dsi.c (3a55445f11e6b1dbdc1e7f2684a519089d2e163c) | dsi.c (8f59ee9a570c2e9dec2b934d924264a64230d5d0) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (c) 2015, The Linux Foundation. All rights reserved. 4 */ 5 6#include "dsi.h" 7 8struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi) --- 98 unchanged lines hidden (view full) --- 107 dsi_destroy(msm_dsi); 108 return ERR_PTR(ret); 109} 110 111static int dsi_bind(struct device *dev, struct device *master, void *data) 112{ 113 struct drm_device *drm = dev_get_drvdata(master); 114 struct msm_drm_private *priv = drm->dev_private; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (c) 2015, The Linux Foundation. All rights reserved. 4 */ 5 6#include "dsi.h" 7 8struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi) --- 98 unchanged lines hidden (view full) --- 107 dsi_destroy(msm_dsi); 108 return ERR_PTR(ret); 109} 110 111static int dsi_bind(struct device *dev, struct device *master, void *data) 112{ 113 struct drm_device *drm = dev_get_drvdata(master); 114 struct msm_drm_private *priv = drm->dev_private; |
115 struct platform_device *pdev = to_platform_device(dev); 116 struct msm_dsi *msm_dsi; | 115 struct msm_dsi *msm_dsi = dev_get_drvdata(dev); |
117 | 116 |
118 DBG(""); 119 msm_dsi = dsi_init(pdev); 120 if (IS_ERR(msm_dsi)) { 121 /* Don't fail the bind if the dsi port is not connected */ 122 if (PTR_ERR(msm_dsi) == -ENODEV) 123 return 0; 124 else 125 return PTR_ERR(msm_dsi); 126 } 127 | |
128 priv->dsi[msm_dsi->id] = msm_dsi; 129 130 return 0; 131} 132 133static void dsi_unbind(struct device *dev, struct device *master, 134 void *data) 135{ 136 struct drm_device *drm = dev_get_drvdata(master); 137 struct msm_drm_private *priv = drm->dev_private; 138 struct msm_dsi *msm_dsi = dev_get_drvdata(dev); | 117 priv->dsi[msm_dsi->id] = msm_dsi; 118 119 return 0; 120} 121 122static void dsi_unbind(struct device *dev, struct device *master, 123 void *data) 124{ 125 struct drm_device *drm = dev_get_drvdata(master); 126 struct msm_drm_private *priv = drm->dev_private; 127 struct msm_dsi *msm_dsi = dev_get_drvdata(dev); |
139 int id = msm_dsi->id; | |
140 | 128 |
141 if (priv->dsi[id]) { 142 dsi_destroy(msm_dsi); 143 priv->dsi[id] = NULL; 144 } | 129 priv->dsi[msm_dsi->id] = NULL; |
145} 146 147static const struct component_ops dsi_ops = { 148 .bind = dsi_bind, 149 .unbind = dsi_unbind, 150}; 151 | 130} 131 132static const struct component_ops dsi_ops = { 133 .bind = dsi_bind, 134 .unbind = dsi_unbind, 135}; 136 |
152static int dsi_dev_probe(struct platform_device *pdev) | 137int dsi_dev_attach(struct platform_device *pdev) |
153{ 154 return component_add(&pdev->dev, &dsi_ops); 155} 156 | 138{ 139 return component_add(&pdev->dev, &dsi_ops); 140} 141 |
142void dsi_dev_detach(struct platform_device *pdev) 143{ 144 component_del(&pdev->dev, &dsi_ops); 145} 146 147static int dsi_dev_probe(struct platform_device *pdev) 148{ 149 struct msm_dsi *msm_dsi; 150 151 DBG(""); 152 msm_dsi = dsi_init(pdev); 153 if (IS_ERR(msm_dsi)) { 154 /* Don't fail the bind if the dsi port is not connected */ 155 if (PTR_ERR(msm_dsi) == -ENODEV) 156 return 0; 157 else 158 return PTR_ERR(msm_dsi); 159 } 160 161 return 0; 162} 163 |
|
157static int dsi_dev_remove(struct platform_device *pdev) 158{ | 164static int dsi_dev_remove(struct platform_device *pdev) 165{ |
166 struct msm_dsi *msm_dsi = platform_get_drvdata(pdev); 167 |
|
159 DBG(""); | 168 DBG(""); |
160 component_del(&pdev->dev, &dsi_ops); | 169 dsi_destroy(msm_dsi); 170 |
161 return 0; 162} 163 164static const struct of_device_id dt_match[] = { 165 { .compatible = "qcom,mdss-dsi-ctrl" }, 166 {} 167}; 168 --- 41 unchanged lines hidden (view full) --- 210 msm_dsi->dev = dev; 211 212 ret = msm_dsi_host_modeset_init(msm_dsi->host, dev); 213 if (ret) { 214 DRM_DEV_ERROR(dev->dev, "failed to modeset init host: %d\n", ret); 215 goto fail; 216 } 217 | 171 return 0; 172} 173 174static const struct of_device_id dt_match[] = { 175 { .compatible = "qcom,mdss-dsi-ctrl" }, 176 {} 177}; 178 --- 41 unchanged lines hidden (view full) --- 220 msm_dsi->dev = dev; 221 222 ret = msm_dsi_host_modeset_init(msm_dsi->host, dev); 223 if (ret) { 224 DRM_DEV_ERROR(dev->dev, "failed to modeset init host: %d\n", ret); 225 goto fail; 226 } 227 |
218 if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) { 219 ret = -EINVAL; | 228 if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) |
220 goto fail; | 229 goto fail; |
221 } | |
222 223 msm_dsi->encoder = encoder; 224 225 msm_dsi->bridge = msm_dsi_manager_bridge_init(msm_dsi->id); 226 if (IS_ERR(msm_dsi->bridge)) { 227 ret = PTR_ERR(msm_dsi->bridge); 228 DRM_DEV_ERROR(dev->dev, "failed to create dsi bridge: %d\n", ret); 229 msm_dsi->bridge = NULL; --- 52 unchanged lines hidden --- | 230 231 msm_dsi->encoder = encoder; 232 233 msm_dsi->bridge = msm_dsi_manager_bridge_init(msm_dsi->id); 234 if (IS_ERR(msm_dsi->bridge)) { 235 ret = PTR_ERR(msm_dsi->bridge); 236 DRM_DEV_ERROR(dev->dev, "failed to create dsi bridge: %d\n", ret); 237 msm_dsi->bridge = NULL; --- 52 unchanged lines hidden --- |