[Freedreno] [PATCH 04/10] drm/msm/dsi: dsi_host: Fix DSI index detection when version clash occurs
Konrad Dybcio
konrad.dybcio at linaro.org
Sat Feb 11 11:51:04 UTC 2023
Now that msm_dsi_config is ready to accept multiple sets of registers
(where array[n][idx] holds the base registers of DSI(idx) for the nth
entry), loop through all available configs to resolve hw version
clashes.
Fixes: 32280d66fd44 ("drm/msm/dsi: Don't get DSI index from DT")
Signed-off-by: Konrad Dybcio <konrad.dybcio at linaro.org>
---
drivers/gpu/drm/msm/dsi/dsi_cfg.h | 1 +
drivers/gpu/drm/msm/dsi/dsi_host.c | 12 +++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index 03493cc6b772..4a47705234bd 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -43,6 +43,7 @@ struct msm_dsi_config {
const int num_bus_clks;
/* Allow + 1 entry for the zero-terminator */
const resource_size_t io_start[VARIANTS_MAX][DSI_MAX + 1];
+ const int num_variants;
};
struct msm_dsi_host_cfg_ops {
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index f5092b4d0757..8dfa69bcff77 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1862,16 +1862,18 @@ static int dsi_host_get_id(struct msm_dsi_host *msm_host)
struct platform_device *pdev = msm_host->pdev;
const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
struct resource *res;
- int i;
+ int i, j, num_variants;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dsi_ctrl");
if (!res)
return -EINVAL;
- for (i = 0; cfg->io_start[0][i]; i++) {
- if (cfg->io_start[0][i] == res->start)
- return i;
- }
+ num_variants = cfg->num_variants ? cfg->num_variants : 1;
+
+ for (i = 0; i < num_variants; i++)
+ for (j = 0; cfg->io_start[i][j]; j++)
+ if (cfg->io_start[i][j] == res->start)
+ return j;
return -EINVAL;
}
--
2.39.1
More information about the Freedreno
mailing list