Skip to contentSkip to conversation

media: qcom: camss: csid: Consolidate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition

PATCH In review Hangxiang Ma 4 participants 5 messages Jun 1

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: qcom: camss: csid: Consolidate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition

Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.

---
Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.

---
 drivers/media/platform/qcom/camss/camss-csid-680.c  | 1 -
 drivers/media/platform/qcom/camss/camss-csid-gen3.c | 1 -
 drivers/media/platform/qcom/camss/camss-csid.h      | 2 ++
 3 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -1
index 345a67c8fb94..bf7164085ddb 100644
@@ -101,7 +101,6 @@
 #define		CSI2_RX_CFG0_DL2_INPUT_SEL			12
 #define		CSI2_RX_CFG0_DL3_INPUT_SEL			16
 #define		CSI2_RX_CFG0_PHY_NUM_SEL			20
-#define		CSI2_RX_CFG0_PHY_SEL_BASE_IDX			1
 #define		CSI2_RX_CFG0_PHY_TYPE_SEL			24
 #define		CSI2_RX_CFG0_TPG_MUX_EN				BIT(27)
 #define		CSI2_RX_CFG0_TPG_MUX_SEL			GENMASK(29, 28)
drivers/media/platform/qcom/camss/camss-csid-gen3.c +0 -1
index 0fdbf75fb27d..da9458cd178b 100644
@@ -105,7 +105,6 @@
 #define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi)	(csid_is_lite(csid) && IS_CSID_690(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)
drivers/media/platform/qcom/camss/camss-csid.h +2 -0
index 5296b10f6bac..059ac94ad1be 100644
@@ -27,6 +27,8 @@
 /* CSID hardware can demultiplex up to 4 outputs */
 #define MSM_CSID_MAX_SRC_STREAMS	4
 
