Re: [PATCH v2 5/5] media: qcom: camss: Add support for named power-domains

From: Konrad Dybcio
Date: Tue Oct 31 2023 - 06:53:14 EST


On 26.10.2023 17:50, Bryan O'Donoghue wrote:
> Right now we use fixed indexes to assign power-domains, with a
> requirement for the TOP GDSC to come last in the list.
>
> Adding support for named power-domains means the declaration in the dtsi
> can come in any order.
>
> After this change we continue to support the old indexing - if a SoC
> resource declration or the in-use dtb doesn't declare power-domain names
> we fall back to the default legacy indexing.
>
> From this point on though new SoC additions should contain named
> power-domains, eventually we will drop support for legacy indexing.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
> ---
> drivers/media/platform/qcom/camss/camss-vfe.c | 24 ++++++++++++++++-
> drivers/media/platform/qcom/camss/camss.c | 26 +++++++++++++++----
> drivers/media/platform/qcom/camss/camss.h | 2 ++
> 3 files changed, 46 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
> index ebd5da6ad3f2f..cb48723efd8a0 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe.c
> @@ -1381,7 +1381,29 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
> if (!res->line_num)
> return -EINVAL;
>
> - if (res->has_pd) {
> + /* Power domain */
Unnecessary, I think

> +
> + if (res->pd_name) {
No need to nullcheck, dev_pm_domain_attach_by_name seems to return
NULL when the name is NULL

[...]
> - if (IS_ERR(camss->genpd)) {
> + if (camss->res->pd_name) {
ditto
> + camss->genpd = dev_pm_domain_attach_by_name(camss->dev,
> + camss->res->pd_name);
> + if (IS_ERR(camss->genpd)) {
> + ret = PTR_ERR(camss->genpd);
> + goto fail_pm;
> + }
> + }
> +
Looks good otherwise, I think

Konrad