All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Lu <aaron.lwe@gmail.com>
To: Seth Forshee <seth.forshee@canonical.com>
Cc: linux-acpi@vger.kernel.org, Matthew Garrett <mjg59@srcf.ucam.org>,
	Len Brown <lenb@kernel.org>, "Rafael J. Wysocki" <rjw@sisk.pl>,
	Ben Jencks <ben@bjencks.net>, joeyli <jlee@suse.com>
Subject: Re: [PATCH 3/5] acpi_video: Add workaround for broken Windows 8 backlight implementations
Date: Thu, 04 Apr 2013 22:27:42 +0800	[thread overview]
Message-ID: <515D8DDE.3050307@gmail.com> (raw)
In-Reply-To: <20130404140244.GC22945@thinkpad-t410>

On 04/04/2013 10:02 PM, Seth Forshee wrote:
> On Thu, Apr 04, 2013 at 09:46:47PM +0800, Aaron Lu wrote:
>> On 04/04/2013 08:35 PM, Seth Forshee wrote:
>>> On Thu, Apr 04, 2013 at 07:44:04PM +0800, Aaron Lu wrote:
>>>> On 03/08/2013 03:39 AM, Seth Forshee wrote:
>>>>> Windows 8 requires that all backlights report 101 brightness levels.
>>>>> When Lenovo updated the firmware for some machines for Windows 8 they
>>>>> met this requirement my making _BCL return a larger set of values for
>>>>> Windows 8 than for other OSes. However, only the values in the smaller
>>>>> set actually change the brightness at all. The rest of the values are
>>>>> silently discarded.
>>>>>
>>>>> As a workaround, change acpi_video to set all intermediate backlight
>>>>> levels when setting the brightness. This isn't perfect, but it will mean
>>>>> that most brightness changes done by common userspace utilities will hit
>>>>> at least one valid brightness value.
>>>>>
>>>>> [1] http://msdn.microsoft.com/en-us/library/windows/hardware/jj128256.aspx
>>>>>
>>>>> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
>>>>> ---
>>>>>  drivers/acpi/video.c |   51 ++++++++++++++++++++++++++++++++++++++++----------
>>>>>  1 file changed, 41 insertions(+), 10 deletions(-)
>>>>>
>>>>> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
>>>>> index edfcd74..b83fbbd 100644
>>>>> --- a/drivers/acpi/video.c
>>>>> +++ b/drivers/acpi/video.c
>>>>> @@ -352,25 +352,56 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
>>>>>  static int
>>>>>  acpi_video_device_lcd_set_state(struct acpi_video_device *device, int state)
>>>>>  {
>>>>> -	int level = device->brightness->levels[state];
>>>>>  	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
>>>>>  	struct acpi_object_list args = { 1, &arg0 };
>>>>> +	int curr_state, offset;
>>>>>  	acpi_status status;
>>>>> +	int result = 0;
>>>>>  
>>>>> -	arg0.integer.value = level;
>>>>> +	curr_state = device->brightness->curr_state;
>>>>>  
>>>>> -	status = acpi_evaluate_object(device->dev->handle, "_BCM",
>>>>> -				      &args, NULL);
>>>>> -	if (ACPI_FAILURE(status)) {
>>>>> -		ACPI_ERROR((AE_INFO, "Evaluating _BCM failed"));
>>>>> -		return -EIO;
>>>>> +	/*
>>>>> +	 * Some Lenovo firmware has a broken backlight implementation
>>>>> +	 * for Windows 8 where _BCL returns 101 backlight levels but
>>>>> +	 * only 16 or so levels actually change the brightness at all.
>>>>> +	 * As a workaround for these machines we set every intermediate
>>>>> +	 * value between the old and new brightness levels whenever the
>>>>> +	 * system has made the Windows 8 OSI call, hoping that at least
>>>>> +	 * one of them will cause a change in brightness.
>>>>> +	 */
>>>>> +	if (acpi_osi_windows_version() == ACPI_OSI_WIN_8) {
>>>>
>>>> What do you think of testing br->count > 100 instead of OSI version? It
>>>> looks like only win8 systems will try to claim so many brightness levels.
>>>
>>> I agree that it would be roughly the same set of machines today. But if
>>> we assume Microsoft will keep the same requirement in the future then it
>>> begins to expand beyond Windows 8.
>>
>> Right, and the br->count > 100 test should also work, so it seems to be
>> a better condition check than OSI version.
> 
> My take on this is that for Lenovo this is an issue of transitioning to
> Windows 8. As far as I can tell the affected machines were all sold with
> Windows 7 previously and updated for Windows 8, and the implementation
> we're seeing looks like it's just a lazy way to meet the 101 brightness
> levels requirement. If that's true then extending it past Windows 8
> doesn't make sense. Unfortunately I haven't been able to get Lenovo to
> comment on it, so right now it's just a guess.

Then perhaps use a DMI table for them?

> 
>>> If anything I'd prefer reducing the number of machines we apply this
>>> workaround to. Like say limiting it to Lenovo Win8 machines, if we can
>>> reasonably assume that Lenovo will be the only vendor with this
>>> ridiculous implementation.
>>
>> This is probably not the case. I saw a Dell system also claims to have
>> 100 levels in win8 mode:
>> https://bugzilla.kernel.org/show_bug.cgi?id=55071
> 
> For that bug it looks like even writing the !Win8 values doesn't change
> the brightness, so this workaround isn't going to help anyway.

Oh, I thought you mean 101 levels, but obviously you mean the ridiculous
implementations.

-Aaron


  reply	other threads:[~2013-04-04 14:26 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 16:21 [PATCH] ACPI: Disable Windows 8 compatibility for some Lenovo ThinkPads Seth Forshee
2013-02-11 17:52 ` Matthew Garrett
2013-02-11 19:06   ` Seth Forshee
2013-02-11 19:09     ` Matthew Garrett
2013-02-11 19:31       ` Rafael J. Wysocki
2013-02-12  3:05         ` Seth Forshee
2013-02-13 20:32       ` Seth Forshee
2013-02-13 20:55         ` Matthew Garrett
2013-02-13 21:04           ` Ben Jencks
2013-02-13 21:49             ` Seth Forshee
2013-02-13 21:46           ` Seth Forshee
2013-02-13 21:54             ` Matthew Garrett
2013-02-13 22:04               ` Seth Forshee
2013-03-07 19:38           ` Seth Forshee
2013-03-07 19:39             ` [PATCH 1/5] ACPICA: Add interface for getting latest Windows version requested via _OSI Seth Forshee
2013-03-07 19:39               ` [PATCH 2/5] acpi_video: Avoid unnecessary conversions between backlight levels and indexes Seth Forshee
2013-03-07 19:39               ` [PATCH 3/5] acpi_video: Add workaround for broken Windows 8 backlight implementations Seth Forshee
2013-04-04 11:44                 ` Aaron Lu
2013-04-04 12:35                   ` Seth Forshee
2013-04-04 13:46                     ` Aaron Lu
2013-04-04 14:02                       ` Seth Forshee
2013-04-04 14:27                         ` Aaron Lu [this message]
2013-03-07 19:39               ` [PATCH 4/5] acpi_video: Disable use of _BQC when value doesn't match those set through _BCM Seth Forshee
2013-03-07 19:39               ` [PATCH 5/5] acpi_video: Don't handle ACPI brightness notifications by default Seth Forshee
2013-08-02  5:55                 ` Aaron Lu
2013-08-02 14:41                   ` Rafael J. Wysocki
2013-08-02 14:52                     ` Aaron Lu
2013-08-03  0:26                       ` Rafael J. Wysocki
2013-08-03  9:46                         ` Aaron Lu
2013-08-03 11:23                           ` Rafael J. Wysocki
2013-08-03 12:10                             ` Aaron Lu
2013-08-03 22:07                               ` Rafael J. Wysocki
2013-08-04  1:08                                 ` Aaron Lu
2013-03-18 21:25             ` [PATCH] ACPI: Disable Windows 8 compatibility for some Lenovo ThinkPads Seth Forshee
2013-04-02  5:18               ` Ben Jencks
2013-04-02  9:15                 ` Aaron Lu
2013-04-02 11:23                   ` Matthew Garrett
2013-04-02 13:44                     ` Aaron Lu
2013-04-02 19:08                       ` Matthew Garrett
2013-04-19 12:24               ` Seth Forshee
2013-04-20 22:06                 ` Rafael J. Wysocki
2013-04-21  2:29                   ` Seth Forshee
2013-04-21 15:46                     ` Henrique de Moraes Holschuh
2013-02-13 21:09       ` Ben Jencks
2013-04-01  1:53 ` Aaron Lu
2013-04-01 13:03   ` Seth Forshee
2013-04-02  9:08     ` Aaron Lu
2013-04-02 13:00       ` Seth Forshee
2013-04-02 13:43         ` Aaron Lu
2013-04-03  7:04         ` Ben Jencks
2013-04-03  7:27           ` Aaron Lu
2013-04-03 13:45             ` Seth Forshee
2013-04-04 11:39               ` Aaron Lu
2013-04-19  3:15           ` Aaron Lu
2013-04-20 22:06             ` Rafael J. Wysocki
2013-04-21 11:07               ` Aaron Lu
2013-04-21 12:11                 ` Aaron Lu
2013-04-21 21:42                 ` Rafael J. Wysocki
2013-04-22  9:39                   ` Aaron Lu
2013-04-22 11:51                     ` Rafael J. Wysocki
2013-04-22 12:11                       ` Aaron Lu
2013-04-22 13:06                         ` Seth Forshee
2013-04-22 13:40                           ` Aaron Lu
2013-04-22 13:56                             ` Seth Forshee
2013-04-22 14:07                               ` Aaron Lu
2013-04-22 15:11                                 ` Seth Forshee
2013-04-22  2:18             ` joeyli
2013-04-22 10:08               ` Aaron Lu
2013-04-22 12:00                 ` joeyli

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=515D8DDE.3050307@gmail.com \
    --to=aaron.lwe@gmail.com \
    --cc=ben@bjencks.net \
    --cc=jlee@suse.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=rjw@sisk.pl \
    --cc=seth.forshee@canonical.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.