Skip to contentSkip to conversation

media: qcom: camss: Two routing fixes and one tidy-up

PATCH In review [email protected] 4 participants 11 messages Nov 22 – Nov 24

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

cover media: qcom: camss: Two routing fixes and one tidy-up

This series lands late-enough in the kernel cycle and applies against the camss-next branch staging to linux-media/next.

First up a patch drops the declaration of CSID2 from x1e/Hamoa since this CSID doesn't have a corresponding VFE it is entirely useless and violates our 1:1 mapping between VFE and CSID. Since CSID2 routes nowhere there's no reason to keep it around.

Second is a fix for a longstanding error in CAMSS which as stemmed from the original development of post ISPIF devices. These devices have a 1:1 mapping between CSID and VFE so the mapping we have given to user-space which declares each CSID as connecting to each VFE is just plain wrong on these devices and has always been.

So the second patch addresses that longstanding issue but, I've been holding off on fixing this for a while since I believed it might require extensive surgery, but in the end its quite simple to do.

Finally the third patch is a tidy-up patch which inverts our current logic of continuously adding new elements to the src_pad_code switch for new SoCs filtering those SoCs down to a default: statement. In fact is is the old SoCs which are the exceptional case so, just do the switch for the old and the default for the new.

---
Bryan O'Donoghue (3):
media: qcom: camss: x1e80100: Fix CSID2 routing to nowhere
media: qcom: camss: Fix CSID to VFE routing for non ISPIF platforms
media: qcom: camss: vfe: Eliminate ever expanding src_pad_code switch logic

 drivers/media/platform/qcom/camss/camss-vfe.c | 20 +--------
 drivers/media/platform/qcom/camss/camss.c     | 59 ++++++++++-----------------
 2 files changed, 23 insertions(+), 56 deletions(-)

---
base-commit: 2ad58ca589da80990b7afbcff018777851577f89
change-id: 20261122-camss-routing-fixes-b178bdb84f20

Best regards,

Signature · 2 lines
---
bod
author maintainer
#1 lore raw

PATCH 1/3 media: qcom: camss: x1e80100: Fix CSID2 routing to nowhere

From: Bryan O'Donoghue <[email protected]>

CSID2 doesn't actually have a corresponding VFE it can receive CSIPHY input and raise an interrupt but it can't drive any VFE write-master. This is basically useless and not worth coding around in the upstream driver. If we find a real use for this we can turn this back on. In the meantime drop the definition, it only confuses things.

Fixes 1830cf0f56c3 ("media: qcom: camss: Add x1e80100 specific support")
---
 drivers/media/platform/qcom/camss/camss.c | 21 ---------------------
 1 file changed, 21 deletions(-)
drivers/media/platform/qcom/camss/camss.c +0 -21
index 26e3f2aa3ef24..aa6d01d8fcb2a 100644
@@ -4515,27 +4515,6 @@ static const struct camss_subdev_resources csid_res_x1e80100[] = {
 			.formats = &csid_formats_gen2
 		},
 	},
-	/* CSID2 */
-	{
-		.regulators = {},
-		.clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb",
-			   "cpas_fast_ahb", "csid", "csid_csiphy_rx" },
-		.clock_rate = { { 0 },
-				{ 0 },
-				{ 64000000, 80000000 },
-				{ 80000000,  100000000, 200000000,
-				  300000000, 400000000 },
-				{ 300000000, 400000000, 480000000 },
-				{ 300000000, 400000000, 480000000 }, },
-		.reg = { "csid2" },
-		.interrupt = { "csid2" },
-		.csid = {
-			.frame_sync_en = true,
-			.hw_ops = &csid_ops_680,
-			.parent_dev_ops = &vfe_parent_dev_ops,
-			.formats = &csid_formats_gen2
-		},
-	},
 	/* CSID_LITE0 */
 	{
 		.regulators = {},
Signature · 1 line
2.56.0
reviewer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] media: qcom: camss: x1e80100: Fix CSID2 routing to nowhere

Quoted 11 lines · On Sun, Nov 22, 2026 at 3:10 AM <[email protected]> wrote:

From: Bryan O'Donoghue <[email protected]>

CSID2 doesn't actually have a corresponding VFE it can receive CSIPHY input and raise an interrupt but it can't drive any VFE write-master. This is basically useless and not worth coding around in the upstream driver. If we find a real use for this we can turn this back on. In the meantime drop the definition, it only confuses things.

Fixes 1830cf0f56c3 ("media: qcom: camss: Add x1e80100 specific support")
Quoted 40 lines
---
 drivers/media/platform/qcom/camss/camss.c | 21 ---------------------
 1 file changed, 21 deletions(-)
