Skip to contentSkip to conversation

media: qcom: camss: Add sa8775p camss support

PATCH Superseded Vikram Sharma 2 participants 11 messages Feb 10, 2025 – Feb 12, 2025

Subsystems (4)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover media: qcom: camss: Add sa8775p camss support

SA8775P is a Qualcomm SoC. This series adds driver changes to bring up CSIPHY, TPG, CSID, VFE/RDI interfaces in SA8775P.

SA8775P provides
- 2 x VFE, 3 RDI per VFE
- 5 x VFE Lite, 6 RDI per VFE
- 2 x CSID
- 5 x CSID Lite
- 3 x TPG
- 4 x CSIPHY

We have tested this on qcs9100-ride board with 'Test Pattern Generator' TPG driver support will be posted in a follow up series.

Tested with following commands:
- media-ctl -d /dev/media0 --reset
- yavta --no-query -w '0x009f0903 0' /dev/v4l-subdev0
- media-ctl -d /dev/media0 -V '"msm_tpg0":0[fmt:SRGGB10/1920x1080 field:none]'
- media-ctl -d /dev/media0 -V '"msm_csid0":0[fmt:SRGGB10/1920x1080 field:none]'
- media-ctl -d /dev/media0 -V '"msm_vfe0_rdi0":0[fmt:SRGGB10/1920x1080 field:none]'
- media-ctl -d /dev/media0 -l '"msm_tpg0":1->"msm_csid0":0[1]'
- media-ctl -d /dev/media0 -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
- yavta --no-query -w '0x009f0903 9' /dev/v4l-subdev0
- yavta -B capture-mplane -n 5 -f SRGGB10P -s 1920x1080 /dev/video0 --capture=7

Used following tools for the sanity check of these changes.

- make -j32 W=1
- ./scripts/checkpatch.pl

Vikram Sharma (4):
media: qcom: camss: Add sa8775p compatible
media: qcom: camss: Add support for CSIPHY 690
media: qcom: camss: Add support for CSID 690
media: qcom: camss: Add support for VFE 690

 drivers/media/platform/qcom/camss/Makefile    |   2 +
 .../platform/qcom/camss/camss-csid-690.c      | 353 ++++++++++++++
 .../platform/qcom/camss/camss-csid-690.h      |  27 ++
 .../media/platform/qcom/camss/camss-csid.h    |   1 +
 .../qcom/camss/camss-csiphy-3ph-1-0.c         |  85 ++++
 .../media/platform/qcom/camss/camss-csiphy.c  |   5 +
 .../media/platform/qcom/camss/camss-csiphy.h  |   1 +
 .../media/platform/qcom/camss/camss-vfe-690.c | 163 +++++++
 drivers/media/platform/qcom/camss/camss-vfe.c |   5 +-
 drivers/media/platform/qcom/camss/camss-vfe.h |   1 +
 drivers/media/platform/qcom/camss/camss.c     | 431 ++++++++++++++++++
 drivers/media/platform/qcom/camss/camss.h     |   1 +
 12 files changed, 1074 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/qcom/camss/camss-csid-690.c
 create mode 100644 drivers/media/platform/qcom/camss/camss-csid-690.h
 create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-690.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 media: qcom: camss: Add sa8775p compatible

Add CAMSS_8775P enum, SA8775P compatible and sa8775p camss driver private data, the private data just include some basic information now, later changes will enumerate with csiphy, tpg, csid and vfe resources.

---
 drivers/media/platform/qcom/camss/camss.c | 24 +++++++++++++++++++++++
 drivers/media/platform/qcom/camss/camss.h |  1 +
 2 files changed, 25 insertions(+)
drivers/media/platform/qcom/camss/camss.c +24 -0
index cfef1e4f211c..1ad2cff8176d 100644
@@ -2264,6 +2264,20 @@ static const struct resources_icc icc_res_sm8550[] = {
 	},
 };
 
+static const struct resources_icc icc_res_sa8775p[] = {
+	{
+		.name = "ahb",
+		.icc_bw_tbl.avg = 38400,
+		.icc_bw_tbl.peak = 76800,
+	},
+	{
+		.name = "hf_0",
+		.icc_bw_tbl.avg = 2097152,
+		.icc_bw_tbl.peak = 2097152,
+	},
+};
+
+
 /*
  * camss_add_clock_margin - Add margin to clock frequency rate
  * @rate: Clock frequency rate
@@ -3234,6 +3248,15 @@ static const struct camss_resources msm8996_resources = {
 	.link_entities = camss_link_entities
 };
 
+
+static const struct camss_resources sa8775p_resources = {
+	.version = CAMSS_8775P,
+	.pd_name = "top",
+	.icc_res = icc_res_sa8775p,
+	.icc_path_num = ARRAY_SIZE(icc_res_sa8775p),
+	.link_entities = camss_link_entities
+};
+
 static const struct camss_resources sdm660_resources = {
 	.version = CAMSS_660,
 	.csiphy_res = csiphy_res_660,
@@ -3319,6 +3342,7 @@ static const struct of_device_id camss_dt_match[] = {
 	{ .compatible = "qcom,msm8916-camss", .data = &msm8916_resources },
 	{ .compatible = "qcom,msm8953-camss", .data = &msm8953_resources },
 	{ .compatible = "qcom,msm8996-camss", .data = &msm8996_resources },
+	{ .compatible = "qcom,sa8775p-camss", .data = &sa8775p_resources },
 	{ .compatible = "qcom,sc7280-camss", .data = &sc7280_resources },
 	{ .compatible = "qcom,sc8280xp-camss", .data = &sc8280xp_resources },
 	{ .compatible = "qcom,sdm660-camss", .data = &sdm660_resources },
drivers/media/platform/qcom/camss/camss.h +1 -0
index 58fc61e7cf7a..d3efd8bff948 100644
@@ -86,6 +86,7 @@ enum camss_version {
 	CAMSS_8280XP,
 	CAMSS_845,
 	CAMSS_8550,
+	CAMSS_8775P,
 };
 
 enum icc_count {
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 media: qcom: camss: Add support for CSIPHY 690

In reply to Vikram Sharma

Add support for CSIPHY found on SA8775P (Titan 690). This implementation is based on the titan 690 implementation.

---
 .../qcom/camss/camss-csiphy-3ph-1-0.c         | 85 +++++++++++++++++++
 .../media/platform/qcom/camss/camss-csiphy.c  |  5 ++
 .../media/platform/qcom/camss/camss-csiphy.h  |  1 +
 drivers/media/platform/qcom/camss/camss.c     | 65 ++++++++++++++
 4 files changed, 156 insertions(+)
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +85 -0
index a6cc957b986e..b69c20b0544e 100644
@@ -63,6 +63,85 @@ struct csiphy_lane_regs {
 	u32 csiphy_param_type;
 };
 
+/* GEN2 1.3.0 2PH */
+static const struct
+csiphy_lane_regs lane_regs_sa8775p[] = {
+	{0x0724, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0728, 0x04, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0700, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x070C, 0xFF, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x072C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0734, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0710, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x071C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0714, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x073C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0704, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0720, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0708, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x0024, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0000, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0038, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x002C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0034, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0010, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x001C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0014, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x003C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0004, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0020, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0008, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x0224, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0200, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0238, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x022C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0234, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0210, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x021C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0214, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x023C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0204, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0220, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0208, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x0424, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0400, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0438, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x042C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0434, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0410, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x041C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0414, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x043C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0404, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0420, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0408, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x0624, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0600, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0638, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x062C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0634, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0610, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x061C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0614, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x063C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0604, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0620, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0608, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x005C, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0060, 0xFD, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0064, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x025C, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0260, 0xFD, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0264, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x045C, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0460, 0xFD, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0464, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x065C, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0660, 0xFD, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0664, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS},
+};
+
 /* GEN2 1.0 2PH */
 static const struct
 csiphy_lane_regs lane_regs_sdm845[] = {
@@ -626,6 +705,7 @@ static bool csiphy_is_gen2(u32 version)
 	case CAMSS_8280XP:
 	case CAMSS_845:
 	case CAMSS_8550:
+	case CAMSS_8775P:
 		ret = true;
 		break;
 	}
@@ -719,6 +799,11 @@ static int csiphy_init(struct csiphy_device *csiphy)
 		regs->lane_array_size = ARRAY_SIZE(lane_regs_sm8550);
 		regs->offset = 0x1000;
 		break;
+	case CAMSS_8775P:
+		regs->lane_regs = &lane_regs_sa8775p[0];
+		regs->lane_array_size = ARRAY_SIZE(lane_regs_sa8775p);
+		regs->offset = 0x1000;
+		break;
 	default:
 		WARN(1, "unknown csiphy version\n");
 		return -ENODEV;
drivers/media/platform/qcom/camss/camss-csiphy.c +5 -0
index c053616558a7..e07e871113d9 100644
@@ -103,6 +103,11 @@ const struct csiphy_formats csiphy_formats_8x96 = {
 	.formats = formats_8x96
 };
 
+const struct csiphy_formats csiphy_formats_sa8775p = {
+	.nformats = ARRAY_SIZE(formats_sdm845),
+	.formats = formats_sdm845
+};
+
 const struct csiphy_formats csiphy_formats_sc7280 = {
 	.nformats = ARRAY_SIZE(formats_sdm845),
 	.formats = formats_sdm845
drivers/media/platform/qcom/camss/camss-csiphy.h +1 -0
index 86b98b37838e..9f2e088b1e47 100644
@@ -125,6 +125,7 @@ void msm_csiphy_unregister_entity(struct csiphy_device *csiphy);
 
 extern const struct csiphy_formats csiphy_formats_8x16;
 extern const struct csiphy_formats csiphy_formats_8x96;
+extern const struct csiphy_formats csiphy_formats_sa8775p;
 extern const struct csiphy_formats csiphy_formats_sc7280;
 extern const struct csiphy_formats csiphy_formats_sdm845;
 
drivers/media/platform/qcom/camss/camss.c +65 -0

78 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#3 lore raw

Re: [PATCH v1 2/4] media: qcom: camss: Add support for CSIPHY 690

Quoted 18 lines · Vikram Sharma

Add support for CSIPHY found on SA8775P (Titan 690). This implementation is based on the titan 690 implementation.

---
  .../qcom/camss/camss-csiphy-3ph-1-0.c         | 85 +++++++++++++++++++
  .../media/platform/qcom/camss/camss-csiphy.c  |  5 ++
  .../media/platform/qcom/camss/camss-csiphy.h  |  1 +
  drivers/media/platform/qcom/camss/camss.c     | 65 ++++++++++++++
  4 files changed, 156 insertions(+)
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +0 -0
index a6cc957b986e..b69c20b0544e 100644

drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c struct csiphy_lane_regs { · line 66

Quoted 4 lines
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +1 -0
@@ -63,6 +63,85 @@ struct csiphy_lane_regs {
  	u32 csiphy_param_type;
  };
 
+/* GEN2 1.3.0 2PH */

Could you include the process node this PHY is constucted on ? Since process node has a direct effect on PHY settings its very useful to include not just the PHY version but the litho process node that PHY works on.

Quoted 134 lines
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +84 -0
+static const struct
+csiphy_lane_regs lane_regs_sa8775p[] = {
+	{0x0724, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0728, 0x04, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0700, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x070C, 0xFF, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x072C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0734, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0710, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x071C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0714, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x073C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0704, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0720, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0708, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x0024, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0000, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0038, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x002C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0034, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0010, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x001C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0014, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x003C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0004, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0020, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0008, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x0224, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0200, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0238, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x022C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0234, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0210, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x021C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0214, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x023C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0204, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0220, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0208, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x0424, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0400, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0438, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x042C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0434, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0410, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x041C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0414, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x043C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0404, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0420, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0408, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x0624, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0600, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0638, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x062C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0634, 0x0F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0610, 0x52, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x061C, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0614, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x063C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0604, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0620, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0608, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE},
+	{0x005C, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0060, 0xFD, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0064, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x025C, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0260, 0xFD, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0264, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x045C, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0460, 0xFD, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0464, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x065C, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0660, 0xFD, 0x00, CSIPHY_DEFAULT_PARAMS},
+	{0x0664, 0x7F, 0x00, CSIPHY_DEFAULT_PARAMS},
+};
+
  /* GEN2 1.0 2PH */
  static const struct
  csiphy_lane_regs lane_regs_sdm845[] = {
@@ -626,6 +705,7 @@ static bool csiphy_is_gen2(u32 version)
  	case CAMSS_8280XP:
  	case CAMSS_845:
  	case CAMSS_8550:
+	case CAMSS_8775P:
  		ret = true;
  		break;
  	}
@@ -719,6 +799,11 @@ static int csiphy_init(struct csiphy_device *csiphy)
  		regs->lane_array_size = ARRAY_SIZE(lane_regs_sm8550);
  		regs->offset = 0x1000;
  		break;
+	case CAMSS_8775P:
+		regs->lane_regs = &lane_regs_sa8775p[0];
+		regs->lane_array_size = ARRAY_SIZE(lane_regs_sa8775p);
+		regs->offset = 0x1000;
+		break;
  	default:
  		WARN(1, "unknown csiphy version\n");
  		return -ENODEV;
drivers/media/platform/qcom/camss/camss-csiphy.c +5 -0
index c053616558a7..e07e871113d9 100644
@@ -103,6 +103,11 @@ const struct csiphy_formats csiphy_formats_8x96 = {
  	.formats = formats_8x96
  };
 
+const struct csiphy_formats csiphy_formats_sa8775p = {
+	.nformats = ARRAY_SIZE(formats_sdm845),
+	.formats = formats_sdm845
+};
+
  const struct csiphy_formats csiphy_formats_sc7280 = {
  	.nformats = ARRAY_SIZE(formats_sdm845),
  	.formats = formats_sdm845
drivers/media/platform/qcom/camss/camss-csiphy.h +1 -0
index 86b98b37838e..9f2e088b1e47 100644
@@ -125,6 +125,7 @@ void msm_csiphy_unregister_entity(struct csiphy_device *csiphy);
 
  extern const struct csiphy_formats csiphy_formats_8x16;
  extern const struct csiphy_formats csiphy_formats_8x96;
+extern const struct csiphy_formats csiphy_formats_sa8775p;
  extern const struct csiphy_formats csiphy_formats_sc7280;
  extern const struct csiphy_formats csiphy_formats_sdm845;
 
drivers/media/platform/qcom/camss/camss.c +0 -0
index 1ad2cff8176d..c839b99fabd7 100644

drivers/media/platform/qcom/camss/camss.c static const struct resources_icc icc_res_sm8550[] = { · line 2270

Quoted 7 lines
drivers/media/platform/qcom/camss/camss.c +4 -0
@@ -2264,6 +2264,69 @@ static const struct resources_icc icc_res_sm8550[] = {
  	},
  };
 
+static const struct camss_subdev_resources csiphy_res_8775p[] = {
+	/* CSIPHY0 */
+	{
+		.regulators = { "vdda-phy", "vdda-pll" },

Funny newline.

Also per our last round of reviews these names ought to indcate the voltage level the rail pertains to - or if indeed you can indicate what the rail powers - vdd digital logic for example great.

https://git.codelinaro.org/bryan.odonoghue/kernel/-/blob/x1e80100-6.13-inspiron14p/drivers/media/platform/qcom/camss/camss.c?ref_type=heads#L2300

Personally I don't have that leel of detail so

		.regulators = { "vdd-csiphy-0p8-supply",
				"vdd-csiphy-1p2-supply" },

is the best I can do, I don't know what the 0.8v of 1.2v supplies actually supply inside the PHY and I suspect this is also true for your new PHY.

Quoted 62 lines
drivers/media/platform/qcom/camss/camss.c +58 -0
+		.clock = { "csiphy_rx", "csiphy0", "csiphy0_timer"},
+		.clock_rate = {
+			{ 400000000, 0, 400000000}
+		},
+		.reg = { "csiphy0" },
+		.interrupt = { "csiphy0" },
+		.csiphy = {
+			.hw_ops = &csiphy_ops_3ph_1_0,
+			.formats = &csiphy_formats_sa8775p
+		}
+	},
+	/* CSIPHY1 */
+	{
+		.regulators = { "vdda-phy", "vdda-pll" },
+
+		.clock = { "csiphy_rx", "csiphy1", "csiphy1_timer"},
+		.clock_rate = {
+			{ 400000000, 0, 400000000}
+		},
+		.reg = { "csiphy1" },
+		.interrupt = { "csiphy1" },
+		.csiphy = {
+			.hw_ops = &csiphy_ops_3ph_1_0,
+			.formats = &csiphy_formats_sa8775p
+		}
+	},
+	/* CSIPHY2 */
+	{
+		.regulators = { "vdda-phy", "vdda-pll" },
+
+		.clock = { "csiphy_rx", "csiphy2", "csiphy2_timer"},
+		.clock_rate = {
+			{ 400000000, 0, 400000000}
+		},
+		.reg = { "csiphy2" },
+		.interrupt = { "csiphy2" },
+		.csiphy = {
+			.hw_ops = &csiphy_ops_3ph_1_0,
+			.formats = &csiphy_formats_sa8775p
+		}
+	},
+	/* CSIPHY3 */
+	{
+		.regulators = { "vdda-phy", "vdda-pll" },
+
+		.clock = { "csiphy_rx", "csiphy3", "csiphy3_timer"},
+		.clock_rate = {
+			{ 400000000, 0, 400000000}
+		},
+		.reg = { "csiphy3" },
+		.interrupt = { "csiphy3" },
+		.csiphy = {
+			.hw_ops = &csiphy_ops_3ph_1_0,
+			.formats = &csiphy_formats_sa8775p
+		}
+	},
+};
+
  static const struct resources_icc icc_res_sa8775p[] = {
  	{
  		.name = "ahb",

drivers/media/platform/qcom/camss/camss.c static const struct camss_resources msm8996_resources = { · line 3323

Quoted 9 lines
drivers/media/platform/qcom/camss/camss.c +2 -0
@@ -3252,7 +3315,9 @@ static const struct camss_resources msm8996_resources = {
  static const struct camss_resources sa8775p_resources = {
  	.version = CAMSS_8775P,
  	.pd_name = "top",
+	.csiphy_res = csiphy_res_8775p,
  	.icc_res = icc_res_sa8775p,
+	.csiphy_num = ARRAY_SIZE(csiphy_res_8775p),
  	.icc_path_num = ARRAY_SIZE(icc_res_sa8775p),
  	.link_entities = camss_link_entities
  };

Meh again, I'd like separate the PHY addition from the SoC compat because the PHY and VFE/CSID are used on sa8775p but aren't necessarily sepcific to it.

---
bod

#4 lore raw

PATCH 3/4 media: qcom: camss: Add support for CSID 690

In reply to Vikram Sharma

The CSID in sa8775p is version 690, This csid is different from csid 780 w.r.t few bit-fields example:
BUF_DONE_IRQ_STATUS_RDI_OFFSET

---
 drivers/media/platform/qcom/camss/Makefile    |   1 +
 .../platform/qcom/camss/camss-csid-690.c      | 353 ++++++++++++++++++
 .../platform/qcom/camss/camss-csid-690.h      |  27 ++
 .../media/platform/qcom/camss/camss-csid.h    |   1 +
 drivers/media/platform/qcom/camss/camss.c     | 154 ++++++++
 5 files changed, 536 insertions(+)
 create mode 100644 drivers/media/platform/qcom/camss/camss-csid-690.c
 create mode 100644 drivers/media/platform/qcom/camss/camss-csid-690.h
drivers/media/platform/qcom/camss/Makefile +1 -0
index f6db5b3b5ace..f1d0e9a00220 100644
@@ -7,6 +7,7 @@ qcom-camss-objs += \
 		camss-csid-4-1.o \
 		camss-csid-4-7.o \
 		camss-csid-gen2.o \
+		camss-csid-690.o \
 		camss-csid-780.o \
 		camss-csiphy-2ph-1-0.o \
 		camss-csiphy-3ph-1-0.o \
drivers/media/platform/qcom/camss/camss-csid-690.c new file +353 -0

353 lines not on this page · raw message

drivers/media/platform/qcom/camss/camss-csid-690.h new file +27 -0
new file mode 100644
index 000000000000..c61db783d629
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * camss-csid-690.h
+ *
+ * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module Generation 3
+ *
+ * Copyright (C) 2021 Linaro Ltd.
+ * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+#ifndef QC_MSM_CAMSS_CSID_690_H
+#define QC_MSM_CAMSS_CSID_690_H
+
+#define DECODE_FORMAT_UNCOMPRESSED_8_BIT	0x1
+#define DECODE_FORMAT_UNCOMPRESSED_10_BIT	0x2
+#define DECODE_FORMAT_UNCOMPRESSED_12_BIT	0x3
+#define DECODE_FORMAT_UNCOMPRESSED_14_BIT	0x4
+#define DECODE_FORMAT_UNCOMPRESSED_16_BIT	0x5
+#define DECODE_FORMAT_UNCOMPRESSED_20_BIT	0x6
+#define DECODE_FORMAT_UNCOMPRESSED_24_BIT	0x7
+#define DECODE_FORMAT_PAYLOAD_ONLY		0xf
+
+
+#define PLAIN_FORMAT_PLAIN8	0x0 /* supports DPCM, UNCOMPRESSED_6/8_BIT */
+#define PLAIN_FORMAT_PLAIN16	0x1 /* supports DPCM, UNCOMPRESSED_10/16_BIT */
+#define PLAIN_FORMAT_PLAIN32	0x2 /* supports UNCOMPRESSED_20_BIT */
+
+#endif /* QC_MSM_CAMSS_CSID_690_H */
drivers/media/platform/qcom/camss/camss-csid.h +1 -0
index 659ffb8bb7d5..ce216de3041f 100644
@@ -237,6 +237,7 @@ extern const struct csid_formats csid_formats_gen2;
 extern const struct csid_hw_ops csid_ops_4_1;
 extern const struct csid_hw_ops csid_ops_4_7;
 extern const struct csid_hw_ops csid_ops_gen2;
+extern const struct csid_hw_ops csid_ops_690;
 extern const struct csid_hw_ops csid_ops_780;
 
 /*
drivers/media/platform/qcom/camss/camss.c +154 -0

174 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#5 lore raw

Re: [PATCH v1 3/4] media: qcom: camss: Add support for CSID 690

Quoted 604 lines · Vikram Sharma

The CSID in sa8775p is version 690, This csid is different from csid 780 w.r.t few bit-fields example:
BUF_DONE_IRQ_STATUS_RDI_OFFSET

---
  drivers/media/platform/qcom/camss/Makefile    |   1 +
  .../platform/qcom/camss/camss-csid-690.c      | 353 ++++++++++++++++++
  .../platform/qcom/camss/camss-csid-690.h      |  27 ++
  .../media/platform/qcom/camss/camss-csid.h    |   1 +
  drivers/media/platform/qcom/camss/camss.c     | 154 ++++++++
  5 files changed, 536 insertions(+)

create mode 100644 drivers/media/platform/qcom/camss/camss-csid-690.c create mode 100644 drivers/media/platform/qcom/camss/camss-csid-690.h

drivers/media/platform/qcom/camss/Makefile +1 -0
index f6db5b3b5ace..f1d0e9a00220 100644
@@ -7,6 +7,7 @@ qcom-camss-objs += \
  		camss-csid-4-1.o \
  		camss-csid-4-7.o \
  		camss-csid-gen2.o \
+		camss-csid-690.o \
  		camss-csid-780.o \
  		camss-csiphy-2ph-1-0.o \
  		camss-csiphy-3ph-1-0.o \
drivers/media/platform/qcom/camss/camss-csid-690.c new file +353 -0
new file mode 100644
index 000000000000..a05ee7630117
@@ -0,0 +1,353 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module
+ *
+ * Copyright (c) 2025 Qualcomm Technologies, Inc.
+ */
+#include <linux/completion.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+
+#include "camss.h"
+#include "camss-csid.h"
+#include "camss-csid-690.h"
+
+#define CSID_IO_PATH_CFG0(csid)		(0x4 * (csid))
+#define		OUTPUT_IFE_EN			0x100
+#define		INTERNAL_CSID			1
+
+#define CSID_RST_CFG			0xC
+#define		RST_MODE			BIT(0)
+#define		RST_LOCATION			BIT(4)
+
+#define CSID_RST_CMD			0x10
+#define		SELECT_HW_RST			BIT(0)
+#define		SELECT_SW_RST			BIT(1)
+#define		SELECT_IRQ_RST			BIT(2)
+
+#define CSID_IRQ_CMD			0x14
+#define		IRQ_CMD_CLEAR			BIT(0)
+
+#define CSID_RUP_AUP_CMD		0x18
+#define		CSID_RUP_AUP_RDI(rdi)		((BIT(4) | BIT(20)) << (rdi))
+
+#define CSID_TOP_IRQ_STATUS		0x7C
+#define		 TOP_IRQ_STATUS_RESET_DONE	BIT(0)
+
+#define CSID_TOP_IRQ_MASK		0x80
+#define CSID_TOP_IRQ_CLEAR		0x84
+#define CSID_TOP_IRQ_SET		0x88
+
+#define CSID_CSI2_RX_IRQ_STATUS		0x9C
+#define CSID_CSI2_RX_IRQ_MASK		0xA0
+#define CSID_CSI2_RX_IRQ_CLEAR		0xA4
+#define CSID_CSI2_RX_IRQ_SET		0xA8
+
+#define CSID_BUF_DONE_IRQ_STATUS	0x8C
+#define		BUF_DONE_IRQ_STATUS_RDI_OFFSET	(csid_is_lite(csid) ? 1 : 13)
+#define CSID_BUF_DONE_IRQ_MASK		0x90
+#define CSID_BUF_DONE_IRQ_CLEAR		0x94
+#define CSID_BUF_DONE_IRQ_SET		0x98
+
+#define CSID_CSI2_RDIN_IRQ_STATUS(rdi)	(0xEC + 0x10 * (rdi))
+#define		RUP_DONE_IRQ_STATUS		BIT(23)
+
+#define CSID_CSI2_RDIN_IRQ_CLEAR(rdi)	(0xF4 + 0x10 * (rdi))
+#define CSID_CSI2_RDIN_IRQ_SET(rdi)	(0xF8 + 0x10 * (rdi))
+
+#define CSID_CSI2_RX_CFG0		0x200
+#define		CSI2_RX_CFG0_NUM_ACTIVE_LANES	0
+#define		CSI2_RX_CFG0_VC_MODE		3
+#define		CSI2_RX_CFG0_DL0_INPUT_SEL	4
+#define		CSI2_RX_CFG0_PHY_NUM_SEL	20
+#define		CSI2_RX_CFG0_TPG_NUM_EN		27
+#define		CSI2_RX_CFG0_TPG_NUM_SEL	28
+
+#define CSID_CSI2_RX_CFG1		0x204
+#define		CSI2_RX_CFG1_ECC_CORRECTION_EN	BIT(0)
+#define		CSI2_RX_CFG1_VC_MODE		BIT(2)
+
+#define CSID_RDI_CFG0(rdi)	(csid_is_lite(csid) ?\
+					(0x300 + 0x100 * (rdi)) :\
+					(0x500 + 0x100 * (rdi)))
+#define		RDI_CFG0_TIMESTAMP_EN		BIT(6)
+#define		RDI_CFG0_TIMESTAMP_STB_SEL	BIT(8)
+#define		RDI_CFG0_DECODE_FORMAT		12
+#define		RDI_CFG0_DT			16
+#define		RDI_CFG0_VC			22
+#define		RDI_CFG0_DT_ID			27
+#define		RDI_CFG0_EN			BIT(31)
+
+#define CSID_RDI_CTRL(rdi)	(csid_is_lite(csid) ? \
+					(0x304 + 0x100 * (rdi)) :\
+					(0x504 + 0x100 * (rdi)))
+#define		RDI_CTRL_START_CMD		BIT(0)
+
+#define CSID_RDI_CFG1(rdi)	(csid_is_lite(csid) ? \
+					(0x310 + 0x100 * (rdi)) :\
+					(0x510 + 0x100 * (rdi)))
+#define		RDI_CFG1_DROP_H_EN		BIT(5)
+#define		RDI_CFG1_DROP_V_EN		BIT(6)
+#define		RDI_CFG1_CROP_H_EN		BIT(7)
+#define		RDI_CFG1_CROP_V_EN		BIT(8)
+#define		RDI_CFG1_PIX_STORE		BIT(10)
+#define		RDI_CFG1_PACKING_FORMAT_MIPI	BIT(15)
+
+#define CSID_RDI_IRQ_SUBSAMPLE_PATTERN(rdi)	(csid_is_lite(csid) ?\
+							(0x348 + 0x100 * (rdi)) :\
+							(0x548 + 0x100 * (rdi)))
+#define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi)	(csid_is_lite(csid) ?\
+							(0x34C + 0x100 * (rdi)) :\
+							(0x54C + 0x100 * (rdi)))
+#define CSI2_RX_CFG0_PHY_SEL_BASE_IDX	1
+
+static void __csid_configure_rx(struct csid_device *csid,
+				struct csid_phy_config *phy, int vc)
+{
+	int val;
+
+	val = (phy->lane_cnt - 1) << CSI2_RX_CFG0_NUM_ACTIVE_LANES;
+	val |= phy->lane_assign << CSI2_RX_CFG0_DL0_INPUT_SEL;
+	val |= (phy->csiphy_id + CSI2_RX_CFG0_PHY_SEL_BASE_IDX) << CSI2_RX_CFG0_PHY_NUM_SEL;
+	if (vc > 3)
+		val |= 1 << CSI2_RX_CFG0_VC_MODE;
+
+	writel(val, csid->base + CSID_CSI2_RX_CFG0);
+
+	val = CSI2_RX_CFG1_ECC_CORRECTION_EN;
+	if (vc > 3)
+		val |= CSI2_RX_CFG1_VC_MODE;
+
+	writel(val, csid->base + CSID_CSI2_RX_CFG1);
+}
+
+static void __csid_ctrl_rdi(struct csid_device *csid, int enable, u8 rdi)
+{
+	int val = 0;
+
+	if (enable)
+		val = RDI_CTRL_START_CMD;
+
+	writel(val, csid->base + CSID_RDI_CTRL(rdi));
+}
+
+static void __csid_configure_wrapper(struct csid_device *csid)
+{
+	u32 val;
+
+	/* csid lite doesn't need to configure top register */
+	if (csid->res->is_lite)
+		return;
+
+	val = OUTPUT_IFE_EN | INTERNAL_CSID;
+	writel(val, csid->camss->csid_wrapper_base + CSID_IO_PATH_CFG0(csid->id));
+}
+
+static void __csid_configure_rdi_stream(struct csid_device *csid, u8 enable, u8 vc)
+{
+	u32 val;
+	u8 lane_cnt = csid->phy.lane_cnt;
+	/* Source pads matching RDI channels on hardware. Pad 1 -> RDI0, Pad 2 -> RDI1, etc. */
+	struct v4l2_mbus_framefmt *input_format = &csid->fmt[MSM_CSID_PAD_FIRST_SRC + vc];
+	const struct csid_format_info *format = csid_get_fmt_entry(csid->res->formats->formats,
+								   csid->res->formats->nformats,
+								   input_format->code);
+
+	if (!lane_cnt)
+		lane_cnt = 4;
+
+	/*
+	 * DT_ID is a two bit bitfield that is concatenated with
+	 * the four least significant bits of the five bit VC
+	 * bitfield to generate an internal CID value.
+	 *
+	 * CSID_RDI_CFG0(vc)
+	 * DT_ID : 28:27
+	 * VC    : 26:22
+	 * DT    : 21:16
+	 *
+	 * CID   : VC 3:0 << 2 | DT_ID 1:0
+	 */
+	u8 dt_id = vc & 0x03;
+
+	val = RDI_CFG0_TIMESTAMP_EN;
+	val |= RDI_CFG0_TIMESTAMP_STB_SEL;
+	/* note: for non-RDI path, this should be format->decode_format */
+	val |= DECODE_FORMAT_PAYLOAD_ONLY << RDI_CFG0_DECODE_FORMAT;
+	val |= vc << RDI_CFG0_VC;
+	val |= format->data_type << RDI_CFG0_DT;
+	val |= dt_id << RDI_CFG0_DT_ID;
+
+	writel(val, csid->base + CSID_RDI_CFG0(vc));
+
+	val = readl(csid->base + CSID_RDI_CFG1(vc));
+	val |= RDI_CFG1_PACKING_FORMAT_MIPI;
+	val |= RDI_CFG1_PIX_STORE;
+	val |= RDI_CFG1_DROP_H_EN;
+	val |= RDI_CFG1_DROP_V_EN;
+	val |= RDI_CFG1_CROP_H_EN;
+	val |= RDI_CFG1_CROP_V_EN;
+
+	writel(val, csid->base + CSID_RDI_CFG1(vc));
+
+	val = 0;
+	writel(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PERIOD(vc));
+
+	val = 1;
+	writel(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PATTERN(vc));
+
+	val = 0;
+	writel(val, csid->base + CSID_RDI_CTRL(vc));
+
+	val = readl(csid->base + CSID_RDI_CFG0(vc));
+
+	if (enable)
+		val |= RDI_CFG0_EN;
+	writel(val, csid->base + CSID_RDI_CFG0(vc));
+}
+
+static void csid_configure_stream(struct csid_device *csid, u8 enable)
+{
+	u8 i;
+
+	__csid_configure_wrapper(csid);
+
+	/* Loop through all enabled VCs and configure stream for each */
+	for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS; i++)
+		if (csid->phy.en_vc & BIT(i)) {
+			__csid_configure_rdi_stream(csid, enable, i);
+			__csid_configure_rx(csid, &csid->phy, i);
+			__csid_ctrl_rdi(csid, enable, i);
+		}
+}
+
+static int csid_configure_testgen_pattern(struct csid_device *csid, s32 val)
+{
+	return 0;
+}
+
+static void csid_subdev_reg_update(struct csid_device *csid, int port_id, bool clear)
+{
+	if (clear) {
+		csid->reg_update &= ~CSID_RUP_AUP_RDI(port_id);
+	} else {
+		csid->reg_update |= CSID_RUP_AUP_RDI(port_id);
+		writel(csid->reg_update, csid->base + CSID_RUP_AUP_CMD);
+	}
+}
+
+/*
+ * csid_isr - CSID module interrupt service routine
+ * @irq: Interrupt line
+ * @dev: CSID device
+ *
+ * Return IRQ_HANDLED on success
+ */
+static irqreturn_t csid_isr(int irq, void *dev)
+{
+	struct csid_device *csid = dev;
+	u32 val, buf_done_val;
+	u8 reset_done;
+	int i;
+
+	val = readl(csid->base + CSID_TOP_IRQ_STATUS);
+	writel(val, csid->base + CSID_TOP_IRQ_CLEAR);
+	reset_done = val & TOP_IRQ_STATUS_RESET_DONE;
+
+	val = readl(csid->base + CSID_CSI2_RX_IRQ_STATUS);
+	writel(val, csid->base + CSID_CSI2_RX_IRQ_CLEAR);
+
+	buf_done_val = readl(csid->base + CSID_BUF_DONE_IRQ_STATUS);
+	writel(buf_done_val, csid->base + CSID_BUF_DONE_IRQ_CLEAR);
+
+	/* Read and clear IRQ status for each enabled RDI channel */
+	for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS; i++)
+		if (csid->phy.en_vc & BIT(i)) {
+			val = readl(csid->base + CSID_CSI2_RDIN_IRQ_STATUS(i));
+			writel(val, csid->base + CSID_CSI2_RDIN_IRQ_CLEAR(i));
+
+			if (val & RUP_DONE_IRQ_STATUS)
+				/* clear the reg update bit */
+				csid_subdev_reg_update(csid, i, true);
+
+			if (buf_done_val & BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET + i)) {
+				/*
+				 * For Titan 690, bus done and RUP IRQ have been moved to
+				 * CSID from VFE. Once CSID received bus done, need notify
+				 * VFE of this event. Trigger VFE to handle bus done process.
+				 */
+				camss_buf_done(csid->camss, csid->id, i);
+			}
+		}
+
+	val = IRQ_CMD_CLEAR;
+	writel(val, csid->base + CSID_IRQ_CMD);
+
+	if (reset_done)
+		complete(&csid->reset_complete);
+
+	return IRQ_HANDLED;
+}
+
+/*
+ * csid_reset - Trigger reset on CSID module and wait to complete
+ * @csid: CSID device
+ *
+ * Return 0 on success or a negative error code otherwise
+ */
+static int csid_reset(struct csid_device *csid)
+{
+	unsigned long time;
+	u32 val;
+	int i;
+
+	reinit_completion(&csid->reset_complete);
+
+	writel(1, csid->base + CSID_TOP_IRQ_CLEAR);
+	writel(1, csid->base + CSID_IRQ_CMD);
+	writel(1, csid->base + CSID_TOP_IRQ_MASK);
+
+	for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS; i++)
+		if (csid->phy.en_vc & BIT(i)) {
+			writel(BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET + i),
+			       csid->base + CSID_BUF_DONE_IRQ_CLEAR);
+			writel(IRQ_CMD_CLEAR, csid->base + CSID_IRQ_CMD);
+			writel(BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET + i),
+			       csid->base + CSID_BUF_DONE_IRQ_MASK);
+		}
+
+	/* preserve registers */
+	val = RST_LOCATION | RST_MODE;
+	writel(val, csid->base + CSID_RST_CFG);
+
+	val = SELECT_HW_RST | SELECT_IRQ_RST;
+	writel(val, csid->base + CSID_RST_CMD);
+
+	time = wait_for_completion_timeout(&csid->reset_complete,
+					   msecs_to_jiffies(CSID_RESET_TIMEOUT_MS));
+	if (!time) {
+		dev_err(csid->camss->dev, "CSID reset timeout\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static void csid_subdev_init(struct csid_device *csid)
+{
+	csid->testgen.nmodes = CSID_PAYLOAD_MODE_DISABLED;
+}
+
+const struct csid_hw_ops csid_ops_690 = {
+	.configure_stream = csid_configure_stream,
+	.configure_testgen_pattern = csid_configure_testgen_pattern,
+	.hw_version = csid_hw_version,
+	.isr = csid_isr,
+	.reset = csid_reset,
+	.src_pad_code = csid_src_pad_code,
+	.subdev_init = csid_subdev_init,
+	.reg_update = csid_subdev_reg_update,
+};
drivers/media/platform/qcom/camss/camss-csid-690.h new file +27 -0
new file mode 100644
index 000000000000..c61db783d629
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * camss-csid-690.h
+ *
+ * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module Generation 3
+ *
+ * Copyright (C) 2021 Linaro Ltd.
+ * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+#ifndef QC_MSM_CAMSS_CSID_690_H
+#define QC_MSM_CAMSS_CSID_690_H
+
+#define DECODE_FORMAT_UNCOMPRESSED_8_BIT	0x1
+#define DECODE_FORMAT_UNCOMPRESSED_10_BIT	0x2
+#define DECODE_FORMAT_UNCOMPRESSED_12_BIT	0x3
+#define DECODE_FORMAT_UNCOMPRESSED_14_BIT	0x4
+#define DECODE_FORMAT_UNCOMPRESSED_16_BIT	0x5
+#define DECODE_FORMAT_UNCOMPRESSED_20_BIT	0x6
+#define DECODE_FORMAT_UNCOMPRESSED_24_BIT	0x7
+#define DECODE_FORMAT_PAYLOAD_ONLY		0xf
+
+
+#define PLAIN_FORMAT_PLAIN8	0x0 /* supports DPCM, UNCOMPRESSED_6/8_BIT */
+#define PLAIN_FORMAT_PLAIN16	0x1 /* supports DPCM, UNCOMPRESSED_10/16_BIT */
+#define PLAIN_FORMAT_PLAIN32	0x2 /* supports UNCOMPRESSED_20_BIT */
+
+#endif /* QC_MSM_CAMSS_CSID_690_H */
drivers/media/platform/qcom/camss/camss-csid.h +1 -0
index 659ffb8bb7d5..ce216de3041f 100644
@@ -237,6 +237,7 @@ extern const struct csid_formats csid_formats_gen2;
  extern const struct csid_hw_ops csid_ops_4_1;
  extern const struct csid_hw_ops csid_ops_4_7;
  extern const struct csid_hw_ops csid_ops_gen2;
+extern const struct csid_hw_ops csid_ops_690;
  extern const struct csid_hw_ops csid_ops_780;
 
  /*
drivers/media/platform/qcom/camss/camss.c +151 -0
index c839b99fabd7..9458cba1b50f 100644
@@ -2050,6 +2050,10 @@ static const struct camss_subdev_resources csiphy_res_8550[] = {
  	}
  };
 
+static const struct resources_wrapper csid_wrapper_res_sa8775p = {
+	.reg = "csid_wrapper",
+};
+
  static const struct resources_wrapper csid_wrapper_res_sm8550 = {
  	.reg = "csid_wrapper",
  };
@@ -2327,6 +2331,153 @@ static const struct camss_subdev_resources csiphy_res_8775p[] = {
  	},
  };
 
+static const struct camss_subdev_resources csid_res_8775p[] = {
+	/* CSID0 */
+	{
+		.regulators = {},
+
+		.clock = { "csid", "csiphy_rx"},
+		.clock_rate = {
+			{ 400000000, 400000000},
+			{ 400000000, 400000000}
+		},
+
+		.reg = { "csid0", "csid_top" },
+		.interrupt = { "csid0" },
+		.csid = {
+			.is_lite = false,
+			.hw_ops = &csid_ops_690,
+			.parent_dev_ops = &vfe_parent_dev_ops,
+			.formats = &csid_formats_gen2
+		}
+	},
+	/* CSID1 */
+	{
+		.regulators = {},
+
+		.clock = { "csid", "csiphy_rx"},
+		.clock_rate = {
+			{ 400000000, 400000000},
+			{ 400000000, 400000000}
+		},
+
+		.reg = { "csid1", "csid_top" },
+		.interrupt = { "csid1" },
+		.csid = {
+			.is_lite = false,
+			.hw_ops = &csid_ops_690,
+			.parent_dev_ops = &vfe_parent_dev_ops,
+			.formats = &csid_formats_gen2
+		}
+	},
+
+	/* CSID2 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 400000000, 400000000, 0},
+			{ 0, 0, 400000000, 480000000, 0}
+		},
+
+		.reg = { "csid_lite0" },
+		.interrupt = { "csid-lite0" },
+		.csid = {
+			.is_lite = true,
+			.hw_ops = &csid_ops_690,
+			.parent_dev_ops = &vfe_parent_dev_ops,
+			.formats = &csid_formats_gen2
+		}
+	},
+	/* CSID3 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 400000000, 400000000, 0},
+			{ 0, 0, 400000000, 480000000, 0}
+		},
+
+		.reg = { "csid_lite1" },
+		.interrupt = { "csid-lite1" },
+		.csid = {
+			.is_lite = true,
+			.hw_ops = &csid_ops_690,
+			.parent_dev_ops = &vfe_parent_dev_ops,
+			.formats = &csid_formats_gen2
+		}
+	},
+	/* CSID4 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 400000000, 400000000, 0},
+			{ 0, 0, 400000000, 480000000, 0}
+		},
+
+		.reg = { "csid_lite2" },
+		.interrupt = { "csid-lite2" },
+		.csid = {
+			.is_lite = true,
+			.hw_ops = &csid_ops_690,
+			.parent_dev_ops = &vfe_parent_dev_ops,
+			.formats = &csid_formats_gen2
+		}
+	},
+	/* CSID5 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 400000000, 400000000, 0},
+			{ 0, 0, 400000000, 480000000, 0}
+		},
+
+		.reg = { "csid_lite3" },
+		.interrupt = { "csid-lite3" },
+		.csid = {
+			.is_lite = true,
+			.hw_ops = &csid_ops_690,
+			.parent_dev_ops = &vfe_parent_dev_ops,
+			.formats = &csid_formats_gen2
+		}
+	},
+	/* CSID6 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 400000000, 400000000, 0},
+			{ 0, 0, 400000000, 480000000, 0}
+		},
+
+		.reg = { "csid_lite4" },
+		.interrupt = { "csid-lite4" },
+		.csid = {
+			.is_lite = true,
+			.hw_ops = &csid_ops_690,
+			.parent_dev_ops = &vfe_parent_dev_ops,
+			.formats = &csid_formats_gen2
+		}
+	},
+};
+
  static const struct resources_icc icc_res_sa8775p[] = {
  	{
  		.name = "ahb",
@@ -3316,8 +3467,11 @@ static const struct camss_resources sa8775p_resources = {
  	.version = CAMSS_8775P,

drivers/media/platform/qcom/camss/camss.c static const struct camss_resources sa8775p_resources = { · line 3477

Quoted 10 lines
drivers/media/platform/qcom/camss/camss.c +3 -0
  	.pd_name = "top",
  	.csiphy_res = csiphy_res_8775p,
+	.csid_res = csid_res_8775p,
+	.csid_wrapper_res = &csid_wrapper_res_sa8775p,
  	.icc_res = icc_res_sa8775p,
  	.csiphy_num = ARRAY_SIZE(csiphy_res_8775p),
+	.csid_num = ARRAY_SIZE(csid_res_8775p),
  	.icc_path_num = ARRAY_SIZE(icc_res_sa8775p),
  	.link_entities = camss_link_entities
  };

Virtually no difference between

780 and 690 here - could you again please move shared code into camss-csid-gen3.c and differentiate with wrapper functions in camss-csid

diff drivers/media/platform/qcom/camss/camss-csid-780.c drivers/media/platform/qcom/camss/camss-csid-690.c

linux-media-qcom-camss/master?
5c5
< * Copyright (c) 2024 Qualcomm Technologies, Inc.
---

Quoted 1 line

* Copyright (c) 2025 Qualcomm Technologies, Inc.

16c16
< #include "camss-csid-780.h"
---

Quoted 1 line

#include "camss-csid-690.h"

27a28

Quoted 1 line

#define SELECT_SW_RST BIT(1)

49c50
< #define BUF_DONE_IRQ_STATUS_RDI_OFFSET (csid_is_lite(csid) ? 1 : 14)
---

Quoted 1 line

#define BUF_DONE_IRQ_STATUS_RDI_OFFSET (csid_is_lite(csid) ? 1 : 13)

61a63

Quoted 1 line

#define CSI2_RX_CFG0_VC_MODE 3

63a66,67

Quoted 2 lines

#define CSI2_RX_CFG0_TPG_NUM_EN 27
#define CSI2_RX_CFG0_TPG_NUM_SEL 28

69c73,75
< #define CSID_RDI_CFG0(rdi) (0x500 + 0x100 * (rdi))
---

Quoted 3 lines
#define CSID_RDI_CFG0(rdi)	(csid_is_lite(csid) ?\
					(0x300 + 0x100 * (rdi)) :\
					(0x500 + 0x100 * (rdi)))

78c84,86
< #define CSID_RDI_CTRL(rdi) (0x504 + 0x100 * (rdi))
---

Quoted 3 lines
#define CSID_RDI_CTRL(rdi)	(csid_is_lite(csid) ? \
					(0x304 + 0x100 * (rdi)) :\
					(0x504 + 0x100 * (rdi)))

81c89,91
< #define CSID_RDI_CFG1(rdi) (0x510 + 0x100 * (rdi))
---

Quoted 3 lines
#define CSID_RDI_CFG1(rdi)	(csid_is_lite(csid) ? \
					(0x310 + 0x100 * (rdi)) :\
					(0x510 + 0x100 * (rdi)))

89,91c99,104
< #define CSID_RDI_IRQ_SUBSAMPLE_PATTERN(rdi) (0x548 + 0x100 * (rdi))
< #define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi) (0x54C + 0x100 * (rdi))
<
---

Quoted 6 lines
#define CSID_RDI_IRQ_SUBSAMPLE_PATTERN(rdi)	(csid_is_lite(csid) ?\
							(0x348 + 0x100 * (rdi)) :\
							(0x548 + 0x100 * (rdi)))
#define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi)	(csid_is_lite(csid) ?\
							(0x34C + 0x100 * (rdi)) :\
							(0x54C + 0x100 * (rdi)))

101a115,116

Quoted 2 lines
	if (vc > 3)
		val |= 1 << CSI2_RX_CFG0_VC_MODE;

171c186,187
< val = RDI_CFG1_PACKING_FORMAT_MIPI;
---

Quoted 2 lines
	val = readl(csid->base + CSID_RDI_CFG1(vc));
	val |= RDI_CFG1_PACKING_FORMAT_MIPI;

262c278
< * For Titan 780, bus done and RUP IRQ have been moved to
---

Quoted 1 line

* For Titan 690, bus done and RUP IRQ have been moved to

328c344
< const struct csid_hw_ops csid_ops_780 = {
---

Quoted 1 line

const struct csid_hw_ops csid_ops_690 = {

Now yes, resisted the name camss-csid-gen3.c when it was 690 or 780 specific but, given the level of convergence with what we are doing upstream @ simple bayer only, I think we should make the effort to share code and resuse.

---
bod

#6 lore raw

PATCH 4/4 media: qcom: camss: Add support for VFE 690

In reply to Vikram Sharma

Add support for VFE found on SA8775P (Titan 690). This VFE is different from vfe 780 w.r.t few register offsets. It supports two full and five lite VFE.

---
 drivers/media/platform/qcom/camss/Makefile    |   1 +
 .../media/platform/qcom/camss/camss-vfe-690.c | 163 +++++++++++++++
 drivers/media/platform/qcom/camss/camss-vfe.c |   5 +-
 drivers/media/platform/qcom/camss/camss-vfe.h |   1 +
 drivers/media/platform/qcom/camss/camss.c     | 192 ++++++++++++++++++
 5 files changed, 361 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-690.c
drivers/media/platform/qcom/camss/Makefile +1 -0
index f1d0e9a00220..284f1775f62f 100644
@@ -18,6 +18,7 @@ qcom-camss-objs += \
 		camss-vfe-4-8.o \
 		camss-vfe-17x.o \
 		camss-vfe-480.o \
+		camss-vfe-690.o \
 		camss-vfe-780.o \
 		camss-vfe-gen1.o \
 		camss-vfe.o \
drivers/media/platform/qcom/camss/camss-vfe-690.c new file +163 -0

163 lines not on this page · raw message

drivers/media/platform/qcom/camss/camss-vfe.c +4 -1
index 9ffa6bc72cf1..71857c68bbed 100644
@@ -346,6 +346,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
 	case CAMSS_8280XP:
 	case CAMSS_845:
 	case CAMSS_8550:
+	case CAMSS_8775P:
 		switch (sink_code) {
 		case MEDIA_BUS_FMT_YUYV8_1X16:
 		{
@@ -908,7 +909,8 @@ static int vfe_match_clock_names(struct vfe_device *vfe,
 
 	return (!strcmp(clock->name, vfe_name) ||
 		!strcmp(clock->name, vfe_lite_name) ||
-		!strcmp(clock->name, "vfe_lite"));
+		!strcmp(clock->name, "vfe_lite") ||
+		!strcmp(clock->name, "camnoc_axi"));
 }
 
 /*
@@ -1972,6 +1974,7 @@ static int vfe_bpl_align(struct vfe_device *vfe)
 	case CAMSS_8280XP:
 	case CAMSS_845:
 	case CAMSS_8550:
+	case CAMSS_8775P:
 		ret = 16;
 		break;
 	default:
drivers/media/platform/qcom/camss/camss-vfe.h +1 -0
index 9dec5bc0d1b1..a9322f4440ae 100644
@@ -243,6 +243,7 @@ extern const struct vfe_hw_ops vfe_ops_4_7;
 extern const struct vfe_hw_ops vfe_ops_4_8;
 extern const struct vfe_hw_ops vfe_ops_170;
 extern const struct vfe_hw_ops vfe_ops_480;
+extern const struct vfe_hw_ops vfe_ops_690;
 extern const struct vfe_hw_ops vfe_ops_780;
 
 int vfe_get(struct vfe_device *vfe);
drivers/media/platform/qcom/camss/camss.c +192 -0

207 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#7 lore raw

Re: [PATCH v1 4/4] media: qcom: camss: Add support for VFE 690

Quoted 2 lines · Vikram Sharma

Add support for VFE found on SA8775P (Titan 690). This VFE is different from vfe 780 w.r.t few register offsets.

VFE780

with-respect-to a few

Quoted 1 line

It supports two full and five lite VFE.

sa8775p supports that not VFE780.

Quoted 207 lines
---
  drivers/media/platform/qcom/camss/Makefile    |   1 +
  .../media/platform/qcom/camss/camss-vfe-690.c | 163 +++++++++++++++
  drivers/media/platform/qcom/camss/camss-vfe.c |   5 +-
  drivers/media/platform/qcom/camss/camss-vfe.h |   1 +
  drivers/media/platform/qcom/camss/camss.c     | 192 ++++++++++++++++++
  5 files changed, 361 insertions(+), 1 deletion(-)

create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-690.c

drivers/media/platform/qcom/camss/Makefile +1 -0
index f1d0e9a00220..284f1775f62f 100644
@@ -18,6 +18,7 @@ qcom-camss-objs += \
  		camss-vfe-4-8.o \
  		camss-vfe-17x.o \
  		camss-vfe-480.o \
+		camss-vfe-690.o \
  		camss-vfe-780.o \
  		camss-vfe-gen1.o \
  		camss-vfe.o \
drivers/media/platform/qcom/camss/camss-vfe-690.c new file +163 -0
new file mode 100644
index 000000000000..92c92065f65b
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v690 (SA8755P)
+ *
+ * Copyright (c) 2025 Qualcomm Technologies, Inc.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+
+#include "camss.h"
+#include "camss-vfe.h"
+
+#define VFE_TOP_CORE_CFG		(0x24)
+#define BUS_REG_BASE			(vfe_is_lite(vfe) ? 0x480 : 0x400)
+
+#define VFE_BUS_WM_CGC_OVERRIDE		(BUS_REG_BASE + 0x08)
+#define	WM_CGC_OVERRIDE_ALL		(0x7FFFFFF)
+
+#define VFE_BUS_WM_TEST_BUS_CTRL	(BUS_REG_BASE + 0xFC)
+
+#define VFE_BUS_WM_CFG(n)		(BUS_REG_BASE + 0x200 + (n) * 0x100)
+#define		WM_CFG_EN			BIT(0)
+#define		WM_VIR_FRM_EN			BIT(1)
+#define		WM_CFG_MODE			BIT(16)
+#define VFE_BUS_WM_IMAGE_ADDR(n)	(BUS_REG_BASE + 0x204 + (n) * 0x100)
+#define VFE_BUS_WM_FRAME_INCR(n)	(BUS_REG_BASE + 0x208 + (n) * 0x100)
+#define VFE_BUS_WM_IMAGE_CFG_0(n)	(BUS_REG_BASE + 0x20c + (n) * 0x100)
+#define		WM_IMAGE_CFG_0_DEFAULT_WIDTH	(0xFFFF)
+#define VFE_BUS_WM_IMAGE_CFG_2(n)	(BUS_REG_BASE + 0x214 + (n) * 0x100)
+#define		WM_IMAGE_CFG_2_DEFAULT_STRIDE	(0xFFFF)
+#define VFE_BUS_WM_PACKER_CFG(n)	(BUS_REG_BASE + 0x218 + (n) * 0x100)
+
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(n)	(BUS_REG_BASE + 0x230 + (n) * 0x100)
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n)	(BUS_REG_BASE + 0x234 + (n) * 0x100)
+#define VFE_BUS_WM_FRAMEDROP_PERIOD(n)		(BUS_REG_BASE + 0x238 + (n) * 0x100)
+#define VFE_BUS_WM_FRAMEDROP_PATTERN(n)		(BUS_REG_BASE + 0x23c + (n) * 0x100)
+
+#define VFE_BUS_WM_MMU_PREFETCH_CFG(n)		(BUS_REG_BASE + 0x260 + (n) * 0x100)
+#define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n)	(BUS_REG_BASE + 0x264 + (n) * 0x100)
+
+/*
+ * Bus client mapping:
+ *
+ * VFE:
+ * 16 = RDI0, 17 = RDI1, 18 = RDI2
+ *
+ * VFE LITE:
+ * 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
+ */
+#define RDI_WM(n)			((vfe_is_lite(vfe) ? 0x0 : 0x10) + (n))
+
+static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
+{
+	struct v4l2_pix_format_mplane *pix =
+		&line->video_out.active_fmt.fmt.pix_mp;
+
+	wm = RDI_WM(wm);
+
+	writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);
+	/* no clock gating at bus input */
+	writel(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL);
+
+	writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height,
+	       vfe->base + VFE_BUS_WM_FRAME_INCR(wm));
+	writel(WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF,
+	       vfe->base + VFE_BUS_WM_IMAGE_CFG_0(wm));
+	writel(WM_IMAGE_CFG_2_DEFAULT_STRIDE,
+	       vfe->base + VFE_BUS_WM_IMAGE_CFG_2(wm));
+
+	writel(0x0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));
+
+	/* TOP CORE CFG */
+	writel(0x600000, vfe->base + VFE_TOP_CORE_CFG);
+
+	/* no dropped frames, one irq per frame */
+	writel(0, vfe->base + VFE_BUS_WM_FRAMEDROP_PERIOD(wm));
+	writel(1, vfe->base + VFE_BUS_WM_FRAMEDROP_PATTERN(wm));
+	writel(0, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(wm));
+	writel(1, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(wm));
+
+	writel(1, vfe->base + VFE_BUS_WM_MMU_PREFETCH_CFG(wm));
+	writel(0xFFFFFFFF, vfe->base + VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(wm));
+
+	writel(WM_CFG_EN | WM_CFG_MODE, vfe->base + VFE_BUS_WM_CFG(wm));
+}
+
+static void vfe_wm_stop(struct vfe_device *vfe, u8 wm)
+{
+	wm = RDI_WM(wm);
+	writel(0, vfe->base + VFE_BUS_WM_CFG(wm));
+}
+
+static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr,
+			  struct vfe_line *line)
+{
+	wm = RDI_WM(wm);
+	writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
+
+	dev_dbg(vfe->camss->dev, "wm:%d, image buf addr:0x%x\n",
+		wm, addr);
+}
+
+static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
+{
+	int port_id = line_id;
+
+	camss_reg_update(vfe->camss, vfe->id, port_id, false);
+}
+
+static inline void vfe_reg_update_clear(struct vfe_device *vfe,
+					enum vfe_line_id line_id)
+{
+	int port_id = line_id;
+
+	camss_reg_update(vfe->camss, vfe->id, port_id, true);
+}
+
+static const struct camss_video_ops vfe_video_ops_690 = {
+	.queue_buffer = vfe_queue_buffer_v2,
+	.flush_buffers = vfe_flush_buffers,
+};
+
+static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
+{
+	vfe->video_ops = vfe_video_ops_690;
+}
+
+static void vfe_global_reset(struct vfe_device *vfe)
+{
+	vfe_isr_reset_ack(vfe);
+}
+
+static irqreturn_t vfe_isr(int irq, void *dev)
+{
+	/* nop */
+	return IRQ_HANDLED;
+}
+
+static int vfe_halt(struct vfe_device *vfe)
+{
+	/* rely on vfe_disable_output() to stop the VFE */
+	return 0;
+}
+
+const struct vfe_hw_ops vfe_ops_690 = {
+	.global_reset = vfe_global_reset,
+	.hw_version = vfe_hw_version,
+	.isr = vfe_isr,
+	.pm_domain_off = vfe_pm_domain_off,
+	.pm_domain_on = vfe_pm_domain_on,
+	.reg_update = vfe_reg_update,
+	.reg_update_clear = vfe_reg_update_clear,
+	.subdev_init = vfe_subdev_init,
+	.vfe_disable = vfe_disable,
+	.vfe_enable = vfe_enable_v2,
+	.vfe_halt = vfe_halt,
+	.vfe_wm_start = vfe_wm_start,
+	.vfe_wm_stop = vfe_wm_stop,
+	.vfe_buf_done = vfe_buf_done,
+	.vfe_wm_update = vfe_wm_update,
+};
drivers/media/platform/qcom/camss/camss-vfe.c +1 -0
index 9ffa6bc72cf1..71857c68bbed 100644
@@ -346,6 +346,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
  	case CAMSS_8280XP:
  	case CAMSS_845:
  	case CAMSS_8550:
