aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/dsi/dsi_host.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/msm/dsi/dsi_host.c')
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi_host.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index e6a8cd1b6462..80d8594c68ba 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1605,13 +1605,6 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host)
1605 struct device_node *endpoint, *device_node; 1605 struct device_node *endpoint, *device_node;
1606 int ret; 1606 int ret;
1607 1607
1608 ret = of_property_read_u32(np, "qcom,dsi-host-index", &msm_host->id);
1609 if (ret) {
1610 dev_err(dev, "%s: host index not specified, ret=%d\n",
1611 __func__, ret);
1612 return ret;
1613 }
1614
1615 /* 1608 /*
1616 * Get the endpoint of the output port of the DSI host. In our case, 1609 * Get the endpoint of the output port of the DSI host. In our case,
1617 * this is mapped to port number with reg = 1. Don't return an error if 1610 * this is mapped to port number with reg = 1. Don't return an error if
@@ -1659,6 +1652,25 @@ err:
1659 return ret; 1652 return ret;
1660} 1653}
1661 1654
1655static int dsi_host_get_id(struct msm_dsi_host *msm_host)
1656{
1657 struct platform_device *pdev = msm_host->pdev;
1658 const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
1659 struct resource *res;
1660 int i;
1661
1662 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dsi_ctrl");
1663 if (!res)
1664 return -EINVAL;
1665
1666 for (i = 0; i < cfg->num_dsi; i++) {
1667 if (cfg->io_start[i] == res->start)
1668 return i;
1669 }
1670
1671 return -EINVAL;
1672}
1673
1662int msm_dsi_host_init(struct msm_dsi *msm_dsi) 1674int msm_dsi_host_init(struct msm_dsi *msm_dsi)
1663{ 1675{
1664 struct msm_dsi_host *msm_host = NULL; 1676 struct msm_dsi_host *msm_host = NULL;
@@ -1695,6 +1707,13 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
1695 goto fail; 1707 goto fail;
1696 } 1708 }
1697 1709
1710 msm_host->id = dsi_host_get_id(msm_host);
1711 if (msm_host->id < 0) {
1712 ret = msm_host->id;
1713 pr_err("%s: unable to identify DSI host index\n", __func__);
1714 goto fail;
1715 }
1716
1698 /* fixup base address by io offset */ 1717 /* fixup base address by io offset */
1699 msm_host->ctrl_base += msm_host->cfg_hnd->cfg->io_offset; 1718 msm_host->ctrl_base += msm_host->cfg_hnd->cfg->io_offset;
1700 1719