diffing kj4 - kj6 kernels

fards

Inactive Recognized Developer
Nov 17, 2005
7,104
1,818
253
Currently Reverse Engineering 42
as kj6 is supposed to bring some bug fixes, I thought I'd check the kernel source.

there's not a huge amount of difference, but some looks interesting, hopefully of use to anyone wanting to building it.


Code:
--- drivers/input/touchscreen/mxt540e.c	2011-10-20 02:58:48.000000000 
+++ drivers/input/touchscreen/mxt540e.c	2011-10-25 17:58:10.000000000 
@@ -907,16 +907,16 @@
 		}
 
 		if (object_type == PROCG_NOISESUPPRESSION_T48) {
 			if (msg[4] == 5) { /* Median filter error */
 				printk("[TSP] Median filter Error\n");
 				get_object_info(data, PROCG_NOISESUPPRESSION_T48, &size, &obj_address);
-				value = data->calcfg_batt_e;
+				value = 0;
 				error = write_mem(data, obj_address+2, 1, &value);
-				msleep(5);
-				value |= 0x20;
+				msleep(15);
+				value = data->calcfg_batt_e;
 				error |= write_mem(data, obj_address+2, 1, &value);
 				if(error) printk(KERN_ERR "[TSP] failed to reenable CHRGON\n");
 			}
 		}
 
 		if (object_type == TOUCH_MULTITOUCHSCREEN_T9) {
Code:
--- drivers/input/keyboard/cypress/cypress-touchkey.c	2011-10-20 02:58:48.000000000 
+++ drivers/input/keyboard/cypress/cypress-touchkey.c	2011-10-25 17:58:10.000000000 
@@ -1909,18 +1909,20 @@
 	int ret = 0;
 
 #ifdef TEST_JIG_MODE
 	unsigned char get_touch = 0x40;
 #endif
 
+#ifndef CONFIG_MACH_Q1_REV02
 	if (gpio_request(_3_TOUCH_SDA_28V, "_3_TOUCH_SDA_28V"))
 		WARN(1, "Fail to request gpio (_3_TOUCH_SDA_28V)\n");
 	if (gpio_request(_3_TOUCH_SCL_28V, "_3_TOUCH_SCL_28V"))
 		WARN(1, "Fail to request gpio (_3_TOUCH_SCL_28V)\n");
 	if (gpio_request(_3_GPIO_TOUCH_EN, "_3_GPIO_TOUCH_EN"))
 		WARN(1, "Fail to request gpio (_3_GPIO_TOUCH_EN)\n");
+#endif
 	if (gpio_request(_3_GPIO_TOUCH_INT, "_3_GPIO_TOUCH_INT"))
 		WARN(1, "Fail to request gpio (_3_GPIO_TOUCH_INT)\n");
 
 	/*20110222 N1_firmware_sync*/
 	sec_touchkey = device_create(sec_class, NULL, 0, NULL, "sec_touchkey");
 
@@ -2212,18 +2214,20 @@
 	misc_deregister(&touchkey_update_device);
 
 	if (touchkey_wq) {
 		destroy_workqueue(touchkey_wq);
 	}
 
+#ifndef CONFIG_MACH_Q1_REV02
 	gpio_free(_3_TOUCH_SDA_28V);
 	gpio_free(_3_TOUCH_SCL_28V);
 	gpio_free(_3_GPIO_TOUCH_EN);
+#endif
 	gpio_free(_3_GPIO_TOUCH_INT);
 }
 
 late_initcall(touchkey_init);
 module_exit(touchkey_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("@@@");
 MODULE_DESCRIPTION("melfas touch keypad");
 

fards

Inactive Recognized Developer
Nov 17, 2005
7,104
1,818
253
Currently Reverse Engineering 42
Code:
--- drivers/leds/leds-max8997.c	2011-10-20 02:58:48.000000000 
+++ drivers/leds/leds-max8997.c	2011-10-25 17:58:10.000000000 
@@ -242,19 +242,30 @@
 	regulator_led_disable(led);
 	regulator_put(led->vcc);
 	kfree(led);
 	return 0;
 }
 