+	case CAMSS_8775P:
  		switch (sink_code) {
  		case MEDIA_BUS_FMT_YUYV8_1X16:
  		{

drivers/media/platform/qcom/camss/camss-vfe.c static int vfe_match_clock_names(struct vfe_device *vfe, · line 913

Quoted 6 lines
drivers/media/platform/qcom/camss/camss-vfe.c +2 -1
@@ -908,7 +909,8 @@ static int vfe_match_clock_names(struct vfe_device *vfe,
 
  	return (!strcmp(clock->name, vfe_name) ||
  		!strcmp(clock->name, vfe_lite_name) ||
-		!strcmp(clock->name, "vfe_lite"));
+		!strcmp(clock->name, "vfe_lite") ||
+		!strcmp(clock->name, "camnoc_axi"));

Suspicious you really need to add this clock here, shouldn't be necessary unless you are setting the clock to a particular value.

Quoted 40 lines
drivers/media/platform/qcom/camss/camss-vfe.c +1 -0
  }
 
  /*
@@ -1972,6 +1974,7 @@ static int vfe_bpl_align(struct vfe_device *vfe)
  	case CAMSS_8280XP:
  	case CAMSS_845:
  	case CAMSS_8550:
+	case CAMSS_8775P:
  		ret = 16;
  		break;
  	default:
drivers/media/platform/qcom/camss/camss-vfe.h +1 -0
index 9dec5bc0d1b1..a9322f4440ae 100644
@@ -243,6 +243,7 @@ extern const struct vfe_hw_ops vfe_ops_4_7;
  extern const struct vfe_hw_ops vfe_ops_4_8;
  extern const struct vfe_hw_ops vfe_ops_170;
  extern const struct vfe_hw_ops vfe_ops_480;
+extern const struct vfe_hw_ops vfe_ops_690;
  extern const struct vfe_hw_ops vfe_ops_780;
 
  int vfe_get(struct vfe_device *vfe);
drivers/media/platform/qcom/camss/camss.c +9 -0
index 9458cba1b50f..4df31c89c20c 100644
@@ -2478,6 +2478,196 @@ static const struct camss_subdev_resources csid_res_8775p[] = {
  	},
  };
 
+static const struct camss_subdev_resources vfe_res_8775p[] = {
+	/* VFE0 */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_vfe0", "vfe0", "vfe0_fast_ahb",
+			   "cpas_ahb", "gcc_axi_hf", "gcc_axi_sf",
+			   "core_ahb", "cpas_fast_ahb_clk", "camnoc_axi",
+			   "icp_ahb"},

drivers/media/platform/qcom/camss/camss.c static const struct camss_subdev_resources csid_res_8775p[] = { · line 2499

Quoted 10 lines
drivers/media/platform/qcom/camss/camss.c +10 -0
+		.clock_rate = {
+			{ 0 },
+			{ 480000000 },
+			{ 300000000, 400000000 },
+			{ 300000000, 400000000 },
+			{ 0 },
+			{ 0 },
+			{ 0, 80000000 },
+			{ 300000000, 400000000 },
+			{ 400000000 },

Is 400 MHz required for camnoc_axi, would 0 i.e. enable not do the same job ?

Quoted 39 lines
drivers/media/platform/qcom/camss/camss.c +39 -0
+			{ 0 },
+		},
+
+		.reg = { "vfe0" },
+		.interrupt = { "vfe0" },
+		.vfe = {
+			.line_num = 3,
+			.is_lite = false,
+			.has_pd = false,
+			.pd_name = NULL,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE1 */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_vfe1", "vfe1", "vfe1_fast_ahb",
+			   "cpas_ahb", "gcc_axi_hf", "gcc_axi_sf",
+			   "core_ahb", "cpas_fast_ahb_clk", "camnoc_axi",
+			   "icp_ahb"},
+		.clock_rate = {
+			{ 0 },
+			{ 480000000 },
+			{ 300000000, 400000000 },
+			{ 300000000, 400000000 },
+			{ 0 },
+			{ 0 },
+			{ 0, 80000000 },
+			{ 300000000, 400000000 },
+			{ 400000000 },
+			{ 0 },
+		},
+
+		.reg = { "vfe1" },
+		.interrupt = { "vfe1" },
+		.vfe = {

drivers/media/platform/qcom/camss/camss.c static const struct camss_subdev_resources csid_res_8775p[] = { · line 2548

Quoted 10 lines
drivers/media/platform/qcom/camss/camss.c +10 -0
+			.line_num = 3,
+			.is_lite = false,
+			.has_pd = false,
+			.pd_name = NULL,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+

redundant newline

Quoted 127 lines
drivers/media/platform/qcom/camss/camss.c +122 -0
+	/* VFE2 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite0" },
+		.interrupt = { "vfe-lite0" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE3 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite1" },
+		.interrupt = { "vfe-lite1" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE4 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite2" },
+		.interrupt = { "vfe-lite2" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE5 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite3" },
+		.interrupt = { "vfe-lite3" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE6 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite4" },
+		.interrupt = { "vfe-lite4" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+};
+
  static const struct resources_icc icc_res_sa8775p[] = {
  	{
  		.name = "ahb",
@@ -3469,9 +3659,11 @@ static const struct camss_resources sa8775p_resources = {
  	.csiphy_res = csiphy_res_8775p,

drivers/media/platform/qcom/camss/camss.c static const struct camss_resources sa8775p_resources = { · line 3669

Quoted 10 lines
drivers/media/platform/qcom/camss/camss.c +2 -0
  	.csid_res = csid_res_8775p,
  	.csid_wrapper_res = &csid_wrapper_res_sa8775p,
+	.vfe_res = vfe_res_8775p,
  	.icc_res = icc_res_sa8775p,
  	.csiphy_num = ARRAY_SIZE(csiphy_res_8775p),
  	.csid_num = ARRAY_SIZE(csid_res_8775p),
+	.vfe_num = ARRAY_SIZE(vfe_res_8775p),
  	.icc_path_num = ARRAY_SIZE(icc_res_sa8775p),
  	.link_entities = camss_link_entities
  };

I'd rather have the last patch in your series enumerate - fill out - this structure.

i.e. vfe and csid 780 should be added and then the enumeration of the resource structure for the sa8775p implementation of 780 as the last patch.

---
bod

#8 lore raw

Re: [PATCH v1 4/4] media: qcom: camss: Add support for VFE 690

Quoted 11 lines · Bryan O'Donoghue
Quoted 2 lines · Vikram Sharma

Add support for VFE found on SA8775P (Titan 690). This VFE is different from vfe 780 w.r.t few register offsets.

VFE780

with-respect-to a few

Quoted 1 line

It supports two full and five lite VFE.

sa8775p supports that not VFE780.

Hi Bryan,

Thanks for your comments.
Will rephrase commit text.

Quoted 224 lines
Quoted 224 lines

---
  drivers/media/platform/qcom/camss/Makefile    |   1 +

  .../media/platform/qcom/camss/camss-vfe-690.c | 163 +++++++++++++++
  drivers/media/platform/qcom/camss/camss-vfe.c |   5 +-
  drivers/media/platform/qcom/camss/camss-vfe.h |   1 +
  drivers/media/platform/qcom/camss/camss.c     | 192 ++++++++++++++++++
  5 files changed, 361 insertions(+), 1 deletion(-)

  create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-690.c

drivers/media/platform/qcom/camss/Makefile +1 -0
index f1d0e9a00220..284f1775f62f 100644
@@ -18,6 +18,7 @@ qcom-camss-objs += \
           camss-vfe-4-8.o \
           camss-vfe-17x.o \
           camss-vfe-480.o \
+        camss-vfe-690.o \
           camss-vfe-780.o \
           camss-vfe-gen1.o \
           camss-vfe.o \
drivers/media/platform/qcom/camss/camss-vfe-690.c new file +3 -0
new file mode 100644
index 000000000000..92c92065f65b
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v690 

(SA8755P)
+ *
+ * Copyright (c) 2025 Qualcomm Technologies, Inc.
+ */

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +21 -0
+
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+
+#include "camss.h"
+#include "camss-vfe.h"
+
+#define VFE_TOP_CORE_CFG        (0x24)
+#define BUS_REG_BASE            (vfe_is_lite(vfe) ? 0x480 : 0x400)
+
+#define VFE_BUS_WM_CGC_OVERRIDE        (BUS_REG_BASE + 0x08)
+#define    WM_CGC_OVERRIDE_ALL        (0x7FFFFFF)
+
+#define VFE_BUS_WM_TEST_BUS_CTRL    (BUS_REG_BASE + 0xFC)
+
+#define VFE_BUS_WM_CFG(n)        (BUS_REG_BASE + 0x200 + (n) * 0x100)
+#define        WM_CFG_EN            BIT(0)
+#define        WM_VIR_FRM_EN            BIT(1)
+#define        WM_CFG_MODE            BIT(16)
+#define VFE_BUS_WM_IMAGE_ADDR(n)    (BUS_REG_BASE + 0x204 + (n) * 

0x100)
+#define VFE_BUS_WM_FRAME_INCR(n)    (BUS_REG_BASE + 0x208 + (n) * 0x100)
+#define VFE_BUS_WM_IMAGE_CFG_0(n)    (BUS_REG_BASE + 0x20c + (n) * 0x100)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +2 -0
+#define        WM_IMAGE_CFG_0_DEFAULT_WIDTH    (0xFFFF)
+#define VFE_BUS_WM_IMAGE_CFG_2(n)    (BUS_REG_BASE + 0x214 + (n) * 

0x100)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +2 -0
+#define        WM_IMAGE_CFG_2_DEFAULT_STRIDE    (0xFFFF)
+#define VFE_BUS_WM_PACKER_CFG(n)    (BUS_REG_BASE + 0x218 + (n) * 

0x100)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +13 -0
+
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(n)    (BUS_REG_BASE + 0x230 
+ (n) * 0x100)
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n)    (BUS_REG_BASE + 0x234 
+ (n) * 0x100)
+#define VFE_BUS_WM_FRAMEDROP_PERIOD(n)        (BUS_REG_BASE + 0x238 
+ (n) * 0x100)
+#define VFE_BUS_WM_FRAMEDROP_PATTERN(n)        (BUS_REG_BASE + 0x23c 
+ (n) * 0x100)
+
+#define VFE_BUS_WM_MMU_PREFETCH_CFG(n)        (BUS_REG_BASE + 0x260 
+ (n) * 0x100)
+#define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n)    (BUS_REG_BASE + 

