dsi.c (9d32c4989c858af12b333ae9a3c160a91ff43934) | dsi.c (ec31abf6684ebe1134eb3320c96fb92e566eff74) |
---|---|
1/* 2 * Copyright (c) 2015, The Linux Foundation. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 and 6 * only version 2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 9 unchanged lines hidden (view full) --- 18 if (!msm_dsi || !msm_dsi->panel) 19 return NULL; 20 21 return (msm_dsi->panel_flags & MIPI_DSI_MODE_VIDEO) ? 22 msm_dsi->encoders[MSM_DSI_VIDEO_ENCODER_ID] : 23 msm_dsi->encoders[MSM_DSI_CMD_ENCODER_ID]; 24} 25 | 1/* 2 * Copyright (c) 2015, The Linux Foundation. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 and 6 * only version 2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 9 unchanged lines hidden (view full) --- 18 if (!msm_dsi || !msm_dsi->panel) 19 return NULL; 20 21 return (msm_dsi->panel_flags & MIPI_DSI_MODE_VIDEO) ? 22 msm_dsi->encoders[MSM_DSI_VIDEO_ENCODER_ID] : 23 msm_dsi->encoders[MSM_DSI_CMD_ENCODER_ID]; 24} 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) 27{ 28 if (!msm_dsi) 29 return; 30 31 msm_dsi_manager_unregister(msm_dsi); 32 | 54static void dsi_destroy(struct msm_dsi *msm_dsi) 55{ 56 if (!msm_dsi) 57 return; 58 59 msm_dsi_manager_unregister(msm_dsi); 60 |
33 if (msm_dsi->phy) { 34 msm_dsi_phy_destroy(msm_dsi->phy); | 61 if (msm_dsi->phy_dev) { 62 put_device(msm_dsi->phy_dev); |
35 msm_dsi->phy = NULL; | 63 msm_dsi->phy = NULL; |
64 msm_dsi->phy_dev = NULL; |
|
36 } 37 38 if (msm_dsi->host) { 39 msm_dsi_host_destroy(msm_dsi->host); 40 msm_dsi->host = NULL; 41 } 42 43 platform_set_drvdata(msm_dsi->pdev, NULL); 44} 45 46static struct msm_dsi *dsi_init(struct platform_device *pdev) 47{ 48 struct msm_dsi *msm_dsi = NULL; 49 int ret; 50 51 if (!pdev) { | 65 } 66 67 if (msm_dsi->host) { 68 msm_dsi_host_destroy(msm_dsi->host); 69 msm_dsi->host = NULL; 70 } 71 72 platform_set_drvdata(msm_dsi->pdev, NULL); 73} 74 75static struct msm_dsi *dsi_init(struct platform_device *pdev) 76{ 77 struct msm_dsi *msm_dsi = NULL; 78 int ret; 79 80 if (!pdev) { |
52 dev_err(&pdev->dev, "no dsi device\n"); | |
53 ret = -ENXIO; 54 goto fail; 55 } 56 57 msm_dsi = devm_kzalloc(&pdev->dev, sizeof(*msm_dsi), GFP_KERNEL); 58 if (!msm_dsi) { 59 ret = -ENOMEM; 60 goto fail; 61 } 62 DBG("dsi probed=%p", msm_dsi); 63 64 msm_dsi->pdev = pdev; 65 platform_set_drvdata(pdev, msm_dsi); 66 67 /* Init dsi host */ 68 ret = msm_dsi_host_init(msm_dsi); 69 if (ret) 70 goto fail; 71 | 81 ret = -ENXIO; 82 goto fail; 83 } 84 85 msm_dsi = devm_kzalloc(&pdev->dev, sizeof(*msm_dsi), GFP_KERNEL); 86 if (!msm_dsi) { 87 ret = -ENOMEM; 88 goto fail; 89 } 90 DBG("dsi probed=%p", msm_dsi); 91 92 msm_dsi->pdev = pdev; 93 platform_set_drvdata(pdev, msm_dsi); 94 95 /* Init dsi host */ 96 ret = msm_dsi_host_init(msm_dsi); 97 if (ret) 98 goto fail; 99 |
72 /* Init dsi PHY */ 73 msm_dsi->phy = msm_dsi_phy_init(pdev, msm_dsi->phy_type, msm_dsi->id); 74 if (!msm_dsi->phy) { 75 ret = -ENXIO; 76 pr_err("%s: phy init failed\n", __func__); | 100 /* GET dsi PHY */ 101 ret = dsi_get_phy(msm_dsi); 102 if (ret) |
77 goto fail; | 103 goto fail; |
78 } | |
79 80 /* Register to dsi manager */ 81 ret = msm_dsi_manager_register(msm_dsi); 82 if (ret) 83 goto fail; 84 85 return msm_dsi; 86 --- 64 unchanged lines hidden (view full) --- 151 .name = "msm_dsi", 152 .of_match_table = dt_match, 153 }, 154}; 155 156void __init msm_dsi_register(void) 157{ 158 DBG(""); | 104 105 /* Register to dsi manager */ 106 ret = msm_dsi_manager_register(msm_dsi); 107 if (ret) 108 goto fail; 109 110 return msm_dsi; 111 --- 64 unchanged lines hidden (view full) --- 176 .name = "msm_dsi", 177 .of_match_table = dt_match, 178 }, 179}; 180 181void __init msm_dsi_register(void) 182{ 183 DBG(""); |
184 msm_dsi_phy_driver_register(); |
|
159 platform_driver_register(&dsi_driver); 160} 161 162void __exit msm_dsi_unregister(void) 163{ 164 DBG(""); | 185 platform_driver_register(&dsi_driver); 186} 187 188void __exit msm_dsi_unregister(void) 189{ 190 DBG(""); |
191 msm_dsi_phy_driver_unregister(); |
|
165 platform_driver_unregister(&dsi_driver); 166} 167 168int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, 169 struct drm_encoder *encoders[MSM_DSI_ENCODER_NUM]) 170{ 171 struct msm_drm_private *priv = dev->dev_private; 172 int ret, i; --- 54 unchanged lines hidden --- | 192 platform_driver_unregister(&dsi_driver); 193} 194 195int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, 196 struct drm_encoder *encoders[MSM_DSI_ENCODER_NUM]) 197{ 198 struct msm_drm_private *priv = dev->dev_private; 199 int ret, i; --- 54 unchanged lines hidden --- |