[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <24afd89b00bfba84d31083e6455baf1f3ad3f362.1561988282.git.nikolaus.voss@loewensteinmedical.de>
Date: Mon, 1 Jul 2019 15:42:52 +0200
From: Nikolaus Voss <nikolaus.voss@...wensteinmedical.de>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Andreas Dannenberg <dannenberg@...com>,
"Andrew F. Davis" <afd@...com>,
Kate Stewart <kstewart@...uxfoundation.org>
Cc: Nikolaus Voss <nikolaus.voss@...wensteinmedical.de>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, nv@...n.de
Subject: [PATCH v2 2/2] ASoC: tas5720.c: add ACPI enumeration support
Add ACPI IDs for tas5720 and tas5722 and use device match API
to determine the variant.
Signed-off-by: Nikolaus Voss <nikolaus.voss@...wensteinmedical.de>
---
sound/soc/codecs/tas5720.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index b2e897f094b4..e3f85926cac4 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -7,6 +7,7 @@
* Author: Andreas Dannenberg <dannenberg@...com>
*/
+#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/device.h>
@@ -631,7 +632,9 @@ static int tas5720_probe(struct i2c_client *client,
data->tas5720_client = client;
- data->variant = (const struct tas5720_variant *)id->driver_data;
+ data->variant = device_get_match_data(&client->dev);
+ if (!data->variant)
+ data->variant = (const struct tas5720_variant *)id->driver_data;
data->regmap = devm_regmap_init_i2c(client, data->variant->reg_config);
if (IS_ERR(data->regmap)) {
@@ -687,10 +690,20 @@ static const struct of_device_id tas5720_of_match[] = {
MODULE_DEVICE_TABLE(of, tas5720_of_match);
#endif
+#if IS_ENABLED(CONFIG_ACPI)
+static const struct acpi_device_id tas5720_acpi_match[] = {
+ { "10TI5720", (kernel_ulong_t)&tas5720 },
+ { "10TI5722", (kernel_ulong_t)&tas5722 },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, tas5720_acpi_match);
+#endif
+
static struct i2c_driver tas5720_i2c_driver = {
.driver = {
.name = "tas5720",
.of_match_table = of_match_ptr(tas5720_of_match),
+ .acpi_match_table = ACPI_PTR(tas5720_acpi_match),
},
.probe = tas5720_probe,
.id_table = tas5720_id,
--
2.17.1
Powered by blists - more mailing lists