summaryrefslogtreecommitdiff
path: root/drivers/pmdomain
AgeCommit message (Collapse)Author
2025-03-17pmdomain: arm: scmi_pm_domain: Remove redundant state verificationSudeep Holla
Currently, scmi_pd_power() explicitly verifies whether the requested power state was applied by calling state_get(). While this check could detect failures where the state was not properly updated, ensuring correctness is the responsibility of the SCMI firmware. Removing this redundant state_get() call eliminates an unnecessary round-trip to the firmware, improving efficiency. Any mismatches between the requested and actual states should be handled by the SCMI firmware, which must return a failure if state_set() is unsuccessful. Additionally, in some cases, checking the state after powering off a domain may be unreliable or unsafe, depending on the firmware implementation. This patch removes the redundant verification, simplifying the function without compromising correctness. Reported-and-tested-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20250314095851.443979-1-sudeep.holla@arm.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-17pmdomain: thead: fix TH1520_AON_PROTOCOL dependencyArnd Bergmann
Kconfig treats the dependency as optional, but the header file only provides normal declarations and no empty API stubs: ld: fs/btrfs/extent_io.o: in function `writepage_delalloc': extent_io.c:(.text+0x2b42): undefined reference to `__udivdi3' ld: drivers/pmdomain/thead/th1520-pm-domains.o: in function `th1520_pd_power_off': th1520-pm-domains.c:(.text+0x57): undefined reference to `th1520_aon_power_update' ld: drivers/pmdomain/thead/th1520-pm-domains.o: in function `th1520_pd_power_on': th1520-pm-domains.c:(.text+0x8a): undefined reference to `th1520_aon_power_update' ld: drivers/pmdomain/thead/th1520-pm-domains.o: in function `th1520_pd_probe': th1520-pm-domains.c:(.text+0xb8): undefined reference to `th1520_aon_init' ld: th1520-pm-domains.c:(.text+0x1c6): undefined reference to `th1520_aon_power_update' Since the firmware code can easily be enabled for compile testing, there is no need to add stubs either, so just make it a hard dependency. Fixes: dc9a897dbb03 ("pmdomain: thead: Add power-domain driver for TH1520") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Michal Wilczynski <m.wilczynski@samsung.com> Link: https://lore.kernel.org/r/20250314154834.4053416-1-arnd@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-13pmdomain: thead: Add power-domain driver for TH1520Michal Wilczynski
The T-Head TH1520 SoC contains multiple power islands that can be programmatically turned on and off using the AON (Always-On) protocol and a hardware mailbox [1]. The relevant mailbox driver has already been merged into the mainline kernel in commit 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver"); Introduce a power-domain driver for the TH1520 SoC, which is using AON firmware protocol to communicate with E902 core through the hardware mailbox. This way it can send power on/off commands to the E902 core. The interaction with AUDIO power island e.g trying to turn it OFF proved to crash the firmware running on the E902 core. Introduce the workaround to disable interacting with the power island. [1] Link: https://openbeagle.org/beaglev-ahead/beaglev-ahead/-/blob/main/docs/TH1520%20System%20User%20Manual.pdf Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com> Acked-by: Drew Fustini <drew@pdp7.com> Link: https://lore.kernel.org/r/20250311171900.1549916-5-m.wilczynski@samsung.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-05pmdomain: Merge branch fixes into nextUlf Hansson
Merge the pmdomain fixes for v6.14-rc[n] into the next branch, to allow them to get tested together with the new changes that are targeted for v6.15. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-05pmdomain: amlogic: fix T7 ISP secpowerXianwei Zhao
ISP and MIPI_ISP, these two have a parent-child relationship, ISP depends on MIPI_ISP. Fixes: ca75e4b214c6 ("pmdomain: amlogic: Add support for T7 power domains controller") Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250303-fix-t7-pwrc-v1-1-b563612bcd86@amlogic.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-03-05pmdomain: rockchip: add regulator dependencyArnd Bergmann
When CONFIG_REGULATOR is disabled, this pmdomain driver fails to build: drivers/pmdomain/rockchip/pm-domains.c:653:30: error: implicit declaration of function 'devm_of_regulator_get'; did you mean 'devm_regulator_get'? [-Wimplicit-function-declaration] 653 | pd->supply = devm_of_regulator_get(pmu->dev, pd->node, "domain"); | ^~~~~~~~~~~~~~~~~~~~~ | devm_regulator_get drivers/pmdomain/rockchip/pm-domains.c:653:28: error: assignment to 'struct regulator *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 653 | pd->supply = devm_of_regulator_get(pmu->dev, pd->node, "domain"); | ^ Add a Kconfig dependency. Fixes: db6df2e3fc16 ("pmdomain: rockchip: add regulator support") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Dragan Simic <dsimic@manjaro.org> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20250304142803.689201-1-arnd@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-28pmdomain: rockchip: add regulator supportSebastian Reichel
Some power domains require extra voltages to be applied. For example trying to enable the GPU power domain on RK3588 fails when the SoC does not have VDD GPU enabled. The same is expected to happen for the NPU, which also has a dedicated supply line. We get the regulator using devm_of_regulator_get(), so a missing dependency in the devicetree is handled gracefully by printing a warning and creating a dummy regulator. This is necessary, since existing DTs do not have the regulator described. They might still work if the regulator is marked as always-on. It is also working if the regulator is enabled at boot time and the GPU driver is probed before the kernel disables unused regulators. The regulator itself is not acquired at driver probe time, since that creates an unsolvable circular dependency. The power domain driver must be probed early, since SoC peripherals need it. Regulators on the other hand depend on SoC peripherals like SPI, I2C or GPIO. MediaTek does not run into this, since they have two power domain drivers. Tested-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20250220-rk3588-gpu-pwr-domain-regulator-v6-7-a4f9c24e5b81@kernel.org [Ulf: Fixed conflict when applying] Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-28pmdomain: rockchip: fix rockchip_pd_power error handlingPeter Geis
The calls rockchip_pd_power makes to rockchip_pmu_set_idle_request lack any return error handling, causing device drivers to incorrectly believe the hardware idle requests succeed when they may have failed. This leads to software possibly accessing hardware that is powered off and the subsequent SError panic that follows. Add error checking and return errors to the calling function to prevent such crashes. gst-launch-1.0 videotestsrc num-buffers=2000 ! v4l2jpegenc ! fakesink Setting pipeline to PAUSED ...er-x64 Pipeline is PREROLLING ... Redistribute latency... rockchip-pm-domain ff100000.syscon:power-controller: failed to get ack on domain 'hevc', val=0x98260 SError Interrupt on CPU2, code 0x00000000bf000002 -- SError Signed-off-by: Peter Geis <pgwipeout@gmail.com> Link: https://lore.kernel.org/r/20241214215802.23989-1-pgwipeout@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20250220-rk3588-gpu-pwr-domain-regulator-v6-5-a4f9c24e5b81@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-28pmdomain: rockchip: reduce indentation in rockchip_pd_powerSebastian Reichel
Rework the logic, so that the function exits early when the power domain state is already correct to reduce code indentation. No functional change intended. Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Adrian Larumbe <adrian.larumbe@collabora.com> # On Rock 5B Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20250220-rk3588-gpu-pwr-domain-regulator-v6-4-a4f9c24e5b81@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-28pmdomain: rockchip: forward rockchip_do_pmu_set_power_domain errorsSebastian Reichel
Currently rockchip_do_pmu_set_power_domain prints a warning if there have been errors turning on the power domain, but it does not return any errors and rockchip_pd_power() tries to continue setting up the QOS registers. This usually results in accessing unpowered registers, which triggers an SError and a full system hang. This improves the error handling by forwarding the error to avoid kernel panics. Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Adrian Larumbe <adrian.larumbe@collabora.com> # On Rock 5B Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20250220-rk3588-gpu-pwr-domain-regulator-v6-3-a4f9c24e5b81@kernel.org [Ulf: Fixed conflict when applying] Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-28pmdomain: rockchip: cleanup mutex handling in rockchip_pd_powerSebastian Reichel
Use the cleanup infrastructure to handle the mutex, which slightly improve code readability for this function. Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Adrian Larumbe <adrian.larumbe@collabora.com> # On Rock 5B Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20250220-rk3588-gpu-pwr-domain-regulator-v6-2-a4f9c24e5b81@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-24pmdomain: Merge branch rockchip into nextUlf Hansson
Merge the immutable branch rockchip into next, to allow it to be tested together with the changes that are targeted for v6.15. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-24pmdomain: rockchip: Fix build errorUlf Hansson
To resolve the build error with undefined reference to `arm_smccc_1_1_get_conduit', let's add a build dependency to HAVE_ARM_SMCCC_DISCOVERY. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: 61eeb9678789 ("pmdomain: rockchip: Check if SMC could be handled by TA") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-19pmdomain: imx: gpcv2: use proper helper for property detectionAhmad Fatoum
Starting with commit c141ecc3cecd7 ("of: Warn when of_property_read_bool() is used on non-boolean properties"), probing the gpcv2 device on i.MX8M SoCs leads to warnings when LOCKDEP is enabled. Fix this by checking property presence with of_property_present as intended. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.kernel.org/r/20250218-gpcv2-of-property-present-v1-1-3bb1a9789654@pengutronix.de Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-19pmdomain: Merge branch rockchip into nextUlf Hansson
Merge the immutable branch rockchip into next, to allow it to be tested together with the changes that are targeted for v6.15. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-19pmdomain: rockchip: Check if SMC could be handled by TAShawn Lin
Non-existent trusted-firmware could lead to SMC calls into some unset location, that breaks the system. Let's check that it's supported before executing the SMC. Reported-by: Steven Price <steven.price@arm.com> Suggested-by: Heiko Stuebner <heiko@sntech.de> Fixes: 58ebba35ddab ("pmdomain: rockchip: Add smc call to inform firmware") Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Steven Price <steven.price@arm.com> Link: https://lore.kernel.org/r/1739926689-151827-1-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-14pmdomain: renesas: rcar-sysc: Drop fwnode_dev_initialized() callGeert Uytterhoeven
As of commit bab2d712eeaf9d60 ("PM: domains: Mark fwnodes when their powerdomain is added/removed") in v5.12, the pmdomain core takes care of marking the fwnode initialized, so there is no need to repeat it. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Saravana Kannan <saravanak@google.com> Link: https://lore.kernel.org/r/05c2ef630694a28b560426d8c426881cc14e8f7c.1738748678.git.geert+renesas@glider.be Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-14pmdomain: sunxi: add V853 ppu supportAndras Szemzo
V853 has a similar ppu like Allwinner D1, add compatible and the available pd names. Signed-off-by: Andras Szemzo <szemzo.andras@gmail.com> Link: https://lore.kernel.org/r/20250205125225.1152849-7-szemzo.andras@gmail.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-13mdomain: Merge branch rockchip into nextUlf Hansson
Merge the immutable branch rockchip into next, to allow it to be tested together with the changes that are targeted for v6.15. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-13pmdomain: rockchip: Add smc call to inform firmwareShawn Lin
Inform firmware to keep the power domain on or off. Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/1738736156-119203-5-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-13pmdomain: core: Introduce dev_pm_genpd_rpm_always_on()Ulf Hansson
For some usecases a consumer driver requires its device to remain power-on from the PM domain perspective during runtime. Using dev PM qos along with the genpd governors, doesn't work for this case as would potentially prevent the device from being runtime suspended too. To support these usecases, let's introduce dev_pm_genpd_rpm_always_on() to allow consumers drivers to dynamically control the behaviour in genpd for a device that is attached to it. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/1738736156-119203-4-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-13pmdomain: bcm2835-power: set flag GENPD_FLAG_ACTIVE_WAKEUPStefan Wahren
Set flag GENPD_FLAG_ACTIVE_WAKEUP to bcm2835_power genpd, then when a device is set as wakeup source using device_set_wakeup_enable, the power domain could be kept on to make sure the device could wakeup the system. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250201111926.31278-1-wahrenst@gmx.net Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-02-13pmdomain: ti: Use of_property_present() for non-boolean propertiesGeert Uytterhoeven
On BeagleBone Black: OF: /ocp: Read of boolean property 'clocks' with a value. OF: /ocp/interconnect@44c00000: Read of boolean property 'clocks' with a value. OF: /ocp/interconnect@48000000: Read of boolean property 'clocks' with a value. OF: /ocp/interconnect@4a000000: Read of boolean property 'clocks' with a value. The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/accb12bd6d048d95bd1feea07dd1a799ad3f8b31.1737532423.git.geert+renesas@glider.be Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-01-21pmdomain: airoha: Fix compilation error with Clang-20 and Thumb2 modeChristian Marangi
The use of R7 in the SMCCC conflicts with the compiler's use of R7 as a frame pointer in Thumb2 mode, which is forcibly enabled by Clang when profiling hooks are inserted via the -pg switch. This is a known issue and similar driver workaround this with a Makefile ifdef. Exact workaround are applied in drivers/firmware/arm_scmi/transports/Makefile and other similar driver. Suggested-by: Sudeep Holla <sudeep.holla@arm.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202501201840.XmpHXpQ4-lkp@intel.com/ Fixes: 82e703dd438b ("pmdomain: airoha: Add Airoha CPU PM Domain support") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Link: https://lore.kernel.org/r/20250120153817.11807-1-ansuelsmth@gmail.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-01-17pmdomain: arm: scmi_pm_domain: Send an explicit request to set the current stateSudeep Holla
On a system with multiple active SCMI agents, one agent(other than OSPM/ Linux or bootloader) would request to turn on a shared power domain before the Linux boots/initialise the genpds. So when the Linux boots and gets the power state as already ON, it just registers the genpd with a default ON state. However, when the driver that needs this shared power domain is probed genpd sees that the power domain status is ON and never makes any SCMI call to power it up which is correct. But, since Linux didn't make an explicit request to turn on the shared power domain, the SCMI platform firmware will not know if the OSPM agent is actively using it. Suppose the other agent that requested the shared power domain to be powered ON requests to power it OFF as it no longer needs it, the SCMI platform firmware needs to turn it off if there are no active users of it which in the above scenaro is the case. As a result of SCMI platform firmware turning off the resource, OSPM/ Linux will crash the moment as it expects the shared power domain to be powered ON. Send an explicit request to set the current state when setting up the genpd power domains so that OSPM registers its vote in the power domain state with the SCMI platform firmware. The other option is to not read the state and set the genpds as default OFF, but it can't handle the scenario on certain platforms where SCMI platform keeps all the power domains turned ON by default for faster boot (or any other such variations) and expect the OSPM to turn off the unused domains if power saving is required. Link: https://lore.kernel.org/all/Z4aBkezSWOPCXcUh@bogus Reported-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com> Reported-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20250115113931.1181309-1-sudeep.holla@arm.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-01-16pmdomain: Merge branch fixes into nextUlf Hansson
Merge the pmdomain fixes for v6.13-rc[n] into the next branch, to allow them to get tested together with the new changes that are targeted for v6.14. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-01-16pmdomain: imx8mp-blk-ctrl: add missing loop break conditionXiaolei Wang
Currently imx8mp_blk_ctrl_remove() will continue the for loop until an out-of-bounds exception occurs. pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : dev_pm_domain_detach+0x8/0x48 lr : imx8mp_blk_ctrl_shutdown+0x58/0x90 sp : ffffffc084f8bbf0 x29: ffffffc084f8bbf0 x28: ffffff80daf32ac0 x27: 0000000000000000 x26: ffffffc081658d78 x25: 0000000000000001 x24: ffffffc08201b028 x23: ffffff80d0db9490 x22: ffffffc082340a78 x21: 00000000000005b0 x20: ffffff80d19bc180 x19: 000000000000000a x18: ffffffffffffffff x17: ffffffc080a39e08 x16: ffffffc080a39c98 x15: 4f435f464f006c72 x14: 0000000000000004 x13: ffffff80d0172110 x12: 0000000000000000 x11: ffffff80d0537740 x10: ffffff80d05376c0 x9 : ffffffc0808ed2d8 x8 : ffffffc084f8bab0 x7 : 0000000000000000 x6 : 0000000000000000 x5 : ffffff80d19b9420 x4 : fffffffe03466e60 x3 : 0000000080800077 x2 : 0000000000000000 x1 : 0000000000000001 x0 : 0000000000000000 Call trace: dev_pm_domain_detach+0x8/0x48 platform_shutdown+0x2c/0x48 device_shutdown+0x158/0x268 kernel_restart_prepare+0x40/0x58 kernel_kexec+0x58/0xe8 __do_sys_reboot+0x198/0x258 __arm64_sys_reboot+0x2c/0x40 invoke_syscall+0x5c/0x138 el0_svc_common.constprop.0+0x48/0xf0 do_el0_svc+0x24/0x38 el0_svc+0x38/0xc8 el0t_64_sync_handler+0x120/0x130 el0t_64_sync+0x190/0x198 Code: 8128c2d0 ffffffc0 aa1e03e9 d503201f Fixes: 556f5cf9568a ("soc: imx: add i.MX8MP HSIO blk-ctrl") Cc: stable@vger.kernel.org Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250115014118.4086729-1-xiaolei.wang@windriver.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-01-16pmdomain: airoha: Add Airoha CPU PM Domain supportChristian Marangi
Add Airoha CPU PM Domain support to control frequency and power of CPU present on Airoha EN7581 SoC. Frequency and power can be controlled with the use of the SMC command by passing the performance state. The driver also expose a read-only clock that expose the current CPU frequency with SMC command. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Link: https://lore.kernel.org/r/20250109131313.32317-1-ansuelsmth@gmail.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-19pmdomain: Merge branch fixes into nextUlf Hansson
Merge the pmdomain fixes for v6.13-rc[n] into the next branch, to allow them to get tested together with the new changes that are targeted for v6.14. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-19pmdomain: core: add dummy release function to genpd deviceLucas Stach
The genpd device, which is really only used as a handle to lookup OPP, but not even registered to the device core otherwise and thus lifetime linked to the genpd struct it is contained in, is missing a release function. After b8f7bbd1f4ec ("pmdomain: core: Add missing put_device()") the device will be cleaned up going through the driver core device_release() function, which will warn when no release callback is present for the device. Add a dummy release function to shut up the warning. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Fixes: b8f7bbd1f4ec ("pmdomain: core: Add missing put_device()") Cc: stable@vger.kernel.org Message-ID: <20241218184433.1930532-1-l.stach@pengutronix.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-19pmdomain: imx: gpcv2: fix an OF node reference leak in imx_gpcv2_probe()Joe Hattori
imx_gpcv2_probe() leaks an OF node reference obtained by of_get_child_by_name(). Fix it by declaring the device node with the __free(device_node) cleanup construct. This bug was found by an experimental static analysis tool that I am developing. Fixes: 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver") Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp> Cc: stable@vger.kernel.org Message-ID: <20241215030159.1526624-1-joe@pf.is.s.u-tokyo.ac.jp> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10pmdomain: ti_sci: handle wake IRQs for IO daisy chain wakeupsKevin Hilman
When a device supports IO daisy-chain wakeups, it uses a dedicated wake IRQ. Devices with IO daisy-chain wakeups enabled should not set wakeup constraints since these can happen even from deep power states, so should not prevent the DM from picking deep power states. Wake IRQs are set with dev_pm_set_wake_irq() or dev_pm_set_dedicated_wake_irq(). The latter is used by the serial driver used on K3 platforms (drivers/tty/serial/8250/8250_omap.c) when the interrupts-extended property is used to describe the dedicated wakeup interrupt. Detect these wake IRQs in the suspend path, and if set, skip sending constraint. Tested-by: Dhruva Gole <d-gole@ti.com> Signed-off-by: Kevin Hilman <khilman@baylibre.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Message-ID: <20241206-lpm-v6-10-constraints-pmdomain-v6-3-833980158c68@baylibre.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10pmdomain: ti_sci: add wakeup constraint managementKevin Hilman
During system-wide suspend, check all devices connected to PM domain to see if they are wakeup-enabled. If so, set a TI SCI device constraint. Note: DM firmware clears all constraints on resume. Co-developed-by: Vibhore Vardhan <vibhore@ti.com> Signed-off-by: Vibhore Vardhan <vibhore@ti.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Dhruva Gole <d-gole@ti.com> Signed-off-by: Kevin Hilman <khilman@baylibre.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Message-ID: <20241206-lpm-v6-10-constraints-pmdomain-v6-2-833980158c68@baylibre.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10pmdomain: ti_sci: add per-device latency constraint managementKevin Hilman
For each device in a TI SCI PM domain, check whether the device has any resume latency constraints set via per-device PM QoS. If constraints are set, send them to DM via the new SCI constraints API. Checking for constraints happen for each device before system-wide suspend (via ->suspend() hook.) An important detail here is that the PM domain driver inserts itself into the path of both the ->suspend() and ->resume() hook path of *all* devices in the PM domain. This allows generic PM domain code to handle the constraint management and communication with TI SCI. Further, this allows device drivers to use existing PM QoS APIs to add/update constraints. DM firmware clears constraints during its resume, so Linux has to check/update/send constraints each time system suspends. Also note that the PM QoS framework uses usecs as the units for latency whereas the TI SCI firmware uses msecs, so a conversion is needed before passing to TI SCI. Co-developed-by: Vibhore Vardhan <vibhore@ti.com> Signed-off-by: Vibhore Vardhan <vibhore@ti.com> Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Dhruva Gole <d-gole@ti.com> Signed-off-by: Kevin Hilman <khilman@baylibre.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Message-ID: <20241206-lpm-v6-10-constraints-pmdomain-v6-1-833980158c68@baylibre.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10pmdomain: imx-gpcv2: Suppress bind attrsPeng Fan
The gpcv2 drivers on imx8m series are registered as platform devices and this opens the possibility of reloading the driver at runtime. But this doesn't actually work. There are some hardware sequence dependecy between blk ctrl and gpc, also power domains are used by other peripherals, so fix this by explicitly suppressing bind attrs. Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-ID: <20241206112731.98244-2-peng.fan@oss.nxp.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10pmdomain: imx8m[p]-blk-ctrl: Suppress bind attrsPeng Fan
The blk ctrl drivers on imx8m series are registered as platform devices and this opens the possibility of reloading the driver at runtime. But this doesn't actually work. There are some hardware sequence dependecy between blk ctrl and gpc, also power domains are used by other peripherals, so fix this by explicitly suppressing bind attrs. Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-ID: <20241206112731.98244-1-peng.fan@oss.nxp.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-10pmdomain: core: Support naming idle statesKonrad Dybcio
Commit 422f2d418186 ("arm64: dts: qcom: Drop undocumented domain "idle-state-name"") brought to light the common misbelief that idle-state-names also applies to e.g. PSCI power domain idle states. Make that a reality, mimicking the property name used by cpuidle states. Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Message-ID: <20241130-topic-idle_state_name-v1-2-d0ff67b0c8e9@oss.qualcomm.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-06Merge tag 'pmdomain-v6.13-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm Pull pmdomain fixes from Ulf Hansson: "Core: - Fix a couple of memory-leaks during genpd init/remove Providers: - imx: Adjust delay for gpcv2 to fix power up handshake - mediatek: Fix DT bindings by adding another nested power-domain layer" * tag 'pmdomain-v6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm: pmdomain: imx: gpcv2: Adjust delay after power up handshake pmdomain: core: Fix error path in pm_genpd_init() when ida alloc fails pmdomain: core: Add missing put_device() dt-bindings: power: mediatek: Add another nested power-domain layer
2024-12-02pmdomain: imx: gpcv2: Adjust delay after power up handshakeShengjiu Wang
The udelay(5) is not enough, sometimes below kernel panic still be triggered: [ 4.012973] Kernel panic - not syncing: Asynchronous SError Interrupt [ 4.012976] CPU: 2 UID: 0 PID: 186 Comm: (udev-worker) Not tainted 6.12.0-rc2-0.0.0-devel-00004-g8b1b79e88956 #1 [ 4.012982] Hardware name: Toradex Verdin iMX8M Plus WB on Dahlia Board (DT) [ 4.012985] Call trace: [...] [ 4.013029] arm64_serror_panic+0x64/0x70 [ 4.013034] do_serror+0x3c/0x70 [ 4.013039] el1h_64_error_handler+0x30/0x54 [ 4.013046] el1h_64_error+0x64/0x68 [ 4.013050] clk_imx8mp_audiomix_runtime_resume+0x38/0x48 [ 4.013059] __genpd_runtime_resume+0x30/0x80 [ 4.013066] genpd_runtime_resume+0x114/0x29c [ 4.013073] __rpm_callback+0x48/0x1e0 [ 4.013079] rpm_callback+0x68/0x80 [ 4.013084] rpm_resume+0x3bc/0x6a0 [ 4.013089] __pm_runtime_resume+0x50/0x9c [ 4.013095] pm_runtime_get_suppliers+0x60/0x8c [ 4.013101] __driver_probe_device+0x4c/0x14c [ 4.013108] driver_probe_device+0x3c/0x120 [ 4.013114] __driver_attach+0xc4/0x200 [ 4.013119] bus_for_each_dev+0x7c/0xe0 [ 4.013125] driver_attach+0x24/0x30 [ 4.013130] bus_add_driver+0x110/0x240 [ 4.013135] driver_register+0x68/0x124 [ 4.013142] __platform_driver_register+0x24/0x30 [ 4.013149] sdma_driver_init+0x20/0x1000 [imx_sdma] [ 4.013163] do_one_initcall+0x60/0x1e0 [ 4.013168] do_init_module+0x5c/0x21c [ 4.013175] load_module+0x1a98/0x205c [ 4.013181] init_module_from_file+0x88/0xd4 [ 4.013187] __arm64_sys_finit_module+0x258/0x350 [ 4.013194] invoke_syscall.constprop.0+0x50/0xe0 [ 4.013202] do_el0_svc+0xa8/0xe0 [ 4.013208] el0_svc+0x3c/0x140 [ 4.013215] el0t_64_sync_handler+0x120/0x12c [ 4.013222] el0t_64_sync+0x190/0x194 [ 4.013228] SMP: stopping secondary CPUs The correct way is to wait handshake, but it needs BUS clock of BLK-CTL be enabled, which is in separate driver. So delay is the only option here. The udelay(10) is a data got by experiment. Fixes: e8dc41afca16 ("pmdomain: imx: gpcv2: Add delay after power up handshake") Reported-by: Francesco Dolcini <francesco@dolcini.it> Closes: https://lore.kernel.org/lkml/20241007132555.GA53279@francesco-nb/ Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Cc: stable@vger.kernel.org Message-ID: <20241121075231.3910922-1-shengjiu.wang@nxp.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-12-02pmdomain: core: Fix error path in pm_genpd_init() when ida alloc failsUlf Hansson
When the ida allocation fails we need to free up the previously allocated memory before returning the error code. Let's fix this and while at it, let's also move the ida allocation to genpd_alloc_data() and the freeing to genpd_free_data(), as it better belongs there. Fixes: 899f44531fe6 ("pmdomain: core: Add GENPD_FLAG_DEV_NAME_FW flag") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Message-ID: <20241122134207.157283-3-ulf.hansson@linaro.org>
2024-12-02pmdomain: core: Add missing put_device()Ulf Hansson
When removing a genpd we don't clean up the genpd->dev correctly. Let's add the missing put_device() in genpd_free_data() to fix this. Fixes: 401ea1572de9 ("PM / Domain: Add struct device to genpd") Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Message-ID: <20241122134207.157283-2-ulf.hansson@linaro.org>
2024-12-01Get rid of 'remove_new' relic from platform driver structLinus Torvalds
The continual trickle of small conversion patches is grating on me, and is really not helping. Just get rid of the 'remove_new' member function, which is just an alias for the plain 'remove', and had a comment to that effect: /* * .remove_new() is a relic from a prototype conversion of .remove(). * New drivers are supposed to implement .remove(). Once all drivers are * converted to not use .remove_new any more, it will be dropped. */ This was just a tree-wide 'sed' script that replaced '.remove_new' with '.remove', with some care taken to turn a subsequent tab into two tabs to make things line up. I did do some minimal manual whitespace adjustment for places that used spaces to line things up. Then I just removed the old (sic) .remove_new member function, and this is the end result. No more unnecessary conversion noise. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-11-12pmdomain: qcom: rpmhpd: Add rpmhpd support for SM8750Jishnu Prakash
This adds the RPMHPD present in SM8750 SoCs. Signed-off-by: Jishnu Prakash <quic_jprakash@quicinc.com> Signed-off-by: Taniya Das <quic_tdas@quicinc.com> Signed-off-by: Melody Olvera <quic_molvera@quicinc.com> Message-ID: <20241112002444.2802092-3-quic_molvera@quicinc.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-11-12pmdomain: imx: Use of_property_present() for non-boolean propertiesRob Herring (Arm)
The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence. Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Message-ID: <20241104190742.276710-1-robh@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-11-01pmdomain: Merge branch fixes into nextUlf Hansson
Merge the pmdomain fixes for v6.12-rc[n] into the next branch, to allow them to get tested together with the new changes that are targeted for v6.13. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-11-01pmdomain: imx93-blk-ctrl: correct remove pathPeng Fan
The check condition should be 'i < bc->onecell_data.num_domains', not 'bc->onecell_data.num_domains' which will make the look never finish and cause kernel panic. Also disable runtime to address "imx93-blk-ctrl 4ac10000.system-controller: Unbalanced pm_runtime_enable!" Fixes: e9aa77d413c9 ("soc: imx: add i.MX93 media blk ctrl driver") Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Cc: stable@vger.kernel.org Message-ID: <20241101101252.1448466-1-peng.fan@oss.nxp.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-10-31pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe()Dario Binacchi
The patch standardizes the probe() code by replacing the two occurrences of dev_err() with dev_err_probe(). Indeed, dev_err_probe() was used in all other error paths of the probe() function. Note that dev_err_probe() has advantages even if the error code is not EPROBE_DEFER, such as the symbolic output of the error code. Therefore, it should generally be preferred over dev_err(). Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Message-ID: <20241025160430.4113467-1-dario.binacchi@amarulasolutions.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-10-31pmdomain: ti-sci: Use scope based of_node_put() to simplify code.Zhang Zekun
Use scope based of_node_put() to simplify the code logic, and we don't need to call of_node_put(). Besides, put of_parse_phandle_with_args() in the while loop to make code more simple. Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Message-ID: <20241024030442.119506-3-zhangzekun11@huawei.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-10-31pmdomain: ti-sci: Add missing of_node_put() for args.npZhang Zekun
of_parse_phandle_with_args() needs to call of_node_put() to decrement the refcount of args.np. So, Add the missing of_node_put() in the loop. Fixes: efa5c01cd7ee ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one") Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Message-ID: <20241024030442.119506-2-zhangzekun11@huawei.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-10-30pmdomain: Merge branch fixes into nextUlf Hansson
Merge the pmdomain fixes for v6.12-rc[n] into the next branch, to allow them to get tested together with the new changes that are targeted for v6.13. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>