diff options
Diffstat (limited to 'drivers/gpu/drm/msm/dsi/phy/dsi_phy.c')
| -rw-r--r-- | drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 32 |
1 files changed, 28 insertions, 4 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 | */ | ||
| 279 | static 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 | |||
| 274 | static int dsi_phy_driver_probe(struct platform_device *pdev) | 298 | static 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 | } |
