From c6c33a6088a78955da739ceac223843f66052745 Mon Sep 17 00:00:00 2001 From: Valentine Barshak Date: Tue, 6 Nov 2018 15:51:09 +0300 Subject: [PATCH 028/122] media: soc_camera: rcar_vin: Fix VnCSI_IFMD settings This makes VnCSI_IFMD DES[01] bit settings identical in both probe and resume callbacks. The DES0 bit is set for all SoCs, while DES1 bit is reserved on V3M, V3H, and E3. While at it, also handle the situations when priv->chip is not found among supported SoCs. Signed-off-by: Valentine Barshak --- drivers/media/platform/soc_camera/rcar_vin.c | 37 ++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c index ded9288..77c8d6b 100644 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c @@ -2999,7 +2999,7 @@ static int rcar_vin_probe(struct platform_device *pdev) if ((priv->chip == RCAR_H3 || priv->chip == RCAR_M3 || priv->chip == RCAR_V3M) && !of_property_read_string(np, "csi,select", &str)) { - u32 ifmd = 0; + u32 ifmd; bool match_flag = false; const struct vin_gen3_ifmd *gen3_ifmd_table = NULL; int vc, num; @@ -3065,14 +3065,24 @@ static int rcar_vin_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "csi_ch:%d, vc:%d\n", priv->csi_ch, priv->vc); - ifmd = VNCSI_IFMD_DES1 | VNCSI_IFMD_DES0; + ifmd = VNCSI_IFMD_DES0; - if (priv->chip == RCAR_H3) + switch (priv->chip) { + case RCAR_H3: gen3_ifmd_table = vin_h3_vc_ifmd; - else if (priv->chip == RCAR_M3) + ifmd = VNCSI_IFMD_DES1; + break; + case RCAR_M3: gen3_ifmd_table = vin_m3_vc_ifmd; - else if (priv->chip == RCAR_V3M) + ifmd = VNCSI_IFMD_DES1; + break; + case RCAR_V3M: gen3_ifmd_table = vin_v3_vc_ifmd; + break; + default: + BUG(); + break; + } for (i = 0; i < num; i++) { if ((gen3_ifmd_table[i].v_sel[priv->index].csi2_ch @@ -3209,7 +3219,7 @@ static int rcar_vin_suspend(struct device *dev) static int rcar_vin_resume(struct device *dev) { - u32 ifmd = 0; + u32 ifmd; bool match_flag = false; const struct vin_gen3_ifmd *gen3_ifmd_table = NULL; int num; @@ -3221,15 +3231,22 @@ static int rcar_vin_resume(struct device *dev) ifmd0_init = true; ifmd4_init = true; - if (priv->chip == RCAR_H3) { - ifmd = VNCSI_IFMD_DES1 | VNCSI_IFMD_DES0; + ifmd = VNCSI_IFMD_DES0; + + switch (priv->chip) { + case RCAR_H3: gen3_ifmd_table = vin_h3_vc_ifmd; - } else if (priv->chip == RCAR_M3) { ifmd = VNCSI_IFMD_DES1; + break; + case RCAR_M3: gen3_ifmd_table = vin_m3_vc_ifmd; - } else if (priv->chip == RCAR_V3M) { ifmd = VNCSI_IFMD_DES1; + break; + case RCAR_V3M: gen3_ifmd_table = vin_v3_vc_ifmd; + break; + default: + return 0; } for (i = 0; i < num; i++) { -- 2.7.4