From b62e71c35acf7fb488d1c889ed1fe81cf296b1e0 Mon Sep 17 00:00:00 2001 From: Markinus Date: Fri, 15 Oct 2010 16:34:27 +0200 Subject: [PATCH 1/5] htcleo: fixed wrong rpc fix for haret boot --- arch/arm/mach-msm/smd_rpcrouter.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-msm/smd_rpcrouter.c b/arch/arm/mach-msm/smd_rpcrouter.c index 28771d10..413139af 100644 --- a/arch/arm/mach-msm/smd_rpcrouter.c +++ b/arch/arm/mach-msm/smd_rpcrouter.c @@ -143,19 +143,15 @@ static int rpcrouter_send_control_msg(union rr_control_msg *msg) RR("send control message cmd=%d srv.cmd=%d prog=%08x:%x id=%d:%08x\n", msg->cmd, msg->srv.cmd, msg->srv.prog, msg->srv.vers, msg->srv.pid, msg->srv.cid); - if (!(msg->cmd == RPCROUTER_CTRL_CMD_HELLO) && !initialized) { - printk(KERN_ERR "rpcrouter_send_control_msg(): Warning, " - "router not initialized\n"); - return -EINVAL; - } + if (!(msg->cmd == RPCROUTER_CTRL_CMD_HELLO) && !initialized #if defined(CONFIG_MACH_HTCLEO) - if ((msg->cmd == RPCROUTER_CTRL_CMD_BYE) && !initialized && !htcleo_is_nand_boot()) - { + && (!(msg->cmd == RPCROUTER_CTRL_CMD_BYE) && !htcleo_is_nand_boot()) +#endif + ) { printk(KERN_ERR "rpcrouter_send_control_msg(): Warning, " "router not initialized\n"); return -EINVAL; } -#endif hdr.version = RPCROUTER_VERSION; hdr.type = msg->cmd; From 107e05ec286b81ddd971ff908d556b25c082aa44 Mon Sep 17 00:00:00 2001 From: Markinus Date: Fri, 15 Oct 2010 21:25:37 +0200 Subject: [PATCH 2/5] htcleo: add yaffs driver in kernel Used same options as other devices --- arch/arm/configs/htcleo_defconfig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/arm/configs/htcleo_defconfig b/arch/arm/configs/htcleo_defconfig index c6697304..ff9e0087 100644 --- a/arch/arm/configs/htcleo_defconfig +++ b/arch/arm/configs/htcleo_defconfig @@ -1642,20 +1642,16 @@ CONFIG_MISC_FILESYSTEMS=y # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_EFS_FS is not set -CONFIG_YAFFS_FS=m +CONFIG_YAFFS_FS=y CONFIG_YAFFS_YAFFS1=y # CONFIG_YAFFS_9BYTE_TAGS is not set # CONFIG_YAFFS_DOES_ECC is not set CONFIG_YAFFS_YAFFS2=y CONFIG_YAFFS_AUTO_YAFFS2=y -CONFIG_YAFFS_DISABLE_TAGS_ECC=y +# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set # CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set # CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y -# CONFIG_YAFFS_EMPTY_LOST_AND_FOUND is not set -CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING=y -# CONFIG_YAFFS_DISABLE_BACKGROUND is not set -CONFIG_YAFFS_XATTR=y # CONFIG_JFFS2_FS is not set # CONFIG_CRAMFS is not set CONFIG_SQUASHFS=y From 2e7b49e61bf416e34b718a6d41e3ca7ec528b7a9 Mon Sep 17 00:00:00 2001 From: Markinus Date: Fri, 15 Oct 2010 23:45:40 +0200 Subject: [PATCH 3/5] htcleo: add a bit more stable lightsensor steps Credits to Curious --- arch/arm/mach-msm/board-htcleo-ls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-msm/board-htcleo-ls.c b/arch/arm/mach-msm/board-htcleo-ls.c index f5e176d0..206dff4c 100644 --- a/arch/arm/mach-msm/board-htcleo-ls.c +++ b/arch/arm/mach-msm/board-htcleo-ls.c @@ -56,7 +56,7 @@ user may be able to adjust time in future static uint16_t lsensor_adc_table[10] = { - 0, 10, 30, 60, 100, 160, 250, 355, 465, 598 + 0, 5, 20, 70, 150, 240, 330, 425, 515, 590 }; From ecba5ca2dc9d1c1e76ae8ee77c7a6a2559b49cb1 Mon Sep 17 00:00:00 2001 From: Markinus Date: Fri, 15 Oct 2010 23:47:49 +0200 Subject: [PATCH 4/5] htcleo: add interface for microps autobacklight functionality --- arch/arm/mach-msm/board-htcleo-bl-led.c | 61 ++++++++++++++++++++----- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-msm/board-htcleo-bl-led.c b/arch/arm/mach-msm/board-htcleo-bl-led.c index d2ccd0ee..54dbf099 100644 --- a/arch/arm/mach-msm/board-htcleo-bl-led.c +++ b/arch/arm/mach-msm/board-htcleo-bl-led.c @@ -38,6 +38,49 @@ #endif static struct led_trigger *htcleo_lcd_backlight; +static int auto_bl_state=0; + +int htcleo_brightness_autobacklight(uint8_t value) +{ + int ret; + uint8_t data[2]; + + LCMDBG("%s:(%d)\n", __func__, value); + if(value!=0 && value!=1) return -1; + + data[0] = 1; + data[1] = value; + ret = microp_i2c_write(MICROP_I2C_WCMD_AUTO_BL_CTL, data, 2); + if (ret != 0) { + pr_err("%s: set auto light sensor fail\n", __func__); + return ret; + } + auto_bl_state=value; + return 0; +} +EXPORT_SYMBOL(htcleo_brightness_autobacklight); + +static ssize_t htcleo_auto_bl_get(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int ret; + ret = sprintf(buf, "%d", auto_bl_state); + return ret; +} + +static ssize_t htcleo_auto_bl_set(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int set_state; + sscanf(buf, "%d", &set_state); + if(set_state!=0 && set_state!=1) return -EINVAL; + htcleo_brightness_autobacklight(set_state); + return count; +} + + +static DEVICE_ATTR(auto_bl, 0644, htcleo_auto_bl_get, htcleo_auto_bl_set); int htcleo_brightness_onoff_bkl(int enable) { @@ -54,26 +97,17 @@ int htcleo_brightness_onoff_bkl(int enable) int htcleo_brightness_set_bkl(uint8_t value) { int ret; - uint8_t cmd[2], data[2]; + uint8_t cmd[2]; - LCMDBG("microp_set_bkl(%d)\n", value); + LCMDBG("%s:(%d)\n", __func__, value); if (value > 9) { value = 9; } - // disable autobrigtness -// CotullaTEST: Lsensor test, add 0x100 -// data[0] = 0; - data[0] = 1; - data[1] = 0; - ret = microp_i2c_write(MICROP_I2C_WCMD_AUTO_BL_CTL, data, 2); // 23 - if (ret != 0) - pr_err("%s: set auto light sensor fail\n", __func__); // setvalue cmd[0] = value << 4; -// printk("22LEVEL %02X\n", cmd[0]); ret = microp_i2c_write(MICROP_I2C_WCMD_LCM_BL_MANU_CTL, cmd, 1); // 22 if (ret < 0) { @@ -112,6 +146,7 @@ static struct led_classdev htcleo_backlight_led = static int htcleo_backlight_probe(struct platform_device *pdev) { int rc; + rc = device_create_file(&pdev->dev, &dev_attr_auto_bl); printk(KERN_INFO "%s: HTCLeo Backlight connect with microP: " "Probe\n", __func__); @@ -119,12 +154,14 @@ static int htcleo_backlight_probe(struct platform_device *pdev) rc = led_classdev_register(&pdev->dev, &htcleo_backlight_led); if (rc) LCMDBG("HTCLeo Backlight: failure on register led_classdev\n"); - return 0; + htcleo_brightness_autobacklight(0); + return rc; } static int htcleo_backlight_remove(struct platform_device *pdev) { + device_remove_file(&pdev->dev, &dev_attr_auto_bl); return 0; } From 3995d03e1cf02ec26fe578b90f5c1293fde02ccb Mon Sep 17 00:00:00 2001 From: Markinus Date: Sat, 16 Oct 2010 01:26:12 +0200 Subject: [PATCH 5/5] htcleo: add sysfs microp auto backlight interface With /sys/devices/platform/htcleo-backlight/auto_bl can it be enabled/disabled (1/0) --- arch/arm/mach-msm/board-htcleo-bl.c | 31 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-msm/board-htcleo-bl.c b/arch/arm/mach-msm/board-htcleo-bl.c index 7d7525f3..edb44b04 100644 --- a/arch/arm/mach-msm/board-htcleo-bl.c +++ b/arch/arm/mach-msm/board-htcleo-bl.c @@ -41,6 +41,24 @@ #define HTCLEO_MAX_BRIGHTNESS 255 +int htcleo_brightness_autobacklight(uint8_t value) +{ + int ret; + uint8_t data[2]; + + LCMDBG("%s:(%d)\n", __func__, value); + + data[0] = 1; + data[1] = value; + ret = microp_i2c_write(MICROP_I2C_WCMD_AUTO_BL_CTL, data, 2); + if (ret != 0) + pr_err("%s: set auto light sensor fail\n", __func__); + + + return ret; +} +EXPORT_SYMBOL(htcleo_brightness_autobacklight); + int htcleo_brightness_onoff_bkl(int enable) { int ret; @@ -56,7 +74,7 @@ int htcleo_brightness_onoff_bkl(int enable) int htcleo_brightness_set_bkl(uint8_t value) { int ret; - uint8_t cmd[2], data[2]; + uint8_t cmd[2]; LCMDBG("microp_set_bkl(%d)\n", value); @@ -64,18 +82,9 @@ int htcleo_brightness_set_bkl(uint8_t value) { value = 9; } - // disable autobrigtness -// CotullaTEST: Lsensor test, add 0x100 -// data[0] = 0; - data[0] = 1; - data[1] = 0; - ret = microp_i2c_write(MICROP_I2C_WCMD_AUTO_BL_CTL, data, 2); // 23 - if (ret != 0) - pr_err("%s: set auto light sensor fail\n", __func__); // setvalue cmd[0] = value << 4; -// printk("22LEVEL %02X\n", cmd[0]); ret = microp_i2c_write(MICROP_I2C_WCMD_LCM_BL_MANU_CTL, cmd, 1); // 22 if (ret < 0) { @@ -127,6 +136,8 @@ static struct backlight_ops htcleo_backlight_ops = static int htcleo_backlight_probe(struct platform_device *pdev) { struct backlight_device *bd; + ret = device_create_file(&client->dev, &dev_attr_reset); + bd = backlight_device_register("htcleo-backlight", &pdev->dev, NULL, &htcleo_backlight_ops); bd->props.max_brightness = HTCLEO_MAX_BRIGHTNESS; bd->props.brightness = HTCLEO_MAX_BRIGHTNESS;