diff mbox series

[1/2] drm/msm/dsi: Add support for flexible DSI block mapping

Message ID 1642527088-13088-1-git-send-email-loic.poulain@linaro.org
State New
Headers show
Series [1/2] drm/msm/dsi: Add support for flexible DSI block mapping | expand

Commit Message

Loic Poulain Jan. 18, 2022, 5:31 p.m. UTC
The QCM2290 SoC integrates same DSI hardware as SC7180 but mapped
at a different address, 0x5e94000 vs 0xae94000. To support such
case, this change introduces an optional io_mask value that can
be used to match multiple mapped addresses. It's probably not the
more elegant solution, and could be revisited if necessary.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/gpu/drm/msm/dsi/dsi_cfg.h  | 2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index 41e99a9..195ab2f 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -36,6 +36,7 @@  struct msm_dsi_config {
 	const char * const *bus_clk_names;
 	const int num_bus_clks;
 	const resource_size_t io_start[DSI_MAX];
+	const u32 io_mask;
 	const int num_dsi;
 };
 
@@ -61,4 +62,3 @@  struct msm_dsi_cfg_handler {
 const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor);
 
 #endif /* __MSM_DSI_CFG_H__ */
-
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index f69a125f..428641e 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1779,6 +1779,9 @@  static int dsi_host_get_id(struct msm_dsi_host *msm_host)
 	for (i = 0; i < cfg->num_dsi; i++) {
 		if (cfg->io_start[i] == res->start)
 			return i;
+		else if (cfg->io_mask &&
+			 (cfg->io_start[i] & cfg->io_mask) == (res->start & cfg->io_mask))
+			return i;
 	}
 
 	return -EINVAL;