dsi.c (efcbd6f9cdeba0b3fff1c9ceab7ea1cf6e3c5ab4) dsi.c (5f403fd7d5c2a33be51b7f4cd4d0219e314d90f1)
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
8bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)

--- 203 unchanged lines hidden (view full) ---

212 DBG("");
213 msm_dsi_phy_driver_unregister();
214 platform_driver_unregister(&dsi_driver);
215}
216
217int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
218 struct drm_encoder *encoder)
219{
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
8bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)

--- 203 unchanged lines hidden (view full) ---

212 DBG("");
213 msm_dsi_phy_driver_unregister();
214 platform_driver_unregister(&dsi_driver);
215}
216
217int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
218 struct drm_encoder *encoder)
219{
220 struct msm_drm_private *priv = dev->dev_private;
221 int ret;
222
220 int ret;
221
223 if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
224 DRM_DEV_ERROR(dev->dev, "too many bridges\n");
225 return -ENOSPC;
226 }
227
228 msm_dsi->dev = dev;
229
230 ret = msm_dsi_host_modeset_init(msm_dsi->host, dev);
231 if (ret) {
232 DRM_DEV_ERROR(dev->dev, "failed to modeset init host: %d\n", ret);
222 msm_dsi->dev = dev;
223
224 ret = msm_dsi_host_modeset_init(msm_dsi->host, dev);
225 if (ret) {
226 DRM_DEV_ERROR(dev->dev, "failed to modeset init host: %d\n", ret);
233 goto fail;
227 return ret;
234 }
235
236 if (msm_dsi_is_bonded_dsi(msm_dsi) &&
237 !msm_dsi_is_master_dsi(msm_dsi)) {
238 /*
239 * Do not return an eror here,
240 * Just skip creating encoder/connector for the slave-DSI.
241 */
242 return 0;
243 }
244
245 msm_dsi->encoder = encoder;
246
228 }
229
230 if (msm_dsi_is_bonded_dsi(msm_dsi) &&
231 !msm_dsi_is_master_dsi(msm_dsi)) {
232 /*
233 * Do not return an eror here,
234 * Just skip creating encoder/connector for the slave-DSI.
235 */
236 return 0;
237 }
238
239 msm_dsi->encoder = encoder;
240
247 msm_dsi->bridge = msm_dsi_manager_bridge_init(msm_dsi->id);
248 if (IS_ERR(msm_dsi->bridge)) {
249 ret = PTR_ERR(msm_dsi->bridge);
241 ret = msm_dsi_manager_bridge_init(msm_dsi);
242 if (ret) {
250 DRM_DEV_ERROR(dev->dev, "failed to create dsi bridge: %d\n", ret);
243 DRM_DEV_ERROR(dev->dev, "failed to create dsi bridge: %d\n", ret);
251 msm_dsi->bridge = NULL;
252 goto fail;
244 return ret;
253 }
254
255 ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id);
256 if (ret) {
257 DRM_DEV_ERROR(dev->dev,
258 "failed to create dsi connector: %d\n", ret);
245 }
246
247 ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id);
248 if (ret) {
249 DRM_DEV_ERROR(dev->dev,
250 "failed to create dsi connector: %d\n", ret);
259 goto fail;
251 return ret;
260 }
261
252 }
253
262 priv->bridges[priv->num_bridges++] = msm_dsi->bridge;
263
264 return 0;
254 return 0;
265fail:
266 /* bridge/connector are normally destroyed by drm: */
267 if (msm_dsi->bridge) {
268 msm_dsi_manager_bridge_destroy(msm_dsi->bridge);
269 msm_dsi->bridge = NULL;
270 }
271
272 return ret;
273}
274
275void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi)
276{
277 msm_dsi_host_snapshot(disp_state, msm_dsi->host);
278 msm_dsi_phy_snapshot(disp_state, msm_dsi->phy);
279}
280
255}
256
257void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi)
258{
259 msm_dsi_host_snapshot(disp_state, msm_dsi->host);
260 msm_dsi_phy_snapshot(disp_state, msm_dsi->phy);
261}
262