All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] apple-gmux: Add suspend/resume support for the backlight
@ 2012-04-19 15:55 Seth Forshee
  2012-05-03 19:36 ` Seth Forshee
  2012-05-10 16:06 ` David Woodhouse
  0 siblings, 2 replies; 9+ messages in thread
From: Seth Forshee @ 2012-04-19 15:55 UTC (permalink / raw)
  To: Matthew Garrett, platform-driver-x86; +Cc: Seth Forshee

After S3, the brightness might not be restored to the pre-suspend value.
Request status update calls from the backlight core on suspend/resume to
ensure the brightness value is restored.

Reported-and-tested-by: Austin Lund <austin.lund@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 drivers/platform/x86/apple-gmux.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index 8a582bd..6dcef4f 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -87,6 +87,9 @@ static int gmux_update_status(struct backlight_device *bd)
 	struct apple_gmux_data *gmux_data = bl_get_data(bd);
 	u32 brightness = bd->props.brightness;
 
+	if (bd->props.state & BL_CORE_SUSPENDED)
+		brightness = 0;
+
 	/*
 	 * Older gmux versions require writing out lower bytes first then
 	 * setting the upper byte to 0 to flush the values. Newer versions
@@ -102,6 +105,7 @@ static int gmux_update_status(struct backlight_device *bd)
 }
 
 static const struct backlight_ops gmux_bl_ops = {
+	.options = BL_CORE_SUSPENDRESUME,
 	.get_brightness = gmux_get_brightness,
 	.update_status = gmux_update_status,
 };
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] apple-gmux: Add suspend/resume support for the backlight
  2012-04-19 15:55 [PATCH] apple-gmux: Add suspend/resume support for the backlight Seth Forshee
@ 2012-05-03 19:36 ` Seth Forshee
  2012-05-03 19:59   ` Matthew Garrett
  2012-05-10 16:06 ` David Woodhouse
  1 sibling, 1 reply; 9+ messages in thread
From: Seth Forshee @ 2012-05-03 19:36 UTC (permalink / raw)
  To: Matthew Garrett, platform-driver-x86

Ping. Any chance of getting this into 3.4?

On Thu, Apr 19, 2012 at 10:55:35AM -0500, Seth Forshee wrote:
> After S3, the brightness might not be restored to the pre-suspend value.
> Request status update calls from the backlight core on suspend/resume to
> ensure the brightness value is restored.
> 
> Reported-and-tested-by: Austin Lund <austin.lund@gmail.com>
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> ---
>  drivers/platform/x86/apple-gmux.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
> index 8a582bd..6dcef4f 100644
> --- a/drivers/platform/x86/apple-gmux.c
> +++ b/drivers/platform/x86/apple-gmux.c
> @@ -87,6 +87,9 @@ static int gmux_update_status(struct backlight_device *bd)
>  	struct apple_gmux_data *gmux_data = bl_get_data(bd);
>  	u32 brightness = bd->props.brightness;
>  
> +	if (bd->props.state & BL_CORE_SUSPENDED)
> +		brightness = 0;
> +
>  	/*
>  	 * Older gmux versions require writing out lower bytes first then
>  	 * setting the upper byte to 0 to flush the values. Newer versions
> @@ -102,6 +105,7 @@ static int gmux_update_status(struct backlight_device *bd)
>  }
>  
>  static const struct backlight_ops gmux_bl_ops = {
> +	.options = BL_CORE_SUSPENDRESUME,
>  	.get_brightness = gmux_get_brightness,
>  	.update_status = gmux_update_status,
>  };
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] apple-gmux: Add suspend/resume support for the backlight
  2012-05-03 19:36 ` Seth Forshee
@ 2012-05-03 19:59   ` Matthew Garrett
  2012-05-03 20:33     ` Matthew Garrett
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew Garrett @ 2012-05-03 19:59 UTC (permalink / raw)
  To: Seth Forshee; +Cc: platform-driver-x86

Looks reasonable. I'll send today or tomorrow.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] apple-gmux: Add suspend/resume support for the backlight
  2012-05-03 19:59   ` Matthew Garrett
@ 2012-05-03 20:33     ` Matthew Garrett
  2012-05-07 16:29       ` Seth Forshee
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew Garrett @ 2012-05-03 20:33 UTC (permalink / raw)
  To: Seth Forshee; +Cc: platform-driver-x86

Applied to -next, thanks

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] apple-gmux: Add suspend/resume support for the backlight
  2012-05-03 20:33     ` Matthew Garrett
@ 2012-05-07 16:29       ` Seth Forshee
  0 siblings, 0 replies; 9+ messages in thread
From: Seth Forshee @ 2012-05-07 16:29 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86

On Thu, May 03, 2012 at 09:33:32PM +0100, Matthew Garrett wrote:
> Applied to -next, thanks

I thought you were going to send this one for 3.4?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] apple-gmux: Add suspend/resume support for the backlight
  2012-04-19 15:55 [PATCH] apple-gmux: Add suspend/resume support for the backlight Seth Forshee
  2012-05-03 19:36 ` Seth Forshee
@ 2012-05-10 16:06 ` David Woodhouse
  2012-05-10 16:23   ` Seth Forshee
  1 sibling, 1 reply; 9+ messages in thread
From: David Woodhouse @ 2012-05-10 16:06 UTC (permalink / raw)
  To: Seth Forshee; +Cc: Matthew Garrett, platform-driver-x86

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

On Thu, 2012-04-19 at 10:55 -0500, Seth Forshee wrote:
> --- a/drivers/platform/x86/apple-gmux.c
> +++ b/drivers/platform/x86/apple-gmux.c
> @@ -87,6 +87,9 @@ static int gmux_update_status(struct backlight_device *bd)
>         struct apple_gmux_data *gmux_data = bl_get_data(bd);
>         u32 brightness = bd->props.brightness;
>  
> +       if (bd->props.state & BL_CORE_SUSPENDED)
> +               brightness = 0;
> +
>         /*
>          * Older gmux versions require writing out lower bytes first then
>          * setting the upper byte to 0 to flush the values. Newer versions

Is this part necessary? It's about to be turned off *anyway*, and
turning it off sooner will achieve little other than to make it harder
to debug suspend failures, surely?

-- 
dwmw2

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] apple-gmux: Add suspend/resume support for the backlight
  2012-05-10 16:06 ` David Woodhouse
@ 2012-05-10 16:23   ` Seth Forshee
  2012-05-10 16:49     ` David Woodhouse
  0 siblings, 1 reply; 9+ messages in thread
From: Seth Forshee @ 2012-05-10 16:23 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Matthew Garrett, platform-driver-x86

On Thu, May 10, 2012 at 09:06:52AM -0700, David Woodhouse wrote:
> On Thu, 2012-04-19 at 10:55 -0500, Seth Forshee wrote:
> > --- a/drivers/platform/x86/apple-gmux.c
> > +++ b/drivers/platform/x86/apple-gmux.c
> > @@ -87,6 +87,9 @@ static int gmux_update_status(struct backlight_device *bd)
> >         struct apple_gmux_data *gmux_data = bl_get_data(bd);
> >         u32 brightness = bd->props.brightness;
> >  
> > +       if (bd->props.state & BL_CORE_SUSPENDED)
> > +               brightness = 0;
> > +
> >         /*
> >          * Older gmux versions require writing out lower bytes first then
> >          * setting the upper byte to 0 to flush the values. Newer versions
> 
> Is this part necessary? It's about to be turned off *anyway*, and
> turning it off sooner will achieve little other than to make it harder
> to debug suspend failures, surely?

No, I suppose it isn't strictly necessary. I added it to avoid having
the backlight turned off when the lid is closed and then turned back on
while suspending.

Seth

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] apple-gmux: Add suspend/resume support for the backlight
  2012-05-10 16:23   ` Seth Forshee
@ 2012-05-10 16:49     ` David Woodhouse
  2012-05-10 17:05       ` Seth Forshee
  0 siblings, 1 reply; 9+ messages in thread
From: David Woodhouse @ 2012-05-10 16:49 UTC (permalink / raw)
  To: Seth Forshee; +Cc: Matthew Garrett, platform-driver-x86

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

On Thu, 2012-05-10 at 09:23 -0700, Seth Forshee wrote:
> On Thu, May 10, 2012 at 09:06:52AM -0700, David Woodhouse wrote:
> > On Thu, 2012-04-19 at 10:55 -0500, Seth Forshee wrote:
> > > --- a/drivers/platform/x86/apple-gmux.c
> > > +++ b/drivers/platform/x86/apple-gmux.c
> > > @@ -87,6 +87,9 @@ static int gmux_update_status(struct backlight_device *bd)
> > >         struct apple_gmux_data *gmux_data = bl_get_data(bd);
> > >         u32 brightness = bd->props.brightness;
> > >  
> > > +       if (bd->props.state & BL_CORE_SUSPENDED)
> > > +               brightness = 0;
> > > +
> > >         /*
> > >          * Older gmux versions require writing out lower bytes first then
> > >          * setting the upper byte to 0 to flush the values. Newer versions
> > 
> > Is this part necessary? It's about to be turned off *anyway*, and
> > turning it off sooner will achieve little other than to make it harder
> > to debug suspend failures, surely?
> 
> No, I suppose it isn't strictly necessary. I added it to avoid having
> the backlight turned off when the lid is closed and then turned back on
> while suspending.

That's achievable with

 if (bd->props.state & BL_CORE_SUSPENDED)
    return;

right?

-- 
dwmw2

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] apple-gmux: Add suspend/resume support for the backlight
  2012-05-10 16:49     ` David Woodhouse
@ 2012-05-10 17:05       ` Seth Forshee
  0 siblings, 0 replies; 9+ messages in thread
From: Seth Forshee @ 2012-05-10 17:05 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Matthew Garrett, platform-driver-x86

On Thu, May 10, 2012 at 09:49:48AM -0700, David Woodhouse wrote:
> On Thu, 2012-05-10 at 09:23 -0700, Seth Forshee wrote:
> > On Thu, May 10, 2012 at 09:06:52AM -0700, David Woodhouse wrote:
> > > On Thu, 2012-04-19 at 10:55 -0500, Seth Forshee wrote:
> > > > --- a/drivers/platform/x86/apple-gmux.c
> > > > +++ b/drivers/platform/x86/apple-gmux.c
> > > > @@ -87,6 +87,9 @@ static int gmux_update_status(struct backlight_device *bd)
> > > >         struct apple_gmux_data *gmux_data = bl_get_data(bd);
> > > >         u32 brightness = bd->props.brightness;
> > > >  
> > > > +       if (bd->props.state & BL_CORE_SUSPENDED)
> > > > +               brightness = 0;
> > > > +
> > > >         /*
> > > >          * Older gmux versions require writing out lower bytes first then
> > > >          * setting the upper byte to 0 to flush the values. Newer versions
> > > 
> > > Is this part necessary? It's about to be turned off *anyway*, and
> > > turning it off sooner will achieve little other than to make it harder
> > > to debug suspend failures, surely?
> > 
> > No, I suppose it isn't strictly necessary. I added it to avoid having
> > the backlight turned off when the lid is closed and then turned back on
> > while suspending.
> 
> That's achievable with
> 
>  if (bd->props.state & BL_CORE_SUSPENDED)
>     return;
> 
> right?

Good point. I'll send an updated patch.

Seth

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-05-10 17:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 15:55 [PATCH] apple-gmux: Add suspend/resume support for the backlight Seth Forshee
2012-05-03 19:36 ` Seth Forshee
2012-05-03 19:59   ` Matthew Garrett
2012-05-03 20:33     ` Matthew Garrett
2012-05-07 16:29       ` Seth Forshee
2012-05-10 16:06 ` David Woodhouse
2012-05-10 16:23   ` Seth Forshee
2012-05-10 16:49     ` David Woodhouse
2012-05-10 17:05       ` Seth Forshee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.