drivers/media/platform/qcom/camss/camss.c +0 -22
index 26e3f2aa3ef24..aa6d01d8fcb2a 100644
@@ -4515,27 +4515,6 @@ static const struct camss_subdev_resources csid_res_x1e80100[] = {
                        .formats = &csid_formats_gen2
                },
        },
-       /* CSID2 */
-       {
-               .regulators = {},
-               .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb",
-                          "cpas_fast_ahb", "csid", "csid_csiphy_rx" },
-               .clock_rate = { { 0 },
-                               { 0 },
-                               { 64000000, 80000000 },
-                               { 80000000,  100000000, 200000000,
-                                 300000000, 400000000 },
-                               { 300000000, 400000000, 480000000 },
-                               { 300000000, 400000000, 480000000 }, },
-               .reg = { "csid2" },
-               .interrupt = { "csid2" },
-               .csid = {
-                       .frame_sync_en = true,
-                       .hw_ops = &csid_ops_680,
-                       .parent_dev_ops = &vfe_parent_dev_ops,
-                       .formats = &csid_formats_gen2
-               },
-       },
        /* CSID_LITE0 */
        {
                .regulators = {},
 
--

2.56.0

reviewer Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] media: qcom: camss: x1e80100: Fix CSID2 routing to nowhere

In reply to [email protected]
Quoted 10 lines · On 11/22/26 04:10, [email protected] wrote:

From: Bryan O'Donoghue <[email protected]>

CSID2 doesn't actually have a corresponding VFE it can receive CSIPHY input and raise an interrupt but it can't drive any VFE write-master. This is basically useless and not worth coding around in the upstream driver. If we find a real use for this we can turn this back on. In the meantime drop the definition, it only confuses things.

Fixes 1830cf0f56c3 ("media: qcom: camss: Add x1e80100 specific support")
Signature · 2 lines
Best wishes,
Vladimir
author maintainer
#4 lore raw

PATCH 2/3 media: qcom: camss: Fix CSID to VFE routing for non ISPIF platforms

In reply to [email protected]

From: Bryan O'Donoghue <[email protected]>

This patch fixes a basic routing error that has been present in CAMSS since the addition of non ISPIF platforms.

The ISPIF platforms can route any CSID to any VFE however this is not the case on the non ISPIF platforms.

The current requirement is a 1:1 mapping CSID0->VFE0 CSID1->VFE1 etc. Demote the spurious poly-mapping down to its 1:1 real form.

Fixes 9229b53f9758 ("Revert "media: qcom: camss: Restructure camss_link_entities"")
---
 drivers/media/platform/qcom/camss/camss.c | 38 ++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 16 deletions(-)
drivers/media/platform/qcom/camss/camss.c +22 -16
index aa6d01d8fcb2a..060879a55e483 100644
@@ -5257,24 +5257,30 @@ static int camss_link_entities(struct camss *camss)
 					}
 				}
 	} else {
-		for (i = 0; i < camss->res->csid_num; i++)
-			for (k = 0; k < camss->res->vfe_num; k++)
-				for (j = 0; j < camss->vfe[k].res->line_num; j++) {
-					struct v4l2_subdev *csid = &camss->csid[i].subdev;
-					struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev;
 
-					ret = media_create_pad_link(&csid->entity,
-								    MSM_CSID_PAD_FIRST_SRC + j,
-								    &vfe->entity,
-								    MSM_VFE_PAD_SINK,
-								    0);
-					if (ret < 0) {
-						camss_link_err(camss, csid->entity.name,
-							       vfe->entity.name,
-							       ret);
-						return ret;
-					}
+		if (camss->res->csid_num != camss->res->vfe_num) {
+			return dev_err_probe(camss->dev, -EINVAL,
+					     "csid_num %u != vfe_num %u\n",
+					     camss->res->csid_num, camss->res->vfe_num);
+		}
+
+		for (i = 0; i < camss->res->csid_num; i++)
+			for (j = 0; j < camss->vfe[i].res->line_num; j++) {
+				struct v4l2_subdev *csid = &camss->csid[i].subdev;
+				struct v4l2_subdev *vfe = &camss->vfe[i].line[j].subdev;
+
+				ret = media_create_pad_link(&csid->entity,
+							    MSM_CSID_PAD_FIRST_SRC + j,
+							    &vfe->entity,
+							    MSM_VFE_PAD_SINK,
+							    0);
+				if (ret < 0) {
+					camss_link_err(camss, csid->entity.name,
+						       vfe->entity.name,
+						       ret);
+					return ret;
 				}
+			}
 	}
 
 	return 0;
Signature · 1 line
2.56.0
reviewer Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] media: qcom: camss: Fix CSID to VFE routing for non ISPIF platforms

Quoted 6 lines · On Sun, Nov 22, 2026 at 3:10 AM <[email protected]> wrote:

From: Bryan O'Donoghue <[email protected]>

