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

login
register
mail settings
Submitter Mathieu Poirier
Date Sept. 3, 2010, 5:04 p.m.
Message ID <1283533494.2254.24.camel@black>
Download mbox | patch
Permalink /patch/63701/
State Accepted
Delegated to: Leann Ogasawara
Headers show

Comments

Mathieu Poirier - Sept. 3, 2010, 5:04 p.m.
This patch fixes:

BugLink: http://bugs.launchpad.net/bugs/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

stanley.miao (1):
      DSS2: Don't power off a panel twice

 drivers/video/omap2/displays/panel-acx565akm.c     |    6 ++++++
 drivers/video/omap2/displays/panel-generic.c       |    6 ++++++
 .../video/omap2/displays/panel-sharp-lq043t1dg01.c |    6 ++++++
 .../video/omap2/displays/panel-sharp-ls037v7dw01.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 639f003679bae1b14addc5946d422dbc40aa538b Mon Sep 17 00:00:00 2001
From: stanley.miao <stanley.miao@windriver.com>
Date: Fri, 3 Sep 2010 10:14:30 -0600
Subject: [PATCH] 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=128348306405397&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>
---
 drivers/video/omap2/displays/panel-acx565akm.c     |    6 ++++++
 drivers/video/omap2/displays/panel-generic.c       |    6 ++++++
 .../video/omap2/displays/panel-sharp-lq043t1dg01.c |    6 ++++++
 .../video/omap2/displays/panel-sharp-ls037v7dw01.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. 7, 2010, 10:25 p.m.
Applied to Maverick linux master.

Thanks,
Leann

On Fri, 2010-09-03 at 11:04 -0600, Mathieu Poirier wrote:
> This patch fixes:
> 
> BugLink: http://bugs.launchpad.net/bugs/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
> 
> stanley.miao (1):
>       DSS2: Don't power off a panel twice
> 
>  drivers/video/omap2/displays/panel-acx565akm.c     |    6 ++++++
>  drivers/video/omap2/displays/panel-generic.c       |    6 ++++++
>  .../video/omap2/displays/panel-sharp-lq043t1dg01.c |    6 ++++++
>  .../video/omap2/displays/panel-sharp-ls037v7dw01.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 639f003679bae1b14addc5946d422dbc40aa538b Mon Sep 17 00:00:00 2001
> From: stanley.miao <stanley.miao@windriver.com>
> Date: Fri, 3 Sep 2010 10:14:30 -0600
> Subject: [PATCH] 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=128348306405397&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>
> ---
>  drivers/video/omap2/displays/panel-acx565akm.c     |    6 ++++++
>  drivers/video/omap2/displays/panel-generic.c       |    6 ++++++
>  .../video/omap2/displays/panel-sharp-lq043t1dg01.c |    6 ++++++
>  .../video/omap2/displays/panel-sharp-ls037v7dw01.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-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
> index 1f8eb70..499ba3d 100644
> --- a/drivers/video/omap2/displays/panel-acx565akm.c
> +++ b/drivers/video/omap2/displays/panel-acx565akm.c
> @@ -587,6 +587,9 @@ static int acx_panel_power_on(struct omap_dss_device *dssdev)
>  
>  	dev_dbg(&dssdev->dev, "%s\n", __func__);
>  
> +       if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
> +               return 0;
> +
>  	mutex_lock(&md->mutex);
>  
>  	r = omapdss_sdi_display_enable(dssdev);
> @@ -642,6 +645,9 @@ static void acx_panel_power_off(struct omap_dss_device *dssdev)
>  
>  	dev_dbg(&dssdev->dev, "%s\n", __func__);
>  
> +       if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> +               return;
> +
>  	mutex_lock(&md->mutex);
>  
>  	if (!md->enabled) {
> diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c
> index 300eff5..96d3d13 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..e3ef390 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..7bddedc 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-toppoly-tdo35s.c b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c
> index fa434ca..2736fa8 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..e1fa652 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-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
index 1f8eb70..499ba3d 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -587,6 +587,9 @@  static int acx_panel_power_on(struct omap_dss_device *dssdev)
 
 	dev_dbg(&dssdev->dev, "%s\n", __func__);
 
+       if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+               return 0;
+
 	mutex_lock(&md->mutex);
 
 	r = omapdss_sdi_display_enable(dssdev);
@@ -642,6 +645,9 @@  static void acx_panel_power_off(struct omap_dss_device *dssdev)
 
 	dev_dbg(&dssdev->dev, "%s\n", __func__);
 
+       if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
+               return;
+
 	mutex_lock(&md->mutex);
 
 	if (!md->enabled) {
diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c
index 300eff5..96d3d13 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..e3ef390 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..7bddedc 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-toppoly-tdo35s.c b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c
index fa434ca..2736fa8 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..e1fa652 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);