+static void regulator_led_shutdown(struct platform_device *pdev)
+{
+	struct regulator_led *led = platform_get_drvdata(pdev);
+
+	if (regulator_is_enabled(led->vcc)) {
+		regulator_led_disable(led);
+	}
+	return;
+}
+
 static struct platform_driver regulator_led_driver = {
 	.driver = {
 		   .name  = "leds-max8997",
 		   .owner = THIS_MODULE,
 		   },
 	.probe  = regulator_led_probe,
 	.remove = __devexit_p(regulator_led_remove),
+	.shutdown = regulator_led_shutdown,
 };
 
 static int __init regulator_led_init(void)
 {
 	return platform_driver_register(&regulator_led_driver);
 }

Code:
--- drivers/media/video/samsung/mali/common/mali_kernel_mem_os.c	2011-10-20 02:58:48.000000000 
+++ drivers/media/video/samsung/mali/common/mali_kernel_mem_os.c	2011-10-25 17:58:10.000000000 
@@ -251,12 +251,13 @@
 	{
 		if ( allocation_order > 0 ) {
 			--allocation_order;
 		} else {
 			/* return OOM */
 			_mali_osk_lock_signal(info->mutex, _MALI_OSK_LOCKMODE_RW);
+			MALI_PRINT(("Failed to allocate consistent memory in all sizes.\n"));
 			return MALI_MEM_ALLOC_NONE;
 		}
 	}
 
 	/* try to allocate 2^(allocation_order) pages, if that fails, try
 	* allocation_order-1 to allocation_order 0 (inclusive) */
@@ -270,18 +271,21 @@
 		--allocation_order;
 	}
 
 	if ( NULL == virt )
 	{
 		MALI_DEBUG_PRINT(1, ("Failed to allocate consistent memory. Is CONSISTENT_DMA_SIZE set too low?\n"));
+		MALI_PRINT(("Failed to allocate consistent memory. Is CONSISTENT_DMA_SIZE set too low?\n"));
 		/* return OOM */
 		_mali_osk_lock_signal(info->mutex, _MALI_OSK_LOCKMODE_RW);
 		return MALI_MEM_ALLOC_NONE;
 	}
 
 	MALI_DEBUG_PRINT(5, ("os_allocator_allocate_page_table_block: Allocation of order %i succeeded\n",
+				allocation_order));
+	MALI_PRINT(("os_allocator_allocate_page_table_block: Allocation of order %i succeeded\n",
 				allocation_order));
 
 	/* we now know the size of the allocation since we know for what
 	 * allocation_order the allocation succeeded */
 	size = _MALI_OSK_CPU_PAGE_SIZE << allocation_order;
 

fards