0x264 + (n) * 0x100)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +13 -0
+
+/*
+ * Bus client mapping:
+ *
+ * VFE:
+ * 16 = RDI0, 17 = RDI1, 18 = RDI2
+ *
+ * VFE LITE:
+ * 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
+ */
+#define RDI_WM(n)            ((vfe_is_lite(vfe) ? 0x0 : 0x10) + (n))
+
+static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct 

vfe_line *line)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +30 -0
+{
+    struct v4l2_pix_format_mplane *pix =
+        &line->video_out.active_fmt.fmt.pix_mp;
+
+    wm = RDI_WM(wm);
+
+    writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);
+    /* no clock gating at bus input */
+    writel(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL);
+
+    writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height,
+           vfe->base + VFE_BUS_WM_FRAME_INCR(wm));
+    writel(WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF,
+           vfe->base + VFE_BUS_WM_IMAGE_CFG_0(wm));
+    writel(WM_IMAGE_CFG_2_DEFAULT_STRIDE,
+           vfe->base + VFE_BUS_WM_IMAGE_CFG_2(wm));
+
+    writel(0x0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));
+
+    /* TOP CORE CFG */
+    writel(0x600000, vfe->base + VFE_TOP_CORE_CFG);
+
+    /* no dropped frames, one irq per frame */
+    writel(0, vfe->base + VFE_BUS_WM_FRAMEDROP_PERIOD(wm));
+    writel(1, vfe->base + VFE_BUS_WM_FRAMEDROP_PATTERN(wm));
+    writel(0, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(wm));
+    writel(1, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(wm));
+
+    writel(1, vfe->base + VFE_BUS_WM_MMU_PREFETCH_CFG(wm));
+    writel(0xFFFFFFFF, vfe->base + 

VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(wm));

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +21 -0
+
+    writel(WM_CFG_EN | WM_CFG_MODE, vfe->base + VFE_BUS_WM_CFG(wm));
+}
+
+static void vfe_wm_stop(struct vfe_device *vfe, u8 wm)
+{
+    wm = RDI_WM(wm);
+    writel(0, vfe->base + VFE_BUS_WM_CFG(wm));
+}
+
+static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr,
+              struct vfe_line *line)
+{
+    wm = RDI_WM(wm);
+    writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
+
+    dev_dbg(vfe->camss->dev, "wm:%d, image buf addr:0x%x\n",
+        wm, addr);
+}
+
+static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id 

