drm/exynos: dsi: remove global variable exynos_dsi_display

exynos_dsi_display is used by internal Exynos DRM framework for
representing pair encoder->connecter. As it should be mapped 1:1 to dsi
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 DSI devices in the system.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
This commit is contained in:
Andrzej Hajda 2014-10-07 14:01:08 +02:00 committed by Inki Dae
parent 7239067795
commit 2900c69c52
1 changed files with 18 additions and 20 deletions

View File

@ -268,6 +268,7 @@ struct exynos_dsi_driver_data {
}; };
struct exynos_dsi { struct exynos_dsi {
struct exynos_drm_display display;
struct mipi_dsi_host dsi_host; struct mipi_dsi_host dsi_host;
struct drm_connector connector; struct drm_connector connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
@ -1531,10 +1532,6 @@ static struct exynos_drm_display_ops exynos_dsi_display_ops = {
.dpms = exynos_dsi_dpms .dpms = exynos_dsi_dpms
}; };
static struct exynos_drm_display exynos_dsi_display = {
.type = EXYNOS_DISPLAY_TYPE_LCD,
.ops = &exynos_dsi_display_ops,
};
MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); MODULE_DEVICE_TABLE(of, exynos_dsi_of_match);
/* of_* functions will be removed after merge of of_graph patches */ /* of_* functions will be removed after merge of of_graph patches */
@ -1640,28 +1637,28 @@ end:
static int exynos_dsi_bind(struct device *dev, struct device *master, static int exynos_dsi_bind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct exynos_drm_display *display = dev_get_drvdata(dev);
struct exynos_dsi *dsi = display->ctx;
struct drm_device *drm_dev = data; struct drm_device *drm_dev = data;
struct exynos_dsi *dsi;
int ret; int ret;
ret = exynos_drm_create_enc_conn(drm_dev, &exynos_dsi_display); ret = exynos_drm_create_enc_conn(drm_dev, display);
if (ret) { if (ret) {
DRM_ERROR("Encoder create [%d] failed with %d\n", DRM_ERROR("Encoder create [%d] failed with %d\n",
exynos_dsi_display.type, ret); display->type, ret);
return ret; return ret;
} }
dsi = exynos_dsi_display.ctx;
return mipi_dsi_host_register(&dsi->dsi_host); return mipi_dsi_host_register(&dsi->dsi_host);
} }
static void exynos_dsi_unbind(struct device *dev, struct device *master, static void exynos_dsi_unbind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct exynos_dsi *dsi = exynos_dsi_display.ctx; struct exynos_drm_display *display = dev_get_drvdata(dev);
struct exynos_dsi *dsi = display->ctx;
exynos_dsi_dpms(&exynos_dsi_display, DRM_MODE_DPMS_OFF); exynos_dsi_dpms(display, DRM_MODE_DPMS_OFF);
mipi_dsi_host_unregister(&dsi->dsi_host); mipi_dsi_host_unregister(&dsi->dsi_host);
} }
@ -1673,22 +1670,23 @@ static const struct component_ops exynos_dsi_component_ops = {
static int exynos_dsi_probe(struct platform_device *pdev) static int exynos_dsi_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct resource *res; struct resource *res;
struct exynos_dsi *dsi; struct exynos_dsi *dsi;
int ret; int ret;
ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR, dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
exynos_dsi_display.type); if (!dsi)
return -ENOMEM;
dsi->display.type = EXYNOS_DISPLAY_TYPE_LCD;
dsi->display.ops = &exynos_dsi_display_ops;
ret = exynos_drm_component_add(dev, EXYNOS_DEVICE_TYPE_CONNECTOR,
dsi->display.type);
if (ret) if (ret)
return ret; return ret;
dsi = devm_kzalloc(&pdev->dev, sizeof(*dsi), GFP_KERNEL);
if (!dsi) {
dev_err(&pdev->dev, "failed to allocate dsi object.\n");
ret = -ENOMEM;
goto err_del_component;
}
/* To be checked as invalid one */ /* To be checked as invalid one */
dsi->te_gpio = -ENOENT; dsi->te_gpio = -ENOENT;