mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Joey Lee" <jlee@novell.com>
Cc: <melchior.franz@gmail.com>, <chris@chris-wilson.co.uk>,
	<dri-devel@lists.freedesktop.org>, "Joey Lee" <JLee@novell.com>,
	"Michael Chang" <MChang@novell.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: i915/kms/backlight-combo mode problem
Date: Mon, 09 May 2011 11:00:10 +0200	[thread overview]
Message-ID: <s5hpqns6yg5.wl%tiwai@suse.de> (raw)
In-Reply-To: <4DC8378A020000230002C5A8@novprvlin0050.provo.novell.com>

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

  reply	other threads:[~2011-05-09  9:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27  4:30 Linux 2.6.39-rc5 Linus Torvalds
2011-04-29 15:58 ` Melchior FRANZ
2011-04-29 17:09   ` Takashi Iwai
2011-04-29 17:41     ` i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5) Melchior FRANZ
2011-04-29 19:47       ` Takashi Iwai
2011-04-29 20:09         ` Melchior FRANZ
2011-04-30  8:11           ` Takashi Iwai
2011-04-30  8:32             ` Melchior FRANZ
2011-04-30 10:27               ` Takashi Iwai
2011-04-30 11:34                 ` Melchior FRANZ
2011-04-30 14:37                   ` Joey Lee
2011-05-02 12:08                   ` Takashi Iwai
2011-05-02 13:12                     ` Melchior FRANZ
2011-05-04  7:07                     ` Joey Lee
     [not found] ` <201105051745.27992@rk-nord.at>
     [not found]   ` <s5htyd9kumz.wl%tiwai@suse.de>
2011-05-05 20:42     ` 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 [this message]
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
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hpqns6yg5.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=MChang@novell.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jlee@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=melchior.franz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®