Skip to content

Commit 27cef8b

Browse files
mminddtor
authored andcommitted
Input: auo-pixcir-ts - handle reset gpio directly
Devicetree based platforms don't handle device callbacks very well and until now no board has come along that needs more extended hwinit than pulling the rst gpio high. Therefore pull the reset handling directly into the driver and remove the callbacks from the driver. If extended device setup is needed at some later point, power-sequences would probably be the solution of choice. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent fa65630 commit 27cef8b

2 files changed

Lines changed: 21 additions & 9 deletions

File tree

drivers/input/touchscreen/auo-pixcir-ts.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,21 @@ static int auo_pixcir_probe(struct i2c_client *client,
511511
goto err_gpio_dir;
512512
}
513513

514-
if (pdata->init_hw)
515-
pdata->init_hw(client);
514+
ret = gpio_request(pdata->gpio_rst, "auo_pixcir_ts_rst");
515+
if (ret) {
516+
dev_err(&client->dev, "request of gpio %d failed, %d\n",
517+
pdata->gpio_rst, ret);
518+
goto err_gpio_dir;
519+
}
520+
521+
ret = gpio_direction_output(pdata->gpio_rst, 1);
522+
if (ret) {
523+
dev_err(&client->dev, "setting direction of gpio %d failed %d\n",
524+
pdata->gpio_rst, ret);
525+
goto err_gpio_rst;
526+
}
527+
528+
msleep(200);
516529

517530
ts->client = client;
518531
ts->touch_ind_mode = 0;
@@ -597,8 +610,9 @@ static int auo_pixcir_probe(struct i2c_client *client,
597610
err_fw_vers:
598611
input_free_device(input_dev);
599612
err_input_alloc:
600-
if (pdata->exit_hw)
601-
pdata->exit_hw(client);
613+
gpio_set_value(pdata->gpio_rst, 0);
614+
err_gpio_rst:
615+
gpio_free(pdata->gpio_rst);
602616
err_gpio_dir:
603617
gpio_free(pdata->gpio_int);
604618
err_gpio_int:
@@ -616,8 +630,8 @@ static int auo_pixcir_remove(struct i2c_client *client)
616630

617631
input_unregister_device(ts->input);
618632

619-
if (pdata->exit_hw)
620-
pdata->exit_hw(client);
633+
gpio_set_value(pdata->gpio_rst, 0);
634+
gpio_free(pdata->gpio_rst);
621635

622636
gpio_free(pdata->gpio_int);
623637

include/linux/input/auo-pixcir-ts.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@
4343
*/
4444
struct auo_pixcir_ts_platdata {
4545
int gpio_int;
46+
int gpio_rst;
4647

4748
int int_setting;
4849

49-
void (*init_hw)(struct i2c_client *);
50-
void (*exit_hw)(struct i2c_client *);
51-
5250
unsigned int x_max;
5351
unsigned int y_max;
5452
};

0 commit comments

Comments
 (0)