This patch fixes a basic routing error that has been present in CAMSS since the addition of non ISPIF platforms.

Quoted 8 lines

The ISPIF platforms can route any CSID to any VFE however this is not the case on the non ISPIF platforms.

The current requirement is a 1:1 mapping CSID0->VFE0 CSID1->VFE1 etc. Demote the spurious poly-mapping down to its 1:1 real form.

Fixes 9229b53f9758 ("Revert "media: qcom: camss: Restructure camss_link_entities"")
Quoted 59 lines
---
 drivers/media/platform/qcom/camss/camss.c | 38 ++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 16 deletions(-)
drivers/media/platform/qcom/camss/camss.c +22 -17
index aa6d01d8fcb2a..060879a55e483 100644
@@ -5257,24 +5257,30 @@ static int camss_link_entities(struct camss *camss)
                                        }
                                }
        } else {
-               for (i = 0; i < camss->res->csid_num; i++)
-                       for (k = 0; k < camss->res->vfe_num; k++)
-                               for (j = 0; j < camss->vfe[k].res->line_num; j++) {
-                                       struct v4l2_subdev *csid = &camss->csid[i].subdev;
-                                       struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev;
 
-                                       ret = media_create_pad_link(&csid->entity,
-                                                                   MSM_CSID_PAD_FIRST_SRC + j,
-                                                                   &vfe->entity,
-                                                                   MSM_VFE_PAD_SINK,
-                                                                   0);
-                                       if (ret < 0) {
-                                               camss_link_err(camss, csid->entity.name,
-                                                              vfe->entity.name,
-                                                              ret);
-                                               return ret;
-                                       }
+               if (camss->res->csid_num != camss->res->vfe_num) {
+                       return dev_err_probe(camss->dev, -EINVAL,
+                                            "csid_num %u != vfe_num %u\n",
+                                            camss->res->csid_num, camss->res->vfe_num);
+               }
+
+               for (i = 0; i < camss->res->csid_num; i++)
+                       for (j = 0; j < camss->vfe[i].res->line_num; j++) {
+                               struct v4l2_subdev *csid = &camss->csid[i].subdev;
+                               struct v4l2_subdev *vfe = &camss->vfe[i].line[j].subdev;
+
+                               ret = media_create_pad_link(&csid->entity,
+                                                           MSM_CSID_PAD_FIRST_SRC + j,
+                                                           &vfe->entity,
+                                                           MSM_VFE_PAD_SINK,
+                                                           0);
+                               if (ret < 0) {
+                                       camss_link_err(camss, csid->entity.name,
+                                                      vfe->entity.name,
+                                                      ret);
+                                       return ret;
                                }
+                       }
        }
 
        return 0;
 
--

2.56.0

reviewer Reviewed-by on v1 2/3
#6 lore raw

Re: [PATCH 2/3] media: qcom: camss: Fix CSID to VFE routing for non ISPIF platforms

In reply to [email protected]
Quoted 5 lines · On 11/22/26 04:10, [email protected] wrote:

From: Bryan O'Donoghue <[email protected]>

This patch fixes a basic routing error that has been present in CAMSS since the addition of non ISPIF platforms.

Quoted 8 lines

The ISPIF platforms can route any CSID to any VFE however this is not the case on the non ISPIF platforms.

The current requirement is a 1:1 mapping CSID0->VFE0 CSID1->VFE1 etc. Demote the spurious poly-mapping down to its 1:1 real form.

Fixes 9229b53f9758 ("Revert "media: qcom: camss: Restructure camss_link_entities"")
Signature · 2 lines
Best wishes,
Vladimir
author maintainer
#7 lore raw

PATCH 3/3 media: qcom: camss: vfe: Eliminate ever expanding src_pad_code switch logic

In reply to [email protected]

From: Bryan O'Donoghue <[email protected]>

Every time we add a SoC the src_pad_code switch statement is expanded. This expansion has continued to the point where there are more SoCs listed for what used to be the exceptional state, than the reverse.

Invert the logic. The exception to the rule is the old SoC set there's no purpose in expanding this switch continuously.

---
 drivers/media/platform/qcom/camss/camss-vfe.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe.c +1 -19
index f9bd2367671f6..10ad862ff5010 100644
@@ -340,21 +340,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
 			return sink_code;
 		}
 		break;
-	case CAMSS_660:
-	case CAMSS_2290:
-	case CAMSS_6150:
-	case CAMSS_6350:
-	case CAMSS_7280:
-	case CAMSS_8x96:
-	case CAMSS_8250:
-	case CAMSS_8280XP:
-	case CAMSS_8300:
-	case CAMSS_845:
-	case CAMSS_8550:
-	case CAMSS_8650:
-	case CAMSS_8775P:
-	case CAMSS_KAANAPALI:
-	case CAMSS_X1E80100:
+	default:
 		switch (sink_code) {
 		case MEDIA_BUS_FMT_YUYV8_1X16:
 		{
@@ -415,10 +401,6 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
 			return sink_code;
 		}
 		break;
-	default:
-		WARN(1, "Unsupported HW version: %x\n",
-		     vfe->camss->res->version);
-		break;
 	}
 	return 0;
 }
