aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/dsi/dsi.c
diff options
context:
space:
mode:
authorHai Li <hali@codeaurora.org>2015-05-15 13:04:06 -0400
committerRob Clark <robdclark@gmail.com>2015-06-11 13:11:05 -0400
commitec31abf6684ebe1134eb3320c96fb92e566eff74 (patch)
tree14d254e9bab8f098451bb2b2a92aa8fffa196e5d /drivers/gpu/drm/msm/dsi/dsi.c
parent9d32c4989c858af12b333ae9a3c160a91ff43934 (diff)
drm/msm/dsi: Separate PHY to another platform device
There are different types of PHY from one chipset to another, while the DSI host controller is relatively consistent across platforms. Also, the PLL inside PHY is providing the source of DSI byte and pixel clocks, which are used by DSI host controller. Separated devices for clock provider and clock consumer make DSI driver better fit into common clock framework. Signed-off-by: Hai Li <hali@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/dsi/dsi.c')
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index beb26dfca276..1f2561e2ff71 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -23,6 +23,34 @@ struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi)
23 msm_dsi->encoders[MSM_DSI_CMD_ENCODER_ID]; 23 msm_dsi->encoders[MSM_DSI_CMD_ENCODER_ID];
24} 24}
25 25
26static int dsi_get_phy(struct msm_dsi *msm_dsi)
27{
28 struct platform_device *pdev = msm_dsi->pdev;
29 struct platform_device *phy_pdev;
30 struct device_node *phy_node;
31
32 phy_node = of_parse_phandle(pdev->dev.of_node, "qcom,dsi-phy", 0);
33 if (!phy_node) {
34 dev_err(&pdev->dev, "cannot find phy device\n");
35 return -ENXIO;
36 }
37
38 phy_pdev = of_find_device_by_node(phy_node);
39 if (phy_pdev)
40 msm_dsi->phy = platform_get_drvdata(phy_pdev);
41
42 of_node_put(phy_node);
43
44 if (!phy_pdev || !msm_dsi->phy) {
45 dev_err(&pdev->dev, "%s: phy driver is not ready\n", __func__);
46 return -EPROBE_DEFER;
47 }
48
49 msm_dsi->phy_dev = get_device(&phy_pdev->dev);
50
51 return 0;
52}
53
26static void dsi_destroy(struct msm_dsi *msm_dsi) 54static void dsi_destroy(struct msm_dsi *msm_dsi)
27{ 55{
28 if (!msm_dsi) 56 if (!msm_dsi)
@@ -30,9 +58,10 @@ static void dsi_destroy(struct msm_dsi *msm_dsi)
30 58
31 msm_dsi_manager_unregister(msm_dsi); 59 msm_dsi_manager_unregister(msm_dsi);
32 60
33 if (msm_dsi->phy) { 61 if (msm_dsi->phy_dev) {
34 msm_dsi_phy_destroy(msm_dsi->phy); 62 put_device(msm_dsi->phy_dev);
35 msm_dsi->phy = NULL; 63 msm_dsi->phy = NULL;
64 msm_dsi->phy_dev = NULL;
36 } 65 }
37 66
38 if (msm_dsi->host) { 67 if (msm_dsi->host) {
@@ -49,7 +78,6 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev)
49 int ret; 78 int ret;
50 79
51 if (!pdev) { 80 if (!pdev) {
52 dev_err(&pdev->dev, "no dsi device\n");
53 ret = -ENXIO; 81 ret = -ENXIO;
54 goto fail; 82 goto fail;
55 } 83 }
@@ -69,13 +97,10 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev)
69 if (ret) 97 if (ret)
70 goto fail; 98 goto fail;
71 99
72 /* Init dsi PHY */ 100 /* GET dsi PHY */
73 msm_dsi->phy = msm_dsi_phy_init(pdev, msm_dsi->phy_type, msm_dsi->id); 101 ret = dsi_get_phy(msm_dsi);
74 if (!msm_dsi->phy) { 102 if (ret)
75 ret = -ENXIO;
76 pr_err("%s: phy init failed\n", __func__);
77 goto fail; 103 goto fail;
78 }
79 104
80 /* Register to dsi manager */ 105 /* Register to dsi manager */
81 ret = msm_dsi_manager_register(msm_dsi); 106 ret = msm_dsi_manager_register(msm_dsi);
@@ -156,12 +181,14 @@ static struct platform_driver dsi_driver = {
156void __init msm_dsi_register(void) 181void __init msm_dsi_register(void)
157{ 182{
158 DBG(""); 183 DBG("");
184 msm_dsi_phy_driver_register();
159 platform_driver_register(&dsi_driver); 185 platform_driver_register(&dsi_driver);
160} 186}
161 187
162void __exit msm_dsi_unregister(void) 188void __exit msm_dsi_unregister(void)
163{ 189{
164 DBG(""); 190 DBG("");
191 msm_dsi_phy_driver_unregister();
165 platform_driver_unregister(&dsi_driver); 192 platform_driver_unregister(&dsi_driver);
166} 193}
167 194