diff options
author | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-01-12 15:12:07 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-02-24 14:31:28 +0200 |
commit | 37ac60e414052f1d9301368437db8f0cb9e323fe (patch) | |
tree | d6b30b58deae82a6d5f2ac2f4d9cf18ed3bc57da /drivers/video/omap2/displays | |
parent | 18946f62c6cc8cf051bafca8b7fa72309e8a1067 (diff) | |
download | linux-37ac60e414052f1d9301368437db8f0cb9e323fe.tar.gz linux-37ac60e414052f1d9301368437db8f0cb9e323fe.tar.bz2 linux-37ac60e414052f1d9301368437db8f0cb9e323fe.zip |
OMAP: DSS2: move enable/disable/suspend/resume
Move enable/disable/suspend/resume from omap_dss_device to
omap_dss_driver.
This is part of a larger patch-set, which moves the control from omapdss
driver to the display driver.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video/omap2/displays')
-rw-r--r-- | drivers/video/omap2/displays/panel-generic.c | 56 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c | 67 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | 42 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-taal.c | 79 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-toppoly-tdo35s.c | 56 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-tpo-td043mtea1.c | 61 |
6 files changed, 302 insertions, 59 deletions
diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c index eb48d1afd800..c59e4baed8b2 100644 --- a/drivers/video/omap2/displays/panel-generic.c +++ b/drivers/video/omap2/displays/panel-generic.c @@ -35,6 +35,35 @@ static struct omap_video_timings generic_panel_timings = { .vbp = 7, }; +static int generic_panel_power_on(struct omap_dss_device *dssdev) +{ + int r; + + r = omapdss_dpi_display_enable(dssdev); + if (r) + goto err0; + + if (dssdev->platform_enable) { + r = dssdev->platform_enable(dssdev); + if (r) + goto err1; + } + + return 0; +err1: + omapdss_dpi_display_disable(dssdev); +err0: + return r; +} + +static void generic_panel_power_off(struct omap_dss_device *dssdev) +{ + if (dssdev->platform_disable) + dssdev->platform_disable(dssdev); + + omapdss_dpi_display_disable(dssdev); +} + static int generic_panel_probe(struct omap_dss_device *dssdev) { dssdev->panel.config = OMAP_DSS_LCD_TFT; @@ -51,27 +80,40 @@ static int generic_panel_enable(struct omap_dss_device *dssdev) { int r = 0; - if (dssdev->platform_enable) - r = dssdev->platform_enable(dssdev); + r = generic_panel_power_on(dssdev); + if (r) + return r; - return r; + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + + return 0; } static void generic_panel_disable(struct omap_dss_device *dssdev) { - if (dssdev->platform_disable) - dssdev->platform_disable(dssdev); + generic_panel_power_off(dssdev); + + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } static int generic_panel_suspend(struct omap_dss_device *dssdev) { - generic_panel_disable(dssdev); + generic_panel_power_off(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; return 0; } static int generic_panel_resume(struct omap_dss_device *dssdev) { - return generic_panel_enable(dssdev); + int r = 0; + + r = generic_panel_power_on(dssdev); + if (r) + return r; + + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + + return 0; } static struct omap_dss_driver generic_driver = { diff --git a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c index e75798edbb59..10267461991c 100644 --- a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c +++ b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c @@ -39,6 +39,41 @@ static struct omap_video_timings sharp_lq_timings = { .vbp = 2, }; +static int sharp_lq_panel_power_on(struct omap_dss_device *dssdev) +{ + int r; + + r = omapdss_dpi_display_enable(dssdev); + if (r) + goto err0; + + /* wait couple of vsyncs until enabling the LCD */ + msleep(50); + + if (dssdev->platform_enable) { + r = dssdev->platform_enable(dssdev); + if (r) + goto err1; + } + + return 0; +err1: + omapdss_dpi_display_disable(dssdev); +err0: + return r; +} + +static void sharp_lq_panel_power_off(struct omap_dss_device *dssdev) +{ + if (dssdev->platform_disable) + dssdev->platform_disable(dssdev); + + /* wait at least 5 vsyncs after disabling the LCD */ + msleep(100); + + omapdss_dpi_display_disable(dssdev); +} + static int sharp_lq_panel_probe(struct omap_dss_device *dssdev) { @@ -58,36 +93,40 @@ static int sharp_lq_panel_enable(struct omap_dss_device *dssdev) { int r = 0; + r = sharp_lq_panel_power_on(dssdev); + if (r) + return r; - /* wait couple of vsyncs until enabling the LCD */ - msleep(50); - - if (dssdev->platform_enable) - r = dssdev->platform_enable(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; - return r; + return 0; } static void sharp_lq_panel_disable(struct omap_dss_device *dssdev) { + sharp_lq_panel_power_off(dssdev); - if (dssdev->platform_disable) - dssdev->platform_disable(dssdev); - - /* wait at least 5 vsyncs after disabling the LCD */ - - msleep(100); + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } static int sharp_lq_panel_suspend(struct omap_dss_device *dssdev) { - sharp_lq_panel_disable(dssdev); + sharp_lq_panel_power_off(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; return 0; } static int sharp_lq_panel_resume(struct omap_dss_device *dssdev) { - return sharp_lq_panel_enable(dssdev); + int r = 0; + + r = sharp_lq_panel_power_on(dssdev); + if (r) + return r; + + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + + return 0; } static struct omap_dss_driver sharp_lq_driver = { diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c index e207d66908d6..8d51a5e6341c 100644 --- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c @@ -20,7 +20,6 @@ #include <linux/module.h> #include <linux/delay.h> #include <linux/device.h> -#include <linux/regulator/consumer.h> #include <linux/err.h> #include <plat/display.h> @@ -54,20 +53,31 @@ static void sharp_ls_panel_remove(struct omap_dss_device *dssdev) { } -static int sharp_ls_panel_enable(struct omap_dss_device *dssdev) +static int sharp_ls_power_on(struct omap_dss_device *dssdev) { int r = 0; + r = omapdss_dpi_display_enable(dssdev); + if (r) + goto err0; + /* wait couple of vsyncs until enabling the LCD */ msleep(50); - if (dssdev->platform_enable) + if (dssdev->platform_enable) { r = dssdev->platform_enable(dssdev); + if (r) + goto err1; + } + return 0; +err1: + omapdss_dpi_display_disable(dssdev); +err0: return r; } -static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) +static void sharp_ls_power_off(struct omap_dss_device *dssdev) { if (dssdev->platform_disable) dssdev->platform_disable(dssdev); @@ -75,17 +85,37 @@ static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) /* wait at least 5 vsyncs after disabling the LCD */ msleep(100); + + omapdss_dpi_display_disable(dssdev); +} + +static int sharp_ls_panel_enable(struct omap_dss_device *dssdev) +{ + int r; + r = sharp_ls_power_on(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + return r; +} + +static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) +{ + sharp_ls_power_off(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev) { - sharp_ls_panel_disable(dssdev); + sharp_ls_power_off(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; return 0; } static int sharp_ls_panel_resume(struct omap_dss_device *dssdev) { - return sharp_ls_panel_enable(dssdev); + int r; + r = sharp_ls_power_on(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + return r; } static struct omap_dss_driver sharp_ls_driver = { diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 58293203fc05..484a61844763 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c @@ -620,14 +620,12 @@ static void taal_remove(struct omap_dss_device *dssdev) kfree(td); } -static int taal_enable(struct omap_dss_device *dssdev) +static int taal_power_on(struct omap_dss_device *dssdev) { struct taal_data *td = dev_get_drvdata(&dssdev->dev); u8 id1, id2, id3; int r; - dev_dbg(&dssdev->dev, "enable\n"); - if (dssdev->platform_enable) { r = dssdev->platform_enable(dssdev); if (r) @@ -637,6 +635,16 @@ static int taal_enable(struct omap_dss_device *dssdev) /* it seems we have to wait a bit until taal is ready */ msleep(5); + dsi_bus_lock(); + + r = omapdss_dsi_display_enable(dssdev); + if (r) { + dev_err(&dssdev->dev, "failed to enable DSI\n"); + goto err0; + } + + omapdss_dsi_vc_enable_hs(TCH, false); + r = taal_sleep_out(td); if (r) goto err; @@ -675,19 +683,27 @@ static int taal_enable(struct omap_dss_device *dssdev) td->intro_printed = true; } + omapdss_dsi_vc_enable_hs(TCH, true); + + dsi_bus_unlock(); + return 0; err: + dsi_bus_unlock(); + + omapdss_dsi_display_disable(dssdev); +err0: if (dssdev->platform_disable) dssdev->platform_disable(dssdev); return r; } -static void taal_disable(struct omap_dss_device *dssdev) +static void taal_power_off(struct omap_dss_device *dssdev) { struct taal_data *td = dev_get_drvdata(&dssdev->dev); - dev_dbg(&dssdev->dev, "disable\n"); + dsi_bus_lock(); cancel_delayed_work(&td->esd_work); @@ -697,32 +713,67 @@ static void taal_disable(struct omap_dss_device *dssdev) /* wait a bit so that the message goes through */ msleep(10); + omapdss_dsi_display_disable(dssdev); + if (dssdev->platform_disable) dssdev->platform_disable(dssdev); td->enabled = 0; + + dsi_bus_unlock(); +} + +static int taal_enable(struct omap_dss_device *dssdev) +{ + int r; + dev_dbg(&dssdev->dev, "enable\n"); + + if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) + return -EINVAL; + + r = taal_power_on(dssdev); + if (r) + return r; + + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + + return r; +} + +static void taal_disable(struct omap_dss_device *dssdev) +{ + dev_dbg(&dssdev->dev, "disable\n"); + + if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) + taal_power_off(dssdev); + + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } static int taal_suspend(struct omap_dss_device *dssdev) { - struct taal_data *td = dev_get_drvdata(&dssdev->dev); - struct backlight_device *bldev = td->bldev; + dev_dbg(&dssdev->dev, "suspend\n"); - bldev->props.power = FB_BLANK_POWERDOWN; - taal_bl_update_status(bldev); + if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) + return -EINVAL; + + taal_power_off(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; return 0; } static int taal_resume(struct omap_dss_device *dssdev) { - struct taal_data *td = dev_get_drvdata(&dssdev->dev); - struct backlight_device *bldev = td->bldev; + int r; + dev_dbg(&dssdev->dev, "resume\n"); - bldev->props.power = FB_BLANK_UNBLANK; - taal_bl_update_status(bldev); + if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) + return -EINVAL; - return 0; + r = taal_power_on(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + return r; } static void taal_framedone_cb(int err, void *data) diff --git a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c index e744b8c83817..fa434ca6e4b7 100644 --- a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c +++ b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c @@ -42,6 +42,35 @@ static struct omap_video_timings toppoly_tdo_panel_timings = { .vbp = 2, }; +static int toppoly_tdo_panel_power_on(struct omap_dss_device *dssdev) +{ + int r; + + r = omapdss_dpi_display_enable(dssdev); + if (r) + goto err0; + + if (dssdev->platform_enable) { + r = dssdev->platform_enable(dssdev); + if (r) + goto err1; + } + + return 0; +err1: + omapdss_dpi_display_disable(dssdev); +err0: + return r; +} + +static void toppoly_tdo_panel_power_off(struct omap_dss_device *dssdev) +{ + if (dssdev->platform_disable) + dssdev->platform_disable(dssdev); + + omapdss_dpi_display_disable(dssdev); +} + static int toppoly_tdo_panel_probe(struct omap_dss_device *dssdev) { dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | @@ -59,27 +88,40 @@ static int toppoly_tdo_panel_enable(struct omap_dss_device *dssdev) { int r = 0; - if (dssdev->platform_enable) - r = dssdev->platform_enable(dssdev); + r = toppoly_tdo_panel_power_on(dssdev); + if (r) + return r; - return r; + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + + return 0; } static void toppoly_tdo_panel_disable(struct omap_dss_device *dssdev) { - if (dssdev->platform_disable) - dssdev->platform_disable(dssdev); + toppoly_tdo_panel_power_off(dssdev); + + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } static int toppoly_tdo_panel_suspend(struct omap_dss_device *dssdev) { - toppoly_tdo_panel_disable(dssdev); + toppoly_tdo_panel_power_off(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; return 0; } static int toppoly_tdo_panel_resume(struct omap_dss_device *dssdev) { - return toppoly_tdo_panel_enable(dssdev); + int r = 0; + + r = toppoly_tdo_panel_power_on(dssdev); + if (r) + return r; + + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + + return 0; } static struct omap_dss_driver generic_driver = { diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c index f297a46f2b1a..c6e4a7e9f532 100644 --- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c +++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c @@ -262,18 +262,20 @@ static const struct omap_video_timings tpo_td043_timings = { .vbp = 34, }; -static int tpo_td043_enable(struct omap_dss_device *dssdev) +static int generic_panel_power_on(struct omap_dss_device *dssdev) { struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); int nreset_gpio = dssdev->reset_gpio; - int ret; + int r; - dev_dbg(&dssdev->dev, "enable\n"); + r = omapdss_dpi_display_enable(dssdev); + if (r) + goto err0; if (dssdev->platform_enable) { - ret = dssdev->platform_enable(dssdev); - if (ret) - return ret; + r = dssdev->platform_enable(dssdev); + if (r) + goto err1; } regulator_enable(tpo_td043->vcc_reg); @@ -294,15 +296,17 @@ static int tpo_td043_enable(struct omap_dss_device *dssdev) tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma); return 0; +err1: + omapdss_dpi_display_disable(dssdev); +err0: + return r; } -static void tpo_td043_disable(struct omap_dss_device *dssdev) +static void generic_panel_power_off(struct omap_dss_device *dssdev) { struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); int nreset_gpio = dssdev->reset_gpio; - dev_dbg(&dssdev->dev, "disable\n"); - tpo_td043_write(tpo_td043->spi, 3, TPO_R03_VAL_STANDBY | TPO_R03_EN_PWM); @@ -318,17 +322,52 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev) if (dssdev->platform_disable) dssdev->platform_disable(dssdev); + + omapdss_dpi_display_disable(dssdev); +} + +static int tpo_td043_enable(struct omap_dss_device *dssdev) +{ + int ret; + + dev_dbg(&dssdev->dev, "enable\n"); + + ret = generic_panel_power_on(dssdev); + if (ret) + return ret; + + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + + return 0; +} + +static void tpo_td043_disable(struct omap_dss_device *dssdev) +{ + dev_dbg(&dssdev->dev, "disable\n"); + + generic_panel_power_off(dssdev); + + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } static int tpo_td043_suspend(struct omap_dss_device *dssdev) { - tpo_td043_disable(dssdev); + generic_panel_power_off(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; return 0; } static int tpo_td043_resume(struct omap_dss_device *dssdev) { - return tpo_td043_enable(dssdev); + int r = 0; + + r = generic_panel_power_on(dssdev); + if (r) + return r; + + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + + return 0; } static int tpo_td043_probe(struct omap_dss_device *dssdev) |