[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230620222743.274432-2-cristian.ciocaltea@collabora.com>
Date: Wed, 21 Jun 2023 01:27:42 +0300
From: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Vijendar Mukunda <Vijendar.Mukunda@....com>,
Syed Saba Kareem <Syed.SabaKareem@....com>,
Arnd Bergmann <arnd@...db.de>,
Randy Dunlap <rdunlap@...radead.org>,
Charles Keepax <ckeepax@...nsource.cirrus.com>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
Venkata Prasad Potturu <venkataprasad.potturu@....com>
Cc: alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
kernel@...labora.com
Subject: [PATCH 1/2] ASoC: amd: vangogh: Add ACPI probe support
Remove the acp5x machine driver from pci-acp5x child devices and enable
probing via ACPI match table.
Co-developed-by: Lucas Tanure <lucas.tanure@...labora.com>
Signed-off-by: Lucas Tanure <lucas.tanure@...labora.com>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
---
sound/soc/amd/vangogh/acp5x-mach.c | 39 +++++++++---------------------
sound/soc/amd/vangogh/acp5x.h | 2 +-
sound/soc/amd/vangogh/pci-acp5x.c | 3 ---
3 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/sound/soc/amd/vangogh/acp5x-mach.c b/sound/soc/amd/vangogh/acp5x-mach.c
index e5bcd1e6eb73..1b54eadc4979 100644
--- a/sound/soc/amd/vangogh/acp5x-mach.c
+++ b/sound/soc/amd/vangogh/acp5x-mach.c
@@ -22,7 +22,6 @@
#define DRV_NAME "acp5x_mach"
#define DUAL_CHANNEL 2
-#define VG_JUPITER 1
#define ACP5X_NAU8821_BCLK 3072000
#define ACP5X_NAU8821_FREQ_OUT 12288000
#define ACP5X_NAU8821_COMP_NAME "i2c-NVTN2020:00"
@@ -31,7 +30,6 @@
#define ACP5X_CS35L41_COMP_RNAME "spi-VLV1776:01"
#define ACP5X_CS35L41_DAI_NAME "cs35l41-pcm"
-static unsigned long acp5x_machine_id;
static struct snd_soc_jack vg_headset;
SND_SOC_DAILINK_DEF(platform, DAILINK_COMP_ARRAY(COMP_PLATFORM("acp5x_i2s_dma.0")));
@@ -331,24 +329,6 @@ static struct snd_soc_card acp5x_8821_35l41_card = {
.num_controls = ARRAY_SIZE(acp5x_8821_controls),
};
-static int acp5x_vg_quirk_cb(const struct dmi_system_id *id)
-{
- acp5x_machine_id = VG_JUPITER;
-
- return 1;
-}
-
-static const struct dmi_system_id acp5x_vg_quirk_table[] = {
- {
- .callback = acp5x_vg_quirk_cb,
- .matches = {
- DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Valve"),
- DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
- }
- },
- {}
-};
-
static int acp5x_probe(struct platform_device *pdev)
{
struct acp5x_platform_info *machine;
@@ -356,18 +336,14 @@ static int acp5x_probe(struct platform_device *pdev)
struct snd_soc_card *card;
int ret;
+ card = (struct snd_soc_card *)device_get_match_data(dev);
+ if (!card)
+ return -EINVAL;
+
machine = devm_kzalloc(dev, sizeof(*machine), GFP_KERNEL);
if (!machine)
return -ENOMEM;
- dmi_check_system(acp5x_vg_quirk_table);
- switch (acp5x_machine_id) {
- case VG_JUPITER:
- card = &acp5x_8821_35l41_card;
- break;
- default:
- return -ENODEV;
- }
card->dev = dev;
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, machine);
@@ -379,10 +355,17 @@ static int acp5x_probe(struct platform_device *pdev)
return 0;
}
+static const struct acpi_device_id acp5x_acpi_match[] = {
+ { "AMDI3541", (kernel_ulong_t)&acp5x_8821_35l41_card },
+ {},
+};
+MODULE_DEVICE_TABLE(acpi, acp5x_acpi_match);
+
static struct platform_driver acp5x_mach_driver = {
.driver = {
.name = "acp5x_mach",
.pm = &snd_soc_pm_ops,
+ .acpi_match_table = acp5x_acpi_match,
},
.probe = acp5x_probe,
};
diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h
index ac1936a8c43f..2d9b182af109 100644
--- a/sound/soc/amd/vangogh/acp5x.h
+++ b/sound/soc/amd/vangogh/acp5x.h
@@ -23,7 +23,7 @@
#define ACP_ERR_INTR_MASK 0x20000000
#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF
-#define ACP5x_DEVS 4
+#define ACP5x_DEVS 3
#define ACP5x_REG_START 0x1240000
#define ACP5x_REG_END 0x1250200
#define ACP5x_I2STDM_REG_START 0x1242400
diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c
index c4634a8a17cd..ab2fcb34518f 100644
--- a/sound/soc/amd/vangogh/pci-acp5x.c
+++ b/sound/soc/amd/vangogh/pci-acp5x.c
@@ -222,9 +222,6 @@ static int snd_acp5x_probe(struct pci_dev *pci,
pdevinfo[2].num_res = 1;
pdevinfo[2].res = &adata->res[2];
- pdevinfo[3].name = "acp5x_mach";
- pdevinfo[3].id = 0;
- pdevinfo[3].parent = &pci->dev;
for (i = 0; i < ACP5x_DEVS; i++) {
adata->pdev[i] =
platform_device_register_full(&pdevinfo[i]);
--
2.41.0
Powered by blists - more mailing lists