soc: fsl: enable acpi support in RCPM driver
PATCH v6 1/1 soc: fsl: enable acpi support in RCPM driver
From: Peng Ma <[email protected]>
This patch enables ACPI support in RCPM driver.
---
Change in v6:
- Remove copyright udpate to rebase on latest mainline
Change in v5:
- Fix panic when dev->of_node is null
Change in v4:
- Make commit subject more accurate
- Remove unrelated new blank line
Change in v3:
- Add #ifdef CONFIG_ACPI for acpi_device_id
- Rename rcpm_acpi_imx_ids to rcpm_acpi_ids
Change in v2:
- Update acpi_device_id to fix conflict with other driver
drivers/soc/fsl/rcpm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/soc/fsl/rcpm.c +16 -2
@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/suspend.h> #include <linux/kernel.h> +#include <linux/acpi.h> #define RCPM_WAKEUP_CELL_MAX_SIZE 7
@@ -78,10 +79,14 @@ static int rcpm_pm_prepare(struct device *dev)"fsl,rcpm-wakeup" , value, rcpm->wakeup_cells + 1); -/* Wakeup source should refer to current rcpm device */ -if (ret || (np->phandle != value[0 ])) +if (ret)continue ; +if (is_of_node (dev->fwnode)) +/* Should refer to current rcpm device */ +if (np->phandle != value[0 ]) +continue ; +/* Property "#fsl,rcpm-wakeup-cells" of rcpm node defines the * number of IPPDEXPCR register cells, and "fsl,rcpm-wakeup" * of wakeup source IP contains an integer array: <phandle to
@@ -172,10 +177,19 @@ static const struct of_device_id rcpm_of_match[] = { };MODULE_DEVICE_TABLE (of, rcpm_of_match); +#ifdef CONFIG_ACPI +static const struct acpi_device_id rcpm_acpi_ids[] = { + {"NXP0015" ,}, + { } +}; +MODULE_DEVICE_TABLE (acpi, rcpm_acpi_ids); +#endif +static struct platform_driver rcpm_driver = { .driver = { .name ="rcpm" , .of_match_table = rcpm_of_match, + .acpi_match_table =ACPI_PTR (rcpm_acpi_ids), .pm = &rcpm_pm_ops, }, .probe = rcpm_probe,
Signature · 1 line
2.25.1
Quoted 43 lines · Ran Wang
From: Peng Ma <[email protected]>
This patch enables ACPI support in RCPM driver.
Signed-off-by Peng Ma <[email protected]>Signed-off-by Ran Wang <[email protected]>---
Change in v6:
- Remove copyright udpate to rebase on latest mainlineChange in v5:
- Fix panic whendev->of_nodeis nullChange in v4:
- Make commit subject more accurate
- Remove unrelated new blank lineChange in v3:
- Add #ifdefCONFIG_ACPIforacpi_device_id
- Renamercpm_acpi_imx_idstorcpm_acpi_idsChange in v2:
- Updateacpi_device_idto fix conflict with other driverdrivers/soc/fsl/rcpm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)drivers/soc/fsl/rcpm.c +1
-0@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/suspend.h> #include <linux/kernel.h> +#include <linux/acpi.h> #define RCPM_WAKEUP_CELL_MAX_SIZE 7@@ -78,10 +79,14 @@ static int rcpm_pm_prepare(struct device *dev)"fsl,rcpm-wakeup" , value, rcpm->wakeup_cells + 1);
drivers/soc/fsl/rcpm.c static int rcpm_pm_prepare(struct device *dev) · line 88
Quoted 10 lines
drivers/soc/fsl/rcpm.c +5
-2-/* Wakeup source should refer to current rcpm device */ -if (ret || (np->phandle != value[0 ])) +if (ret)continue ; +if (is_of_node (dev->fwnode)) +/* Should refer to current rcpm device */ +if (np->phandle != value[0 ]) +continue ;
It looks like that we assume that in the ACPI scenario there will only be one RCPM controller and all devices are controlled by this single PM controller. This probably is true for all existing SoCs with a RCPM. But since the driver tried to support multiple RCPMs, maybe we should continue to support multiple RCPM controllers or at least mention that in the comment.
Quoted 27 lines
drivers/soc/fsl/rcpm.c +10
-1+/* Property "#fsl,rcpm-wakeup-cells" of rcpm node defines the * number of IPPDEXPCR register cells, and "fsl,rcpm-wakeup" * of wakeup source IP contains an integer array: <phandle to @@ -172,10 +177,19 @@ static const struct of_device_id rcpm_of_match[] = { };MODULE_DEVICE_TABLE (of, rcpm_of_match); +#ifdef CONFIG_ACPI +static const struct acpi_device_id rcpm_acpi_ids[] = { + {"NXP0015" ,}, + { } +}; +MODULE_DEVICE_TABLE (acpi, rcpm_acpi_ids); +#endif +static struct platform_driver rcpm_driver = { .driver = { .name ="rcpm" , .of_match_table = rcpm_of_match, + .acpi_match_table =ACPI_PTR (rcpm_acpi_ids), .pm = &rcpm_pm_ops, }, .probe = rcpm_probe, --2.25.1
Hi Leo,
Quoted 51 lines · Li Yang
Quoted 49 lines · Ran Wang
From: Peng Ma <[email protected]>
This patch enables ACPI support in RCPM driver.
Signed-off-by Peng Ma <[email protected]>Signed-off-by Ran Wang <[email protected]>---
Change in v6:
- Remove copyright udpate to rebase on latest mainlineChange in v5:
- Fix panic whendev->of_nodeis nullChange in v4:
- Make commit subject more accurate
- Remove unrelated new blank lineChange in v3:
- Add #ifdefCONFIG_ACPIforacpi_device_id
- Renamercpm_acpi_imx_idstorcpm_acpi_idsChange in v2:
- Updateacpi_device_idto fix conflict with other driverdrivers/soc/fsl/rcpm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)drivers/soc/fsl/rcpm.c index renamed from drivers/soc/fsl/rcpm.c +0
-0
4ace28cab314..7aa997b932d1100644drivers/soc/fsl/rcpm.c +2
-2@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/suspend.h> #include <linux/kernel.h> +#include <linux/acpi.h> #define RCPM_WAKEUP_CELL_MAX_SIZE 7@@ -78,10 +79,14 @@ static int rcpm_pm_prepare(struct device *dev)"fsl,rcpm-wakeup" , value, rcpm->wakeup_cells + 1); -/* Wakeup source should refer to current rcpm device */ -if (ret || (np->phandle != value[0 ])) +if (ret)continue ;
Quoted 8 lines
drivers/soc/fsl/rcpm.c static int rcpm_pm_prepare(struct device *dev) · line 88
Quoted 4 lines
drivers/soc/fsl/rcpm.c +4
-0+if (is_of_node (dev->fwnode)) +/* Should refer to current rcpm device */ +if (np->phandle != value[0 ]) +continue ;It looks like that we assume that in the ACPI scenario there will only be one RCPM controller and all devices are controlled by this single PM controller. This probably is true for all existing SoCs with a RCPM. But since the driver tried to support multiple RCPMs, maybe we should continue to support multiple RCPM controllers or at least mention that in the comment.
How about adding some comment as below:
/* For ACPI mode, currently we assume there is only one RCPM controller existing */
Regards,
Ran
Quoted 26 lines
Quoted 26 lines
drivers/soc/fsl/rcpm.c +1
-0+/* Property "#fsl,rcpm-wakeup-cells" of rcpm node defines the * number of IPPDEXPCR register cells, and "fsl,rcpm-wakeup" * of wakeup source IP contains an integer array: <phandle to @@ -172,10 +177,19 @@ static const struct
of_device_idrcpm_of_match[] = { };MODULE_DEVICE_TABLE(of, rcpm_of_match);drivers/soc/fsl/rcpm.c +8
-1+#ifdef CONFIG_ACPI +static const struct acpi_device_id rcpm_acpi_ids[] = { + {"NXP0015" ,}, + { } +}; +MODULE_DEVICE_TABLE (acpi, rcpm_acpi_ids);#endif +static struct platform_driver rcpm_driver = { .driver = { .name ="rcpm" , .of_match_table = rcpm_of_match, + .acpi_match_table =ACPI_PTR (rcpm_acpi_ids), .pm = &rcpm_pm_ops, }, .probe = rcpm_probe, --2.25.1
Quoted 61 lines
-----Original Message-----
From: Ran Wang <[email protected]>
Sent: Tuesday, April 6, 2021 8:32 PM
To: Leo Li <[email protected]>
Cc: Christophe Leroy <[email protected]>; linuxppc-dev <[email protected]>; moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE <[email protected]>; lkml <linux- [email protected]>
Subject: RE: [PATCH v6] soc: fsl: enable acpi support in RCPM driverHi Leo,
Quoted 46 lines · Li Yang
Quoted 44 lines · Ran Wang
From: Peng Ma <[email protected]>
This patch enables ACPI support in RCPM driver.
Signed-off-by Peng Ma <[email protected]>Signed-off-by Ran Wang <[email protected]>---
Change in v6:
- Remove copyright udpate to rebase on latest mainlineChange in v5:
- Fix panic whendev->of_nodeis nullChange in v4:
- Make commit subject more accurate
- Remove unrelated new blank lineChange in v3:
- Add #ifdefCONFIG_ACPIforacpi_device_id
- Renamercpm_acpi_imx_idstorcpm_acpi_idsChange in v2:
- Updateacpi_device_idto fix conflict with other driverdrivers/soc/fsl/rcpm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)drivers/soc/fsl/rcpm.c index renamed from drivers/soc/fsl/rcpm.c +0
-0
4ace28cab314..7aa997b932d1100644drivers/soc/fsl/rcpm.c +1
-0@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/suspend.h> #include <linux/kernel.h> +#include <linux/acpi.h> #define RCPM_WAKEUP_CELL_MAX_SIZE 7@@ -78,10 +79,14 @@ static int rcpm_pm_prepare(struct device *dev)"fsl,rcpm-wakeup" , value, rcpm->wakeup_cells + 1);
Quoted 7 lines
Quoted 7 lines
drivers/soc/fsl/rcpm.c static int rcpm_pm_prepare(struct device *dev) · line 86
Quoted 7 lines
drivers/soc/fsl/rcpm.c +3
-2-/* Wakeup source should refer to current rcpm device */ -if (ret || (np->phandle != value[0 ])) +if (ret)continue ; +if (is_of_node (dev->fwnode)) +/* Should refer to current rcpm device */
Better to be /* Only handle devices with fsl,rcpm-wakeup pointing to the current rcpm node*/
Quoted 6 lines
Quoted 6 lines
drivers/soc/fsl/rcpm.c static int rcpm_pm_prepare(struct device *dev) · line 88
Quoted 2 lines
drivers/soc/fsl/rcpm.c +2
-0+if (np->phandle != value[0 ]) +continue ;It looks like that we assume that in the ACPI scenario there will only be one RCPM controller and all devices are controlled by this single PM controller. This probably is true for all existing SoCs with a RCPM. But
Quoted 8 lines
since the driver tried to support multiple RCPMs, maybe we should continue to support multiple RCPM controllers or at least mention that in the comment.
How about adding some comment as below:
/* For ACPI mode, currently we assume there is only one RCPM controller existing */
Ok. On the other hand, it will be clearer to update the existing comment above.
Quoted 30 lines
Regards,
RanQuoted 26 lines
Quoted 26 lines
drivers/soc/fsl/rcpm.c +1
-0+/* Property "#fsl,rcpm-wakeup-cells" of rcpm node defines the * number of IPPDEXPCR register cells, and "fsl,rcpm-wakeup" * of wakeup source IP contains an integer array: <phandle to @@ -172,10 +177,19 @@ static const struct
of_device_idrcpm_of_match[] = { };MODULE_DEVICE_TABLE(of, rcpm_of_match);drivers/soc/fsl/rcpm.c +8
-1+#ifdef CONFIG_ACPI +static const struct acpi_device_id rcpm_acpi_ids[] = { + {"NXP0015" ,}, + { } +}; +MODULE_DEVICE_TABLE (acpi, rcpm_acpi_ids);#endif +static struct platform_driver rcpm_driver = { .driver = { .name ="rcpm" , .of_match_table = rcpm_of_match, + .acpi_match_table =ACPI_PTR (rcpm_acpi_ids), .pm = &rcpm_pm_ops, }, .probe = rcpm_probe, --2.25.1