Commit 622688f3 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Inki Dae

drm/exynos: mic: convert to component framework

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: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 38b5e5f4
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/component.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/regmap.h> #include <linux/regmap.h>
...@@ -373,9 +374,33 @@ void mic_pre_enable(struct drm_bridge *bridge) ...@@ -373,9 +374,33 @@ void mic_pre_enable(struct drm_bridge *bridge)
void mic_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; int i;
mutex_lock(&mic_mutex); mutex_lock(&mic_mutex);
...@@ -387,13 +412,13 @@ void mic_destroy(struct drm_bridge *bridge) ...@@ -387,13 +412,13 @@ void mic_destroy(struct drm_bridge *bridge)
already_disabled: already_disabled:
mutex_unlock(&mic_mutex); mutex_unlock(&mic_mutex);
drm_bridge_remove(&mic->bridge);
} }
static const struct drm_bridge_funcs mic_bridge_funcs = { static const struct component_ops exynos_mic_component_ops = {
.disable = mic_disable, .bind = exynos_mic_bind,
.post_disable = mic_post_disable, .unbind = exynos_mic_unbind,
.pre_enable = mic_pre_enable,
.enable = mic_enable,
}; };
int exynos_mic_probe(struct platform_device *pdev) int exynos_mic_probe(struct platform_device *pdev)
...@@ -435,15 +460,6 @@ int exynos_mic_probe(struct platform_device *pdev) ...@@ -435,15 +460,6 @@ int exynos_mic_probe(struct platform_device *pdev)
goto err; 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++) { for (i = 0; i < NUM_CLKS; i++) {
mic->clks[i] = devm_clk_get(dev, clk_names[i]); mic->clks[i] = devm_clk_get(dev, clk_names[i]);
if (IS_ERR(mic->clks[i])) { if (IS_ERR(mic->clks[i])) {
...@@ -454,7 +470,10 @@ int exynos_mic_probe(struct platform_device *pdev) ...@@ -454,7 +470,10 @@ int exynos_mic_probe(struct platform_device *pdev)
} }
} }
platform_set_drvdata(pdev, mic);
DRM_DEBUG_KMS("MIC has been probed\n"); DRM_DEBUG_KMS("MIC has been probed\n");
return component_add(dev, &exynos_mic_component_ops);
err: err:
return ret; return ret;
...@@ -462,10 +481,7 @@ int exynos_mic_probe(struct platform_device *pdev) ...@@ -462,10 +481,7 @@ int exynos_mic_probe(struct platform_device *pdev)
static int exynos_mic_remove(struct platform_device *pdev) static int exynos_mic_remove(struct platform_device *pdev)
{ {
struct exynos_mic *mic = platform_get_drvdata(pdev); component_del(&pdev->dev, &exynos_mic_component_ops);
drm_bridge_remove(&mic->bridge);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment