Skip to content

Commit 7d78718

Browse files
mszyprowdaeinki
authored andcommitted
drm/exynos: mic: Rework initialization
Commit dd8b680 ("exynos: drm: dsi: Attach in_bridge in MIC driver") moved Exynos MIC attaching from DSI to MIC driver. However the method proposed there is incomplete and cannot really work. To properly attach it to the bridge chain, access to the respective encoder is needed. The Exynos MIC driver always attaches to the encoder created by the Exynos DSI driver, so grab it via available helpers for getting access to the CRTC and encoders. This also requires to change the order of driver component binding to let DSI to be bound before MIC. Fixes: dd8b680 ("exynos: drm: dsi: Attach in_bridge in MIC driver") Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Fixed merge conflict. Signed-off-by: Inki Dae <inki.dae@samsung.com>
1 parent 5c2b745 commit 7d78718

2 files changed

Lines changed: 15 additions & 33 deletions

File tree

drivers/gpu/drm/exynos/exynos_drm_drv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ static struct exynos_drm_driver_info exynos_drm_drivers[] = {
176176
}, {
177177
DRV_PTR(mixer_driver, CONFIG_DRM_EXYNOS_MIXER),
178178
DRM_COMPONENT_DRIVER
179-
}, {
180-
DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
181-
DRM_COMPONENT_DRIVER
182179
}, {
183180
DRV_PTR(dp_driver, CONFIG_DRM_EXYNOS_DP),
184181
DRM_COMPONENT_DRIVER
185182
}, {
186183
DRV_PTR(dsi_driver, CONFIG_DRM_EXYNOS_DSI),
187184
DRM_COMPONENT_DRIVER
185+
}, {
186+
DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
187+
DRM_COMPONENT_DRIVER
188188
}, {
189189
DRV_PTR(hdmi_driver, CONFIG_DRM_EXYNOS_HDMI),
190190
DRM_COMPONENT_DRIVER

drivers/gpu/drm/exynos/exynos_drm_mic.c

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <drm/drm_print.h>
2727

2828
#include "exynos_drm_drv.h"
29+
#include "exynos_drm_crtc.h"
2930

3031
/* Sysreg registers for MIC */
3132
#define DSD_CFG_MUX 0x1004
@@ -100,9 +101,7 @@ struct exynos_mic {
100101

101102
bool i80_mode;
102103
struct videomode vm;
103-
struct drm_encoder *encoder;
104104
struct drm_bridge bridge;
105-
struct drm_bridge *next_bridge;
106105

107106
bool enabled;
108107
};
@@ -229,8 +228,6 @@ static void mic_set_reg_on(struct exynos_mic *mic, bool enable)
229228
writel(reg, mic->reg + MIC_OP);
230229
}
231230

232-
static void mic_disable(struct drm_bridge *bridge) { }
233-
234231
static void mic_post_disable(struct drm_bridge *bridge)
235232
{
236233
struct exynos_mic *mic = bridge->driver_private;
@@ -297,34 +294,30 @@ static void mic_pre_enable(struct drm_bridge *bridge)
297294
mutex_unlock(&mic_mutex);
298295
}
299296

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-
311297
static const struct drm_bridge_funcs mic_bridge_funcs = {
312-
.disable = mic_disable,
313298
.post_disable = mic_post_disable,
314299
.mode_set = mic_mode_set,
315300
.pre_enable = mic_pre_enable,
316-
.enable = mic_enable,
317-
.attach = mic_attach,
318301
};
319302

320303
static int exynos_mic_bind(struct device *dev, struct device *master,
321304
void *data)
322305
{
323306
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;
324317

325318
mic->bridge.driver_private = mic;
326319

327-
return 0;
320+
return drm_bridge_attach(encoder, &mic->bridge, NULL, 0);
328321
}
329322

330323
static void exynos_mic_unbind(struct device *dev, struct device *master,
@@ -388,7 +381,6 @@ static int exynos_mic_probe(struct platform_device *pdev)
388381
{
389382
struct device *dev = &pdev->dev;
390383
struct exynos_mic *mic;
391-
struct device_node *remote;
392384
struct resource res;
393385
int ret, i;
394386

@@ -432,16 +424,6 @@ static int exynos_mic_probe(struct platform_device *pdev)
432424
}
433425
}
434426

435-
remote = of_graph_get_remote_node(dev->of_node, 1, 0);
436-
mic->next_bridge = of_drm_find_bridge(remote);
437-
if (!mic->next_bridge) {
438-
DRM_DEV_ERROR(dev, "mic: Failed to find next bridge\n");
439-
ret = -EPROBE_DEFER;
440-
goto err;
441-
}
442-
443-
of_node_put(remote);
444-
445427
platform_set_drvdata(pdev, mic);
446428

447429
mic->bridge.funcs = &mic_bridge_funcs;

0 commit comments

Comments
 (0)