linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2 RESEND] input: touchcreen: tsc2007: make interrupt optional
@ 2025-08-24  9:19 Svyatoslav Ryhel
  2025-08-24  9:19 ` [PATCH v2 1/2 RESEND] input: touchcreen: tsc2007: change warning to debug message if pen GPIO is not defined Svyatoslav Ryhel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Svyatoslav Ryhel @ 2025-08-24  9:19 UTC (permalink / raw)
  To: Dmitry Torokhov, Svyatoslav Ryhel, Kevin Hilman, Andreas Kemnade
  Cc: linux-input, linux-kernel

In case tsc2007 is used as an ADC sensor there will be no interrupt
provided at all, so set up an interrupt only if one is present and
remove associated warning.

---
Changes in v2:
- commit spit into making interrupt optional and changing message typefrom
  warn to dbg
---

Svyatoslav Ryhel (2):
  input: touchcreen: tsc2007: change warning to debug message if pen
    GPIO is not defined
  input: touchcreen: tsc2007: make interrupt optional

 drivers/input/touchscreen/tsc2007_core.c | 30 ++++++++++++++----------
 1 file changed, 17 insertions(+), 13 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2 RESEND] input: touchcreen: tsc2007: change warning to debug message if pen GPIO is not defined
  2025-08-24  9:19 [PATCH v2 0/2 RESEND] input: touchcreen: tsc2007: make interrupt optional Svyatoslav Ryhel
@ 2025-08-24  9:19 ` Svyatoslav Ryhel
  2025-08-24  9:19 ` [PATCH v2 2/2 RESEND] input: touchcreen: tsc2007: make interrupt optional Svyatoslav Ryhel
  2025-09-03 14:41 ` [PATCH v2 0/2 " Dmitry Torokhov
  2 siblings, 0 replies; 4+ messages in thread
From: Svyatoslav Ryhel @ 2025-08-24  9:19 UTC (permalink / raw)
  To: Dmitry Torokhov, Svyatoslav Ryhel, Kevin Hilman, Andreas Kemnade
  Cc: linux-input, linux-kernel

Since pen GPIO request is optional, there is no reason to throw dev_warn if
such GPIO is not defined.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/input/touchscreen/tsc2007_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 8d832a372b89..17c82baf87df 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -254,7 +254,7 @@ static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts)
 	if (ts->gpiod)
 		ts->get_pendown_state = tsc2007_get_pendown_state_gpio;
 	else
-		dev_warn(dev, "Pen down GPIO is not specified in properties\n");
+		dev_dbg(dev, "Pen down GPIO is not specified in properties\n");
 
 	return 0;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2 RESEND] input: touchcreen: tsc2007: make interrupt optional
  2025-08-24  9:19 [PATCH v2 0/2 RESEND] input: touchcreen: tsc2007: make interrupt optional Svyatoslav Ryhel
  2025-08-24  9:19 ` [PATCH v2 1/2 RESEND] input: touchcreen: tsc2007: change warning to debug message if pen GPIO is not defined Svyatoslav Ryhel
@ 2025-08-24  9:19 ` Svyatoslav Ryhel
  2025-09-03 14:41 ` [PATCH v2 0/2 " Dmitry Torokhov
  2 siblings, 0 replies; 4+ messages in thread
From: Svyatoslav Ryhel @ 2025-08-24  9:19 UTC (permalink / raw)
  To: Dmitry Torokhov, Svyatoslav Ryhel, Kevin Hilman, Andreas Kemnade
  Cc: linux-input, linux-kernel

In case tsc2007 is used as an ADC sensor there will be no interrupt
provided at all, so set up an interrupt only if one is present.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/input/touchscreen/tsc2007_core.c | 28 ++++++++++++++----------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 17c82baf87df..4b169200e689 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -178,7 +178,8 @@ static void tsc2007_stop(struct tsc2007 *ts)
 	mb();
 	wake_up(&ts->wait);
 
-	disable_irq(ts->irq);
+	if (ts->irq)
+		disable_irq(ts->irq);
 }
 
 static int tsc2007_open(struct input_dev *input_dev)
@@ -189,7 +190,8 @@ static int tsc2007_open(struct input_dev *input_dev)
 	ts->stopped = false;
 	mb();
 
-	enable_irq(ts->irq);
+	if (ts->irq)
+		enable_irq(ts->irq);
 
 	/* Prepare for touch readings - power down ADC and enable PENIRQ */
 	err = tsc2007_xfer(ts, PWRDOWN);
@@ -362,17 +364,19 @@ static int tsc2007_probe(struct i2c_client *client)
 			pdata->init_platform_hw();
 	}
 
-	err = devm_request_threaded_irq(&client->dev, ts->irq,
-					NULL, tsc2007_soft_irq,
-					IRQF_ONESHOT,
-					client->dev.driver->name, ts);
-	if (err) {
-		dev_err(&client->dev, "Failed to request irq %d: %d\n",
-			ts->irq, err);
-		return err;
-	}
+	if (ts->irq) {
+		err = devm_request_threaded_irq(&client->dev, ts->irq,
+						NULL, tsc2007_soft_irq,
+						IRQF_ONESHOT,
+						client->dev.driver->name, ts);
+		if (err) {
+			dev_err(&client->dev, "Failed to request irq %d: %d\n",
+				ts->irq, err);
+			return err;
+		}
 
-	tsc2007_stop(ts);
+		tsc2007_stop(ts);
+	}
 
 	/* power down the chip (TSC2007_SETUP does not ACK on I2C) */
 	err = tsc2007_xfer(ts, PWRDOWN);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2 RESEND] input: touchcreen: tsc2007: make interrupt optional
  2025-08-24  9:19 [PATCH v2 0/2 RESEND] input: touchcreen: tsc2007: make interrupt optional Svyatoslav Ryhel
  2025-08-24  9:19 ` [PATCH v2 1/2 RESEND] input: touchcreen: tsc2007: change warning to debug message if pen GPIO is not defined Svyatoslav Ryhel
  2025-08-24  9:19 ` [PATCH v2 2/2 RESEND] input: touchcreen: tsc2007: make interrupt optional Svyatoslav Ryhel
@ 2025-09-03 14:41 ` Dmitry Torokhov
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2025-09-03 14:41 UTC (permalink / raw)
  To: Svyatoslav Ryhel; +Cc: Kevin Hilman, Andreas Kemnade, linux-input, linux-kernel

On Sun, Aug 24, 2025 at 12:19:25PM +0300, Svyatoslav Ryhel wrote:
> In case tsc2007 is used as an ADC sensor there will be no interrupt
> provided at all, so set up an interrupt only if one is present and
> remove associated warning.

Applied the lot, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-03 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-24  9:19 [PATCH v2 0/2 RESEND] input: touchcreen: tsc2007: make interrupt optional Svyatoslav Ryhel
2025-08-24  9:19 ` [PATCH v2 1/2 RESEND] input: touchcreen: tsc2007: change warning to debug message if pen GPIO is not defined Svyatoslav Ryhel
2025-08-24  9:19 ` [PATCH v2 2/2 RESEND] input: touchcreen: tsc2007: make interrupt optional Svyatoslav Ryhel
2025-09-03 14:41 ` [PATCH v2 0/2 " Dmitry Torokhov

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).