From 04b1fc0291674666110fffd09b30d8304aaa4602 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Tue, 14 May 2013 10:55:19 +0300 Subject: OMAPDRM: fix overlay manager handling Currently omapdrm creates crtcs, which map directly to DSS overlay managers, only on demand at init time. This would make it difficult to manage connecting the display entities in the future, as the code cannot just search for a suitable overlay manager. We cannot fix this the sane way, which would be to create crtcs for each overlay manager, because we need an overlay for each crtc. With limited number of overlays, that's not possible. So the solution for now is to detach the overlay manager from the crtc. crtcs are still created on demand at init time, but all overlay managers are always initialized by the omapdss. This way we can create and connect whole display pipelines from the overlay manager to the display, regardless of which crtcs omapdrm would create. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c') diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 79b200aee18..02075bfcd8f 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -40,7 +40,7 @@ struct omap_crtc { * mgr->id.) Eventually this will be replaced w/ something * more common-panel-framework-y */ - struct omap_overlay_manager mgr; + struct omap_overlay_manager *mgr; struct omap_video_timings timings; bool enabled; @@ -90,6 +90,9 @@ uint32_t pipe2vbl(struct drm_crtc *crtc) * job of sequencing the setup of the video pipe in the proper order */ +/* ovl-mgr-id -> crtc */ +static struct omap_crtc *omap_crtcs[8]; + /* we can probably ignore these until we support command-mode panels: */ static void omap_crtc_start_update(struct omap_overlay_manager *mgr) { @@ -107,7 +110,7 @@ static void omap_crtc_disable(struct omap_overlay_manager *mgr) static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, const struct omap_video_timings *timings) { - struct omap_crtc *omap_crtc = container_of(mgr, struct omap_crtc, mgr); + struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; DBG("%s", omap_crtc->name); omap_crtc->timings = *timings; omap_crtc->full_update = true; @@ -116,7 +119,7 @@ static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, static void omap_crtc_set_lcd_config(struct omap_overlay_manager *mgr, const struct dss_lcd_mgr_config *config) { - struct omap_crtc *omap_crtc = container_of(mgr, struct omap_crtc, mgr); + struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; DBG("%s", omap_crtc->name); dispc_mgr_set_lcd_config(omap_crtc->channel, config); } @@ -569,7 +572,7 @@ static void omap_crtc_pre_apply(struct omap_drm_apply *apply) } else { if (encoder) { omap_encoder_set_enabled(encoder, false); - omap_encoder_update(encoder, &omap_crtc->mgr, + omap_encoder_update(encoder, omap_crtc->mgr, &omap_crtc->timings); omap_encoder_set_enabled(encoder, true); omap_crtc->full_update = false; @@ -595,6 +598,11 @@ static const char *channel_names[] = { [OMAP_DSS_CHANNEL_LCD2] = "lcd2", }; +void omap_crtc_pre_init(void) +{ + dss_install_mgr_ops(&mgr_ops); +} + /* initialize crtc */ struct drm_crtc *omap_crtc_init(struct drm_device *dev, struct drm_plane *plane, enum omap_channel channel, int id) @@ -635,9 +643,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, omap_irq_register(dev, &omap_crtc->error_irq); /* temporary: */ - omap_crtc->mgr.id = channel; - - dss_install_mgr_ops(&mgr_ops); + omap_crtc->mgr = omap_dss_get_overlay_manager(channel); /* TODO: fix hard-coded setup.. add properties! */ info = &omap_crtc->info; @@ -651,6 +657,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, omap_plane_install_properties(omap_crtc->plane, &crtc->base); + omap_crtcs[channel] = omap_crtc; + return crtc; fail: -- cgit v1.2.3-70-g09d2 From a7e71e7f9fc7924921081aa55ceafca00d2c9f49 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 8 May 2013 16:23:32 +0300 Subject: OMAPDSS: Implement display (dis)connect support We currently have two steps in panel initialization and startup: probing and enabling. After the panel has been probed, it's ready and can be configured and later enabled. This model is not enough with more complex display pipelines, where we may have, for example, two panels, of which only one can be used at a time, connected to the same video output. To support that kind of scenarios, we need to add new step to the initialization: connect. This patch adds support for connecting and disconnecting panels. After probe, but before connect, no panel ops should be called. When the connect is called, a proper video pipeline is established, and the panel is ready for use. If some part in the video pipeline is already connected (by some other panel), the connect call fails. One key difference with the old style setup is that connect() handles also connecting to the overlay manager. This means that the omapfb (or omapdrm) no longer needs to figure out which overlay manager to use, but it can just call connect() on the panel, and the proper overlay manager is connected by omapdss. This also allows us to add back the support for dynamic switching between two exclusive panels. However, the current panel device model is not changed to support this, as the new device model is implemented in the following patches and the old model will be removed. The new device model supports dynamic switching. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 24 +++++++++++++++++ drivers/gpu/drm/omapdrm/omap_drv.c | 12 ++++++++- drivers/video/omap2/dss/apply.c | 14 ++++++++++ drivers/video/omap2/dss/core.c | 44 +++++++++++++++++++++++++++++++ drivers/video/omap2/dss/display-sysfs.c | 28 +++++++++++--------- drivers/video/omap2/dss/manager-sysfs.c | 45 ++++++++++++++++++++------------ drivers/video/omap2/dss/output.c | 14 ++++++++++ drivers/video/omap2/omapfb/omapfb-main.c | 25 ++++++++++-------- include/video/omapdss.h | 23 ++++++++++++++++ 9 files changed, 188 insertions(+), 41 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c') diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 02075bfcd8f..b2ab2f5d3cb 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -94,6 +94,28 @@ uint32_t pipe2vbl(struct drm_crtc *crtc) static struct omap_crtc *omap_crtcs[8]; /* we can probably ignore these until we support command-mode panels: */ +static int omap_crtc_connect(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst) +{ + if (mgr->output) + return -EINVAL; + + if ((mgr->supported_outputs & dst->id) == 0) + return -EINVAL; + + dst->manager = mgr; + mgr->output = dst; + + return 0; +} + +static void omap_crtc_disconnect(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst) +{ + mgr->output->manager = NULL; + mgr->output = NULL; +} + static void omap_crtc_start_update(struct omap_overlay_manager *mgr) { } @@ -138,6 +160,8 @@ static void omap_crtc_unregister_framedone_handler( } static const struct dss_mgr_ops mgr_ops = { + .connect = omap_crtc_connect, + .disconnect = omap_crtc_disconnect, .start_update = omap_crtc_start_update, .enable = omap_crtc_enable, .disable = omap_crtc_disable, diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index ff9b49276b8..c65dd0d6b01 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -97,6 +97,7 @@ static int omap_modeset_init(struct drm_device *dev) int num_mgrs = dss_feat_get_num_mgrs(); int num_crtcs; int i, id = 0; + int r; omap_crtc_pre_init(); @@ -118,6 +119,7 @@ static int omap_modeset_init(struct drm_device *dev) struct drm_connector *connector; struct drm_encoder *encoder; enum omap_channel channel; + struct omap_overlay_manager *mgr; if (!dssdev->driver) { dev_warn(dev->dev, "%s has no driver.. skipping it\n", @@ -133,6 +135,13 @@ static int omap_modeset_init(struct drm_device *dev) continue; } + r = dssdev->driver->connect(dssdev); + if (r) { + dev_err(dev->dev, "could not connect display: %s\n", + dssdev->name); + continue; + } + encoder = omap_encoder_init(dev, dssdev); if (!encoder) { @@ -174,8 +183,9 @@ static int omap_modeset_init(struct drm_device *dev) * other possible channels to which the encoder can connect are * not considered. */ - channel = dssdev->output->dispc_channel; + mgr = omapdss_find_mgr_from_display(dssdev); + channel = mgr->id; /* * if this channel hasn't already been taken by a previously * allocated crtc, we create a new crtc for it diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index c844071e8e2..dbd3c2f28a8 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c @@ -790,6 +790,18 @@ static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr) } } +static int dss_mgr_connect_compat(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst) +{ + return mgr->set_output(mgr, dst); +} + +static void dss_mgr_disconnect_compat(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst) +{ + mgr->unset_output(mgr); +} + static void dss_mgr_start_update_compat(struct omap_overlay_manager *mgr) { struct mgr_priv_data *mp = get_mgr_priv(mgr); @@ -1552,6 +1564,8 @@ static void dss_mgr_unregister_framedone_handler_compat(struct omap_overlay_mana } static const struct dss_mgr_ops apply_mgr_ops = { + .connect = dss_mgr_connect_compat, + .disconnect = dss_mgr_disconnect_compat, .start_update = dss_mgr_start_update_compat, .enable = dss_mgr_enable_compat, .disable = dss_mgr_disable_compat, diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 710e9f9a443..831abec565f 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -379,6 +379,46 @@ static int dss_driver_remove(struct device *dev) return 0; } +static int omapdss_default_connect(struct omap_dss_device *dssdev) +{ + struct omap_dss_output *out; + struct omap_overlay_manager *mgr; + int r; + + out = dssdev->output; + + if (out == NULL) + return -ENODEV; + + mgr = omap_dss_get_overlay_manager(out->dispc_channel); + if (!mgr) + return -ENODEV; + + r = dss_mgr_connect(mgr, out); + if (r) + return r; + + return 0; +} + +static void omapdss_default_disconnect(struct omap_dss_device *dssdev) +{ + struct omap_dss_output *out; + struct omap_overlay_manager *mgr; + + out = dssdev->output; + + if (out == NULL) + return; + + mgr = out->manager; + + if (mgr == NULL) + return; + + dss_mgr_disconnect(mgr, out); +} + int omap_dss_register_driver(struct omap_dss_driver *dssdriver) { dssdriver->driver.bus = &dss_bus_type; @@ -392,6 +432,10 @@ int omap_dss_register_driver(struct omap_dss_driver *dssdriver) omapdss_default_get_recommended_bpp; if (dssdriver->get_timings == NULL) dssdriver->get_timings = omapdss_default_get_timings; + if (dssdriver->connect == NULL) + dssdriver->connect = omapdss_default_connect; + if (dssdriver->disconnect == NULL) + dssdriver->disconnect = omapdss_default_disconnect; return driver_register(&dssdriver->driver); } diff --git a/drivers/video/omap2/dss/display-sysfs.c b/drivers/video/omap2/dss/display-sysfs.c index 18211a9ab35..81d5dc6e509 100644 --- a/drivers/video/omap2/dss/display-sysfs.c +++ b/drivers/video/omap2/dss/display-sysfs.c @@ -33,9 +33,9 @@ static ssize_t display_enabled_show(struct device *dev, struct device_attribute *attr, char *buf) { struct omap_dss_device *dssdev = to_dss_device(dev); - bool enabled = dssdev->state != OMAP_DSS_DISPLAY_DISABLED; - return snprintf(buf, PAGE_SIZE, "%d\n", enabled); + return snprintf(buf, PAGE_SIZE, "%d\n", + omapdss_device_is_enabled(dssdev)); } static ssize_t display_enabled_store(struct device *dev, @@ -44,20 +44,24 @@ static ssize_t display_enabled_store(struct device *dev, { struct omap_dss_device *dssdev = to_dss_device(dev); int r; - bool enabled; + bool enable; - r = strtobool(buf, &enabled); + r = strtobool(buf, &enable); if (r) return r; - if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) { - if (enabled) { - r = dssdev->driver->enable(dssdev); - if (r) - return r; - } else { - dssdev->driver->disable(dssdev); - } + if (enable == omapdss_device_is_enabled(dssdev)) + return size; + + if (omapdss_device_is_connected(dssdev) == false) + return -ENODEV; + + if (enable) { + r = dssdev->driver->enable(dssdev); + if (r) + return r; + } else { + dssdev->driver->disable(dssdev); } return size; diff --git a/drivers/video/omap2/dss/manager-sysfs.c b/drivers/video/omap2/dss/manager-sysfs.c index 72784b3aad2..de7e7b5b1b7 100644 --- a/drivers/video/omap2/dss/manager-sysfs.c +++ b/drivers/video/omap2/dss/manager-sysfs.c @@ -50,6 +50,7 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr, int r = 0; size_t len = size; struct omap_dss_device *dssdev = NULL; + struct omap_dss_device *old_dssdev; int match(struct omap_dss_device *dssdev, void *data) { @@ -66,34 +67,44 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr, if (len > 0 && dssdev == NULL) return -EINVAL; - if (dssdev) + if (dssdev) { DSSDBG("display %s found\n", dssdev->name); - if (mgr->output) { - r = mgr->unset_output(mgr); - if (r) { - DSSERR("failed to unset current output\n"); + if (omapdss_device_is_connected(dssdev)) { + DSSERR("new display is already connected\n"); + r = -EINVAL; + goto put_device; + } + + if (omapdss_device_is_enabled(dssdev)) { + DSSERR("new display is not disabled\n"); + r = -EINVAL; goto put_device; } } - if (dssdev) { - struct omap_dss_output *out; + old_dssdev = mgr->get_device(mgr); + if (old_dssdev) { + if (omapdss_device_is_enabled(old_dssdev)) { + DSSERR("old display is not disabled\n"); + r = -EINVAL; + goto put_device; + } - out = omapdss_find_output_from_display(dssdev); + old_dssdev->driver->disconnect(old_dssdev); + } - /* - * a registered device should have an output connected to it - * already - */ - if (!out) { - DSSERR("device has no output connected to it\n"); + if (dssdev) { + r = dssdev->driver->connect(dssdev); + if (r) { + DSSERR("failed to connect new device\n"); goto put_device; } - r = mgr->set_output(mgr, out); - if (r) { - DSSERR("failed to set manager output\n"); + old_dssdev = mgr->get_device(mgr); + if (old_dssdev != dssdev) { + DSSERR("failed to connect device to this manager\n"); + dssdev->driver->disconnect(dssdev); goto put_device; } diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c index ab2c0f0ab24..a53b08b2249 100644 --- a/drivers/video/omap2/dss/output.c +++ b/drivers/video/omap2/dss/output.c @@ -179,6 +179,20 @@ void dss_uninstall_mgr_ops(void) } EXPORT_SYMBOL(dss_uninstall_mgr_ops); +int dss_mgr_connect(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst) +{ + return dss_mgr_ops->connect(mgr, dst); +} +EXPORT_SYMBOL(dss_mgr_connect); + +void dss_mgr_disconnect(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst) +{ + dss_mgr_ops->disconnect(mgr, dst); +} +EXPORT_SYMBOL(dss_mgr_disconnect); + void dss_mgr_set_timings(struct omap_overlay_manager *mgr, const struct omap_video_timings *timings) { diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index cc8953c4faa..528e453e8e1 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c @@ -1853,6 +1853,8 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) dssdev->driver->disable(dssdev); + dssdev->driver->disconnect(dssdev); + omap_dss_put_device(dssdev); } @@ -2363,22 +2365,23 @@ static int omapfb_init_connections(struct omapfb2_device *fbdev, int i, r; struct omap_overlay_manager *mgr; + r = def_dssdev->driver->connect(def_dssdev); + if (r) { + dev_err(fbdev->dev, "failed to connect default display\n"); + return r; + } + for (i = 0; i < fbdev->num_displays; ++i) { struct omap_dss_device *dssdev = fbdev->displays[i].dssdev; - struct omap_dss_output *out; - out = omapdss_find_output_from_display(dssdev); - if (!out) + if (dssdev == def_dssdev) continue; - mgr = omap_dss_get_overlay_manager(out->dispc_channel); - if (!mgr) - continue; - - if (mgr->output) - mgr->unset_output(mgr); - - mgr->set_output(mgr, out); + /* + * We don't care if the connect succeeds or not. We just want to + * connect as many displays as possible. + */ + dssdev->driver->connect(dssdev); } mgr = omapdss_find_mgr_from_display(def_dssdev); diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 898f8124785..4f52f523fba 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -689,6 +689,9 @@ struct omap_dss_driver { int (*probe)(struct omap_dss_device *); void (*remove)(struct omap_dss_device *); + int (*connect)(struct omap_dss_device *dssdev); + void (*disconnect)(struct omap_dss_device *dssdev); + int (*enable)(struct omap_dss_device *display); void (*disable)(struct omap_dss_device *display); int (*run_test)(struct omap_dss_device *display, int test); @@ -889,6 +892,11 @@ int omapdss_compat_init(void); void omapdss_compat_uninit(void); struct dss_mgr_ops { + int (*connect)(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst); + void (*disconnect)(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst); + void (*start_update)(struct omap_overlay_manager *mgr); int (*enable)(struct omap_overlay_manager *mgr); void (*disable)(struct omap_overlay_manager *mgr); @@ -905,6 +913,10 @@ struct dss_mgr_ops { int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops); void dss_uninstall_mgr_ops(void); +int dss_mgr_connect(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst); +void dss_mgr_disconnect(struct omap_overlay_manager *mgr, + struct omap_dss_output *dst); void dss_mgr_set_timings(struct omap_overlay_manager *mgr, const struct omap_video_timings *timings); void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, @@ -916,4 +928,15 @@ int dss_mgr_register_framedone_handler(struct omap_overlay_manager *mgr, void (*handler)(void *), void *data); void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr, void (*handler)(void *), void *data); + +static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev) +{ + return dssdev->output; +} + +static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev) +{ + return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE; +} + #endif -- cgit v1.2.3-70-g09d2 From 1f68d9c4b660487c5878c4800ff5a402abc6c005 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 19 Apr 2013 15:09:34 +0300 Subject: OMAPDSS: combine omap_dss_output into omap_dss_device We currently have omap_dss_device, which represents an external display device, sometimes an external encoder, sometimes a panel. Then we have omap_dss_output, which represents DSS's output encoder. In the future with new display device model, we construct a video pipeline from the display blocks. To accomplish this, all the blocks need to be presented by the same entity. Thus, this patch combines omap_dss_output into omap_dss_device. Some of the fields in omap_dss_output are already found in omap_dss_device, but some are not. This means we'll have DSS output specific fields in omap_dss_device, which is not very nice. However, it is easier to just keep those output specific fields there for now, and after transition to new display device model is made, they can be cleaned up easier than could be done now. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 4 +-- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/video/omap2/dss/apply.c | 6 ++-- drivers/video/omap2/dss/core.c | 4 +-- drivers/video/omap2/dss/dpi.c | 12 +++---- drivers/video/omap2/dss/dsi.c | 18 +++++----- drivers/video/omap2/dss/dss.h | 4 +-- drivers/video/omap2/dss/hdmi.c | 12 +++---- drivers/video/omap2/dss/output.c | 32 +++++++++--------- drivers/video/omap2/dss/rfbi.c | 14 ++++---- drivers/video/omap2/dss/sdi.c | 12 +++---- drivers/video/omap2/dss/venc.c | 12 +++---- include/video/omapdss.h | 66 +++++++++++++++++-------------------- 13 files changed, 96 insertions(+), 102 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c') diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index b2ab2f5d3cb..4cec678dba9 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -95,7 +95,7 @@ static struct omap_crtc *omap_crtcs[8]; /* we can probably ignore these until we support command-mode panels: */ static int omap_crtc_connect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { if (mgr->output) return -EINVAL; @@ -110,7 +110,7 @@ static int omap_crtc_connect(struct omap_overlay_manager *mgr, } static void omap_crtc_disconnect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { mgr->output->manager = NULL; mgr->output = NULL; diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index c65dd0d6b01..78a78c6ea57 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -259,7 +259,7 @@ static int omap_modeset_init(struct drm_device *dev) struct drm_encoder *encoder = priv->encoders[i]; struct omap_dss_device *dssdev = omap_encoder_get_dssdev(encoder); - struct omap_dss_output *output; + struct omap_dss_device *output; output = omapdss_find_output_from_display(dssdev); diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index ced656ae705..752b9859290 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c @@ -791,13 +791,13 @@ static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr) } static int dss_mgr_connect_compat(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { return mgr->set_output(mgr, dst); } static void dss_mgr_disconnect_compat(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { mgr->unset_output(mgr); } @@ -1166,7 +1166,7 @@ static void dss_mgr_get_info(struct omap_overlay_manager *mgr, } static int dss_mgr_set_output(struct omap_overlay_manager *mgr, - struct omap_dss_output *output) + struct omap_dss_device *output) { int r; diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 7118449919c..1aeb274e30f 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -353,7 +353,7 @@ static int dss_driver_remove(struct device *dev) static int omapdss_default_connect(struct omap_dss_device *dssdev) { - struct omap_dss_output *out; + struct omap_dss_device *out; struct omap_overlay_manager *mgr; int r; @@ -375,7 +375,7 @@ static int omapdss_default_connect(struct omap_dss_device *dssdev) static void omapdss_default_disconnect(struct omap_dss_device *dssdev) { - struct omap_dss_output *out; + struct omap_dss_device *out; struct omap_overlay_manager *mgr; out = dssdev->output; diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index e8cbf86eff9..482b918757b 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -48,7 +48,7 @@ static struct { struct dss_lcd_mgr_config mgr_config; int data_lines; - struct omap_dss_output output; + struct omap_dss_device output; } dpi; static struct platform_device *dpi_get_dsidev(enum omap_channel channel) @@ -347,7 +347,7 @@ static void dpi_config_lcd_manager(struct omap_overlay_manager *mgr) int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &dpi.output; + struct omap_dss_device *out = &dpi.output; int r; mutex_lock(&dpi.lock); @@ -680,11 +680,11 @@ static int dpi_probe_pdata(struct platform_device *dpidev) static void dpi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &dpi.output; + struct omap_dss_device *out = &dpi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_DPI; - out->type = OMAP_DISPLAY_TYPE_DPI; + out->output_type = OMAP_DISPLAY_TYPE_DPI; out->name = "dpi.0"; out->dispc_channel = dpi_get_channel(); @@ -693,7 +693,7 @@ static void dpi_init_output(struct platform_device *pdev) static void __exit dpi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &dpi.output; + struct omap_dss_device *out = &dpi.output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 26aa4c324c1..88780731f7a 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -363,7 +363,7 @@ struct dsi_data { enum omap_dss_dsi_mode mode; struct omap_dss_dsi_videomode_timings vm_timings; - struct omap_dss_output output; + struct omap_dss_device output; }; struct dsi_packet_sent_handler_data { @@ -383,12 +383,12 @@ static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dside static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev) { - return dssdev->output->pdev; + return to_platform_device(dssdev->output->dev); } struct platform_device *dsi_get_dsidev_from_id(int module) { - struct omap_dss_output *out; + struct omap_dss_device *out; enum omap_dss_output_id id; switch (module) { @@ -404,7 +404,7 @@ struct platform_device *dsi_get_dsidev_from_id(int module) out = omap_dss_get_output(id); - return out ? out->pdev : NULL; + return out ? to_platform_device(out->dev) : NULL; } static inline void dsi_write_reg(struct platform_device *dsidev, @@ -4133,7 +4133,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); struct omap_overlay_manager *mgr = dsi->output.manager; int bpp = dsi_get_pixel_size(dsi->pix_fmt); - struct omap_dss_output *out = &dsi->output; + struct omap_dss_device *out = &dsi->output; u8 data_type; u16 word_count; int r; @@ -5415,13 +5415,13 @@ static int dsi_probe_pdata(struct platform_device *dsidev) static void dsi_init_output(struct platform_device *dsidev) { struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); - struct omap_dss_output *out = &dsi->output; + struct omap_dss_device *out = &dsi->output; - out->pdev = dsidev; + out->dev = &dsidev->dev; out->id = dsi->module_id == 0 ? OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2; - out->type = OMAP_DISPLAY_TYPE_DSI; + out->output_type = OMAP_DISPLAY_TYPE_DSI; out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1"; out->dispc_channel = dsi_get_channel(dsi->module_id); @@ -5431,7 +5431,7 @@ static void dsi_init_output(struct platform_device *dsidev) static void dsi_uninit_output(struct platform_device *dsidev) { struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); - struct omap_dss_output *out = &dsi->output; + struct omap_dss_device *out = &dsi->output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 03d729ac8c4..67a509ea1fc 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -180,8 +180,8 @@ void dss_copy_device_pdata(struct omap_dss_device *dst, const struct omap_dss_device *src); /* output */ -void dss_register_output(struct omap_dss_output *out); -void dss_unregister_output(struct omap_dss_output *out); +void dss_register_output(struct omap_dss_device *out); +void dss_unregister_output(struct omap_dss_device *out); /* display */ int dss_suspend_all_devices(void); diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 1804f1e28b9..1c1c1eee999 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -70,7 +70,7 @@ static struct { int ls_oe_gpio; int hpd_gpio; - struct omap_dss_output output; + struct omap_dss_device output; } hdmi; /* @@ -720,7 +720,7 @@ bool omapdss_hdmi_detect(void) int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &hdmi.output; + struct omap_dss_device *out = &hdmi.output; int r = 0; DSSDBG("ENTER hdmi_display_enable\n"); @@ -1035,11 +1035,11 @@ static int hdmi_probe_pdata(struct platform_device *pdev) static void hdmi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &hdmi.output; + struct omap_dss_device *out = &hdmi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_HDMI; - out->type = OMAP_DISPLAY_TYPE_HDMI; + out->output_type = OMAP_DISPLAY_TYPE_HDMI; out->name = "hdmi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; @@ -1048,7 +1048,7 @@ static void hdmi_init_output(struct platform_device *pdev) static void __exit hdmi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &hdmi.output; + struct omap_dss_device *out = &hdmi.output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c index a53b08b2249..cc81fec1626 100644 --- a/drivers/video/omap2/dss/output.c +++ b/drivers/video/omap2/dss/output.c @@ -27,7 +27,7 @@ static LIST_HEAD(output_list); static DEFINE_MUTEX(output_lock); -int omapdss_output_set_device(struct omap_dss_output *out, +int omapdss_output_set_device(struct omap_dss_device *out, struct omap_dss_device *dssdev) { int r; @@ -41,7 +41,7 @@ int omapdss_output_set_device(struct omap_dss_output *out, goto err; } - if (out->type != dssdev->type) { + if (out->output_type != dssdev->type) { DSSERR("output type and display type don't match\n"); r = -EINVAL; goto err; @@ -60,7 +60,7 @@ err: } EXPORT_SYMBOL(omapdss_output_set_device); -int omapdss_output_unset_device(struct omap_dss_output *out) +int omapdss_output_unset_device(struct omap_dss_device *out) { int r; @@ -92,19 +92,19 @@ err: } EXPORT_SYMBOL(omapdss_output_unset_device); -void dss_register_output(struct omap_dss_output *out) +void dss_register_output(struct omap_dss_device *out) { list_add_tail(&out->list, &output_list); } -void dss_unregister_output(struct omap_dss_output *out) +void dss_unregister_output(struct omap_dss_device *out) { list_del(&out->list); } -struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id) +struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id) { - struct omap_dss_output *out; + struct omap_dss_device *out; list_for_each_entry(out, &output_list, list) { if (out->id == id) @@ -115,9 +115,9 @@ struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id) } EXPORT_SYMBOL(omap_dss_get_output); -struct omap_dss_output *omap_dss_find_output(const char *name) +struct omap_dss_device *omap_dss_find_output(const char *name) { - struct omap_dss_output *out; + struct omap_dss_device *out; list_for_each_entry(out, &output_list, list) { if (strcmp(out->name, name) == 0) @@ -128,12 +128,12 @@ struct omap_dss_output *omap_dss_find_output(const char *name) } EXPORT_SYMBOL(omap_dss_find_output); -struct omap_dss_output *omap_dss_find_output_by_node(struct device_node *node) +struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node) { - struct omap_dss_output *out; + struct omap_dss_device *out; list_for_each_entry(out, &output_list, list) { - if (out->pdev->dev.of_node == node) + if (out->dev->of_node == node) return out; } @@ -141,7 +141,7 @@ struct omap_dss_output *omap_dss_find_output_by_node(struct device_node *node) } EXPORT_SYMBOL(omap_dss_find_output_by_node); -struct omap_dss_output *omapdss_find_output_from_display(struct omap_dss_device *dssdev) +struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev) { return dssdev->output; } @@ -149,7 +149,7 @@ EXPORT_SYMBOL(omapdss_find_output_from_display); struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev) { - struct omap_dss_output *out; + struct omap_dss_device *out; out = omapdss_find_output_from_display(dssdev); @@ -180,14 +180,14 @@ void dss_uninstall_mgr_ops(void) EXPORT_SYMBOL(dss_uninstall_mgr_ops); int dss_mgr_connect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { return dss_mgr_ops->connect(mgr, dst); } EXPORT_SYMBOL(dss_mgr_connect); void dss_mgr_disconnect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { dss_mgr_ops->disconnect(mgr, dst); } diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 30ff0e0d462..35836eb73a6 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -117,7 +117,7 @@ static struct { int data_lines; struct rfbi_timings intf_timings; - struct omap_dss_output output; + struct omap_dss_device output; } rfbi; static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val) @@ -890,7 +890,7 @@ static void rfbi_config_lcd_manager(struct omap_dss_device *dssdev) int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &rfbi.output; + struct omap_dss_device *out = &rfbi.output; int r; if (out == NULL || out->manager == NULL) { @@ -925,7 +925,7 @@ EXPORT_SYMBOL(omapdss_rfbi_display_enable); void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &rfbi.output; + struct omap_dss_device *out = &rfbi.output; dss_mgr_unregister_framedone_handler(out->manager, framedone_callback, NULL); @@ -1013,11 +1013,11 @@ static int rfbi_probe_pdata(struct platform_device *rfbidev) static void rfbi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &rfbi.output; + struct omap_dss_device *out = &rfbi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_DBI; - out->type = OMAP_DISPLAY_TYPE_DBI; + out->output_type = OMAP_DISPLAY_TYPE_DBI; out->name = "rfbi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_LCD; @@ -1026,7 +1026,7 @@ static void rfbi_init_output(struct platform_device *pdev) static void __exit rfbi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &rfbi.output; + struct omap_dss_device *out = &rfbi.output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index d4f3313bc37..5e81de58d93 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -40,7 +40,7 @@ static struct { struct omap_video_timings timings; int datapairs; - struct omap_dss_output output; + struct omap_dss_device output; } sdi; struct sdi_clk_calc_ctx { @@ -126,7 +126,7 @@ static void sdi_config_lcd_manager(struct omap_dss_device *dssdev) int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &sdi.output; + struct omap_dss_device *out = &sdi.output; struct omap_video_timings *t = &sdi.timings; struct dss_clock_info dss_cinfo; struct dispc_clock_info dispc_cinfo; @@ -335,11 +335,11 @@ static int sdi_probe_pdata(struct platform_device *sdidev) static void sdi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &sdi.output; + struct omap_dss_device *out = &sdi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_SDI; - out->type = OMAP_DISPLAY_TYPE_SDI; + out->output_type = OMAP_DISPLAY_TYPE_SDI; out->name = "sdi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_LCD; @@ -348,7 +348,7 @@ static void sdi_init_output(struct platform_device *pdev) static void __exit sdi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &sdi.output; + struct omap_dss_device *out = &sdi.output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index d529a924943..96c49bc7bdb 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -304,7 +304,7 @@ static struct { enum omap_dss_venc_type type; bool invert_polarity; - struct omap_dss_output output; + struct omap_dss_device output; } venc; static inline void venc_write_reg(int idx, u32 val) @@ -500,7 +500,7 @@ unsigned long venc_get_pixel_clock(void) int omapdss_venc_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &venc.output; + struct omap_dss_device *out = &venc.output; int r; DSSDBG("venc_display_enable\n"); @@ -785,11 +785,11 @@ static int venc_probe_pdata(struct platform_device *vencdev) static void venc_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &venc.output; + struct omap_dss_device *out = &venc.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_VENC; - out->type = OMAP_DISPLAY_TYPE_VENC; + out->output_type = OMAP_DISPLAY_TYPE_VENC; out->name = "venc.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; @@ -798,7 +798,7 @@ static void venc_init_output(struct platform_device *pdev) static void __exit venc_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &venc.output; + struct omap_dss_device *out = &venc.output; dss_unregister_output(out); } diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 6a699f537a6..8e5035a5454 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -515,7 +515,7 @@ struct omap_overlay_manager { enum omap_dss_output_id supported_outputs; /* dynamic fields */ - struct omap_dss_output *output; + struct omap_dss_device *output; /* * The following functions do not block: @@ -529,7 +529,7 @@ struct omap_overlay_manager { */ int (*set_output)(struct omap_overlay_manager *mgr, - struct omap_dss_output *output); + struct omap_dss_device *output); int (*unset_output)(struct omap_overlay_manager *mgr); int (*set_manager_info)(struct omap_overlay_manager *mgr, @@ -572,29 +572,6 @@ struct omap_dss_writeback_info { u8 pre_mult_alpha; }; -struct omap_dss_output { - struct list_head list; - - const char *name; - - /* display type supported by the output */ - enum omap_display_type type; - - /* DISPC channel for this output */ - enum omap_channel dispc_channel; - - /* output instance */ - enum omap_dss_output_id id; - - /* output's platform device pointer */ - struct platform_device *pdev; - - /* dynamic fields */ - struct omap_overlay_manager *manager; - - struct omap_dss_device *device; -}; - struct omap_dss_device { /* old device, to be removed */ struct device old_dev; @@ -608,6 +585,7 @@ struct omap_dss_device { char alias[16]; enum omap_display_type type; + enum omap_display_type output_type; /* obsolete, to be removed */ enum omap_channel channel; @@ -669,7 +647,7 @@ struct omap_dss_device { enum omap_display_caps caps; - struct omap_dss_output *output; + struct omap_dss_device *output; enum omap_dss_display_state state; @@ -680,6 +658,22 @@ struct omap_dss_device { void (*platform_disable)(struct omap_dss_device *dssdev); int (*set_backlight)(struct omap_dss_device *dssdev, int level); int (*get_backlight)(struct omap_dss_device *dssdev); + + + /* OMAP DSS output specific fields */ + + struct list_head list; + + /* DISPC channel for this output */ + enum omap_channel dispc_channel; + + /* output instance */ + enum omap_dss_output_id id; + + /* dynamic fields */ + struct omap_overlay_manager *manager; + + struct omap_dss_device *device; }; struct omap_dss_hdmi_data @@ -798,14 +792,14 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num); int omap_dss_get_num_overlays(void); struct omap_overlay *omap_dss_get_overlay(int num); -struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id); -struct omap_dss_output *omap_dss_find_output(const char *name); -struct omap_dss_output *omap_dss_find_output_by_node(struct device_node *node); -int omapdss_output_set_device(struct omap_dss_output *out, +struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id); +struct omap_dss_device *omap_dss_find_output(const char *name); +struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node); +int omapdss_output_set_device(struct omap_dss_device *out, struct omap_dss_device *dssdev); -int omapdss_output_unset_device(struct omap_dss_output *out); +int omapdss_output_unset_device(struct omap_dss_device *out); -struct omap_dss_output *omapdss_find_output_from_display(struct omap_dss_device *dssdev); +struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev); struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev); void omapdss_default_get_resolution(struct omap_dss_device *dssdev, @@ -909,9 +903,9 @@ void omapdss_compat_uninit(void); struct dss_mgr_ops { int (*connect)(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst); + struct omap_dss_device *dst); void (*disconnect)(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst); + struct omap_dss_device *dst); void (*start_update)(struct omap_overlay_manager *mgr); int (*enable)(struct omap_overlay_manager *mgr); @@ -930,9 +924,9 @@ int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops); void dss_uninstall_mgr_ops(void); int dss_mgr_connect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst); + struct omap_dss_device *dst); void dss_mgr_disconnect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst); + struct omap_dss_device *dst); void dss_mgr_set_timings(struct omap_overlay_manager *mgr, const struct omap_video_timings *timings); void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, -- cgit v1.2.3-70-g09d2