diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-12-22 17:36:18 +0000 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-12-28 17:29:20 +0000 |
commit | 2e542b4f1246e0f6c24557e099b4ad8d65acae77 (patch) | |
tree | f1a5dd7dbebb77ab491b3624794f8f7a1b46c517 | |
parent | a03506b35eb84a53132d9c16d990e8a01bcdb502 (diff) | |
download | iio-2e542b4f1246e0f6c24557e099b4ad8d65acae77.tar.gz |
pm80x - split up
-rw-r--r-- | drivers/input/misc/88pm80x_onkey.c | 5 | ||||
-rw-r--r-- | drivers/mfd/88pm80x.c | 25 | ||||
-rw-r--r-- | drivers/rtc/rtc-88pm80x.c | 16 | ||||
-rw-r--r-- | include/linux/mfd/88pm80x.h | 26 |
4 files changed, 28 insertions, 44 deletions
diff --git a/drivers/input/misc/88pm80x_onkey.c b/drivers/input/misc/88pm80x_onkey.c index 51c8a326fd0686..1bde26c9bead95 100644 --- a/drivers/input/misc/88pm80x_onkey.c +++ b/drivers/input/misc/88pm80x_onkey.c @@ -59,9 +59,6 @@ static irqreturn_t pm80x_onkey_handler(int irq, void *data) return IRQ_HANDLED; } -static SIMPLE_DEV_PM_OPS(pm80x_onkey_pm_ops, pm80x_dev_suspend, - pm80x_dev_resume); - static int pm80x_onkey_probe(struct platform_device *pdev) { @@ -151,7 +148,7 @@ static int pm80x_onkey_remove(struct platform_device *pdev) static struct platform_driver pm80x_onkey_driver = { .driver = { .name = "88pm80x-onkey", - .pm = &pm80x_onkey_pm_ops, + .pm = pm_sleep_ptr(&pm80x_dev_pm_ops), }, .probe = pm80x_onkey_probe, .remove = pm80x_onkey_remove, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index ac4f08565f2902..c8cf3a53ef18c1 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -129,6 +129,30 @@ int pm80x_deinit(void) } EXPORT_SYMBOL_GPL(pm80x_deinit); +static inline int pm80x_dev_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); + int irq = platform_get_irq(pdev, 0); + + if (device_may_wakeup(dev)) + set_bit(irq, &chip->wu_flag); + + return 0; +} + +static inline int pm80x_dev_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); + int irq = platform_get_irq(pdev, 0); + + if (device_may_wakeup(dev)) + clear_bit(irq, &chip->wu_flag); + + return 0; +} + static int pm80x_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -154,6 +178,7 @@ static int pm80x_resume(struct device *dev) } EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_dev_pm_ops, pm80x_dev_suspend, pm80x_dev_resume); MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x"); MODULE_AUTHOR("Qiao Zhou <zhouqiao@marvell.com>"); diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c index 6a3f44cf6ebe59..a1eb1990a404ce 100644 --- a/drivers/rtc/rtc-88pm80x.c +++ b/drivers/rtc/rtc-88pm80x.c @@ -222,20 +222,6 @@ static const struct rtc_class_ops pm80x_rtc_ops = { .alarm_irq_enable = pm80x_rtc_alarm_irq_enable, }; -#ifdef CONFIG_PM_SLEEP -static int pm80x_rtc_suspend(struct device *dev) -{ - return pm80x_dev_suspend(dev); -} - -static int pm80x_rtc_resume(struct device *dev) -{ - return pm80x_dev_resume(dev); -} -#endif - -static SIMPLE_DEV_PM_OPS(pm80x_rtc_pm_ops, pm80x_rtc_suspend, pm80x_rtc_resume); - static int pm80x_rtc_probe(struct platform_device *pdev) { struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -327,7 +313,7 @@ static int pm80x_rtc_remove(struct platform_device *pdev) static struct platform_driver pm80x_rtc_driver = { .driver = { .name = "88pm80x-rtc", - .pm = &pm80x_rtc_pm_ops, + .pm = pm_sleep_ptr(&pm80x_dev_pm_ops), }, .probe = pm80x_rtc_probe, .remove = pm80x_rtc_remove, diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index def5df6e74bf18..cc15393044828f 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -339,31 +339,7 @@ static inline void pm80x_free_irq(struct pm80x_chip *pm80x, int irq, void *data) free_irq(regmap_irq_get_virq(pm80x->irq_data, irq), data); } -#ifdef CONFIG_PM -static inline int pm80x_dev_suspend(struct device *dev) -{ - struct platform_device *pdev = to_platform_device(dev); - struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); - int irq = platform_get_irq(pdev, 0); - - if (device_may_wakeup(dev)) - set_bit(irq, &chip->wu_flag); - - return 0; -} - -static inline int pm80x_dev_resume(struct device *dev) -{ - struct platform_device *pdev = to_platform_device(dev); - struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); - int irq = platform_get_irq(pdev, 0); - - if (device_may_wakeup(dev)) - clear_bit(irq, &chip->wu_flag); - - return 0; -} -#endif +extern const struct dev_pm_ops pm80x_dev_pm_ops; extern int pm80x_init(struct i2c_client *client); extern int pm80x_deinit(void); |