diff mbox

i915/kms/backlight-combo mode problem

Message ID 4DC8378A020000230002C5A8@novprvlin0050.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Joey Lee May 9, 2011, 8:50 a.m. UTC
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 :

Comments

Takashi Iwai May 9, 2011, 9 a.m. UTC | #1
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);
>  }
>  
> 
>
Melchior FRANZ May 9, 2011, 10:08 a.m. UTC | #2
* 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.
Michael Chang May 9, 2011, 10:43 a.m. UTC | #3
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.
>
diff mbox

Patch

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);
 }