linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ALSA: hda/tegra: property for card name
@ 2019-02-20 15:13 Sameer Pujar
  2019-02-20 15:13 ` [PATCH 2/3] arm64: tegra: custom name for hda sound card Sameer Pujar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sameer Pujar @ 2019-02-20 15:13 UTC (permalink / raw)
  To: tiwai, perex, robh+dt, mark.rutland
  Cc: thierry.reding, jonathanh, alsa-devel, devicetree, linux-tegra,
	linux-kernel, Sameer Pujar

An optional property "nvidia,model" is introduced for hda to pass custom
name for the sound card. The suffix "-hda" in the name passed is useful
to distinguish between multiple cards available for a platform.
When the property is not specified, default name("tegra-hda") mentioned
in hda driver is used. This property can be added in platform specific
file of the board and card name can relate to the board in use.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
---
 Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt
index 44d2745..21cd310 100644
--- a/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt
+++ b/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt
@@ -13,6 +13,10 @@ Required properties:
   See ../reset/reset.txt for details.
 - reset-names : Must include the following entries: hda, hda2hdmi, hda2codec_2x
 
+Optional properties:
+- nvidia,model : The user-visible name of this sound complex. Since the property
+  is optional, legacy boards can use default name provided in hda driver.
+
 Example:
 
 hda@70030000 {
@@ -27,4 +31,5 @@ hda@70030000 {
 		 <&tegra_car 128>, /* hda2hdmi */
 		 <&tegra_car 111>; /* hda2codec_2x */
 	reset-names = "hda", "hda2hdmi", "hda2codec_2x";
+	nvidia,model = "jetson-tk1-hda";
 };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] arm64: tegra: custom name for hda sound card
  2019-02-20 15:13 [PATCH 1/3] ALSA: hda/tegra: property for card name Sameer Pujar
@ 2019-02-20 15:13 ` Sameer Pujar
  2019-02-22  9:47   ` Takashi Iwai
  2019-02-20 15:13 ` [PATCH 3/3] ALSA: hda/tegra: sound card name from device tree Sameer Pujar
  2019-02-22  9:46 ` [PATCH 1/3] ALSA: hda/tegra: property for card name Takashi Iwai
  2 siblings, 1 reply; 6+ messages in thread
From: Sameer Pujar @ 2019-02-20 15:13 UTC (permalink / raw)
  To: tiwai, perex, robh+dt, mark.rutland
  Cc: thierry.reding, jonathanh, alsa-devel, devicetree, linux-tegra,
	linux-kernel, Sameer Pujar

"nvidia,model" property is added to pass custom name for hda sound card.
This is parsed in hda driver and used for card name. This aligns with the
way with which sound cards are named in general.

This patch populates above for jetson-tx1, jetson-tx2 and jetson-xavier.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 1 +
 arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts | 1 +
 arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi     | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts b/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts
index 0f3c6ce..31457f3 100644
--- a/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts
@@ -54,6 +54,7 @@
 	};
 
 	hda@3510000 {
+		nvidia,model = "jetson-tx2-hda";
 		status = "okay";
 	};
 
diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts b/arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts
index 34a7044..b62e969 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts
@@ -21,6 +21,7 @@
 		};
 
 		hda@3510000 {
+			nvidia,model = "jetson-xavier-hda";
 			status = "okay";
 		};
 
diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi
index 8780b5b..95e890d8 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi
@@ -1323,6 +1323,7 @@
 	};
 
 	hda@70030000 {
+		nvidia,model = "jetson-tx1-hda";
 		status = "okay";
 	};
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] ALSA: hda/tegra: sound card name from device tree
  2019-02-20 15:13 [PATCH 1/3] ALSA: hda/tegra: property for card name Sameer Pujar
  2019-02-20 15:13 ` [PATCH 2/3] arm64: tegra: custom name for hda sound card Sameer Pujar
