diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-05-08 16:23:32 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-06-17 14:00:43 +0300 |
commit | a7e71e7f9fc7924921081aa55ceafca00d2c9f49 (patch) | |
tree | a7aacbb4520023a99d268c0e859a483049d1d467 /drivers/video/omap2/dss | |
parent | 04b1fc0291674666110fffd09b30d8304aaa4602 (diff) |
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 <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss')
-rw-r--r-- | drivers/video/omap2/dss/apply.c | 14 | ||||
-rw-r--r-- | drivers/video/omap2/dss/core.c | 44 | ||||
-rw-r--r-- | drivers/video/omap2/dss/display-sysfs.c | 28 | ||||
-rw-r--r-- | drivers/video/omap2/dss/manager-sysfs.c | 45 | ||||
-rw-r--r-- | drivers/video/omap2/dss/output.c | 14 |
5 files changed, 116 insertions, 29 deletions
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) { |