[PATCH v3 7/8] media: qcom: camss: csiphy-3ph: C-PHY needs own lane configuration

David Heidelberg via B4 Relay posted 8 patches 3 weeks, 1 day ago
[PATCH v3 7/8] media: qcom: camss: csiphy-3ph: C-PHY needs own lane configuration
Posted by David Heidelberg via B4 Relay 3 weeks, 1 day ago
From: David Heidelberg <david@ixit.cz>

Catch when C-PHY configuration gets used on SoC with CAMSS missing C-PHY
configuration lane registers.

Hopefully this check will disappear as these lane regs gets populated.

Signed-off-by: David Heidelberg <david@ixit.cz>
---
 drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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 d82a88dad74b5..89bfe3710fc3a 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
@@ -1217,6 +1217,22 @@ static int csiphy_lanes_enable(struct csiphy_device *csiphy,
 	u8 val;
 	int i;
 
+	if (c->phy_cfg == V4L2_MBUS_CSI2_CPHY) {
+		switch (csiphy->camss->res->version) {
+		case CAMSS_2290:
+		case CAMSS_8280XP:
+		case CAMSS_X1E80100:
+		case CAMSS_8550:
+		case CAMSS_8650:
+		case CAMSS_8300:
+		case CAMSS_8775P:
+			dev_err(dev, "Missing lane_regs definition for C-PHY\n");
+			return -EINVAL;
+		default:
+			break;
+		}
+	}
+
 	switch (csiphy->camss->res->version) {
 	case CAMSS_845:
 		if (c->phy_cfg == V4L2_MBUS_CSI2_CPHY) {

-- 
2.51.0
Re: [PATCH v3 7/8] media: qcom: camss: csiphy-3ph: C-PHY needs own lane configuration
Posted by Bryan O'Donoghue 3 weeks, 1 day ago
On 17/01/2026 15:36, David Heidelberg via B4 Relay wrote:
> From: David Heidelberg <david@ixit.cz>
> 
> Catch when C-PHY configuration gets used on SoC with CAMSS missing C-PHY
> configuration lane registers.
> 
> Hopefully this check will disappear as these lane regs gets populated.
> 
> Signed-off-by: David Heidelberg <david@ixit.cz>
> ---
>   drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> 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 d82a88dad74b5..89bfe3710fc3a 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
> @@ -1217,6 +1217,22 @@ static int csiphy_lanes_enable(struct csiphy_device *csiphy,
>   	u8 val;
>   	int i;
>   
> +	if (c->phy_cfg == V4L2_MBUS_CSI2_CPHY) {
> +		switch (csiphy->camss->res->version) {
> +		case CAMSS_2290:
> +		case CAMSS_8280XP:
> +		case CAMSS_X1E80100:
> +		case CAMSS_8550:
> +		case CAMSS_8650:
> +		case CAMSS_8300:
> +		case CAMSS_8775P:
> +			dev_err(dev, "Missing lane_regs definition for C-PHY\n");
> +			return -EINVAL;
> +		default:
> +			break;
> +		}
> +	}
> +
>   	switch (csiphy->camss->res->version) {
>   	case CAMSS_845:
>   		if (c->phy_cfg == V4L2_MBUS_CSI2_CPHY) {
> 

Proliferating special cases in switch statements on a per-SoC basis is 
verboten.

Please find another way to do this, you already have a bool to indicate 
cphy in struct csid_phy_config {} so at some level CAMSS already has a 
bool to indicate what to do.

Please make that logic accessible to logical consumers throughout, in 
this case the CPHY code.

---
bod