Patchwork [Maverick] pull-request: DSS2: Don't power off panel twice

login
register
mail settings
Submitter Mathieu Poirier
Date Sept. 2, 2010, 7:57 p.m.
Message ID <1283457461.8721.23.camel@black>
Download mbox | patch
Permalink /patch/63538/
State Rejected
Delegated to: Leann Ogasawara
Headers show

Comments

Mathieu Poirier - Sept. 2, 2010, 7:57 p.m.
This patch fixes:

BugLink: http://bugs.launchpad.net/bug/588243

The following changes since commit 9f02aef9921f0f213a6680768641eb2af6113c3b:
  Leann Ogasawara (1):
        UBUNTU: Start new release

are available in the git repository at:

  git://kernel.ubuntu.com/mpoirier/ubuntu-maverick.git lp588243

Mathieu J. Poirier (1):
      DSS2: Don't power off panel twice

 drivers/video/omap2/displays/panel-generic.c       |    6 ++++++
 .../video/omap2/displays/panel-sharp-lq043t1dg01.c |    6 ++++++
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |    6 ++++++
 drivers/video/omap2/displays/panel-taal.c          |    6 ++++++
 .../video/omap2/displays/panel-toppoly-tdo35s.c    |    6 ++++++
 .../video/omap2/displays/panel-tpo-td043mtea1.c    |    6 ++++++
 6 files changed, 36 insertions(+), 0 deletions(-)

-------------------------------------------------------------
>From 7c6524b497a454ff07e1efc6237dcef2fe655c11 Mon Sep 17 00:00:00 2001
From: Mathieu J. Poirier <mathieu.poirier@canonical.com>
Date: Thu, 2 Sep 2010 11:05:49 -0600
Subject: [PATCH] DSS2: Don't power off panel twice

Adding the work of Stanley Miao that has been submitted to
linux-omap-2.6. This work simply avoids disabling the display
if it is already inactive, something that causes the kernel
to print a trace dump when rebooting/halting the system.

BugLink: http://bugs.launchpad.net/bug/588243

Signed-off-by: Mathieu Poirier <mathieu.poirier@canonical.com>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>

-------------------------------------------------------------
>From c3b386edd12ca5e085e8d013fd23cafd19b6296f Mon Sep 17 00:00:00 2001
From: Stanley.Miao <stanley.miao@windriver.com>
Date: Wed, 11 Aug 2010 11:19:13 +0800
Subject: [PATCH] OMAP: DSS2: don't power off a panel twice

If we blank the panel by
echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank

Then, we reboot the sytem, the kernel will crash at
drivers/video/omap2/dss/core.c:323

This is because the panel is closed twice. Now check the state of a dssdev
to forbid a panel is power on or power off twice.

Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
---
 drivers/video/omap2/displays/panel-generic.c       |    6 ++++++
 .../video/omap2/displays/panel-sharp-lq043t1dg01.c |    6 ++++++
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |    6 ++++++
 drivers/video/omap2/displays/panel-taal.c          |    6 ++++++
 .../video/omap2/displays/panel-toppoly-tdo35s.c    |    6 ++++++
 .../video/omap2/displays/panel-tpo-td043mtea1.c    |    6 ++++++
 6 files changed, 36 insertions(+), 0 deletions(-)
Leann Ogasawara - Sept. 3, 2010, 12:04 a.m.
Hi Mathieu,

Based on the upstream comment [1], should this patch be cleaned up to
not modify drivers/video/omap2/displays/panel-taal.c.  Will it also be
re-submitted upstream with this cleanup?  I'd also suggest just using
the original commit message from the patch author, add a reference to
the upstream submission, and fix up the invalid BugLink url, eg
something like:

    OMAP: DSS2: don't power off a panel twice
    
    BugLink: http://bugs.launchpad.net/bugs/588243
    
    If we blank the panel by
    echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank
    
    Then, we reboot the sytem, the kernel will crash at
    drivers/video/omap2/dss/core.c:323
    
    This is because the panel is closed twice. Now check the state of a dssdev
    to forbid a panel is power on or power off twice.
    
    This has been submitted to upstream to the linux-omap mailing list:
    http://marc.info/?l=linux-omap&m=128155916220155&w=2
    
    Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
    Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
    Signed-off-by: Mathieu Poirier <mathieu.poirier@canonical.com>

