Commit 930865fb authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Inki Dae

drm/exynos/hdmi: embed display into private context

exynos_drm_display is used by internal Exynos DRM framework for
representing encoder:connector pair. As it should be mapped 1:1 to hdmi
private context it seems more reasonable to embed it directly in that context.
As a result further code simplification will be possible.
Moreover it will be possible to handle multiple hdmi devices in the system.
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 400c8ac8
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <media/s5p_hdmi.h> #include <media/s5p_hdmi.h>
#define get_hdmi_display(dev) platform_get_drvdata(to_platform_device(dev))
#define ctx_from_connector(c) container_of(c, struct hdmi_context, connector) #define ctx_from_connector(c) container_of(c, struct hdmi_context, connector)
#define HOTPLUG_DEBOUNCE_MS 1100 #define HOTPLUG_DEBOUNCE_MS 1100
...@@ -182,6 +181,7 @@ struct hdmi_conf_regs { ...@@ -182,6 +181,7 @@ struct hdmi_conf_regs {
}; };
struct hdmi_context { struct hdmi_context {
struct exynos_drm_display display;
struct device *dev; struct device *dev;
struct drm_device *drm_dev; struct drm_device *drm_dev;
struct drm_connector connector; struct drm_connector connector;
...@@ -2143,11 +2143,6 @@ static struct exynos_drm_display_ops hdmi_display_ops = { ...@@ -2143,11 +2143,6 @@ static struct exynos_drm_display_ops hdmi_display_ops = {
.commit = hdmi_commit, .commit = hdmi_commit,
}; };
static struct exynos_drm_display hdmi_display = {
.type = EXYNOS_DISPLAY_TYPE_HDMI,
.ops = &hdmi_display_ops,
};
static void hdmi_hotplug_work_func(struct work_struct *work) static void hdmi_hotplug_work_func(struct work_struct *work)
{ {
struct hdmi_context *hdata; struct hdmi_context *hdata;
...@@ -2302,12 +2297,11 @@ MODULE_DEVICE_TABLE (of, hdmi_match_types); ...@@ -2302,12 +2297,11 @@ MODULE_DEVICE_TABLE (of, hdmi_match_types);
static int hdmi_bind(struct device *dev, struct device *master, void *data) static int hdmi_bind(struct device *dev, struct device *master, void *data)
{ {
struct drm_device *drm_dev = data; struct drm_device *drm_dev = data;
struct hdmi_context *hdata; struct hdmi_context *hdata = dev_get_drvdata(dev);
hdata = hdmi_display.ctx;
hdata->drm_dev = drm_dev; hdata->drm_dev = drm_dev;
return exynos_drm_create_enc_conn(drm_dev, &hdmi_display); return exynos_drm_create_enc_conn(drm_dev, &hdata->display);
} }
static void hdmi_unbind(struct device *dev, struct device *master, void *data) static void hdmi_unbind(struct device *dev, struct device *master, void *data)
...@@ -2349,31 +2343,28 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2349,31 +2343,28 @@ static int hdmi_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
int ret; int ret;
ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR, if (!dev->of_node)
hdmi_display.type); return -ENODEV;
if (ret)
return ret;
if (!dev->of_node) {
ret = -ENODEV;
goto err_del_component;
}
pdata = drm_hdmi_dt_parse_pdata(dev); pdata = drm_hdmi_dt_parse_pdata(dev);
if (!pdata) { if (!pdata)
ret = -EINVAL; return -EINVAL;
goto err_del_component;
}
hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL); hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
if (!hdata) { if (!hdata)
ret = -ENOMEM; return -ENOMEM;
goto err_del_component;
} hdata->display.type = EXYNOS_DISPLAY_TYPE_HDMI;
hdata->display.ops = &hdmi_display_ops;
ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR,
hdata->display.type);
if (ret)
return ret;
mutex_init(&hdata->hdmi_mutex); mutex_init(&hdata->hdmi_mutex);
platform_set_drvdata(pdev, &hdmi_display); platform_set_drvdata(pdev, hdata);
match = of_match_node(hdmi_match_types, dev->of_node); match = of_match_node(hdmi_match_types, dev->of_node);
if (!match) { if (!match) {
...@@ -2485,7 +2476,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2485,7 +2476,7 @@ static int hdmi_probe(struct platform_device *pdev)
} }
pm_runtime_enable(dev); pm_runtime_enable(dev);
hdmi_display.ctx = hdata; hdata->display.ctx = hdata;
ret = component_add(&pdev->dev, &hdmi_component_ops); ret = component_add(&pdev->dev, &hdmi_component_ops);
if (ret) if (ret)
...@@ -2510,7 +2501,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2510,7 +2501,7 @@ static int hdmi_probe(struct platform_device *pdev)
static int hdmi_remove(struct platform_device *pdev) static int hdmi_remove(struct platform_device *pdev)
{ {
struct hdmi_context *hdata = hdmi_display.ctx; struct hdmi_context *hdata = platform_get_drvdata(pdev);
cancel_delayed_work_sync(&hdata->hotplug_work); cancel_delayed_work_sync(&hdata->hotplug_work);
......
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