[PATCH v4 2/4] media: qcom: camss: Set the streams API flag per SoC

From: Hitesh Patel

Date: Mon Oct 12 2026 - 08:17:04 EST


streams_enable was repeated on every CSIPHY, CSID and VFE resource entry
of a platform: fourteen assignments for SM8250, and fifteen more for each
further platform enabled. The flag describes the driver's support for a
SoC, not a property of an individual subdev, and nothing reads it before
the camss resources are available.

Declare it once on struct camss_resources alongside version, and have the
three subdevs consult camss->res->streams_enable at registration. SM8250
keeps the same behaviour with one assignment instead of fourteen.

Suggested-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
Signed-off-by: Hitesh Patel <hitesh@xxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/camss/camss-csid.c | 2 +-
drivers/media/platform/qcom/camss/camss-csid.h | 1 -
drivers/media/platform/qcom/camss/camss-csiphy.c | 4 ++--
drivers/media/platform/qcom/camss/camss-csiphy.h | 1 -
drivers/media/platform/qcom/camss/camss-vfe.c | 10 +++++-----
drivers/media/platform/qcom/camss/camss-vfe.h | 1 -
drivers/media/platform/qcom/camss/camss.c | 15 +--------------
drivers/media/platform/qcom/camss/camss.h | 2 ++
8 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
index 991275398..57c8f13f6 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -1828,7 +1828,7 @@ int msm_csid_register_entity(struct csid_device *csid,
struct v4l2_subdev *sd = &csid->subdev;
struct media_pad *pads = csid->pads;
struct device *dev = csid->camss->dev;
- bool streams_api = csid->res->streams_enable;
+ bool streams_api = csid->camss->res->streams_enable;
unsigned int num_pads = csid_is_lite(csid) ? MSM_CSID_PADS_NUM : MSM_CSID_PADS_NUM - 1;
int i;
int ret;
diff --git a/drivers/media/platform/qcom/camss/camss-csid.h b/drivers/media/platform/qcom/camss/camss-csid.h
index a312103cf..20ea67b96 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.h
+++ b/drivers/media/platform/qcom/camss/camss-csid.h
@@ -184,7 +184,6 @@ struct csid_hw_ops {

struct csid_subdev_resources {
bool is_lite;
- bool streams_enable;
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-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
index 81ca1b0a2..cece9bcb4 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
@@ -1157,7 +1157,7 @@ int msm_csiphy_register_entity(struct csiphy_device *csiphy,
struct media_pad *pads = csiphy->pads;
struct camss *camss = csiphy->camss;
struct device *dev = camss->dev;
- bool streams_api = csiphy->res->streams_enable;
+ bool streams_api = csiphy->camss->res->streams_enable;
int ret;

if (streams_api)
@@ -1238,7 +1238,7 @@ void msm_csiphy_unregister_entity(struct csiphy_device *csiphy)
if (!IS_ERR(csiphy->phy))
phy_exit(csiphy->phy);
v4l2_device_unregister_subdev(&csiphy->subdev);
- if (csiphy->res->streams_enable)
+ if (csiphy->camss->res->streams_enable)
v4l2_subdev_cleanup(&csiphy->subdev);
media_entity_cleanup(&csiphy->subdev.entity);
}
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h
index f93971bb1..ca3160af7 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.h
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.h
@@ -86,7 +86,6 @@ struct csiphy_hw_ops {

struct csiphy_subdev_resources {
u8 id;
- bool streams_enable;
const struct csiphy_hw_ops *hw_ops;
const struct csiphy_formats *formats;
};
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index 2cfca1b62..13cbce9f9 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -2168,7 +2168,7 @@ int msm_vfe_register_entities(struct vfe_device *vfe,
pads = vfe->line[i].pads;
video_out = &vfe->line[i].video_out;

- v4l2_subdev_init(sd, vfe->res->streams_enable ? &vfe_streams_v4l2_ops
+ v4l2_subdev_init(sd, vfe->camss->res->streams_enable ? &vfe_streams_v4l2_ops
: &vfe_v4l2_ops);
sd->internal_ops = &vfe_v4l2_internal_ops;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
@@ -2199,7 +2199,7 @@ int msm_vfe_register_entities(struct vfe_device *vfe,
goto error_init;
}

- if (vfe->res->streams_enable) {
+ if (vfe->camss->res->streams_enable) {
ret = v4l2_subdev_init_finalize(sd);
if (ret) {
dev_err(dev, "Failed to finalize subdev: %d\n", ret);
@@ -2255,7 +2255,7 @@ int msm_vfe_register_entities(struct vfe_device *vfe,
v4l2_device_unregister_subdev(sd);

error_subdev_cleanup:
- if (vfe->res->streams_enable)
+ if (vfe->camss->res->streams_enable)
v4l2_subdev_cleanup(sd);

error_reg_subdev:
@@ -2268,7 +2268,7 @@ int msm_vfe_register_entities(struct vfe_device *vfe,

msm_video_unregister(video_out);
v4l2_device_unregister_subdev(sd);
- if (vfe->res->streams_enable)
+ if (vfe->camss->res->streams_enable)
v4l2_subdev_cleanup(sd);
media_entity_cleanup(&sd->entity);
}
@@ -2293,7 +2293,7 @@ void msm_vfe_unregister_entities(struct vfe_device *vfe)

msm_video_unregister(video_out);
v4l2_device_unregister_subdev(sd);
- if (vfe->res->streams_enable)
+ if (vfe->camss->res->streams_enable)
v4l2_subdev_cleanup(sd);
media_entity_cleanup(&sd->entity);
}
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h
index d1c54a516..ae9dad353 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.h
+++ b/drivers/media/platform/qcom/camss/camss-vfe.h
@@ -138,7 +138,6 @@ struct vfe_subdev_resources {
char *pd_name;
bool has_vbif;
char *vbif_name;
- bool streams_enable;
const struct vfe_hw_ops *hw_ops;
const struct camss_formats *formats_rdi;
const struct camss_formats *formats_pix;
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 452afe16a..2c9c4ce50 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -1954,7 +1954,6 @@ static const struct camss_subdev_resources csiphy_res_8250[] = {
.interrupt = { "csiphy0" },
.csiphy = {
.id = 0,
- .streams_enable = true,
.hw_ops = &csiphy_ops_3ph_1_0,
.formats = &csiphy_formats_sdm845
}
@@ -1972,7 +1971,6 @@ static const struct camss_subdev_resources csiphy_res_8250[] = {
.interrupt = { "csiphy1" },
.csiphy = {
.id = 1,
- .streams_enable = true,
.hw_ops = &csiphy_ops_3ph_1_0,
.formats = &csiphy_formats_sdm845
}
@@ -1990,7 +1988,6 @@ static const struct camss_subdev_resources csiphy_res_8250[] = {
.interrupt = { "csiphy2" },
.csiphy = {
.id = 2,
- .streams_enable = true,
.hw_ops = &csiphy_ops_3ph_1_0,
.formats = &csiphy_formats_sdm845
}
@@ -2008,7 +2005,6 @@ static const struct camss_subdev_resources csiphy_res_8250[] = {
.interrupt = { "csiphy3" },
.csiphy = {
.id = 3,
- .streams_enable = true,
.hw_ops = &csiphy_ops_3ph_1_0,
.formats = &csiphy_formats_sdm845
}
@@ -2026,7 +2022,6 @@ static const struct camss_subdev_resources csiphy_res_8250[] = {
.interrupt = { "csiphy4" },
.csiphy = {
.id = 4,
- .streams_enable = true,
.hw_ops = &csiphy_ops_3ph_1_0,
.formats = &csiphy_formats_sdm845
}
@@ -2044,7 +2039,6 @@ static const struct camss_subdev_resources csiphy_res_8250[] = {
.interrupt = { "csiphy5" },
.csiphy = {
.id = 5,
- .streams_enable = true,
.hw_ops = &csiphy_ops_3ph_1_0,
.formats = &csiphy_formats_sdm845
}
@@ -2064,7 +2058,6 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.reg = { "csid0" },
.interrupt = { "csid0" },
.csid = {
- .streams_enable = true,
.hw_ops = &csid_ops_gen2,
.parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
@@ -2082,7 +2075,6 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.reg = { "csid1" },
.interrupt = { "csid1" },
.csid = {
- .streams_enable = true,
.hw_ops = &csid_ops_gen2,
.parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
@@ -2100,7 +2092,6 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.interrupt = { "csid2" },
.csid = {
.is_lite = true,
- .streams_enable = true,
.hw_ops = &csid_ops_gen2,
.parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
@@ -2118,7 +2109,6 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.interrupt = { "csid3" },
.csid = {
.is_lite = true,
- .streams_enable = true,
.hw_ops = &csid_ops_gen2,
.parent_dev_ops = &vfe_parent_dev_ops,
.formats = &csid_formats_gen2
@@ -2148,7 +2138,6 @@ static const struct camss_subdev_resources vfe_res_8250[] = {
.line_num = 3,
.has_pd = true,
.pd_name = "ife0",
- .streams_enable = true,
.hw_ops = &vfe_ops_480,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
@@ -2175,7 +2164,6 @@ static const struct camss_subdev_resources vfe_res_8250[] = {
.line_num = 3,
.has_pd = true,
.pd_name = "ife1",
- .streams_enable = true,
.hw_ops = &vfe_ops_480,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
@@ -2200,7 +2188,6 @@ static const struct camss_subdev_resources vfe_res_8250[] = {
.vfe = {
.is_lite = true,
.line_num = 4,
- .streams_enable = true,
.hw_ops = &vfe_ops_480,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
@@ -2225,7 +2212,6 @@ static const struct camss_subdev_resources vfe_res_8250[] = {
.vfe = {
.is_lite = true,
.line_num = 4,
- .streams_enable = true,
.hw_ops = &vfe_ops_480,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
@@ -5745,6 +5731,7 @@ static const struct camss_resources sm6350_resources = {

static const struct camss_resources sm8250_resources = {
.version = CAMSS_8250,
+ .streams_enable = true,
.pd_name = "top",
.csiphy_res = csiphy_res_8250,
.csid_res = csid_res_8250,
diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
index dc07ed5d1..5cfae3f3d 100644
--- a/drivers/media/platform/qcom/camss/camss.h
+++ b/drivers/media/platform/qcom/camss/camss.h
@@ -106,6 +106,8 @@ enum icc_count {

struct camss_resources {
enum camss_version version;
+ /* Drive this platform through the V4L2 subdev streams API */
+ bool streams_enable;
const char *pd_name;
const char *pm_clks[CAMSS_RES_MAX];
const struct camss_subdev_resources *csiphy_res;
--
2.43.0