[PATCH v2 2/2] pmdomain: spacemit: Add power domain driver

Iker Pedrosa ikerpedrosam at gmail.com
Thu Oct 15 10:38:00 PDT 2026


El jue, 8 oct 2026 a las 5:45, Yixun Lan (<dlan at kernel.org>) escribió:
>
>   SpacemiT's PMU (Power Management Unit) consist of several power domains
> which can be managed independently, depending on different application
> scenario, each domain can be powered on/off for saving power.

Tested on an OrangePi RV2 with the PowerVR GPU power domain. A few
comments below.

> +struct spacemit_pm_domain_param {
> +       int reg_pwr_ctrl;
> +       int bit_hw_mode;
> +       int bit_sleep2;
> +       int bit_sleep1;
> +       int bit_isolation;
> +       int bit_auto_pwr_on;
> +       int bit_hw_pwr_stat;
> +       int bit_pwr_stat;
> +       int use_hw;

bit_* fields hold values 0-15, u8 would be more precise than an int.
Similarly, reg_pwr_ctrl fits in u16 and use_hw could be bool.

> +static int spacemit_pd_power_on(struct generic_pm_domain *domain)
> ...
> +               dev_err(&domain->dev, "power-on domain: %d, error\n", spd->pm_index);

You could include the domain name failing, that would help identify
what's causing the problem. You are already including the name in the
"power-off" error message.

> +static int spacemit_pm_domain_probe(struct auxiliary_device *adev,
> +                                   const struct auxiliary_device_id *id)
> ...
> +       pmu->genpd_data.domains     = (struct generic_pm_domain **)pmu->domains;

This cast relies on genpd being the first member of struct
spacemit_pm_domain. Reordering the struct silently breaks it. Consider
allocating a separate struct generic_pm_domain ** array and storing
&pd->genpd explicitly

Tested-by: Iker Pedrosa <ikerpedrosam at gmail.com>



More information about the linux-riscv mailing list