From 3b7941ce8ff731e95acf6e458a0fec4d67345090 Mon Sep 17 00:00:00 2001 From: zyk <“zyk@rock-chips.com”> Date: Thu, 20 Mar 2014 16:33:57 +0800 Subject: [PATCH] TP ct36x: reduce init time --- drivers/input/touchscreen/ct36x/core.c | 18 +++++++++--------- drivers/input/touchscreen/ct36x/ct363.c | 17 +++++++++++------ drivers/input/touchscreen/ct36x/ct36x_ts.c | 6 +++--- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/input/touchscreen/ct36x/core.c b/drivers/input/touchscreen/ct36x/core.c index c6c03cc1c77f..33ee074cd69c 100755 --- a/drivers/input/touchscreen/ct36x/core.c +++ b/drivers/input/touchscreen/ct36x/core.c @@ -22,7 +22,7 @@ int ct36x_chip_set_idle(struct ct36x_data *ts) char buf[2] = {0x00, 0xA5}; ret = ct36x_update_write(ts, 0x7F, buf, 2); - mdelay(10); + mdelay(5); return ret; } @@ -33,7 +33,7 @@ static int ct36x_chip_rst_offset(struct ct36x_data *ts) char buf = 0x00; ret =ct36x_update_write(ts, 0x7F, &buf, 1); - mdelay(10); + mdelay(5); return ret; } @@ -201,14 +201,14 @@ int ct36x_chip_get_fwchksum(struct ct36x_data *ts) ret = ct36x_write(ts, buf, 3); if(ret < 0) return ret; - mdelay(20); + mdelay(5); buf[0] = 0x00; buf[1] = 0xE1; ret = ct36x_write(ts, buf, 2); if(ret < 0) return ret; - mdelay(500); + mdelay(330); buf[0] = 0xFF; buf[1] = 0x8E; @@ -216,7 +216,7 @@ int ct36x_chip_get_fwchksum(struct ct36x_data *ts) ret = ct36x_write(ts, buf, 3); if(ret < 0) return ret; - mdelay(20); + mdelay(5); ret = ct36x_chip_rst_offset(ts); if(ret < 0){ @@ -228,7 +228,7 @@ int ct36x_chip_get_fwchksum(struct ct36x_data *ts) if(ret < 0) return ret; - mdelay(20); + mdelay(5); fwchksum = ((buf[0]<<8) | buf[1]); return fwchksum; @@ -246,19 +246,19 @@ int ct36x_chip_get_ver(struct ct36x_data *ts) ret = ct36x_write(ts, buf, 3); if(ret < 0) return ret; - mdelay(10); + mdelay(5); buf[0] = 0x00; ret = ct36x_write(ts, buf, 1); if(ret < 0) return ret; - mdelay(10); + mdelay(5); // do read version ret = ct36x_read(ts, &ver, 1); if(ret < 0) return ret; - mdelay(10); + mdelay(5); return ver; } diff --git a/drivers/input/touchscreen/ct36x/ct363.c b/drivers/input/touchscreen/ct36x/ct363.c index f5e295126bc1..c386f94894d3 100755 --- a/drivers/input/touchscreen/ct36x/ct363.c +++ b/drivers/input/touchscreen/ct36x/ct363.c @@ -53,12 +53,12 @@ static void ct363_deinit_hw(struct ct36x_data *ts) static void ct363_reset_hw(struct ct36x_data *ts) { - gpio_direction_output(ts->rst_io.gpio, ts->rst_io.active_low); - msleep(50); + //gpio_direction_output(ts->rst_io.gpio, ts->rst_io.active_low); + //msleep(50); gpio_set_value(ts->rst_io.gpio, !ts->rst_io.active_low); - msleep(50); + msleep(10); gpio_set_value(ts->rst_io.gpio, ts->rst_io.active_low); - msleep(500); + msleep(230); } static int ct363_init(struct ct36x_data *ts) @@ -73,6 +73,8 @@ static int ct363_init(struct ct36x_data *ts) /* Hardware reset */ ct363_reset_hw(ts); // Get binary Checksum + + #if 1 binchksum = ct36x_chip_get_binchksum(); ct36x_dbg(ts, "CT363 init: binchksum = %d\n", binchksum); @@ -107,9 +109,12 @@ static int ct363_init(struct ct36x_data *ts) } /* Hardware reset */ - ct363_reset_hw(ts); + //ct363_reset_hw(ts); + gpio_set_value(ts->rst_io.gpio, !ts->rst_io.active_low); + msleep(10); + gpio_set_value(ts->rst_io.gpio, ts->rst_io.active_low); msleep(5); - + #endif ts->point_num = CT363_POINT_NUM; ct363 = kzalloc(sizeof(struct ct363_priv), GFP_KERNEL); diff --git a/drivers/input/touchscreen/ct36x/ct36x_ts.c b/drivers/input/touchscreen/ct36x/ct36x_ts.c index 67d0f7f72444..05061ea36931 100755 --- a/drivers/input/touchscreen/ct36x/ct36x_ts.c +++ b/drivers/input/touchscreen/ct36x/ct36x_ts.c @@ -196,7 +196,7 @@ static int ct36x_ts_probe(struct i2c_client *client, const struct i2c_device_id ts->irq_io.gpio = of_get_named_gpio_flags(np, "touch-gpio", 0, (enum of_gpio_flags *)&irq_flags); ts->rst_io.gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &rst_flags); - printk("the irq_flags is %ld,rst_flags is %d\n",irq_flags,rst_flags); + //printk("the irq_flags is %ld,rst_flags is %d\n",irq_flags,rst_flags); ret = of_property_read_u32_array(np, "orientation",orientation,4); if (ret < 0) @@ -217,13 +217,13 @@ static int ct36x_ts_probe(struct i2c_client *client, const struct i2c_device_id if (gpio_is_valid(ts->rst_io.gpio)) { ts->rst_io.active_low = (rst_flags & OF_GPIO_ACTIVE_LOW) ? 0 : 1; - printk("the ts->rst_io.active_low is %d ========\n",ts->rst_io.active_low); + //printk("the ts->rst_io.active_low is %d ========\n",ts->rst_io.active_low); ret = devm_gpio_request_one(&client->dev, ts->rst_io.gpio, (rst_flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, "ct363 reset pin"); if (ret != 0) { dev_err(&client->dev, "ct363 gpio_request error\n"); return -EIO; } - msleep(100); + //msleep(100); } else { dev_info(&client->dev, "reset pin invalid\n"); } -- 2.34.1