Inactive Recognized Developer
Nov 17, 2005
7,104
1,818
253
Currently Reverse Engineering 42
Code:
--- drivers/media/video/m5mo.c	2011-10-20 02:58:48.000000000 
+++ drivers/media/video/m5mo.c	2011-10-25 17:58:10.000000000 
@@ -1707,13 +1707,13 @@
 }
 #endif
 
 static int m5mo_set_touch_auto_focus(struct v4l2_subdev *sd, int val)
 {
 	struct m5mo_state *state = to_state(sd);
-	int err = -EINVAL;
+	int err; 
 	cam_info("%s\n", val ? "start" : "stop");
 
 	state->focus.touch = val;
 
 	if (val) {
 		err = m5mo_set_af_mode(sd, FOCUS_MODE_TOUCH);
@@ -1727,13 +1727,13 @@
 		err = m5mo_writew(sd, M5MO_CATEGORY_LENS,
 				M5MO_LENS_AF_TOUCH_POSY, state->focus.pos_y);
 		CHECK_ERR(err);
 	}
 
 	cam_trace("X\n");
-	return err;
+	return 0;
 }
 
 static int m5mo_set_zoom(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 {
 	struct m5mo_state *state = to_state(sd);
 	struct v4l2_queryctrl qc = {0,};
 

fards

Inactive Recognized Developer
Nov 17, 2005
7,104
1,818
253
Currently Reverse Engineering 42
Code:
--- drivers/power/smb328_charger.c	2011-10-20 02:58:49.000000000 
+++ drivers/power/smb328_charger.c	2011-10-25 17:58:10.000000000 
@@ -820,18 +820,26 @@
 {
 	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
 	struct smb328_chip *chip;
 	int ret = 0;
 	int gpio = 0;
 	u8 data;
+	int i;
 
-	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
-		return -EIO;
+	i = 10;
+	while (1) {
+		if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
+			goto I2CERROR;
 
-	if (smb328_i2c_read(client, 0x36, &data)<0)	/* check HW */
-		return -EIO;
+		if (smb328_i2c_read(client, 0x36, &data)>=0)	/* check HW */
+			break;
+
+I2CERROR:
+		if (!i--) return -EIO;
+		msleep(300);
+	}
 
 	dev_info(&client->dev, "%s : SMB328 Charger Driver Loading\n", __func__);
 
 	chip = kzalloc(sizeof(struct smb328_chip), GFP_KERNEL);
 	if (!chip)
 		return -ENOMEM;
 

fards

Inactive Recognized Developer
Nov 17, 2005
7,104
1,818
253
Currently Reverse Engineering 42
Code:
--- drivers/video/samsung/s3cfb_s6e8aa0.c	2011-10-20 02:58:50.000000000 
+++ drivers/video/samsung/s3cfb_s6e8aa0.c	2011-10-25 17:58:10.000000000 
@@ -1009,19 +1009,27 @@
 	return 0;
 }
 
 int s6e8ax0_read_mtp(struct lcd_info *lcd, u8 *mtp_data)
 {
 	int ret;
+	u8 retry_cnt = 3;
 
 	s6e8ax0_write(lcd, enable_mtp_register, ARRAY_SIZE(enable_mtp_register));
+
+read_retry:
 	ret = s6e8ax0_read(lcd, LDI_MTP_ADDR, LDI_MTP_LENGTH, mtp_data);
 	if (!ret) {
-		printk("ERROR:MTP read failed\n");
-		return 0;
+		if (retry_cnt) {
+			printk("[WARN:LCD] : %s : retry cnt : %d\n", __func__, retry_cnt);
+			retry_cnt--;
+			goto read_retry;
+		} else
+			printk("ERROR:MTP read failed\n");
 	}
+
 	s6e8ax0_write(lcd, disable_mtp_register, ARRAY_SIZE(disable_mtp_register));
 	return ret;
 }
 #endif
 
 static ssize_t lcdtype_show(struct device *dev, struct
@@ -1228,12 +1236,13 @@
 	struct s5p_platform_dsim *pd = (struct s5p_platform_dsim *)pdev->dev.platform_data;
 #endif
 #ifdef SMART_DIMMING
 	u8 mtp_data[LDI_MTP_LENGTH] = {0,};
 	u32 i;
 	u8 id_buf[3] = {0,};
+	u8 retry_cnt = 3;
 #endif
 
 	lcd = kzalloc(sizeof(struct lcd_info), GFP_KERNEL);
 	if (!lcd) {
 		pr_err("failed to allocate for lcd\n");
 		ret = -ENOMEM;
@@ -1330,17 +1339,24 @@
 
 	dev_info(&lcd->ld->dev, "s6e8aa0 lcd panel driver has been probed.\n");
 
 #ifdef SMART_DIMMING
 	mutex_init(&lcd->bl_lock);
 
-	//read mpt
+read_retry:
 	ret = s6e8ax0_read(lcd, PANEL_ID_COMMAND, 3, id_buf);
 	if (!ret) {
-		printk("[LCD:ERROR] : %s read id failed\n", __func__);
-		//return -1;
+		if (retry_cnt) {
+			printk("[WARN:LCD] : %s : retry cnt : %d\n", __func__, retry_cnt);
+			retry_cnt--;
+			goto read_retry;
+		} else {
+			printk("[ERROR:LCD] : %s : Read ID Failed\n", __func__);
+			/*To protect ELVSS Wrong Operation*/
+			id_buf[2] = 0x33;
+		}
 	}
 
 	printk("Read ID : %x, %x, %x\n", id_buf[0], id_buf[1], id_buf[2]);
 
 	if (id_buf[2] == 0x33) {
 		lcd->support_elvss = 0;
@@ -1361,22 +1377,23 @@
 
 	init_table_info(&lcd->smart);
 
 	ret = s6e8ax0_read_mtp(lcd, mtp_data);
 	if (!ret) {
 		printk("[LCD:ERROR] : %s read mtp failed\n", __func__);
-		//return -1;
+		lcd->connected = 0;
+		dev_info(&lcd->ld->dev, "panel is not connected well\n");
+		/*return -1;*/
 	}
 
 	calc_voltage_table(&lcd->smart, mtp_data);
 
 	s6e8ax0_adb_brightness_update(lcd, lcd->bd->props.brightness, 1);
 #endif
 
-	if (id_buf[0] == 0xa2) {
-		lcd->connected = 1;
+	if (lcd->connected) {
 		INIT_DELAYED_WORK(&hs_clk_re_try, hs_clk_re_try_work);
 
 		lcd->irq = gpio_to_irq(GPIO_OLED_DET);
 
 		s3c_gpio_cfgpin(GPIO_OLED_DET, S3C_GPIO_SFN(0xf));
 		s3c_gpio_setpull(GPIO_OLED_DET, S3C_GPIO_PULL_NONE);
@@ -1384,15 +1401,12 @@
 
 		if (request_irq(lcd->irq, oled_det_int, IRQF_TRIGGER_FALLING, "vgh_toggle", 0)) {
 			pr_err("failed to reqeust irq. %d\n", lcd->irq);
 			ret = -EINVAL;
 			goto out_free_backlight;
 		}
-	} else {
-		lcd->connected = 0;
-		dev_info(&lcd->ld->dev, "panel is not connected\n");
 	}
 
 	return 0;
 
 out_free_backlight:
 	lcd_device_unregister(lcd->ld);
 

fards

Inactive Recognized Developer
Nov 17, 2005
7,104
1,818
253
Currently Reverse Engineering 42
Code:
--- drivers/video/samsung/s5p-dsim.c	2011-10-20 02:58:50.000000000 
+++ drivers/video/samsung/s5p-dsim.c	2011-10-25 17:58:10.000000000 
@@ -115,13 +115,13 @@
 #define MIPI_CMD_GENERIC_RD_2		0x24
 
 #define MIPI_CMD_DSI_RD_0			0x06
 
 #define MIPI_CMD_DSI_SET_PKT_SZ		0x37
 
-#define MIPI_RX_TIMEOUT			HZ
+#define MIPI_RX_TIMEOUT			msecs_to_jiffies(250)
 #define DSMI_RX_FIFO_READ_DONE		0x30800002
 #define DSIM_MAX_RX_FIFO			20
 
 #define S5P_DSIM_INT_SFR_FIFO_EMPTY		29
 #define S5P_DSIM_INT_BTA			25
 #define S5P_DSIM_INT_MSK_FRAME_DONE		24
@@ -358,13 +358,13 @@
 	}
 
 	rxhd = readl(reg_base + S5P_DSIM_RXFIFO);
 	printk("rxhd : %x\n", rxhd);
 	if ((u8)(rxhd & 0xff) != response) {
 		printk(KERN_ERR "[DSIM:ERROR]:%s wrong response rxhd : %x, response:%x\n"
-		    ,__func__, rxhd, response);
+		    , __func__, rxhd, response);
 		goto clear_rx_fifo;
 	}
 	// for short packet
 	if (count <= 2) {
 		for (i = 0; i < count; i++)
 			buf[i] = (rxhd >> (8+(i*8))) & 0xff;
@@ -379,21 +379,21 @@
 			goto clear_rx_fifo;
 		}
 
 		for (i = 0; i < rxsize>>2; i++) {
 			temp = readl(reg_base + S5P_DSIM_RXFIFO);
 			printk("pkt : %08x\n", temp);
-			for(j=0; j < 4; j++) {
+			for (j = 0; j < 4; j++) {
 				buf[(i*4)+j] = (u8)(temp>>(j*8))&0xff;
 				//printk("Value : %02x\n",(temp>>(j*8))&0xff);
 			}
 		}
 		if (rxsize % 4) {
 			temp = readl(reg_base + S5P_DSIM_RXFIFO);
 			printk("pkt-l : %08x\n", temp);
-			for(j=0; j < rxsize%4; j++) {
+			for (j = 0; j < rxsize%4; j++) {
 				buf[(i*4)+j] = (u8)(temp>>(j*8))&0xff;
 				//printk("Value : %02x\n",(temp>>(j*8))&0xff);
 			}
 		}
 	}
 
@@ -1089,30 +1089,30 @@
 
 	writel(int_stat, dsim.reg_base + S5P_DSIM_INTMSK);
 }
 
 int s5p_dsim_fifo_clear(void)
 {
-	int dsim_count=0,ret;
+	int dsim_count = 0, ret;
 
 	writel(SwRstRelease, dsim.reg_base + S5P_DSIM_INTSRC);
-	
+
 	writel(DSIM_FUNCRST, dsim.reg_base + S5P_DSIM_SWRST);
-	do{
-		if(++dsim_count>90000){
-			printk("dsim fifo clear fail re_try dsim resume\n");			
-			ret=0;
+	do {
+		if (++dsim_count > 90000) {
+			printk("dsim fifo clear fail re_try dsim resume\n");
+			ret = 0;
 			break;
-		}			
-		
-		if(readl(dsim.reg_base + S5P_DSIM_INTSRC) & SwRstRelease){
-			s5p_dsim_interrupt_mask_set();			
-			ret=1;
+		}
+
+		if (readl(dsim.reg_base + S5P_DSIM_INTSRC) & SwRstRelease) {
+			s5p_dsim_interrupt_mask_set();
+			ret = 1;
 			break;
 		}
-	}while(1);	
+	} while (1);
 
 	return ret;
 }
 
 #ifdef CONFIG_HAS_EARLYSUSPEND
 void s5p_dsim_early_suspend(void)
@@ -1140,24 +1140,24 @@
 
 	if (dsim.mipi_drv->suspend)
 		dsim.mipi_drv->suspend(dsim.dev, state);
 
 	if (dsim.mipi_ddi_pd->lcd_power_on)
 		dsim.mipi_ddi_pd->lcd_power_on(dsim.dev, 0);
-	
+
 	s5p_dsim_enable_hs_clock(dsim.reg_base, 0);
 	s5p_dsim_set_clock(dsim.reg_base, dsim.dsim_info->e_byte_clk, 0);
-	
+
 	writel(0xffff, dsim.reg_base + S5P_DSIM_CLKCTRL);
 	writel(0x0, dsim.reg_base + S5P_DSIM_PLLCTRL);
 	writel(0x0, dsim.reg_base + S5P_DSIM_PLLTMR);
 	writel(0x0, dsim.reg_base + S5P_DSIM_PHYACCHR);
-	writel(0x0, dsim.reg_base + S5P_DSIM_PHYACCHR1);  
+	writel(0x0, dsim.reg_base + S5P_DSIM_PHYACCHR1);
 
 	writel(0x1, dsim.reg_base + S5P_DSIM_SWRST);
-	
+
 	clk_disable(dsim.clock);
 
 #if 0
 	if (dsim.pd->mipi_power)
 		dsim.pd->mipi_power(0);
 	else
 

fards

Inactive Recognized Developer
Nov 17, 2005
7,104
1,818
253
Currently Reverse Engineering 42
Code:
--- drivers/video/samsung/s6e8aa0_param.h	2011-10-20 02:58:50.000000000 
+++ drivers/video/samsung/s6e8aa0_param.h	2011-10-25 17:58:10.000000000 
@@ -66,13 +66,14 @@
 static const unsigned char SEQ_APPLY_LEVEL_2_KEY[] = {
 	0xFC,
 	0x5A, 0x5A
 };
 
 static const unsigned char SEQ_SLEEP_OUT[] = {
-	0x11
+	0x11,
+	0x00,0x00	
 };
 
 static const unsigned char SEQ_PANEL_CONDITION_SET[] = {
 	0xF8,
 	0x25, 0x34, 0x00, 0x00, 0x00, 0x95, 0x00, 0x3C, 0x7D, 0x08,
 	0x27, 0x00, 0x00, 0x10, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00,
@@ -83,13 +84,14 @@
 static const unsigned char SEQ_DISPLAY_CONDITION_SET[] = {
 	0xF2,
 	0x80, 0x03, 0x0D
 };
 
 static const unsigned char SEQ_GAMMA_UPDATE[] = {
-	0xF7, 0x03
+	0xF7, 0x03,
+	0x00		
 };
 
 static const unsigned char SEQ_ETC_SOURCE_CONTROL[] = {
 	0xF6,
 	0x00, 0x02, 0x00
 };
@@ -116,30 +118,35 @@
 	0x14, 0x40, 0x0C, 0xCB, 0xCE,
 	0x6E, 0xC4, 0x0F, 0x40, 0x41,
 	0xD9, 0x00, 0x00, 0x00
 };
 
 static const unsigned char SEQ_DISPLAY_ON[] = {
-	0x29
+	0x29,
+	0x00,0x00	
 };
 
 static const unsigned char SEQ_DISPLAY_OFF[] = {
-	0x28
+	0x28,
+	0x00,0x00		
 };
 
 static const unsigned char SEQ_STANDBY_ON[] = {
-	0x01
+	0x01,
+	0x00,0x00		
 };
 
 
 static const unsigned char SEQ_ACL_ON[] = {
 	0xC0, 0x01,
+	0x00		
 };
 
 static const unsigned char SEQ_ACL_OFF[] = {
 	0xC0, 0x00,
+	0x00		
 };
 
 static const unsigned char SEQ_ACL_CUTOFF_20[] = {
 	0xC1,
 	0x47, 0x53, 0x13, 0x53, 0x00,
 	0x00, 0x03, 0x1F, 0x00, 0x00,
 

netchip

Senior Member
Sep 2, 2011
1,154
630
0
and they changed to codesourcery for toolchain

+CROSS_COMPILE ?= /opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi-


Not a massive amount of differences, the screen driver changes looks most interesting to me.
Is there a new kernel source?

Sent from my GT-I9100
 

The_Steph

Senior Member
Mar 20, 2007
885
361
0
Paris
Not a massive amount of differences, the screen driver changes looks most interesting to me.
Maybe that diff solves my screen issue.

Just to explain, sometimes my screen does not wake up even if the phone is still running (long pressing the on/off button makes the phone vibrate which means that it is still working) and when I hard reboot it (8 seconds long on/off button press), it restarts and in the battery usage I can see that the phone has been awake for a long time instead of having been idle (when it happens, it is generally during the night).

As I am facing it globally (with both European stock and Hong Kong ROMs), I hope this kernel change corrects it.
 

fards

Inactive Recognized Developer
Nov 17, 2005
7,104
1,818
253
Currently Reverse Engineering 42
Maybe that diff solves my screen issue.

Just to explain, sometimes my screen does not wake up even if the phone is still running (long pressing the on/off button makes the phone vibrate which means that it is still working) and when I hard reboot it (8 seconds long on/off button press), it restarts and in the battery usage I can see that the phone has been awake for a long time instead of having been idle (when it happens, it is generally during the night).

As I am facing it globally (with both European stock and Hong Kong ROMs), I hope this kernel change corrects it.
I've seen the same thing a couple of times. Still haven't tested the KJ6 kernel to see the effect of those patches yet.
 

The_Steph

Senior Member
Mar 20, 2007
885
361
0
Paris
KJ6, where did you get it?

Edit: I have Baseband version N7000XXKJ6 but Kernel N7000ZSKK1. Is is this version you are talking about?
 
Last edited:

The_Steph

Senior Member
Mar 20, 2007
885
361
0
Paris
Basically, what you did is you installed KJ6 kernel, rooted it and install the kernel you built?

If yes, do you mind, allowing me to download the kernel you built in order to use it?