* [PATCH RFC 0/3] media: qcom: camss: vfe: Share the gen3 code with VFE 680 and 1080
@ 2026-12-03 10:34 Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 1/3] media: qcom: camss: vfe: gen3: Describe the register layout with a struct Wenmeng Liu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wenmeng Liu @ 2026-12-03 10:34 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, Wenmeng Liu
The gen3 (690 and 780), 680 and 1080 VFE drivers program the RDI write
masters in the same way and mostly differ in their register layout. The
same applies to VFE 970 and 980 from the SM8750 and Eliza series [1].
This series describes the layout with a struct vfe_gen3_cfg referenced
from the VFE resources, and moves VFE 680 and 1080 to the gen3 code,
dropping camss-vfe-680.c and camss-vfe-1080.c. VFE 970 and 980 can then
be added as gen3 layouts as well.
VFE 1080 keeps its split address and register update through
vfe_ops_split_aup. VFE 680 switches from line based to frame based write
masters, like the other gen3 VFEs.
[1] https://lore.kernel.org/all/20261202-add-support-for-camss-on-sm8750-v8-0-a07210023c55@oss.qualcomm.com/
---
Wenmeng Liu (3):
media: qcom: camss: vfe: gen3: Describe the register layout with a struct
media: qcom: camss: vfe: Move VFE 680 to the gen3 code
media: qcom: camss: vfe: Move VFE 1080 to the gen3 code
drivers/media/platform/qcom/camss/Makefile | 2 -
drivers/media/platform/qcom/camss/camss-vfe-1080.c | 213 ------------------
drivers/media/platform/qcom/camss/camss-vfe-680.c | 244 ---------------------
drivers/media/platform/qcom/camss/camss-vfe-gen3.c | 170 ++++++++++----
drivers/media/platform/qcom/camss/camss-vfe.h | 11 +-
drivers/media/platform/qcom/camss/camss.c | 53 ++++-
6 files changed, 178 insertions(+), 515 deletions(-)
---
base-commit: 799dd936553182df5770dde7f38d94c8337df75a
change-id: 20261203-camss-vfe-a4ef8483c117
Best regards,
--
Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH RFC 1/3] media: qcom: camss: vfe: gen3: Describe the register layout with a struct
2026-12-03 10:34 [PATCH RFC 0/3] media: qcom: camss: vfe: Share the gen3 code with VFE 680 and 1080 Wenmeng Liu
@ 2026-12-03 10:34 ` Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 2/3] media: qcom: camss: vfe: Move VFE 680 to the gen3 code Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 3/3] media: qcom: camss: vfe: Move VFE 1080 " Wenmeng Liu
2 siblings, 0 replies; 4+ messages in thread
From: Wenmeng Liu @ 2026-12-03 10:34 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, Wenmeng Liu
VFE 690 and VFE 780 only differ in the bus register layout, the RDI write
master client IDs, the address units and the downscaler configuration.
Describe them with a struct vfe_gen3_cfg referenced from the VFE
resources instead of checking the CAMSS version.
Signed-off-by: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
---
drivers/media/platform/qcom/camss/camss-vfe-gen3.c | 101 +++++++++++++--------
drivers/media/platform/qcom/camss/camss-vfe.h | 6 ++
drivers/media/platform/qcom/camss/camss.c | 17 ++++
3 files changed, 84 insertions(+), 40 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
index 22579617def78457d057e5ba413ae481843a18ad..afbef045ed91b11277895b5a38e0f2576a77b33f 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
@@ -12,26 +12,36 @@
#include "camss.h"
#include "camss-vfe.h"
-#define IS_VFE_690(vfe) \
- ((vfe->camss->res->version == CAMSS_8775P) \
- || (vfe->camss->res->version == CAMSS_8300))
-
-#define BUS_REG_BASE_690 \
- (vfe_is_lite(vfe) ? 0x480 : 0x400)
-#define BUS_REG_BASE_780 \
- (vfe_is_lite(vfe) ? 0x200 : 0xC00)
+/**
+ * struct vfe_gen3_cfg - VFE register layout
+ * @bus_base_full: bus register base on a full VFE
+ * @bus_base_lite: bus register base on a VFE lite
+ * @test_bus_ctrl: offset of the WM test bus control register from the bus base
+ * @wm_base: offset of the first WM register block from the bus base
+ * @rdi_wm_full: WM client ID of RDI0 on a full VFE, it is 0 on a VFE lite
+ * @addr_shift: right shift applied to the image address and frame increment
+ * @disable_ds: disable the DS4 and DS16 downscalers
+ */
+struct vfe_gen3_cfg {
+ u32 bus_base_full;
+ u32 bus_base_lite;
+ u32 test_bus_ctrl;
+ u32 wm_base;
+ u8 rdi_wm_full;
+ u8 addr_shift;
+ bool disable_ds;
+};
+
+#define GEN3_CFG (vfe->res->gen3_cfg)
+
#define BUS_REG_BASE \
- (IS_VFE_690(vfe) ? BUS_REG_BASE_690 : BUS_REG_BASE_780)
+ (vfe_is_lite(vfe) ? GEN3_CFG->bus_base_lite : GEN3_CFG->bus_base_full)
#define VFE_TOP_CORE_CFG (0x24)
#define VFE_DISABLE_DSCALING_DS4 BIT(21)
#define VFE_DISABLE_DSCALING_DS16 BIT(22)
-#define VFE_BUS_WM_TEST_BUS_CTRL_690 (BUS_REG_BASE + 0xFC)
-#define VFE_BUS_WM_TEST_BUS_CTRL_780 (BUS_REG_BASE + 0xDC)
-#define VFE_BUS_WM_TEST_BUS_CTRL \
- (IS_VFE_690(vfe) ? VFE_BUS_WM_TEST_BUS_CTRL_690 \
- : VFE_BUS_WM_TEST_BUS_CTRL_780)
+#define VFE_BUS_WM_TEST_BUS_CTRL (BUS_REG_BASE + GEN3_CFG->test_bus_ctrl)
/*
* Bus client mapping:
*
@@ -43,32 +53,31 @@
* VFE_690 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
* VFE_780 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4
*/
-#define RDI_WM_690(n) ((vfe_is_lite(vfe) ? 0x0 : 0x10) + (n))
-#define RDI_WM_780(n) ((vfe_is_lite(vfe) ? 0x0 : 0x17) + (n))
-#define RDI_WM(n) (IS_VFE_690(vfe) ? RDI_WM_690(n) : RDI_WM_780(n))
+#define RDI_WM(n) ((vfe_is_lite(vfe) ? 0x0 : GEN3_CFG->rdi_wm_full) + (n))
#define VFE_BUS_WM_CGC_OVERRIDE (BUS_REG_BASE + 0x08)
#define WM_CGC_OVERRIDE_ALL (0x7FFFFFF)
-#define VFE_BUS_WM_CFG(n) (BUS_REG_BASE + 0x200 + (n) * 0x100)
+#define VFE_BUS_WM(n) (BUS_REG_BASE + GEN3_CFG->wm_base + (n) * 0x100)
+#define VFE_BUS_WM_CFG(n) VFE_BUS_WM(n)
#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 VFE_BUS_WM_IMAGE_ADDR(n) (VFE_BUS_WM(n) + 0x04)
+#define VFE_BUS_WM_FRAME_INCR(n) (VFE_BUS_WM(n) + 0x08)
+#define VFE_BUS_WM_IMAGE_CFG_0(n) (VFE_BUS_WM(n) + 0x0c)
#define WM_IMAGE_CFG_0_DEFAULT_WIDTH (0xFFFF)
-#define VFE_BUS_WM_IMAGE_CFG_2(n) (BUS_REG_BASE + 0x214 + (n) * 0x100)
+#define VFE_BUS_WM_IMAGE_CFG_2(n) (VFE_BUS_WM(n) + 0x14)
#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_PACKER_CFG(n) (VFE_BUS_WM(n) + 0x18)
-#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_IRQ_SUBSAMPLE_PERIOD(n) (VFE_BUS_WM(n) + 0x30)
+#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n) (VFE_BUS_WM(n) + 0x34)
+#define VFE_BUS_WM_FRAMEDROP_PERIOD(n) (VFE_BUS_WM(n) + 0x38)
+#define VFE_BUS_WM_FRAMEDROP_PATTERN(n) (VFE_BUS_WM(n) + 0x3c)
-#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)
+#define VFE_BUS_WM_MMU_PREFETCH_CFG(n) (VFE_BUS_WM(n) + 0x60)
+#define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n) (VFE_BUS_WM(n) + 0x64)
static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
{
@@ -82,12 +91,8 @@ static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
writel(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL);
- if (IS_VFE_690(vfe))
- writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height,
- vfe->base + VFE_BUS_WM_FRAME_INCR(wm));
- else
- writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height >> 8,
- vfe->base + VFE_BUS_WM_FRAME_INCR(wm));
+ writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height >>
+ GEN3_CFG->addr_shift, 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));
@@ -96,7 +101,7 @@ static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
writel(0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));
/* TOP CORE CFG */
- if (IS_VFE_690(vfe))
+ if (GEN3_CFG->disable_ds)
writel(VFE_DISABLE_DSCALING_DS4 | VFE_DISABLE_DSCALING_DS16,
vfe->base + VFE_TOP_CORE_CFG);
@@ -123,10 +128,7 @@ static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr,
{
wm = RDI_WM(wm);
- if (IS_VFE_690(vfe))
- writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
- else
- writel((addr >> 8), vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
+ writel(addr >> GEN3_CFG->addr_shift, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
dev_dbg(vfe->camss->dev, "wm:%d, image buf addr:0x%x\n",
wm, addr);
@@ -174,6 +176,25 @@ static int vfe_halt(struct vfe_device *vfe)
return 0;
}
+const struct vfe_gen3_cfg vfe_gen3_cfg_690 = {
+ .bus_base_full = 0x400,
+ .bus_base_lite = 0x480,
+ .test_bus_ctrl = 0xFC,
+ .wm_base = 0x200,
+ .rdi_wm_full = 0x10,
+ .addr_shift = 0,
+ .disable_ds = true,
+};
+
+const struct vfe_gen3_cfg vfe_gen3_cfg_780 = {
+ .bus_base_full = 0xC00,
+ .bus_base_lite = 0x200,
+ .test_bus_ctrl = 0xDC,
+ .wm_base = 0x200,
+ .rdi_wm_full = 0x17,
+ .addr_shift = 8,
+};
+
const struct vfe_hw_ops vfe_ops_gen3 = {
.global_reset = vfe_global_reset,
.hw_version = vfe_hw_version,
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h
index c37526caf9a6fc052c3f4ab4215e635167f6da95..159a7c4f5ceb3b57f26a0e03e515776a158a7b7c 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.h
+++ b/drivers/media/platform/qcom/camss/camss-vfe.h
@@ -98,6 +98,7 @@ struct vfe_line {
};
struct vfe_device;
+struct vfe_gen3_cfg;
struct vfe_hw_ops {
void (*addr_update)(struct vfe_device *vfe, enum vfe_line_id line_id);
@@ -143,6 +144,8 @@ struct vfe_subdev_resources {
bool has_vbif;
char *vbif_name;
const struct vfe_hw_ops *hw_ops;
+ /* VFE gen3 and later register layout */
+ const struct vfe_gen3_cfg *gen3_cfg;
const struct camss_formats *formats_rdi;
const struct camss_formats *formats_pix;
};
@@ -255,6 +258,9 @@ extern const struct vfe_hw_ops vfe_ops_680;
extern const struct vfe_hw_ops vfe_ops_1080;
extern const struct vfe_hw_ops vfe_ops_gen3;
+extern const struct vfe_gen3_cfg vfe_gen3_cfg_690;
+extern const struct vfe_gen3_cfg vfe_gen3_cfg_780;
+
int vfe_get(struct vfe_device *vfe);
void vfe_put(struct vfe_device *vfe);
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 3a5b7c665d3a913e06489e985348b38af97c2f39..7df72ed72959fcf08041d9ff990a98e334d2440d 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -3560,6 +3560,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = {
.has_pd = true,
.pd_name = "ife0",
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -3584,6 +3585,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = {
.has_pd = true,
.pd_name = "ife1",
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -3608,6 +3610,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = {
.has_pd = true,
.pd_name = "ife2",
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -3629,6 +3632,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -3650,6 +3654,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -3936,6 +3941,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = {
.has_pd = true,
.pd_name = "ife0",
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -3963,6 +3969,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = {
.has_pd = true,
.pd_name = "ife1",
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -3990,6 +3997,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = {
.has_pd = true,
.pd_name = "ife2",
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -4015,6 +4023,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -4040,6 +4049,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_780,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -4352,6 +4362,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = {
.has_pd = false,
.pd_name = NULL,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_690,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -4380,6 +4391,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = {
.has_pd = false,
.pd_name = NULL,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_690,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -4406,6 +4418,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_690,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -4432,6 +4445,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_690,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -4458,6 +4472,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_690,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -4484,6 +4499,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_690,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -4510,6 +4526,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = {
.line_num = 4,
.is_lite = true,
.hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_690,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH RFC 2/3] media: qcom: camss: vfe: Move VFE 680 to the gen3 code
2026-12-03 10:34 [PATCH RFC 0/3] media: qcom: camss: vfe: Share the gen3 code with VFE 680 and 1080 Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 1/3] media: qcom: camss: vfe: gen3: Describe the register layout with a struct Wenmeng Liu
@ 2026-12-03 10:34 ` Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 3/3] media: qcom: camss: vfe: Move VFE 1080 " Wenmeng Liu
2 siblings, 0 replies; 4+ messages in thread
From: Wenmeng Liu @ 2026-12-03 10:34 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, Wenmeng Liu
VFE 680 has the same bus write registers as VFE 780. It programs its
write masters in line based mode with the image size and stride, and
masks the TOP and BUS interrupts which are already masked at reset.
Describe it with a struct vfe_gen3_cfg and program it like the other
gen3 VFEs, in frame based mode where the image size and stride are
ignored, with clock gating disabled at the bus input. The frame
increment is unchanged as the RDI line stride is already aligned to
16 bytes.
Signed-off-by: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
---
drivers/media/platform/qcom/camss/Makefile | 1 -
drivers/media/platform/qcom/camss/camss-vfe-680.c | 244 ---------------------
drivers/media/platform/qcom/camss/camss-vfe-gen3.c | 11 +
drivers/media/platform/qcom/camss/camss-vfe.h | 2 +-
drivers/media/platform/qcom/camss/camss.c | 21 +-
5 files changed, 26 insertions(+), 253 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/Makefile b/drivers/media/platform/qcom/camss/Makefile
index 42a14e8fe1b7f28ba5ffcbe59769093b08db4d6b..dcc338136e9c0778fb8d75593e9f5b1d11e121fd 100644
--- a/drivers/media/platform/qcom/camss/Makefile
+++ b/drivers/media/platform/qcom/camss/Makefile
@@ -25,7 +25,6 @@ qcom-camss-objs += \
camss-vfe-17x.o \
camss-vfe-340.o \
camss-vfe-480.o \
- camss-vfe-680.o \
camss-vfe-1080.o \
camss-vfe-gen1.o \
camss-vfe-gen3.o \
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-680.c b/drivers/media/platform/qcom/camss/camss-vfe-680.c
deleted file mode 100644
index 99036e7c1e763a07c077e4ce024f3da2575a95e2..0000000000000000000000000000000000000000
--- a/drivers/media/platform/qcom/camss/camss-vfe-680.c
+++ /dev/null
@@ -1,244 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * camss-vfe-680.c
- *
- * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v680
- *
- * Copyright (C) 2025 Linaro Ltd.
- */
-
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/iopoll.h>
-
-#include "camss.h"
-#include "camss-vfe.h"
-
-#define VFE_TOP_IRQn_STATUS(vfe, n) ((vfe_is_lite(vfe) ? 0x1c : 0x44) + (n) * 4)
-#define VFE_TOP_IRQn_MASK(vfe, n) ((vfe_is_lite(vfe) ? 0x24 : 0x34) + (n) * 4)
-#define VFE_TOP_IRQn_CLEAR(vfe, n) ((vfe_is_lite(vfe) ? 0x2c : 0x3c) + (n) * 4)
-#define VFE_IRQ1_SOF(vfe, n) ((vfe_is_lite(vfe) ? BIT(2) : BIT(8)) << ((n) * 2))
-#define VFE_IRQ1_EOF(vfe, n) ((vfe_is_lite(vfe) ? BIT(3) : BIT(9)) << ((n) * 2))
-#define VFE_TOP_IRQ_CMD(vfe) (vfe_is_lite(vfe) ? 0x38 : 0x30)
-#define VFE_TOP_IRQ_CMD_GLOBAL_CLEAR BIT(0)
-#define VFE_TOP_DIAG_CONFIG (vfe_is_lite(vfe) ? 0x40 : 0x50)
-
-#define VFE_TOP_DEBUG_11(vfe) (vfe_is_lite(vfe) ? 0x40 : 0xcc)
-#define VFE_TOP_DEBUG_12(vfe) (vfe_is_lite(vfe) ? 0x40 : 0xd0)
-#define VFE_TOP_DEBUG_13(vfe) (vfe_is_lite(vfe) ? 0x40 : 0xd4)
-
-#define VFE_BUS_IRQn_MASK(vfe, n) ((vfe_is_lite(vfe) ? 0x218 : 0xc18) + (n) * 4)
-#define VFE_BUS_IRQn_CLEAR(vfe, n) ((vfe_is_lite(vfe) ? 0x220 : 0xc20) + (n) * 4)
-#define VFE_BUS_IRQn_STATUS(vfe, n) ((vfe_is_lite(vfe) ? 0x228 : 0xc28) + (n) * 4)
-#define VFE_BUS_IRQ_GLOBAL_CLEAR(vfe) (vfe_is_lite(vfe) ? 0x230 : 0xc30)
-#define VFE_BUS_WR_VIOLATION_STATUS(vfe) (vfe_is_lite(vfe) ? 0x264 : 0xc64)
-#define VFE_BUS_WR_OVERFLOW_STATUS(vfe) (vfe_is_lite(vfe) ? 0x268 : 0xc68)
-#define VFE_BUS_WR_IMAGE_VIOLATION_STATUS(vfe) (vfe_is_lite(vfe) ? 0x270 : 0xc70)
-
-#define VFE_BUS_WRITE_CLIENT_CFG(vfe, c) ((vfe_is_lite(vfe) ? 0x400 : 0xe00) + (c) * 0x100)
-#define VFE_BUS_WRITE_CLIENT_CFG_EN BIT(0)
-#define VFE_BUS_IMAGE_ADDR(vfe, c) ((vfe_is_lite(vfe) ? 0x404 : 0xe04) + (c) * 0x100)
-#define VFE_BUS_FRAME_INCR(vfe, c) ((vfe_is_lite(vfe) ? 0x408 : 0xe08) + (c) * 0x100)
-#define VFE_BUS_IMAGE_CFG0(vfe, c) ((vfe_is_lite(vfe) ? 0x40c : 0xe0c) + (c) * 0x100)
-#define VFE_BUS_IMAGE_CFG0_DATA(h, s) (((h) << 16) | ((s) >> 4))
-#define WM_IMAGE_CFG_0_DEFAULT_WIDTH (0xFFFF)
-
-#define VFE_BUS_IMAGE_CFG1(vfe, c) ((vfe_is_lite(vfe) ? 0x410 : 0xe10) + (c) * 0x100)
-#define VFE_BUS_IMAGE_CFG2(vfe, c) ((vfe_is_lite(vfe) ? 0x414 : 0xe14) + (c) * 0x100)
-#define VFE_BUS_PACKER_CFG(vfe, c) ((vfe_is_lite(vfe) ? 0x418 : 0xe18) + (c) * 0x100)
-#define VFE_BUS_IRQ_SUBSAMPLE_PERIOD(vfe, c) ((vfe_is_lite(vfe) ? 0x430 : 0xe30) + (c) * 0x100)
-#define VFE_BUS_IRQ_SUBSAMPLE_PATTERN(vfe, c) ((vfe_is_lite(vfe) ? 0x434 : 0xe34) + (c) * 0x100)
-#define VFE_BUS_FRAMEDROP_PERIOD(vfe, c) ((vfe_is_lite(vfe) ? 0x438 : 0xe38) + (c) * 0x100)
-#define VFE_BUS_FRAMEDROP_PATTERN(vfe, c) ((vfe_is_lite(vfe) ? 0x43c : 0xe3c) + (c) * 0x100)
-#define VFE_BUS_MMU_PREFETCH_CFG(vfe, c) ((vfe_is_lite(vfe) ? 0x460 : 0xe60) + (c) * 0x100)
-#define VFE_BUS_MMU_PREFETCH_CFG_EN BIT(0)
-#define VFE_BUS_MMU_PREFETCH_MAX_OFFSET(vfe, c) ((vfe_is_lite(vfe) ? 0x464 : 0xe64) + (c) * 0x100)
-#define VFE_BUS_ADDR_STATUS0(vfe, c) ((vfe_is_lite(vfe) ? 0x470 : 0xe70) + (c) * 0x100)
-
-/*
- * TODO: differentiate the port id based on requested type of RDI, BHIST etc
- *
- * IFE write master IDs
- *
- * VIDEO_FULL_Y 0
- * VIDEO_FULL_C 1
- * VIDEO_DS_4:1 2
- * VIDEO_DS_16:1 3
- * DISPLAY_FULL_Y 4
- * DISPLAY_FULL_C 5
- * DISPLAY_DS_4:1 6
- * DISPLAY_DS_16:1 7
- * FD_Y 8
- * FD_C 9
- * PIXEL_RAW 10
- * STATS_BE0 11
- * STATS_BHIST0 12
- * STATS_TINTLESS_BG 13
- * STATS_AWB_BG 14
- * STATS_AWB_BFW 15
- * STATS_BAF 16
- * STATS_BHIST 17
- * STATS_RS 18
- * STATS_IHIST 19
- * SPARSE_PD 20
- * PDAF_V2.0_PD_DATA 21
- * PDAF_V2.0_SAD 22
- * LCR 23
- * RDI0 24
- * RDI1 25
- * RDI2 26
- * LTM_STATS 27
- *
- * IFE Lite write master IDs
- *
- * RDI0 0
- * RDI1 1
- * RDI2 2
- * RDI3 3
- * GAMMA 4
- * BE 5
- */
-
-/* TODO: assign an ENUM in resources and use the provided master
- * id directly for RDI, STATS, AWB_BG, BHIST.
- * This macro only works because RDI is all we support right now.
- */
-#define RDI_WM(n) ((vfe_is_lite(vfe) ? 0 : 24) + (n))
-
-static void vfe_global_reset(struct vfe_device *vfe)
-{
- /* VFE680 has no global reset, simply report a completion */
- complete(&vfe->reset_complete);
-}
-
-/*
- * vfe_isr - VFE module interrupt handler
- * @irq: Interrupt line
- * @dev: VFE device
- *
- * Return IRQ_HANDLED on success
- */
-static irqreturn_t vfe_isr(int irq, void *dev)
-{
- return IRQ_HANDLED;
-}
-
-/*
- * vfe_halt - Trigger halt on VFE module and wait to complete
- * @vfe: VFE device
- *
- * Return 0 on success or a negative error code otherwise
- */
-static int vfe_halt(struct vfe_device *vfe)
-{
- /* rely on vfe_disable_output() to stop the VFE */
- return 0;
-}
-
-static void vfe_disable_irq(struct vfe_device *vfe)
-{
- writel(0u, vfe->base + VFE_TOP_IRQn_MASK(vfe, 0));
- writel(0u, vfe->base + VFE_TOP_IRQn_MASK(vfe, 1));
- writel(0u, vfe->base + VFE_BUS_IRQn_MASK(vfe, 0));
- writel(0u, vfe->base + VFE_BUS_IRQn_MASK(vfe, 1));
-}
-
-static void vfe_wm_update(struct vfe_device *vfe, u8 rdi, u32 addr,
- struct vfe_line *line)
-{
- u8 wm = RDI_WM(rdi);
-
- writel(addr, vfe->base + VFE_BUS_IMAGE_ADDR(vfe, wm));
-}
-
-static void vfe_wm_start(struct vfe_device *vfe, u8 rdi, struct vfe_line *line)
-{
- struct v4l2_pix_format_mplane *pix =
- &line->video_out.active_fmt.fmt.pix_mp;
- u32 stride = pix->plane_fmt[0].bytesperline;
- u32 cfg;
- u8 wm;
-
- cfg = VFE_BUS_IMAGE_CFG0_DATA(pix->height, stride);
- wm = RDI_WM(rdi);
-
- writel(cfg, vfe->base + VFE_BUS_IMAGE_CFG0(vfe, wm));
- writel(0, vfe->base + VFE_BUS_IMAGE_CFG1(vfe, wm));
- writel(stride, vfe->base + VFE_BUS_IMAGE_CFG2(vfe, wm));
- writel(0, vfe->base + VFE_BUS_PACKER_CFG(vfe, wm));
-
- /* Set total frame increment value */
- writel(pix->plane_fmt[0].bytesperline * pix->height,
- vfe->base + VFE_BUS_FRAME_INCR(vfe, wm));
-
- /* MMU */
- writel(VFE_BUS_MMU_PREFETCH_CFG_EN, vfe->base + VFE_BUS_MMU_PREFETCH_CFG(vfe, wm));
- writel(~0u, vfe->base + VFE_BUS_MMU_PREFETCH_MAX_OFFSET(vfe, wm));
-
- /* no dropped frames, one irq per frame */
- writel(1, vfe->base + VFE_BUS_FRAMEDROP_PATTERN(vfe, wm));
- writel(0, vfe->base + VFE_BUS_FRAMEDROP_PERIOD(vfe, wm));
- writel(1, vfe->base + VFE_BUS_IRQ_SUBSAMPLE_PATTERN(vfe, wm));
- writel(0, vfe->base + VFE_BUS_IRQ_SUBSAMPLE_PERIOD(vfe, wm));
-
- /* We don't process IRQs for VFE in RDI mode at the moment */
- vfe_disable_irq(vfe);
-
- /* Enable WM */
- writel(VFE_BUS_WRITE_CLIENT_CFG_EN,
- vfe->base + VFE_BUS_WRITE_CLIENT_CFG(vfe, wm));
-
- dev_dbg(vfe->camss->dev, "RDI%d WM:%d width %d height %d stride %d\n",
- rdi, wm, pix->width, pix->height, stride);
-}
-
-static void vfe_wm_stop(struct vfe_device *vfe, u8 rdi)
-{
- u8 wm = RDI_WM(rdi);
-
- writel(0, vfe->base + VFE_BUS_WRITE_CLIENT_CFG(vfe, wm));
-}
-
-static const struct camss_video_ops vfe_video_ops_680 = {
- .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_680;
-}
-
-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);
-}
-
-const struct vfe_hw_ops vfe_ops_680 = {
- .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,
- .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,
- .reg_update = vfe_reg_update,
- .reg_update_clear = vfe_reg_update_clear,
-};
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
index afbef045ed91b11277895b5a38e0f2576a77b33f..58304d8d4d50ece62e4bc774522adb9253021787 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
@@ -46,10 +46,12 @@ struct vfe_gen3_cfg {
* Bus client mapping:
*
* Full VFE:
+ * VFE_680: 24 = RDI0, 25 = RDI1, 26 = RDI2
* VFE_690: 16 = RDI0, 17 = RDI1, 18 = RDI2
* VFE_780: 23 = RDI0, 24 = RDI1, 25 = RDI2
*
* VFE LITE:
+ * VFE_680 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3
* VFE_690 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
* VFE_780 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4
*/
@@ -176,6 +178,15 @@ static int vfe_halt(struct vfe_device *vfe)
return 0;
}
+const struct vfe_gen3_cfg vfe_gen3_cfg_680 = {
+ .bus_base_full = 0xC00,
+ .bus_base_lite = 0x200,
+ .test_bus_ctrl = 0xDC,
+ .wm_base = 0x200,
+ .rdi_wm_full = 24,
+ .addr_shift = 0,
+};
+
const struct vfe_gen3_cfg vfe_gen3_cfg_690 = {
.bus_base_full = 0x400,
.bus_base_lite = 0x480,
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h
index 159a7c4f5ceb3b57f26a0e03e515776a158a7b7c..6da997615212f693bde9f5ea8029e823472b05cf 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.h
+++ b/drivers/media/platform/qcom/camss/camss-vfe.h
@@ -254,10 +254,10 @@ 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_340;
extern const struct vfe_hw_ops vfe_ops_480;
-extern const struct vfe_hw_ops vfe_ops_680;
extern const struct vfe_hw_ops vfe_ops_1080;
extern const struct vfe_hw_ops vfe_ops_gen3;
+extern const struct vfe_gen3_cfg vfe_gen3_cfg_680;
extern const struct vfe_gen3_cfg vfe_gen3_cfg_690;
extern const struct vfe_gen3_cfg vfe_gen3_cfg_780;
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 7df72ed72959fcf08041d9ff990a98e334d2440d..c3318d82172f0fb0c1e89e8bce85359f2c32359d 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -4779,7 +4779,8 @@ static const struct camss_subdev_resources vfe_res_x1e80100[] = {
.vfe = {
.line_num = 4,
.pd_name = "ife0",
- .hw_ops = &vfe_ops_680,
+ .hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_680,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -4803,7 +4804,8 @@ static const struct camss_subdev_resources vfe_res_x1e80100[] = {
.vfe = {
.line_num = 4,
.pd_name = "ife1",
- .hw_ops = &vfe_ops_680,
+ .hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_680,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -4826,7 +4828,8 @@ static const struct camss_subdev_resources vfe_res_x1e80100[] = {
.vfe = {
.is_lite = true,
.line_num = 4,
- .hw_ops = &vfe_ops_680,
+ .hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_680,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -4849,7 +4852,8 @@ static const struct camss_subdev_resources vfe_res_x1e80100[] = {
.vfe = {
.is_lite = true,
.line_num = 4,
- .hw_ops = &vfe_ops_680,
+ .hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_680,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -4973,7 +4977,8 @@ static const struct camss_subdev_resources vfe_res_x1p42100[] = {
.vfe = {
.line_num = 3,
.pd_name = "ife0",
- .hw_ops = &vfe_ops_680,
+ .hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_680,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -4994,7 +4999,8 @@ static const struct camss_subdev_resources vfe_res_x1p42100[] = {
.vfe = {
.is_lite = true,
.line_num = 4,
- .hw_ops = &vfe_ops_680,
+ .hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_680,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
@@ -5015,7 +5021,8 @@ static const struct camss_subdev_resources vfe_res_x1p42100[] = {
.vfe = {
.is_lite = true,
.line_num = 4,
- .hw_ops = &vfe_ops_680,
+ .hw_ops = &vfe_ops_gen3,
+ .gen3_cfg = &vfe_gen3_cfg_680,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
},
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH RFC 3/3] media: qcom: camss: vfe: Move VFE 1080 to the gen3 code
2026-12-03 10:34 [PATCH RFC 0/3] media: qcom: camss: vfe: Share the gen3 code with VFE 680 and 1080 Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 1/3] media: qcom: camss: vfe: gen3: Describe the register layout with a struct Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 2/3] media: qcom: camss: vfe: Move VFE 680 to the gen3 code Wenmeng Liu
@ 2026-12-03 10:34 ` Wenmeng Liu
2 siblings, 0 replies; 4+ messages in thread
From: Wenmeng Liu @ 2026-12-03 10:34 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Loic Poulain,
Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, Wenmeng Liu
VFE 1080 is programmed like VFE 780 apart from its register layout and
the split address and register update commands. Add the gen3 ops with
the address update operations as vfe_ops_split_aup and use them with a
struct vfe_gen3_cfg describing VFE 1080.
Unlike the other gen3 VFEs, VFE 1080 does not program the frame drop
registers of its VFE lite write masters, describe that in the layout.
Signed-off-by: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
---
drivers/media/platform/qcom/camss/Makefile | 1 -
drivers/media/platform/qcom/camss/camss-vfe-1080.c | 213 ---------------------
drivers/media/platform/qcom/camss/camss-vfe-gen3.c | 58 +++++-
drivers/media/platform/qcom/camss/camss-vfe.h | 3 +-
drivers/media/platform/qcom/camss/camss.c | 15 +-
5 files changed, 68 insertions(+), 222 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/Makefile b/drivers/media/platform/qcom/camss/Makefile
index dcc338136e9c0778fb8d75593e9f5b1d11e121fd..66b6fa048418b0aac14ffc2110fb5622b243fc15 100644
--- a/drivers/media/platform/qcom/camss/Makefile
+++ b/drivers/media/platform/qcom/camss/Makefile
@@ -25,7 +25,6 @@ qcom-camss-objs += \
camss-vfe-17x.o \
camss-vfe-340.o \
camss-vfe-480.o \
- camss-vfe-1080.o \
camss-vfe-gen1.o \
camss-vfe-gen3.o \
camss-vfe-vbif.o \
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-1080.c b/drivers/media/platform/qcom/camss/camss-vfe-1080.c
deleted file mode 100644
index 68798f13fbea892d1e37f396a57c7b7f5f8d22a2..0000000000000000000000000000000000000000
--- a/drivers/media/platform/qcom/camss/camss-vfe-1080.c
+++ /dev/null
@@ -1,213 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * camss-vfe-1080.c
- *
- * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module 1080
- *
- * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
- */
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/iopoll.h>
-
-#include "camss.h"
-#include "camss-vfe.h"
-
-/* VFE-1080 Bus Register Base Addresses */
-#define BUS_REG_BASE (vfe_is_lite(vfe) ? 0x800 : 0x1000)
-
-#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 + 0x128)
-
-#define VFE_BUS_WM_CFG(n) (BUS_REG_BASE + 0x500 + (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 + 0x504 + (n) * 0x100)
-#define VFE_BUS_WM_FRAME_INCR(n) (BUS_REG_BASE + 0x508 + (n) * 0x100)
-#define VFE_BUS_WM_IMAGE_CFG_0(n) (BUS_REG_BASE + 0x50C + (n) * 0x100)
-#define WM_IMAGE_CFG_0_DEFAULT_WIDTH (0xFFFF)
-#define VFE_BUS_WM_IMAGE_CFG_2(n) (BUS_REG_BASE + 0x514 + (n) * 0x100)
-#define WM_IMAGE_CFG_2_DEFAULT_STRIDE (0xFFFF)
-#define VFE_BUS_WM_PACKER_CFG(n) (BUS_REG_BASE + 0x518 + (n) * 0x100)
-
-#define VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(n) (BUS_REG_BASE + 0x530 + (n) * 0x100)
-#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n) (BUS_REG_BASE + 0x534 + (n) * 0x100)
-
-/* VFE lite has no such registers */
-#define VFE_BUS_WM_FRAMEDROP_PERIOD(n) (BUS_REG_BASE + 0x538 + (n) * 0x100)
-#define VFE_BUS_WM_FRAMEDROP_PATTERN(n) (BUS_REG_BASE + 0x53C + (n) * 0x100)
-
-#define VFE_BUS_WM_MMU_PREFETCH_CFG(n) (BUS_REG_BASE + 0x560 + (n) * 0x100)
-#define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n) (BUS_REG_BASE + 0x564 + (n) * 0x100)
-
-/*
- * IFE write master client IDs
- *
- * VIDEO_FULL 0
- * VIDEO_DC4_Y 1
- * VIDEO_DC4_C 2
- * VIDEO_DC16_Y 3
- * VIDEO_DC16_C 4
- * DISPLAY_DS2_Y 5
- * DISPLAY_DS2_C 6
- * FD_Y 7
- * FD_C 8
- * PIXEL_RAW 9
- * STATS_AEC_BG 10
- * STATS_AEC_BHIST 11
- * STATS_TINTLESS_BG 12
- * STATS_AWB_BG 13
- * STATS_AWB_BFW 14
- * STATS_AF_BHIST 15
- * STATS_ALSC_BG 16
- * STATS_FLICKER_BAYERRS 17
- * STATS_TMC_BHIST 18
- * PDAF_0 19
- * PDAF_1 20
- * PDAF_2 21
- * PDAF_3 22
- * RDI0 23
- * RDI1 24
- * RDI2 25
- * RDI3 26
- * RDI4 27
- *
- * IFE Lite write master client IDs
- *
- * RDI0 0
- * RDI1 1
- * RDI2 2
- * RDI3 3
- * GAMMA 4
- * STATES_BE 5
- */
-#define RDI_WM(n) ((vfe_is_lite(vfe) ? 0x0 : 0x17) + (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);
-
- /* no clock gating at bus input */
- writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);
-
- writel(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL);
-
- writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height >> 8,
- 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(0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm));
-
- /* no dropped frames, one irq per frame */
- if (!vfe_is_lite(vfe)) {
- 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 >> 8, 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 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 void vfe_addr_update(struct vfe_device *vfe, enum vfe_line_id line_id)
-{
- int port_id = line_id;
-
- camss_addr_update(vfe->camss, vfe->id, port_id, false);
-}
-
-static void vfe_addr_update_clear(struct vfe_device *vfe, enum vfe_line_id line_id)
-{
- int port_id = line_id;
-
- camss_addr_update(vfe->camss, vfe->id, port_id, true);
-}
-
-static const struct camss_video_ops vfe_video_ops_1080 = {
- .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_1080;
-}
-
-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_1080 = {
- .addr_update = vfe_addr_update,
- .addr_update_clear = vfe_addr_update_clear,
- .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,
-};
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
index 58304d8d4d50ece62e4bc774522adb9253021787..a4827f95d764276b8bf31f437107deb1f57610d4 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
@@ -21,6 +21,7 @@
* @rdi_wm_full: WM client ID of RDI0 on a full VFE, it is 0 on a VFE lite
* @addr_shift: right shift applied to the image address and frame increment
* @disable_ds: disable the DS4 and DS16 downscalers
+ * @lite_has_framedrop: the VFE lite write masters have frame drop registers
*/
struct vfe_gen3_cfg {
u32 bus_base_full;
@@ -30,6 +31,7 @@ struct vfe_gen3_cfg {
u8 rdi_wm_full;
u8 addr_shift;
bool disable_ds;
+ bool lite_has_framedrop;
};
#define GEN3_CFG (vfe->res->gen3_cfg)
@@ -49,11 +51,13 @@ struct vfe_gen3_cfg {
* VFE_680: 24 = RDI0, 25 = RDI1, 26 = RDI2
* VFE_690: 16 = RDI0, 17 = RDI1, 18 = RDI2
* VFE_780: 23 = RDI0, 24 = RDI1, 25 = RDI2
+ * VFE_1080: 23 = RDI0, 24 = RDI1, 25 = RDI2, 26 = RDI3, 27 = RDI4
*
* VFE LITE:
* VFE_680 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3
* VFE_690 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5
* VFE_780 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4
+ * VFE_1080: 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3
*/
#define RDI_WM(n) ((vfe_is_lite(vfe) ? 0x0 : GEN3_CFG->rdi_wm_full) + (n))
@@ -108,8 +112,10 @@ static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
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));
+ if (!vfe_is_lite(vfe) || GEN3_CFG->lite_has_framedrop) {
+ 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));
@@ -151,6 +157,21 @@ static inline void vfe_reg_update_clear(struct vfe_device *vfe,
camss_reg_update(vfe->camss, vfe->id, port_id, true);
}
+static void vfe_addr_update(struct vfe_device *vfe, enum vfe_line_id line_id)
+{
+ int port_id = line_id;
+
+ camss_addr_update(vfe->camss, vfe->id, port_id, false);
+}
+
+static void vfe_addr_update_clear(struct vfe_device *vfe,
+ enum vfe_line_id line_id)
+{
+ int port_id = line_id;
+
+ camss_addr_update(vfe->camss, vfe->id, port_id, true);
+}
+
static const struct camss_video_ops vfe_video_ops_gen3 = {
.queue_buffer = vfe_queue_buffer_v2,
.flush_buffers = vfe_flush_buffers,
@@ -185,6 +206,7 @@ const struct vfe_gen3_cfg vfe_gen3_cfg_680 = {
.wm_base = 0x200,
.rdi_wm_full = 24,
.addr_shift = 0,
+ .lite_has_framedrop = true,
};
const struct vfe_gen3_cfg vfe_gen3_cfg_690 = {
@@ -195,6 +217,7 @@ const struct vfe_gen3_cfg vfe_gen3_cfg_690 = {
.rdi_wm_full = 0x10,
.addr_shift = 0,
.disable_ds = true,
+ .lite_has_framedrop = true,
};
const struct vfe_gen3_cfg vfe_gen3_cfg_780 = {
@@ -204,6 +227,16 @@ const struct vfe_gen3_cfg vfe_gen3_cfg_780 = {
.wm_base = 0x200,
.rdi_wm_full = 0x17,
.addr_shift = 8,
+ .lite_has_framedrop = true,
+};
+
+const struct vfe_gen3_cfg vfe_gen3_cfg_1080 = {
+ .bus_base_full = 0x1000,
+ .bus_base_lite = 0x800,
+ .test_bus_ctrl = 0x128,
+ .wm_base = 0x500,
+ .rdi_wm_full = 0x17,
+ .addr_shift = 8,
};
const struct vfe_hw_ops vfe_ops_gen3 = {
@@ -223,3 +256,24 @@ const struct vfe_hw_ops vfe_ops_gen3 = {
.vfe_buf_done = vfe_buf_done,
.vfe_wm_update = vfe_wm_update,
};
+
+/* VFEs splitting the address and register update commands */
+const struct vfe_hw_ops vfe_ops_split_aup = {
+ .addr_update = vfe_addr_update,
+ .addr_update_clear = vfe_addr_update_clear,
+ .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,
+};
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h
index 6da997615212f693bde9f5ea8029e823472b05cf..4e937a202296c48fd0d7686141d80c5b33227959 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.h
+++ b/drivers/media/platform/qcom/camss/camss-vfe.h
@@ -254,12 +254,13 @@ 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_340;
extern const struct vfe_hw_ops vfe_ops_480;
-extern const struct vfe_hw_ops vfe_ops_1080;
extern const struct vfe_hw_ops vfe_ops_gen3;
+extern const struct vfe_hw_ops vfe_ops_split_aup;
extern const struct vfe_gen3_cfg vfe_gen3_cfg_680;
extern const struct vfe_gen3_cfg vfe_gen3_cfg_690;
extern const struct vfe_gen3_cfg vfe_gen3_cfg_780;
+extern const struct vfe_gen3_cfg vfe_gen3_cfg_1080;
int vfe_get(struct vfe_device *vfe);
void vfe_put(struct vfe_device *vfe);
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index c3318d82172f0fb0c1e89e8bce85359f2c32359d..05fa7714f5be95025edf04e37d404ee3027852b2 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -144,7 +144,8 @@ static const struct camss_subdev_resources vfe_res_kaanapali[] = {
.line_num = 3,
.has_pd = true,
.pd_name = "ife0",
- .hw_ops = &vfe_ops_1080,
+ .hw_ops = &vfe_ops_split_aup,
+ .gen3_cfg = &vfe_gen3_cfg_1080,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -169,7 +170,8 @@ static const struct camss_subdev_resources vfe_res_kaanapali[] = {
.line_num = 3,
.has_pd = true,
.pd_name = "ife1",
- .hw_ops = &vfe_ops_1080,
+ .hw_ops = &vfe_ops_split_aup,
+ .gen3_cfg = &vfe_gen3_cfg_1080,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -194,7 +196,8 @@ static const struct camss_subdev_resources vfe_res_kaanapali[] = {
.line_num = 3,
.has_pd = true,
.pd_name = "ife2",
- .hw_ops = &vfe_ops_1080,
+ .hw_ops = &vfe_ops_split_aup,
+ .gen3_cfg = &vfe_gen3_cfg_1080,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -214,7 +217,8 @@ static const struct camss_subdev_resources vfe_res_kaanapali[] = {
.vfe = {
.line_num = 3,
.is_lite = true,
- .hw_ops = &vfe_ops_1080,
+ .hw_ops = &vfe_ops_split_aup,
+ .gen3_cfg = &vfe_gen3_cfg_1080,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
@@ -234,7 +238,8 @@ static const struct camss_subdev_resources vfe_res_kaanapali[] = {
.vfe = {
.line_num = 3,
.is_lite = true,
- .hw_ops = &vfe_ops_1080,
+ .hw_ops = &vfe_ops_split_aup,
+ .gen3_cfg = &vfe_gen3_cfg_1080,
.formats_rdi = &vfe_formats_rdi_845,
.formats_pix = &vfe_formats_pix_845
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-03 10:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 10:34 [PATCH RFC 0/3] media: qcom: camss: vfe: Share the gen3 code with VFE 680 and 1080 Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 1/3] media: qcom: camss: vfe: gen3: Describe the register layout with a struct Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 2/3] media: qcom: camss: vfe: Move VFE 680 to the gen3 code Wenmeng Liu
2026-12-03 10:34 ` [PATCH RFC 3/3] media: qcom: camss: vfe: Move VFE 1080 " Wenmeng Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®