linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Subject: Re: [PATCH 1/3] ACPI / X86: Allow matching always_present_id array entries by DMI
Date: Mon, 10 Jul 2017 17:25:04 +0300	[thread overview]
Message-ID: <1499696704.22624.329.camel@linux.intel.com> (raw)
In-Reply-To: <20170709190514.3437-1-hdegoede@redhat.com>

On Sun, 2017-07-09 at 21:05 +0200, Hans de Goede wrote:
> On some X86 systems the DSDT hides APCI devices to work around Windows
> driver bugs. On one such system the device is even hidden until a
> certain
> time after _SB.PCI0.GFX0.LCD.LCD1._ON gets called has passed *and*
> _STA has been called at least 3 times since. TL;DR: it is a mess.
> 
> Until now the always_present_id matching was used to force status
> for a whole class of devices, e.g. always enable PWM1 on CHerry Trail

Cherry

> devices.
> 
> This commit extends the always_present_id matching code to optionally
> als check for a DMI match so that we can also add system specific
> quirks to the always_present_id array.
> 

I got answers to my questions (see thread), thus, FWIW,

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/acpi/x86/utils.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c
> index bd86b809c848..b0e16516adfd 100644
> --- a/drivers/acpi/x86/utils.c
> +++ b/drivers/acpi/x86/utils.c
> @@ -12,6 +12,7 @@
>   */
>  
>  #include <linux/acpi.h>
> +#include <linux/dmi.h>
>  #include <asm/cpu_device_id.h>
>  #include <asm/intel-family.h>
>  #include "../internal.h"
> @@ -20,6 +21,10 @@
>   * Some ACPI devices are hidden (status == 0x0) in recent BIOS-es
> because
>   * some recent Windows drivers bind to one device but poke at
> multiple
>   * devices at the same time, so the others get hidden.
> + *
> + * Some BIOS-es (temporarily) hide specific APCI devices to work
> around Windows
> + * driver bugs. We use DMI matching to match known cases of this.
> + *
>   * We work around this by always reporting ACPI_STA_DEFAULT for these
>   * devices. Note this MUST only be done for devices where this is
> safe.
>   *
> @@ -31,14 +36,16 @@
>  struct always_present_id {
>  	struct acpi_device_id hid[2];
>  	struct x86_cpu_id cpu_ids[2];
> +	struct dmi_system_id dmi_ids[2]; /* Optional */
>  	const char *uid;
>  };
>  
>  #define ICPU(model)	{ X86_VENDOR_INTEL, 6, model,
> X86_FEATURE_ANY, }
>  
> -#define ENTRY(hid, uid, cpu_models) {					
> \
> +#define ENTRY(hid, uid, cpu_models, dmi...) {				
> \
>  	{ { hid, }, {} },						
> \
>  	{ cpu_models, {} },						
> \
> +	{ { .matches = dmi }, {} },					
> \
>  	uid,								
> \
>  }
>  
> @@ -47,13 +54,13 @@ static const struct always_present_id
> always_present_ids[] = {
>  	 * Bay / Cherry Trail PWM directly poked by GPU driver in
> win10,
>  	 * but Linux uses a separate PWM driver, harmless if not
> used.
>  	 */
> -	ENTRY("80860F09", "1", ICPU(INTEL_FAM6_ATOM_SILVERMONT1)),
> -	ENTRY("80862288", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT)),
> +	ENTRY("80860F09", "1", ICPU(INTEL_FAM6_ATOM_SILVERMONT1),
> {}),
> +	ENTRY("80862288", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT), {}),
>  	/*
>  	 * The INT0002 device is necessary to clear wakeup interrupt
> sources
>  	 * on Cherry Trail devices, without it we get nobody cared
> IRQ msgs.
>  	 */
> -	ENTRY("INT0002", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT)),
> +	ENTRY("INT0002", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT), {}),
>  };
>  
>  bool acpi_device_always_present(struct acpi_device *adev)
> @@ -76,6 +83,10 @@ bool acpi_device_always_present(struct acpi_device
> *adev)
>  		if (!x86_match_cpu(always_present_ids[i].cpu_ids))
>  			continue;
>  
> +		if (always_present_ids[i].dmi_ids[0].matches[0].slot
> &&
> +		    !dmi_check_system(always_present_ids[i].dmi_ids))
> +			continue;
> +
>  		if (old_status != ACPI_STA_DEFAULT) /* Log only once
> */
>  			dev_info(&adev->dev,
>  				 "Device [%s] is in always present
> list\n",

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  parent reply	other threads:[~2017-07-10 14:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09 19:05 [PATCH 1/3] ACPI / X86: Allow matching always_present_id array entries by DMI Hans de Goede
2017-07-09 19:05 ` [PATCH 2/3] ACPI / X86: Add Dell Venue 11 Pro 7130 touchscreen to always_present_ids Hans de Goede
2017-07-09 19:05 ` [PATCH 3/3] ACPI / X86: Add KIOX000A accelerometer on GPD win to always_present_ids array Hans de Goede
2017-07-10 10:22   ` Andy Shevchenko
2017-07-10 10:25     ` Hans de Goede
2017-07-10 10:29       ` Andy Shevchenko
2017-07-10 10:35         ` Hans de Goede
2017-07-10 14:25 ` Andy Shevchenko [this message]
2017-07-10 18:13   ` [PATCH 1/3] ACPI / X86: Allow matching always_present_id array entries by DMI Hans de Goede
2017-07-10 18:39     ` Andy Shevchenko
2017-07-12 21:22       ` Rafael J. Wysocki

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=1499696704.22624.329.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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).