:: Re: [maemo-leste] tsc2005 power man…
Top Pagina
Delete this message
Reply to this message
Auteur: Merlijn Wajer
Datum:  
Aan: Tony Lindgren
CC: maemo-leste
Onderwerp: Re: [maemo-leste] tsc2005 power management
Hi Tony,

On 27/11/2021 15:57, Merlijn Wajer wrote:
> Hi Tony,
>
> Attached my initial attempt to port tsc200x-core to the runtime pm
> framework (based on your work for the atmel_mxt driver). I've tested
> that it suspends and resumes at the right time (when the files are being
> opened), and the touchscreen still works on Maemo Leste.
>
> I'll send the patch later to the linux-omap and the input list if it
> makes sense.
>
> The driver still blocks idle... I have a few thoughts, wonder what your
> take is. One thing I'd like to assert: am I supposed to read
> "cm_idlest1_core" to read the blockers, not "cm_idlest_per", see [1].


With the attached patch applied on top of the one in my previous email,
the touchscreen seems to idle fine (does not block idle anymore) when
not in use - when the fd is released by Xorg/mce.

I suppose the next step is to make it suspend even when in use after a
timeout and wake up on interrupt (if possible) like you did with the
atmel_mxt driver?

Cheers,
Merlijn
>From 2e95cb45f1e80db239ebd4fb225d842ad33b9b43 Mon Sep 17 00:00:00 2001
From: Merlijn Wajer <merlijn@???>
Date: Sat, 11 Dec 2021 11:37:39 +0100
Subject: [PATCH] Input: tsc2005: disable irqs on suspend

Let's also disable the irq on probe, we will just enable it when the
device is resumed.
---
drivers/input/touchscreen/tsc200x-core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c
index ae124c356938..20d9b8dc1eb0 100644
--- a/drivers/input/touchscreen/tsc200x-core.c
+++ b/drivers/input/touchscreen/tsc200x-core.c
@@ -245,8 +245,6 @@ static int __maybe_unused tsc200x_runtime_suspend(struct device *dev)

     cancel_delayed_work_sync(&ts->esd_work);


-    enable_irq(ts->irq);
-
     if (mutex_ac)
         mutex_unlock(&ts->mutex);


@@ -267,6 +265,8 @@ static int __maybe_unused tsc200x_runtime_resume(struct device *dev)
      * won't unlock it */
     mutex_ac = mutex_trylock(&ts->mutex);


+    enable_irq(ts->irq);
+
     tsc200x_start_scan(ts);


     if (ts->esd_timeout && ts->reset_gpio) {
@@ -571,6 +571,7 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
         dev_err(dev, "Failed to request irq, err: %d\n", error);
         return error;
     }
+    disable_irq(irq);


     error = regulator_enable(ts->vio);
     if (error)
-- 
2.32.0