On 18/01/2022 20:31, Loic Poulain wrote:
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.
I'd prefer to use another approach here.
Allow dts to specify the exact version of the block
("qcom,dsi-ctrl-6g-v2.4.1-qcm2290" in your case. Or just
"qcom,dsi-ctrl-6g-qcm2290".). Do not attempt autodetecting the version
if the dts specifies the block. This way you can have special DSI
configuration for qcs2290.
Also see
https://lore.kernel.org/linux-arm-msm/20220108190059.72583-1-david@xxxxxxx/
Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxx>
---
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 --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;
--
With best wishes
Dmitry