2021-12-23 11:54:04

by Sameer Pujar

[permalink] [raw]
Subject: [PATCH v4 0/3] Fix Tegra194 HDA regression

HDA probe failure is observed on Tegra194 based platforms and this
happens due to reset failure. This series fixes the problem by
skipping the failing reset and DT bindings are updated accordingly.


Changelog
=========
v3 -> v4:
---------
* Rename SoC data variable in HDA driver patch.
* Remove NULL check for compatible match data in HDA driver patch.
* Drop "Depends-on" tag from commit message and add "Reviewed-by"
tag from Dmitry.
* Update binding doc patch as per comment from Rob.


v2 -> v3:
---------
* Use reset bulk APIs in HDA driver as suggested by Dmitry.


v1 -> v2:
---------
* Updated HDA driver patch to skip the failing reset instead of
skipping resets in general for BPMP devices as per comment from
Dmitry.
* Used a better strucure name for SoC data as per comment from
Thierry.
* Dropped 'Fixes' tag in binding doc patch as per comment from
Dmitry.

Sameer Pujar (3):
ALSA: hda/tegra: Fix Tegra194 HDA reset failure
dt-bindings: sound: tegra: Add minItems for resets
arm64: tegra: Remove non existent Tegra194 reset

.../bindings/sound/nvidia,tegra30-hda.yaml | 2 +
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 5 +--
sound/pci/hda/hda_tegra.c | 43 +++++++++++++++++-----
3 files changed, 38 insertions(+), 12 deletions(-)

--
2.7.4



2021-12-23 11:54:08

by Sameer Pujar

[permalink] [raw]
Subject: [PATCH v4 1/3] ALSA: hda/tegra: Fix Tegra194 HDA reset failure

HDA regression is recently reported on Tegra194 based platforms.
This happens because "hda2codec_2x" reset does not really exist
in Tegra194 and it causes probe failure. All the HDA based audio
tests fail at the moment. This underlying issue is exposed by
commit c045ceb5a145 ("reset: tegra-bpmp: Handle errors in BPMP
response") which now checks return code of BPMP command response.
Fix this issue by skipping unavailable reset on Tegra194.

Cc: [email protected]
Signed-off-by: Sameer Pujar <[email protected]>
Reviewed-by: Dmitry Osipenko <[email protected]>
---
sound/pci/hda/hda_tegra.c | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)

diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
index ea700395..773f490 100644
--- a/sound/pci/hda/hda_tegra.c
+++ b/sound/pci/hda/hda_tegra.c
@@ -68,14 +68,20 @@
*/
#define TEGRA194_NUM_SDO_LINES 4

+struct hda_tegra_soc {
+ bool has_hda2codec_2x_reset;
+};
+
struct hda_tegra {
struct azx chip;
struct device *dev;
- struct reset_control *reset;
+ struct reset_control_bulk_data resets[3];
struct clk_bulk_data clocks[3];
+ unsigned int nresets;
unsigned int nclocks;
void __iomem *regs;
struct work_struct probe_work;
+ const struct hda_tegra_soc *soc;
};

#ifdef CONFIG_PM
@@ -170,7 +176,7 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev)
int rc;

if (!chip->running) {
- rc = reset_control_assert(hda->reset);
+ rc = reset_control_bulk_assert(hda->nresets, hda->resets);
if (rc)
return rc;
}
@@ -187,7 +193,7 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev)
} else {
usleep_range(10, 100);

- rc = reset_control_deassert(hda->reset);
+ rc = reset_control_bulk_deassert(hda->nresets, hda->resets);
if (rc)
return rc;
}
@@ -427,9 +433,17 @@ static int hda_tegra_create(struct snd_card *card,
return 0;
}

+static const struct hda_tegra_soc tegra30_data = {
+ .has_hda2codec_2x_reset = true,
+};
+
+static const struct hda_tegra_soc tegra194_data = {
+ .has_hda2codec_2x_reset = false,
+};
+
static const struct of_device_id hda_tegra_match[] = {
- { .compatible = "nvidia,tegra30-hda" },
- { .compatible = "nvidia,tegra194-hda" },
+ { .compatible = "nvidia,tegra30-hda", .data = &tegra30_data },
+ { .compatible = "nvidia,tegra194-hda", .data = &tegra194_data },
{},
};
MODULE_DEVICE_TABLE(of, hda_tegra_match);
@@ -449,6 +463,8 @@ static int hda_tegra_probe(struct platform_device *pdev)
hda->dev = &pdev->dev;
chip = &hda->chip;

+ hda->soc = of_device_get_match_data(&pdev->dev);
+
err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, 0, &card);
if (err < 0) {
@@ -456,11 +472,20 @@ static int hda_tegra_probe(struct platform_device *pdev)
return err;
}

