On Sun Nov 30 22:25:36 2025 -0800, Hangxiang Ma wrote:
> The current value of '0xb0' that represents the offset to the status
> registers within the common registers of the CSIPHY has been changed on
> the newer SOCs and it requires generalizing the macro using a new
> variable 'common_status_offset'. This variable is initialized in the
> csiphy_init() function.
> 
> Signed-off-by: Hangxiang Ma <[email protected]>
> Signed-off-by: Bryan O'Donoghue <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 .../media/platform/qcom/camss/camss-csiphy-3ph-1-0.c  | 19 +++++++++++++------
 drivers/media/platform/qcom/camss/camss-csiphy.h      |  1 +
 2 files changed, 14 insertions(+), 6 deletions(-)

---

diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c 
b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
index 619abbf60781..d70d4f611798 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
@@ -46,7 +46,8 @@
 #define CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE     BIT(7)
 #define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B BIT(0)
 #define CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_SHOW_REV_ID    BIT(1)
-#define CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(offset, n)   ((offset) + 0xb0 + 0x4 
* (n))
+#define CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(offset, common_status_offset, n) \
+       ((offset) + (common_status_offset) + 0x4 * (n))
 
 #define CSIPHY_DEFAULT_PARAMS          0
 #define CSIPHY_LANE_ENABLE             1
@@ -810,13 +811,17 @@ static void csiphy_hw_version_read(struct csiphy_device 
*csiphy,
               CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->offset, 6));
 
        hw_version = readl_relaxed(csiphy->base +
-                                  
CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, 12));
+               CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                 regs->common_status_offset, 
12));
        hw_version |= readl_relaxed(csiphy->base +
-                                  
CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, 13)) << 8;
+               CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                 regs->common_status_offset, 
13)) << 8;
        hw_version |= readl_relaxed(csiphy->base +
-                                  
CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, 14)) << 16;
+               CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                 regs->common_status_offset, 
14)) << 16;
        hw_version |= readl_relaxed(csiphy->base +
-                                  
CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, 15)) << 24;
+               CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                 regs->common_status_offset, 
15)) << 24;
 
        dev_dbg(dev, "CSIPHY 3PH HW Version = 0x%08x\n", hw_version);
 }
@@ -845,7 +850,8 @@ static irqreturn_t csiphy_isr(int irq, void *dev)
        for (i = 0; i < 11; i++) {
                int c = i + 22;
                u8 val = readl_relaxed(csiphy->base +
-                                      
CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset, i));
+                       CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(regs->offset,
+                                                         
regs->common_status_offset, i));
 
                writel_relaxed(val, csiphy->base +
                               CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(regs->offset, 
c));
@@ -1086,6 +1092,7 @@ static int csiphy_init(struct csiphy_device *csiphy)
 
        csiphy->regs = regs;
        regs->offset = 0x800;
+       regs->common_status_offset = 0xb0;
 
        switch (csiphy->camss->res->version) {
        case CAMSS_845:
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h 
b/drivers/media/platform/qcom/camss/camss-csiphy.h
index 895f80003c44..2d5054819df7 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.h
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.h
@@ -90,6 +90,7 @@ struct csiphy_device_regs {
        const struct csiphy_lane_regs *lane_regs;
        int lane_array_size;
        u32 offset;
+       u32 common_status_offset;
 };
 
 struct csiphy_device {
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to