* [PATCH] Input: goodix - call acpi_device_fix_up_power() in some cases
@ 2022-06-18 21:02 Hans de Goede
2022-07-09 4:55 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2022-06-18 21:02 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Hans de Goede, Bastien Nocera, linux-input, Maya Matuszczyk
On ACPI boards, when we cannot get the GPIOs to do a reset ourselves
if necessary, call acpi_device_fix_up_power() to force the ACPI _PS0
method to run.
On some devices without proper GPIO descriptions this will reset
the touchscreen for us and this may be necessary for us to be able
to communicate to the touchscreen at all.
Specifically on an Aya Neo Next this change will cause the _PS0()
ACPI function to call INIT() which does:
Method (INIT, 0, Serialized)
{
TP_I = 0x00A50000
TP_R = 0x00A50000
Sleep (0x0A)
TP_I = 0x00E50000
Sleep (One)
TP_R = 0x00E50000
Sleep (0x06)
TP_I = 0x00A50000
Sleep (0x3C)
TP_I = 0x00041800
}
On older kernels the ACPI core assumed a power-on was necessary by itself
and would run _PS0 before our probe function runs, which can be seen from
the GPIO pin ctrl registers in /sys/kernel/debug/gpio which match
the above hex values with older kernels.
With newer kernels before this change the GPIO pin ctrl registers do not
match, indicating INIT() has not run and probing the touchscreen fails.
This change makes Linux run _PS0() again fixing the touchscreen not working
on the Aya Neo Next.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=209061
Reported-and-tested-by: Maya Matuszczyk <maccraft123mc@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/input/touchscreen/goodix.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index af2ddee76f58..293bb064e8aa 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -904,6 +904,11 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
} else {
dev_warn(dev, "Unexpected ACPI resources: gpio_count %d, gpio_int_idx %d\n",
ts->gpio_count, ts->gpio_int_idx);
+ /*
+ * On some devices _PS0 does a reset for us and
+ * sometimes this is necessary for things to work.
+ */
+ acpi_device_fix_up_power(ACPI_COMPANION(dev));
return -EINVAL;
}
--
2.36.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: goodix - call acpi_device_fix_up_power() in some cases
2022-06-18 21:02 [PATCH] Input: goodix - call acpi_device_fix_up_power() in some cases Hans de Goede
@ 2022-07-09 4:55 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2022-07-09 4:55 UTC (permalink / raw)
To: Hans de Goede; +Cc: Bastien Nocera, linux-input, Maya Matuszczyk
On Sat, Jun 18, 2022 at 11:02:33PM +0200, Hans de Goede wrote:
> On ACPI boards, when we cannot get the GPIOs to do a reset ourselves
> if necessary, call acpi_device_fix_up_power() to force the ACPI _PS0
> method to run.
>
> On some devices without proper GPIO descriptions this will reset
> the touchscreen for us and this may be necessary for us to be able
> to communicate to the touchscreen at all.
>
> Specifically on an Aya Neo Next this change will cause the _PS0()
> ACPI function to call INIT() which does:
>
> Method (INIT, 0, Serialized)
> {
> TP_I = 0x00A50000
> TP_R = 0x00A50000
> Sleep (0x0A)
> TP_I = 0x00E50000
> Sleep (One)
> TP_R = 0x00E50000
> Sleep (0x06)
> TP_I = 0x00A50000
> Sleep (0x3C)
> TP_I = 0x00041800
> }
>
> On older kernels the ACPI core assumed a power-on was necessary by itself
> and would run _PS0 before our probe function runs, which can be seen from
> the GPIO pin ctrl registers in /sys/kernel/debug/gpio which match
> the above hex values with older kernels.
>
> With newer kernels before this change the GPIO pin ctrl registers do not
> match, indicating INIT() has not run and probing the touchscreen fails.
>
> This change makes Linux run _PS0() again fixing the touchscreen not working
> on the Aya Neo Next.
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=209061
> Reported-and-tested-by: Maya Matuszczyk <maccraft123mc@gmail.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-09 4:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-18 21:02 [PATCH] Input: goodix - call acpi_device_fix_up_power() in some cases Hans de Goede
2022-07-09 4:55 ` 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).