|
26 | 26 | #include <drm/drm_print.h> |
27 | 27 |
|
28 | 28 | #include "exynos_drm_drv.h" |
| 29 | +#include "exynos_drm_crtc.h" |
29 | 30 |
|
30 | 31 | /* Sysreg registers for MIC */ |
31 | 32 | #define DSD_CFG_MUX 0x1004 |
@@ -100,9 +101,7 @@ struct exynos_mic { |
100 | 101 |
|
101 | 102 | bool i80_mode; |
102 | 103 | struct videomode vm; |
103 | | - struct drm_encoder *encoder; |
104 | 104 | struct drm_bridge bridge; |
105 | | - struct drm_bridge *next_bridge; |
106 | 105 |
|
107 | 106 | bool enabled; |
108 | 107 | }; |
@@ -229,8 +228,6 @@ static void mic_set_reg_on(struct exynos_mic *mic, bool enable) |
229 | 228 | writel(reg, mic->reg + MIC_OP); |
230 | 229 | } |
231 | 230 |
|
232 | | -static void mic_disable(struct drm_bridge *bridge) { } |
233 | | - |
234 | 231 | static void mic_post_disable(struct drm_bridge *bridge) |
235 | 232 | { |
236 | 233 | struct exynos_mic *mic = bridge->driver_private; |
@@ -297,34 +294,30 @@ static void mic_pre_enable(struct drm_bridge *bridge) |
297 | 294 | mutex_unlock(&mic_mutex); |
298 | 295 | } |
299 | 296 |
|
300 | | -static void mic_enable(struct drm_bridge *bridge) { } |
301 | | - |
302 | | -static int mic_attach(struct drm_bridge *bridge, |
303 | | - enum drm_bridge_attach_flags flags) |
304 | | -{ |
305 | | - struct exynos_mic *mic = bridge->driver_private; |
306 | | - |
307 | | - return drm_bridge_attach(bridge->encoder, mic->next_bridge, |
308 | | - &mic->bridge, flags); |
309 | | -} |
310 | | - |
311 | 297 | static const struct drm_bridge_funcs mic_bridge_funcs = { |
312 | | - .disable = mic_disable, |
313 | 298 | .post_disable = mic_post_disable, |
314 | 299 | .mode_set = mic_mode_set, |
315 | 300 | .pre_enable = mic_pre_enable, |
316 | | - .enable = mic_enable, |
317 | | - .attach = mic_attach, |
318 | 301 | }; |
319 | 302 |
|
320 | 303 | static int exynos_mic_bind(struct device *dev, struct device *master, |
321 | 304 | void *data) |
322 | 305 | { |
323 | 306 | struct exynos_mic *mic = dev_get_drvdata(dev); |
| 307 | + struct drm_device *drm_dev = data; |
| 308 | + struct exynos_drm_crtc *crtc = exynos_drm_crtc_get_by_type(drm_dev, |
| 309 | + EXYNOS_DISPLAY_TYPE_LCD); |
| 310 | + struct drm_encoder *e, *encoder = NULL; |
| 311 | + |
| 312 | + drm_for_each_encoder(e, drm_dev) |
| 313 | + if (e->possible_crtcs == drm_crtc_mask(&crtc->base)) |
| 314 | + encoder = e; |
| 315 | + if (!encoder) |
| 316 | + return -ENODEV; |
324 | 317 |
|
325 | 318 | mic->bridge.driver_private = mic; |
326 | 319 |
|
327 | | - return 0; |
| 320 | + return drm_bridge_attach(encoder, &mic->bridge, NULL, 0); |
328 | 321 | } |
329 | 322 |
|
330 | 323 | static void exynos_mic_unbind(struct device *dev, struct device *master, |
@@ -388,7 +381,6 @@ static int exynos_mic_probe(struct platform_device *pdev) |
388 | 381 | { |
389 | 382 | struct device *dev = &pdev->dev; |
390 | 383 | struct exynos_mic *mic; |
391 | | - struct device_node *remote; |
392 | 384 | struct resource res; |
393 | 385 | int ret, i; |
394 | 386 |
|
@@ -432,16 +424,6 @@ static int exynos_mic_probe(struct platform_device *pdev) |
432 | 424 | } |
433 | 425 | } |
434 | 426 |
|
435 | | - remote = of_graph_get_remote_node(dev->of_node, 1, 0); |
436 | | - mic->next_bridge = of_drm_find_bridge(remote); |
437 | | - if (IS_ERR(mic->next_bridge)) { |
438 | | - DRM_DEV_ERROR(dev, "mic: Failed to find next bridge\n"); |
439 | | - ret = PTR_ERR(mic->next_bridge); |
440 | | - goto err; |
441 | | - } |
442 | | - |
443 | | - of_node_put(remote); |
444 | | - |
445 | 427 | platform_set_drvdata(pdev, mic); |
446 | 428 |
|
447 | 429 | mic->bridge.funcs = &mic_bridge_funcs; |
|
0 commit comments