Update ektf2136 touch screen driver to 3.0.5 from 3.0.4 based on kernel-dapttion-mrst-2.6.37.6-14.1.src.rpm in meego-table-ia32-1.2.0.90.2.20110601:
1. Add hardware reset function in ektf2136 touch screen driver 2. Replace request_irq to request_threaded_irq 3. Add packet fail counter and debug message 4. Add mutex lock for sleep and resume command Signed-off-by: Mike Hsu <[email protected]> Signed-off-by: Stanley Zeng <[email protected]> Signed-off-by: Scott Liu <[email protected]> --- mrst.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- --- linux-2.6.37/arch/x86/platform/mrst/mrst.old.c 2011-06-01 17:38:17.000000000 +0800 +++ linux-2.6.37/arch/x86/platform/mrst/mrst.c 2011-06-01 17:39:12.000000000 +0800 @@ -559,10 +559,13 @@ struct spi_board_info *spi_info = info; static struct ektf2136_platform_data ektf2136_spi_pdata; int gpio = get_gpio_by_name("ts_int"); + int reset = get_gpio_by_name("ts_reset"); - if (gpio == -1) + if (gpio == -1 || reset == -1) return NULL; + ektf2136_spi_pdata.gpio = gpio; + ektf2136_spi_pdata.reset = reset; spi_info->irq = gpio + MRST_IRQ_OFFSET; spi_info->mode = SPI_MODE_3; spi_info->controller_data = &ektf2136_spi_touch; --- ektf2136.h | 1 + 1 file changed, 1 insertion(+) --- --- linux-2.6.37/include/linux/spi/ektf2136.old.h 2011-06-01 17:39:51.000000000 +0800 +++ linux-2.6.37/include/linux/spi/ektf2136.h 2011-06-01 17:40:16.000000000 +0800 @@ -5,6 +5,7 @@ struct ektf2136_platform_data { int gpio; /* The GPIO pin for the device */ + int reset; /* The HW RESET pin for the device */ }; struct elan_sr_hdr { --- ektf2136_spi.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 7 deletions(-) --- --- linux-2.6.37/drivers/input/touchscreen/ektf2136_spi.old.c 2011-06-01 17:52:12.000000000 +0800 +++ linux-2.6.37/drivers/input/touchscreen/ektf2136_spi.c 2011-06-07 14:40:47.000000000 +0800 @@ -30,11 +30,11 @@ #include <linux/pm_runtime.h> #define DRV_NAME "ektf2136_spi" -#define DRIVER_VERSION "v3.0.4" +#define DRIVER_VERSION "v3.0.5" #define DRV_MA_VER 3 #define DRV_MI_VER 0 -#define DRV_SUB_MI_VER 4 +#define DRV_SUB_MI_VER 5 static const char ELAN_TS_NAME[] = "ektf2136_spi"; @@ -109,6 +109,7 @@ struct elan_data { int intr_gpio; + int reset_gpio; int use_irq; u8 major_fw_version; u8 minor_fw_version; @@ -450,9 +451,11 @@ checksum = checksum%256; - if (checksum != buf[34]) + if (checksum != buf[34]) { + ed->packet_fail++; + dev_dbg(&spi->dev, "elan touch checksum fail: %02x\n", buf[34]); return -EFAULT; - + } return 0; } @@ -472,7 +475,7 @@ status = gpio_get_value(ed->intr_gpio); retry--; msleep(20); - } while (status == 1 && retry > 0); + } while (status != 0 && retry > 0); return (status == 0 ? 0 : -ETIMEDOUT); } @@ -753,6 +756,24 @@ } /** + * elan_touch_hw_reset - reset touch panel + * @spi: our panel + * + * Trigger the hardware reset pin at each touch panel initial stage. + * Caller must hold the mutex + */ +static int elan_touch_hw_reset(struct spi_device *spi) +{ + struct elan_data *ed = spi_get_drvdata(spi); + + gpio_direction_output(ed->reset_gpio, 0); + msleep(100); + gpio_direction_output(ed->reset_gpio, 1); + + return 0; +} + +/** * elan_touch_init - hand shake with touch panel * @spi: our panel * @@ -763,8 +784,14 @@ { u8 buf_recv[4]; struct elan_data *ed = spi_get_drvdata(spi); - int rc = elan_touch_poll(spi); + int rc; + + /* Reset elan_touch_device */ + rc = elan_touch_hw_reset(spi); + if (rc < 0) + return -EINVAL; + rc = elan_touch_poll(spi); if (rc < 0) return -EINVAL; @@ -915,6 +942,8 @@ break; } default: + ed->packet_fail++; + dev_dbg(&spi->dev, "elan touch report data fail: %02x\n", buf[0]); break; } } @@ -1191,7 +1220,7 @@ ed->use_irq = 1; - err = request_irq(spi->irq, elan_touch_ts_interrupt, + err = request_threaded_irq(spi->irq, NULL, elan_touch_ts_interrupt, IRQF_TRIGGER_FALLING, ELAN_TS_NAME, ed); if (err < 0) { @@ -1649,6 +1678,20 @@ } ed->intr_gpio = pdata->gpio; + ed->reset_gpio = pdata->reset; + + if (ed->reset_gpio) { + err = gpio_is_valid(ed->reset_gpio); + if (err < 0) { + dev_dbg(&spi->dev, "elan touch hw reset pin %d is not valid\n", ed->reset_gpio); + goto fail; + } + err = gpio_request(ed->reset_gpio, ELAN_TS_NAME); + if (err < 0) { + dev_dbg(&spi->dev, "elan touch gpio_request fail: %d\n", err); + goto fail; + } + } ed->input = input_allocate_device(); if (ed->input == NULL) { @@ -1783,6 +1826,8 @@ fail: if (ed->input) input_free_device(ed->input); + if (ed->reset_gpio) + gpio_free(ed->reset_gpio); kfree(ed); return err; } @@ -1811,6 +1856,9 @@ else hrtimer_cancel(&ed->timer); + if (ed->reset_gpio) + gpio_free(ed->reset_gpio); + mutex_lock(&ed->mutex); elan_send_soft_reset(spi); mutex_unlock(&ed->mutex); @@ -1836,8 +1884,11 @@ if (ed->protocol & PRO_UPDATE_FW_MODE) return 0; + mutex_lock(&ed->mutex); ret = elan_spi_write_cmd(ed->spi, set_sleep_cmd, sizeof(set_sleep_cmd), "set_sleep_cmd"); + mutex_unlock(&ed->mutex); + if (ret < 0) return ret; @@ -1862,8 +1913,11 @@ if (ed->protocol & PRO_UPDATE_FW_MODE) return 0; + mutex_lock(&ed->mutex); ret = elan_spi_write_cmd(ed->spi, set_active_cmd, sizeof(set_active_cmd), "set_active_cmd"); + mutex_unlock(&ed->mutex); + if (ret < 0) return ret; Best regards, Mike Hsu 徐宗壕 Linux Software, Mobile BG, Wistron Email: [email protected] Tel: 886-2-66123829
linux-2.6.37-ektf-add-hwreset.patch
Description: linux-2.6.37-ektf-add-hwreset.patch
_______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
