i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-05 Thread Melchior FRANZ
* Takashi Iwai -- Thursday 05 May 2011:
> Try the fixed patch below.

> ---
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 456f404..4c6e187 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -332,6 +332,7 @@ typedef struct drm_i915_private {
>   struct intel_overlay *overlay;
>  
>   /* LVDS info */
> + int backlight_combination_mode; /* 0=unknown, -1=no, 1=yes */
>   int backlight_level;  /* restore backlight to this value */
>   bool backlight_enabled;
>   struct drm_display_mode *panel_fixed_mode;
> diff --git a/drivers/gpu/drm/i915/intel_panel.c 
> b/drivers/gpu/drm/i915/intel_panel.c
> index f8f86e5..5a6be04 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -115,14 +115,24 @@ done:
>  static int is_backlight_combination_mode(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 (IS_GEN2(dev))
> - return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
> -
> - return 0;
> + int combo_mode;
> + u8 lbpc;
> +
> + if (dev_priv->backlight_combination_mode)
> + return dev_priv->backlight_combination_mode > 0;
> +
> + pci_read_config_byte(dev->pdev, PCI_LBPC, );
> + if (!lbpc)
> + combo_mode = 0;
> + else if (INTEL_INFO(dev)->gen >= 4)
> + combo_mode = I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
> + else if (IS_GEN2(dev))
> + combo_mode = I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
> + else
> + combo_mode = 0;
> +
> + dev_priv->backlight_combination_mode = combo_mode ? 1 : -1;
> + return combo_mode;
>  }
>  
>  static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)

The first patch had a problem. Without the lbpc check for zero the backlight
still stayed off and could only be activated with the brightness-down key.
This revised patch works correctly for me. Thanks!

m.


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-05 Thread Melchior FRANZ
* Takashi Iwai -- Thursday 05 May 2011:
 Try the fixed patch below.

 ---
 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
 index 456f404..4c6e187 100644
 --- a/drivers/gpu/drm/i915/i915_drv.h
 +++ b/drivers/gpu/drm/i915/i915_drv.h
 @@ -332,6 +332,7 @@ typedef struct drm_i915_private {
   struct intel_overlay *overlay;
  
   /* LVDS info */
 + int backlight_combination_mode; /* 0=unknown, -1=no, 1=yes */
   int backlight_level;  /* restore backlight to this value */
   bool backlight_enabled;
   struct drm_display_mode *panel_fixed_mode;
 diff --git a/drivers/gpu/drm/i915/intel_panel.c 
 b/drivers/gpu/drm/i915/intel_panel.c
 index f8f86e5..5a6be04 100644
 --- a/drivers/gpu/drm/i915/intel_panel.c
 +++ b/drivers/gpu/drm/i915/intel_panel.c
 @@ -115,14 +115,24 @@ done:
  static int is_backlight_combination_mode(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 (IS_GEN2(dev))
 - return I915_READ(BLC_PWM_CTL)  BLM_LEGACY_MODE;
 -
 - return 0;
 + int combo_mode;
 + u8 lbpc;
 +
 + if (dev_priv-backlight_combination_mode)
 + return dev_priv-backlight_combination_mode  0;
 +
 + pci_read_config_byte(dev-pdev, PCI_LBPC, lbpc);
 + if (!lbpc)
 + combo_mode = 0;
 + else if (INTEL_INFO(dev)-gen = 4)
 + combo_mode = I915_READ(BLC_PWM_CTL2)  BLM_COMBINATION_MODE;
 + else if (IS_GEN2(dev))
 + combo_mode = I915_READ(BLC_PWM_CTL)  BLM_LEGACY_MODE;
 + else
 + combo_mode = 0;
 +
 + dev_priv-backlight_combination_mode = combo_mode ? 1 : -1;
 + return combo_mode;
  }
  
  static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)

The first patch had a problem. Without the lbpc check for zero the backlight
still stayed off and could only be activated with the brightness-down key.
This revised patch works correctly for me. Thanks!

