pwm: lpss: add PM support for LPSS PWM
Subsystems (2)
PATCH 1/1 pwm: lpss: add PM support for LPSS PWM
Signed-off-by Huiquan Zhong <[email protected]>
Signed-off-by Qipeng Zha <[email protected]>
--- drivers/pwm/pwm-lpss-pci.c | 11 +++++++++++ drivers/pwm/pwm-lpss-platform.c | 11 +++++++++++ drivers/pwm/pwm-lpss.c | 41 +++++++++++++++++++++++++++++++++++++++++ drivers/pwm/pwm-lpss.h | 1 + 4 files changed, 64 insertions(+)
drivers/pwm/pwm-lpss-pci.c +11 -0
@@ -13,6 +13,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> +#include <linux/pm_runtime.h> #include "pwm-lpss.h"
@@ -33,6 +34,12 @@ static int pwm_lpss_probe_pci(struct pci_dev *pdev,return PTR_ERR (lpwm);pci_set_drvdata (pdev, lpwm); + +pm_runtime_set_autosuspend_delay (&pdev->dev,5 ); +pm_runtime_use_autosuspend (&pdev->dev); +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_allow (&pdev->dev); +return 0 ; }
@@ -40,6 +47,7 @@ static void pwm_lpss_remove_pci(struct pci_dev *pdev) {struct pwm_lpss_chip *lpwm =pci_get_drvdata (pdev); +pm_runtime_forbid (&pdev->dev);pwm_lpss_remove (lpwm); }
@@ -59,6 +67,9 @@ static struct pci_driver pwm_lpss_driver_pci = { .id_table = pwm_lpss_pci_ids, .probe = pwm_lpss_probe_pci, .remove = pwm_lpss_remove_pci, + .driver = { + .pm = &pwm_lpss_pm, + }, };module_pci_driver (pwm_lpss_driver_pci);
drivers/pwm/pwm-lpss-platform.c +11 -0
@@ -14,6 +14,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include "pwm-lpss.h"
@@ -36,6 +37,12 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev)return PTR_ERR (lpwm);platform_set_drvdata (pdev, lpwm); + +pm_runtime_set_autosuspend_delay (&pdev->dev,5 ); +pm_runtime_use_autosuspend (&pdev->dev); +pm_runtime_put_noidle (&pdev->dev); +pm_runtime_allow (&pdev->dev); +return 0 ; }
@@ -43,6 +50,7 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev) {struct pwm_lpss_chip *lpwm =platform_get_drvdata (pdev); +pm_runtime_forbid (&pdev->dev);return pwm_lpss_remove (lpwm); }
@@ -60,6 +68,9 @@ static struct platform_driver pwm_lpss_driver_platform = { }, .probe = pwm_lpss_probe_platform, .remove = pwm_lpss_remove_platform, + .driver = { + .pm = &pwm_lpss_pm, + }, };module_platform_driver (pwm_lpss_driver_platform);
drivers/pwm/pwm-lpss.c +41 -0
82 lines not on this page · raw message
drivers/pwm/pwm-lpss.h +1 -0
@@ -28,5 +28,6 @@ extern const struct pwm_lpss_boardinfo pwm_lpss_bsw_info;struct pwm_lpss_chip *pwm_lpss_probe (struct device *dev,struct resource *r,const struct pwm_lpss_boardinfo *info);int pwm_lpss_remove (struct pwm_lpss_chip *lpwm); +extern const struct dev_pm_ops pwm_lpss_pm;#endif /* __PWM_LPSS_H */
Signature · 1 line
1.8.3.2
Quoted 2 lines · Qipeng Zha
Signed-off-by Huiquan Zhong <[email protected]>Signed-off-by Qipeng Zha <[email protected]>
Can you please write a proper changelog explaining *why* this change is needed, thanks.
For devices as simple as LPSS PWM I have hard time understanding why it needs to implement runtime PM.