Signature · 1 line
2.56.0
reviewer Reviewed-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] media: qcom: camss: vfe: Eliminate ever expanding src_pad_code switch logic

Quoted 11 lines · On Sun, Nov 22, 2026 at 3:11 AM <[email protected]> wrote:

From: Bryan O'Donoghue <[email protected]>

Every time we add a SoC the src_pad_code switch statement is expanded. This expansion has continued to the point where there are more SoCs listed for what used to be the exceptional state, than the reverse.

Invert the logic. The exception to the rule is the old SoC set there's no purpose in expanding this switch continuously.

Quoted 46 lines
---
 drivers/media/platform/qcom/camss/camss-vfe.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
drivers/media/platform/qcom/camss/camss-vfe.c +1 -20
index f9bd2367671f6..10ad862ff5010 100644
@@ -340,21 +340,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
                        return sink_code;
                }
                break;
-       case CAMSS_660:
-       case CAMSS_2290:
-       case CAMSS_6150:
-       case CAMSS_6350:
-       case CAMSS_7280:
-       case CAMSS_8x96:
-       case CAMSS_8250:
-       case CAMSS_8280XP:
-       case CAMSS_8300:
-       case CAMSS_845:
-       case CAMSS_8550:
-       case CAMSS_8650:
-       case CAMSS_8775P:
-       case CAMSS_KAANAPALI:
-       case CAMSS_X1E80100:
+       default:
                switch (sink_code) {
                case MEDIA_BUS_FMT_YUYV8_1X16:
                {
@@ -415,10 +401,6 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
                        return sink_code;
                }
                break;
-       default:
-               WARN(1, "Unsupported HW version: %x\n",
-                    vfe->camss->res->version);
-               break;
        }
        return 0;
 }
 
--

2.56.0

reviewer Reviewed-by on v1 3/3
#9 lore raw

Re: [PATCH 3/3] media: qcom: camss: vfe: Eliminate ever expanding src_pad_code switch logic

In reply to [email protected]
Quoted 10 lines · On 11/22/26 04:10, [email protected] wrote:

From: Bryan O'Donoghue <[email protected]>

Every time we add a SoC the src_pad_code switch statement is expanded. This expansion has continued to the point where there are more SoCs listed for what used to be the exceptional state, than the reverse.

Invert the logic. The exception to the rule is the old SoC set there's no purpose in expanding this switch continuously.

Signature · 2 lines
Best wishes,
Vladimir
Reviewed-by on the v1 series
#10 lore raw
In reply to [email protected]

Hi Bryan,

Thanks for the fixes.

For the whole series:

Quoted 44 lines · On 11/22/2026 4:10 AM, [email protected] wrote:

This series lands late-enough in the kernel cycle and applies against the camss-next branch staging to linux-media/next.

First up a patch drops the declaration of CSID2 from x1e/Hamoa since this CSID doesn't have a corresponding VFE it is entirely useless and violates our 1:1 mapping between VFE and CSID. Since CSID2 routes nowhere there's no reason to keep it around.

Second is a fix for a longstanding error in CAMSS which as stemmed from the original development of post ISPIF devices. These devices have a 1:1 mapping between CSID and VFE so the mapping we have given to user-space which declares each CSID as connecting to each VFE is just plain wrong on these devices and has always been.

So the second patch addresses that longstanding issue but, I've been holding off on fixing this for a while since I believed it might require extensive surgery, but in the end its quite simple to do.

Finally the third patch is a tidy-up patch which inverts our current logic of continuously adding new elements to the src_pad_code switch for new SoCs filtering those SoCs down to a default: statement. In fact is is the old SoCs which are the exceptional case so, just do the switch for the old and the default for the new.

---
Bryan O'Donoghue (3):
media: qcom: camss: x1e80100: Fix CSID2 routing to nowhere
media: qcom: camss: Fix CSID to VFE routing for non ISPIF platforms
media: qcom: camss: vfe: Eliminate ever expanding src_pad_code switch logic

 drivers/media/platform/qcom/camss/camss-vfe.c | 20 +--------
 drivers/media/platform/qcom/camss/camss.c     | 59 ++++++++++-----------------
 2 files changed, 23 insertions(+), 56 deletions(-)

---
base-commit: 2ad58ca589da80990b7afbcff018777851577f89
change-id: 20261122-camss-routing-fixes-b178bdb84f20

Best regards,

Signature · 2 lines
---
bod