+ "Error: CSID depends on VFE/IFE device ops!\n")) {
+ return -EINVAL;
+ }
+
csid->res->hw_ops->subdev_init(csid);
/* Memory */
@@ -1031,9 +1035,11 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
* VFE to be initialized before CSID
*/
if (id >= 2) /* VFE/CSID lite */
- csid->base = camss->vfe[id].base + VFE_480_LITE_CSID_OFFSET;
+ csid->base = csid->res->parent_dev_ops->get_base_address(camss, id)
+ + VFE_480_LITE_CSID_OFFSET;
else
- csid->base = camss->vfe[id].base + VFE_480_CSID_OFFSET;
+ csid->base = csid->res->parent_dev_ops->get_base_address(camss, id)
+ + VFE_480_CSID_OFFSET;
} else {
csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]);
if (IS_ERR(csid->base))
diff --git a/drivers/media/platform/qcom/camss/camss-csid.h b/drivers/media/platform/qcom/camss/camss-csid.h
index 0e385d17c250..8cdae98e4dca 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.h
+++ b/drivers/media/platform/qcom/camss/camss-csid.h
@@ -157,6 +157,7 @@ struct csid_hw_ops {
struct csid_subdev_resources {
bool is_lite;
const struct csid_hw_ops *hw_ops;
+ const struct parent_dev_ops *parent_dev_ops;
const struct csid_formats *formats;
};
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 37060eaa0ba5..4d625ef59cf7 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -32,6 +32,8 @@
#define CAMSS_CLOCK_MARGIN_NUMERATOR 105
#define CAMSS_CLOCK_MARGIN_DENOMINATOR 100
+static const struct parent_dev_ops vfe_parent_dev_ops;
+
static const struct camss_subdev_resources csiphy_res_8x16[] = {
/* CSIPHY0 */
{
@@ -87,6 +89,7 @@ static const struct camss_subdev_resources csid_res_8x16[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_1,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_1
}
},
@@ -109,6 +112,7 @@ static const struct camss_subdev_resources csid_res_8x16[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_1,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_1
}
},
@@ -226,6 +230,7 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_7,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_7
}
},
@@ -248,6 +253,7 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_7,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_7
}
},
@@ -270,6 +276,7 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_7,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_7
}
},
@@ -292,6 +299,7 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_7,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_7
}
}
@@ -445,6 +453,7 @@ static const struct camss_subdev_resources csid_res_660[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_7,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_7
}
},
@@ -470,6 +479,7 @@ static const struct camss_subdev_resources csid_res_660[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_7,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_7
}
},
@@ -495,6 +505,7 @@ static const struct camss_subdev_resources csid_res_660[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_7,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_7
}
},
@@ -520,6 +531,7 @@ static const struct camss_subdev_resources csid_res_660[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_4_7,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_4_7
}
}
@@ -714,6 +726,7 @@ static const struct camss_subdev_resources csid_res_845[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -739,6 +752,7 @@ static const struct camss_subdev_resources csid_res_845[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -765,6 +779,7 @@ static const struct camss_subdev_resources csid_res_845[] = {
.csid = {
.is_lite = true,
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
}
@@ -957,6 +972,7 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -974,6 +990,7 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.type = CAMSS_SUBDEV_TYPE_CSID,
.csid = {
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -991,6 +1008,7 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.csid = {
.is_lite = true,
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -1008,6 +1026,7 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.csid = {
.is_lite = true,
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
}
@@ -1212,6 +1231,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.interrupt = { "csid0" },
.csid = {
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -1227,6 +1247,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.interrupt = { "csid1" },
.csid = {
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -1242,6 +1263,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.interrupt = { "csid2" },
.csid = {
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -1257,6 +1279,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.interrupt = { "csid3" },
.csid = {
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -1272,6 +1295,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.csid = {
.is_lite = true,
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -1287,6 +1311,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.csid = {
.is_lite = true,
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -1302,6 +1327,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.csid = {
.is_lite = true,
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
},
@@ -1317,6 +1343,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.csid = {
.is_lite = true,
.hw_ops = &csid_ops_gen2,
+ .parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
}
}
@@ -1661,6 +1688,48 @@ void camss_pm_domain_off(struct camss *camss, int id)
}
}
+static int vfe_parent_dev_ops_get(struct camss *camss, int id)
+{
+ int ret = -EINVAL;
+
+ if (id < camss->res->vfe_num) {