From c94800a3952c71191c3a8a7151695216da43d5eb Mon Sep 17 00:00:00 2001 From: Sameer Pujar Date: Thu, 29 Nov 2018 09:28:52 +0530 Subject: ALSA: hda/tegra: compatible string as shortname By default HDA sound card is registered with shortname "tegra-hda". Same driver is used across tegra platforms and it is necessary to distinguish between platforms to use platform specific settings from userspace. One such example is, hdmi port on different platforms use different alsa pcm device ID. For hdmi playback to work it should open correct pcm device depending on the platform. This patch applies shortname from first compatible string provided in root node of device tree. Userspace then can use this card name to apply specific settings. Signed-off-by: Sameer Pujar Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_tegra.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'sound/pci/hda/hda_tegra.c') diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index dd7d4242d6d2..84ea6069d28b 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -344,6 +345,8 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) int err; unsigned short gcap; int irq_id = platform_get_irq(pdev, 0); + const char *sname; + struct device_node *root; err = hda_tegra_init_chip(chip, pdev); if (err) @@ -401,8 +404,23 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) return -ENODEV; } + /* driver name */ strcpy(card->driver, "tegra-hda"); - strcpy(card->shortname, "tegra-hda"); + + root = of_find_node_by_path("/"); + sname = of_get_property(root, "compatible", NULL); + of_node_put(root); + if (!sname) { + dev_err(card->dev, + "failed to get compatible property from root node\n"); + return -ENODEV; + } + /* shortname for card */ + if (strlen(sname) > sizeof(card->shortname)) + dev_info(card->dev, "truncating shortname for card\n"); + strncpy(card->shortname, sname, sizeof(card->shortname)); + + /* longname for card */ snprintf(card->longname, sizeof(card->longname), "%s at 0x%lx irq %i", card->shortname, bus->addr, bus->irq); -- cgit v1.2.3-59-g8ed1b From 350355e339312d6ac048086a4c5f6d0ea0bf915f Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Mon, 3 Dec 2018 16:53:16 +0100 Subject: ALSA: hda/tegra - Probe up to 8 codecs Recent devices support more than the 4 codecs that the AZX core will probe by default. Probe up to 8 codecs to make sure all of them are enumerated. Suggested-by: Sameer Pujar Signed-off-by: Thierry Reding Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci/hda/hda_tegra.c') diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 84ea6069d28b..83befd8d43e8 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -531,7 +531,7 @@ static void hda_tegra_probe_work(struct work_struct *work) goto out_free; /* create codec instances */ - err = azx_probe_codecs(chip, 0); + err = azx_probe_codecs(chip, 8); if (err < 0) goto out_free; -- cgit v1.2.3-59-g8ed1b