line_id)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +58 -0
+{
+    int port_id = line_id;
+
+    camss_reg_update(vfe->camss, vfe->id, port_id, false);
+}
+
+static inline void vfe_reg_update_clear(struct vfe_device *vfe,
+                    enum vfe_line_id line_id)
+{
+    int port_id = line_id;
+
+    camss_reg_update(vfe->camss, vfe->id, port_id, true);
+}
+
+static const struct camss_video_ops vfe_video_ops_690 = {
+    .queue_buffer = vfe_queue_buffer_v2,
+    .flush_buffers = vfe_flush_buffers,
+};
+
+static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
+{
+    vfe->video_ops = vfe_video_ops_690;
+}
+
+static void vfe_global_reset(struct vfe_device *vfe)
+{
+    vfe_isr_reset_ack(vfe);
+}
+
+static irqreturn_t vfe_isr(int irq, void *dev)
+{
+    /* nop */
+    return IRQ_HANDLED;
+}
+
+static int vfe_halt(struct vfe_device *vfe)
+{
+    /* rely on vfe_disable_output() to stop the VFE */
+    return 0;
+}
+
+const struct vfe_hw_ops vfe_ops_690 = {
+    .global_reset = vfe_global_reset,
+    .hw_version = vfe_hw_version,
+    .isr = vfe_isr,
+    .pm_domain_off = vfe_pm_domain_off,
+    .pm_domain_on = vfe_pm_domain_on,
+    .reg_update = vfe_reg_update,
+    .reg_update_clear = vfe_reg_update_clear,
+    .subdev_init = vfe_subdev_init,
+    .vfe_disable = vfe_disable,
+    .vfe_enable = vfe_enable_v2,
+    .vfe_halt = vfe_halt,
+    .vfe_wm_start = vfe_wm_start,
+    .vfe_wm_stop = vfe_wm_stop,
+    .vfe_buf_done = vfe_buf_done,
+    .vfe_wm_update = vfe_wm_update,
+};
drivers/media/platform/qcom/camss/camss-vfe.c +0 -0
index 9ffa6bc72cf1..71857c68bbed 100644
@@ -346,6 +346,7 @@ static u32 vfe_src_pad_code(struct vfe_line 
 *line, u32 sink_code,

      case CAMSS_8280XP:
      case CAMSS_845:
      case CAMSS_8550:
+    case CAMSS_8775P:
          switch (sink_code) {
          case MEDIA_BUS_FMT_YUYV8_1X16:
          {

drivers/media/platform/qcom/camss/camss-vfe.c +0 -0
@@ -908,7 +909,8 @@ static int vfe_match_clock_names(struct 
Quoted 8 lines
Quoted 6 lines
drivers/media/platform/qcom/camss/camss-vfe.c +0 -0
 vfe_device *vfe,

        return (!strcmp(clock->name, vfe_name) ||
          !strcmp(clock->name, vfe_lite_name) ||
-        !strcmp(clock->name, "vfe_lite"));
+        !strcmp(clock->name, "vfe_lite") ||
+        !strcmp(clock->name, "camnoc_axi"));

Suspicious you really need to add this clock here, shouldn't be necessary unless you are setting the clock to a particular value.

While testing we found that if camnoc_axi not set to a particular level i.e. 400Mhz Overflows were seen on csid output.

Quoted 43 lines
Quoted 43 lines

  }
    /*

drivers/media/platform/qcom/camss/camss-vfe.c +0 -0
@@ -1972,6 +1974,7 @@ static int vfe_bpl_align(struct vfe_device *vfe)

      case CAMSS_8280XP:
      case CAMSS_845:
      case CAMSS_8550:
+    case CAMSS_8775P:
          ret = 16;
          break;
      default:

drivers/media/platform/qcom/camss/camss-vfe.h +1 -0
index 9dec5bc0d1b1..a9322f4440ae 100644
@@ -243,6 +243,7 @@ extern const struct vfe_hw_ops vfe_ops_4_7;
   extern const struct vfe_hw_ops vfe_ops_4_8;
   extern const struct vfe_hw_ops vfe_ops_170;
   extern const struct vfe_hw_ops vfe_ops_480;
+extern const struct vfe_hw_ops vfe_ops_690;
   extern const struct vfe_hw_ops vfe_ops_780;
     int vfe_get(struct vfe_device *vfe);
drivers/media/platform/qcom/camss/camss.c +12 -0
index 9458cba1b50f..4df31c89c20c 100644
@@ -2478,6 +2478,196 @@ static const struct camss_subdev_resources 
 csid_res_8775p[] = {
       },
   };
   +static const struct camss_subdev_resources vfe_res_8775p[] = {
+    /* VFE0 */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_vfe0", "vfe0", "vfe0_fast_ahb",
+               "cpas_ahb", "gcc_axi_hf", "gcc_axi_sf",
+               "core_ahb", "cpas_fast_ahb_clk", "camnoc_axi",
+               "icp_ahb"},
+        .clock_rate = {
+            { 0 },
+            { 480000000 },
+            { 300000000, 400000000 },
Quoted 8 lines

drivers/media/platform/qcom/camss/camss.c static const struct camss_subdev_resources csid_res_8775p[] = { · line 2499

Quoted 6 lines
drivers/media/platform/qcom/camss/camss.c +6 -0
+            { 300000000, 400000000 },
+            { 0 },
+            { 0 },
+            { 0, 80000000 },
+            { 300000000, 400000000 },
+            { 400000000 },

Is 400 MHz required for camnoc_axi, would 0 i.e. enable not do the same job?

While testing we found that if camnoc_axi not set to a particular level i.e. 400Mhz Overflows were seen on csid output.

Quoted 44 lines
Quoted 44 lines
drivers/media/platform/qcom/camss/camss.c +43 -0
+            { 0 },
+        },
+
+        .reg = { "vfe0" },
+        .interrupt = { "vfe0" },
+        .vfe = {
+            .line_num = 3,
+            .is_lite = false,
+            .has_pd = false,
+            .pd_name = NULL,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE1 */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_vfe1", "vfe1", "vfe1_fast_ahb",
+               "cpas_ahb", "gcc_axi_hf", "gcc_axi_sf",
+               "core_ahb", "cpas_fast_ahb_clk", "camnoc_axi",
+               "icp_ahb"},
+        .clock_rate = {
+            { 0 },
+            { 480000000 },
+            { 300000000, 400000000 },
+            { 300000000, 400000000 },
+            { 0 },
+            { 0 },
+            { 0, 80000000 },
+            { 300000000, 400000000 },
+            { 400000000 },
+            { 0 },
+        },
+
+        .reg = { "vfe1" },
+        .interrupt = { "vfe1" },
+        .vfe = {
+            .line_num = 3,
+            .is_lite = false,
+            .has_pd = false,
+            .pd_name = NULL,
Quoted 8 lines

drivers/media/platform/qcom/camss/camss.c static const struct camss_subdev_resources csid_res_8775p[] = { · line 2518

Quoted 6 lines
drivers/media/platform/qcom/camss/camss.c +6 -0
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+

redundant newline

ACK

Quoted 142 lines
Quoted 137 lines
drivers/media/platform/qcom/camss/camss.c +122 -0
+    /* VFE2 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite0" },
+        .interrupt = { "vfe-lite0" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE3 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite1" },
+        .interrupt = { "vfe-lite1" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE4 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite2" },
+        .interrupt = { "vfe-lite2" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE5 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite3" },
+        .interrupt = { "vfe-lite3" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE6 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite4" },
+        .interrupt = { "vfe-lite4" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+};
+
   static const struct resources_icc icc_res_sa8775p[] = {
       {

          .name = "ahb",

drivers/media/platform/qcom/camss/camss.c +2 -0
@@ -3469,9 +3659,11 @@ static const struct camss_resources 
 sa8775p_resources = {
       .csiphy_res = csiphy_res_8775p,
       .csid_res = csid_res_8775p,
       .csid_wrapper_res = &csid_wrapper_res_sa8775p,
+    .vfe_res = vfe_res_8775p,
       .icc_res = icc_res_sa8775p,
       .csiphy_num = ARRAY_SIZE(csiphy_res_8775p),
       .csid_num = ARRAY_SIZE(csid_res_8775p),
+    .vfe_num = ARRAY_SIZE(vfe_res_8775p),
       .icc_path_num = ARRAY_SIZE(icc_res_sa8775p),
Quoted 2 lines

      .link_entities = camss_link_entities
  };

I'd rather have the last patch in your series enumerate - fill out - this structure.

Quoted 1 line

i.e. vfe and csid 780 should be added and then the enumeration of the resource structure for the sa8775p implementation of 780 as the last patch.

Does that mean we should add compatible string, new enum "CAMSS_8775P" and enumerations of the resources as the last patch of the series?

Best Regards,
Vikram

Quoted 3 lines

---
bod

maintainer
#9 lore raw

Re: [PATCH v1 4/4] media: qcom: camss: Add support for VFE 690

In reply to Vikram Sharma
Quoted 442 lines · Vikram Sharma

Add support for VFE found on SA8775P (Titan 690). This VFE is different from vfe 780 w.r.t few register offsets. It supports two full and five lite VFE.

---
  drivers/media/platform/qcom/camss/Makefile    |   1 +
  .../media/platform/qcom/camss/camss-vfe-690.c | 163 +++++++++++++++
  drivers/media/platform/qcom/camss/camss-vfe.c |   5 +-
  drivers/media/platform/qcom/camss/camss-vfe.h |   1 +
  drivers/media/platform/qcom/camss/camss.c     | 192 ++++++++++++++++++
  5 files changed, 361 insertions(+), 1 deletion(-)

create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-690.c

drivers/media/platform/qcom/camss/Makefile +1 -0
index f1d0e9a00220..284f1775f62f 100644
@@ -18,6 +18,7 @@ qcom-camss-objs += \
  		camss-vfe-4-8.o \
  		camss-vfe-17x.o \
  		camss-vfe-480.o \
+		camss-vfe-690.o \
  		camss-vfe-780.o \
  		camss-vfe-gen1.o \
  		camss-vfe.o \
drivers/media/platform/qcom/camss/camss-vfe-690.c new file +163 -0
new file mode 100644
index 000000000000..92c92065f65b
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v690 (SA8755P)
+ *
+ * Copyright (c) 2025 Qualcomm Technologies, Inc.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+
+#include "camss.h"
+#include "camss-vfe.h"
+
+#define VFE_TOP_CORE_CFG		(0x24)
+#define BUS_REG_BASE			(vfe_is_lite(vfe) ? 0x480 : 0x400)
+
+#define VFE_BUS_WM_CGC_OVERRIDE		(BUS_REG_BASE + 0x08)
+#define	WM_CGC_OVERRIDE_ALL		(0x7FFFFFF)
+
+#define VFE_BUS_WM_TEST_BUS_CTRL	(BUS_REG_BASE + 0xFC)
+
+#define VFE_BUS_WM_CFG(n)		(BUS_REG_BASE + 0x200 + (n) * 0x100)
+#define		WM_CFG_EN			BIT(0)
+#define		WM_VIR_FRM_EN			BIT(1)
+#define		WM_CFG_MODE			BIT(16)
+#define VFE_BUS_WM_IMAGE_ADDR(n)	(BUS_REG_BASE + 0x204 + (n) * 0x100)
+#define VFE_BUS_WM_FRAME_INCR(n)	(BUS_REG_BASE + 0x208 + (n) * 0x100)
+#define VFE_BUS_WM_IMAGE_CFG_0(n)	(BUS_REG_BASE + 0x20c + (n) * 0x100)
+#define		WM_IMAGE_CFG_0_DEFAULT_WIDTH	(0xFFFF)
+#define VFE_BUS_WM_IMAGE_CFG_2(n)	(BUS_REG_BASE + 0x214 + (n) * 0x100)
+#define		WM_IMAGE_CFG_2_DEFAULT_STRIDE	(0xFFFF)
+#define VFE_BUS_WM_PACKER_CFG(n)	(BUS_REG_BASE + 0x218 + (n) * 0x100)
+
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(n)	(BUS_REG_BASE + 0x230 + (n) * 0x100)
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n)	(BUS_REG_BASE + 0x234 + (n) * 0x100)
+#define VFE_BUS_WM_FRAMEDROP_PERIOD(n)		(BUS_REG_BASE + 0x238 + (n) * 0x100)
+#define VFE_BUS_WM_FRAMEDROP_PATTERN(n)		(BUS_REG_BASE + 0x23c + (n) * 0x100)
+
+#define VFE_BUS_WM_MMU_PREFETCH_CFG(n)		(BUS_REG_BASE + 0x260 + (n) * 0x100)
+#define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n)	(BUS_REG_BASE + 0x264 + (n) * 0x100)
+
+/*
+ * Bus client mapping:
+ *
+ * VFE:
+ * 16 = RDI0, 17 = RDI1, 18 = RDI2
+ *
+ * VFE LITE:
+ * 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
+ */
+#define RDI_WM(n)			((vfe_is_lite(vfe) ? 0x0 : 0x10) + (n))
+
+static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
+{
+	struct v4l2_pix_format_mplane *pix =
+		&line->video_out.active_fmt.fmt.pix_mp;
+
+	wm = RDI_WM(wm);
+
+	writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);
+	/* no clock gating at bus input */
+	writel(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL);
+
+	writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height,
+	       vfe->base + VFE_BUS_WM_FRAME_INCR(wm));
+	writel(WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF,
+	       vfe->base + VFE_BUS_WM_IMAGE_CFG_0(wm));
+	writel(WM_IMAGE_CFG_2_DEFAULT_STRIDE,
+	       vfe->base + VFE_BUS_WM_IMAGE_CFG_2(wm));
+
+	writel(0x0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));
+
+	/* TOP CORE CFG */
+	writel(0x600000, vfe->base + VFE_TOP_CORE_CFG);
+
+	/* no dropped frames, one irq per frame */
+	writel(0, vfe->base + VFE_BUS_WM_FRAMEDROP_PERIOD(wm));
+	writel(1, vfe->base + VFE_BUS_WM_FRAMEDROP_PATTERN(wm));
+	writel(0, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(wm));
+	writel(1, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(wm));
+
+	writel(1, vfe->base + VFE_BUS_WM_MMU_PREFETCH_CFG(wm));
+	writel(0xFFFFFFFF, vfe->base + VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(wm));
+
+	writel(WM_CFG_EN | WM_CFG_MODE, vfe->base + VFE_BUS_WM_CFG(wm));
+}
+
+static void vfe_wm_stop(struct vfe_device *vfe, u8 wm)
+{
+	wm = RDI_WM(wm);
+	writel(0, vfe->base + VFE_BUS_WM_CFG(wm));
+}
+
+static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr,
+			  struct vfe_line *line)
+{
+	wm = RDI_WM(wm);
+	writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
+
+	dev_dbg(vfe->camss->dev, "wm:%d, image buf addr:0x%x\n",
+		wm, addr);
+}
+
+static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
+{
+	int port_id = line_id;
+
+	camss_reg_update(vfe->camss, vfe->id, port_id, false);
+}
+
+static inline void vfe_reg_update_clear(struct vfe_device *vfe,
+					enum vfe_line_id line_id)
+{
+	int port_id = line_id;
+
+	camss_reg_update(vfe->camss, vfe->id, port_id, true);
+}
+
+static const struct camss_video_ops vfe_video_ops_690 = {
+	.queue_buffer = vfe_queue_buffer_v2,
+	.flush_buffers = vfe_flush_buffers,
+};
+
+static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
+{
+	vfe->video_ops = vfe_video_ops_690;
+}
+
+static void vfe_global_reset(struct vfe_device *vfe)
+{
+	vfe_isr_reset_ack(vfe);
+}
+
+static irqreturn_t vfe_isr(int irq, void *dev)
+{
+	/* nop */
+	return IRQ_HANDLED;
+}
+
+static int vfe_halt(struct vfe_device *vfe)
+{
+	/* rely on vfe_disable_output() to stop the VFE */
+	return 0;
+}
+
+const struct vfe_hw_ops vfe_ops_690 = {
+	.global_reset = vfe_global_reset,
+	.hw_version = vfe_hw_version,
+	.isr = vfe_isr,
+	.pm_domain_off = vfe_pm_domain_off,
+	.pm_domain_on = vfe_pm_domain_on,
+	.reg_update = vfe_reg_update,
+	.reg_update_clear = vfe_reg_update_clear,
+	.subdev_init = vfe_subdev_init,
+	.vfe_disable = vfe_disable,
+	.vfe_enable = vfe_enable_v2,
+	.vfe_halt = vfe_halt,
+	.vfe_wm_start = vfe_wm_start,
+	.vfe_wm_stop = vfe_wm_stop,
+	.vfe_buf_done = vfe_buf_done,
+	.vfe_wm_update = vfe_wm_update,
+};
drivers/media/platform/qcom/camss/camss-vfe.c +4 -1
index 9ffa6bc72cf1..71857c68bbed 100644
@@ -346,6 +346,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
  	case CAMSS_8280XP:
  	case CAMSS_845:
  	case CAMSS_8550:
