Skip to content

Commit

Permalink
drm/exynos: mic: convert to component framework
Browse files Browse the repository at this point in the history
MIC is SoC component and important part of kms pipeline on Exynos5433,
so convert it to use component framework like other KMS/CRTC drivers.
MIC driver is already listed on KMS component driver list in Exynos DRM
core, so without this conversion, initialization of Exynos DRM core
fails on Exynos 5433 SoC.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
  • Loading branch information
Marek Szyprowski authored and Inki Dae committed Feb 15, 2016
1 parent 38b5e5f commit 622688f
Showing 1 changed file with 36 additions and 20 deletions.
56 changes: 36 additions & 20 deletions drivers/gpu/drm/exynos/exynos_drm_mic.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/clk.h>
#include <linux/component.h>
#include <drm/drmP.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
Expand Down Expand Up @@ -373,9 +374,33 @@ void mic_pre_enable(struct drm_bridge *bridge)

void mic_enable(struct drm_bridge *bridge) { }

void mic_destroy(struct drm_bridge *bridge)
static const struct drm_bridge_funcs mic_bridge_funcs = {
.disable = mic_disable,
.post_disable = mic_post_disable,
.pre_enable = mic_pre_enable,
.enable = mic_enable,
};

static int exynos_mic_bind(struct device *dev, struct device *master,
void *data)
{
struct exynos_mic *mic = bridge->driver_private;
struct exynos_mic *mic = dev_get_drvdata(dev);
int ret;

mic->bridge.funcs = &mic_bridge_funcs;
mic->bridge.of_node = dev->of_node;
mic->bridge.driver_private = mic;
ret = drm_bridge_add(&mic->bridge);
if (ret)
DRM_ERROR("mic: Failed to add MIC to the global bridge list\n");

return ret;
}

static void exynos_mic_unbind(struct device *dev, struct device *master,
void *data)
{
struct exynos_mic *mic = dev_get_drvdata(dev);
int i;

mutex_lock(&mic_mutex);
Expand All @@ -387,13 +412,13 @@ void mic_destroy(struct drm_bridge *bridge)

already_disabled:
mutex_unlock(&mic_mutex);

drm_bridge_remove(&mic->bridge);
}

static const struct drm_bridge_funcs mic_bridge_funcs = {
.disable = mic_disable,
.post_disable = mic_post_disable,
.pre_enable = mic_pre_enable,
.enable = mic_enable,
static const struct component_ops exynos_mic_component_ops = {
.bind = exynos_mic_bind,
.unbind = exynos_mic_unbind,
};

int exynos_mic_probe(struct platform_device *pdev)
Expand Down Expand Up @@ -435,15 +460,6 @@ int exynos_mic_probe(struct platform_device *pdev)
goto err;
}

mic->bridge.funcs = &mic_bridge_funcs;
mic->bridge.of_node = dev->of_node;
mic->bridge.driver_private = mic;
ret = drm_bridge_add(&mic->bridge);
if (ret) {
DRM_ERROR("mic: Failed to add MIC to the global bridge list\n");
goto err;
}

for (i = 0; i < NUM_CLKS; i++) {
mic->clks[i] = devm_clk_get(dev, clk_names[i]);
if (IS_ERR(mic->clks[i])) {
Expand All @@ -454,18 +470,18 @@ int exynos_mic_probe(struct platform_device *pdev)
}
}

platform_set_drvdata(pdev, mic);

DRM_DEBUG_KMS("MIC has been probed\n");
return component_add(dev, &exynos_mic_component_ops);

err:
return ret;
}

static int exynos_mic_remove(struct platform_device *pdev)
{
struct exynos_mic *mic = platform_get_drvdata(pdev);

drm_bridge_remove(&mic->bridge);

component_del(&pdev->dev, &exynos_mic_component_ops);
return 0;
}

Expand Down

0 comments on commit 622688f

Please sign in to comment.