aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/dsi/phy
diff options
context:
space:
mode:
authorArchit Taneja <architt@codeaurora.org>2016-06-23 05:56:04 -0400
committerRob Clark <robdclark@gmail.com>2016-07-16 10:09:02 -0400
commit32280d66fd44de231b1d1a015e4ef41cac2d295c (patch)
treebb1826ef885f53d7a60273fedf3ba3f41ce94f55 /drivers/gpu/drm/msm/dsi/phy
parent96a611b54f7f0564886d64c43485402fa2530bf4 (diff)
drm/msm/dsi: Don't get DSI index from DT
The DSI host and PHY driver currently expects the DT bindings to provide custom properties "qcom,dsi-host-index" and "qcom,dsi-phy-index" so that the driver can identify which DSI instance it is. The binding isn't acceptable, but the driver still needs to figure out what its instance id. This is now done by storing the mmio starting addresses for each DSI instance in every SoC version in the driver. The driver then identifies the index number by trying to match the stored address with comparing the resource start address we get from DT. We don't have compatible strings for DSI PHY on each SoC, but only the DSI PHY type. We only support one SoC version for each PHY type, so we get away doing the same thing above for the PHY driver. We can revisit this when we support two SoCs with the same DSI PHY. Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/dsi/phy')
-rw-r--r--drivers/gpu/drm/msm/dsi/phy/dsi_phy.c32
-rw-r--r--drivers/gpu/drm/msm/dsi/phy/dsi_phy.h2
-rw-r--r--drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c4
-rw-r--r--drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c4
-rw-r--r--drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c2
5 files changed, 39 insertions, 5 deletions
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index e2f42d8ea294..f39386ed75e4 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -271,6 +271,30 @@ static const struct of_device_id dsi_phy_dt_match[] = {
271 {} 271 {}
272}; 272};
273 273
274/*
275 * Currently, we only support one SoC for each PHY type. When we have multiple
276 * SoCs for the same PHY, we can try to make the index searching a bit more
277 * clever.
278 */
279static int dsi_phy_get_id(struct msm_dsi_phy *phy)
280{
281 struct platform_device *pdev = phy->pdev;
282 const struct msm_dsi_phy_cfg *cfg = phy->cfg;
283 struct resource *res;
284 int i;
285
286 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dsi_phy");
287 if (!res)
288 return -EINVAL;
289
290 for (i = 0; i < cfg->num_dsi_phy; i++) {
291 if (cfg->io_start[i] == res->start)
292 return i;
293 }
294
295 return -EINVAL;
296}
297
274static int dsi_phy_driver_probe(struct platform_device *pdev) 298static int dsi_phy_driver_probe(struct platform_device *pdev)
275{ 299{
276 struct msm_dsi_phy *phy; 300 struct msm_dsi_phy *phy;
@@ -289,10 +313,10 @@ static int dsi_phy_driver_probe(struct platform_device *pdev)
289 phy->cfg = match->data; 313 phy->cfg = match->data;
290 phy->pdev = pdev; 314 phy->pdev = pdev;
291 315
292 ret = of_property_read_u32(dev->of_node, 316 phy->id = dsi_phy_get_id(phy);
293 "qcom,dsi-phy-index", &phy->id); 317 if (phy->id < 0) {
294 if (ret) { 318 ret = phy->id;
295 dev_err(dev, "%s: PHY index not specified, %d\n", 319 dev_err(dev, "%s: couldn't identify PHY index, %d\n",
296 __func__, ret); 320 __func__, ret);
297 goto fail; 321 goto fail;
298 } 322 }
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
index 0d54ed00386d..f24a85439b94 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -38,6 +38,8 @@ struct msm_dsi_phy_cfg {
38 * Fill default H/W values in illegal cells, eg. cell {0, 1}. 38 * Fill default H/W values in illegal cells, eg. cell {0, 1}.
39 */ 39 */
40 bool src_pll_truthtable[DSI_MAX][DSI_MAX]; 40 bool src_pll_truthtable[DSI_MAX][DSI_MAX];
41 const resource_size_t io_start[DSI_MAX];
42 const int num_dsi_phy;
41}; 43};
42 44
43extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs; 45extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
index f4bc11af849a..c757e2070cac 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
@@ -145,6 +145,8 @@ const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs = {
145 .ops = { 145 .ops = {
146 .enable = dsi_20nm_phy_enable, 146 .enable = dsi_20nm_phy_enable,
147 .disable = dsi_20nm_phy_disable, 147 .disable = dsi_20nm_phy_disable,
148 } 148 },
149 .io_start = { 0xfd998300, 0xfd9a0300 },
150 .num_dsi_phy = 2,
149}; 151};
150 152
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
index 96d1852af418..63d7fba31380 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
@@ -145,6 +145,8 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs = {
145 .enable = dsi_28nm_phy_enable, 145 .enable = dsi_28nm_phy_enable,
146 .disable = dsi_28nm_phy_disable, 146 .disable = dsi_28nm_phy_disable,
147 }, 147 },
148 .io_start = { 0xfd922b00, 0xfd923100 },
149 .num_dsi_phy = 2,
148}; 150};
149 151
150const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = { 152const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = {
@@ -160,5 +162,7 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = {
160 .enable = dsi_28nm_phy_enable, 162 .enable = dsi_28nm_phy_enable,
161 .disable = dsi_28nm_phy_disable, 163 .disable = dsi_28nm_phy_disable,
162 }, 164 },
165 .io_start = { 0x1a98500 },
166 .num_dsi_phy = 1,
163}; 167};
164 168
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
index 213355a3e767..7bdb9de54968 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
@@ -192,4 +192,6 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs = {
192 .enable = dsi_28nm_phy_enable, 192 .enable = dsi_28nm_phy_enable,
193 .disable = dsi_28nm_phy_disable, 193 .disable = dsi_28nm_phy_disable,
194 }, 194 },
195 .io_start = { 0x4700300, 0x5800300 },
196 .num_dsi_phy = 2,
195}; 197};