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

From: Bryan O'Donoghue
Date: Tue Oct 31 2023 - 07:38:26 EST


On 31/10/2023 10:53, Konrad Dybcio wrote:
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


Consistent with existing commentary in this function ->

/* Memory */

/* Interrupts */

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

It looks so. Then again I'm sure checking here saves a few instructions and stack operations..

---
bod