+	case CAMSS_8775P:
  		switch (sink_code) {
  		case MEDIA_BUS_FMT_YUYV8_1X16:
  		{
@@ -908,7 +909,8 @@ static int vfe_match_clock_names(struct vfe_device *vfe,
 
  	return (!strcmp(clock->name, vfe_name) ||
  		!strcmp(clock->name, vfe_lite_name) ||
-		!strcmp(clock->name, "vfe_lite"));
+		!strcmp(clock->name, "vfe_lite") ||
+		!strcmp(clock->name, "camnoc_axi"));
  }
 
  /*
@@ -1972,6 +1974,7 @@ static int vfe_bpl_align(struct vfe_device *vfe)
  	case CAMSS_8280XP:
  	case CAMSS_845:
  	case CAMSS_8550:
+	case CAMSS_8775P:
  		ret = 16;
  		break;
  	default:
drivers/media/platform/qcom/camss/camss-vfe.h +1 -0
index 9dec5bc0d1b1..a9322f4440ae 100644
@@ -243,6 +243,7 @@ extern const struct vfe_hw_ops vfe_ops_4_7;
  extern const struct vfe_hw_ops vfe_ops_4_8;
  extern const struct vfe_hw_ops vfe_ops_170;
  extern const struct vfe_hw_ops vfe_ops_480;
+extern const struct vfe_hw_ops vfe_ops_690;
  extern const struct vfe_hw_ops vfe_ops_780;
 
  int vfe_get(struct vfe_device *vfe);
drivers/media/platform/qcom/camss/camss.c +190 -0
index 9458cba1b50f..4df31c89c20c 100644
@@ -2478,6 +2478,196 @@ static const struct camss_subdev_resources csid_res_8775p[] = {
  	},
  };
 
+static const struct camss_subdev_resources vfe_res_8775p[] = {
+	/* VFE0 */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_vfe0", "vfe0", "vfe0_fast_ahb",
+			   "cpas_ahb", "gcc_axi_hf", "gcc_axi_sf",
+			   "core_ahb", "cpas_fast_ahb_clk", "camnoc_axi",
+			   "icp_ahb"},
+		.clock_rate = {
+			{ 0 },
+			{ 480000000 },
+			{ 300000000, 400000000 },
+			{ 300000000, 400000000 },
+			{ 0 },
+			{ 0 },
+			{ 0, 80000000 },
+			{ 300000000, 400000000 },
+			{ 400000000 },
+			{ 0 },
+		},
+
+		.reg = { "vfe0" },
+		.interrupt = { "vfe0" },
+		.vfe = {
+			.line_num = 3,
+			.is_lite = false,
+			.has_pd = false,
+			.pd_name = NULL,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE1 */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_vfe1", "vfe1", "vfe1_fast_ahb",
+			   "cpas_ahb", "gcc_axi_hf", "gcc_axi_sf",
+			   "core_ahb", "cpas_fast_ahb_clk", "camnoc_axi",
+			   "icp_ahb"},
+		.clock_rate = {
+			{ 0 },
+			{ 480000000 },
+			{ 300000000, 400000000 },
+			{ 300000000, 400000000 },
+			{ 0 },
+			{ 0 },
+			{ 0, 80000000 },
+			{ 300000000, 400000000 },
+			{ 400000000 },
+			{ 0 },
+		},
+
+		.reg = { "vfe1" },
+		.interrupt = { "vfe1" },
+		.vfe = {
+			.line_num = 3,
+			.is_lite = false,
+			.has_pd = false,
+			.pd_name = NULL,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+
+	/* VFE2 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite0" },
+		.interrupt = { "vfe-lite0" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE3 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite1" },
+		.interrupt = { "vfe-lite1" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE4 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite2" },
+		.interrupt = { "vfe-lite2" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE5 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite3" },
+		.interrupt = { "vfe-lite3" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+	/* VFE6 (lite) */
+	{
+		.regulators = {},
+
+		.clock = { "cpas_ife_lite", "vfe_lite_ahb",
+			   "vfe_lite_csid", "vfe_lite_cphy_rx",
+			   "vfe_lite"},
+		.clock_rate = {
+			{ 0, 0, 0, 0  },
+			{ 300000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 400000000, 400000000, 400000000, 400000000 },
+			{ 480000000, 600000000, 600000000, 600000000 },
+		},
+		.reg = { "vfe_lite4" },
+		.interrupt = { "vfe-lite4" },
+		.vfe = {
+			.line_num = 4,
+			.is_lite = true,
+			.hw_ops = &vfe_ops_690,
+			.formats_rdi = &vfe_formats_rdi_845,
+			.formats_pix = &vfe_formats_pix_845
+		}
+	},
+};
+
  static const struct resources_icc icc_res_sa8775p[] = {
  	{
  		.name = "ahb",
@@ -3469,9 +3659,11 @@ static const struct camss_resources sa8775p_resources = {
  	.csiphy_res = csiphy_res_8775p,

drivers/media/platform/qcom/camss/camss.c static const struct camss_resources sa8775p_resources = { · line 3669

Quoted 10 lines
drivers/media/platform/qcom/camss/camss.c +2 -0
  	.csid_res = csid_res_8775p,
  	.csid_wrapper_res = &csid_wrapper_res_sa8775p,
+	.vfe_res = vfe_res_8775p,
  	.icc_res = icc_res_sa8775p,
  	.csiphy_num = ARRAY_SIZE(csiphy_res_8775p),
  	.csid_num = ARRAY_SIZE(csid_res_8775p),
+	.vfe_num = ARRAY_SIZE(vfe_res_8775p),
  	.icc_path_num = ARRAY_SIZE(icc_res_sa8775p),
  	.link_entities = camss_link_entities
  };

There's a pretty superficial difference between 780 and 990

git diff drivers/media/platform/qcom/camss/camss-vfe-690.c drivers/media/platform/qcom/camss/camss-vfe-780.c

linux-media-qcom-camss/master?
3c3
< * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v690 (SA8755P)
---

Quoted 1 line

* Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v780 (SM8550)

5c5
< * Copyright (c) 2025 Qualcomm Technologies, Inc.
---

Quoted 1 line

* Copyright (c) 2024 Qualcomm Technologies, Inc.

15,16c15
< #define VFE_TOP_CORE_CFG (0x24)
< #define BUS_REG_BASE (vfe_is_lite(vfe) ? 0x480 : 0x400)
---

Quoted 1 line

#define BUS_REG_BASE (vfe_is_lite(vfe) ? 0x200 : 0xC00)

19c18
< #define WM_CGC_OVERRIDE_ALL (0x7FFFFFF)
---

Quoted 1 line

#define WM_CGC_OVERRIDE_ALL (0x7FFFFFF)

21c20
< #define VFE_BUS_WM_TEST_BUS_CTRL (BUS_REG_BASE + 0xFC)
---

Quoted 1 line

#define VFE_BUS_WM_TEST_BUS_CTRL (BUS_REG_BASE + 0xDC)

46,47c45,46
< * VFE:
< * 16 = RDI0, 17 = RDI1, 18 = RDI2
---

Quoted 2 lines

* Full VFE:
* 23 = RDI0, 24 = RDI1, 25 = RDI2

50c49
< * 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
---

Quoted 1 line

* 0 = RDI0, 1 = RDI1, 2 = RDI3, 4 = RDI4

52c51
< #define RDI_WM(n) ((vfe_is_lite(vfe) ? 0x0 : 0x10) + (n))
---

Quoted 1 line

#define RDI_WM(n) ((vfe_is_lite(vfe) ? 0x0 : 0x17) + (n))

61d59
< writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);
62a61,62

Quoted 2 lines
	writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);

65c65
< writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height,
---

Quoted 1 line
	writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height >> 8,

67c67
< writel(WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF,
---

Quoted 1 line
	writel((WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF),

71,75c71
<
< writel(0x0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));
<
< /* TOP CORE CFG */
< writel(0x600000, vfe->base + VFE_TOP_CORE_CFG);

What's this for ?

---

Quoted 1 line
	writel(0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));

99c95
< writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
---

Quoted 1 line
	writel((addr >> 8) & 0xFFFFFFFF, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));

