Message ID | CADnq5_Nr8S+kzdKVq9=VL9BVK+4eFeX0egs-rkiv882MAm3bow@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jul 26, 2012 at 11:35:25AM -0400, Alex Deucher wrote: > On Thu, Jul 26, 2012 at 8:58 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: > > The other missing bit is how to actually change the brightness... Alex, > > do you know what registers to poke? > > You need to check if the GPU controls the backlight or the system > does. I think the attached patches should point you in the right > direction. Yep :) 0050: ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability : 0050: (union) ATOM_FIRMWARE_CAPABILITY sbfAccess : USHORT GPUControlsBL:1 = 0x0001 (1) The panel is using the INTERNAL_UNIPHY encoder, and I see the UNIPHYTransmitterControl command table. Interaction with video.ko is still a bit messy... Do you already have code for handling the notifications? I'll work on it in the weekend otherwise ;) Luca
On Thu, Jul 26, 2012 at 3:33 PM, Luca Tettamanti <kronos.it@gmail.com> wrote: > On Thu, Jul 26, 2012 at 11:35:25AM -0400, Alex Deucher wrote: >> On Thu, Jul 26, 2012 at 8:58 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: >> > The other missing bit is how to actually change the brightness... Alex, >> > do you know what registers to poke? >> >> You need to check if the GPU controls the backlight or the system >> does. I think the attached patches should point you in the right >> direction. > > Yep :) > > 0050: ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability : > 0050: (union) ATOM_FIRMWARE_CAPABILITY sbfAccess : > USHORT GPUControlsBL:1 = 0x0001 (1) > > The panel is using the INTERNAL_UNIPHY encoder, and I see the > UNIPHYTransmitterControl command table. > > Interaction with video.ko is still a bit messy... > > Do you already have code for handling the notifications? I'll work on it > in the weekend otherwise ;) I don't have patches for that. Please feel free to work on it :) Thanks, Alex
On Thu, Jul 26, 2012 at 3:42 PM, Alex Deucher <alexdeucher@gmail.com> wrote: > On Thu, Jul 26, 2012 at 3:33 PM, Luca Tettamanti <kronos.it@gmail.com> wrote: >> On Thu, Jul 26, 2012 at 11:35:25AM -0400, Alex Deucher wrote: >>> On Thu, Jul 26, 2012 at 8:58 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: >>> > The other missing bit is how to actually change the brightness... Alex, >>> > do you know what registers to poke? >>> >>> You need to check if the GPU controls the backlight or the system >>> does. I think the attached patches should point you in the right >>> direction. >> >> Yep :) >> >> 0050: ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability : >> 0050: (union) ATOM_FIRMWARE_CAPABILITY sbfAccess : >> USHORT GPUControlsBL:1 = 0x0001 (1) >> >> The panel is using the INTERNAL_UNIPHY encoder, and I see the >> UNIPHYTransmitterControl command table. >> >> Interaction with video.ko is still a bit messy... >> >> Do you already have code for handling the notifications? I'll work on it >> in the weekend otherwise ;) > > I don't have patches for that. Please feel free to work on it :) One thing worth checking, the sbios may write the requested backlight level to the bios scratch reg, in which case the driver only has to execute the BL_BRIGHTNESS action rather than writing the requested level to the register first. Alex > > Thanks, > > Alex
On Thu, Jul 26, 2012 at 03:42:26PM -0400, Alex Deucher wrote: > On Thu, Jul 26, 2012 at 3:33 PM, Luca Tettamanti <kronos.it@gmail.com> wrote: > > On Thu, Jul 26, 2012 at 11:35:25AM -0400, Alex Deucher wrote: > >> On Thu, Jul 26, 2012 at 8:58 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: > >> > The other missing bit is how to actually change the brightness... Alex, > >> > do you know what registers to poke? > >> > >> You need to check if the GPU controls the backlight or the system > >> does. I think the attached patches should point you in the right > >> direction. > > > > Yep :) > > > > 0050: ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability : > > 0050: (union) ATOM_FIRMWARE_CAPABILITY sbfAccess : > > USHORT GPUControlsBL:1 = 0x0001 (1) > > > > The panel is using the INTERNAL_UNIPHY encoder, and I see the > > UNIPHYTransmitterControl command table. > > > > Interaction with video.ko is still a bit messy... > > > > Do you already have code for handling the notifications? I'll work on it > > in the weekend otherwise ;) > > I don't have patches for that. Please feel free to work on it :) I just found the first problem (probably a BIOS bug): ATIF_FUNCTION_GET_SYSTEM_PARAMETERS is implemented in the DSDT, but the corresponding bit ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED is not set :( I intended to use the method to set up the notification handler but now my BIOS says that it's not there even if it is... Can I assume some default values (e.g. notifications are enabled and will use 0x81 unless ATIF_FUNCTION_GET_SYSTEM_PARAMETERS says something different)? thanks, Luca
On Sat, Jul 28, 2012 at 10:56 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: > On Thu, Jul 26, 2012 at 03:42:26PM -0400, Alex Deucher wrote: >> On Thu, Jul 26, 2012 at 3:33 PM, Luca Tettamanti <kronos.it@gmail.com> wrote: >> > On Thu, Jul 26, 2012 at 11:35:25AM -0400, Alex Deucher wrote: >> >> On Thu, Jul 26, 2012 at 8:58 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: >> >> > The other missing bit is how to actually change the brightness... Alex, >> >> > do you know what registers to poke? >> >> >> >> You need to check if the GPU controls the backlight or the system >> >> does. I think the attached patches should point you in the right >> >> direction. >> > >> > Yep :) >> > >> > 0050: ATOM_FIRMWARE_CAPABILITY_ACCESS usFirmwareCapability : >> > 0050: (union) ATOM_FIRMWARE_CAPABILITY sbfAccess : >> > USHORT GPUControlsBL:1 = 0x0001 (1) >> > >> > The panel is using the INTERNAL_UNIPHY encoder, and I see the >> > UNIPHYTransmitterControl command table. >> > >> > Interaction with video.ko is still a bit messy... >> > >> > Do you already have code for handling the notifications? I'll work on it >> > in the weekend otherwise ;) >> >> I don't have patches for that. Please feel free to work on it :) > > I just found the first problem (probably a BIOS bug): > ATIF_FUNCTION_GET_SYSTEM_PARAMETERS is implemented in the DSDT, but the > corresponding bit ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED is not set :( > I intended to use the method to set up the notification handler but now > my BIOS says that it's not there even if it is... > Can I assume some default values (e.g. notifications are enabled and will > use 0x81 unless ATIF_FUNCTION_GET_SYSTEM_PARAMETERS says something > different)? The spec says that the bits in the supported functions vector mean that if bit n is set, function n+1 exists, but it's possible that the spec is wrong and it's actually a 1 to 1 mapping; if bit n is set, function n is supported. In which case the the supported functions vector bits should be: +/* supported functions vector */ +# define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 1) +# define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 2) +# define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 3) +# define ATIF_GET_LID_STATE_SUPPORTED (1 << 4) +# define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 5) +# define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 6) +# define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 7) +# define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 8) +# define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 13) +# define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 15) See if that lines up better. I'm still new to these ACPI interfaces so I'm not an expert yet. Alex
On Sat, Jul 28, 2012 at 05:29:25PM -0400, Alex Deucher wrote: > On Sat, Jul 28, 2012 at 10:56 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: > > I just found the first problem (probably a BIOS bug): > > ATIF_FUNCTION_GET_SYSTEM_PARAMETERS is implemented in the DSDT, but the > > corresponding bit ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED is not set :( > > I intended to use the method to set up the notification handler but now > > my BIOS says that it's not there even if it is... > > Can I assume some default values (e.g. notifications are enabled and will > > use 0x81 unless ATIF_FUNCTION_GET_SYSTEM_PARAMETERS says something > > different)? > > The spec says that the bits in the supported functions vector mean > that if bit n is set, function n+1 exists, Hum, I don't follow. The vector in my case is 0x2 (1 << 1), that would mean that ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 2) is supported? Maybe if the bit n is set then functions 0..n are available? That would (almost) match what I see... > but it's possible that the > spec is wrong and it's actually a 1 to 1 mapping; if bit n is set, > function n is supported. In which case the the supported functions > vector bits should be: > +/* supported functions vector */ > +# define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 1) > +# define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 2) > +# define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 3) > +# define ATIF_GET_LID_STATE_SUPPORTED (1 << 4) > +# define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 5) > +# define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 6) > +# define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 7) > +# define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 8) > +# define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 13) > +# define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 15) > > See if that lines up better. Not really... the value returned by VERIFY_INTERFACE is 0x2, but in the DSDT I see: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS The implementation of the first one makes sense, the second is used for brightness control. The other two _might_ be a leftover (the machine does not have an analog TV out). > I'm still new to these ACPI interfaces > so I'm not an expert yet. I've been exposed to a lot of ACPI code (I wrote the asus_atk0110 driver), in my experience the DSDT is full of crap: code copied&pasted from other machines, leftover no longer used, and other stuff that's plainly wrong. Luca
On Sun, Jul 29, 2012 at 11:51:48AM +0800, joeyli wrote: > Hi Luca, > > ? ??2012-07-28 ? 16:56 +0200?Luca Tettamanti ??? > > I just found the first problem (probably a BIOS bug): > > ATIF_FUNCTION_GET_SYSTEM_PARAMETERS is implemented in the DSDT, but the > > corresponding bit ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED is not set :( > > I intended to use the method to set up the notification handler but now > > my BIOS says that it's not there even if it is... > > Can I assume some default values (e.g. notifications are enabled and will > > use 0x81 unless ATIF_FUNCTION_GET_SYSTEM_PARAMETERS says something > > different)? > > > > Did you check your DSDT for there have some "Notify (VGA, 0x81)" > statement in AFN0..AFN15? > If YES, I think that means your machine in case the 0x81 is for ATI used > by default. Yes, my point is that the nofication is there, but since GET_SYSTEM_PARAMETERS is not announced I have not way to check it. IOW, what is implemented in the DSDT does not match what is announced by VERIFY_INTERFACE. For reference this is the DSDT: http://pastebin.com/KKS7ZsTt Luca
On Mon, Jul 30, 2012 at 04:32:47PM +0800, joeyli wrote: > ? ??2012-07-29 ? 15:10 +0200?Luca Tettamanti ??? > > On Sun, Jul 29, 2012 at 11:51:48AM +0800, joeyli wrote: > > > Hi Luca, > > > > > > ? ??2012-07-28 ? 16:56 +0200?Luca Tettamanti ??? > > > > I just found the first problem (probably a BIOS bug): > > > > ATIF_FUNCTION_GET_SYSTEM_PARAMETERS is implemented in the DSDT, but the > > > > corresponding bit ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED is not set :( > > > > I intended to use the method to set up the notification handler but now > > > > my BIOS says that it's not there even if it is... > > > > Can I assume some default values (e.g. notifications are enabled and will > > > > use 0x81 unless ATIF_FUNCTION_GET_SYSTEM_PARAMETERS says something > > > > different)? > > > > > > > > > > Did you check your DSDT for there have some "Notify (VGA, 0x81)" > > > statement in AFN0..AFN15? > > > If YES, I think that means your machine in case the 0x81 is for ATI used > > > by default. > > > > Yes, my point is that the nofication is there, but since > > GET_SYSTEM_PARAMETERS is not announced I have not way to check it. > > IOW, what is implemented in the DSDT does not match what is announced by > > VERIFY_INTERFACE. > > For reference this is the DSDT: http://pastebin.com/KKS7ZsTt > > > > Luca > > > > Yes, saw the problem in your DSDT: > > Method (AF00, 0, NotSerialized) > { > CreateWordField (ATIB, Zero, SSZE) > ... > Store (0x80, NMSK) > Store (0x02, SFUN) <=== 10b, bit 0 is 0 > Return (ATIB) > } > > But, AF01 still supported in ATIF on this machine, maybe we should still > try GET_SYSTEM_PARAMETERS even the function vector set to 0? > No idea... That's what I'm doing right now... if SBIOS_REQUESTS is supported I try and call GET_SYSTEM_PARAMETERS even if it's not announced. > On the other hand, > My patch to avoid 0x81 event conflict with acpi/video driver like below. > This patch woks on my notebook. Your patches do much more things then > mine, so I think my patch just for reference. I ignored the event handling for now... I'd like to hear something back from ACPI camp before committing to this solution. > There have a problem is: > If we want use acpi_notifier_call_chain to check does event consume by > any notifier in acpi's blocking notifier chain, then we need return > NOTIFY_BAD in radeon_acpi but not NOTIFY_OK. > > So, I suggest radeon_acpi should register to acpi notifier chain by > itself but not append on radeon_acpi_event in radeon_pm. It shouldn't matter, once I change radeon_atif_handler to return NOTIFY_BAD the call chain will be stopped anyway. > And, > suggest also check the device class is ACPI_VIDEO_CLASS like following: > > +static int radeon_acpi_video_event(struct notifier_block *nb, > ... > + if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0) > + return NOTIFY_DONE; > + Will do. I'll use the package structs in the next iteration. Luca
On Sun, Jul 29, 2012 at 9:06 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: > On Sat, Jul 28, 2012 at 05:29:25PM -0400, Alex Deucher wrote: >> On Sat, Jul 28, 2012 at 10:56 AM, Luca Tettamanti <kronos.it@gmail.com> wrote: >> > I just found the first problem (probably a BIOS bug): >> > ATIF_FUNCTION_GET_SYSTEM_PARAMETERS is implemented in the DSDT, but the >> > corresponding bit ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED is not set :( >> > I intended to use the method to set up the notification handler but now >> > my BIOS says that it's not there even if it is... >> > Can I assume some default values (e.g. notifications are enabled and will >> > use 0x81 unless ATIF_FUNCTION_GET_SYSTEM_PARAMETERS says something >> > different)? >> >> The spec says that the bits in the supported functions vector mean >> that if bit n is set, function n+1 exists, > > Hum, I don't follow. The vector in my case is 0x2 (1 << 1), that would > mean that ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 2) is supported? > > Maybe if the bit n is set then functions 0..n are available? That would > (almost) match what I see... From the spec: Supported DWORD Bit vector providing supported functions information. Each bit marks Functions Bit support for one specific function of the ATIF method. Bit n, if set, Vector indicates that Function n+1 is supported. I don't know how wonky bioses in the wild are however. I can see what our internal teams do in these sort of cases. > >> but it's possible that the >> spec is wrong and it's actually a 1 to 1 mapping; if bit n is set, >> function n is supported. In which case the the supported functions >> vector bits should be: >> +/* supported functions vector */ >> +# define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 1) >> +# define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 2) >> +# define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 3) >> +# define ATIF_GET_LID_STATE_SUPPORTED (1 << 4) >> +# define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 5) >> +# define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 6) >> +# define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 7) >> +# define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 8) >> +# define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 13) >> +# define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 15) >> >> See if that lines up better. > > Not really... the value returned by VERIFY_INTERFACE is 0x2, but in the > DSDT I see: > > ATIF_FUNCTION_GET_SYSTEM_PARAMETERS > ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS > ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS > ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS > > The implementation of the first one makes sense, the second is used for > brightness control. The other two _might_ be a leftover (the machine > does not have an analog TV out). Yeah, probably unless there is a TV-out on a docking station or something like that. The TV-out port should show up in the connector table in the vbios even if it has a port on the docking station however. Alex
From a56ac560e34032ca803e0909c8a92a9037046790 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@amd.com> Date: Thu, 26 Jul 2012 09:50:57 -0400 Subject: [PATCH 1/3] drm/radeon: track whether the GPU controls the backlight A table in the vbios tells us whether the GPU backlight controller is used or not. If the bit is set, the GPU backlight controller is used; if it is not set, an off-chip backlight controller is used. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++++ drivers/gpu/drm/radeon/radeon_mode.h | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index b1e3820..92267a8 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c @@ -1254,6 +1254,10 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) if (rdev->clock.max_pixel_clock == 0) rdev->clock.max_pixel_clock = 40000; + /* not technically a clock, but... */ + if (firmware_info->info.usFirmwareCapability.sbfAccess.GPUControlsBL) + rdev->mode_info.gpu_controls_bl = true; + return true; } diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index f380d59..33cbf97 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h @@ -252,6 +252,8 @@ struct radeon_mode_info { /* pointer to fbdev info structure */ struct radeon_fbdev *rfbdev; + /* GPU controls backlight */ + bool gpu_controls_bl; }; #define MAX_H_CODE_TIMING_LEN 32 -- 1.7.7.5