linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Aaron Lu <aaron.lu@intel.com>, "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Zhang Rui <rui.zhang@intel.com>, linux-acpi@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] acpi: video: Allow forcing native backlight on non win8 machines
Date: Tue, 03 Mar 2015 14:11:28 +0100	[thread overview]
Message-ID: <54F5B300.7020904@redhat.com> (raw)
In-Reply-To: <54F57018.7000302@intel.com>

Hi,

On 03-03-15 09:26, Aaron Lu wrote:
> On 03/03/2015 03:39 PM, Hans de Goede wrote:
>> The native backlight behavior (so not registering both the acpi-video and the
>> vendor backlight driver) can be useful on some non win8 machines too, allow
>> the user to force this behavior by passing video.use_native_backlight=2
>> on the kernel commandline.
>
> Just bikeshedding, what about doing it this way?
>
> In the acpi_video_use_native_backlight function:
> 1 If user has set a cmdline option, use that(no matter if it is a win8
>    system or not);
> 2 If the system is in a DMI table, use that(no matter if it is a win8
>    system or not);
> 3 return true if this is a win8 system; false otherwise.
>
> Something like this:

That works for me, and has the added advantage of not changing the
cmdline syntax (but it does change the cmdline behavior ...).

So going either way is fine with me.

Aaron's version is:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans

>
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index debd30917010..4cd0c8a4fd9d 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
>    */
>   static int use_native_backlight_param = -1;
>   module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
> -static bool use_native_backlight_dmi = true;
> +static int use_native_backlight_dmi = -1;
>
>   static int register_count;
>   static struct mutex video_list_lock;
> @@ -239,13 +239,14 @@ static bool acpi_video_use_native_backlight(void)
>   {
>   	if (use_native_backlight_param != -1)
>   		return use_native_backlight_param;
> -	else
> +	else if (use_native_backlight_dmi != -1)
>   		return use_native_backlight_dmi;
> +	return acpi_osi_is_win8();
>   }
>
>   bool acpi_video_verify_backlight_support(void)
>   {
> -	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
> +	if (acpi_video_use_native_backlight() &&
>   	    backlight_device_registered(BACKLIGHT_RAW))
>   		return false;
>   	return acpi_video_backlight_support();
> @@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
>
>   static int __init video_disable_native_backlight(const struct dmi_system_id *d)
>   {
> -	use_native_backlight_dmi = false;
> +	use_native_backlight_dmi = 0;
>   	return 0;
>   }
>
>
> Regards,
> Aaron
>
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/acpi/video.c | 9 +++++----
>>   1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
>> index debd309..9817b52 100644
>> --- a/drivers/acpi/video.c
>> +++ b/drivers/acpi/video.c
>> @@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
>>    */
>>   static int use_native_backlight_param = -1;
>>   module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
>> -static bool use_native_backlight_dmi = true;
>> +static int use_native_backlight_dmi = 1;
>>
>>   static int register_count;
>>   static struct mutex video_list_lock;
>> @@ -235,7 +235,7 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
>>   				     u32 level_current, u32 event);
>>   static void acpi_video_switch_brightness(struct work_struct *work);
>>
>> -static bool acpi_video_use_native_backlight(void)
>> +static int acpi_video_use_native_backlight(void)
>>   {
>>   	if (use_native_backlight_param != -1)
>>   		return use_native_backlight_param;
>> @@ -245,7 +245,8 @@ static bool acpi_video_use_native_backlight(void)
>>
>>   bool acpi_video_verify_backlight_support(void)
>>   {
>> -	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
>> +	if (((acpi_video_use_native_backlight() == 2) ||
>> +	     (acpi_video_use_native_backlight() == 1 && acpi_osi_is_win8())) &&
>>   	    backlight_device_registered(BACKLIGHT_RAW))
>>   		return false;
>>   	return acpi_video_backlight_support();
>> @@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
>>
>>   static int __init video_disable_native_backlight(const struct dmi_system_id *d)
>>   {
>> -	use_native_backlight_dmi = false;
>> +	use_native_backlight_dmi = 0;
>>   	return 0;
>>   }
>>
>>
>

  reply	other threads:[~2015-03-03 13:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03  7:39 [RFC PATCH 0/2] acpi: video: Allow forcing native backlight on non win8 laptops Hans de Goede
2015-03-03  7:39 ` [RFC PATCH 1/2] acpi: video: Allow forcing native backlight on non win8 machines Hans de Goede
2015-03-03  8:26   ` Aaron Lu
2015-03-03 13:11     ` Hans de Goede [this message]
2015-03-04  2:50       ` Aaron Lu
2015-03-10 22:25         ` Rafael J. Wysocki
2015-03-10 22:42           ` Hans de Goede
2015-03-10 23:10             ` Rafael J. Wysocki
2015-03-11  6:14               ` [PATCH update] acpi: video: Allow forcing native backlight on non win8, machines Aaron Lu
2015-03-11 11:14                 ` Hans de Goede
2015-03-11 13:05                   ` Aaron Lu
2015-03-12 22:40                     ` Rafael J. Wysocki
2015-03-03  7:39 ` [RFC PATCH 2/2] acpi: video: Add force native backlight quirk for Lenovo Ideapad Z570 Hans de Goede
2015-03-10 22:26   ` Rafael J. Wysocki
2015-03-10 22:44     ` Hans de Goede
2015-03-03  8:25 ` [RFC PATCH 0/2] acpi: video: Allow forcing native backlight on non win8 laptops Aaron Lu

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=54F5B300.7020904@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=aaron.lu@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.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;
as well as URLs for NNTP newsgroup(s).