From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org, Roger Quadros <rogerq@ti.com>
Cc: Jianchun Bian <jcbian@pixcir.com.cn>, linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] Input: pixcir_i2c_ts - add RESET gpio
Date: Mon, 6 Jul 2015 17:30:09 -0700 [thread overview]
Message-ID: <1436229011-29655-4-git-send-email-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <1436229011-29655-1-git-send-email-dmitry.torokhov@gmail.com>
From: Roger Quadros <rogerq@ti.com>
The controller has a RESET pin which is usually controlled over
a GPIO line. If such a GPIO is provided, perform a RESET
during probe.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
.../bindings/input/touchscreen/pixcir_i2c_ts.txt | 3 +++
drivers/input/touchscreen/pixcir_i2c_ts.c | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
index 6e55109..8eb240a 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
@@ -8,6 +8,9 @@ Required properties:
- touchscreen-size-x: horizontal resolution of touchscreen (in pixels)
- touchscreen-size-y: vertical resolution of touchscreen (in pixels)
+Optional properties:
+- reset-gpio: GPIO connected to the RESET line of the chip
+
Example:
i2c@00000000 {
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 8965d7c..9d9ac08 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -36,6 +36,7 @@ struct pixcir_i2c_ts_data {
struct i2c_client *client;
struct input_dev *input;
struct gpio_desc *gpio_attb;
+ struct gpio_desc *gpio_reset;
const struct pixcir_ts_platform_data *pdata;
bool running;
int max_fingers; /* Max fingers supported in this instance */
@@ -189,6 +190,17 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static void pixcir_reset(struct pixcir_i2c_ts_data *tsdata)
+{
+ if (!IS_ERR_OR_NULL(tsdata->gpio_reset)) {
+ gpiod_set_value_cansleep(tsdata->gpio_reset, 1);
+ ndelay(100); /* datasheet section 1.2.3 says 80ns min. */
+ gpiod_set_value_cansleep(tsdata->gpio_reset, 0);
+ /* wait for controller ready. 100ms guess. */
+ msleep(100);
+ }
+}
+
static int pixcir_set_power_mode(struct pixcir_i2c_ts_data *ts,
enum pixcir_power_mode mode)
{
@@ -529,6 +541,14 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
return error;
}
+ tsdata->gpio_reset = devm_gpiod_get_optional(dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(tsdata->gpio_reset)) {
+ error = PTR_ERR(tsdata->gpio_reset);
+ dev_err(dev, "Failed to request RESET gpio: %d\n", error);
+ return error;
+ }
+
error = devm_request_threaded_irq(dev, client->irq, NULL, pixcir_ts_isr,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
client->name, tsdata);
@@ -537,6 +557,8 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
return error;
}
+ pixcir_reset(tsdata);
+
/* Always be in IDLE mode to save power, device supports auto wake */
error = pixcir_set_power_mode(tsdata, PIXCIR_POWER_IDLE);
if (error) {
--
2.4.3.573.g4eafbef
next prev parent reply other threads:[~2015-07-07 0:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 0:30 [PATCH 1/6] Input: pixcir_i2c_ts - move platform data Dmitry Torokhov
2015-07-07 0:30 ` [PATCH 2/6] Input: pixcir_i2c_ts - switch the device over to gpiod Dmitry Torokhov
2015-07-07 10:55 ` Roger Quadros
2015-07-07 0:30 ` [PATCH 3/6] Input: pixcir_i2c_ts - allow using with GPIO expanders Dmitry Torokhov
2015-07-07 10:55 ` Roger Quadros
2015-07-07 0:30 ` Dmitry Torokhov [this message]
2015-07-07 0:30 ` [PATCH 5/6] Input: pixcir_i2c_ts - simplify input device initialization Dmitry Torokhov
2015-07-07 11:39 ` Roger Quadros
2015-07-07 0:30 ` [PATCH 6/6] Input: pixcir_i2c_ts - use standard OF touchscreen parsing code Dmitry Torokhov
2015-07-07 11:47 ` Roger Quadros
2015-07-07 10:46 ` [PATCH 1/6] Input: pixcir_i2c_ts - move platform data Roger Quadros
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=1436229011-29655-4-git-send-email-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=jcbian@pixcir.com.cn \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rogerq@ti.com \
/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
Powered by JetHome