* [PATCH] acpi/video: lcd_get_level_current doen't return current level @ 2013-03-30 13:01 Artem Savkov 2013-03-31 1:56 ` Rafael J. Wysocki 2013-03-31 6:15 ` Danny Baumann 0 siblings, 2 replies; 8+ messages in thread From: Artem Savkov @ 2013-03-30 13:01 UTC (permalink / raw) To: dannybaumann Cc: aaron.lu, rafael.j.wysocki, linux-acpi, linux-kernel, Artem Savkov acpi_video_device_lcd_get_level_current() called acpi_video_bqc_value_to_level() with "*level" as a second argument, resulting in level being returned based on initial input, not current brightness, breaking backlight controls. Signed-off-by: Artem Savkov <artem.savkov@gmail.com> --- drivers/acpi/video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 3cdd047..68a777b 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -505,7 +505,8 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, return 0; } - *level = acpi_video_bqc_value_to_level(device, *level); + *level = acpi_video_bqc_value_to_level(device, + device->brightness->curr); for (i = 2; i < device->brightness->count; i++) if (device->brightness->levels[i] == *level) { -- 1.8.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] acpi/video: lcd_get_level_current doen't return current level 2013-03-30 13:01 [PATCH] acpi/video: lcd_get_level_current doen't return current level Artem Savkov @ 2013-03-31 1:56 ` Rafael J. Wysocki 2013-03-31 6:15 ` Danny Baumann 1 sibling, 0 replies; 8+ messages in thread From: Rafael J. Wysocki @ 2013-03-31 1:56 UTC (permalink / raw) To: Artem Savkov Cc: dannybaumann, aaron.lu, rafael.j.wysocki, linux-acpi, linux-kernel On Saturday, March 30, 2013 05:01:41 PM Artem Savkov wrote: > acpi_video_device_lcd_get_level_current() called acpi_video_bqc_value_to_level() > with "*level" as a second argument, resulting in level being returned based on > initial input, not current brightness, breaking backlight controls. This looks like a valid fix, but (1) is the problem being fixed a regression and if so, which was the last working kernel and (2) do you have any pointers to bug reports/BZ entries related to that? Also, do I assume correctly that you've tested it? Rafael > Signed-off-by: Artem Savkov <artem.savkov@gmail.com> > --- > drivers/acpi/video.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c > index 3cdd047..68a777b 100644 > --- a/drivers/acpi/video.c > +++ b/drivers/acpi/video.c > @@ -505,7 +505,8 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, > return 0; > } > > - *level = acpi_video_bqc_value_to_level(device, *level); > + *level = acpi_video_bqc_value_to_level(device, > + device->brightness->curr); > > for (i = 2; i < device->brightness->count; i++) > if (device->brightness->levels[i] == *level) { > -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] acpi/video: lcd_get_level_current doen't return current level 2013-03-30 13:01 [PATCH] acpi/video: lcd_get_level_current doen't return current level Artem Savkov 2013-03-31 1:56 ` Rafael J. Wysocki @ 2013-03-31 6:15 ` Danny Baumann 2013-03-31 6:46 ` Artem Savkov 1 sibling, 1 reply; 8+ messages in thread From: Danny Baumann @ 2013-03-31 6:15 UTC (permalink / raw) To: Artem Savkov; +Cc: aaron.lu, rafael.j.wysocki, linux-acpi, linux-kernel Artem Savkov <artem.savkov@gmail.com> schrieb: >acpi_video_device_lcd_get_level_current() called >acpi_video_bqc_value_to_level() >with "*level" as a second argument, resulting in level being returned >based on >initial input, not current brightness, breaking backlight controls. I don't think this change is correct. As level was passed as parameter into the evaluation of _BQC, *level contains the AML returned brightness level afterwards, so it's correct to use it as an input to acpi_video_bqc_value_to_level(). Actually, the whole point of acpi_video_device_lcd_get_level_current() is to update device->brightness->curr, so it doesn't make sense to me to use it in that function. What's the exact problem this patch tries to solve? Regards, Danny Hi, ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] acpi/video: lcd_get_level_current doen't return current level 2013-03-31 6:15 ` Danny Baumann @ 2013-03-31 6:46 ` Artem Savkov 2013-03-31 7:04 ` Danny Baumann 0 siblings, 1 reply; 8+ messages in thread From: Artem Savkov @ 2013-03-31 6:46 UTC (permalink / raw) To: Danny Baumann; +Cc: aaron.lu, rafael.j.wysocki, linux-acpi, linux-kernel On Sun, Mar 31, 2013 at 08:15:14AM +0200, Danny Baumann wrote: > Artem Savkov <artem.savkov@gmail.com> schrieb: > >acpi_video_device_lcd_get_level_current() called > >acpi_video_bqc_value_to_level() > >with "*level" as a second argument, resulting in level being returned > >based on > >initial input, not current brightness, breaking backlight controls. > I don't think this change is correct. As level was passed as parameter into the evaluation of _BQC, *level contains the AML returned brightness level afterwards, so it's correct to use it as an input to acpi_video_bqc_value_to_level(). Actually, the whole point of acpi_video_device_lcd_get_level_current() is to update device->brightness->curr, so it doesn't make sense to me to use it in that function. > > What's the exact problem this patch tries to solve? I'm running a -next kernel on my laptop and couple of days ago keyboard backlight controls stopped working: only 2 lower brightness levels. I've debugged it a bit and found out that acpi_video_switch_brightness() calls acpi_video_device_lcd_get_level_current() with level uninitialized and always gets lowest posible value. -- Regards, Artem ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] acpi/video: lcd_get_level_current doen't return current level 2013-03-31 6:46 ` Artem Savkov @ 2013-03-31 7:04 ` Danny Baumann 2013-03-31 8:16 ` Artem Savkov 0 siblings, 1 reply; 8+ messages in thread From: Danny Baumann @ 2013-03-31 7:04 UTC (permalink / raw) To: Artem Savkov; +Cc: aaron.lu, rafael.j.wysocki, linux-acpi, linux-kernel Hi, Artem Savkov <artem.savkov@gmail.com> schrieb: >On Sun, Mar 31, 2013 at 08:15:14AM +0200, Danny Baumann wrote: >> Artem Savkov <artem.savkov@gmail.com> schrieb: >> >acpi_video_device_lcd_get_level_current() called >> >acpi_video_bqc_value_to_level() >> >with "*level" as a second argument, resulting in level being >returned >> >based on >> >initial input, not current brightness, breaking backlight controls. >> I don't think this change is correct. As level was passed as >parameter into the evaluation of _BQC, *level contains the AML returned >brightness level afterwards, so it's correct to use it as an input to >acpi_video_bqc_value_to_level(). Actually, the whole point of >acpi_video_device_lcd_get_level_current() is to update >device->brightness->curr, so it doesn't make sense to me to use it in >that function. >> >> What's the exact problem this patch tries to solve? > >I'm running a -next kernel on my laptop and couple of days ago keyboard >backlight controls stopped working: only 2 lower brightness levels. >I've >debugged it a bit and found out that acpi_video_switch_brightness() >calls >acpi_video_device_lcd_get_level_current() with level uninitialized and >always gets lowest posible value. The point is: after the acpi_evaluate_object call, *level must contain the current brightness level, otherwise your BIOS is broken (this happens: e.g. my laptop always returns 100 from _BQC in Windows 8 mode). You can verify this easily by initializing level_current to some invalid value and checking it again after the call to _get_level_current. I'd be pretty surprised if the value didn't change. Also, if you look at [1], you'll see that the code operated on *level before as well. This problem may have been obscured by the fact that the brightness device wasn't initialized properly before my patches went in. Does acpi_video_switch_brightness actually do anything for you when reverting the 3 newest commits of video.c? Regards, Danny [1] https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/drivers/acpi/video.c?h=linux-next&id=994fa63c5b126df6e9f31ef4e09000e2e243234b ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] acpi/video: lcd_get_level_current doen't return current level 2013-03-31 7:04 ` Danny Baumann @ 2013-03-31 8:16 ` Artem Savkov 2013-03-31 10:07 ` Aaron Lu 0 siblings, 1 reply; 8+ messages in thread From: Artem Savkov @ 2013-03-31 8:16 UTC (permalink / raw) To: Danny Baumann; +Cc: aaron.lu, rafael.j.wysocki, linux-acpi, linux-kernel On Sun, Mar 31, 2013 at 09:04:21AM +0200, Danny Baumann wrote: > Hi, > > Artem Savkov <artem.savkov@gmail.com> schrieb: > > >On Sun, Mar 31, 2013 at 08:15:14AM +0200, Danny Baumann wrote: > >> Artem Savkov <artem.savkov@gmail.com> schrieb: > >> >acpi_video_device_lcd_get_level_current() called > >> >acpi_video_bqc_value_to_level() > >> >with "*level" as a second argument, resulting in level being > >returned > >> >based on > >> >initial input, not current brightness, breaking backlight controls. > >> I don't think this change is correct. As level was passed as > >parameter into the evaluation of _BQC, *level contains the AML returned > >brightness level afterwards, so it's correct to use it as an input to > >acpi_video_bqc_value_to_level(). Actually, the whole point of > >acpi_video_device_lcd_get_level_current() is to update > >device->brightness->curr, so it doesn't make sense to me to use it in > >that function. > >> > >> What's the exact problem this patch tries to solve? > > > >I'm running a -next kernel on my laptop and couple of days ago keyboard > >backlight controls stopped working: only 2 lower brightness levels. > >I've > >debugged it a bit and found out that acpi_video_switch_brightness() > >calls > >acpi_video_device_lcd_get_level_current() with level uninitialized and > >always gets lowest posible value. > > The point is: after the acpi_evaluate_object call, *level must contain the current brightness level, otherwise your BIOS is broken (this happens: e.g. my laptop always returns 100 from _BQC in Windows 8 mode). You can verify this easily by initializing level_current to some invalid value and checking it again after the call to _get_level_current. I'd be pretty surprised if the value didn't change. Also, if you look at [1], you'll see that the code operated on *level before as well. > This problem may have been obscured by the fact that the brightness device wasn't initialized properly before my patches went in. Does acpi_video_switch_brightness actually do anything for you when reverting the 3 newest commits of video.c? Yes, you are right. Both my patch and the version before your patches result in initial acpi_video_device_lcd_get_level_current call ending with invalid level being returned and bqc disabled, so they both just use *level = brightness->curr after that. -- Regards, Artem ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] acpi/video: lcd_get_level_current doen't return current level 2013-03-31 8:16 ` Artem Savkov @ 2013-03-31 10:07 ` Aaron Lu 2013-03-31 10:37 ` Artem Savkov 0 siblings, 1 reply; 8+ messages in thread From: Aaron Lu @ 2013-03-31 10:07 UTC (permalink / raw) To: Artem Savkov; +Cc: Danny Baumann, Rafael J. Wysocki, linux-acpi, linux-kernel On 03/31/2013 04:16 PM, Artem Savkov wrote: > On Sun, Mar 31, 2013 at 09:04:21AM +0200, Danny Baumann wrote: >> Hi, >> >> Artem Savkov <artem.savkov@gmail.com> schrieb: >> >>> On Sun, Mar 31, 2013 at 08:15:14AM +0200, Danny Baumann wrote: >>>> Artem Savkov <artem.savkov@gmail.com> schrieb: >>>>> acpi_video_device_lcd_get_level_current() called >>>>> acpi_video_bqc_value_to_level() >>>>> with "*level" as a second argument, resulting in level being >>> returned >>>>> based on >>>>> initial input, not current brightness, breaking backlight controls. >>>> I don't think this change is correct. As level was passed as >>> parameter into the evaluation of _BQC, *level contains the AML returned >>> brightness level afterwards, so it's correct to use it as an input to >>> acpi_video_bqc_value_to_level(). Actually, the whole point of >>> acpi_video_device_lcd_get_level_current() is to update >>> device->brightness->curr, so it doesn't make sense to me to use it in >>> that function. >>>> >>>> What's the exact problem this patch tries to solve? >>> >>> I'm running a -next kernel on my laptop and couple of days ago keyboard >>> backlight controls stopped working: only 2 lower brightness levels. >>> I've >>> debugged it a bit and found out that acpi_video_switch_brightness() >>> calls >>> acpi_video_device_lcd_get_level_current() with level uninitialized and >>> always gets lowest posible value. >> >> The point is: after the acpi_evaluate_object call, *level must contain the current brightness level, otherwise your BIOS is broken (this happens: e.g. my laptop always returns 100 from _BQC in Windows 8 mode). You can verify this easily by initializing level_current to some invalid value and checking it again after the call to _get_level_current. I'd be pretty surprised if the value didn't change. Also, if you look at [1], you'll see that the code operated on *level before as well. >> This problem may have been obscured by the fact that the brightness device wasn't initialized properly before my patches went in. Does acpi_video_switch_brightness actually do anything for you when reverting the 3 newest commits of video.c? > > Yes, you are right. Both my patch and the version before your patches > result in initial acpi_video_device_lcd_get_level_current call ending > with invalid level being returned and bqc disabled, so they both just > use *level = brightness->curr after that. > OK, this suggests the _BQC control method of your system is broken. Please kindly file a bug in bugzilla.kernel.org, against ACPI/Power-Video and attach the output of acpidump and dmidecode there, I want to take a look, thanks. -Aaron ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] acpi/video: lcd_get_level_current doen't return current level 2013-03-31 10:07 ` Aaron Lu @ 2013-03-31 10:37 ` Artem Savkov 0 siblings, 0 replies; 8+ messages in thread From: Artem Savkov @ 2013-03-31 10:37 UTC (permalink / raw) To: Aaron Lu; +Cc: Danny Baumann, Rafael J. Wysocki, linux-acpi, linux-kernel On Sun, Mar 31, 2013 at 06:07:57PM +0800, Aaron Lu wrote: > On 03/31/2013 04:16 PM, Artem Savkov wrote: > >On Sun, Mar 31, 2013 at 09:04:21AM +0200, Danny Baumann wrote: > >>Hi, > >> > >>Artem Savkov <artem.savkov@gmail.com> schrieb: > >> > >>>On Sun, Mar 31, 2013 at 08:15:14AM +0200, Danny Baumann wrote: > >>>>Artem Savkov <artem.savkov@gmail.com> schrieb: > >>>>>acpi_video_device_lcd_get_level_current() called > >>>>>acpi_video_bqc_value_to_level() > >>>>>with "*level" as a second argument, resulting in level being > >>>returned > >>>>>based on > >>>>>initial input, not current brightness, breaking backlight controls. > >>>>I don't think this change is correct. As level was passed as > >>>parameter into the evaluation of _BQC, *level contains the AML returned > >>>brightness level afterwards, so it's correct to use it as an input to > >>>acpi_video_bqc_value_to_level(). Actually, the whole point of > >>>acpi_video_device_lcd_get_level_current() is to update > >>>device->brightness->curr, so it doesn't make sense to me to use it in > >>>that function. > >>>> > >>>>What's the exact problem this patch tries to solve? > >>> > >>>I'm running a -next kernel on my laptop and couple of days ago keyboard > >>>backlight controls stopped working: only 2 lower brightness levels. > >>>I've > >>>debugged it a bit and found out that acpi_video_switch_brightness() > >>>calls > >>>acpi_video_device_lcd_get_level_current() with level uninitialized and > >>>always gets lowest posible value. > >> > >>The point is: after the acpi_evaluate_object call, *level must contain the current brightness level, otherwise your BIOS is broken (this happens: e.g. my laptop always returns 100 from _BQC in Windows 8 mode). You can verify this easily by initializing level_current to some invalid value and checking it again after the call to _get_level_current. I'd be pretty surprised if the value didn't change. Also, if you look at [1], you'll see that the code operated on *level before as well. > >>This problem may have been obscured by the fact that the brightness device wasn't initialized properly before my patches went in. Does acpi_video_switch_brightness actually do anything for you when reverting the 3 newest commits of video.c? > > > >Yes, you are right. Both my patch and the version before your patches > >result in initial acpi_video_device_lcd_get_level_current call ending > >with invalid level being returned and bqc disabled, so they both just > >use *level = brightness->curr after that. > > > > OK, this suggests the _BQC control method of your system is broken. > Please kindly file a bug in bugzilla.kernel.org, against > ACPI/Power-Video and attach the output of acpidump and dmidecode there, > I want to take a look, thanks. > > -Aaron > Submitted: https://bugzilla.kernel.org/show_bug.cgi?id=56011 -- Regards, Artem ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-03-31 10:37 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-03-30 13:01 [PATCH] acpi/video: lcd_get_level_current doen't return current level Artem Savkov 2013-03-31 1:56 ` Rafael J. Wysocki 2013-03-31 6:15 ` Danny Baumann 2013-03-31 6:46 ` Artem Savkov 2013-03-31 7:04 ` Danny Baumann 2013-03-31 8:16 ` Artem Savkov 2013-03-31 10:07 ` Aaron Lu 2013-03-31 10:37 ` Artem Savkov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox