Commit Graph

5 Commits

Author SHA1 Message Date
Lukas Bulwahn
152d59f1ae pmdomain: arm: scmi_pm_domain: remove code clutter
There is no need to introduce the boolean power_on to select the constant
value for state. Simply pass the value for state as argument. Just remove
this code clutter.

No functional change.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20250606090802.597504-1-lukas.bulwahn@redhat.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2025-06-18 14:44:43 +02:00
Sudeep Holla
6cf5db71dc pmdomain: arm: scmi_pm_domain: Remove redundant state verification
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-17 11:12:01 +01:00
Sudeep Holla
c2d7aa308e pmdomain: arm: scmi_pm_domain: Send an explicit request to set the current state
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-17 12:17:16 +01:00
Peng Fan
e5cddc3406 pmdomain: arm: scmi_pm_domain: set flag GENPD_FLAG_ACTIVE_WAKEUP
Set flag GENPD_FLAG_ACTIVE_WAKEUP to scmi 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: Peng Fan <peng.fan@nxp.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20240514131833.911703-1-peng.fan@oss.nxp.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-06-05 11:54:43 +02:00
Sudeep Holla
af78e5c309 firmware: arm_scmi: Move power-domain driver to the pmdomain dir
To simplify with maintenance let's move the Arm SCMI power-domain driver
to the new pmdomain directory.

Link: https://lore.kernel.org/all/20230921113328.3208651-1-sudeep.holla@arm.com
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2023-09-21 16:35:14 +01:00