Commit 3632f421 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "Fix the arming of wakeup IRQs in the generic wakeup IRQ code
  (wakeirq), drop unused functions from it and fix up a driver using it
  and trying to work around the IRQ arming issue in a questionable way
  (Johan Hovold)"

* tag 'pm-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  serial: qcom-geni: drop bogus runtime pm state update
  PM: sleep: wakeirq: drop unused enable helpers
  PM: sleep: wakeirq: fix wake irq arming
parents 2f4effd8 4dd8752a
...@@ -29,6 +29,7 @@ extern u64 pm_runtime_active_time(struct device *dev); ...@@ -29,6 +29,7 @@ extern u64 pm_runtime_active_time(struct device *dev);
#define WAKE_IRQ_DEDICATED_MASK (WAKE_IRQ_DEDICATED_ALLOCATED | \ #define WAKE_IRQ_DEDICATED_MASK (WAKE_IRQ_DEDICATED_ALLOCATED | \
WAKE_IRQ_DEDICATED_MANAGED | \ WAKE_IRQ_DEDICATED_MANAGED | \
WAKE_IRQ_DEDICATED_REVERSE) WAKE_IRQ_DEDICATED_REVERSE)
#define WAKE_IRQ_DEDICATED_ENABLED BIT(3)
struct wake_irq { struct wake_irq {
struct device *dev; struct device *dev;
......
...@@ -194,7 +194,6 @@ static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned ...@@ -194,7 +194,6 @@ static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned
return err; return err;
} }
/** /**
* dev_pm_set_dedicated_wake_irq - Request a dedicated wake-up interrupt * dev_pm_set_dedicated_wake_irq - Request a dedicated wake-up interrupt
* @dev: Device entry * @dev: Device entry
...@@ -206,11 +205,6 @@ static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned ...@@ -206,11 +205,6 @@ static int __dev_pm_set_dedicated_wake_irq(struct device *dev, int irq, unsigned
* Sets up a threaded interrupt handler for a device that has * Sets up a threaded interrupt handler for a device that has
* a dedicated wake-up interrupt in addition to the device IO * a dedicated wake-up interrupt in addition to the device IO
* interrupt. * interrupt.
*
* The interrupt starts disabled, and needs to be managed for
* the device by the bus code or the device driver using
* dev_pm_enable_wake_irq*() and dev_pm_disable_wake_irq*()
* functions.
*/ */
int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)
{ {
...@@ -232,11 +226,6 @@ EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq); ...@@ -232,11 +226,6 @@ EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq);
* the status of WAKE_IRQ_DEDICATED_REVERSE to tell rpm_suspend() * the status of WAKE_IRQ_DEDICATED_REVERSE to tell rpm_suspend()
* to enable dedicated wake-up interrupt after running the runtime suspend * to enable dedicated wake-up interrupt after running the runtime suspend
* callback for @dev. * callback for @dev.
*
* The interrupt starts disabled, and needs to be managed for
* the device by the bus code or the device driver using
* dev_pm_enable_wake_irq*() and dev_pm_disable_wake_irq*()
* functions.
*/ */
int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq) int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq)
{ {
...@@ -244,44 +233,6 @@ int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq) ...@@ -244,44 +233,6 @@ int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq)
} }
EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq_reverse); EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq_reverse);
/**
* dev_pm_enable_wake_irq - Enable device wake-up interrupt
* @dev: Device
*
* Optionally called from the bus code or the device driver for
* runtime_resume() to override the PM runtime core managed wake-up
* interrupt handling to enable the wake-up interrupt.
*
* Note that for runtime_suspend()) the wake-up interrupts
* should be unconditionally enabled unlike for suspend()
* that is conditional.
*/
void dev_pm_enable_wake_irq(struct device *dev)
{
struct wake_irq *wirq = dev->power.wakeirq;
if (wirq && (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED))
enable_irq(wirq->irq);
}
EXPORT_SYMBOL_GPL(dev_pm_enable_wake_irq);
/**
* dev_pm_disable_wake_irq - Disable device wake-up interrupt
* @dev: Device
*
* Optionally called from the bus code or the device driver for
* runtime_suspend() to override the PM runtime core managed wake-up
* interrupt handling to disable the wake-up interrupt.
*/
void dev_pm_disable_wake_irq(struct device *dev)
{
struct wake_irq *wirq = dev->power.wakeirq;
if (wirq && (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED))
disable_irq_nosync(wirq->irq);
}
EXPORT_SYMBOL_GPL(dev_pm_disable_wake_irq);
/** /**
* dev_pm_enable_wake_irq_check - Checks and enables wake-up interrupt * dev_pm_enable_wake_irq_check - Checks and enables wake-up interrupt
* @dev: Device * @dev: Device
...@@ -314,8 +265,10 @@ void dev_pm_enable_wake_irq_check(struct device *dev, ...@@ -314,8 +265,10 @@ void dev_pm_enable_wake_irq_check(struct device *dev,
return; return;
enable: enable:
if (!can_change_status || !(wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) if (!can_change_status || !(wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) {
enable_irq(wirq->irq); enable_irq(wirq->irq);
wirq->status |= WAKE_IRQ_DEDICATED_ENABLED;
}
} }
/** /**
...@@ -336,8 +289,10 @@ void dev_pm_disable_wake_irq_check(struct device *dev, bool cond_disable) ...@@ -336,8 +289,10 @@ void dev_pm_disable_wake_irq_check(struct device *dev, bool cond_disable)
if (cond_disable && (wirq->status & WAKE_IRQ_DEDICATED_REVERSE)) if (cond_disable && (wirq->status & WAKE_IRQ_DEDICATED_REVERSE))
return; return;
if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED) if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED) {
wirq->status &= ~WAKE_IRQ_DEDICATED_ENABLED;
disable_irq_nosync(wirq->irq); disable_irq_nosync(wirq->irq);
}
} }
/** /**
...@@ -376,7 +331,7 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq) ...@@ -376,7 +331,7 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq)
if (device_may_wakeup(wirq->dev)) { if (device_may_wakeup(wirq->dev)) {
if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED && if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED &&
!pm_runtime_status_suspended(wirq->dev)) !(wirq->status & WAKE_IRQ_DEDICATED_ENABLED))
enable_irq(wirq->irq); enable_irq(wirq->irq);
enable_irq_wake(wirq->irq); enable_irq_wake(wirq->irq);
...@@ -399,7 +354,7 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq) ...@@ -399,7 +354,7 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq)
disable_irq_wake(wirq->irq); disable_irq_wake(wirq->irq);
if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED && if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED &&
!pm_runtime_status_suspended(wirq->dev)) !(wirq->status & WAKE_IRQ_DEDICATED_ENABLED))
disable_irq_nosync(wirq->irq); disable_irq_nosync(wirq->irq);
} }
} }
...@@ -1681,13 +1681,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) ...@@ -1681,13 +1681,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
/*
* Set pm_runtime status as ACTIVE so that wakeup_irq gets
* enabled/disabled from dev_pm_arm_wake_irq during system
* suspend/resume respectively.
*/
pm_runtime_set_active(&pdev->dev);
if (port->wakeup_irq > 0) { if (port->wakeup_irq > 0) {
device_init_wakeup(&pdev->dev, true); device_init_wakeup(&pdev->dev, true);
ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
......
...@@ -10,8 +10,6 @@ extern int dev_pm_set_wake_irq(struct device *dev, int irq); ...@@ -10,8 +10,6 @@ extern int dev_pm_set_wake_irq(struct device *dev, int irq);
extern int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq); extern int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq);
extern int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq); extern int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq);
extern void dev_pm_clear_wake_irq(struct device *dev); extern void dev_pm_clear_wake_irq(struct device *dev);
extern void dev_pm_enable_wake_irq(struct device *dev);
extern void dev_pm_disable_wake_irq(struct device *dev);
#else /* !CONFIG_PM */ #else /* !CONFIG_PM */
...@@ -34,13 +32,5 @@ static inline void dev_pm_clear_wake_irq(struct device *dev) ...@@ -34,13 +32,5 @@ static inline void dev_pm_clear_wake_irq(struct device *dev)
{ {
} }
static inline void dev_pm_enable_wake_irq(struct device *dev)
{
}
static inline void dev_pm_disable_wake_irq(struct device *dev)
{
}
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#endif /* _LINUX_PM_WAKEIRQ_H */ #endif /* _LINUX_PM_WAKEIRQ_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment