From: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
To: Bryan O'Donoghue <bod@kernel.org>,
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
Loic Poulain <loic.poulain@oss.qualcomm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
Subject: [PATCH 4/6] media: qcom: camss: vfe: Add support for VFE 900
Date: Tue, 15 Sep 2026 17:34:14 +0800 [thread overview]
Message-ID: <20260915-nord-v1-4-20db41a7f1ff@oss.qualcomm.com> (raw)
In-Reply-To: <20260915-nord-v1-0-20db41a7f1ff@oss.qualcomm.com>
The VFE on the Nord platform reuses the gen4 VFE driver but places its
bus registers at a different base and does not implement the write
master CGC override register. Add a VFE 900 variant to the gen4 driver
to handle the different bus register base, the separate location of the
test bus control register, and to skip the missing CGC override
register.
In addition, the v900 ADDR_IMAGE register takes a full byte address
rather than the 256-byte-unit encoding used by the gen4 baseline, and
the full IFE write master client map places the RDI clients at index 28
(the lite instances keep RDI0 at client 0).
Signed-off-by: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
---
drivers/media/platform/qcom/camss/camss-vfe-gen4.c | 102 +++++++++++++++++++--
drivers/media/platform/qcom/camss/camss.h | 1 +
2 files changed, 95 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen4.c b/drivers/media/platform/qcom/camss/camss-vfe-gen4.c
index d73d70898710a2127c606ac8459a1d8c747a2f7c..f1429a6d2be54c415175a0129778f4b3a232564f 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-gen4.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-gen4.c
@@ -13,13 +13,77 @@
#include "camss.h"
#include "camss-vfe.h"
+struct vfe_gen4_hw_info {
+ u32 bus_reg_base;
+ u32 bus_reg_base_lite;
+ s32 test_bus_ctrl_offset; /* relative to the bus register base */
+ u8 rdi_wm_offset;
+ u8 rdi_wm_offset_lite;
+ u8 addr_shift; /* ADDR_IMAGE address unit */
+ bool has_wm_cgc_override;
+};
+
+static const struct vfe_gen4_hw_info vfe_900_hw_info = {
+ .bus_reg_base = 0xA00,
+ .bus_reg_base_lite = 0x700,
+ .test_bus_ctrl_offset = -0x1BC,
+ .rdi_wm_offset = 0x1C,
+ .rdi_wm_offset_lite = 0x0,
+ .addr_shift = 0,
+ .has_wm_cgc_override = false,
+};
+
+static const struct vfe_gen4_hw_info vfe_1080_hw_info = {
+ .bus_reg_base = 0x1000,
+ .bus_reg_base_lite = 0x800,
+ .test_bus_ctrl_offset = 0x128,
+ .rdi_wm_offset = 0x17,
+ .rdi_wm_offset_lite = 0x0,
+ .addr_shift = 8,
+ .has_wm_cgc_override = true,
+};
+
+static inline const struct vfe_gen4_hw_info *
+vfe_gen4_get_hw_info(struct vfe_device *vfe)
+{
+ switch (vfe->camss->res->version) {
+ case CAMSS_NORD:
+ return &vfe_900_hw_info;
+ default:
+ return &vfe_1080_hw_info;
+ }
+}
+
+static inline u32 vfe_gen4_bus_reg_base(struct vfe_device *vfe)
+{
+ const struct vfe_gen4_hw_info *hw_info = vfe_gen4_get_hw_info(vfe);
+
+ return vfe_is_lite(vfe) ? hw_info->bus_reg_base_lite :
+ hw_info->bus_reg_base;
+}
+
+static inline u32 vfe_gen4_test_bus_ctrl(struct vfe_device *vfe)
+{
+ const struct vfe_gen4_hw_info *hw_info = vfe_gen4_get_hw_info(vfe);
+
+ return vfe_gen4_bus_reg_base(vfe) + hw_info->test_bus_ctrl_offset;
+}
+
+static inline u8 vfe_gen4_rdi_wm(struct vfe_device *vfe, u8 rdi)
+{
+ const struct vfe_gen4_hw_info *hw_info = vfe_gen4_get_hw_info(vfe);
+
+ return rdi + (vfe_is_lite(vfe) ? hw_info->rdi_wm_offset_lite :
+ hw_info->rdi_wm_offset);
+}
+
/* VFE-gen4 Bus Register Base Addresses */
-#define BUS_REG_BASE (vfe_is_lite(vfe) ? 0x800 : 0x1000)
+#define BUS_REG_BASE (vfe_gen4_bus_reg_base(vfe))
#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_TEST_BUS_CTRL (vfe_gen4_test_bus_ctrl(vfe))
#define VFE_BUS_WM_CFG(n) (BUS_REG_BASE + 0x500 + (n) * 0x100)
#define WM_CFG_EN BIT(0)
@@ -83,18 +147,36 @@
* RDI3 3
* GAMMA 4
* STATES_BE 5
+ *
+ * v900 full IFE write master client map: the RDI clients start at 28,
+ * after the 28 image/stats clients (0-27):
+ *
+ * MAIN C0/C1/C2/UV 0-3
+ * PIXEL_RAW 4
+ * W_IR 5
+ * AI_1 C0/C1/C2/UV 6-9
+ * AI_2 C0/C1/C2/UV 10-13
+ * HV_DS16 / HV_DS4 14-15
+ * STATS BG_IR..BLTM 16-27
+ * RDI0 28
+ * RDI1 29
+ * RDI2 30
+ * ... RDI11 39
+ *
+ * v900 IFE Lite matches the generic map above (RDI0 at client 0).
*/
-#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);
+ wm = vfe_gen4_rdi_wm(vfe, wm);
/* no clock gating at bus input */
- writel(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE);
+ if (vfe_gen4_get_hw_info(vfe)->has_wm_cgc_override)
+ writel(WM_CGC_OVERRIDE_ALL,
+ vfe->base + VFE_BUS_WM_CGC_OVERRIDE);
writel(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL);
@@ -123,15 +205,19 @@ static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
static void vfe_wm_stop(struct vfe_device *vfe, u8 wm)
{
- wm = RDI_WM(wm);
+ wm = vfe_gen4_rdi_wm(vfe, 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));
+ const struct vfe_gen4_hw_info *hw_info = vfe_gen4_get_hw_info(vfe);
+
+ wm = vfe_gen4_rdi_wm(vfe, wm);
+
+ writel(addr >> hw_info->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);
}
diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
index 93d691c8ac63b2a47dbb234856b627d8911a1851..487b8ec0f7cdbfe2e2da0e46cb4431b1e6b4c475 100644
--- a/drivers/media/platform/qcom/camss/camss.h
+++ b/drivers/media/platform/qcom/camss/camss.h
@@ -96,6 +96,7 @@ enum camss_version {
CAMSS_8550,
CAMSS_8650,
CAMSS_8775P,
+ CAMSS_NORD,
CAMSS_X1E80100,
};
--
2.34.1
next prev parent reply other threads:[~2026-09-15 9:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 9:34 [PATCH 0/6] media: qcom: camss: Add support for Nord CAMSS Wenmeng Liu
2026-09-15 9:34 ` [PATCH 1/6] dt-bindings: media: Add bindings for qcom,nord-camss Wenmeng Liu
2026-09-15 9:45 ` sashiko-bot
2026-09-17 10:13 ` Krzysztof Kozlowski
2026-09-17 12:37 ` Wenmeng Liu
2026-09-18 6:47 ` Krzysztof Kozlowski
2026-09-18 7:08 ` Wenmeng Liu
2026-09-15 9:34 ` [PATCH 2/6] media: qcom: camss: csid: Add support for CSID 900 Wenmeng Liu
2026-09-15 9:50 ` sashiko-bot
2026-09-20 7:01 ` Shawn Guo
2026-09-15 9:34 ` [PATCH 3/6] media: qcom: camss: vfe: Add support for VFE gen4 Wenmeng Liu
2026-09-15 9:53 ` sashiko-bot
2026-09-20 7:19 ` Shawn Guo
2026-09-15 9:34 ` Wenmeng Liu [this message]
2026-09-15 9:43 ` [PATCH 4/6] media: qcom: camss: vfe: Add support for VFE 900 sashiko-bot
2026-09-20 7:17 ` Shawn Guo
2026-09-15 9:34 ` [PATCH 5/6] media: qcom: camss: tpg: Add support for TPG v2.5.0 Wenmeng Liu
2026-09-15 9:34 ` [PATCH 6/6] media: qcom: camss: Add support for nord camss Wenmeng Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260915-nord-v1-4-20db41a7f1ff@oss.qualcomm.com \
--to=wenmeng.liu@oss.qualcomm.com \
--cc=bod@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=vladimir.zapolskiy@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox