[Intel-gfx] [PATCH v8 1/2] ACPI / bus: Introduce a list of ids for "always present" devices
Hans de Goede
hdegoede at redhat.com
Fri Apr 21 11:43:51 UTC 2017
Hi,
On 21-04-17 13:38, Andy Shevchenko wrote:
> On Fri, 2017-04-21 at 12:47 +0200, Hans de Goede wrote:
>> Several Bay / Cherry Trail devices (all of which ship with Windows 10)
>> hide
>> the LPSS PWM controller in ACPI, typically the _STA method looks like
>> this:
>>
>> Method (_STA, 0, NotSerialized) // _STA: Status
>> {
>> If (OSID == One)
>> {
>> Return (Zero)
>> }
>>
>> Return (0x0F)
>> }
>>
>> Where OSID is some dark magic seen in all Cherry Trail ACPI tables
>> making
>> the machine behave differently depending on which OS it *thinks* it is
>> booting, this gets set in a number of ways which we cannot control, on
>> some newer machines it simple hardcoded to "One" aka win10.
>>
>> This causes the PWM controller to get hidden, which means Linux cannot
>> control the backlight level on cht based tablets / laptops.
>>
>> Since loading the driver for this does no harm (the only in kernel
>> user
>> of it is the i915 driver, which will only uses it when it needs it),
>> this
>> commit makes acpi_bus_get_status() always set status to
>> ACPI_STA_DEFAULT
>> for the LPSS PWM device, fixing the lack of backlight control.
>>
>
>> drivers/acpi/Makefile | 1 +
>> drivers/acpi/bus.c | 5 +++
>> drivers/acpi/x86/x86_utils.c | 85
>> ++++++++++++++++++++++++++++++++++++++++++++
>
> Perhaps .../x86/utils.c ?
I thought that utils.c would be too generic,
but that was mainly thinking about module kernel
cmdline options which do not apply here, still
having a somewhat unique basename seems useful.
>
>> include/acpi/acpi_bus.h | 9 +++++
>
>> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
>> index 34fbe02..784bda6 100644
>> --- a/drivers/acpi/bus.c
>> +++ b/drivers/acpi/bus.c
>> @@ -114,6 +114,11 @@ int acpi_bus_get_status(struct acpi_device
>> *device)
>> acpi_status status;
>> unsigned long long sta;
>>
>> + if (acpi_device_always_present(device)) {
>> + acpi_set_device_status(device, ACPI_STA_DEFAULT);
>> + return 0;
>> + }
>> +
>> status = acpi_bus_get_status_handle(device->handle, &sta);
>> if (ACPI_FAILURE(status))
>> return -ENODEV;
>>
>
>> +#define ICPU(model) { X86_VENDOR_INTEL, 6, model,
>> X86_FEATURE_ANY, }
>> +
>
>> +#define ENTRY(hid, uid, cpu_models) {
>
> cpu_models -> cpu_model ?
>
> Or I missed that it's an array?
It may be an array, e.g. :
ENTRY("INT0002", "1", (ICPU(INTEL_FAM6_ATOM_SILVERMONT1), ICPU(INTEL_FAM6_ATOM_AIRMONT)) ),
Note this is a theoretical example (for now).
Regards,
Hans
More information about the Intel-gfx
mailing list