1

pmdomain: raspberrypi-power: Add logging to rpi_firmware_set_power

The Raspberry Pi power driver heavily relies on the logging of the
underlying firmware driver. This results in disadvantages like unspecific
error messages or limited debugging options. So implement the logging for
the most important function rpi_firmware_set_power.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20240728114200.75559-5-wahrenst@gmx.net
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Stefan Wahren 2024-07-28 13:41:48 +02:00 committed by Ulf Hansson
parent 49d2a1ec68
commit eb3896ea9e

View File

@ -48,33 +48,39 @@ struct rpi_power_domain_packet {
* Asks the firmware to enable or disable power on a specific power
* domain.
*/
static int rpi_firmware_set_power(struct rpi_power_domain *rpi_domain, bool on)
static int rpi_firmware_set_power(struct generic_pm_domain *domain, bool on)
{
struct rpi_power_domain *rpi_domain =
container_of(domain, struct rpi_power_domain, base);
bool old_interface = rpi_domain->old_interface;
struct rpi_power_domain_packet packet;
int ret;
packet.domain = rpi_domain->domain;
packet.state = on;
return rpi_firmware_property(rpi_domain->fw,
rpi_domain->old_interface ?
RPI_FIRMWARE_SET_POWER_STATE :
RPI_FIRMWARE_SET_DOMAIN_STATE,
&packet, sizeof(packet));
ret = rpi_firmware_property(rpi_domain->fw, old_interface ?
RPI_FIRMWARE_SET_POWER_STATE :
RPI_FIRMWARE_SET_DOMAIN_STATE,
&packet, sizeof(packet));
if (ret)
dev_err(&domain->dev, "Failed to set %s to %u (%d)\n",
old_interface ? "power" : "domain", on, ret);
else
dev_dbg(&domain->dev, "Set %s to %u\n",
old_interface ? "power" : "domain", on);
return ret;
}
static int rpi_domain_off(struct generic_pm_domain *domain)
{
struct rpi_power_domain *rpi_domain =
container_of(domain, struct rpi_power_domain, base);
return rpi_firmware_set_power(rpi_domain, false);
return rpi_firmware_set_power(domain, false);
}
static int rpi_domain_on(struct generic_pm_domain *domain)
{
struct rpi_power_domain *rpi_domain =
container_of(domain, struct rpi_power_domain, base);
return rpi_firmware_set_power(rpi_domain, true);
return rpi_firmware_set_power(domain, true);
}
static void rpi_common_init_power_domain(struct rpi_power_domains *rpi_domains,