ACPI: Add missing prototype for non CONFIG_SUSPEND/CONFIG_X86 case
Subsystems (4)
PATCH v4 1/2 ACPI: Add missing prototype for non CONFIG_SUSPEND/CONFIG_X86 case
From: Mario Limonciello <[email protected]>
acpi_register_lps0_dev() and acpi_unregister_lps0_dev() may be used in drivers that don't require CONFIG_SUSPEND or compile on !X86.
Add prototypes for those cases.
---
v3:
* Add struct acpi_s2idle_dev_ops outside defines too
--- include/linux/acpi.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
include/linux/acpi.h +8 -1
@@ -1125,13 +1125,13 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,acpi_status acpi_os_prepare_extended_sleep (u8 sleep_state,u32 val_a,u32 val_b); -#if defined(CONFIG_SUSPEND ) && defined(CONFIG_X86 )struct acpi_s2idle_dev_ops {struct list_head list_node;void (*prepare)(void );void (*check)(void );void (*restore)(void ); }; +#if defined(CONFIG_SUSPEND ) && defined(CONFIG_X86 )int acpi_register_lps0_dev (struct acpi_s2idle_dev_ops *arg);void acpi_unregister_lps0_dev (struct acpi_s2idle_dev_ops *arg);int acpi_get_lps0_constraint (struct acpi_device *adev);
@@ -1140,6 +1140,13 @@ static inline int acpi_get_lps0_constraint(struct device *dev) {return ACPI_STATE_UNKNOWN ; } +static inline int acpi_register_lps0_dev (struct acpi_s2idle_dev_ops *arg) +{ +return -ENODEV ; +} +static inline void acpi_unregister_lps0_dev (struct acpi_s2idle_dev_ops *arg) +{ +}#endif /* CONFIG_SUSPEND && CONFIG_X86 */ void arch_reserve_mem_area (acpi_physical_address addr,size_t size);#else
Signature · 1 line
2.43.0
PATCH v4 2/2 pinctrl: amd: Add an LPS0 check() callback
From: Mario Limonciello <[email protected]>
During suspend the pinctrl_amd driver disables the interrupts for any GPIOs that are not marked as wake sources.
This however does not prevent them from changing the wake status bit during suspend, it just stops the system from waking.
If the system wakes from hardware sleep for another reason (such as plugging in the AC adapter) this wake bits might be active.
This could potentially cause problems with going back to hardware sleep. Add an extra debugging message when PM debugging is enabled to help identify if this is happening.
---
v4:
* Add guards for CONFIG_ACPI (handle COMPILE_TEST build failure)
--- drivers/pinctrl/pinctrl-amd.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/pinctrl/pinctrl-amd.c +34 -0
@@ -37,6 +37,8 @@#include "pinctrl-utils.h" #include "pinctrl-amd.h" +static struct amd_gpio *pinctrl_dev; +static int amd_gpio_get_direction (struct gpio_chip *gc,unsigned offset) {unsigned long flags;
@@ -909,6 +911,31 @@ static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)return false; } +#ifdef CONFIG_ACPI +static void amd_gpio_check_pending (void ) +{ +struct amd_gpio *gpio_dev = pinctrl_dev; +struct pinctrl_desc *desc = gpio_dev->pctrl->desc; +int i; + +if (!pm_debug_messages_on) +return ; + +for (i =0 ; i < desc->npins; i++) { +int pin = desc->pins[i].number; +u32 tmp; + + tmp =readl (gpio_dev->base + pin *4 ); +if (tmp &PIN_IRQ_PENDING ) +pm_pr_dbg ("%s: GPIO %d is active: 0x%x.\n" , __func__, pin, tmp); + } +} + +static struct acpi_s2idle_dev_ops pinctrl_amd_s2idle_dev_ops = { + .check = amd_gpio_check_pending, +}; +#endif +static int amd_gpio_suspend_hibernate_common (struct device *dev,bool is_suspend) {struct amd_gpio *gpio_dev =dev_get_drvdata (dev);
@@ -942,6 +969,7 @@ static int amd_gpio_suspend_hibernate_common(struct device *dev, bool is_suspendstatic int amd_gpio_suspend (struct device *dev) { + pinctrl_dev =dev_get_drvdata (dev);return amd_gpio_suspend_hibernate_common (dev, true); }
@@ -1181,6 +1209,9 @@ static int amd_gpio_probe(struct platform_device *pdev)platform_set_drvdata (pdev, gpio_dev);acpi_register_wakeup_handler (gpio_dev->irq, amd_gpio_check_wake, gpio_dev); +#ifdef CONFIG_ACPI +acpi_register_lps0_dev (&pinctrl_amd_s2idle_dev_ops); +#endif dev_dbg (&pdev->dev,"amd gpio driver loaded\n" );return ret;
@@ -1199,6 +1230,9 @@ static void amd_gpio_remove(struct platform_device *pdev)gpiochip_remove (&gpio_dev->gc);acpi_unregister_wakeup_handler (amd_gpio_check_wake, gpio_dev); +#ifdef CONFIG_ACPI +acpi_unregister_lps0_dev (&pinctrl_amd_s2idle_dev_ops); +#endif }#ifdef CONFIG_ACPI
Signature · 1 line
2.43.0
Rafael J. Wysocki
maintainerQuoted 42 lines · Mario Limonciello
From: Mario Limonciello <[email protected]>
acpi_register_lps0_dev()andacpi_unregister_lps0_dev()may be used in drivers that don't requireCONFIG_SUSPENDor compile on !X86.Add prototypes for those cases.
Reported-by kernel test robot <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v3:
* Add structacpi_s2idle_dev_opsoutside defines too--- include/linux/acpi.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)include/linux/acpi.h +2
-1@@ -1125,13 +1125,13 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,acpi_status acpi_os_prepare_extended_sleep (u8 sleep_state,u32 val_a,u32 val_b); -#if defined(CONFIG_SUSPEND ) && defined(CONFIG_X86 )struct acpi_s2idle_dev_ops {struct list_head list_node;void (*prepare)(void );void (*check)(void );void (*restore)(void ); }; +#if defined(CONFIG_SUSPEND ) && defined(CONFIG_X86 )int acpi_register_lps0_dev (struct acpi_s2idle_dev_ops *arg);void acpi_unregister_lps0_dev (struct acpi_s2idle_dev_ops *arg);int acpi_get_lps0_constraint (struct acpi_device *adev);@@ -1140,6 +1140,13 @@ static inline int acpi_get_lps0_constraint(struct device *dev) {return ACPI_STATE_UNKNOWN ; } +static inline int acpi_register_lps0_dev (struct acpi_s2idle_dev_ops *arg)
include/linux/acpi.h static inline int acpi_get_lps0_constraint(struct device *dev)
Quoted 10 lines
include/linux/acpi.h +6
-1+{ +return -ENODEV ; +} +static inline void acpi_unregister_lps0_dev (struct acpi_s2idle_dev_ops *arg) +{ +}#endif /* CONFIG_SUSPEND && CONFIG_X86 */ void arch_reserve_mem_area (acpi_physical_address addr,size_t size);#else --
Applied along with the [2/2] as 6.16 material, thanks!