120c116
< static const struct camss_video_ops vfe_video_ops_690 = {
---

Quoted 1 line

static const struct camss_video_ops vfe_video_ops_780 = {

127c123
< vfe->video_ops = vfe_video_ops_690;
---

Quoted 1 line
	vfe->video_ops = vfe_video_ops_780;

147c143
< const struct vfe_hw_ops vfe_ops_690 = {
---

Quoted 1 line

const struct vfe_hw_ops vfe_ops_780 = {

I don't really see much logical difference here to justify all of the copy/paste code.

Could you comment on some set of offsets passed in the VFE resources structure ?

If not an offset then perhaps a camss-vfe-gen3.c file which contains the shared code and wrappering that shared code in camss-vfe-690 and vfe-780 respectively ?

Actually, I think that's the way to go, for his level of similarity it should be possible to move the share code 1:1 in many cases to a shared file.

---
bod

#10 lore raw

Re: [PATCH v1 4/4] media: qcom: camss: Add support for VFE 690

Quoted 554 lines · Bryan O'Donoghue
Quoted 465 lines · Vikram Sharma

Add support for VFE found on SA8775P (Titan 690). This VFE is different from vfe 780 w.r.t few register offsets. It supports two full and five lite VFE.

---
  drivers/media/platform/qcom/camss/Makefile    |   1 +

  .../media/platform/qcom/camss/camss-vfe-690.c | 163 +++++++++++++++
  drivers/media/platform/qcom/camss/camss-vfe.c |   5 +-
  drivers/media/platform/qcom/camss/camss-vfe.h |   1 +
  drivers/media/platform/qcom/camss/camss.c     | 192 ++++++++++++++++++
  5 files changed, 361 insertions(+), 1 deletion(-)

  create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-690.c

drivers/media/platform/qcom/camss/Makefile +1 -0
index f1d0e9a00220..284f1775f62f 100644
@@ -18,6 +18,7 @@ qcom-camss-objs += \
           camss-vfe-4-8.o \
           camss-vfe-17x.o \
           camss-vfe-480.o \
+        camss-vfe-690.o \
           camss-vfe-780.o \
           camss-vfe-gen1.o \
           camss-vfe.o \
drivers/media/platform/qcom/camss/camss-vfe-690.c new file +3 -0
new file mode 100644
index 000000000000..92c92065f65b
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v690 

(SA8755P)
+ *
+ * Copyright (c) 2025 Qualcomm Technologies, Inc.
+ */

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +21 -0
+
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+
+#include "camss.h"
+#include "camss-vfe.h"
+
+#define VFE_TOP_CORE_CFG        (0x24)
+#define BUS_REG_BASE            (vfe_is_lite(vfe) ? 0x480 : 0x400)
+
+#define VFE_BUS_WM_CGC_OVERRIDE        (BUS_REG_BASE + 0x08)
+#define    WM_CGC_OVERRIDE_ALL        (0x7FFFFFF)
+
+#define VFE_BUS_WM_TEST_BUS_CTRL    (BUS_REG_BASE + 0xFC)
+
+#define VFE_BUS_WM_CFG(n)        (BUS_REG_BASE + 0x200 + (n) * 0x100)
+#define        WM_CFG_EN            BIT(0)
+#define        WM_VIR_FRM_EN            BIT(1)
+#define        WM_CFG_MODE            BIT(16)
+#define VFE_BUS_WM_IMAGE_ADDR(n)    (BUS_REG_BASE + 0x204 + (n) * 

0x100)
+#define VFE_BUS_WM_FRAME_INCR(n)    (BUS_REG_BASE + 0x208 + (n) * 0x100)
+#define VFE_BUS_WM_IMAGE_CFG_0(n)    (BUS_REG_BASE + 0x20c + (n) * 0x100)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +2 -0
+#define        WM_IMAGE_CFG_0_DEFAULT_WIDTH    (0xFFFF)
+#define VFE_BUS_WM_IMAGE_CFG_2(n)    (BUS_REG_BASE + 0x214 + (n) * 

0x100)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +2 -0
+#define        WM_IMAGE_CFG_2_DEFAULT_STRIDE    (0xFFFF)
+#define VFE_BUS_WM_PACKER_CFG(n)    (BUS_REG_BASE + 0x218 + (n) * 

0x100)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +13 -0
+
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(n)    (BUS_REG_BASE + 0x230 
+ (n) * 0x100)
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n)    (BUS_REG_BASE + 0x234 
+ (n) * 0x100)
+#define VFE_BUS_WM_FRAMEDROP_PERIOD(n)        (BUS_REG_BASE + 0x238 
+ (n) * 0x100)
+#define VFE_BUS_WM_FRAMEDROP_PATTERN(n)        (BUS_REG_BASE + 0x23c 
+ (n) * 0x100)
+
+#define VFE_BUS_WM_MMU_PREFETCH_CFG(n)        (BUS_REG_BASE + 0x260 
+ (n) * 0x100)
+#define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n)    (BUS_REG_BASE + 

