media: qcom: camss: Add hooks to get CSID wrapper resources
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Wed, 14 Aug 2024 16:14:34 +0000 (17:14 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Sat, 12 Oct 2024 17:09:05 +0000 (19:09 +0200)
New SoCs have CSID devices inside of a shared "wrapper" i.e. a set of regs
which is responsible for manging the muxes of the CSID to various other
blocks throughout CAMSS.

Not every SoC has this top-level muxing layer so make it optional depending
on whether its declared as a resource or not.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/qcom/camss/camss.c
drivers/media/platform/qcom/camss/camss.h

index 34c1bd5ed54096e43465f3d7b8d5f6250aed0860..542c2fdc5d5c0e1835a4ddd2c15aba5af10971af 100644 (file)
@@ -1780,6 +1780,7 @@ err_cleanup:
  */
 static int camss_init_subdevices(struct camss *camss)
 {
+       struct platform_device *pdev = to_platform_device(camss->dev);
        const struct camss_resources *res = camss->res;
        unsigned int i;
        int ret;
@@ -1806,6 +1807,17 @@ static int camss_init_subdevices(struct camss *camss)
                }
        }
 
+       /* Get optional CSID wrapper regs shared between CSID devices */
+       if (res->csid_wrapper_res) {
+               char *reg = res->csid_wrapper_res->reg;
+               void __iomem *base;
+
+               base = devm_platform_ioremap_resource_byname(pdev, reg);
+               if (IS_ERR(base))
+                       return PTR_ERR(base);
+               camss->csid_wrapper_base = base;
+       }
+
        for (i = 0; i < camss->res->csid_num; i++) {
                ret = msm_csid_subdev_init(camss, &camss->csid[i],
                                           &res->csid_res[i], i);
index 73c47c07fc30c5b253b2b62706025a5c7fd4f430..0ce84fcbbd25c7825212beb74073ffd4c70858a8 100644 (file)
@@ -66,6 +66,10 @@ struct resources_icc {
        struct icc_bw_tbl icc_bw_tbl;
 };
 
+struct resources_wrapper {
+       char *reg;
+};
+
 enum pm_domain {
        PM_DOMAIN_VFE0 = 0,
        PM_DOMAIN_VFE1 = 1,
@@ -93,6 +97,7 @@ struct camss_resources {
        const struct camss_subdev_resources *csid_res;
        const struct camss_subdev_resources *ispif_res;
        const struct camss_subdev_resources *vfe_res;
+       const struct resources_wrapper *csid_wrapper_res;
        const struct resources_icc *icc_res;
        const unsigned int icc_path_num;
        const unsigned int csiphy_num;
@@ -110,6 +115,7 @@ struct camss {
        struct csid_device *csid;
        struct ispif_device *ispif;
        struct vfe_device *vfe;
+       void __iomem *csid_wrapper_base;
        atomic_t ref_count;
        int genpd_num;
        struct device *genpd;