From: Dominik Brodowski <linux@dominikbrodowski.net>
To: rjw@rjwysocki.net
Cc: linux-acpi@vger.kernel.org, mario_limonciello@dell.com,
broonie@kernel.org, matthew.garrett@coreos.com,
alsa-devel@alsa-project.org,
Dominik Brodowski <linux@dominikbrodowski.net>
Subject: [PATCH 3/4] acpi: add _REV quirk for Dell XPS 13 (2015)
Date: Thu, 14 May 2015 15:31:27 +0200 [thread overview]
Message-ID: <1431610288-26737-4-git-send-email-linux@dominikbrodowski.net> (raw)
In-Reply-To: <1431610288-26737-1-git-send-email-linux@dominikbrodowski.net>
Based on what ACPI exports as is supported version (_REV), the Dell
XPS 13 (2015) configures its audio device to either work in HDA mode
or in I2S mode. As the latter only works on sufficiently new
userspace, add a quirk and an associated config option to force sound
to HDA mode.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
drivers/acpi/Kconfig | 15 +++++++++++++++
drivers/acpi/bus.c | 2 ++
drivers/acpi/internal.h | 1 +
drivers/acpi/osl.c | 42 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 16da185..76e4fa7 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -430,4 +430,19 @@ config XPOWER_PMIC_OPREGION
endif
+config ACPI_REV_OVERRIDE_DELL_XPS_13_2015
+ bool "Dell XPS 13 (2015) quirk to force HDA sound"
+ depends on X86 && SND_HDA
+ default y
+ help
+ Based on what ACPI exports as is supported version, the Dell XPS 13
+ (2015) configures its audio device to either work in HDA mode or in
+ I2S mode. As the latter only works on sufficiently new userspace,
+ this config option allows to force sound to HDA mode. To switch
+ between I2S and HDA mode, either toggle this option or pass
+ acpi.rev=2 (for HDA) / acpi.rev=5 (for I2S) on the kernel command
+ line, and perform a cold reboot _twice_.
+
+ If in doubt, say Y.
+
endif # ACPI
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index c412fdb..99c2e56 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -494,6 +494,8 @@ void __init acpi_early_init(void)
*/
dmi_check_system(dsdt_dmi_table);
+ acpi_os_quirks();
+
status = acpi_reallocate_root_table();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index ba4a61e..89566d7 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -23,6 +23,7 @@
#define PREFIX "ACPI: "
+void acpi_os_quirks(void);
acpi_status acpi_os_initialize1(void);
int init_acpi_device_notify(void);
int acpi_scan_init(void);
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index caa52f7..6f41f66 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -44,6 +44,7 @@
#include <linux/list.h>
#include <linux/jiffies.h>
#include <linux/semaphore.h>
+#include <linux/dmi.h>
#include <asm/io.h>
#include <asm/uaccess.h>
@@ -571,6 +572,47 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
return AE_OK;
}
+#ifdef CONFIG_ACPI_REV_OVERRIDE_DELL_XPS_13_2015
+static int acpi_set_supported_rev(const struct dmi_system_id *id)
+{
+ printk(KERN_NOTICE
+ "%s detected - force ACPI _REV to %lu\n",
+ id->ident, (unsigned long) id->driver_data);
+ acpi_supported_rev = (unsigned long) id->driver_data;
+ return 0;
+}
+
+static struct dmi_system_id acpi_rev_quirk_table[] __initdata = {
+ /*
+ * DELL XPS 13 (2015) switches sound between HDA and I2S
+ * depending on the ACPI _REV callback. If userspace supports
+ * I2S sufficiently (or if you do not care about sound), you
+ * can safely disable this quirk.
+ */
+ {
+ .callback = acpi_set_supported_rev,
+ .ident = "DELL XPS 13 (2015)",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343"),
+ },
+ .driver_data = (void *) 5
+ },
+ {}
+};
+#else /* !CONFIG_ACPI_REV_OVERRIDE_DELL_XPS_13_2015 */
+static struct dmi_system_id acpi_rev_quirk_table[] __initdata = {
+ {}
+};
+#endif /* CONFIG_ACPI_REV_OVERRIDE_DELL_XPS_13_2015 */
+
+void __init acpi_os_quirks(void)
+{
+ dmi_check_system(acpi_rev_quirk_table);
+ return;
+}
+
+
#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
#include <linux/earlycpio.h>
#include <linux/memblock.h>
--
2.1.4
next prev parent reply other threads:[~2015-05-14 13:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-14 13:31 [PATCH 0/4] ACPI: provide an override for _REV Dominik Brodowski
2015-05-14 13:31 ` [PATCH 1/4] acpi: use same type for acpi_predefined_names values as in definition Dominik Brodowski
2015-05-14 13:31 ` [PATCH 2/4] acpi: allow for an override to set _REV Dominik Brodowski
2015-05-14 14:18 ` Dominik Brodowski
2015-05-14 20:36 ` Rafael J. Wysocki
2015-05-14 21:55 ` Rafael J. Wysocki
2015-05-17 17:41 ` Dominik Brodowski
2015-05-18 1:01 ` Rafael J. Wysocki
2015-05-18 4:47 ` Dominik Brodowski
2015-05-21 1:24 ` Rafael J. Wysocki
2015-05-21 10:24 ` Dominik Brodowski
2015-05-22 1:11 ` Rafael J. Wysocki
2015-05-21 18:10 ` Matthew Garrett
2015-05-21 18:18 ` Mario Limonciello
2015-05-22 1:13 ` Rafael J. Wysocki
2015-05-22 21:19 ` Mario_Limonciello
2015-05-22 22:15 ` Rafael J. Wysocki
2015-06-30 20:11 ` Rafael J. Wysocki
2015-05-22 1:02 ` Rafael J. Wysocki
2015-05-14 13:31 ` Dominik Brodowski [this message]
2015-05-14 13:31 ` [PATCH 4/4] acpi: fix kernel-parameters ordering in Documentation Dominik Brodowski
2015-05-14 20:31 ` [PATCH 0/4] ACPI: provide an override for _REV Rafael J. Wysocki
2015-05-14 23:56 ` 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=1431610288-26737-4-git-send-email-linux@dominikbrodowski.net \
--to=linux@dominikbrodowski.net \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=mario_limonciello@dell.com \
--cc=matthew.garrett@coreos.com \
--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