linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: i915/kms/backlight-combo mode problem
  2011-05-05 20:42   ` i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5) Melchior FRANZ
@ 2011-05-06  8:52     ` Melchior FRANZ
  2011-05-06 12:41       ` Joey Lee
  0 siblings, 1 reply; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-06  8:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Takashi Iwai, Chris Wilson, dri-devel, Carlos Corbacho, Joey Lee

* Melchior FRANZ -- Thursday 05 May 2011:
> This revised patch works correctly for me.

... and changing backlight brightness worked with acpi_osi=Linux, too.
Unfortunately, that does no longer work now, although I haven't changed
anything. Pressing the brightness buttons causes some ACPI debug output,
but it doesn't adjust anything.

m. 

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-06  8:52     ` i915/kms/backlight-combo mode problem Melchior FRANZ
@ 2011-05-06 12:41       ` Joey Lee
  2011-05-06 16:23         ` Melchior FRANZ
  0 siblings, 1 reply; 26+ messages in thread
From: Joey Lee @ 2011-05-06 12:41 UTC (permalink / raw)
  To: melchior.franz; +Cc: chris, dri-devel, Joey Lee, carlos, tiwai, linux-kernel

Hi Melchior, 

於 五,2011-05-06 於 10:52 +0200,Melchior FRANZ 提到:
> * Melchior FRANZ -- Thursday 05 May 2011:
> > This revised patch works correctly for me.
> 
> ... and changing backlight brightness worked with acpi_osi=Linux, too.
> Unfortunately, that does no longer work now, although I haven't changed
> anything. Pressing the brightness buttons causes some ACPI debug output,
> but it doesn't adjust anything.
> 
> m. 

hmm........ Takashi's patch works before, but doesn't work now?

Does that because my new patch for bko#34142 ? Could you please add
acer-wmi to /etc/modprobe.d/blacklist then reboot machine ?

Step:
	- add acer-wmi to /etc/modprobe.d/blacklist
	- shutdown your machine
	- remove AC power and notebook's battery
	- plugin AC power then boot your notebook
	- check the brightness control 


Thank's
Joey Lee


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

* Re: i915/kms/backlight-combo mode problem
  2011-05-06 12:41       ` Joey Lee
@ 2011-05-06 16:23         ` Melchior FRANZ
  2011-05-07 20:22           ` Melchior FRANZ
  0 siblings, 1 reply; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-06 16:23 UTC (permalink / raw)
  To: Joey Lee; +Cc: chris, dri-devel, carlos, tiwai, linux-kernel

* Joey Lee -- Friday 06 May 2011:
> 於 五,2011-05-06 於 10:52 +0200,Melchior FRANZ 提到:
> > ... and changing backlight brightness worked with acpi_osi=Linux, too.
> > Unfortunately, that does no longer work now, although I haven't changed
> > anything. Pressing the brightness buttons causes some ACPI debug output,
> > but it doesn't adjust anything.

> hmm........ Takashi's patch works before, but doesn't work now?

Argh ... sorry Takashi. Joey is right. I thought I had tested that,
but apparently not. Indeed, your last patch prevents the backlight
from being turned off, but it also breaks the brightness adjustment
keys at runtime with acpi_osi=Linux. And without that it doesn't
work, anyway, just like before. I'll add some more debug messages ...



> Does that because my new patch for bko#34142 ? Could you please add
> acer-wmi to /etc/modprobe.d/blacklist then reboot machine ?

Done. No, your patch is not involved. But backing out Takashi's
patch and re-applying confirmed that it's that patch.

m.

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-06 16:23         ` Melchior FRANZ
@ 2011-05-07 20:22           ` Melchior FRANZ
  2011-05-08 13:41             ` Joey Lee
  2011-05-09  8:58             ` Takashi Iwai
  0 siblings, 2 replies; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-07 20:22 UTC (permalink / raw)
  To: linux-kernel, tiwai; +Cc: Joey Lee, chris, dri-devel

* Melchior FRANZ -- Friday 06 May 2011:
> last patch prevents the backlight from being turned off, but it also
> breaks the brightness adjustment keys at runtime with acpi_osi=Linux.

It has turned out that acpi key events seem to be handled correctly
and even the state of /sys/class/backlight/acer-wmi/brightness is
updated accordingly. The only problem is that this maintained
brightness state isn't applied to the actual backlight. It remains
at highest level. Google pointed me to this workaround for another
Acer notebook:

  https://help.ubuntu.com/community/AspireTimeline/Fixes#Alternative%20fix%20for%2010.10

This uses the acpid to write the brightness value to the display
using setpci. And this works on my notebook as well (Acer Travelmate
5735Z-452G32Mnss). Not pretty but better than nothing. Is Acer
not able to build proper notebooks? Or is it a kernel bug?

m.

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-07 20:22           ` Melchior FRANZ
@ 2011-05-08 13:41             ` Joey Lee
  2011-05-08 14:05               ` Melchior FRANZ
  2011-05-09  8:58             ` Takashi Iwai
  1 sibling, 1 reply; 26+ messages in thread
From: Joey Lee @ 2011-05-08 13:41 UTC (permalink / raw)
  To: melchior.franz; +Cc: chris, dri-devel, Joey Lee, tiwai, linux-kernel

於 六,2011-05-07 於 22:22 +0200,Melchior FRANZ 提到:
> * Melchior FRANZ -- Friday 06 May 2011:
> > last patch prevents the backlight from being turned off, but it also
> > breaks the brightness adjustment keys at runtime with acpi_osi=Linux.
> 
> It has turned out that acpi key events seem to be handled correctly
> and even the state of /sys/class/backlight/acer-wmi/brightness is

That's interesting for acer-wmi generated brightness interface when this
machine declare acpi brightness interface in DSDT.

> updated accordingly. The only problem is that this maintained

Does it work to you direct control brightness by access
by /sys/class/backlight/acer-wmi/brightness ?

> brightness state isn't applied to the actual backlight. It remains
> at highest level. Google pointed me to this workaround for another
> Acer notebook:
> 
>   https://help.ubuntu.com/community/AspireTimeline/Fixes#Alternative%20fix%20for%2010.10
> 
> This uses the acpid to write the brightness value to the display
> using setpci. And this works on my notebook as well (Acer Travelmate

As I remember, use setpci to control brightness is not recommended
because BIOS or ACPI will also touch brightness level. That will be
better control brightness by the function that was provided by BIOS. 
e.g. ACPI or WMI interface, or direct control by EC.

That means that will be better fix your Fn key control brightness like
before, you just need press Fn key to change brightness and don't need
have any workaround.

> 5735Z-452G32Mnss). Not pretty but better than nothing. Is Acer
> not able to build proper notebooks? Or is it a kernel bug?
> 
> m.

Looks like current status is we try to fix bko#31522 but the patch
causes your brightness no work by press Fn key even with acpi_osi=Linux.
Does it right?

Could you please also help to check:
	replace acpi_osi=Linux by acpi_osi="!Windows 2006"

Does it also works to you for backlight control?


Thank's
Joey Lee


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

* Re: i915/kms/backlight-combo mode problem
  2011-05-08 13:41             ` Joey Lee
@ 2011-05-08 14:05               ` Melchior FRANZ
  2011-05-09  8:50                 ` Joey Lee
  0 siblings, 1 reply; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-08 14:05 UTC (permalink / raw)
  To: Joey Lee; +Cc: chris, dri-devel, tiwai, linux-kernel

* Joey Lee -- Sunday 08 May 2011:
> 於 六,2011-05-07 於 22:22 +0200,Melchior FRANZ 提到:
> > It has turned out that acpi key events seem to be handled correctly
> > and even the state of /sys/class/backlight/acer-wmi/brightness is
> 
> That's interesting for acer-wmi generated brightness interface when this
> machine declare acpi brightness interface in DSDT.

I'm sorry to give contradicting info. Yesterday I saw a subdir acer-wmi
(or acer_wmi) in /sys/class/backlight/ during one of my tests (with/without
acer_wmi, with/without acpi_osi=Linux). Now I left acpi_osi=Linux
away and allow acer_wmi, and it's subdir acpi_video0. Next time I'll
make notes.



> Does it work to you direct control brightness by access
> by /sys/class/backlight/acer-wmi/brightness ?

No. A number written to this virtual file is accepted and remembered,
but it doesn't actually change the brightness. It takes setpci to do
that. 


 
> As I remember, use setpci to control brightness is not recommended
> because BIOS or ACPI will also touch brightness level. That will be
> better control brightness by the function that was provided by BIOS. 
> e.g. ACPI or WMI interface, or direct control by EC.

Well, sounds plausible. And I wouldn't do it if it weren't the only
way at the moment.  :-)



> That means that will be better fix your Fn key control brightness like
> before, you just need press Fn key to change brightness and don't need
> have any workaround.

OK. I have added a lot of debug messages to intel_panel.c yesterday.
All it told me was that it seems to work correctly wiht acpi_osi=Linux.
Except that it doesn't actually change the brightness. Without acpi_osi
the functions aren't called at all and none of my messages showed up.



> Looks like current status is we try to fix bko#31522 but the patch
> causes your brightness no work by press Fn key even with acpi_osi=Linux.
> Does it right?

The history is: with acpi_osi=Linux everything worked with 2.6.38-rc8.
With 2.6.38 the screen stayed black. The patch that only ignored lbpc=0
worked (IIRC) including key adjustment. Later patches broke keys.



> 	replace acpi_osi=Linux by acpi_osi="!Windows 2006"
> 
> Does it also works to you for backlight control?

No, doesn't work.

m.

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-08 14:05               ` Melchior FRANZ
@ 2011-05-09  8:50                 ` Joey Lee
  2011-05-09  9:00                   ` Takashi Iwai
  2011-05-09 10:08                   ` Melchior FRANZ
  0 siblings, 2 replies; 26+ messages in thread
From: Joey Lee @ 2011-05-09  8:50 UTC (permalink / raw)
  To: melchior.franz
  Cc: chris, dri-devel, Joey Lee, Michael Chang, tiwai, linux-kernel

Add Cc. Michael Chang for he is our i915 expert.

Hi Melchior, 

於 日,2011-05-08 於 16:05 +0200,Melchior FRANZ 提到:
> 
> > Does it work to you direct control brightness by access
> > by /sys/class/backlight/acer-wmi/brightness ?
> 
> No. A number written to this virtual file is accepted and remembered,
> but it doesn't actually change the brightness. It takes setpci to do
> that. 
> 

I thought the video driver still is the KEY component for backlight
issues, need fix the problem in video driver first.

> 
>  
> > As I remember, use setpci to control brightness is not recommended
> > because BIOS or ACPI will also touch brightness level. That will be
> > better control brightness by the function that was provided by BIOS. 
> > e.g. ACPI or WMI interface, or direct control by EC.
> 
> Well, sounds plausible. And I wouldn't do it if it weren't the only
> way at the moment.  :-)
> 
> 
> 
> > That means that will be better fix your Fn key control brightness like
> > before, you just need press Fn key to change brightness and don't need
> > have any workaround.
> 
> OK. I have added a lot of debug messages to intel_panel.c yesterday.
> All it told me was that it seems to work correctly wiht acpi_osi=Linux.
> Except that it doesn't actually change the brightness. Without acpi_osi
> the functions aren't called at all and none of my messages showed up.
> 

I traced _Q event in your DSDT, when acpi_osi=Linux, it run the Intel
OpRegion logic for change brightness. And, finally, intel_opregion will
access the function the were provided by intel_panel. So, the problem
still back to intel_panel.

After discuss with Michael chang, we thought there have problem in your
brightness level after add combination mode:

vi driver/gpu/drm/i915/intel_panel.c

