Re: [PATCH v7 3/8] media: qcom: camss: Prepare CSID for C-PHY support

From: Frank Li

Date: Mon Jun 08 2026 - 14:20:37 EST


On Fri, Jun 05, 2026 at 03:14:41PM +0200, David Heidelberg wrote:
> Inherit C-PHY information from CSIPHY, so we can configure CSID
> properly.
>
> CSI2_RX_CFG0_PHY_TYPE_SEL must be set to 1, when C-PHY mode is used.
>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
> Acked-by: Cory Keitz <ckeitz@xxxxxxxxxx>
> Signed-off-by: David Heidelberg <david@xxxxxxx>
> ---
> drivers/media/platform/qcom/camss/camss-csid-gen2.c | 1 +
> drivers/media/platform/qcom/camss/camss-csid.c | 5 +++++
> drivers/media/platform/qcom/camss/camss-csid.h | 6 ++++++
> 3 files changed, 12 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c
> index eadcb2f7e3aaa..a5b406cc8ead3 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c
> @@ -178,16 +178,17 @@ static void __csid_configure_rx(struct csid_device *csid,
> int val;
>
> if (!lane_cnt)
> lane_cnt = 4;
>
> val = (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_NUM_SEL;
> + val |= csid->phy.phy_sel << CSI2_RX_CFG0_PHY_TYPE_SEL;


It is fine for now. Suggest change to FIELD_PREP() in future.

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG0);
>
> val = 1 << CSI2_RX_CFG1_PACKET_ECC_CORRECTION_EN;
> if (vc > 3)
> val |= 1 << CSI2_RX_CFG1_VC_MODE;
> val |= 1 << CSI2_RX_CFG1_MISR_EN;
> writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG1);
> }
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index 48459b46a981b..bcc34ac9dd212 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -1286,16 +1286,21 @@ static int csid_link_setup(struct media_entity *entity,
> /* do no allow a link from CSIPHY to CSID */
> if (!csiphy->cfg.csi2)
> return -EPERM;
>
> csid->phy.csiphy_id = csiphy->id;
>
> lane_cfg = &csiphy->cfg.csi2->lane_cfg;
> csid->phy.lane_cnt = lane_cfg->num_data;
> + if (lane_cfg->phy_cfg == V4L2_MBUS_CSI2_CPHY)
> + csid->phy.phy_sel = CSID_PHY_SEL_CPHY;
> + else
> + csid->phy.phy_sel = CSID_PHY_SEL_DPHY;
> +
> csid->phy.lane_assign = csid_get_lane_assign(lane_cfg, lane_cfg->num_data);
> csid->tpg_linked = false;
> }
> }
> /* Decide which virtual channels to enable based on which source pads are enabled */
> if (local->flags & MEDIA_PAD_FL_SOURCE) {
> struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
> struct csid_device *csid = v4l2_get_subdevdata(sd);
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.h b/drivers/media/platform/qcom/camss/camss-csid.h
> index 5296b10f6bac8..e65590b0df69f 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.h
> +++ b/drivers/media/platform/qcom/camss/camss-csid.h
> @@ -39,16 +39,21 @@ enum csid_testgen_mode {
> CSID_PAYLOAD_MODE_USER_SPECIFIED = 6,
> CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN1 = 6, /* excluding disabled */
> CSID_PAYLOAD_MODE_COMPLEX_PATTERN = 7,
> CSID_PAYLOAD_MODE_COLOR_BOX = 8,
> CSID_PAYLOAD_MODE_COLOR_BARS = 9,
> CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2 = 9, /* excluding disabled */
> };
>
> +enum csid_phy_sel {
> + CSID_PHY_SEL_DPHY = 0,
> + CSID_PHY_SEL_CPHY = 1
> +};
> +
> struct csid_format_info {
> u32 code;
> u8 data_type;
> u8 decode_format;
> u8 bpp;
> u8 spp; /* bus samples per pixel */
> };
>
> @@ -65,16 +70,17 @@ struct csid_testgen_config {
> };
>
> struct csid_phy_config {
> u8 csiphy_id;
> u8 lane_cnt;
> u32 lane_assign;
> u32 en_vc;
> u8 need_vc_update;
> + enum csid_phy_sel phy_sel;
> };
>
> struct csid_device;
>
> struct csid_hw_ops {
> /*
> * configure_stream - Configures and starts CSID input stream
> * @csid: CSID device
>
> --
> 2.53.0
>