Commit c0bde003 authored by Sameer Pujar's avatar Sameer Pujar Committed by Takashi Iwai

ALSA: hda/tegra: sound card name from device tree

A platform can have multiple sound cards for different audio paths.
Following is the print seen duirng device boot for jetson-xavier,
  ALSA device list:
    #0: nvidia,p2972-0000 at 0x3518000 irq 17
By looking at above, it is not very clear if the sound card is for
HDA. It becomes confusing when platform has registered multiple cards,
and platform model name is used for card.

This patch uses "nvidia,model" property mentioned in hda device tree
to get the card name. Since property is optional, legacy boards will
continue to use "tegra-hda". Custom name can be passed wherever needed.
This naming convention is conistent with the way sound cards are named
in general.
Signed-off-by: default avatarSameer Pujar <spujar@nvidia.com>
Reviewed-by: default avatarJonathan Hunter <jonathanh@nvidia.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 11ce4308
...@@ -380,8 +380,8 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) ...@@ -380,8 +380,8 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
int err; int err;
unsigned short gcap; unsigned short gcap;
int irq_id = platform_get_irq(pdev, 0); int irq_id = platform_get_irq(pdev, 0);
const char *sname; const char *sname, *drv_name = "tegra-hda";
struct device_node *root; struct device_node *np = pdev->dev.of_node;
err = hda_tegra_init_chip(chip, pdev); err = hda_tegra_init_chip(chip, pdev);
if (err) if (err)
...@@ -440,17 +440,11 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) ...@@ -440,17 +440,11 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
} }
/* driver name */ /* driver name */
strcpy(card->driver, "tegra-hda"); strncpy(card->driver, drv_name, sizeof(card->driver));
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 */ /* shortname for card */
sname = of_get_property(np, "nvidia,model", NULL);
if (!sname)
sname = drv_name;
if (strlen(sname) > sizeof(card->shortname)) if (strlen(sname) > sizeof(card->shortname))
dev_info(card->dev, "truncating shortname for card\n"); dev_info(card->dev, "truncating shortname for card\n");
strncpy(card->shortname, sname, sizeof(card->shortname)); strncpy(card->shortname, sname, sizeof(card->shortname));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment