From: "Heiko Stübner" <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
To: Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 2/4] Input: auo-pixcir-ts - handle reset gpio directly
Date: Sat, 23 Feb 2013 12:56:48 +0100 [thread overview]
Message-ID: <201302231256.48476.heiko@sntech.de> (raw)
In-Reply-To: <201302231255.23772.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
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-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
drivers/input/touchscreen/auo-pixcir-ts.c | 26 ++++++++++++++++++++------
include/linux/input/auo-pixcir-ts.h | 4 +---
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c
index 813413e..6317a9c 100644
--- a/drivers/input/touchscreen/auo-pixcir-ts.c
+++ b/drivers/input/touchscreen/auo-pixcir-ts.c
@@ -511,8 +511,21 @@ static int auo_pixcir_probe(struct i2c_client *client,
goto err_gpio_dir;
}
- if (pdata->init_hw)
- pdata->init_hw(client);
+ ret = gpio_request(pdata->gpio_rst, "auo_pixcir_ts_rst");
+ if (ret) {
+ dev_err(&client->dev, "request of gpio %d failed, %d\n",
+ pdata->gpio_rst, ret);
+ goto err_gpio_dir;
+ }
+
+ ret = gpio_direction_output(pdata->gpio_rst, 1);
+ if (ret) {
+ dev_err(&client->dev, "setting direction of gpio %d failed %d\n",
+ pdata->gpio_rst, ret);
+ goto err_gpio_rst;
+ }
+
+ msleep(200);
ts->client = client;
ts->touch_ind_mode = 0;
@@ -597,8 +610,9 @@ err_input_register:
err_fw_vers:
input_free_device(input_dev);
err_input_alloc:
- if (pdata->exit_hw)
- pdata->exit_hw(client);
+ gpio_set_value(pdata->gpio_rst, 0);
+err_gpio_rst:
+ gpio_free(pdata->gpio_rst);
err_gpio_dir:
gpio_free(pdata->gpio_int);
err_gpio_int:
@@ -616,8 +630,8 @@ static int auo_pixcir_remove(struct i2c_client *client)
input_unregister_device(ts->input);
- if (pdata->exit_hw)
- pdata->exit_hw(client);
+ gpio_set_value(pdata->gpio_rst, 0);
+ gpio_free(pdata->gpio_rst);
gpio_free(pdata->gpio_int);
diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h
index 75d4be7..5049f21 100644
--- a/include/linux/input/auo-pixcir-ts.h
+++ b/include/linux/input/auo-pixcir-ts.h
@@ -43,12 +43,10 @@
*/
struct auo_pixcir_ts_platdata {
int gpio_int;
+ int gpio_rst;
int int_setting;
- void (*init_hw)(struct i2c_client *);
- void (*exit_hw)(struct i2c_client *);
-
unsigned int x_max;
unsigned int y_max;
};
--
1.7.2.3
next prev parent reply other threads:[~2013-02-23 11:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-23 11:55 [PATCH 0/4] Input: auo_pixcir_ts - add devicetree support Heiko Stübner
[not found] ` <201302231255.23772.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-02-23 11:56 ` [PATCH 1/4] Input: auo-pixcir-ts - set input direction for interrupt gpio Heiko Stübner
2013-02-23 11:56 ` Heiko Stübner [this message]
2013-02-23 11:57 ` [PATCH 3/4] Input: auo_pixcir_ts - keep own pointer to platform_data Heiko Stübner
2013-02-23 11:58 ` [PATCH 4/4] Input: auo_pixcir_ts - add devicetree support Heiko Stübner
2013-02-24 8:00 ` Dmitry Torokhov
[not found] ` <20130224080015.GA20590-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
2013-02-24 9:58 ` Heiko Stübner
2013-02-25 3:06 ` Dmitry Torokhov
2013-02-25 13:47 ` Heiko Stübner
2013-02-26 7:05 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201302231256.48476.heiko@sntech.de \
--to=heiko-4mtyjxux2i+zqb+pc5nmwq@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).