Skip to content

Commit 1661f60

Browse files
benjamin-bara-skidatadtor
authored andcommitted
Input: tsc2007 - enable cansleep pendown GPIO
When a hard IRQ is triggered, the soft IRQ, which decides if an actual pen down happened, should always be triggered. This enables the usage of "can_sleep" GPIO chips as "pen down" GPIO, as the value is not read during the hard IRQ anymore. This might be the case if the GPIO chip is an expander behind i2c. Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com> Signed-off-by: Richard Leitner <richard.leitner@skidata.com> Link: https://lore.kernel.org/r/20230328-tsc2007-sleep-v5-1-fc55e76d0ced@skidata.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent fdefcbd commit 1661f60

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

drivers/input/touchscreen/tsc2007_core.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,6 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
172172
return IRQ_HANDLED;
173173
}
174174

175-
static irqreturn_t tsc2007_hard_irq(int irq, void *handle)
176-
{
177-
struct tsc2007 *ts = handle;
178-
179-
if (tsc2007_is_pen_down(ts))
180-
return IRQ_WAKE_THREAD;
181-
182-
if (ts->clear_penirq)
183-
ts->clear_penirq();
184-
185-
return IRQ_HANDLED;
186-
}
187-
188175
static void tsc2007_stop(struct tsc2007 *ts)
189176
{
190177
ts->stopped = true;
@@ -226,7 +213,7 @@ static int tsc2007_get_pendown_state_gpio(struct device *dev)
226213
struct i2c_client *client = to_i2c_client(dev);
227214
struct tsc2007 *ts = i2c_get_clientdata(client);
228215

229-
return gpiod_get_value(ts->gpiod);
216+
return gpiod_get_value_cansleep(ts->gpiod);
230217
}
231218

232219
static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts)
@@ -376,7 +363,7 @@ static int tsc2007_probe(struct i2c_client *client)
376363
}
377364

378365
err = devm_request_threaded_irq(&client->dev, ts->irq,
379-
tsc2007_hard_irq, tsc2007_soft_irq,
366+
NULL, tsc2007_soft_irq,
380367
IRQF_ONESHOT,
381368
client->dev.driver->name, ts);
382369
if (err) {

0 commit comments

Comments
 (0)