m.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-04 Thread Joey Lee
Hi Melchior, 

? ??2011-05-02 ? 14:08 +0200?Takashi Iwai ???
> At Sat, 30 Apr 2011 13:34:51 +0200,
> Melchior FRANZ wrote:
> > 
> > Dropping Linus from the CC.
> > 
> > 
> > * Takashi Iwai -- Saturday 30 April 2011:
> > * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
> > > > Yes, backlight adjustment generally works on this notebook, but only
> > > > with "acpi_osi=Linux" on the command line.
> > > 
> > > acpi_osi quirk should be better added statically, then.
> > 
> > No, I guess the problem here is that acer_wmi doesn't support this
> > machine yet. I told the ACER WMI maintainer and sent a DSDT image,
> > but this message was thoroughly ignored.
> > 
> > 
> >   $ dmesg|grep -i acer
> >   [0.00] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
> >   [   71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
> >   [   72.350278] acer_wmi: Unable to detect available WMID devices
> >   
> >   Machine: Acer Travelmate 5735Z-452G32Mnss
> 
> Hm, but the backlight control is done via the standard ACPI, no?
> If so, the fact that acer_wmi doesn't work sounds irrelevant.
> 
> BTW, did you try my previous patch?
> 
> 
> Takashi

Yes, please try Takashi's previous patch. 

I am tracing bko#34142, but this issue does not related to your
backlight control, because there have _BCM, _BQC declare in your DSDT,
your machine MUST SUPPORTED by standard acpi backlight interface.

Even the acer-wmi can probed on your machine, it cann't help anything
for your backlight control.


Thank's a lot!
Joey Lee



Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-04 Thread Joey Lee
Hi Melchior, 

於 一,2011-05-02 於 14:08 +0200,Takashi Iwai 提到:
 At Sat, 30 Apr 2011 13:34:51 +0200,
 Melchior FRANZ wrote:
  
  Dropping Linus from the CC.
  
  
  * Takashi Iwai -- Saturday 30 April 2011:
  * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
Yes, backlight adjustment generally works on this notebook, but only
with acpi_osi=Linux on the command line.
   
   acpi_osi quirk should be better added statically, then.
  
  No, I guess the problem here is that acer_wmi doesn't support this
  machine yet. I told the ACER WMI maintainer and sent a DSDT image,
  but this message was thoroughly ignored.
  
  
$ dmesg|grep -i acer
[0.00] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
[   71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
[   72.350278] acer_wmi: Unable to detect available WMID devices

Machine: Acer Travelmate 5735Z-452G32Mnss
 
 Hm, but the backlight control is done via the standard ACPI, no?
 If so, the fact that acer_wmi doesn't work sounds irrelevant.
 
 BTW, did you try my previous patch?
 
 
 Takashi

Yes, please try Takashi's previous patch. 

I am tracing bko#34142, but this issue does not related to your
backlight control, because there have _BCM, _BQC declare in your DSDT,
your machine MUST SUPPORTED by standard acpi backlight interface.

Even the acer-wmi can probed on your machine, it cann't help anything
for your backlight control.


Thank's a lot!
Joey Lee

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-02 Thread Melchior FRANZ
* Takashi Iwai -- Monday 02 May 2011:
* > At Sat, 30 Apr 2011 13:34:51 +0200, Melchior FRANZ wrote:
> > * Takashi Iwai -- Saturday 30 April 2011:
> > > acpi_osi quirk should be better added statically, then.
> > 
> > No, I guess the problem here is that acer_wmi doesn't support this
> > machine yet.

> Hm, but the backlight control is done via the standard ACPI, no?

I have no idea. If I were an expert, I would just have sent a
patch, not a bug report. And I prefer fixes to "quirks".  :-P



> BTW, did you try my previous patch?

Works. I hadn't tested it before, because you seemed to wait
for the opinion of some Intel people, and so did I. But thanks
for that code!

m.


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-02 Thread Takashi Iwai
At Sat, 30 Apr 2011 13:34:51 +0200,
Melchior FRANZ wrote:
> 
> Dropping Linus from the CC.
> 
> 
> * Takashi Iwai -- Saturday 30 April 2011:
> * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
> > > Yes, backlight adjustment generally works on this notebook, but only
> > > with "acpi_osi=Linux" on the command line.
> > 
> > acpi_osi quirk should be better added statically, then.
> 
> No, I guess the problem here is that acer_wmi doesn't support this
> machine yet. I told the ACER WMI maintainer and sent a DSDT image,
> but this message was thoroughly ignored.
> 
> 
>   $ dmesg|grep -i acer
>   [0.00] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
>   [   71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
>   [   72.350278] acer_wmi: Unable to detect available WMID devices
>   
>   Machine: Acer Travelmate 5735Z-452G32Mnss

Hm, but the backlight control is done via the standard ACPI, no?
If so, the fact that acer_wmi doesn't work sounds irrelevant.

BTW, did you try my previous patch?


Takashi


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-02 Thread Takashi Iwai
At Sat, 30 Apr 2011 13:34:51 +0200,
Melchior FRANZ wrote:
 
 Dropping Linus from the CC.
 
 
 * Takashi Iwai -- Saturday 30 April 2011:
 * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
   Yes, backlight adjustment generally works on this notebook, but only
   with acpi_osi=Linux on the command line.
  
  acpi_osi quirk should be better added statically, then.
 
 No, I guess the problem here is that acer_wmi doesn't support this
 machine yet. I told the ACER WMI maintainer and sent a DSDT image,
 but this message was thoroughly ignored.
 
 
   $ dmesg|grep -i acer
   [0.00] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
   [   71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
   [   72.350278] acer_wmi: Unable to detect available WMID devices
   
   Machine: Acer Travelmate 5735Z-452G32Mnss

Hm, but the backlight control is done via the standard ACPI, no?
If so, the fact that acer_wmi doesn't work sounds irrelevant.

BTW, did you try my previous patch?


Takashi
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-02 Thread Melchior FRANZ
* Takashi Iwai -- Monday 02 May 2011:
*  At Sat, 30 Apr 2011 13:34:51 +0200, Melchior FRANZ wrote:
  * Takashi Iwai -- Saturday 30 April 2011:
   acpi_osi quirk should be better added statically, then.
  
  No, I guess the problem here is that acer_wmi doesn't support this
  machine yet.

 Hm, but the backlight control is done via the standard ACPI, no?

I have no idea. If I were an expert, I would just have sent a
patch, not a bug report. And I prefer fixes to quirks.  :-P



 BTW, did you try my previous patch?

Works. I hadn't tested it before, because you seemed to wait
for the opinion of some Intel people, and so did I. But thanks
for that code!

m.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-05-01 Thread Joey Lee
Hi Melchior, 

於 六,2011-04-30 於 13:34 +0200,Melchior FRANZ 提到:
 Dropping Linus from the CC.
 
 
 * Takashi Iwai -- Saturday 30 April 2011:
 * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
   Yes, backlight adjustment generally works on this notebook, but only
   with acpi_osi=Linux on the command line.
  
  acpi_osi quirk should be better added statically, then.
 
 No, I guess the problem here is that acer_wmi doesn't support this
 machine yet. I told the ACER WMI maintainer and sent a DSDT image,
 but this message was thoroughly ignored.
 
 
   $ dmesg|grep -i acer
   [0.00] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
   [   71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
   [   72.350278] acer_wmi: Unable to detect available WMID devices
   
   Machine: Acer Travelmate 5735Z-452G32Mnss
 
 m.
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/

Could you please attach DSDT on this mail or share your kernel bugzilla
number to us?

I found cann't access BKO now?


Thank's
Joey Lee

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Melchior FRANZ
Dropping Linus from the CC.


* Takashi Iwai -- Saturday 30 April 2011:
* * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
> > Yes, backlight adjustment generally works on this notebook, but only
> > with "acpi_osi=Linux" on the command line.
> 
> acpi_osi quirk should be better added statically, then.

No, I guess the problem here is that acer_wmi doesn't support this
machine yet. I told the ACER WMI maintainer and sent a DSDT image,
but this message was thoroughly ignored.


  $ dmesg|grep -i acer
  [0.00] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
  [   71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
  [   72.350278] acer_wmi: Unable to detect available WMID devices

  Machine: Acer Travelmate 5735Z-452G32Mnss

m.


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Takashi Iwai
At Sat, 30 Apr 2011 10:32:04 +0200,
Melchior FRANZ wrote:
> 
> * Takashi Iwai -- Saturday 30 April 2011:
> > I remember vaguely that the value zero could be interpreted as the max.
> 
> > Also, with the patch, does the backlight level can be adjusted
> > correctly to different values?  I wonder whether LBPC adjustment
> > really works or not on your machine.
> 
> > +   if (!lbpc)
> > +   lbpc = 0xff; /* max value */
> 
> This change does *not* work on my machine. The screen stays black
> again.

Hrm, then it's really hard to say how exactly the system behaves when
lbpc=0...  I guess we should avoid controlling LBPC in such a case,
e.g. something like the patch below (totally untested).

But Intel guys must know of this better... I leave this to their
hands.

> 
> Yes, backlight adjustment generally works on this notebook, but only
> with "acpi_osi=Linux" on the command line.

acpi_osi quirk should be better added statically, then.


thanks,

Takashi

---
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1c1b27c..c0ab771 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -328,6 +328,7 @@ typedef struct drm_i915_private {
struct intel_overlay *overlay;

/* LVDS info */
+   int backlight_combination_mode; /* 0=unknown, -1=no, 1=yes */
int backlight_level;  /* restore backlight to this value */
bool backlight_enabled;
struct drm_display_mode *panel_fixed_mode;
diff --git a/drivers/gpu/drm/i915/intel_panel.c 
b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..320dd5f 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -115,14 +115,24 @@ done:
 static int is_backlight_combination_mode(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 (IS_GEN2(dev))
-   return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
-
-   return 0;
+   int combo_mode;
+   u8 lbpc;
+
+   if (dev_priv->backlight_combination_mode)
+   return dev_priv->backlight_combination_mode > 0;
+
+   pci_read_config_byte(dev->pdev, PCI_LBPC, );
+   if (!lbpc)
+   combo_mode = 0;
+   else if (INTEL_INFO(dev)->gen >= 4)
+   combo_mode = I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
+   else if (IS_GEN2(dev))
+   combo_mode = I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
+   else
+   combo_mode = 0;
+
+   dev_priv->backlight_combination_mode = combo_mode ? -1 : 1;
+   return combo_mode;
 }

 static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Melchior FRANZ
* Takashi Iwai -- Saturday 30 April 2011:
> I remember vaguely that the value zero could be interpreted as the max.

> Also, with the patch, does the backlight level can be adjusted
> correctly to different values?  I wonder whether LBPC adjustment
> really works or not on your machine.

> + if (!lbpc)
> + lbpc = 0xff; /* max value */

This change does *not* work on my machine. The screen stays black
again.

Yes, backlight adjustment generally works on this notebook, but only
with "acpi_osi=Linux" on the command line.

m.


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Takashi Iwai
At Fri, 29 Apr 2011 22:09:54 +0200,
Melchior FRANZ wrote:
> 
> * Takashi Iwai -- Friday 29 April 2011:
> [https://bugzilla.kernel.org/show_bug.cgi?id=31522]
> > Looking at bugzilla, the problem seems like the case lbpc=0.
> > What about the patch below instead?
> 
> > -   val *= lbpc;
> > +   if (lbpc)
> > +   val *= lbpc;
> 
> Yes, that works as well. (I had assumed that this was the problem,
> but wasn't sure if a zero was even a legitimate value, or rather
> a sign for a problem or wrong assumption elsewhere.)

Well, this was just my wild guess.  I remember vaguely that the value
zero could be interpreted as the max.  It might be depending on the
hardware.

So, the patch below may work better in your case.

Also, with the patch, does the backlight level can be adjusted
correctly to different values?  I wonder whether LBPC adjustment
really works or not on your machine.


Takashi

---
diff --git a/drivers/gpu/drm/i915/intel_panel.c 
b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..aaa1f9e 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -207,6 +207,8 @@ u32 intel_panel_get_backlight(struct drm_device *dev)

val &= ~1;
pci_read_config_byte(dev->pdev, PCI_LBPC, );
+   if (!lbpc)
+   lbpc = 0xff; /* max value */
val *= lbpc;
}
}


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Joey Lee
Hi Melchior, 

? ??2011-04-30 ? 13:34 +0200?Melchior FRANZ ???
> Dropping Linus from the CC.
> 
> 
> * Takashi Iwai -- Saturday 30 April 2011:
> * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
> > > Yes, backlight adjustment generally works on this notebook, but only
> > > with "acpi_osi=Linux" on the command line.
> > 
> > acpi_osi quirk should be better added statically, then.
> 
> No, I guess the problem here is that acer_wmi doesn't support this
> machine yet. I told the ACER WMI maintainer and sent a DSDT image,
> but this message was thoroughly ignored.
> 
> 
>   $ dmesg|grep -i acer
>   [0.00] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
>   [   71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
>   [   72.350278] acer_wmi: Unable to detect available WMID devices
>   
>   Machine: Acer Travelmate 5735Z-452G32Mnss
> 
> m.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

Could you please attach DSDT on this mail or share your kernel bugzilla
number to us?

I found cann't access BKO now?


Thank's
Joey Lee



Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Takashi Iwai
At Fri, 29 Apr 2011 22:09:54 +0200,
Melchior FRANZ wrote:
 
 * Takashi Iwai -- Friday 29 April 2011:
 [https://bugzilla.kernel.org/show_bug.cgi?id=31522]
  Looking at bugzilla, the problem seems like the case lbpc=0.
  What about the patch below instead?
 
  -   val *= lbpc;
  +   if (lbpc)
  +   val *= lbpc;
 
 Yes, that works as well. (I had assumed that this was the problem,
 but wasn't sure if a zero was even a legitimate value, or rather
 a sign for a problem or wrong assumption elsewhere.)

Well, this was just my wild guess.  I remember vaguely that the value
zero could be interpreted as the max.  It might be depending on the
hardware.

So, the patch below may work better in your case.

Also, with the patch, does the backlight level can be adjusted
correctly to different values?  I wonder whether LBPC adjustment
really works or not on your machine.


Takashi

---
diff --git a/drivers/gpu/drm/i915/intel_panel.c 
b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..aaa1f9e 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -207,6 +207,8 @@ u32 intel_panel_get_backlight(struct drm_device *dev)
 
val = ~1;
pci_read_config_byte(dev-pdev, PCI_LBPC, lbpc);
+   if (!lbpc)
+   lbpc = 0xff; /* max value */
val *= lbpc;
}
}
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Melchior FRANZ
* Takashi Iwai -- Saturday 30 April 2011:
 I remember vaguely that the value zero could be interpreted as the max.

 Also, with the patch, does the backlight level can be adjusted
 correctly to different values?  I wonder whether LBPC adjustment
 really works or not on your machine.

 + if (!lbpc)
 + lbpc = 0xff; /* max value */

This change does *not* work on my machine. The screen stays black
again.

Yes, backlight adjustment generally works on this notebook, but only
with acpi_osi=Linux on the command line.

m.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Takashi Iwai
At Sat, 30 Apr 2011 10:32:04 +0200,
Melchior FRANZ wrote:
 
 * Takashi Iwai -- Saturday 30 April 2011:
  I remember vaguely that the value zero could be interpreted as the max.
 
  Also, with the patch, does the backlight level can be adjusted
  correctly to different values?  I wonder whether LBPC adjustment
  really works or not on your machine.
 
  +   if (!lbpc)
  +   lbpc = 0xff; /* max value */
 
 This change does *not* work on my machine. The screen stays black
 again.

Hrm, then it's really hard to say how exactly the system behaves when
lbpc=0...  I guess we should avoid controlling LBPC in such a case,
e.g. something like the patch below (totally untested).

But Intel guys must know of this better... I leave this to their
hands.

 
 Yes, backlight adjustment generally works on this notebook, but only
 with acpi_osi=Linux on the command line.

acpi_osi quirk should be better added statically, then.


thanks,

Takashi

---
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1c1b27c..c0ab771 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -328,6 +328,7 @@ typedef struct drm_i915_private {
struct intel_overlay *overlay;
 
/* LVDS info */
+   int backlight_combination_mode; /* 0=unknown, -1=no, 1=yes */
int backlight_level;  /* restore backlight to this value */
bool backlight_enabled;
struct drm_display_mode *panel_fixed_mode;
diff --git a/drivers/gpu/drm/i915/intel_panel.c 
b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..320dd5f 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -115,14 +115,24 @@ done:
 static int is_backlight_combination_mode(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 (IS_GEN2(dev))
-   return I915_READ(BLC_PWM_CTL)  BLM_LEGACY_MODE;
-
-   return 0;
+   int combo_mode;
+   u8 lbpc;
+
+   if (dev_priv-backlight_combination_mode)
+   return dev_priv-backlight_combination_mode  0;
+
+   pci_read_config_byte(dev-pdev, PCI_LBPC, lbpc);
+   if (!lbpc)
+   combo_mode = 0;
+   else if (INTEL_INFO(dev)-gen = 4)
+   combo_mode = I915_READ(BLC_PWM_CTL2)  BLM_COMBINATION_MODE;
+   else if (IS_GEN2(dev))
+   combo_mode = I915_READ(BLC_PWM_CTL)  BLM_LEGACY_MODE;
+   else
+   combo_mode = 0;
+
+   dev_priv-backlight_combination_mode = combo_mode ? -1 : 1;
+   return combo_mode;
 }
 
 static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-30 Thread Melchior FRANZ
Dropping Linus from the CC.


* Takashi Iwai -- Saturday 30 April 2011:
* * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
  Yes, backlight adjustment generally works on this notebook, but only
  with acpi_osi=Linux on the command line.
 
 acpi_osi quirk should be better added statically, then.

No, I guess the problem here is that acer_wmi doesn't support this
machine yet. I told the ACER WMI maintainer and sent a DSDT image,
but this message was thoroughly ignored.


  $ dmesg|grep -i acer
  [0.00] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
  [   71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
  [   72.350278] acer_wmi: Unable to detect available WMID devices
  
  Machine: Acer Travelmate 5735Z-452G32Mnss

m.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-29 Thread Melchior FRANZ
* Takashi Iwai -- Friday 29 April 2011:
[https://bugzilla.kernel.org/show_bug.cgi?id=31522]
> Looking at bugzilla, the problem seems like the case lbpc=0.
> What about the patch below instead?

> - val *= lbpc;
> + if (lbpc)
> + val *= lbpc;

Yes, that works as well. (I had assumed that this was the problem,
but wasn't sure if a zero was even a legitimate value, or rather
a sign for a problem or wrong assumption elsewhere.)

m.


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-29 Thread Takashi Iwai
At Fri, 29 Apr 2011 19:41:53 +0200,
Melchior FRANZ wrote:
> 
> * Takashi Iwai -- Friday 29 April 2011:
> > Melchior FRANZ wrote:
> > > The bug was introduced with commit 
> > > ba3820ade317ee36e496b9b40d2ec3987dd4aef0
> > > [...] when using KMS my notebook's[2] screen remains dark, because the
> > > backlight isn't turned on.
> 
> > Could you check whether the patch below changes the behavior?
> > If this cures, it means that the backlight-combo mode doesn't work on
> > your machine.
> 
> Yes, that works. (Test was with fafc9929c668f8bae6dd1f109f33a86d2cb3c460,
> which is current HEAD.)

Looking at bugzilla, the problem seems like the case lbpc=0.
What about the patch below instead?


Takashi

---
diff --git a/drivers/gpu/drm/i915/intel_panel.c 
b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..ba60218 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -207,7 +207,8 @@ u32 intel_panel_get_backlight(struct drm_device *dev)

val &= ~1;
pci_read_config_byte(dev->pdev, PCI_LBPC, );
-   val *= lbpc;
+   if (lbpc)
+   val *= lbpc;
}
}



i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-29 Thread Melchior FRANZ
* Takashi Iwai -- Friday 29 April 2011:
> Melchior FRANZ wrote:
> > The bug was introduced with commit ba3820ade317ee36e496b9b40d2ec3987dd4aef0
> > [...] when using KMS my notebook's[2] screen remains dark, because the
> > backlight isn't turned on.

> Could you check whether the patch below changes the behavior?
> If this cures, it means that the backlight-combo mode doesn't work on
> your machine.

Yes, that works. (Test was with fafc9929c668f8bae6dd1f109f33a86d2cb3c460,
which is current HEAD.)

m.


i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-29 Thread Melchior FRANZ
* Takashi Iwai -- Friday 29 April 2011:
 Melchior FRANZ wrote:
  The bug was introduced with commit ba3820ade317ee36e496b9b40d2ec3987dd4aef0
  [...] when using KMS my notebook's[2] screen remains dark, because the
  backlight isn't turned on.

 Could you check whether the patch below changes the behavior?
 If this cures, it means that the backlight-combo mode doesn't work on
 your machine.

Yes, that works. (Test was with fafc9929c668f8bae6dd1f109f33a86d2cb3c460,
which is current HEAD.)

m.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-29 Thread Takashi Iwai
At Fri, 29 Apr 2011 19:41:53 +0200,
Melchior FRANZ wrote:
 
 * Takashi Iwai -- Friday 29 April 2011:
  Melchior FRANZ wrote:
   The bug was introduced with commit 
   ba3820ade317ee36e496b9b40d2ec3987dd4aef0
   [...] when using KMS my notebook's[2] screen remains dark, because the
   backlight isn't turned on.
 
  Could you check whether the patch below changes the behavior?
  If this cures, it means that the backlight-combo mode doesn't work on
  your machine.
 
 Yes, that works. (Test was with fafc9929c668f8bae6dd1f109f33a86d2cb3c460,
 which is current HEAD.)

Looking at bugzilla, the problem seems like the case lbpc=0.
What about the patch below instead?


Takashi

---
diff --git a/drivers/gpu/drm/i915/intel_panel.c 
b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..ba60218 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -207,7 +207,8 @@ u32 intel_panel_get_backlight(struct drm_device *dev)
 
val = ~1;
pci_read_config_byte(dev-pdev, PCI_LBPC, lbpc);
-   val *= lbpc;
+   if (lbpc)
+   val *= lbpc;
}
}
 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

2011-04-29 Thread Melchior FRANZ
* Takashi Iwai -- Friday 29 April 2011:
[https://bugzilla.kernel.org/show_bug.cgi?id=31522]
 Looking at bugzilla, the problem seems like the case lbpc=0.
 What about the patch below instead?

 - val *= lbpc;
 + if (lbpc)
 + val *= lbpc;

Yes, that works as well. (I had assumed that this was the problem,
but wasn't sure if a zero was even a legitimate value, or rather
a sign for a problem or wrong assumption elsewhere.)

m.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel