PCI: dw-rockchip: Add runtime PM support to Rockchip PCIe
Subsystems (3)
PATCH v2 1/1 PCI: dw-rockchip: Add runtime PM support to Rockchip PCIe
Add runtime powwe manageement functionality into the Rockchip DesignWare PCIe controller driver. Calling devm_pm_runtime_enable() during device probing allows the controller to report its runtime PM status, enabling power management controls to be applied consistently across the entire connected PCIe hierarchy.
---
v2:
improve the commit message
Drop the .remove patch
Drop the disable_pm_runtime
v1:
https://lore.kernel.org/all/[email protected]/
--- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/pci/controller/dwc/pcie-dw-rockchip.c +17 -0
@@ -20,6 +20,7 @@#include <linux/of_irq.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/regmap.h> #include <linux/reset.h>
@@ -709,6 +710,20 @@ static int rockchip_pcie_probe(struct platform_device *pdev)if (ret) goto deinit_phy; + ret =pm_runtime_set_suspended (dev); +if (ret) + goto deinit_clk; + + ret =devm_pm_runtime_enable (dev); +if (ret) { + ret =dev_err_probe (dev, ret,"Failed to enable runtime PM\n" ); + goto deinit_clk; + } + + ret =pm_runtime_resume_and_get (dev); +if (ret) + goto deinit_clk; +switch (data->mode) {case DW_PCIE_RC_TYPE : ret =rockchip_pcie_configure_rc (pdev, rockchip);
@@ -730,6 +745,8 @@ static int rockchip_pcie_probe(struct platform_device *pdev) deinit_clk:clk_bulk_disable_unprepare (rockchip->clk_cnt, rockchip->clks); +pm_runtime_disable (dev); +pm_runtime_no_callbacks (dev); deinit_phy:rockchip_pcie_phy_deinit (rockchip);
base-commit: b69053dd3ffbc0d2dedbbc86182cdef6f641fe1b
Signature · 1 line
2.50.1
Hi All
Quoted 2 lines · Anand Moon
Add runtime powwe manageement functionality into the Rockchip DesignWare
There is a small typo over here,
s/runtime powwe manageement/runtime power management/
If you need it, I will send an updated version.
Quoted 6 lines
PCIe controller driver. Calling
devm_pm_runtime_enable()during device probing allows the controller to report its runtime PM status, enabling power management controls to be applied consistently across the entire connected PCIe hierarchy.Signed-off-by Anand Moon <[email protected]>
Thanks
-Anand
Manivannan Sadhasivam
maintainerQuoted 31 lines · Anand Moon
Add runtime powwe manageement functionality into the Rockchip DesignWare PCIe controller driver. Calling
devm_pm_runtime_enable()during device probing allows the controller to report its runtime PM status, enabling power management controls to be applied consistently across the entire connected PCIe hierarchy.Signed-off-by Anand Moon <[email protected]>---
v2:
improve the commit message
Drop the .remove patch
Drop thedisable_pm_runtime
v1:
https://lore.kernel.org/all/[email protected]/--- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/pci/controller/dwc/pcie-dw-rockchip.c +1
-0@@ -20,6 +20,7 @@#include <linux/of_irq.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/regmap.h> #include <linux/reset.h>
drivers/pci/controller/dwc/pcie-dw-rockchip.c static int rockchip_pcie_probe(struct platform_device *pdev) · line 715
Quoted 6 lines
drivers/pci/controller/dwc/pcie-dw-rockchip.c +3
-0@@ -709,6 +710,20 @@ static int rockchip_pcie_probe(struct platform_device *pdev)if (ret) goto deinit_phy; + ret =pm_runtime_set_suspended (dev); +if (ret) + goto deinit_clk;
Seriously? Why do you need this? Default PM status is 'suspended'.
Quoted 15 lines
drivers/pci/controller/dwc/pcie-dw-rockchip.c +11
-0+ + ret =devm_pm_runtime_enable (dev); +if (ret) { + ret =dev_err_probe (dev, ret,"Failed to enable runtime PM\n" ); + goto deinit_clk; + } + + ret =pm_runtime_resume_and_get (dev); +if (ret) + goto deinit_clk; +switch (data->mode) {case DW_PCIE_RC_TYPE : ret =rockchip_pcie_configure_rc (pdev, rockchip);
drivers/pci/controller/dwc/pcie-dw-rockchip.c static int rockchip_pcie_probe(struct platform_device *pdev) · line 748
Quoted 4 lines
drivers/pci/controller/dwc/pcie-dw-rockchip.c +1
-0@@ -730,6 +745,8 @@ static int rockchip_pcie_probe(struct platform_device *pdev) deinit_clk:clk_bulk_disable_unprepare (rockchip->clk_cnt, rockchip->clks); +pm_runtime_disable (dev);
You used devm_ for enable.
drivers/pci/controller/dwc/pcie-dw-rockchip.c static int rockchip_pcie_probe(struct platform_device *pdev) · line 749
Quoted 1 line
drivers/pci/controller/dwc/pcie-dw-rockchip.c +1
-0+pm_runtime_no_callbacks (dev);
Why? Where is pm_runtime_put()? Please read Documentation/power/runtime_pm.rst.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Hi Manivannan,
Thanks for your review comments.
Quoted 36 lines · Manivannan Sadhasivam
Quoted 34 lines · Anand Moon
Add runtime powwe manageement functionality into the Rockchip DesignWare PCIe controller driver. Calling
devm_pm_runtime_enable()during device probing allows the controller to report its runtime PM status, enabling power management controls to be applied consistently across the entire connected PCIe hierarchy.Signed-off-by Anand Moon <[email protected]>---
v2:
improve the commit message
Drop the .remove patch
Drop thedisable_pm_runtime
v1:
https://lore.kernel.org/all/[email protected]/--- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/pci/controller/dwc/pcie-dw-rockchip.c +1
-0@@ -20,6 +20,7 @@#include <linux/of_irq.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/regmap.h> #include <linux/reset.h> @@ -709,6 +710,20 @@ static int rockchip_pcie_probe(struct platform_device *pdev)if (ret) goto deinit_phy;
Quoted 5 lines
drivers/pci/controller/dwc/pcie-dw-rockchip.c static int rockchip_pcie_probe(struct platform_device *pdev) · line 715
Quoted 3 lines
drivers/pci/controller/dwc/pcie-dw-rockchip.c +3
-0+ ret =pm_runtime_set_suspended (dev); +if (ret) + goto deinit_clk;Seriously? Why do you need this? Default PM status is 'suspended'.
These changes were part of my work on suspend/resume capabilities
Quoted 23 lines
Quoted 16 lines
drivers/pci/controller/dwc/pcie-dw-rockchip.c +11
-0+ + ret =devm_pm_runtime_enable (dev); +if (ret) { + ret =dev_err_probe (dev, ret,"Failed to enable runtime PM\n" ); + goto deinit_clk; + } + + ret =pm_runtime_resume_and_get (dev); +if (ret) + goto deinit_clk; +switch (data->mode) {case DW_PCIE_RC_TYPE : ret =rockchip_pcie_configure_rc (pdev, rockchip);drivers/pci/controller/dwc/pcie-dw-rockchip.c static int rockchip_pcie_probe(struct platform_device *pdev) · line 748
Quoted 4 lines
drivers/pci/controller/dwc/pcie-dw-rockchip.c +1
-0@@ -730,6 +745,8 @@ static int rockchip_pcie_probe(struct platform_device *pdev) deinit_clk:clk_bulk_disable_unprepare (rockchip->clk_cnt, rockchip->clks); +pm_runtime_disable (dev);You used
devm_for enable.
Quoted 4 lines
drivers/pci/controller/dwc/pcie-dw-rockchip.c static int rockchip_pcie_probe(struct platform_device *pdev) · line 749
Quoted 1 line
drivers/pci/controller/dwc/pcie-dw-rockchip.c +1
-0+pm_runtime_no_callbacks (dev);Why? Where is
pm_runtime_put()? Please readDocumentation/power/runtime_pm.rst.
Ok, I will study and update the changes.
Quoted 4 lines
- Mani
--
மணிவண்ணன் சதாசிவம்
Thanks
-Anand