void intel_panel_set_backlight(struct drm_device *dev, u32 level)
{
        struct drm_i915_private *dev_priv = dev->dev_private;
        u32 tmp;

        DRM_DEBUG_DRIVER("set backlight PWM = %d\n", level);

        if (HAS_PCH_SPLIT(dev))
                return intel_pch_panel_set_backlight(dev, level);

        if (is_backlight_combination_mode(dev)){
                u32 max = intel_panel_get_max_backlight(dev);
                u8 lbpc;

                lbpc = level * 0xfe / max + 1;
                level /= lbpc;			/* maybe the level changed by lbpc */
                pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
        }

        tmp = I915_READ(BLC_PWM_CTL);
        if (IS_PINEVIEW(dev)) {
                tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
                level <<= 1;
        } else
                tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
        I915_WRITE(BLC_PWM_CTL, tmp | level);
}

We need to know some run time value when intel_panel_set_backlight call by funciton key.
Please help to apply the attached debug patch to intel_panel.c then attached dmesg.

> 
> 
> > Looks like current status is we try to fix bko#31522 but the patch
> > causes your brightness no work by press Fn key even with acpi_osi=Linux.
> > Does it right?
> 
> The history is: with acpi_osi=Linux everything worked with 2.6.38-rc8.
> With 2.6.38 the screen stayed black. The patch that only ignored lbpc=0
> worked (IIRC) including key adjustment. Later patches broke keys.
> 
> 
> 
> > 	replace acpi_osi=Linux by acpi_osi="!Windows 2006"
> > 
> > Does it also works to you for backlight control?
> 
> No, doesn't work.
> 

We can test the acpi_osi="!Windows 2006" again after we fix the i915's
problem.


Thank's
Joey Lee

The following is debug patch, and please add kernel parameter
drm.debug=0x02 :

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index f8f86e5..f62dbd9 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -236,17 +236,22 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
 		u32 max = intel_panel_get_max_backlight(dev);
 		u8 lbpc;
 
+		DRM_DEBUG_DRIVER("set backlight max = % 		lbpc = level * 0xfe / max + 1;
+		DRM_DEBUG_DRIVER("set backlight lbpc = %d\n", lbpc);
 		level /= lbpc;
 		pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
 	}
 
 	tmp = I915_READ(BLC_PWM_CTL);
+	DRM_DEBUG_DRIVER("set backlight tmp(1) = %d\n", tmp);
 	if (IS_PINEVIEW(dev)) {
 		tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
 		level <<= 1;
 	} else
 		tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
+	DRM_DEBUG_DRIVER("set backlight tmp(2) = %d\n", tmp);
+	DRM_DEBUG_DRIVER("set backlight level = %d\n", level);
 	I915_WRITE(BLC_PWM_CTL, tmp | level);
 }
 



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

* Re: i915/kms/backlight-combo mode problem
  2011-05-07 20:22           ` Melchior FRANZ
  2011-05-08 13:41             ` Joey Lee
@ 2011-05-09  8:58             ` Takashi Iwai
  1 sibling, 0 replies; 26+ messages in thread
From: Takashi Iwai @ 2011-05-09  8:58 UTC (permalink / raw)
  To: Melchior FRANZ; +Cc: linux-kernel, Joey Lee, chris, dri-devel

At Sat, 7 May 2011 22:22:40 +0200,
Melchior FRANZ wrote:
> 
> * Melchior FRANZ -- Friday 06 May 2011:
> > last patch prevents the backlight from being turned off, but it also
> > breaks the brightness adjustment keys at runtime with acpi_osi=Linux.
> 
> It has turned out that acpi key events seem to be handled correctly
> and even the state of /sys/class/backlight/acer-wmi/brightness is
> updated accordingly. The only problem is that this maintained
> brightness state isn't applied to the actual backlight. It remains
> at highest level. Google pointed me to this workaround for another
> Acer notebook:
> 
>   https://help.ubuntu.com/community/AspireTimeline/Fixes#Alternative%20fix%20for%2010.10
> 
> This uses the acpid to write the brightness value to the display
> using setpci. And this works on my notebook as well (Acer Travelmate
> 5735Z-452G32Mnss).

Then we miss something.  With the hack above, you are doing nothing
but writing LBPC register value externally from setpci.  It implies
that the write to LBPC basically works on your machine.


Takashi

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-09  8:50                 ` Joey Lee
@ 2011-05-09  9:00                   ` Takashi Iwai
  2011-05-09  9:35                     ` Joey Lee
  2011-05-09 10:08                   ` Melchior FRANZ
  1 sibling, 1 reply; 26+ messages in thread
From: Takashi Iwai @ 2011-05-09  9:00 UTC (permalink / raw)
  To: Joey Lee
  Cc: melchior.franz, chris, dri-devel, Joey Lee, Michael Chang,
	linux-kernel

At Mon, 09 May 2011 02:50:50 -0600,
Joey Lee wrote:
> 
> Add Cc. Michael Chang for he is our i915 expert.
> 
> Hi Melchior, 
> 
> 於 日,2011-05-08 於 16:05 +0200,Melchior FRANZ 提到:
> > 
> > > Does it work to you direct control brightness by access
> > > by /sys/class/backlight/acer-wmi/brightness ?
> > 
> > No. A number written to this virtual file is accepted and remembered,
> > but it doesn't actually change the brightness. It takes setpci to do
> > that. 
> > 
> 
> I thought the video driver still is the KEY component for backlight
> issues, need fix the problem in video driver first.
> 
> > 
> >  
> > > As I remember, use setpci to control brightness is not recommended
> > > because BIOS or ACPI will also touch brightness level. That will be
> > > better control brightness by the function that was provided by BIOS. 
> > > e.g. ACPI or WMI interface, or direct control by EC.
> > 
> > Well, sounds plausible. And I wouldn't do it if it weren't the only
> > way at the moment.  :-)
> > 
> > 
> > 
> > > That means that will be better fix your Fn key control brightness like
> > > before, you just need press Fn key to change brightness and don't need
> > > have any workaround.
> > 
> > OK. I have added a lot of debug messages to intel_panel.c yesterday.
> > All it told me was that it seems to work correctly wiht acpi_osi=Linux.
> > Except that it doesn't actually change the brightness. Without acpi_osi
> > the functions aren't called at all and none of my messages showed up.
> > 
> 
> I traced _Q event in your DSDT, when acpi_osi=Linux, it run the Intel
> OpRegion logic for change brightness. And, finally, intel_opregion will
> access the function the were provided by intel_panel. So, the problem
> still back to intel_panel.
> 
> After discuss with Michael chang, we thought there have problem in your
> brightness level after add combination mode:
> 
> vi driver/gpu/drm/i915/intel_panel.c
> 
> void intel_panel_set_backlight(struct drm_device *dev, u32 level)
> {
>         struct drm_i915_private *dev_priv = dev->dev_private;
>         u32 tmp;
> 
>         DRM_DEBUG_DRIVER("set backlight PWM = %d\n", level);
> 
>         if (HAS_PCH_SPLIT(dev))
>                 return intel_pch_panel_set_backlight(dev, level);
> 
>         if (is_backlight_combination_mode(dev)){
>                 u32 max = intel_panel_get_max_backlight(dev);
>                 u8 lbpc;
> 
>                 lbpc = level * 0xfe / max + 1;
>                 level /= lbpc;			/* maybe the level changed by lbpc */
>                 pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
>         }
> 
>         tmp = I915_READ(BLC_PWM_CTL);
>         if (IS_PINEVIEW(dev)) {
>                 tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
>                 level <<= 1;
>         } else
>                 tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
>         I915_WRITE(BLC_PWM_CTL, tmp | level);
> }
> 
> We need to know some run time value when intel_panel_set_backlight call by funciton key.

Yes, that'll help understanding.

> Please help to apply the attached debug patch to intel_panel.c then attached dmesg.

The patch has an obvious typo :)
Also, we should track the value in intel_panel_get_backlight(), too.


Takashi


> > > Looks like current status is we try to fix bko#31522 but the patch
> > > causes your brightness no work by press Fn key even with acpi_osi=Linux.
> > > Does it right?
> > 
> > The history is: with acpi_osi=Linux everything worked with 2.6.38-rc8.
> > With 2.6.38 the screen stayed black. The patch that only ignored lbpc=0
> > worked (IIRC) including key adjustment. Later patches broke keys.
> > 
> > 
> > 
> > > 	replace acpi_osi=Linux by acpi_osi="!Windows 2006"
> > > 
> > > Does it also works to you for backlight control?
> > 
> > No, doesn't work.
> > 
> 
> We can test the acpi_osi="!Windows 2006" again after we fix the i915's
> problem.
> 
> 
> Thank's
> Joey Lee
> 
> The following is debug patch, and please add kernel parameter
> drm.debug=0x02 :
> 
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index f8f86e5..f62dbd9 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -236,17 +236,22 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
>  		u32 max = intel_panel_get_max_backlight(dev);
>  		u8 lbpc;
>  
> +		DRM_DEBUG_DRIVER("set backlight max = % 		lbpc = level * 0xfe / max + 1;
> +		DRM_DEBUG_DRIVER("set backlight lbpc = %d\n", lbpc);
>  		level /= lbpc;
>  		pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
>  	}
>  
>  	tmp = I915_READ(BLC_PWM_CTL);
> +	DRM_DEBUG_DRIVER("set backlight tmp(1) = %d\n", tmp);
>  	if (IS_PINEVIEW(dev)) {
>  		tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
>  		level <<= 1;
>  	} else
>  		tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
> +	DRM_DEBUG_DRIVER("set backlight tmp(2) = %d\n", tmp);
> +	DRM_DEBUG_DRIVER("set backlight level = %d\n", level);
>  	I915_WRITE(BLC_PWM_CTL, tmp | level);
>  }
>  
> 
> 

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-09  9:00                   ` Takashi Iwai
@ 2011-05-09  9:35                     ` Joey Lee
  0 siblings, 0 replies; 26+ messages in thread
From: Joey Lee @ 2011-05-09  9:35 UTC (permalink / raw)
  To: chris, melchior.franz, dri-devel, Joey Lee, Michael Chang, tiwai,
	linux-kernel

於 一,2011-05-09 於 11:00 +0200,Takashi Iwai 提到:
> At Mon, 09 May 2011 02:50:50 -0600,
> Joey Lee wrote:
> > 
> > We need to know some run time value when intel_panel_set_backlight call by funciton key.
> 
> Yes, that'll help understanding.
> 
> > Please help to apply the attached debug patch to intel_panel.c then attached dmesg.
> 
> The patch has an obvious typo :)
> Also, we should track the value in intel_panel_get_backlight(), too.
> 
> 
> Takashi
> 

Thank's for Takashi's review and sorry for my typo. 
Follow Takashi's suggestion, I added a debug message in get_backlight,
the following is new debug patch:

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index f8f86e5..9695840 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -199,6 +199,7 @@ u32 intel_panel_get_backlight(struct drm_device *dev)
 		val = I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
 	} else {
 		val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
+		DRM_DEBUG_DRIVER("get backlight val = %d\n", val);
 		if (IS_PINEVIEW(dev))
 			val >>= 1;
 
@@ -236,17 +237,22 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
 		u32 max = intel_panel_get_max_backlight(dev);
 		u8 lbpc;
 
+		DRM_DEBUG_DRIVER("set backlight max = %d\n", max);
 		lbpc = level * 0xfe / max + 1;
+		DRM_DEBUG_DRIVER("set backlight lbpc = %d\n", lbpc);
 		level /= lbpc;
 		pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
 	}
 
 	tmp = I915_READ(BLC_PWM_CTL);
+	DRM_DEBUG_DRIVER("set backlight tmp(1) = %d\n", tmp);
 	if (IS_PINEVIEW(dev)) {
 		tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
 		level <<= 1;
 	} else
 		tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
+	DRM_DEBUG_DRIVER("set backlight tmp(2) = %d\n", tmp);
+	DRM_DEBUG_DRIVER("set backlight level = %d\n", level);
 	I915_WRITE(BLC_PWM_CTL, tmp | level);
 }
 



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

* Re: i915/kms/backlight-combo mode problem
  2011-05-09  8:50                 ` Joey Lee
  2011-05-09  9:00                   ` Takashi Iwai
@ 2011-05-09 10:08                   ` Melchior FRANZ
       [not found]                     ` <BANLkTimtvAWeS-t3bWjJmdVtyaPDw2uWDA@mail.gmail.com>
  1 sibling, 1 reply; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-09 10:08 UTC (permalink / raw)
  To: Joey Lee; +Cc: chris, dri-devel, Michael Chang, tiwai, linux-kernel

* Joey Lee -- Monday 09 May 2011:
> The following is debug patch, and please add kernel parameter
> drm.debug=0x02 :

The result is with acpi_osi=Linux:


boot phase:
[    3.310274] [drm:intel_panel_get_backlight], get backlight val = 2890
[    3.310280] [drm:intel_panel_get_backlight], get backlight PWM = 2890
[    3.310615] [drm:intel_panel_get_backlight], get backlight val = 2890
[    3.310617] [drm:intel_panel_get_backlight], get backlight PWM = 2890
[    3.310619] [drm:intel_panel_set_backlight], set backlight PWM = 0
[    3.310622] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401930
[    3.310624] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[    3.310626] [drm:intel_panel_set_backlight], set backlight level = 0

[    3.641522] [drm:intel_panel_set_backlight], set backlight PWM = 2890
[    3.641525] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399040
[    3.641527] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[    3.641529] [drm:intel_panel_set_backlight], set backlight level = 2890

[   11.410563] video LNXVIDEO:01: Restoring backlight state



brightness up:
   [no output]



brightness down:
[  152.697127] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  152.697136] [drm:intel_panel_set_backlight], set backlight PWM = 283
[  152.697141] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401930
[  152.697146] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  152.697150] [drm:intel_panel_set_backlight], set backlight level = 283

[  166.720631] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  166.720640] [drm:intel_panel_set_backlight], set backlight PWM = 578
[  166.720645] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399323
[  166.720649] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  166.720654] [drm:intel_panel_set_backlight], set backlight level = 578

[  178.091776] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  178.091784] [drm:intel_panel_set_backlight], set backlight PWM = 861
[  178.091789] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399618
[  178.091793] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  178.091797] [drm:intel_panel_set_backlight], set backlight level = 861

[  188.888370] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  188.888379] [drm:intel_panel_set_backlight], set backlight PWM = 1156
[  188.888383] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399901
[  188.888388] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  188.888392] [drm:intel_panel_set_backlight], set backlight level = 1156

[  196.411657] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  196.411665] [drm:intel_panel_set_backlight], set backlight PWM = 1439
[  196.411670] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400196
[  196.411674] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  196.411678] [drm:intel_panel_set_backlight], set backlight level = 1439

[  201.256229] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  201.256238] [drm:intel_panel_set_backlight], set backlight PWM = 1734
[  201.256243] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400479
[  201.256247] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  201.256252] [drm:intel_panel_set_backlight], set backlight level = 1734

[  206.939838] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  206.939846] [drm:intel_panel_set_backlight], set backlight PWM = 2017
[  206.939851] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400774
[  206.939856] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  206.939860] [drm:intel_panel_set_backlight], set backlight level = 2017

[  213.779732] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  213.779740] [drm:intel_panel_set_backlight], set backlight PWM = 2312
[  213.779744] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401057
[  213.779749] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  213.779753] [drm:intel_panel_set_backlight], set backlight level = 2312

[  222.583806] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  222.583814] [drm:intel_panel_set_backlight], set backlight PWM = 2595
[  222.583819] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401352
[  222.583824] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  222.583828] [drm:intel_panel_set_backlight], set backlight level = 2595

[  229.345860] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  229.345870] [drm:intel_panel_set_backlight], set backlight PWM = 2595
[  229.345874] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401635
[  229.345879] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  229.345883] [drm:intel_panel_set_backlight], set backlight level = 2595



brightness up:
[  240.594464] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  240.594474] [drm:intel_panel_set_backlight], set backlight PWM = 2312
[  240.594479] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401635
[  240.594483] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  240.594487] [drm:intel_panel_set_backlight], set backlight level = 2312

[  240.816722] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  240.816730] [drm:intel_panel_set_backlight], set backlight PWM = 2017
[  240.816734] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401352
[  240.816739] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  240.816743] [drm:intel_panel_set_backlight], set backlight level = 2017

[  240.999973] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  240.999981] [drm:intel_panel_set_backlight], set backlight PWM = 1734
[  240.999985] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401057
[  240.999990] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  240.999994] [drm:intel_panel_set_backlight], set backlight level = 1734

[  241.212456] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  241.212464] [drm:intel_panel_set_backlight], set backlight PWM = 1439
[  241.212469] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400774
[  241.212473] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  241.212478] [drm:intel_panel_set_backlight], set backlight level = 1439

[  241.395611] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  241.395619] [drm:intel_panel_set_backlight], set backlight PWM = 1156
[  241.395624] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400479
[  241.395628] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  241.395633] [drm:intel_panel_set_backlight], set backlight level = 1156

[  242.039460] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  242.039470] [drm:intel_panel_set_backlight], set backlight PWM = 283
[  242.039475] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400196
[  242.039479] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  242.039484] [drm:intel_panel_set_backlight], set backlight level = 283

[  242.044495] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  242.044502] [drm:intel_panel_set_backlight], set backlight PWM = 283
[  242.044507] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399323
[  242.044511] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  242.044515] [drm:intel_panel_set_backlight], set backlight level = 283

[  242.077032] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[  242.077038] [drm:intel_panel_set_backlight], set backlight PWM = 0
[  242.077043] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399323
[  242.077047] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  242.077052] [drm:intel_panel_set_backlight], set backlight level = 0

m.

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

* Re: i915/kms/backlight-combo mode problem
       [not found]                     ` <BANLkTimtvAWeS-t3bWjJmdVtyaPDw2uWDA@mail.gmail.com>
@ 2011-05-10  3:29                       ` Michael Chang
  2011-05-10 11:08                         ` Melchior FRANZ
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Chang @ 2011-05-10  3:29 UTC (permalink / raw)
  To: Melchior FRANZ; +Cc: Joey Lee, chris, dri-devel, tiwai, linux-kernel

Melchior,

Could you please try this patch and get the log ? We wonder why
is_backlight_combination_mode () returns false. We all knew that it
returns true during booting (and takashi's fix works to fix the
blackscreen for you) and it's unlikely to become false afterward.
Perhaps it was changed wrongly ..

I speculate that if it returns true matters because it would touch the
LPBC register and your problem might get fixed.

Thanks in advance. :)

diff --git a/drivers/gpu/drm/i915/intel_panel.c
b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..8f14bfa 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -116,12 +116,21 @@ static int Melchior(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;

-	if (INTEL_INFO(dev)->gen >= 4)
-		return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
+	if (INTEL_INFO(dev)->gen >= 4) {

-	if (IS_GEN2(dev))
-		return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
+		int ret = I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
+		DRM_DEBUG_DRIVER("BLM_COMBINATION_MODE = %d\n", ret);
+		return ret;
+	}
+
+	if (IS_GEN2(dev)) {

+		int ret = I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
+		DRM_DEBUG_DRIVER("BLM_LEGACY_MODE = %d\n", ret);
+		return ret;
+	}
+	
+	DRM_DEBUG_DRIVER("Do nothing, return false\n");
 	return 0;
 }


2011/5/9 Michael Chang <mchang@novell.com>:
>
> From the log, it looks like is_backlight_combination_mode is evaluated false
> which contradicts with the topic we are discussed. Regardless of the
> combination_mode, the log seems to work ..  weird.
>
> 2011/5/9 Melchior FRANZ <melchior.franz@gmail.com>
>>
>> * Joey Lee -- Monday 09 May 2011:
>> > The following is debug patch, and please add kernel parameter
>> > drm.debug=0x02 :
>>
>> The result is with acpi_osi=Linux:
>>
>>
>> boot phase:
>> [    3.310274] [drm:intel_panel_get_backlight], get backlight val = 2890
>> [    3.310280] [drm:intel_panel_get_backlight], get backlight PWM = 2890
>> [    3.310615] [drm:intel_panel_get_backlight], get backlight val = 2890
>> [    3.310617] [drm:intel_panel_get_backlight], get backlight PWM = 2890
>> [    3.310619] [drm:intel_panel_set_backlight], set backlight PWM = 0
>> [    3.310622] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189401930
>> [    3.310624] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [    3.310626] [drm:intel_panel_set_backlight], set backlight level = 0
>>
>> [    3.641522] [drm:intel_panel_set_backlight], set backlight PWM = 2890
>> [    3.641525] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189399040
>> [    3.641527] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [    3.641529] [drm:intel_panel_set_backlight], set backlight level = 2890
>>
>> [   11.410563] video LNXVIDEO:01: Restoring backlight state
>>
>>
>>
>> brightness up:
>>   [no output]
>>
>>
>>
>> brightness down:
>> [  152.697127] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  152.697136] [drm:intel_panel_set_backlight], set backlight PWM = 283
>> [  152.697141] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189401930
>> [  152.697146] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  152.697150] [drm:intel_panel_set_backlight], set backlight level = 283
>>
>> [  166.720631] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  166.720640] [drm:intel_panel_set_backlight], set backlight PWM = 578
>> [  166.720645] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189399323
>> [  166.720649] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  166.720654] [drm:intel_panel_set_backlight], set backlight level = 578
>>
>> [  178.091776] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  178.091784] [drm:intel_panel_set_backlight], set backlight PWM = 861
>> [  178.091789] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189399618
>> [  178.091793] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  178.091797] [drm:intel_panel_set_backlight], set backlight level = 861
>>
>> [  188.888370] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  188.888379] [drm:intel_panel_set_backlight], set backlight PWM = 1156
>> [  188.888383] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189399901
>> [  188.888388] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  188.888392] [drm:intel_panel_set_backlight], set backlight level = 1156
>>
>> [  196.411657] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  196.411665] [drm:intel_panel_set_backlight], set backlight PWM = 1439
>> [  196.411670] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189400196
>> [  196.411674] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  196.411678] [drm:intel_panel_set_backlight], set backlight level = 1439
>>
>> [  201.256229] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  201.256238] [drm:intel_panel_set_backlight], set backlight PWM = 1734
>> [  201.256243] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189400479
>> [  201.256247] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  201.256252] [drm:intel_panel_set_backlight], set backlight level = 1734
>>
>> [  206.939838] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  206.939846] [drm:intel_panel_set_backlight], set backlight PWM = 2017
>> [  206.939851] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189400774
>> [  206.939856] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  206.939860] [drm:intel_panel_set_backlight], set backlight level = 2017
>>
>> [  213.779732] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  213.779740] [drm:intel_panel_set_backlight], set backlight PWM = 2312
>> [  213.779744] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189401057
>> [  213.779749] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  213.779753] [drm:intel_panel_set_backlight], set backlight level = 2312
>>
>> [  222.583806] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  222.583814] [drm:intel_panel_set_backlight], set backlight PWM = 2595
>> [  222.583819] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189401352
>> [  222.583824] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  222.583828] [drm:intel_panel_set_backlight], set backlight level = 2595
>>
>> [  229.345860] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  229.345870] [drm:intel_panel_set_backlight], set backlight PWM = 2595
>> [  229.345874] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189401635
>> [  229.345879] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  229.345883] [drm:intel_panel_set_backlight], set backlight level = 2595
>>
>>
>>
>> brightness up:
>> [  240.594464] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  240.594474] [drm:intel_panel_set_backlight], set backlight PWM = 2312
>> [  240.594479] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189401635
>> [  240.594483] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  240.594487] [drm:intel_panel_set_backlight], set backlight level = 2312
>>
>> [  240.816722] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  240.816730] [drm:intel_panel_set_backlight], set backlight PWM = 2017
>> [  240.816734] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189401352
>> [  240.816739] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  240.816743] [drm:intel_panel_set_backlight], set backlight level = 2017
>>
>> [  240.999973] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  240.999981] [drm:intel_panel_set_backlight], set backlight PWM = 1734
>> [  240.999985] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189401057
>> [  240.999990] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  240.999994] [drm:intel_panel_set_backlight], set backlight level = 1734
>>
>> [  241.212456] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  241.212464] [drm:intel_panel_set_backlight], set backlight PWM = 1439
>> [  241.212469] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189400774
>> [  241.212473] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  241.212478] [drm:intel_panel_set_backlight], set backlight level = 1439
>>
>> [  241.395611] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  241.395619] [drm:intel_panel_set_backlight], set backlight PWM = 1156
>> [  241.395624] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189400479
>> [  241.395628] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  241.395633] [drm:intel_panel_set_backlight], set backlight level = 1156
>>
>> [  242.039460] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  242.039470] [drm:intel_panel_set_backlight], set backlight PWM = 283
>> [  242.039475] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189400196
>> [  242.039479] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  242.039484] [drm:intel_panel_set_backlight], set backlight level = 283
>>
>> [  242.044495] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  242.044502] [drm:intel_panel_set_backlight], set backlight PWM = 283
>> [  242.044507] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189399323
>> [  242.044511] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  242.044515] [drm:intel_panel_set_backlight], set backlight level = 283
>>
>> [  242.077032] [drm:intel_panel_get_max_backlight], max backlight PWM =
>> 2890
>> [  242.077038] [drm:intel_panel_set_backlight], set backlight PWM = 0
>> [  242.077043] [drm:intel_panel_set_backlight], set backlight tmp(1) =
>> 189399323
>> [  242.077047] [drm:intel_panel_set_backlight], set backlight tmp(2) =
>> 189399040
>> [  242.077052] [drm:intel_panel_set_backlight], set backlight level = 0
>>
>> m.
>
>

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-10  3:29                       ` Michael Chang
@ 2011-05-10 11:08                         ` Melchior FRANZ
       [not found]                           ` <BANLkTimQJM3N1WdBhYVOH0UyyOTFcxOfUQ@mail.gmail.com>
  2011-05-15 10:08                           ` Takashi Iwai
  0 siblings, 2 replies; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-10 11:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michael Chang, Joey Lee, chris, dri-devel, tiwai