0x264 + (n) * 0x100)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +13 -0
+
+/*
+ * Bus client mapping:
+ *
+ * VFE:
+ * 16 = RDI0, 17 = RDI1, 18 = RDI2
+ *
+ * VFE LITE:
+ * 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
+ */
+#define RDI_WM(n)            ((vfe_is_lite(vfe) ? 0x0 : 0x10) + (n))
+
+static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct 

vfe_line *line)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +30 -0
+{
+    struct v4l2_pix_format_mplane *pix =
+        &line->video_out.active_fmt.fmt.pix_mp;
+
+    wm = RDI_WM(wm);
+
+    writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);
+    /* no clock gating at bus input */
+    writel(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL);
+
+    writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height,
+           vfe->base + VFE_BUS_WM_FRAME_INCR(wm));
+    writel(WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF,
+           vfe->base + VFE_BUS_WM_IMAGE_CFG_0(wm));
+    writel(WM_IMAGE_CFG_2_DEFAULT_STRIDE,
+           vfe->base + VFE_BUS_WM_IMAGE_CFG_2(wm));
+
+    writel(0x0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));
+
+    /* TOP CORE CFG */
+    writel(0x600000, vfe->base + VFE_TOP_CORE_CFG);
+
+    /* no dropped frames, one irq per frame */
+    writel(0, vfe->base + VFE_BUS_WM_FRAMEDROP_PERIOD(wm));
+    writel(1, vfe->base + VFE_BUS_WM_FRAMEDROP_PATTERN(wm));
+    writel(0, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(wm));
+    writel(1, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(wm));
+
+    writel(1, vfe->base + VFE_BUS_WM_MMU_PREFETCH_CFG(wm));
+    writel(0xFFFFFFFF, vfe->base + 

VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(wm));

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +21 -0
+
+    writel(WM_CFG_EN | WM_CFG_MODE, vfe->base + VFE_BUS_WM_CFG(wm));
+}
+
+static void vfe_wm_stop(struct vfe_device *vfe, u8 wm)
+{
+    wm = RDI_WM(wm);
+    writel(0, vfe->base + VFE_BUS_WM_CFG(wm));
+}
+
+static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr,
+              struct vfe_line *line)
+{
+    wm = RDI_WM(wm);
+    writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
+
+    dev_dbg(vfe->camss->dev, "wm:%d, image buf addr:0x%x\n",
+        wm, addr);
+}
+
+static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id 

line_id)

drivers/media/platform/qcom/camss/camss-vfe-690.c new file +58 -0
+{
+    int port_id = line_id;
+
+    camss_reg_update(vfe->camss, vfe->id, port_id, false);
+}
+
+static inline void vfe_reg_update_clear(struct vfe_device *vfe,
+                    enum vfe_line_id line_id)
+{
+    int port_id = line_id;
+
+    camss_reg_update(vfe->camss, vfe->id, port_id, true);
+}
+
+static const struct camss_video_ops vfe_video_ops_690 = {
+    .queue_buffer = vfe_queue_buffer_v2,
+    .flush_buffers = vfe_flush_buffers,
+};
+
+static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
+{
+    vfe->video_ops = vfe_video_ops_690;
+}
+
+static void vfe_global_reset(struct vfe_device *vfe)
+{
+    vfe_isr_reset_ack(vfe);
+}
+
+static irqreturn_t vfe_isr(int irq, void *dev)
+{
+    /* nop */
+    return IRQ_HANDLED;
+}
+
+static int vfe_halt(struct vfe_device *vfe)
+{
+    /* rely on vfe_disable_output() to stop the VFE */
+    return 0;
+}
+
+const struct vfe_hw_ops vfe_ops_690 = {
+    .global_reset = vfe_global_reset,
+    .hw_version = vfe_hw_version,
+    .isr = vfe_isr,
+    .pm_domain_off = vfe_pm_domain_off,
+    .pm_domain_on = vfe_pm_domain_on,
+    .reg_update = vfe_reg_update,
+    .reg_update_clear = vfe_reg_update_clear,
+    .subdev_init = vfe_subdev_init,
+    .vfe_disable = vfe_disable,
+    .vfe_enable = vfe_enable_v2,
+    .vfe_halt = vfe_halt,
+    .vfe_wm_start = vfe_wm_start,
+    .vfe_wm_stop = vfe_wm_stop,
+    .vfe_buf_done = vfe_buf_done,
+    .vfe_wm_update = vfe_wm_update,
+};
drivers/media/platform/qcom/camss/camss-vfe.c +0 -0
index 9ffa6bc72cf1..71857c68bbed 100644
@@ -346,6 +346,7 @@ static u32 vfe_src_pad_code(struct vfe_line 
 *line, u32 sink_code,

      case CAMSS_8280XP:
      case CAMSS_845:
      case CAMSS_8550:
+    case CAMSS_8775P:
          switch (sink_code) {
          case MEDIA_BUS_FMT_YUYV8_1X16:
          {

drivers/media/platform/qcom/camss/camss-vfe.c +0 -0
@@ -908,7 +909,8 @@ static int vfe_match_clock_names(struct 
 vfe_device *vfe,

        return (!strcmp(clock->name, vfe_name) ||
          !strcmp(clock->name, vfe_lite_name) ||
-        !strcmp(clock->name, "vfe_lite"));
+        !strcmp(clock->name, "vfe_lite") ||
+        !strcmp(clock->name, "camnoc_axi"));
  }
    /*

drivers/media/platform/qcom/camss/camss-vfe.c +0 -0
@@ -1972,6 +1974,7 @@ static int vfe_bpl_align(struct vfe_device *vfe)

      case CAMSS_8280XP:
      case CAMSS_845:
      case CAMSS_8550:
+    case CAMSS_8775P:
          ret = 16;
          break;
      default:

drivers/media/platform/qcom/camss/camss-vfe.h +1 -0
index 9dec5bc0d1b1..a9322f4440ae 100644
@@ -243,6 +243,7 @@ extern const struct vfe_hw_ops vfe_ops_4_7;
   extern const struct vfe_hw_ops vfe_ops_4_8;
   extern const struct vfe_hw_ops vfe_ops_170;
   extern const struct vfe_hw_ops vfe_ops_480;
+extern const struct vfe_hw_ops vfe_ops_690;
   extern const struct vfe_hw_ops vfe_ops_780;
     int vfe_get(struct vfe_device *vfe);
drivers/media/platform/qcom/camss/camss.c +189 -0
index 9458cba1b50f..4df31c89c20c 100644
@@ -2478,6 +2478,196 @@ static const struct camss_subdev_resources 
 csid_res_8775p[] = {
       },
   };
   +static const struct camss_subdev_resources vfe_res_8775p[] = {
+    /* VFE0 */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_vfe0", "vfe0", "vfe0_fast_ahb",
+               "cpas_ahb", "gcc_axi_hf", "gcc_axi_sf",
+               "core_ahb", "cpas_fast_ahb_clk", "camnoc_axi",
+               "icp_ahb"},
+        .clock_rate = {
+            { 0 },
+            { 480000000 },
+            { 300000000, 400000000 },
+            { 300000000, 400000000 },
+            { 0 },
+            { 0 },
+            { 0, 80000000 },
+            { 300000000, 400000000 },
+            { 400000000 },
+            { 0 },
+        },
+
+        .reg = { "vfe0" },
+        .interrupt = { "vfe0" },
+        .vfe = {
+            .line_num = 3,
+            .is_lite = false,
+            .has_pd = false,
+            .pd_name = NULL,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE1 */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_vfe1", "vfe1", "vfe1_fast_ahb",
+               "cpas_ahb", "gcc_axi_hf", "gcc_axi_sf",
+               "core_ahb", "cpas_fast_ahb_clk", "camnoc_axi",
+               "icp_ahb"},
+        .clock_rate = {
+            { 0 },
+            { 480000000 },
+            { 300000000, 400000000 },
+            { 300000000, 400000000 },
+            { 0 },
+            { 0 },
+            { 0, 80000000 },
+            { 300000000, 400000000 },
+            { 400000000 },
+            { 0 },
+        },
+
+        .reg = { "vfe1" },
+        .interrupt = { "vfe1" },
+        .vfe = {
+            .line_num = 3,
+            .is_lite = false,
+            .has_pd = false,
+            .pd_name = NULL,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+
+    /* VFE2 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite0" },
+        .interrupt = { "vfe-lite0" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE3 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite1" },
+        .interrupt = { "vfe-lite1" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE4 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite2" },
+        .interrupt = { "vfe-lite2" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE5 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite3" },
+        .interrupt = { "vfe-lite3" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+    /* VFE6 (lite) */
+    {
+        .regulators = {},
+
+        .clock = { "cpas_ife_lite", "vfe_lite_ahb",
+               "vfe_lite_csid", "vfe_lite_cphy_rx",
+               "vfe_lite"},
+        .clock_rate = {
+            { 0, 0, 0, 0  },
+            { 300000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 400000000, 400000000, 400000000, 400000000 },
+            { 480000000, 600000000, 600000000, 600000000 },
+        },
+        .reg = { "vfe_lite4" },
+        .interrupt = { "vfe-lite4" },
+        .vfe = {
+            .line_num = 4,
+            .is_lite = true,
+            .hw_ops = &vfe_ops_690,
+            .formats_rdi = &vfe_formats_rdi_845,
+            .formats_pix = &vfe_formats_pix_845
+        }
+    },
+};
+
   static const struct resources_icc icc_res_sa8775p[] = {
       {

          .name = "ahb",

drivers/media/platform/qcom/camss/camss.c +2 -0
@@ -3469,9 +3659,11 @@ static const struct camss_resources 
 sa8775p_resources = {
       .csiphy_res = csiphy_res_8775p,
       .csid_res = csid_res_8775p,
       .csid_wrapper_res = &csid_wrapper_res_sa8775p,
+    .vfe_res = vfe_res_8775p,
       .icc_res = icc_res_sa8775p,
       .csiphy_num = ARRAY_SIZE(csiphy_res_8775p),
       .csid_num = ARRAY_SIZE(csid_res_8775p),
+    .vfe_num = ARRAY_SIZE(vfe_res_8775p),
       .icc_path_num = ARRAY_SIZE(icc_res_sa8775p),
Quoted 2 lines

      .link_entities = camss_link_entities
  };

There's a pretty superficial difference between 780 and 990

git diff drivers/media/platform/qcom/camss/camss-vfe-690.c drivers/media/platform/qcom/camss/camss-vfe-780.c

linux-media-qcom-camss/master?
3c3
<  * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v690 (SA8755P)
---

Quoted 1 line

  * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v780

(SM8550)
5c5
<  * Copyright (c) 2025 Qualcomm Technologies, Inc.
---

Quoted 1 line

  * Copyright (c) 2024 Qualcomm Technologies, Inc.

15,16c15
< #define VFE_TOP_CORE_CFG        (0x24)
< #define BUS_REG_BASE            (vfe_is_lite(vfe) ? 0x480 : 0x400)
---

Quoted 1 line

#define BUS_REG_BASE            (vfe_is_lite(vfe) ? 0x200 : 0xC00)

19c18
< #define    WM_CGC_OVERRIDE_ALL        (0x7FFFFFF)
---

Quoted 1 line

#define        WM_CGC_OVERRIDE_ALL        (0x7FFFFFF)

21c20
< #define VFE_BUS_WM_TEST_BUS_CTRL    (BUS_REG_BASE + 0xFC)
---

Quoted 1 line

#define VFE_BUS_WM_TEST_BUS_CTRL    (BUS_REG_BASE + 0xDC)

46,47c45,46
<  * VFE:
<  * 16 = RDI0, 17 = RDI1, 18 = RDI2
---

Quoted 2 lines

  * Full VFE:
  * 23 = RDI0, 24 = RDI1, 25 = RDI2

50c49
<  * 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
---

Quoted 1 line

  * 0 = RDI0, 1 = RDI1, 2 = RDI3, 4 = RDI4

52c51
< #define RDI_WM(n)            ((vfe_is_lite(vfe) ? 0x0 : 0x10) + (n))
---

Quoted 1 line

#define RDI_WM(n)            ((vfe_is_lite(vfe) ? 0x0 : 0x17) + (n))

61d59
<     writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE); 62a61,62

Quoted 2 lines

     writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);

65c65
<     writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height,
---

Quoted 2 lines

     writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height

Quoted 1 line

8,

67c67
<     writel(WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF,
---

Quoted 1 line

     writel((WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF),

71,75c71
<
<     writel(0x0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm)); <
<     /* TOP CORE CFG */
<     writel(0x600000, vfe->base + VFE_TOP_CORE_CFG);

What's this for ?

---

Quoted 1 line

     writel(0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));

99c95
<     writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
---

Quoted 1 line

     writel((addr >> 8) & 0xFFFFFFFF, vfe->base +

VFE_BUS_WM_IMAGE_ADDR(wm));
120c116
< static const struct camss_video_ops vfe_video_ops_690 = {
---

Quoted 1 line

static const struct camss_video_ops vfe_video_ops_780 = {

127c123
<     vfe->video_ops = vfe_video_ops_690;
---

Quoted 1 line

     vfe->video_ops = vfe_video_ops_780;

147c143
< const struct vfe_hw_ops vfe_ops_690 = {
---

Quoted 1 line

const struct vfe_hw_ops vfe_ops_780 = {

Quoted 8 lines

I don't really see much logical difference here to justify all of the copy/paste code.

Could you comment on some set of offsets passed in the VFE resources structure ?

If not an offset then perhaps a camss-vfe-gen3.c file which contains the shared code and wrappering that shared code in camss-vfe-690 and vfe-780 respectively ?

Actually, I think that's the way to go, for his level of similarity it should be possible to move the share code 1:1 in many cases to a shared file.

Agree with your suggestion to move common code to *_gen3.c. Next patch in this series will take care of that. Additionally I will add more info regarding the delta for 'vfe 780' vs 'vfe 690'.

Best Regards,
Vikram

Quoted 2 lines

---
bod