Thanks,
Leann

[1] http://marc.info/?l=linux-omap&m=128204126510625&w=2

On Thu, 2010-09-02 at 13:57 -0600, Mathieu Poirier wrote:
> This patch fixes:
> 
> BugLink: http://bugs.launchpad.net/bug/588243
> 
> The following changes since commit 9f02aef9921f0f213a6680768641eb2af6113c3b:
>   Leann Ogasawara (1):
>         UBUNTU: Start new release
> 
> are available in the git repository at:
> 
>   git://kernel.ubuntu.com/mpoirier/ubuntu-maverick.git lp588243
> 
> Mathieu J. Poirier (1):
>       DSS2: Don't power off panel twice
> 
>  drivers/video/omap2/displays/panel-generic.c       |    6 ++++++
>  .../video/omap2/displays/panel-sharp-lq043t1dg01.c |    6 ++++++
>  .../video/omap2/displays/panel-sharp-ls037v7dw01.c |    6 ++++++
>  drivers/video/omap2/displays/panel-taal.c          |    6 ++++++
>  .../video/omap2/displays/panel-toppoly-tdo35s.c    |    6 ++++++
>  .../video/omap2/displays/panel-tpo-td043mtea1.c    |    6 ++++++
>  6 files changed, 36 insertions(+), 0 deletions(-)
> 
> -------------------------------------------------------------
> >From 7c6524b497a454ff07e1efc6237dcef2fe655c11 Mon Sep 17 00:00:00 2001
> From: Mathieu J. Poirier <mathieu.poirier@canonical.com>
> Date: Thu, 2 Sep 2010 11:05:49 -0600
> Subject: [PATCH] DSS2: Don't power off panel twice
> 
> Adding the work of Stanley Miao that has been submitted to
> linux-omap-2.6. This work simply avoids disabling the display
> if it is already inactive, something that causes the kernel
> to print a trace dump when rebooting/halting the system.
> 
> BugLink: http://bugs.launchpad.net/bug/588243
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@canonical.com>
> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
> 
> -------------------------------------------------------------
> >From c3b386edd12ca5e085e8d013fd23cafd19b6296f Mon Sep 17 00:00:00 2001
> From: Stanley.Miao <stanley.miao@windriver.com>
> Date: Wed, 11 Aug 2010 11:19:13 +0800
> Subject: [PATCH] OMAP: DSS2: don't power off a panel twice
> 
> If we blank the panel by
> echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank
> 
> Then, we reboot the sytem, the kernel will crash at
> drivers/video/omap2/dss/core.c:323
> 
> This is because the panel is closed twice. Now check the state of a dssdev
> to forbid a panel is power on or power off twice.
> 
> Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
> ---
>  drivers/video/omap2/displays/panel-generic.c       |    6 ++++++
>  .../video/omap2/displays/panel-sharp-lq043t1dg01.c |    6 ++++++
>  .../video/omap2/displays/panel-sharp-ls037v7dw01.c |    6 ++++++
>  drivers/video/omap2/displays/panel-taal.c          |    6 ++++++
>  .../video/omap2/displays/panel-toppoly-tdo35s.c    |    6 ++++++
>  .../video/omap2/displays/panel-tpo-td043mtea1.c    |    6 ++++++
>  6 files changed, 36 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c
> index 300eff5..395a68d 100644
> --- a/drivers/video/omap2/displays/panel-generic.c
> +++ b/drivers/video/omap2/displays/panel-generic.c
> @@ -39,6 +39,9 @@ static int generic_panel_power_on(struct omap_dss_device *dssdev)
>  {
>  	int r;
>  
> +	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
> +		return 0;
> +
>  	r = omapdss_dpi_display_enable(dssdev);
>  	if (r)
>  		goto err0;
> @@ -58,6 +61,9 @@ err0:
>  
>  static void generic_panel_power_off(struct omap_dss_device *dssdev)
>  {
> +	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> +		return;
> +
>  	if (dssdev->platform_disable)
>  		dssdev->platform_disable(dssdev);
>  
> diff --git a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c
> index 1026746..0c6896c 100644
> --- a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c
> +++ b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c
> @@ -43,6 +43,9 @@ static int sharp_lq_panel_power_on(struct omap_dss_device *dssdev)
>  {
>  	int r;
>  
> +	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
> +		return 0;
> +
>  	r = omapdss_dpi_display_enable(dssdev);
>  	if (r)
>  		goto err0;
> @@ -65,6 +68,9 @@ err0:
>  
>  static void sharp_lq_panel_power_off(struct omap_dss_device *dssdev)
>  {
> +	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> +		return;
> +
>  	if (dssdev->platform_disable)
>  		dssdev->platform_disable(dssdev);
>  
> diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
> index 7d9eb2b..9a138f6 100644
> --- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
> +++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
> @@ -135,6 +135,9 @@ static int sharp_ls_power_on(struct omap_dss_device *dssdev)
>  {
>  	int r = 0;
>  
> +	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
> +		return 0;
> +
>  	r = omapdss_dpi_display_enable(dssdev);
>  	if (r)
>  		goto err0;
> @@ -157,6 +160,9 @@ err0:
>  
>  static void sharp_ls_power_off(struct omap_dss_device *dssdev)
>  {
> +	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> +		return;
> +
>  	if (dssdev->platform_disable)
>  		dssdev->platform_disable(dssdev);
>  
> diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
> index aaf5d30..c649f06 100644
> --- a/drivers/video/omap2/displays/panel-taal.c
> +++ b/drivers/video/omap2/displays/panel-taal.c
> @@ -635,6 +635,9 @@ static int taal_power_on(struct omap_dss_device *dssdev)
>  	u8 id1, id2, id3;
>  	int r;
>  
> +	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
> +		return 0;
> +
>  	if (dssdev->platform_enable) {
>  		r = dssdev->platform_enable(dssdev);
>  		if (r)
> @@ -715,6 +718,9 @@ static void taal_power_off(struct omap_dss_device *dssdev)
>  {
>  	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
>  
> +	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> +		return;
> +
>  	dsi_bus_lock();
>  
>  	cancel_delayed_work(&td->esd_work);
> diff --git a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c
> index fa434ca..49e1dec 100644
> --- a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c
> +++ b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c
> @@ -46,6 +46,9 @@ static int toppoly_tdo_panel_power_on(struct omap_dss_device *dssdev)
>  {
>  	int r;
>  
> +	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
> +		return 0;
> +
>  	r = omapdss_dpi_display_enable(dssdev);
>  	if (r)
>  		goto err0;
> @@ -65,6 +68,9 @@ err0:
>  
>  static void toppoly_tdo_panel_power_off(struct omap_dss_device *dssdev)
>  {
> +	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> +		return;
> +
>  	if (dssdev->platform_disable)
>  		dssdev->platform_disable(dssdev);
>  
> diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
> index e866e76..dbe9d43 100644
> --- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
> +++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
> @@ -269,6 +269,9 @@ static int tpo_td043_power_on(struct omap_dss_device *dssdev)
>  	int nreset_gpio = dssdev->reset_gpio;
>  	int r;
>  
> +	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
> +		return 0;
> +
>  	r = omapdss_dpi_display_enable(dssdev);
>  	if (r)
>  		goto err0;
> @@ -308,6 +311,9 @@ static void tpo_td043_power_off(struct omap_dss_device *dssdev)
>  	struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev);
>  	int nreset_gpio = dssdev->reset_gpio;
>  
> +	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> +		return;
> +
>  	tpo_td043_write(tpo_td043->spi, 3,
>  			TPO_R03_VAL_STANDBY | TPO_R03_EN_PWM);
>  
> -- 
> 1.7.0.4
> 
> 
> 
>

Patch

diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c
index 300eff5..395a68d 100644
--- a/drivers/video/omap2/displays/panel-generic.c
+++ b/drivers/video/omap2/displays/panel-generic.c
@@ -39,6 +39,9 @@  static int generic_panel_power_on(struct omap_dss_device *dssdev)
 {
 	int r;
 
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	r = omapdss_dpi_display_enable(dssdev);
 	if (r)
 		goto err0;
@@ -58,6 +61,9 @@  err0:
 
 static void generic_panel_power_off(struct omap_dss_device *dssdev)
 {
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return;
+
 	if (dssdev->platform_disable)
 		dssdev->platform_disable(dssdev);
 
diff --git a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c
index 1026746..0c6896c 100644
--- a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c
+++ b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c
@@ -43,6 +43,9 @@  static int sharp_lq_panel_power_on(struct omap_dss_device *dssdev)
 {
 	int r;
 
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	r = omapdss_dpi_display_enable(dssdev);
 	if (r)
 		goto err0;
@@ -65,6 +68,9 @@  err0:
 
 static void sharp_lq_panel_power_off(struct omap_dss_device *dssdev)
 {
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return;
+
 	if (dssdev->platform_disable)
 		dssdev->platform_disable(dssdev);
 
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
index 7d9eb2b..9a138f6 100644
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
@@ -135,6 +135,9 @@  static int sharp_ls_power_on(struct omap_dss_device *dssdev)
 {
 	int r = 0;
 
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	r = omapdss_dpi_display_enable(dssdev);
 	if (r)
 		goto err0;
@@ -157,6 +160,9 @@  err0:
 
 static void sharp_ls_power_off(struct omap_dss_device *dssdev)
 {
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return;
+
 	if (dssdev->platform_disable)
 		dssdev->platform_disable(dssdev);
 
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index aaf5d30..c649f06 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -635,6 +635,9 @@  static int taal_power_on(struct omap_dss_device *dssdev)
 	u8 id1, id2, id3;
 	int r;
 
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	if (dssdev->platform_enable) {
 		r = dssdev->platform_enable(dssdev);
 		if (r)
@@ -715,6 +718,9 @@  static void taal_power_off(struct omap_dss_device *dssdev)
 {
 	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
 
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return;
+
 	dsi_bus_lock();
 
 	cancel_delayed_work(&td->esd_work);
diff --git a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c
index fa434ca..49e1dec 100644
--- a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c
+++ b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c
@@ -46,6 +46,9 @@  static int toppoly_tdo_panel_power_on(struct omap_dss_device *dssdev)
 {
 	int r;
 
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	r = omapdss_dpi_display_enable(dssdev);
 	if (r)
 		goto err0;
@@ -65,6 +68,9 @@  err0:
 
 static void toppoly_tdo_panel_power_off(struct omap_dss_device *dssdev)
 {
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return;
+
 	if (dssdev->platform_disable)
 		dssdev->platform_disable(dssdev);
 
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
index e866e76..dbe9d43 100644
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
+++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
@@ -269,6 +269,9 @@  static int tpo_td043_power_on(struct omap_dss_device *dssdev)
 	int nreset_gpio = dssdev->reset_gpio;
 	int r;
 
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+		return 0;
+
 	r = omapdss_dpi_display_enable(dssdev);
 	if (r)
 		goto err0;
@@ -308,6 +311,9 @@  static void tpo_td043_power_off(struct omap_dss_device *dssdev)
 	struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev);
 	int nreset_gpio = dssdev->reset_gpio;
 
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+		return;
+
 	tpo_td043_write(tpo_td043->spi, 3,
 			TPO_R03_VAL_STANDBY | TPO_R03_EN_PWM);