* Michael Chang -- Tuesday 10 May 2011:
> Could you please try this patch and get the log ? We wonder why
> is_backlight_combination_mode () returns false.

This information was already buried in the bugzilla thread:

  https://bugzilla.kernel.org/show_bug.cgi?id=31522
  "It turned out that on this machine INTEL_INFO(dev)->gen equals 4,
  and is_backlight_combination_mode() returns 0x40000000."


But to say it again in your words:   :-)

  [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824  (0x40000000)

6x during boot-up, and several times later when changing the backlight
brightness.


This was with 8b061610dac3a3b89770c85ad63b481a47b0c38e. And now
I have a little shocker for you (and me): because this was a
vanilla kernel (apart from these debug messages), the screen went
black again, like I knew it. But pressing the "brightness down"
key turns the backlight on! I can't believe that I haven't tested
that. I guess I've only tried "brightness up" and "display toggle".
Those don't turn backlight on. Or maybe somethine else relevant
meanwhile changed in the i915 drivers. (I've regularly been
updating to HEAD.)  

So, the problem was just the initial state all the time?

m.

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

* Re: i915/kms/backlight-combo mode problem
       [not found]                           ` <BANLkTimQJM3N1WdBhYVOH0UyyOTFcxOfUQ@mail.gmail.com>
@ 2011-05-13 21:20                             ` Joey Lee
  2011-05-15 12:50                               ` Melchior FRANZ
  0 siblings, 1 reply; 26+ messages in thread
From: Joey Lee @ 2011-05-13 21:20 UTC (permalink / raw)
  To: Michael Chang; +Cc: chris, dri-devel, tiwai, linux-kernel

Forward to upstream for more discussion.

於 五,2011-05-13 於 17:27 +0800,Michael Chang 提到:
> Melchior,
> 
> I tried to puzzle out the possible cause of the problem, but sorry
> that no further progress to give you. I'd like to debug this issue,
> also did Joey. But there's more questions in my mind, made me feel not
> able to proceed any further.. :(
> 
> 1. is_backlight_combination_mode() really returns 0x4 ..? I understand
> your words, but if this is true then Joey Lee provided patch should
> log out some information about changing the LPBC
> 
>   set backlight lbpc = ...
> 
> but I didn't see any of the log output .. :(
> 
> 2.  I dig the old mailing thread .. found a post
> 
> http://marc.info/?l=linux-kernel&m=130462815211684&w=2
> 
> If you rebase this patch to your currently git commit, will it fixes
> all problems for you now (only vanilla kernel with this patch)? (You
> replied that this patch works for you ..) Also another interesting
> finding...
> 
> > +	if (!lbpc)
> > +		combo_mode = 0;
> 
> Looks like the purpose of it is to NOT touch the LPBC registers if
> lbpc is zero ...(since this forces is_backlight_combination_mode
> return 0). This would make contradiction about the assumption that you
> could change to back-light via LPBC ..   (using setpci is actually
> access the LPBC registers .. IMHO).
> 
> Total a mess for me now .. Did I made anything wrong .. I know I may
> lose some details.
> 
> I'm thinking is it ok for us to discuss in IRC, the communication
> would be more efficient. Would this be convenient for you ? This is up
> to you.
> 
> Have nice weekend .. :)
> 
> Regards,
> Michael Chang
> 
> 2011/5/10 Melchior FRANZ <melchior.franz@gmail.com>:
> > * Michael Chang -- Tuesday 10 May 2011:
> >> Could you please try this patch and get the log ? We wonder why
> >> is_backlight_combination_mode () returns false.
> >
> > This information was already buried in the bugzilla thread:
> >
> >  https://bugzilla.kernel.org/show_bug.cgi?id=31522
> >  "It turned out that on this machine INTEL_INFO(dev)->gen equals 4,
> >  and is_backlight_combination_mode() returns 0x40000000."
> >
> >
> > But to say it again in your words:   :-)
> >
> >  [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824  (0x40000000)
> >
> > 6x during boot-up, and several times later when changing the backlight
> > brightness.
> >
> >
> > This was with 8b061610dac3a3b89770c85ad63b481a47b0c38e. And now
> > I have a little shocker for you (and me): because this was a
> > vanilla kernel (apart from these debug messages), the screen went
> > black again, like I knew it. But pressing the "brightness down"
> > key turns the backlight on! I can't believe that I haven't tested
> > that. I guess I've only tried "brightness up" and "display toggle".
> > Those don't turn backlight on. Or maybe somethine else relevant
> > meanwhile changed in the i915 drivers. (I've regularly been
> > updating to HEAD.)
> >
> > So, the problem was just the initial state all the time?
> >
> > m.
> >



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

* Re: i915/kms/backlight-combo mode problem
  2011-05-10 11:08                         ` Melchior FRANZ
       [not found]                           ` <BANLkTimQJM3N1WdBhYVOH0UyyOTFcxOfUQ@mail.gmail.com>
@ 2011-05-15 10:08                           ` Takashi Iwai
  2011-05-16 12:21                             ` Melchior FRANZ
  1 sibling, 1 reply; 26+ messages in thread
From: Takashi Iwai @ 2011-05-15 10:08 UTC (permalink / raw)
  To: Melchior FRANZ; +Cc: linux-kernel, Michael Chang, Joey Lee, chris, dri-devel

At Tue, 10 May 2011 13:08:23 +0200,
Melchior FRANZ wrote:
> 
> * Michael Chang -- Tuesday 10 May 2011:
> > Could you please try this patch and get the log ? We wonder why
> > is_backlight_combination_mode () returns false.
> 
> This information was already buried in the bugzilla thread:
> 
>   https://bugzilla.kernel.org/show_bug.cgi?id=31522
>   "It turned out that on this machine INTEL_INFO(dev)->gen equals 4,
>   and is_backlight_combination_mode() returns 0x40000000."
> 
> 
> But to say it again in your words:   :-)
> 
>   [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824  (0x40000000)
> 
> 6x during boot-up, and several times later when changing the backlight
> brightness.
> 
> 
> This was with 8b061610dac3a3b89770c85ad63b481a47b0c38e. And now
> I have a little shocker for you (and me): because this was a
> vanilla kernel (apart from these debug messages), the screen went
> black again, like I knew it. But pressing the "brightness down"
> key turns the backlight on! I can't believe that I haven't tested
> that. I guess I've only tried "brightness up" and "display toggle".
> Those don't turn backlight on. Or maybe somethine else relevant
> meanwhile changed in the i915 drivers. (I've regularly been
> updating to HEAD.)  
> 
> So, the problem was just the initial state all the time?

Looks so, indeed.  Now, the question is what's the real cause.

IIRC, you reported that the backlight gets normal when you revert my
commit in 2.6.38.x.  So, this was regarded as a regression at first.
But, one question remains: whether the backlight level control worked
with the reverted kernel?
Judging from the attempts so far, it looks like that only LBPC can
adjust the level on your machine.  If it's true, 2.6.38.0 shouldn't be
able to adjust the level.  If you can still change the level without
LBPC, the former analysis was incorrect.

Also, with the latest 2.6.38.x, you found that the backlight gets back
when you adjust the level down.  Another question now is what happens
if you again turn it up to the max level.  Is the backlight still on?

If the backlight is kept on even with the max level, it implies that
the problem is only the initial value; once when set correctly, it'll
work fine after that.  OTOH, if the backlight gets off again at max,
it means that the max value (LBPC 0xfe) is a sort of out-of-range.
Then LBPC calculation in the driver has to be modified.


thanks,

Takashi

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-13 21:20                             ` Joey Lee
@ 2011-05-15 12:50                               ` Melchior FRANZ
  0 siblings, 0 replies; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-15 12:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Joey Lee, Michael Chang, chris, dri-devel, tiwai

Hey,

* Michael Chang -- Friday 13 May 2011:
> But there's more questions in my mind, made me feel not
> able to proceed any further.. :(

No problem. The reason for inconsistencies in my reports is
simply that I've realized some properties only later. So here's
a new error description, based on ddb503b42960, which is current
HEAD.


On this "Acer Travelmate 5735Z-452G32Mnss" the following happens
since after 2.6.37-rc8, with acpi_osi=Linux:

- the backlight goes dark as soon as KMS takes over early in the
  boot process (the screen contents aren't corrupted, though, and
  under appropriate lighting conditions I can even see the
  (very dark) uncorrupted contents.)

- when I press the "backlight darker" key, the backlight is turned
  on. (No other key does that AFAICS, including "display toggle"
  and "backlight brighter.)

Everything works correctly after that, including backlight adjustment,
BUT:

 - when I close the lid and open it again, the backlight stays black
   again, just like before. Backlight adjustment turns it on, and
   now even the "brighter" key does it sometimes, but not always.)



> 1. is_backlight_combination_mode() really returns 0x4 ..?

>From https://bugzilla.kernel.org/show_bug.cgi?id=31522, comment #8:
"It turned out that on this machine INTEL_INFO(dev)->gen equals 4,
and is_backlight_combination_mode() returns 0x40000000."

That was true when I reported it. But lpbc was always 0 in my tests
back then, and now it's not. 



> I understand your words, but if this is true then Joey Lee provided
> patch should log out some information about changing the LPBC
> 
>   set backlight lbpc = ...
> 
> but I didn't see any of the log output .. :(

You hadn't told me that these patches were meant to be incremental,
so I backed the first logging patch out before applying the other.
Here is the result of ddb503b42960 with both logging patches applied:

boot phase:
[    2.620237] [drm] Initialized drm 1.1.0 20060810
[    2.664806] i915 0000:00:02.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[    2.664812] i915 0000:00:02.0: setting latency timer to 64
[    2.726569] [drm:intel_opregion_setup], graphic opregion physical addr: 0x7ba8c018
[    2.726612] [drm:intel_opregion_setup], Public ACPI methods supported
[    2.726615] [drm:intel_opregion_setup], SWSCI supported
[    2.726617] [drm:intel_opregion_setup], ASLE supported
[    2.726650] i915 0000:00:02.0: irq 44 for MSI/MSI-X
[    2.726655] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[    2.726656] [drm] Driver supports precise vblank timestamp query.
[    2.753294] [drm:init_status_page], render ring hws offset: 0x00000000
[    2.753431] [drm:init_status_page], bsd ring hws offset: 0x00021000
[    2.753547] [drm:intel_parse_bios], Using VBT from OpRegion: $VBT CANTIGA        d
[    2.797315] [drm:intel_panel_get_backlight], get backlight val = 2890
[    2.797319] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[    2.797322] [drm:intel_panel_get_backlight], get backlight PWM = 0
[    2.797328] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
[    2.797658] [drm:intel_panel_set_backlight], set backlight PWM = 0
[    2.797661] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[    2.797664] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[    2.797667] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[    2.797669] [drm:intel_panel_set_backlight], set backlight max = 736950
[    2.797671] [drm:intel_panel_set_backlight], set backlight lbpc = 1
[    2.797678] [drm:intel_opregion_asle_intr], non asle set request??
[    2.797681] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401930
[    2.797683] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[    2.797685] [drm:intel_panel_set_backlight], set backlight level = 0
[    2.905962] scsi 4:0:0:0: Direct-Access     Generic- Multi-Card       1.00 PQ: 0 ANSI: 0 CCS
[    3.040041] [drm:gm45_get_vblank_counter], trying to get vblank count for disabled pipe A
[    3.040047] [drm:gm45_get_vblank_counter], trying to get vblank count for disabled pipe A
[    3.090368] checking generic (80000000 3ff0000) vs hw (80000000 10000000)
[    3.090373] fb: conflicting fb hw usage inteldrmfb vs VESA VGA - removing generic driver
[    3.090392] Console: switching to colour dummy device 80x25
[    3.091058] fbcon: inteldrmfb (fb0) is primary device
[    3.125522] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[    3.125525] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[    3.125527] [drm:intel_panel_set_backlight], set backlight PWM = 736950
[    3.125529] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[    3.125531] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[    3.125533] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[    3.125535] [drm:intel_panel_set_backlight], set backlight max = 736950
[    3.125537] [drm:intel_panel_set_backlight], set backlight lbpc = 255
[    3.125541] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399040
[    3.125543] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[    3.125544] [drm:intel_panel_set_backlight], set backlight level = 2890
[    3.125557] [drm:intel_opregion_asle_intr],
[    3.125559] Console: switching non asle set request??
[    3.125562] to colour frame buffer device 170x48
[    3.128264] fb0: inteldrmfb frame buffer device
[    3.128265] drm: registered panic notifier
[    3.429079] acpi device:07: registered as cooling_device2
[    3.429425] input: Video Bus as /devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:01/input/input6
[    3.429521] ACPI: Video Device [OVGA] (multi-head: yes  rom: no  post: no)
[    3.429980] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
[    3.806479] sd 4:0:0:0: [sdb] 15720448 512-byte logical blocks: (8.04 GB/7.49 GiB)
[    3.807220] sd 4:0:0:0: [sdb] Write Protect is off
[    3.807222] sd 4:0:0:0: [sdb] Mode Sense: 03 00 00 00
[    3.807225] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[    3.809345] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[    3.813728]  sdb: sdb1
[    3.815475] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[    3.815513] sd 4:0:0:0: [sdb] Attached SCSI removable disk
[    4.786309] md: linear personality registered for level -1
[   84.936637] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[   84.936641] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[   84.936644] [drm:intel_panel_set_backlight], set backlight PWM = 72250
[   84.936646] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[   84.936649] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[   84.936652] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[   84.936654] [drm:intel_panel_set_backlight], set backlight max = 736950
[   84.936656] [drm:intel_panel_set_backlight], set backlight lbpc = 25
[   84.936660] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401930
[   84.936662] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[   84.936664] [drm:intel_panel_set_backlight], set backlight level = 2890
[   84.936669] [drm:intel_opregion_asle_intr], non asle set request??
[   84.936672] [drm:intel_opregion_asle_intr], non asle set request??

brighter:
[  325.356259] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[  325.356268] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[  325.356273] [drm:intel_panel_set_backlight], set backlight PWM = 0
[  325.356278] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[  325.356283] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[  325.356288] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[  325.356292] [drm:intel_panel_set_backlight], set backlight max = 736950
[  325.356297] [drm:intel_panel_set_backlight], set backlight lbpc = 1
[  325.356302] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401930
[  325.356307] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  325.356311] [drm:intel_panel_set_backlight], set backlight level = 0
[  325.356318] [drm:intel_opregion_asle_intr], non asle set request??
[  325.356324] [drm:intel_opregion_asle_intr], non asle set request??

darker:
[  359.642417] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[  359.642424] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[  359.642429] [drm:intel_panel_set_backlight], set backlight PWM = 72250
[  359.642434] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[  359.642439] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[  359.642443] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[  359.642448] [drm:intel_panel_set_backlight], set backlight max = 736950
[  359.642452] [drm:intel_panel_set_backlight], set backlight lbpc = 25
[  359.642458] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399040
[  359.642463] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  359.642467] [drm:intel_panel_set_backlight], set backlight level = 2890
[  359.642474] [drm:intel_opregion_asle_intr], non asle set request??
[  359.642480] [drm:intel_opregion_asle_intr], non asle set request??


 
> http://marc.info/?l=linux-kernel&m=130462815211684&w=2
> 
> If you rebase this patch to your currently git commit, will it fixes
> all problems [...]

This patch didn't fix my problems back then, and since an always zeroed lbpc
is apparently not the case, I assume this test wouldn't be very helpful. Of
course, if you insist, then I'll try it again. 

Thanks for your help, and sorry for the confusion.  :-)
m.

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-15 10:08                           ` Takashi Iwai
@ 2011-05-16 12:21                             ` Melchior FRANZ
  2011-05-17  7:56                               ` Michael Chang
  0 siblings, 1 reply; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-16 12:21 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, Michael Chang, Joey Lee, chris, dri-devel

* Takashi Iwai -- Sunday 15 May 2011:
> IIRC, you reported that the backlight gets normal when you revert my
> commit in 2.6.38.x.  So, this was regarded as a regression at first.

Yes. And it *is* a regression, which is the whole point of my
initial complaint, as reported by Maciej in 
https://bugzilla.kernel.org/show_bug.cgi?id=31522



> But, one question remains: whether the backlight level control worked
> with the reverted kernel?

Good point. Turns out it didn't work with 2.6.38-rc8 either. But it
did work at some time before. (I use this notebook mainly as a
terminal ATM, so I didn't care much for backlight level. This came
up later during investigation.)

So the only thing that 2.6.38 broke was that the backlight
was initially off. Adjustment had already been broken before
(and works now again; sigh ... confused? I am! :-).



> If you can still change the level without
> LBPC, the former analysis was incorrect.

I don't even know what an LBPC is, other than a variable named like that.
So I'd need a hint for how to test that.



> Also, with the latest 2.6.38.x, you found that the backlight gets back
> when you adjust the level down.

When I reported this, it was about 2.6.39-* and HEAD, not stable
versions. But I tried now, and openSuSE's 2.6.38.6 behaves the same.



> Another question now is what happens if you again turn it up to the
> max level.  Is the backlight still on?

Yes. If the backlight was on at one point, then increasing the level
to maximum never turned if off.



> If the backlight is kept on even with the max level, it implies that
> the problem is only the initial value; once when set correctly, it'll
> work fine after that.

Yes, that's the case. (Except that after closing the lid it's off again.)