+/* CSIPHY to hardware PHY selector mapping */
+#define CSI2_RX_CFG0_PHY_SEL_BASE_IDX 1
 #define CSID_RESET_TIMEOUT_MS 500
 
 enum csid_testgen_mode {

---
base-commit: 697a0e31ee66f5ddb929c09895139779fff33f20
change-id: 20260601-camss-macro-3d40c4d4e90d

Best regards,

Signature · 1 line
Hangxiang Ma <[email protected]>
reviewer
#1 lore raw
Quoted 5 lines · Hangxiang Ma

Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.

Taking that direction, I don’t think this is the only instance of redundancy, so why single out this one in particular? Should we consider one-line cleanups across all similar cases? Also, other CSID drivers follow the same pattern but use different identifiers for that define (e.g. csid-340).

Also, introducing such low-level, register-aligned naming (CSI2_RX_CFG0_PHY...) in what is supposed to be a generic CSID header doesn’t seem appropriate.

Regards,
Loic

Quoted 59 lines

---
Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.

---
 drivers/media/platform/qcom/camss/camss-csid-680.c  | 1 -
 drivers/media/platform/qcom/camss/camss-csid-gen3.c | 1 -
 drivers/media/platform/qcom/camss/camss-csid.h      | 2 ++
 3 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -1
index 345a67c8fb94..bf7164085ddb 100644
@@ -101,7 +101,6 @@
 #define                CSI2_RX_CFG0_DL2_INPUT_SEL                      12
 #define                CSI2_RX_CFG0_DL3_INPUT_SEL                      16
 #define                CSI2_RX_CFG0_PHY_NUM_SEL                        20
-#define                CSI2_RX_CFG0_PHY_SEL_BASE_IDX                   1
 #define                CSI2_RX_CFG0_PHY_TYPE_SEL                       24
 #define                CSI2_RX_CFG0_TPG_MUX_EN                         BIT(27)
 #define                CSI2_RX_CFG0_TPG_MUX_SEL                        GENMASK(29, 28)
drivers/media/platform/qcom/camss/camss-csid-gen3.c +0 -1
index 0fdbf75fb27d..da9458cd178b 100644
@@ -105,7 +105,6 @@
 #define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi)     (csid_is_lite(csid) && IS_CSID_690(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)
drivers/media/platform/qcom/camss/camss-csid.h +2 -1
index 5296b10f6bac..059ac94ad1be 100644
@@ -27,6 +27,8 @@
 /* CSID hardware can demultiplex up to 4 outputs */
 #define MSM_CSID_MAX_SRC_STREAMS       4
 
+/* CSIPHY to hardware PHY selector mapping */
+#define CSI2_RX_CFG0_PHY_SEL_BASE_IDX 1
 #define CSID_RESET_TIMEOUT_MS 500
 
 enum csid_testgen_mode {
 
---

base-commit: 697a0e31ee66f5ddb929c09895139779fff33f20
change-id: 20260601-camss-macro-3d40c4d4e90d

Best regards,
--
Hangxiang Ma <[email protected]>

#2 lore raw
Quoted 74 lines · Loic Poulain
Quoted 5 lines · Hangxiang Ma

Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.

Taking that direction, I don’t think this is the only instance of redundancy, so why single out this one in particular? Should we consider one-line cleanups across all similar cases? Also, other CSID drivers follow the same pattern but use different identifiers for that define (e.g. csid-340).

Also, introducing such low-level, register-aligned naming (CSI2_RX_CFG0_PHY...) in what is supposed to be a generic CSID header doesn’t seem appropriate.

Regards,
Loic

Quoted 51 lines

---
Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.

---
  drivers/media/platform/qcom/camss/camss-csid-680.c  | 1 -
  drivers/media/platform/qcom/camss/camss-csid-gen3.c | 1 -
  drivers/media/platform/qcom/camss/camss-csid.h      | 2 ++
  3 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -1
index 345a67c8fb94..bf7164085ddb 100644
@@ -101,7 +101,6 @@
  #define                CSI2_RX_CFG0_DL2_INPUT_SEL                      12
  #define                CSI2_RX_CFG0_DL3_INPUT_SEL                      16
  #define                CSI2_RX_CFG0_PHY_NUM_SEL                        20
-#define                CSI2_RX_CFG0_PHY_SEL_BASE_IDX                   1
  #define                CSI2_RX_CFG0_PHY_TYPE_SEL                       24
  #define                CSI2_RX_CFG0_TPG_MUX_EN                         BIT(27)
  #define                CSI2_RX_CFG0_TPG_MUX_SEL                        GENMASK(29, 28)
drivers/media/platform/qcom/camss/camss-csid-gen3.c +0 -1
index 0fdbf75fb27d..da9458cd178b 100644
@@ -105,7 +105,6 @@
  #define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi)     (csid_is_lite(csid) && IS_CSID_690(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)
drivers/media/platform/qcom/camss/camss-csid.h +2 -0
index 5296b10f6bac..059ac94ad1be 100644
@@ -27,6 +27,8 @@
  /* CSID hardware can demultiplex up to 4 outputs */
  #define MSM_CSID_MAX_SRC_STREAMS       4
 
+/* CSIPHY to hardware PHY selector mapping */
+#define CSI2_RX_CFG0_PHY_SEL_BASE_IDX 1
  #define CSID_RESET_TIMEOUT_MS 500
 
  enum csid_testgen_mode {
Quoted 9 lines
Quoted 8 lines

---
base-commit: 697a0e31ee66f5ddb929c09895139779fff33f20
change-id: 20260601-camss-macro-3d40c4d4e90d

Best regards,
--
Hangxiang Ma <[email protected]>

Thanks Loic, Bryan pointed this out in last review cycle and suggested to split it as a standalone series. This idea comes from KNP series as I was once suggested to move this macro into one common header to remove redundancy. I think your are correct after fully consideration. I will make changes only for KNP and put it in driver.

Best regards,
Hangxiang

#3 lore raw

Hi Hangxiang,

Quoted 97 lines · On 6/1/2026 8:13 AM, [email protected] wrote:
Quoted 87 lines · Loic Poulain
Quoted 5 lines · Hangxiang Ma

Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.

Taking that direction, I don’t think this is the only instance of redundancy, so why single out this one in particular? Should we consider one-line cleanups across all similar cases? Also, other CSID drivers follow the same pattern but use different identifiers for that define (e.g. csid-340).

Also, introducing such low-level, register-aligned naming (CSI2_RX_CFG0_PHY...)  in what is supposed to be a generic CSID header doesn’t seem appropriate.

Regards,
Loic

Quoted 11 lines

---
Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.
---
   drivers/media/platform/qcom/camss/camss-csid-680.c  | 1 - drivers/media/platform/qcom/camss/camss-csid-gen3.c | 1 - drivers/media/platform/qcom/camss/camss-csid.h      | 2 ++

Review

Quoted 3 lines
   3 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) renamed from drivers/media/platform/qcom/camss/camss-csid-680.c +0 -0

drivers/media/platform/qcom/camss/camss-csid-680.c

drivers/media/platform/qcom/camss/camss-csid-680.c line 101

Quoted 5 lines

index 345a67c8fb94..bf7164085ddb 100644

drivers/media/platform/qcom/camss/camss-csid-680.c +0 -0
@@ -101,7 +101,6 @@
    #define                

CSI2_RX_CFG0_DL2_INPUT_SEL                      12

drivers/media/platform/qcom/camss/camss-csid-680.c line 102

Quoted 1 line
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -0
    #define                

CSI2_RX_CFG0_DL3_INPUT_SEL                      16

drivers/media/platform/qcom/camss/camss-csid-680.c line 103

Quoted 1 line
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -0
    #define                

CSI2_RX_CFG0_PHY_NUM_SEL                        20

drivers/media/platform/qcom/camss/camss-csid-680.c line 104

Quoted 1 line
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -1
-#define                

CSI2_RX_CFG0_PHY_SEL_BASE_IDX                   1

drivers/media/platform/qcom/camss/camss-csid-680.c line 104

Quoted 1 line
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -0
    #define                

CSI2_RX_CFG0_PHY_TYPE_SEL                       24

drivers/media/platform/qcom/camss/camss-csid-680.c line 105

Quoted 1 line
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -0
    #define                

CSI2_RX_CFG0_TPG_MUX_EN                         BIT(27)

drivers/media/platform/qcom/camss/camss-csid-680.c line 106

Quoted 1 line
drivers/media/platform/qcom/camss/camss-csid-680.c +0 -0
    #define                

CSI2_RX_CFG0_TPG_MUX_SEL                        GENMASK(29, 28)

Review

Quoted 1 line
(quoted diff) renamed from drivers/media/platform/qcom/camss/camss-csid-gen3.c +0 -0

drivers/media/platform/qcom/camss/camss-csid-gen3.c

drivers/media/platform/qcom/camss/camss-csid-gen3.c line 105

Quoted 5 lines

index 0fdbf75fb27d..da9458cd178b 100644

drivers/media/platform/qcom/camss/camss-csid-gen3.c +0 -0
@@ -105,7 +105,6 @@
    #define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi)     (csid_is_lite(csid) 

&& IS_CSID_690(csid) ?\

Quoted 1 line

                                                          (0x34C +

0x100 * (rdi)) :\

Quoted 1 line

                                                          (0x54C +

0x100 * (rdi)))

Review

Quoted 5 lines

-#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)

(quoted diff) renamed from drivers/media/platform/qcom/camss/camss-csid.h +0 -0

drivers/media/platform/qcom/camss/camss-csid.h

Quoted 13 lines

index 5296b10f6bac..059ac94ad1be 100644

drivers/media/platform/qcom/camss/camss-csid.h +2 -0
@@ -27,6 +27,8 @@
    /* CSID hardware can demultiplex up to 4 outputs */
    #define MSM_CSID_MAX_SRC_STREAMS       4
 
+/* CSIPHY to hardware PHY selector mapping */
+#define CSI2_RX_CFG0_PHY_SEL_BASE_IDX 1
    #define CSID_RESET_TIMEOUT_MS 500
 
    enum csid_testgen_mode {
Quoted 9 lines
Quoted 8 lines

---
base-commit: 697a0e31ee66f5ddb929c09895139779fff33f20
change-id: 20260601-camss-macro-3d40c4d4e90d

Best regards,
--
Hangxiang Ma <[email protected]>

Quoted 5 lines

Thanks Loic, Bryan pointed this out in last review cycle and suggested to split it as a standalone series. This idea comes from KNP series as I was once suggested to move this macro into one common header to remove redundancy. I think your are correct after fully consideration. I will make changes only for KNP and put it in driver.

Best regards,
Hangxiang

So this patch is not necessary any more, is it? If there is anything specifically to be done to withdraw this, just for it to be clear to Bryan, can you please?

Thanks,
Vijay.

maintainer
#4 lore raw
Quoted 96 lines · Vijay Kumar Tumati

Hi Hangxiang,

Quoted 93 lines · On 6/1/2026 8:13 AM, [email protected] wrote:
Quoted 81 lines · Loic Poulain
Quoted 5 lines · Hangxiang Ma

Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.

Taking that direction, I don’t think this is the only instance of redundancy, so why single out this one in particular? Should we consider one-line cleanups across all similar cases? Also, other CSID drivers follow the same pattern but use different identifiers for that define (e.g. csid-340).

Also, introducing such low-level, register-aligned naming (CSI2_RX_CFG0_PHY...)  in what is supposed to be a generic CSID header doesn’t seem appropriate.

Regards,
Loic

Quoted 11 lines

---
Move the duplicate CSI2_RX_CFG0_PHY_SEL_BASE_IDX definition from camss-csid-680.c and camss-csid-gen3.c into the shared camss-csid.h header. This eliminates redundancy and makes the constant available to future CSID implementations.
---
   drivers/media/platform/qcom/camss/camss-csid-680.c  | 1 - drivers/media/platform/qcom/camss/camss-csid-gen3.c | 1 - drivers/media/platform/qcom/camss/camss-csid.h      | 2 ++

Review

Quoted 3 lines
   3 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) renamed from drivers/media/platform/qcom/camss/camss-csid-680.c +0 -0

drivers/media/platform/qcom/camss/camss-csid-680.c

drivers/media/platform/qcom/camss/camss-csid-680.c line 106

Quoted 11 lines

index 345a67c8fb94..bf7164085ddb 100644

drivers/media/platform/qcom/camss/camss-csid-680.c +0 -1
@@ -101,7 +101,6 @@
    #define CSI2_RX_CFG0_DL2_INPUT_SEL                      12
    #define CSI2_RX_CFG0_DL3_INPUT_SEL                      16
    #define CSI2_RX_CFG0_PHY_NUM_SEL                        20
-#define CSI2_RX_CFG0_PHY_SEL_BASE_IDX                   1
    #define CSI2_RX_CFG0_PHY_TYPE_SEL                       24
    #define CSI2_RX_CFG0_TPG_MUX_EN                         BIT(27)
    #define CSI2_RX_CFG0_TPG_MUX_SEL                        

GENMASK(29, 28)

Review

Quoted 1 line
(quoted diff) renamed from drivers/media/platform/qcom/camss/camss-csid-gen3.c +0 -0

drivers/media/platform/qcom/camss/camss-csid-gen3.c

drivers/media/platform/qcom/camss/camss-csid-gen3.c line 105

Quoted 5 lines

index 0fdbf75fb27d..da9458cd178b 100644

drivers/media/platform/qcom/camss/camss-csid-gen3.c +0 -0
@@ -105,7 +105,6 @@
    #define CSID_RDI_IRQ_SUBSAMPLE_PERIOD(rdi)     

(csid_is_lite(csid) && IS_CSID_690(csid) ?\

Quoted 1 line

                                                          (0x34C +

0x100 * (rdi)) :\

Quoted 1 line

                                                          (0x54C +

0x100 * (rdi)))

Review

Quoted 5 lines

-#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)

(quoted diff) renamed from drivers/media/platform/qcom/camss/camss-csid.h +0 -0

drivers/media/platform/qcom/camss/camss-csid.h

Quoted 13 lines

index 5296b10f6bac..059ac94ad1be 100644

drivers/media/platform/qcom/camss/camss-csid.h +2 -0
@@ -27,6 +27,8 @@
    /* CSID hardware can demultiplex up to 4 outputs */
    #define MSM_CSID_MAX_SRC_STREAMS       4
 
+/* CSIPHY to hardware PHY selector mapping */
+#define CSI2_RX_CFG0_PHY_SEL_BASE_IDX 1
    #define CSID_RESET_TIMEOUT_MS 500
 
    enum csid_testgen_mode {
Quoted 9 lines
Quoted 8 lines

---
base-commit: 697a0e31ee66f5ddb929c09895139779fff33f20
change-id: 20260601-camss-macro-3d40c4d4e90d

Best regards,
--
Hangxiang Ma <[email protected]>

Thanks Loic, Bryan pointed this out in last review cycle and suggested to split it as a standalone series. This idea comes from KNP series as I was once suggested to move this macro into one common header to remove redundancy. I think your are correct after fully consideration. I will make changes only for KNP and put it in driver.

Quoted 8 lines
Quoted 3 lines

Best regards,
Hangxiang

So this patch is not necessary any more, is it? If there is anything specifically to be done to withdraw this, just for it to be clear to Bryan, can you please?

Thanks,
Vijay.

I don't like endlessly redefining the same things over and over again. Its wasteful and error prone.

Burying it in camss-csid yes I agree is not appropriate - however for specific classes of silicon - it is entirely appropriate.

That surely is the entire point of naming things gen2, gen3, gen4 etc instead of silicon-version-x

Hence camss-csid-genX.h for sharing generation specific things.

---
bod