linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: PM: Do not turn of unused power resources on the Toshiba Click Mini
@ 2023-04-20 11:02 Hans de Goede
  2023-04-27 16:46 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2023-04-20 11:02 UTC (permalink / raw)
  To: Rafael J . Wysocki
  Cc: Hans de Goede, regressions, linux-acpi, Gé Koerkamp

The CPR3 power resource on the Toshiba Click Mini toggles a GPIO
which is called SISP (for SIS touchscreen power?) on/off.

This CPR3 power resource is not listed in any _PR? lists, let alone
in a _PR0 list for the SIS0817 touchscreen ACPI device which needs it.

Before commit a1224f34d72a ("ACPI: PM: Check states of power resources
during initialization") this was not an issue because since nothing
referenced the CPR3 power resource its state was always
ACPI_POWER_RESOURCE_STATE_UNKNOWN and power resources with this state
get ignored by acpi_turn_off_unused_power_resources().

This clearly is a bug in the DSDT of this device. Add a DMI quirk
to make acpi_turn_off_unused_power_resources() a no-op on this
model to fix the touchscreen no longer working since kernel 5.16 .

This quirk also causes 2 other power resources to not get turned
off, but the _OFF method on these already was a no-op, so this makes
no difference for the other 2 power resources.

Fixes: a1224f34d72a ("ACPI: PM: Check states of power resources during initialization")
Reported-by: Gé Koerkamp <ge.koerkamp@gmail.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216946
Link: https://lore.kernel.org/regressions/32a14a8a-9795-4c8c-7e00-da9012f548f8@leemhuis.info/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/power.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 292cec3691cc..5dc792961ab8 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -23,6 +23,7 @@
 
 #define pr_fmt(fmt) "ACPI: PM: " fmt
 
+#include <linux/dmi.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -1022,6 +1023,21 @@ void acpi_resume_power_resources(void)
 }
 #endif
 
+static const struct dmi_system_id dmi_leave_unused_power_resources_on[] = {
+	{
+		/*
+		 * The Toshiba Click Mini has a CPR3 power-resource which must
+		 * be on for the touchscreen to work, but which is not in any
+		 * _PR? lists. The other 2 affected power-resources are no-ops.
+		 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Click Mini L9W-B"),
+		},
+	},
+	{}
+};
+
 /**
  * acpi_turn_off_unused_power_resources - Turn off power resources not in use.
  */
@@ -1029,6 +1045,9 @@ void acpi_turn_off_unused_power_resources(void)
 {
 	struct acpi_power_resource *resource;
 
+	if (dmi_check_system(dmi_leave_unused_power_resources_on))
+		return;
+
 	mutex_lock(&power_resource_list_lock);
 
 	list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
-- 
2.39.2


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

* Re: [PATCH] ACPI: PM: Do not turn of unused power resources on the Toshiba Click Mini
  2023-04-20 11:02 [PATCH] ACPI: PM: Do not turn of unused power resources on the Toshiba Click Mini Hans de Goede
@ 2023-04-27 16:46 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-04-27 16:46 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Rafael J . Wysocki, regressions, linux-acpi, Gé Koerkamp

On Thu, Apr 20, 2023 at 1:02 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> The CPR3 power resource on the Toshiba Click Mini toggles a GPIO
> which is called SISP (for SIS touchscreen power?) on/off.
>
> This CPR3 power resource is not listed in any _PR? lists, let alone
> in a _PR0 list for the SIS0817 touchscreen ACPI device which needs it.
>
> Before commit a1224f34d72a ("ACPI: PM: Check states of power resources
> during initialization") this was not an issue because since nothing
> referenced the CPR3 power resource its state was always
> ACPI_POWER_RESOURCE_STATE_UNKNOWN and power resources with this state
> get ignored by acpi_turn_off_unused_power_resources().
>
> This clearly is a bug in the DSDT of this device. Add a DMI quirk
> to make acpi_turn_off_unused_power_resources() a no-op on this
> model to fix the touchscreen no longer working since kernel 5.16 .
>
> This quirk also causes 2 other power resources to not get turned
> off, but the _OFF method on these already was a no-op, so this makes
> no difference for the other 2 power resources.
>
> Fixes: a1224f34d72a ("ACPI: PM: Check states of power resources during initialization")
> Reported-by: Gé Koerkamp <ge.koerkamp@gmail.com>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216946
> Link: https://lore.kernel.org/regressions/32a14a8a-9795-4c8c-7e00-da9012f548f8@leemhuis.info/
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/acpi/power.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
> index 292cec3691cc..5dc792961ab8 100644
> --- a/drivers/acpi/power.c
> +++ b/drivers/acpi/power.c
> @@ -23,6 +23,7 @@
>
>  #define pr_fmt(fmt) "ACPI: PM: " fmt
>
> +#include <linux/dmi.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
> @@ -1022,6 +1023,21 @@ void acpi_resume_power_resources(void)
>  }
>  #endif
>
> +static const struct dmi_system_id dmi_leave_unused_power_resources_on[] = {
> +       {
> +               /*
> +                * The Toshiba Click Mini has a CPR3 power-resource which must
> +                * be on for the touchscreen to work, but which is not in any
> +                * _PR? lists. The other 2 affected power-resources are no-ops.
> +                */
> +               .matches = {
> +                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
> +                       DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Click Mini L9W-B"),
> +               },
> +       },
> +       {}
> +};
> +
>  /**
>   * acpi_turn_off_unused_power_resources - Turn off power resources not in use.
>   */
> @@ -1029,6 +1045,9 @@ void acpi_turn_off_unused_power_resources(void)
>  {
>         struct acpi_power_resource *resource;
>
> +       if (dmi_check_system(dmi_leave_unused_power_resources_on))
> +               return;
> +
>         mutex_lock(&power_resource_list_lock);
>
>         list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
> --

Applied as 6.4-rc material, thanks!

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

end of thread, other threads:[~2023-04-27 16:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 11:02 [PATCH] ACPI: PM: Do not turn of unused power resources on the Toshiba Click Mini Hans de Goede
2023-04-27 16:46 ` Rafael J. Wysocki

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