@ 2019-02-20 15:13 ` Sameer Pujar
  2019-02-22  9:47   ` Takashi Iwai
  2019-02-22  9:46 ` [PATCH 1/3] ALSA: hda/tegra: property for card name Takashi Iwai
  2 siblings, 1 reply; 6+ messages in thread
From: Sameer Pujar @ 2019-02-20 15:13 UTC (permalink / raw)
  To: tiwai, perex, robh+dt, mark.rutland
  Cc: thierry.reding, jonathanh, alsa-devel, devicetree, linux-tegra,
	linux-kernel, Sameer Pujar

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: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
---
 sound/pci/hda/hda_tegra.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
index c8d18dc..dbd8da5 100644
--- a/sound/pci/hda/hda_tegra.c
+++ b/sound/pci/hda/hda_tegra.c
@@ -380,8 +380,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;
+	const char *sname, *drv_name = "tegra-hda";
+	struct device_node *np = pdev->dev.of_node;
 
 	err = hda_tegra_init_chip(chip, pdev);
 	if (err)
@@ -440,17 +440,11 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
 	}
 
 	/* driver name */
-	strcpy(card->driver, "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;
-	}
+	strncpy(card->driver, drv_name, sizeof(card->driver));
 	/* shortname for card */
+	sname = of_get_property(np, "nvidia,model", NULL);
+	if (!sname)
+		sname = drv_name;
 	if (strlen(sname) > sizeof(card->shortname))
 		dev_info(card->dev, "truncating shortname for card\n");
 	strncpy(card->shortname, sname, sizeof(card->shortname));
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] ALSA: hda/tegra: property for card name
  2019-02-20 15:13 [PATCH 1/3] ALSA: hda/tegra: property for card name Sameer Pujar
  2019-02-20 15:13 ` [PATCH 2/3] arm64: tegra: custom name for hda sound card Sameer Pujar
  2019-02-20 15:13 ` [PATCH 3/3] ALSA: hda/tegra: sound card name from device tree Sameer Pujar
@ 2019-02-22  9:46 ` Takashi Iwai
  2 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2019-02-22  9:46 UTC (permalink / raw)
  To: Sameer Pujar
  Cc: mark.rutland, robh+dt, perex, alsa-devel, thierry.reding,
	jonathanh, devicetree, linux-kernel, linux-tegra

On Wed, 20 Feb 2019 16:13:22 +0100,
Sameer Pujar wrote:
> 
> An optional property "nvidia,model" is introduced for hda to pass custom
> name for the sound card. The suffix "-hda" in the name passed is useful
> to distinguish between multiple cards available for a platform.
> When the property is not specified, default name("tegra-hda") mentioned
> in hda driver is used. This property can be added in platform specific
> file of the board and card name can relate to the board in use.
> 
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] arm64: tegra: custom name for hda sound card
  2019-02-20 15:13 ` [PATCH 2/3] arm64: tegra: custom name for hda sound card Sameer Pujar
@ 2019-02-22  9:47   ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2019-02-22  9:47 UTC (permalink / raw)
  To: Sameer Pujar
  Cc: mark.rutland, robh+dt, perex, alsa-devel, thierry.reding,
	jonathanh, devicetree, linux-kernel, linux-tegra

On Wed, 20 Feb 2019 16:13:23 +0100,
Sameer Pujar wrote:
> 
> "nvidia,model" property is added to pass custom name for hda sound card.
> This is parsed in hda driver and used for card name. This aligns with the
> way with which sound cards are named in general.
> 
> This patch populates above for jetson-tx1, jetson-tx2 and jetson-xavier.
> 
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] ALSA: hda/tegra: sound card name from device tree
  2019-02-20 15:13 ` [PATCH 3/3] ALSA: hda/tegra: sound card name from device tree Sameer Pujar
@ 2019-02-22  9:47   ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2019-02-22  9:47 UTC (permalink / raw)
  To: Sameer Pujar
  Cc: mark.rutland, robh+dt, perex, alsa-devel, thierry.reding,
	jonathanh, devicetree, linux-kernel, linux-tegra

On Wed, 20 Feb 2019 16:13:24 +0100,
Sameer Pujar wrote:
> 
> 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: Sameer Pujar <spujar@nvidia.com>
> Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-22  9:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-20 15:13 [PATCH 1/3] ALSA: hda/tegra: property for card name Sameer Pujar
2019-02-20 15:13 ` [PATCH 2/3] arm64: tegra: custom name for hda sound card Sameer Pujar
2019-02-22  9:47   ` Takashi Iwai
2019-02-20 15:13 ` [PATCH 3/3] ALSA: hda/tegra: sound card name from device tree Sameer Pujar
2019-02-22  9:47   ` Takashi Iwai
2019-02-22  9:46 ` [PATCH 1/3] ALSA: hda/tegra: property for card name Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).