m.

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-16 12:21                             ` Melchior FRANZ
@ 2011-05-17  7:56                               ` Michael Chang
  2011-05-17  8:58                                 ` Melchior FRANZ
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Chang @ 2011-05-17  7:56 UTC (permalink / raw)
  To: Melchior FRANZ; +Cc: Takashi Iwai, linux-kernel, Joey Lee, chris, dri-devel

2011/5/16 Melchior FRANZ <melchior.franz@gmail.com>:

> I don't even know what an LBPC is, other than a variable named like that.
> So I'd need a hint for how to test that.

It resides at your vga adapter's pci configuration space, offset 0xf4.

You can know your LPBC value by:
  $ lspci -xxx -s 00:02.0 | awk '/^f0:/ {print $6}'

And alter it's value via setpci (assuming set it to max)
  $ setpci -s 00:02.0 F4.B=ff

I assume you've tried this .. as you report setpci works for you. :)

>From your new attached log, In booting phase your LPBC is set to 255
and actual brightness is maximum (255*2890=736950). I see no other
change after it until manual brightness change. This is a totally
reversed to your problem.

Could you help to get the LPBC value in the initial dark condition? If
it's not corresponds to 255, maybe something sneaks and changes it but
not logged.

[    3.125522] [drm:is_backlight_combination_mode],
BLM_COMBINATION_MODE = 1073741824
[    3.125525] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[    3.125527] [drm:intel_panel_set_backlight], set backlight PWM = 736950
[    3.125529] [drm:is_backlight_combination_mode],
BLM_COMBINATION_MODE = 1073741824
[    3.125531] [drm:is_backlight_combination_mode],
BLM_COMBINATION_MODE = 1073741824
[    3.125533] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[    3.125535] [drm:intel_panel_set_backlight], set backlight max = 736950
[    3.125537] [drm:intel_panel_set_backlight], set backlight lbpc = 255
[    3.125544] [drm:intel_panel_set_backlight], set backlight level = 2890

> Yes, that's the case. (Except that after closing the lid it's off again.)

Maybe this is another clue for root cause. Would it be convenient for
you to gather the log?

 1. $ dmesg -c
 2. Close the lid
 3. Open the lid
 4. $ dmesg > dmesg.lid

Thanks a lot,
Michael Chang

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-17  7:56                               ` Michael Chang
@ 2011-05-17  8:58                                 ` Melchior FRANZ
  2011-05-17 10:12                                   ` Michael Chang
  0 siblings, 1 reply; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-17  8:58 UTC (permalink / raw)
  To: Michael Chang; +Cc: Takashi Iwai, linux-kernel, Joey Lee, chris, dri-devel

* Michael Chang -- Tuesday 17 May 2011:
[LBPC]
> You can know your LPBC value by:
>   $ lspci -xxx -s 00:02.0 | awk '/^f0:/ {print $6}'
> 
> And alter it's value via setpci (assuming set it to max)
>   $ setpci -s 00:02.0 F4.B=ff
> 
> I assume you've tried this .. as you report setpci works for you. :)

Ahh, yes, indeed. This lspci line (almost) always shows a value that
corresponds with the actual backlight brightness, and both lines work
with and without acpi_osi=Linux. (Whereas adjustment via keys only works
*with* acpi_osi=Linux.)  (Tested with 2.6.39-rc7/bd1a643e10)



> Could you help to get the LPBC value in the initial dark condition? If
> it's not corresponds to 255, maybe something sneaks and changes it but
> not logged.

Initially (with acpi_osi=Linux) LPBC=0xff. After "brightness down"
it's 0x19, and after then pressing "brightness up" it's 0x01. The lowest
value I can achieve after pressing "brightness down" a few times is 0xe5,
the highest is 0x01. Neither 0xff nor 0x00 can be reached via keys, but
can (most of the time -- see below!) be set with the setpci line and give
the expected results, backlight off and fully on. ("display toggle" has
no effect on LBPC, btw.) 

Setting 0xFF doesn't always turn the backlight off, though! If LBPC is
at the (key) maximum 0x01, then setting 0xFF via setpci changes only the
LBPC value as shown by lspci, but the backlight isn't actually turned off!
If I then press "backlight darker" once (LBPC=0x19), then setting 0xFF
via setpci works again.



>  1. $ dmesg -c
>  2. Close the lid
>  3. Open the lid
>  4. $ dmesg > dmesg.lid

The results are:

[  188.571040] [drm:intel_panel_set_backlight], set backlight PWM = 736950
[  188.571048] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[  188.571054] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
[  188.571059] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
[  188.571064] [drm:intel_panel_set_backlight], set backlight max = 736950
[  188.571069] [drm:intel_panel_set_backlight], set backlight lbpc = 255
[  188.571075] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399040
[  188.571080] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[  188.571084] [drm:intel_panel_set_backlight], 
[  188.571088] [drm:intel_opregion_asle_intr], non asle set request??
[  188.571093] set backlight level = 2890

The backlight is off now, as always after closing/reopening the lid,
and LPBC=0xff.

m.



PS: I'd be willing to join an irc.freenode.net channel in case you or
    anyone else wants quicker ("live") responses to such queries.

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-17  8:58                                 ` Melchior FRANZ
@ 2011-05-17 10:12                                   ` Michael Chang
  2011-05-17 11:40                                     ` Melchior FRANZ
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Chang @ 2011-05-17 10:12 UTC (permalink / raw)
  To: Melchior FRANZ; +Cc: Takashi Iwai, linux-kernel, Joey Lee, chris, dri-devel

Melchior,

I want to double check with you. If you change brightness from lowest
to highest, the LPBC value changes this way

Highest                  Lowest
0x10 ,   0x19 ......   0xe5

And vice versa, from Lowest to Highest

Lowest                          Highest
0xe5 ,   ......         0x19  0x10

If above is true, then you have a very particular notebook that
reverse the sense of the LPBC values ....  I don't know who ever came
across such device. wow.

Regarding that your brightness control key,  due to that it is
controlled by acer_wmi and likely that BIOS aware this, it would do
brightness in a reversed way. I think Joey would check DSDT and see
any clue or evidence for this. OTOH the i915 driver didn't aware of
this and operates as usual sense that means falling into the trap.

PS. I see your log always reverse the sense of this LPBC value, now I
know why. :)

Regards,
Michael Chang

2011/5/17 Melchior FRANZ <melchior.franz@gmail.com>:
> * Michael Chang -- Tuesday 17 May 2011:
> [LBPC]
>> You can know your LPBC value by:
>>   $ lspci -xxx -s 00:02.0 | awk '/^f0:/ {print $6}'
>>
>> And alter it's value via setpci (assuming set it to max)
>>   $ setpci -s 00:02.0 F4.B=ff
>>
>> I assume you've tried this .. as you report setpci works for you. :)
>
> Ahh, yes, indeed. This lspci line (almost) always shows a value that
> corresponds with the actual backlight brightness, and both lines work
> with and without acpi_osi=Linux. (Whereas adjustment via keys only works
> *with* acpi_osi=Linux.)  (Tested with 2.6.39-rc7/bd1a643e10)
>
>
>
>> Could you help to get the LPBC value in the initial dark condition? If
>> it's not corresponds to 255, maybe something sneaks and changes it but
>> not logged.
>
> Initially (with acpi_osi=Linux) LPBC=0xff. After "brightness down"
> it's 0x19, and after then pressing "brightness up" it's 0x01. The lowest
> value I can achieve after pressing "brightness down" a few times is 0xe5,
> the highest is 0x01. Neither 0xff nor 0x00 can be reached via keys, but
> can (most of the time -- see below!) be set with the setpci line and give
> the expected results, backlight off and fully on. ("display toggle" has
> no effect on LBPC, btw.)
>
> Setting 0xFF doesn't always turn the backlight off, though! If LBPC is
> at the (key) maximum 0x01, then setting 0xFF via setpci changes only the
> LBPC value as shown by lspci, but the backlight isn't actually turned off!
> If I then press "backlight darker" once (LBPC=0x19), then setting 0xFF
> via setpci works again.
>
>
>
>>  1. $ dmesg -c
>>  2. Close the lid
>>  3. Open the lid
>>  4. $ dmesg > dmesg.lid
>
> The results are:
>
> [  188.571040] [drm:intel_panel_set_backlight], set backlight PWM = 736950
> [  188.571048] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
> [  188.571054] [drm:is_backlight_combination_mode], BLM_COMBINATION_MODE = 1073741824
> [  188.571059] [drm:intel_panel_get_max_backlight], max backlight PWM = 736950
> [  188.571064] [drm:intel_panel_set_backlight], set backlight max = 736950
> [  188.571069] [drm:intel_panel_set_backlight], set backlight lbpc = 255
> [  188.571075] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399040
> [  188.571080] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
> [  188.571084] [drm:intel_panel_set_backlight],
> [  188.571088] [drm:intel_opregion_asle_intr], non asle set request??
> [  188.571093] set backlight level = 2890
>
> The backlight is off now, as always after closing/reopening the lid,
> and LPBC=0xff.
>
> m.
>
>
>
> PS: I'd be willing to join an irc.freenode.net channel in case you or
>    anyone else wants quicker ("live") responses to such queries.
>

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

* Re: i915/kms/backlight-combo mode problem
  2011-05-17 10:12                                   ` Michael Chang
@ 2011-05-17 11:40                                     ` Melchior FRANZ
  0 siblings, 0 replies; 26+ messages in thread
From: Melchior FRANZ @ 2011-05-17 11:40 UTC (permalink / raw)
  To: Michael Chang; +Cc: Takashi Iwai, linux-kernel, Joey Lee, chris, dri-devel

Hey,

* Michael Chang -- Tuesday 17 May 2011:
> If you change brightness from lowest to highest, the LPBC value changes
> this way
> 
> Highest                  Lowest
> 0x10 ,   0x19 ......   0xe5

Yes. (Though it's 0x01, not 0x10.)

    ---0xFF      ... initial value and after closing/reopening lid
    |  0xE5   \  ... dark
    |  0xCC   |
    |  0xB2   |
 (1)|  0x99   |
    |  0x7F   |_____key adjustable range
    |  0x66   |
    |  0x4C   |
    |  0x33   |
    -->0x19   |
       0x01   /  ... bright
       0x00      ... also bright, only settable with setpci


(1) is the jump that resurrects the backlight from darkness by
    pressing the "brightness down" key

And again, if fully turned up via keys (and therefore at 0x01),
then setting to 0xff with setpci doesn't turn it off. At all other
key steps it does.  :-)



> If above is true, then you have a very particular notebook that
> reverse the sense of the LPBC values ....  I don't know who ever came
> across such device. wow.

Maybe they screwed it up and therefore sold it with Linux ("linpus")
and a custom driver preinstalled ...



> Regarding that your brightness control key,  due to that it is
> controlled by acer_wmi and likely that BIOS aware this, it would do
> brightness in a reversed way.

acer_wmi doesn't do the brightness adjustment. But maybe under "linpus"
some variant of it did. (BTW: there are two keys on this notebook that
aren't handled by the kernel, by X11 or even acer_wmi. There are just no
events for them. Looks like another ACER brain damage err.. "capability". :-)

m.

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

* i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)
@ 2012-01-21 17:09 Chris Diamand
  2012-01-21 18:32 ` Keith Packard
  0 siblings, 1 reply; 26+ messages in thread
From: Chris Diamand @ 2012-01-21 17:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: tiwai, melchior.franz

Hi,

I have the problem described in the thread here 
(https://lkml.org/lkml/2011/4/29/217) where the backlight
values are reversed so although stuff is displayed on the screen, the 
backlight is off. This occurs with kernels from about 2.6.39 onwards.

After booting a "broken" kernel (>~2.6.39), the backlight can be lit 
temporarily with:
setpci -s 00:02.0 F4.B=0
and then turned off with:
setpci -s 00:02.0 F4.B=FF

Yesterday I tried this patch, https://lkml.org/lkml/2011/4/30/37 by 
manually applying it to the 3.2.1
kernel source - this fixes the problem.

** Unfortunately the LKML thread stops after this patch and given that 
the problem is still present in the latest source, this code wasn't 
pushed into the kernel. Is there a reason for this or was it just 
forgotten about? What can I do about this? I am happy to make a git 
patch with the latest source if this will help.

If it is relevant, the backlight brightness controls (Fn-left, Fn-right) 
have never worked on any kernel
version, although they are picked up by acpi_listen.

The machine is a Packard Bell XS butterfly laptop, 11.6", 1.3GHz celeron 
743, 2gb ram, etc.
As per the posting guidelines, here is loads of info about it:

# dmesg|grep acer

[    9.820622] acer_wmi: Acer Laptop ACPI-WMI Extras
[    9.821841] acer_wmi: Function bitmap for Communication Device: 0x81
[    9.822005] acer_wmi: Brightness must be controlled by generic video 
driver


# lspci -v

00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory 
Controller Hub (rev 07)
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, fast devsel, latency 0
         Capabilities: [e0] Vendor Specific Information: Len=0a <?>
         Kernel driver in use: agpgart-intel

00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series 
Chipset Integrated Graphics Controller (rev 07) (prog-if 00 [VGA 
controller])
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, fast devsel, latency 0, IRQ 47
         Memory at 90000000 (64-bit, non-prefetchable) [size=4M]
         Memory at 80000000 (64-bit, prefetchable) [size=256M]
         I/O ports at 50d0 [size=8]
         Expansion ROM at <unassigned> [disabled]
         Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
         Capabilities: [d0] Power Management version 3
         Kernel driver in use: i915

00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset 
Integrated Graphics Controller (rev 07)
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, fast devsel, latency 0
         Memory at 93400000 (64-bit, non-prefetchable) [size=1M]
         Capabilities: [d0] Power Management version 3

00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI 
Controller #4 (rev 03) (prog-if 00 [UHCI])
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, medium devsel, latency 0, IRQ 20
         I/O ports at 50a0 [size=32]
         Capabilities: [50] PCI Advanced Features
         Kernel driver in use: uhci_hcd

00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI 
Controller #2 (rev 03) (prog-if 20 [EHCI])
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, medium devsel, latency 0, IRQ 21
         Memory at 96705c00 (32-bit, non-prefetchable) [size=1K]
         Capabilities: [50] Power Management version 2
         Capabilities: [58] Debug port: BAR=1 offset=00a0
         Capabilities: [98] PCI Advanced Features
         Kernel driver in use: ehci_hcd

00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio 
Controller (rev 03)
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, fast devsel, latency 0, IRQ 45
         Memory at 96700000 (64-bit, non-prefetchable) [size=16K]
         Capabilities: [50] Power Management version 2
         Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
         Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
         Capabilities: [100] Virtual Channel
         Capabilities: [130] Root Complex Link
         Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express 
Port 1 (rev 03) (prog-if 00 [Normal decode])
         Flags: bus master, fast devsel, latency 0
         Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
         I/O behind bridge: 00004000-00004fff
         Memory behind bridge: 95700000-966fffff
         Prefetchable memory behind bridge: 
0000000090400000-00000000913fffff
         Capabilities: [40] Express Root Port (Slot+), MSI 00
         Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
         Capabilities: [90] Subsystem: Acer Incorporated [ALI] Device 034b
         Capabilities: [a0] Power Management version 2
         Capabilities: [100] Virtual Channel
         Capabilities: [180] Root Complex Link
         Kernel driver in use: pcieport

00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express 
Port 2 (rev 03) (prog-if 00 [Normal decode])
         Flags: bus master, fast devsel, latency 0
         Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
         I/O behind bridge: 00003000-00003fff
         Memory behind bridge: 94600000-956fffff
         Prefetchable memory behind bridge: 
0000000091400000-00000000923fffff
         Capabilities: [40] Express Root Port (Slot+), MSI 00
         Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
         Capabilities: [90] Subsystem: Acer Incorporated [ALI] Device 034b
         Capabilities: [a0] Power Management version 2
         Capabilities: [100] Virtual Channel
         Capabilities: [180] Root Complex Link
         Kernel driver in use: pcieport

00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express 
Port 3 (rev 03) (prog-if 00 [Normal decode])
         Flags: bus master, fast devsel, latency 0
         Bus: primary=00, secondary=05, subordinate=05, sec-latency=0
         I/O behind bridge: 00001000-00002fff
         Memory behind bridge: 93500000-945fffff
         Prefetchable memory behind bridge: 
0000000092400000-00000000933fffff
         Capabilities: [40] Express Root Port (Slot+), MSI 00
         Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
         Capabilities: [90] Subsystem: Acer Incorporated [ALI] Device 034b
         Capabilities: [a0] Power Management version 2
         Capabilities: [100] Virtual Channel
         Capabilities: [180] Root Complex Link
         Kernel driver in use: pcieport

00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI 
Controller #1 (rev 03) (prog-if 00 [UHCI])
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: medium devsel, IRQ 23
         I/O ports at 5080 [size=32]
         Capabilities: [50] PCI Advanced Features
         Kernel driver in use: uhci_hcd

00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI 
Controller #2 (rev 03) (prog-if 00 [UHCI])
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: medium devsel, IRQ 19
         I/O ports at 5060 [size=32]
         Capabilities: [50] PCI Advanced Features
         Kernel driver in use: uhci_hcd

00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI 
Controller #3 (rev 03) (prog-if 00 [UHCI])
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, medium devsel, latency 0, IRQ 20
         I/O ports at 5040 [size=32]
         Capabilities: [50] PCI Advanced Features
         Kernel driver in use: uhci_hcd

00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI 
Controller #1 (rev 03) (prog-if 20 [EHCI])
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: medium devsel, IRQ 23
         Memory at 96705800 (32-bit, non-prefetchable) [size=1K]
         Capabilities: [50] Power Management version 2
         Capabilities: [58] Debug port: BAR=1 offset=00a0
         Capabilities: [98] PCI Advanced Features
         Kernel driver in use: ehci_hcd

00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93) 
(prog-if 01 [Subtractive decode])
         Flags: bus master, fast devsel, latency 0
         Bus: primary=00, secondary=06, subordinate=06, sec-latency=32
         Capabilities: [50] Subsystem: Acer Incorporated [ALI] Device 034b