- hda->reset = devm_reset_control_array_get_exclusive(&pdev->dev);
- if (IS_ERR(hda->reset)) {
- err = PTR_ERR(hda->reset);
+ hda->resets[hda->nresets++].id = "hda";
+ hda->resets[hda->nresets++].id = "hda2hdmi";
+ /*
+ * "hda2codec_2x" reset is not present on Tegra194. Though DT would
+ * be updated to reflect this, but to have backward compatibility
+ * below is necessary.
+ */
+ if (hda->soc->has_hda2codec_2x_reset)
+ hda->resets[hda->nresets++].id = "hda2codec_2x";
+
+ err = devm_reset_control_bulk_get_exclusive(&pdev->dev, hda->nresets,
+ hda->resets);
+ if (err)
goto out_free;
- }

hda->clocks[hda->nclocks++].id = "hda";
hda->clocks[hda->nclocks++].id = "hda2hdmi";
--
2.7.4


2021-12-23 11:54:13

by Sameer Pujar

[permalink] [raw]
Subject: [PATCH v4 2/3] dt-bindings: sound: tegra: Add minItems for resets

Tegra194 HDA has only two resets unlike the previous generations of
Tegra SoCs. To take care of this set minItems field to two.

Signed-off-by: Sameer Pujar <[email protected]>
---
Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.yaml | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.yaml b/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.yaml
index b55775e..2c913aa 100644
--- a/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.yaml
+++ b/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.yaml
@@ -50,9 +50,11 @@ properties:
- const: hda2codec_2x

resets:
+ minItems: 2
maxItems: 3

reset-names:
+ minItems: 2
items:
- const: hda
- const: hda2hdmi
--
2.7.4


2021-12-23 11:54:18

by Sameer Pujar

[permalink] [raw]
Subject: [PATCH v4 3/3] arm64: tegra: Remove non existent Tegra194 reset

Tegra194 does not really have "hda2codec_2x" related reset. Hence drop
this entry to reflect actual HW.

Fixes: 4878cc0c9fab ("arm64: tegra: Add HDA controller on Tegra194")
Signed-off-by: Sameer Pujar <[email protected]>
---
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi
index 8d29b7f..6a1d896 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi
@@ -976,9 +976,8 @@
<&bpmp TEGRA194_CLK_HDA2CODEC_2X>;
clock-names = "hda", "hda2hdmi", "hda2codec_2x";
resets = <&bpmp TEGRA194_RESET_HDA>,
- <&bpmp TEGRA194_RESET_HDA2HDMICODEC>,
- <&bpmp TEGRA194_RESET_HDA2CODEC_2X>;
- reset-names = "hda", "hda2hdmi", "hda2codec_2x";
+ <&bpmp TEGRA194_RESET_HDA2HDMICODEC>;
+ reset-names = "hda", "hda2hdmi";
power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DISP>;
interconnects = <&mc TEGRA194_MEMORY_CLIENT_HDAR &emc>,
<&mc TEGRA194_MEMORY_CLIENT_HDAW &emc>;
--
2.7.4


2022-01-01 15:48:11

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v4 0/3] Fix Tegra194 HDA regression

On Thu, 23 Dec 2021 12:53:48 +0100,
Sameer Pujar wrote:
>
> HDA probe failure is observed on Tegra194 based platforms and this
> happens due to reset failure. This series fixes the problem by
> skipping the failing reset and DT bindings are updated accordingly.
>
>
> Changelog
> =========
> v3 -> v4:
> ---------
> * Rename SoC data variable in HDA driver patch.
> * Remove NULL check for compatible match data in HDA driver patch.
> * Drop "Depends-on" tag from commit message and add "Reviewed-by"
> tag from Dmitry.
> * Update binding doc patch as per comment from Rob.
>
>
> v2 -> v3:
> ---------
> * Use reset bulk APIs in HDA driver as suggested by Dmitry.
>
>
> v1 -> v2:
> ---------
> * Updated HDA driver patch to skip the failing reset instead of
> skipping resets in general for BPMP devices as per comment from
> Dmitry.
> * Used a better strucure name for SoC data as per comment from
> Thierry.
> * Dropped 'Fixes' tag in binding doc patch as per comment from
> Dmitry.
>
> Sameer Pujar (3):
> ALSA: hda/tegra: Fix Tegra194 HDA reset failure
> dt-bindings: sound: tegra: Add minItems for resets
> arm64: tegra: Remove non existent Tegra194 reset

As there seems no objection for this revision, I applied all three
patches now to for-next branch of sound.git tree.


thanks,

Takashi