00:1f.0 ISA bridge: Intel Corporation ICH9M-E LPC Interface Controller 
(rev 03)
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, medium devsel, latency 0
         Capabilities: [e0] Vendor Specific Information: Len=0c <?>

00:1f.2 SATA controller: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 
4 port SATA Controller [AHCI mode] (rev 03) (prog-if 01 [AHCI 1.0])
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 43
         I/O ports at 50c8 [size=8]
         I/O ports at 50dc [size=4]
         I/O ports at 50c0 [size=8]
         I/O ports at 50d8 [size=4]
         I/O ports at 5020 [size=32]
         Memory at 96705000 (32-bit, non-prefetchable) [size=2K]
         Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit-
         Capabilities: [70] Power Management version 3
         Capabilities: [a8] SATA HBA v1.0
         Capabilities: [b0] PCI Advanced Features
         Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller 
(rev 03)
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: medium devsel, IRQ 18
         Memory at 96706000 (64-bit, non-prefetchable) [size=256]
         I/O ports at 5000 [size=32]
         Kernel driver in use: i801_smbus

00:1f.6 Signal processing controller: Intel Corporation 82801I (ICH9 
Family) Thermal Subsystem (rev 03)
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: fast devsel, IRQ 11
         Memory at 96704000 (64-bit, non-prefetchable) [size=4K]
         Capabilities: [50] Power Management version 3

04:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000
         Subsystem: Intel Corporation Centrino Wireless-N 1000 BGN
         Flags: bus master, fast devsel, latency 0, IRQ 44
         Memory at 94600000 (64-bit, non-prefetchable) [size=8K]
         Capabilities: [c8] Power Management version 3
         Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
         Capabilities: [e0] Express Endpoint, MSI 00
         Capabilities: [100] Advanced Error Reporting
         Capabilities: [140] Device Serial Number 00-1e-64-ff-ff-3a-4c-ec
         Kernel driver in use: iwlwifi

05:00.0 Ethernet controller: Atheros Communications Inc. AR8131 Gigabit 
Ethernet (rev c0)
         Subsystem: Acer Incorporated [ALI] Device 034b
         Flags: bus master, fast devsel, latency 0, IRQ 46
         Memory at 93500000 (64-bit, non-prefetchable) [size=256K]
         I/O ports at 1000 [size=128]
         Capabilities: [40] Power Management version 3
         Capabilities: [48] MSI: Enable+ Count=1/1 Maskable- 64bit+
         Capabilities: [58] Express Endpoint, MSI 00
         Capabilities: [6c] Vital Product Data
         Capabilities: [100] Advanced Error Reporting
         Capabilities: [180] Device Serial Number ff-0b-61-4b-70-5a-b6-ff
         Kernel driver in use: atl1c


# cat /proc/cpuinfo

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Celeron(R) CPU          743  @ 1.30GHz
stepping        : 10
microcode       : 0xa07
cpu MHz         : 1296.810
cache size      : 1024 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss tm pbe syscall 
nx lm constant_tsc up arch_perfmon pebs bts rep_good nopl aperfmperf pni 
dtes64 monitor ds_cpl tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm dts
bogomips        : 2593.62
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:


# cat /proc/modules

aes_x86_64 7760 3 - Live 0xffffffffa0089000
aes_generic 27055 1 aes_x86_64, Live 0xffffffffa007f000
mperf 1429 0 - Live 0xffffffffa0075000
cpufreq_userspace 2152 0 - Live 0xffffffffa0071000
cpufreq_powersave 994 0 - Live 0xffffffffa006d000
cpufreq_stats 3093 0 - Live 0xffffffffa0069000
cpufreq_conservative 5057 0 - Live 0xffffffffa0035000
bluetooth 78815 2 - Live 0xffffffffa0002000
i915 376275 2 - Live 0xffffffffa0721000
drm_kms_helper 28203 1 i915, Live 0xffffffffa0714000
drm 199595 3 i915,drm_kms_helper, Live 0xffffffffa06cd000
i2c_algo_bit 4834 1 i915, Live 0xffffffffa06c8000
uinput 6725 1 - Live 0xffffffffa06c3000
fuse 58861 1 - Live 0xffffffffa06ac000
nfsd 212927 2 - Live 0xffffffffa066a000
exportfs 3447 1 nfsd, Live 0xffffffffa0666000
nfs 264646 0 - Live 0xffffffffa0610000
lockd 66446 2 nfsd,nfs, Live 0xffffffffa05f7000
fscache 41009 1 nfs, Live 0xffffffffa05e4000
auth_rpcgss 37737 2 nfsd,nfs, Live 0xffffffffa05d4000
nfs_acl 2317 2 nfsd,nfs, Live 0xffffffffa05d0000
sunrpc 196478 6 nfsd,nfs,lockd,auth_rpcgss,nfs_acl, Live 0xffffffffa058a000
loop 15447 0 - Live 0xffffffffa0582000
joydev 9152 0 - Live 0xffffffffa057c000
snd_hda_codec_hdmi 22257 1 - Live 0xffffffffa0571000
snd_hda_codec_realtek 197108 1 - Live 0xffffffffa0536000
arc4 1353 2 - Live 0xffffffffa0532000
snd_hda_intel 23473 3 - Live 0xffffffffa0526000
snd_hda_codec 93483 3 
snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel, Live 
0xffffffffa0501000
snd_hwdep 5752 1 snd_hda_codec, Live 0xffffffffa04fb000
snd_pcm 73041 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec, Live 
0xffffffffa04df000
snd_seq 46164 0 - Live 0xffffffffa04cc000
snd_timer 18682 2 snd_pcm,snd_seq, Live 0xffffffffa04c2000
snd_seq_device 5829 1 snd_seq, Live 0xffffffffa04bd000
iwlwifi 165948 0 - Live 0xffffffffa0487000
snd 60683 15 
snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_seq,snd_timer,snd_seq_device, 
Live 0xffffffffa046e000
uvcvideo 53221 0 - Live 0xffffffffa045c000
soundcore 6558 1 snd, Live 0xffffffffa0456000
videodev 79468 1 uvcvideo, Live 0xffffffffa0439000
mac80211 201126 1 iwlwifi, Live 0xffffffffa03f6000
i2c_i801 7770 0 - Live 0xffffffffa03f0000
psmouse 56724 0 - Live 0xffffffffa03da000
cfg80211 146500 2 iwlwifi,mac80211, Live 0xffffffffa03a8000
iTCO_wdt 12072 0 - Live 0xffffffffa03a0000
acer_wmi 20155 0 - Live 0xffffffffa0396000
v4l2_compat_ioctl32 7727 1 videodev, Live 0xffffffffa0391000
mxm_wmi 1851 0 - Live 0xffffffffa038d000
sparse_keymap 3594 1 acer_wmi, Live 0xffffffffa0389000
iTCO_vendor_support 2797 1 iTCO_wdt, Live 0xffffffffa0385000
pcspkr 1830 0 - Live 0xffffffffa0381000
evdev 8569 16 - Live 0xffffffffa0373000
serio_raw 4177 0 - Live 0xffffffffa036e000
i2c_core 23165 6 i915,drm_kms_helper,drm,i2c_algo_bit,videodev,i2c_i801, 
Live 0xffffffffa0362000
snd_page_alloc 7422 2 snd_hda_intel,snd_pcm, Live 0xffffffffa035c000
rfkill 16037 4 bluetooth,cfg80211,acer_wmi, Live 0xffffffffa0353000
wmi 9150 2 acer_wmi,mxm_wmi, Live 0xffffffffa0345000
battery 6802 0 - Live 0xffffffffa0340000
ac 2438 0 - Live 0xffffffffa033c000
button 5105 1 i915, Live 0xffffffffa032f000
video 12154 1 i915, Live 0xffffffffa0327000
processor 27867 1 - Live 0xffffffffa02f3000
ext4 386181 2 - Live 0xffffffffa0278000
mbcache 6317 1 ext4, Live 0xffffffffa0272000
jbd2 70425 1 ext4, Live 0xffffffffa0256000
crc16 1643 1 ext4, Live 0xffffffffa0252000
sr_mod 13275 0 - Live 0xffffffffa0246000
sd_mod 30692 4 - Live 0xffffffffa0239000
cdrom 33723 1 sr_mod, Live 0xffffffffa022b000
crc_t10dif 1499 1 sd_mod, Live 0xffffffffa0227000
uhci_hcd 18980 0 - Live 0xffffffffa021e000
ahci 19800 3 - Live 0xffffffffa0214000
libahci 20328 1 ahci, Live 0xffffffffa020a000
libata 169193 2 ahci,libahci, Live 0xffffffffa01ca000
scsi_mod 190814 3 sr_mod,sd_mod,libata, Live 0xffffffffa0142000
ehci_hcd 33755 0 - Live 0xffffffffa01bc000
thermal 8342 0 - Live 0xffffffffa0199000
thermal_sys 14742 3 video,processor,thermal, Live 0xffffffffa0191000
atl1c 27404 0 - Live 0xffffffffa0185000
usbcore 146444 4 uvcvideo,uhci_hcd,ehci_hcd, Live 0xffffffffa0039000
usb_common 1117 1 usbcore, Live 0xffffffffa0000000


# cat /proc/ioports

0000-0cf7 : PCI Bus 0000:00
   0000-001f : dma1
   0020-0021 : pic1
   0040-0043 : timer0
   0050-0053 : timer1
   0060-0060 : keyboard
   0062-0062 : EC data
   0064-0064 : keyboard
   0066-0066 : EC cmd
   0070-0077 : rtc0
   0080-008f : dma page reg
   00a0-00a1 : pic2
   00c0-00df : dma2
   00f0-00ff : fpu
   03c0-03df : vga+
   0400-047f : pnp 00:01
     0400-0403 : ACPI PM1a_EVT_BLK
     0404-0405 : ACPI PM1a_CNT_BLK
     0408-040b : ACPI PM_TMR
     0410-0415 : ACPI CPU throttle
     0420-042f : ACPI GPE0_BLK
     0430-0433 : iTCO_wdt
     0450-0450 : ACPI PM2_CNT_BLK
     0460-047f : iTCO_wdt
   0500-057f : pnp 00:01
   0600-060f : pnp 00:01
   0610-0610 : pnp 00:01
   0800-080f : pnp 00:01
   0810-0817 : pnp 00:01
   0820-0823 : pnp 00:01
0cf8-0cff : PCI conf1
0d00-ffff : PCI Bus 0000:00
   1000-2fff : PCI Bus 0000:05
     1000-107f : 0000:05:00.0
       1000-107f : atl1c
   3000-3fff : PCI Bus 0000:04
   4000-4fff : PCI Bus 0000:02
   5000-501f : 0000:00:1f.3
     5000-501f : i801_smbus
   5020-503f : 0000:00:1f.2
     5020-503f : ahci
   5040-505f : 0000:00:1d.2
     5040-505f : uhci_hcd
   5060-507f : 0000:00:1d.1
     5060-507f : uhci_hcd
   5080-509f : 0000:00:1d.0
     5080-509f : uhci_hcd
   50a0-50bf : 0000:00:1a.0
     50a0-50bf : uhci_hcd
   50c0-50c7 : 0000:00:1f.2
     50c0-50c7 : ahci
   50c8-50cf : 0000:00:1f.2
     50c8-50cf : ahci
   50d0-50d7 : 0000:00:02.0
   50d8-50db : 0000:00:1f.2
     50d8-50db : ahci
   50dc-50df : 0000:00:1f.2
     50dc-50df : ahci
   ff2c-ff2f : pnp 00:01


I am new to all this kernel dev/mailing list stuff so I apologize in 
advance if I have done anything wrong by sending this.
Thanks for the help,
Chris.

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

* Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)
  2012-01-21 17:09 i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5) Chris Diamand
@ 2012-01-21 18:32 ` Keith Packard
  2012-01-21 21:25   ` i915/kms/backlight-combo mode problem Chris Diamand
  0 siblings, 1 reply; 26+ messages in thread
From: Keith Packard @ 2012-01-21 18:32 UTC (permalink / raw)
  To: Chris Diamand, linux-kernel; +Cc: tiwai, melchior.franz

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

On Sat, 21 Jan 2012 17:09:25 +0000, Chris Diamand <chris.diamand@gmail.com> wrote:
> Hi,
> 
> I have the problem described in the thread here 
> (https://lkml.org/lkml/2011/4/29/217) where the backlight
> values are reversed so although stuff is displayed on the screen, the 
> backlight is off. This occurs with kernels from about 2.6.39 onwards.
> 
> After booting a "broken" kernel (>~2.6.39), the backlight can be lit 
> temporarily with:
> setpci -s 00:02.0 F4.B=0
> and then turned off with:
> setpci -s 00:02.0 F4.B=FF

Can you experiment with other values? I'd like to know if it's
completely reversed, or if there's some other interaction here.

Testing 0x80, 0x7f, 0x01, 0xfe would all be interesting to me.

I suspect that writes to the LPBC value are being trapped by SMI and
'doing things' underneath.

> Yesterday I tried this patch, https://lkml.org/lkml/2011/4/30/37 by 
> manually applying it to the 3.2.1
> kernel source - this fixes the problem.

Can you still turn the backlight off with this patch in place?

> ** Unfortunately the LKML thread stops after this patch and given that 
> the problem is still present in the latest source, this code wasn't 
> pushed into the kernel. Is there a reason for this or was it just 
> forgotten about? What can I do about this? I am happy to make a git 
> patch with the latest source if this will help.

The patch would completely bypass LPBC-based brightness controls if the
backlight happened to be off when the driver started, which isn't
exactly what you want.

-- 
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

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

* Re: i915/kms/backlight-combo mode problem
  2012-01-21 18:32 ` Keith Packard
@ 2012-01-21 21:25   ` Chris Diamand
  2012-01-21 22:31     ` Keith Packard
  0 siblings, 1 reply; 26+ messages in thread
From: Chris Diamand @ 2012-01-21 21:25 UTC (permalink / raw)
  To: Keith Packard; +Cc: linux-kernel, tiwai, melchior.franz

On 21/01/12 18:32, Keith Packard wrote:
> On Sat, 21 Jan 2012 17:09:25 +0000, Chris Diamand<chris.diamand@gmail.com>  wrote:
>> Hi,
>>
>> I have the problem described in the thread here
>> (https://lkml.org/lkml/2011/4/29/217) where the backlight
>> values are reversed so although stuff is displayed on the screen, the
>> backlight is off. This occurs with kernels from about 2.6.39 onwards.
>>
>> After booting a "broken" kernel (>~2.6.39), the backlight can be lit
>> temporarily with:
>> setpci -s 00:02.0 F4.B=0
>> and then turned off with:
>> setpci -s 00:02.0 F4.B=FF
> Can you experiment with other values? I'd like to know if it's
> completely reversed, or if there's some other interaction here.
>
> Testing 0x80, 0x7f, 0x01, 0xfe would all be interesting to me.
>
0x00 is the brightest. It gets very gradually dimmer up to about 0xB0, 
when the gaps between
brightness levels are slightly bigger.
0xFE is very low but still works.
Barely any difference between 0x80 and 0x7f, same with 0x00 and 0x01, etc.

> I suspect that writes to the LPBC value are being trapped by SMI and
> 'doing things' underneath.
>
>> Yesterday I tried this patch, https://lkml.org/lkml/2011/4/30/37 by
>> manually applying it to the 3.2.1
>> kernel source - this fixes the problem.
> Can you still turn the backlight off with this patch in place?
Yes, with Fn-F6. It turns back on again when the mouse is moved or a key 
is pressed.
>> ** Unfortunately the LKML thread stops after this patch and given that
>> the problem is still present in the latest source, this code wasn't
>> pushed into the kernel. Is there a reason for this or was it just
>> forgotten about? What can I do about this? I am happy to make a git
>> patch with the latest source if this will help.
> The patch would completely bypass LPBC-based brightness controls if the
> backlight happened to be off when the driver started, which isn't
> exactly what you want.
>



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

* Re: i915/kms/backlight-combo mode problem
  2012-01-21 21:25   ` i915/kms/backlight-combo mode problem Chris Diamand
@ 2012-01-21 22:31     ` Keith Packard
  2012-01-22 10:46       ` Chris Diamand
  0 siblings, 1 reply; 26+ messages in thread
From: Keith Packard @ 2012-01-21 22:31 UTC (permalink / raw)
  To: Chris Diamand; +Cc: linux-kernel, tiwai, melchior.franz

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

On Sat, 21 Jan 2012 21:25:56 +0000, Chris Diamand <chris.diamand@gmail.com> wrote:

> 0x00 is the brightest. It gets very gradually dimmer up to about 0xB0, 
> when the gaps between
> brightness levels are slightly bigger.
> 0xFE is very low but still works.
> Barely any difference between 0x80 and 0x7f, same with 0x00 and 0x01,
> etc.

Here's a patch which just flips the interpretation of that value over;
does this work?

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 04d79fd..43faa9d 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -207,6 +207,7 @@ u32 intel_panel_get_backlight(struct drm_device *dev)
                        u8 lbpc;
 
                        pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc);
+                       lbpc = 0xff - lbpc;
                        val *= lbpc;
                }
        }
@@ -238,7 +239,7 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level
 
                lbpc = level * 0xfe / max + 1;
                level /= lbpc;
-               pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
+               pci_write_config_byte(dev->pdev, PCI_LBPC, 0xff - lbpc);
        }
 
        tmp = I915_READ(BLC_PWM_CTL);


-- 
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

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

* Re: i915/kms/backlight-combo mode problem
  2012-01-21 22:31     ` Keith Packard
@ 2012-01-22 10:46       ` Chris Diamand
  0 siblings, 0 replies; 26+ messages in thread
From: Chris Diamand @ 2012-01-22 10:46 UTC (permalink / raw)
  To: Keith Packard; +Cc: linux-kernel, tiwai, melchior.franz


> Here's a patch which just flips the interpretation of that value over;
> does this work?
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 04d79fd..43faa9d 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -207,6 +207,7 @@ u32 intel_panel_get_backlight(struct drm_device *dev)
>                          u8 lbpc;
>
>                          pci_read_config_byte(dev->pdev, PCI_LBPC,&lbpc);
> +                       lbpc = 0xff - lbpc;
>                          val *= lbpc;
>                  }
>          }
> @@ -238,7 +239,7 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level
>
>                  lbpc = level * 0xfe / max + 1;
>                  level /= lbpc;
> -               pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
> +               pci_write_config_byte(dev->pdev, PCI_LBPC, 0xff - lbpc);
>          }
>
>          tmp = I915_READ(BLC_PWM_CTL);
This works - the backlight stays on, and can be switched off with Fn-F6.
Interestingly the values for setpci -s are still *exactly the same*, as 
in 0x00 is fully on, 0xFF is off (with graduation in between), despite 
the values being reversed.

Chris.

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

end of thread, other threads:[~2012-01-22 10:46 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-21 17:09 i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5) Chris Diamand
2012-01-21 18:32 ` Keith Packard
2012-01-21 21:25   ` i915/kms/backlight-combo mode problem Chris Diamand
2012-01-21 22:31     ` Keith Packard
2012-01-22 10:46       ` Chris Diamand
  -- strict thread matches above, loose matches on Subject: below --
2011-04-27  4:30 Linux 2.6.39-rc5 Linus Torvalds
     [not found] ` <s5htyd9kumz.wl%tiwai@suse.de>
2011-05-05 20:42   ` i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5) Melchior FRANZ
2011-05-06  8:52     ` i915/kms/backlight-combo mode problem Melchior FRANZ
2011-05-06 12:41       ` Joey Lee
2011-05-06 16:23         ` Melchior FRANZ
2011-05-07 20:22           ` Melchior FRANZ
2011-05-08 13:41             ` Joey Lee
2011-05-08 14:05               ` Melchior FRANZ
2011-05-09  8:50                 ` Joey Lee
2011-05-09  9:00                   ` Takashi Iwai
2011-05-09  9:35                     ` Joey Lee
2011-05-09 10:08                   ` Melchior FRANZ
     [not found]                     ` <BANLkTimtvAWeS-t3bWjJmdVtyaPDw2uWDA@mail.gmail.com>
2011-05-10  3:29                       ` Michael Chang
2011-05-10 11:08                         ` Melchior FRANZ
     [not found]                           ` <BANLkTimQJM3N1WdBhYVOH0UyyOTFcxOfUQ@mail.gmail.com>
2011-05-13 21:20                             ` Joey Lee
2011-05-15 12:50                               ` Melchior FRANZ
2011-05-15 10:08                           ` Takashi Iwai
2011-05-16 12:21                             ` Melchior FRANZ
2011-05-17  7:56                               ` Michael Chang
2011-05-17  8:58                                 ` Melchior FRANZ
2011-05-17 10:12                                   ` Michael Chang
2011-05-17 11:40                                     ` Melchior FRANZ
2011-05-09  8:58             ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).