mbox series

[v4,00/22] Support HDMI audio on NVIDIA Tegra20

Message ID 20211204143725.31646-1-digetx@gmail.com
Headers show
Series Support HDMI audio on NVIDIA Tegra20 | expand

Message

Dmitry Osipenko Dec. 4, 2021, 2:37 p.m. UTC
This series revives Tegra20 S/PDIF driver which was upstreamed long time
ago, but never was used. It also turns Tegra DRM HDMI driver into HDMI
audio CODEC provider. Finally, HDMI audio is enabled in device-trees.
For now the audio is enable only for Acer A500 tablet and Toshiba AC100
netbook because they're already supported by upstream, later on ASUS TF101
tablet will join them.

I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
that removes obsolete slave_id. This eases merging of the patches by
removing the merge conflict. This is a note for Mark Brown.

I also based this series on top of power management series [2]. I.e. [2]
should be applied first, otherwise "Add S/PDIF node to Tegra20 device-tree"
patch should have merge conflict. This is a note for Thierry.

[1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=273312
[2] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=274534

Changelog:

v4: - Added patches that update multi_v7_defconfig with the enabled S/PDIF
      and APB DMA drivers.

v3: - Renamed S/PDIF device-tree clocks as was suggested by Rob Herring.

    - Added r-bs and acks that were given by Rob Herring to v2.

v2: - Corrected I2S yaml problem that was reported by the DT bot for v1
      by removing the non-existent required clock-names property.

    - Removed assigned-clocks property from S/PDIF yaml since this property
      is now inherited from the clocks property.

    - Reordered the "tegra20: spdif: Set FIFO trigger level" patch, making
      it the first sound/soc patch in the series, like it was suggested by
      Mark Brown in the comment to v1. Also reworded commit message of this
      patch to *not* make it looks like it should be backported to stable
      kernels.

Arnd Bergmann (1):
  ASoC: tegra20-spdif: stop setting slave_id

Dmitry Osipenko (21):
  ASoC: dt-bindings: Add binding for Tegra20 S/PDIF
  ASoC: dt-bindings: tegra20-i2s: Convert to schema
  ASoC: dt-bindings: tegra20-i2s: Document new nvidia,fixed-parent-rate
    property
  dt-bindings: host1x: Document optional HDMI sound-dai-cells
  ASoC: tegra20: spdif: Set FIFO trigger level
  ASoC: tegra20: spdif: Support device-tree
  ASoC: tegra20: spdif: Improve driver's code
  ASoC: tegra20: spdif: Use more resource-managed helpers
  ASoC: tegra20: spdif: Reset hardware
  ASoC: tegra20: spdif: Support system suspend
  ASoC: tegra20: spdif: Filter out unsupported rates
  ASoC: tegra20: i2s: Filter out unsupported rates
  drm/tegra: hdmi: Unwind tegra_hdmi_init() errors
  drm/tegra: hdmi: Register audio CODEC on Tegra20
  ARM: tegra_defconfig: Enable S/PDIF driver
  ARM: config: multi v7: Enable NVIDIA Tegra20 S/PDIF driver
  ARM: config: multi v7: Enable NVIDIA Tegra20 APB DMA driver
  ARM: tegra: Add S/PDIF node to Tegra20 device-tree
  ARM: tegra: Add HDMI audio graph to Tegra20 device-tree
  ARM: tegra: acer-a500: Enable S/PDIF and HDMI audio
  ARM: tegra: paz00: Enable S/PDIF and HDMI audio

 .../display/tegra/nvidia,tegra20-host1x.txt   |   1 +
 .../bindings/sound/nvidia,tegra20-i2s.txt     |  30 ---
 .../bindings/sound/nvidia,tegra20-i2s.yaml    |  77 +++++++
 .../bindings/sound/nvidia,tegra20-spdif.yaml  |  85 ++++++++
 .../boot/dts/tegra20-acer-a500-picasso.dts    |   8 +
 arch/arm/boot/dts/tegra20-paz00.dts           |   8 +
 arch/arm/boot/dts/tegra20.dtsi                |  40 +++-
 arch/arm/configs/multi_v7_defconfig           |   2 +
 arch/arm/configs/tegra_defconfig              |   1 +
 drivers/gpu/drm/tegra/Kconfig                 |   3 +
 drivers/gpu/drm/tegra/hdmi.c                  | 168 +++++++++++++--
 sound/soc/tegra/tegra20_i2s.c                 |  49 +++++
 sound/soc/tegra/tegra20_spdif.c               | 197 ++++++++++++------
 sound/soc/tegra/tegra20_spdif.h               |   1 +
 sound/soc/tegra/tegra_pcm.c                   |   6 +
 sound/soc/tegra/tegra_pcm.h                   |   1 +
 16 files changed, 574 insertions(+), 103 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-spdif.yaml

Comments

Mark Brown Dec. 15, 2021, 6:57 p.m. UTC | #1
On Sat, Dec 04, 2021 at 05:37:03PM +0300, Dmitry Osipenko wrote:

> I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
> that removes obsolete slave_id. This eases merging of the patches by
> removing the merge conflict. This is a note for Mark Brown.

That's not in my tree so I'll need either a pull request with the series
or a resend after the merge window.  It's also not clear what to do
about the DRM bits, I guess it's probably easiest to just apply them
along with the ASoC patches.

Please include human readable descriptions of things like commits and
issues being discussed in e-mail in your mails, this makes them much
easier for humans to read especially when they have no internet access.
I do frequently catch up on my mail on flights or while otherwise
travelling so this is even more pressing for me than just being about
making things a bit easier to read.
Dmitry Osipenko Dec. 15, 2021, 7:19 p.m. UTC | #2
15.12.2021 21:57, Mark Brown пишет:
> On Sat, Dec 04, 2021 at 05:37:03PM +0300, Dmitry Osipenko wrote:
> 
>> I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
>> that removes obsolete slave_id. This eases merging of the patches by
>> removing the merge conflict. This is a note for Mark Brown.
> 
> That's not in my tree so I'll need either a pull request with the series
> or a resend after the merge window.

This patch is included as a part of this series, please see the patch #6.

I saw that Vinod Koul already merged it into his DMA tree [1] a day ago,
but there is no stable branch there.

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/log/?h=next

>  It's also not clear what to do
> about the DRM bits, I guess it's probably easiest to just apply them
> along with the ASoC patches.

I already asked Thierry Reding to take a look at this patchset. He will
let to you know how the DRM bits should be handled. Hopefully this
should happen tomorrow.

We will know how to move forward if Vinod and Thierry will reply ASAP.
Otherwise this series will have to wait for the next cycle.

> Please include human readable descriptions of things like commits and
> issues being discussed in e-mail in your mails, this makes them much
> easier for humans to read especially when they have no internet access.
> I do frequently catch up on my mail on flights or while otherwise
> travelling so this is even more pressing for me than just being about
> making things a bit easier to read.
> 

Noted; I see now that it's indeed not clear from the cover letter that I
included Arnd's patch into this patchset, sorry about that. I assumed
that you will notice this after looking through the patches.
Mark Brown Dec. 15, 2021, 7:58 p.m. UTC | #3
On Wed, Dec 15, 2021 at 10:19:07PM +0300, Dmitry Osipenko wrote:
> 15.12.2021 21:57, Mark Brown пишет:

> > Please include human readable descriptions of things like commits and
> > issues being discussed in e-mail in your mails, this makes them much
> > easier for humans to read especially when they have no internet access.
> > I do frequently catch up on my mail on flights or while otherwise
> > travelling so this is even more pressing for me than just being about
> > making things a bit easier to read.

> Noted; I see now that it's indeed not clear from the cover letter that I
> included Arnd's patch into this patchset, sorry about that. I assumed
> that you will notice this after looking through the patches.

It's a pretty long series and having to open a link to figure out what
patch is being talked about puts an additional barrier to remembering
the specific patch at the time dependencies are being considered (which
might not be at the same time as things are reviewed, especially if
other reviews are likely).
Thierry Reding Dec. 16, 2021, 1:46 p.m. UTC | #4
On Sat, Dec 04, 2021 at 05:37:23PM +0300, Dmitry Osipenko wrote:
> Add HDMI audio graph to Tegra20 device-tree to enable HDMI audio on
> Tegra20 devices.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  arch/arm/boot/dts/tegra20.dtsi | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
> index 72cbe32d0c1d..dde228bcbbff 100644
> --- a/arch/arm/boot/dts/tegra20.dtsi
> +++ b/arch/arm/boot/dts/tegra20.dtsi
> @@ -186,7 +186,7 @@ rgb {
>  			};
>  		};
>  
> -		hdmi@54280000 {
> +		tegra_hdmi: hdmi@54280000 {
>  			compatible = "nvidia,tegra20-hdmi";
>  			reg = <0x54280000 0x00040000>;
>  			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
> @@ -1063,4 +1063,24 @@ pmu {
>  		interrupt-affinity = <&{/cpus/cpu@0}>,
>  				     <&{/cpus/cpu@1}>;
>  	};
> +
> +	sound-hdmi {
> +		compatible = "simple-audio-card";
> +		simple-audio-card,name = "NVIDIA Tegra20 HDMI";
> +
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		simple-audio-card,dai-link@0 {
> +			reg = <0>;
> +
> +			cpu {
> +				sound-dai = <&tegra_spdif>;
> +			};
> +
> +			codec {
> +				sound-dai = <&tegra_hdmi>;
> +			};
> +		};
> +	};

Should this be status = "disabled" and then only enabled for platforms
that actually enable HDMI?

Thierry
Thierry Reding Dec. 16, 2021, 1:55 p.m. UTC | #5
On Wed, Dec 15, 2021 at 10:19:07PM +0300, Dmitry Osipenko wrote:
> 15.12.2021 21:57, Mark Brown пишет:
> > On Sat, Dec 04, 2021 at 05:37:03PM +0300, Dmitry Osipenko wrote:
> > 
> >> I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
> >> that removes obsolete slave_id. This eases merging of the patches by
> >> removing the merge conflict. This is a note for Mark Brown.
> > 
> > That's not in my tree so I'll need either a pull request with the series
> > or a resend after the merge window.
> 
> This patch is included as a part of this series, please see the patch #6.
> 
> I saw that Vinod Koul already merged it into his DMA tree [1] a day ago,
> but there is no stable branch there.
> 
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/log/?h=next
> 
> >  It's also not clear what to do
> > about the DRM bits, I guess it's probably easiest to just apply them
> > along with the ASoC patches.
> 
> I already asked Thierry Reding to take a look at this patchset. He will
> let to you know how the DRM bits should be handled. Hopefully this
> should happen tomorrow.
> 
> We will know how to move forward if Vinod and Thierry will reply ASAP.
> Otherwise this series will have to wait for the next cycle.

I've applied the DRM patches to the drm/tegra tree and pulled in the ARM
device tree changes into the Tegra tree. I think the rest can go through
ASoC. Well, provided you can sort out the patch 6 issue with Vinod.

Thierry
Dmitry Osipenko Dec. 16, 2021, 2:24 p.m. UTC | #6
16.12.2021 16:46, Thierry Reding пишет:
> On Sat, Dec 04, 2021 at 05:37:23PM +0300, Dmitry Osipenko wrote:
>> Add HDMI audio graph to Tegra20 device-tree to enable HDMI audio on
>> Tegra20 devices.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>  arch/arm/boot/dts/tegra20.dtsi | 22 +++++++++++++++++++++-
>>  1 file changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
>> index 72cbe32d0c1d..dde228bcbbff 100644
>> --- a/arch/arm/boot/dts/tegra20.dtsi
>> +++ b/arch/arm/boot/dts/tegra20.dtsi
>> @@ -186,7 +186,7 @@ rgb {
>>  			};
>>  		};
>>  
>> -		hdmi@54280000 {
>> +		tegra_hdmi: hdmi@54280000 {
>>  			compatible = "nvidia,tegra20-hdmi";
>>  			reg = <0x54280000 0x00040000>;
>>  			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
>> @@ -1063,4 +1063,24 @@ pmu {
>>  		interrupt-affinity = <&{/cpus/cpu@0}>,
>>  				     <&{/cpus/cpu@1}>;
>>  	};
>> +
>> +	sound-hdmi {
>> +		compatible = "simple-audio-card";
>> +		simple-audio-card,name = "NVIDIA Tegra20 HDMI";
>> +
>> +		#address-cells = <1>;
>> +		#size-cells = <0>;
>> +
>> +		simple-audio-card,dai-link@0 {
>> +			reg = <0>;
>> +
>> +			cpu {
>> +				sound-dai = <&tegra_spdif>;
>> +			};
>> +
>> +			codec {
>> +				sound-dai = <&tegra_hdmi>;
>> +			};
>> +		};
>> +	};
> 
> Should this be status = "disabled" and then only enabled for platforms
> that actually enable HDMI?

Assuming that HDMI node is disabled, we assume that the card won't be
initialized. It won't be a problem to restructure this card in DT later
on if we will have any other use-cases than we currently have, but this
is unlikely to happen in practice.
Dmitry Osipenko Dec. 16, 2021, 2:29 p.m. UTC | #7
15.12.2021 22:19, Dmitry Osipenko пишет:
> 15.12.2021 21:57, Mark Brown пишет:
>> On Sat, Dec 04, 2021 at 05:37:03PM +0300, Dmitry Osipenko wrote:
>>
>>> I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
>>> that removes obsolete slave_id. This eases merging of the patches by
>>> removing the merge conflict. This is a note for Mark Brown.
>> That's not in my tree so I'll need either a pull request with the series
>> or a resend after the merge window.
> This patch is included as a part of this series, please see the patch #6.
> 
> I saw that Vinod Koul already merged it into his DMA tree [1] a day ago,
> but there is no stable branch there.
> 
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/log/?h=next
> 

Vinod, will you be a able to create immutable branch for us with the
"dmaengine: kill off dma_slave_config->slave_id" patches [1]?

[1] https://lore.kernel.org/all/20211122222203.4103644-1-arnd@kernel.org/
Dmitry Osipenko Dec. 16, 2021, 3:09 p.m. UTC | #8
16.12.2021 16:55, Thierry Reding пишет:
> On Wed, Dec 15, 2021 at 10:19:07PM +0300, Dmitry Osipenko wrote:
>> 15.12.2021 21:57, Mark Brown пишет:
>>> On Sat, Dec 04, 2021 at 05:37:03PM +0300, Dmitry Osipenko wrote:
>>>
>>>> I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
>>>> that removes obsolete slave_id. This eases merging of the patches by
>>>> removing the merge conflict. This is a note for Mark Brown.
>>>
>>> That's not in my tree so I'll need either a pull request with the series
>>> or a resend after the merge window.
>>
>> This patch is included as a part of this series, please see the patch #6.
>>
>> I saw that Vinod Koul already merged it into his DMA tree [1] a day ago,
>> but there is no stable branch there.
>>
>> [1]
>> https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/log/?h=next
>>
>>>  It's also not clear what to do
>>> about the DRM bits, I guess it's probably easiest to just apply them
>>> along with the ASoC patches.
>>
>> I already asked Thierry Reding to take a look at this patchset. He will
>> let to you know how the DRM bits should be handled. Hopefully this
>> should happen tomorrow.
>>
>> We will know how to move forward if Vinod and Thierry will reply ASAP.
>> Otherwise this series will have to wait for the next cycle.
> 
> I've applied the DRM patches to the drm/tegra tree and pulled in the ARM
> device tree changes into the Tegra tree. I think the rest can go through
> ASoC. Well, provided you can sort out the patch 6 issue with Vinod.

Thank you!
Thierry Reding Dec. 16, 2021, 3:15 p.m. UTC | #9
On Sat, Dec 04, 2021 at 05:37:08PM +0300, Dmitry Osipenko wrote:
> FIFO trigger level must be not less than the size of DMA burst, otherwise

"must be bigger than or equal to"?

> audio will be played x4 faster that it should be because part of the DMA

"faster than"

> data will be dropped on FIFO input buffer overflow.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  sound/soc/tegra/tegra20_spdif.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Makes sense:

Acked-by: Thierry Reding <treding@nvidia.com>
Thierry Reding Dec. 16, 2021, 3:16 p.m. UTC | #10
On Sat, Dec 04, 2021 at 05:37:09PM +0300, Dmitry Osipenko wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The DMA resource is never set up anywhere, and passing this as slave_id
> has not been the proper procedure in a long time.
> 
> As a preparation for removing all slave_id references from the ALSA code,
> remove this one.
> 
> According to Dmitry Osipenko, this driver has never been used and
> the mechanism for configuring DMA would not work as it is implemented,
> so this part will get rewritten when the driver gets put into use
> again in the future.
> 
> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  sound/soc/tegra/tegra20_spdif.c | 1 -
>  1 file changed, 1 deletion(-)

In case you want to pick this up into the ASoC tree and Vinod removes it
from the DMA tree:

Acked-by: Thierry Reding <treding@nvidia.com>
Thierry Reding Dec. 16, 2021, 3:17 p.m. UTC | #11
On Sat, Dec 04, 2021 at 05:37:10PM +0300, Dmitry Osipenko wrote:
> Tegra20 S/PDIF driver was added in a pre-DT era and was never used since
> that time. Revive driver by adding device-tree support.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  sound/soc/tegra/tegra20_spdif.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>
Thierry Reding Dec. 16, 2021, 3:18 p.m. UTC | #12
On Sat, Dec 04, 2021 at 05:37:11PM +0300, Dmitry Osipenko wrote:
> - Clean up whitespaces, defines and variables.
> 
> - Remove obsolete code.
> 
> - Adhere to upstream coding style.
> 
> - Don't override returned error code.
> 
> - Replace pr_err with dev_err.
> 
> No functional changes are made by this patch. This is a minor code's
> refactoring that will ease further maintenance of the driver.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  sound/soc/tegra/tegra20_spdif.c | 49 ++++++++++++---------------------
>  1 file changed, 18 insertions(+), 31 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>
Thierry Reding Dec. 16, 2021, 3:21 p.m. UTC | #13
On Sat, Dec 04, 2021 at 05:37:12PM +0300, Dmitry Osipenko wrote:
> Use resource-managed helpers to make code cleaner. Driver's remove callback
> isn't needed anymore since driver is completely resource-managed now.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  sound/soc/tegra/tegra20_spdif.c | 33 +++++++++------------------------
>  sound/soc/tegra/tegra_pcm.c     |  6 ++++++
>  sound/soc/tegra/tegra_pcm.h     |  1 +
>  3 files changed, 16 insertions(+), 24 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>
Thierry Reding Dec. 16, 2021, 3:22 p.m. UTC | #14
On Sat, Dec 04, 2021 at 05:37:13PM +0300, Dmitry Osipenko wrote:
> Reset S/PDIF controller on runtime PM suspend/resume to ensure that we
> always have a consistent hardware state.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  sound/soc/tegra/tegra20_spdif.c | 32 ++++++++++++++++++++++++++++++++
>  sound/soc/tegra/tegra20_spdif.h |  1 +
>  2 files changed, 33 insertions(+)

Acked-by: Thierry Reding <treding@nvidia.com>
Thierry Reding Dec. 16, 2021, 3:22 p.m. UTC | #15
On Sat, Dec 04, 2021 at 05:37:14PM +0300, Dmitry Osipenko wrote:
> Support system suspend by enforcing runtime PM suspend/resume.
> Now there is no doubt that h/w is indeed stopped during suspend
> and that h/w state will be properly restored after resume.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  sound/soc/tegra/tegra20_spdif.c | 2 ++
>  1 file changed, 2 insertions(+)

Acked-by: Thierry Reding <treding@nvidia.com>
Thierry Reding Dec. 16, 2021, 3:30 p.m. UTC | #16
On Sat, Dec 04, 2021 at 05:37:15PM +0300, Dmitry Osipenko wrote:
> SPDIF and other SoC components share audio PLL on Tegra, thus only one
> component may set the desired base clock rate. This creates problem for
> HDMI audio because it uses SPDIF and audio may not work if SPDIF's clock
> doesn't exactly match standard audio rate since some receivers may reject
> audio in that case. Filter out audio rates which SPDIF output can't
> support, assuming that other components won't change rate at runtime.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  sound/soc/tegra/tegra20_spdif.c | 61 +++++++++++++++++++++++++++++++++
>  1 file changed, 61 insertions(+)
> 
> diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c
> index a4aa5614aef4..d09cd7ee6879 100644
> --- a/sound/soc/tegra/tegra20_spdif.c
> +++ b/sound/soc/tegra/tegra20_spdif.c
> @@ -79,6 +79,7 @@ static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream,
>  	struct tegra20_spdif *spdif = dev_get_drvdata(dai->dev);
>  	unsigned int mask = 0, val = 0;
>  	int ret, spdifclock;
> +	long rate;

Perhaps we should change spdifclock to be "long" as well, even though
they're the same on Tegra20. SND_SOC_TEGRA depends on || COMPILE_TEST,
so technically somebody could build this on 64-bit and then these are
no longer the same types.

Still shouldn't be problematic given the numbers that are passed in,
but it'd still be nice to keep consistent types for these.

>  
>  	mask |= TEGRA20_SPDIF_CTRL_PACK |
>  		TEGRA20_SPDIF_CTRL_BIT_MODE_MASK;
> @@ -133,6 +134,12 @@ static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream,
>  		return ret;
>  	}
>  
> +	rate = clk_get_rate(spdif->clk_spdif_out);
> +	if (rate != spdifclock)
> +		dev_warn_once(dai->dev,
> +			      "SPDIF clock rate %d doesn't match requested rate %lu\n",

That should be %ld since it's not unsigned.

Otherwise, looks good. Probably not worth respinning for just these
minor comments, so:

Acked-by: Thierry Reding <treding@nvidia.com>
Thierry Reding Dec. 16, 2021, 3:31 p.m. UTC | #17
On Sat, Dec 04, 2021 at 05:37:16PM +0300, Dmitry Osipenko wrote:
> Support new nvidia,fixed-parent-rate device-tree property which instructs
> I2S that board wants parent clock rate to stay at a fixed rate. This allows
> to play audio over S/PDIF and I2S simultaneously. The root of the problem
> is that audio components on Tegra share the same audio PLL, and thus, only
> a subset of rates can be supported if we want to play audio simultaneously.
> Filter out audio rates that don't match parent clock rate if device-tree
> has the nvidia,fixed-parent-rate property.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  sound/soc/tegra/tegra20_i2s.c | 49 +++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)

Acked-by: Thierry Reding <treding@nvidia.com>
Vinod Koul Dec. 17, 2021, 6:04 a.m. UTC | #18
On 16-12-21, 17:29, Dmitry Osipenko wrote:
> 15.12.2021 22:19, Dmitry Osipenko пишет:
> > 15.12.2021 21:57, Mark Brown пишет:
> >> On Sat, Dec 04, 2021 at 05:37:03PM +0300, Dmitry Osipenko wrote:
> >>
> >>> I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
> >>> that removes obsolete slave_id. This eases merging of the patches by
> >>> removing the merge conflict. This is a note for Mark Brown.
> >> That's not in my tree so I'll need either a pull request with the series
> >> or a resend after the merge window.
> > This patch is included as a part of this series, please see the patch #6.
> > 
> > I saw that Vinod Koul already merged it into his DMA tree [1] a day ago,
> > but there is no stable branch there.
> > 
> > [1]
> > https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/log/?h=next
> > 
> 
> Vinod, will you be a able to create immutable branch for us with the
> "dmaengine: kill off dma_slave_config->slave_id" patches [1]?
> 
> [1] https://lore.kernel.org/all/20211122222203.4103644-1-arnd@kernel.org/

Here you go:

The following changes since commit fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf:

  Linux 5.16-rc1 (2021-11-14 13:56:52 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git tags/dmaengine_topic_slave_id_removal_5.17

for you to fetch changes up to 3c219644075795a99271d345efdfa8b256e55161:

  dmaengine: remove slave_id config field (2021-12-17 11:23:56 +0530)

----------------------------------------------------------------
dmaengine_topic_slave_id_removal_5.17

Tag for dmaengine slave_id removal topic branch which should be merged
into v5.17

----------------------------------------------------------------
Arnd Bergmann (11):
      ASoC: tegra20-spdif: stop setting slave_id
      dmaengine: tegra20-apb: stop checking config->slave_id
      ASoC: dai_dma: remove slave_id field
      spi: pic32: stop setting dma_config->slave_id
      mmc: bcm2835: stop setting chan_config->slave_id
      dmaengine: shdma: remove legacy slave_id parsing
      dmaengine: pxa/mmp: stop referencing config->slave_id
      dmaengine: sprd: stop referencing config->slave_id
      dmaengine: qcom-adm: stop abusing slave_id config
      dmaengine: xilinx_dpdma: stop using slave_id field
      dmaengine: remove slave_id config field

 drivers/dma/mmp_pdma.c             |  6 ------
 drivers/dma/pxa_dma.c              |  7 -------
 drivers/dma/qcom/qcom_adm.c        | 56 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 drivers/dma/sh/shdma-base.c        |  8 --------
 drivers/dma/sprd-dma.c             |  3 ---
 drivers/dma/tegra20-apb-dma.c      |  6 ------
 drivers/dma/xilinx/xilinx_dpdma.c  | 17 +++++++++++------
 drivers/gpu/drm/xlnx/zynqmp_disp.c |  9 +++++++--
 drivers/mmc/host/bcm2835.c         |  2 --
 drivers/mtd/nand/raw/qcom_nandc.c  | 14 ++++++++++++--
 drivers/spi/spi-pic32.c            |  2 --
 drivers/tty/serial/msm_serial.c    | 15 +++++++++++++--
 include/linux/dma/qcom_adm.h       | 12 ++++++++++++
 include/linux/dma/xilinx_dpdma.h   | 11 +++++++++++
 include/linux/dmaengine.h          |  4 ----
 include/sound/dmaengine_pcm.h      |  2 --
 sound/core/pcm_dmaengine.c         |  5 ++---
 sound/soc/tegra/tegra20_spdif.c    |  1 -
 18 files changed, 117 insertions(+), 63 deletions(-)
 create mode 100644 include/linux/dma/qcom_adm.h
 create mode 100644 include/linux/dma/xilinx_dpdma.h

Thanks
Dmitry Osipenko Dec. 17, 2021, 12:06 p.m. UTC | #19
17.12.2021 09:04, Vinod Koul пишет:
> On 16-12-21, 17:29, Dmitry Osipenko wrote:
>> 15.12.2021 22:19, Dmitry Osipenko пишет:
>>> 15.12.2021 21:57, Mark Brown пишет:
>>>> On Sat, Dec 04, 2021 at 05:37:03PM +0300, Dmitry Osipenko wrote:
>>>>
>>>>> I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
>>>>> that removes obsolete slave_id. This eases merging of the patches by
>>>>> removing the merge conflict. This is a note for Mark Brown.
>>>> That's not in my tree so I'll need either a pull request with the series
>>>> or a resend after the merge window.
>>> This patch is included as a part of this series, please see the patch #6.
>>>
>>> I saw that Vinod Koul already merged it into his DMA tree [1] a day ago,
>>> but there is no stable branch there.
>>>
>>> [1]
>>> https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/log/?h=next
>>>
>>
>> Vinod, will you be a able to create immutable branch for us with the
>> "dmaengine: kill off dma_slave_config->slave_id" patches [1]?
>>
>> [1] https://lore.kernel.org/all/20211122222203.4103644-1-arnd@kernel.org/
> 
> Here you go:
> 
> The following changes since commit fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf:
> 
>   Linux 5.16-rc1 (2021-11-14 13:56:52 -0800)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git tags/dmaengine_topic_slave_id_removal_5.17
> 
> for you to fetch changes up to 3c219644075795a99271d345efdfa8b256e55161:
> 
>   dmaengine: remove slave_id config field (2021-12-17 11:23:56 +0530)
> 
> ----------------------------------------------------------------
> dmaengine_topic_slave_id_removal_5.17
> 
> Tag for dmaengine slave_id removal topic branch which should be merged
> into v5.17
> 
> ----------------------------------------------------------------
> Arnd Bergmann (11):
>       ASoC: tegra20-spdif: stop setting slave_id
>       dmaengine: tegra20-apb: stop checking config->slave_id
>       ASoC: dai_dma: remove slave_id field
>       spi: pic32: stop setting dma_config->slave_id
>       mmc: bcm2835: stop setting chan_config->slave_id
>       dmaengine: shdma: remove legacy slave_id parsing
>       dmaengine: pxa/mmp: stop referencing config->slave_id
>       dmaengine: sprd: stop referencing config->slave_id
>       dmaengine: qcom-adm: stop abusing slave_id config
>       dmaengine: xilinx_dpdma: stop using slave_id field
>       dmaengine: remove slave_id config field
> 
>  drivers/dma/mmp_pdma.c             |  6 ------
>  drivers/dma/pxa_dma.c              |  7 -------
>  drivers/dma/qcom/qcom_adm.c        | 56 +++++++++++++++++++++++++++++++++++++++++++++++++-------
>  drivers/dma/sh/shdma-base.c        |  8 --------
>  drivers/dma/sprd-dma.c             |  3 ---
>  drivers/dma/tegra20-apb-dma.c      |  6 ------
>  drivers/dma/xilinx/xilinx_dpdma.c  | 17 +++++++++++------
>  drivers/gpu/drm/xlnx/zynqmp_disp.c |  9 +++++++--
>  drivers/mmc/host/bcm2835.c         |  2 --
>  drivers/mtd/nand/raw/qcom_nandc.c  | 14 ++++++++++++--
>  drivers/spi/spi-pic32.c            |  2 --
>  drivers/tty/serial/msm_serial.c    | 15 +++++++++++++--
>  include/linux/dma/qcom_adm.h       | 12 ++++++++++++
>  include/linux/dma/xilinx_dpdma.h   | 11 +++++++++++
>  include/linux/dmaengine.h          |  4 ----
>  include/sound/dmaengine_pcm.h      |  2 --
>  sound/core/pcm_dmaengine.c         |  5 ++---
>  sound/soc/tegra/tegra20_spdif.c    |  1 -
>  18 files changed, 117 insertions(+), 63 deletions(-)
>  create mode 100644 include/linux/dma/qcom_adm.h
>  create mode 100644 include/linux/dma/xilinx_dpdma.h

Thank you!
Mark Brown Dec. 21, 2021, 2:50 a.m. UTC | #20
On Sat, 4 Dec 2021 17:37:03 +0300, Dmitry Osipenko wrote:
> This series revives Tegra20 S/PDIF driver which was upstreamed long time
> ago, but never was used. It also turns Tegra DRM HDMI driver into HDMI
> audio CODEC provider. Finally, HDMI audio is enabled in device-trees.
> For now the audio is enable only for Acer A500 tablet and Toshiba AC100
> netbook because they're already supported by upstream, later on ASUS TF101
> tablet will join them.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[01/22] ASoC: dt-bindings: Add binding for Tegra20 S/PDIF
        commit: 46f016119e2ac38d9efd32e4957bc888dc71fffe
[02/22] ASoC: dt-bindings: tegra20-i2s: Convert to schema
        commit: 80c3d0a97abfd2a678b6077236a77ccb8c4747fa
[03/22] ASoC: dt-bindings: tegra20-i2s: Document new nvidia,fixed-parent-rate property
        commit: 549818e5c85a6d806cdef146d0203df2689d4e2f
[05/22] ASoC: tegra20: spdif: Set FIFO trigger level
        commit: 16736a0221db6d6f3fe130750c6dc5bbf5417da4
[06/22] ASoC: tegra20-spdif: stop setting slave_id
        (no commit info)
[07/22] ASoC: tegra20: spdif: Support device-tree
        commit: c0000fc618cdbe190274cf37040033dfa23c159d
[08/22] ASoC: tegra20: spdif: Improve driver's code
        commit: 117aeed43974e500dcbd106e51218a83ae2c9977
[09/22] ASoC: tegra20: spdif: Use more resource-managed helpers
        commit: 150f4d573fe19a77864f6dec31aa444332f9fc9e
[10/22] ASoC: tegra20: spdif: Reset hardware
        commit: ec1b4545d75575118e01a5e95699cff5010b4e19
[11/22] ASoC: tegra20: spdif: Support system suspend
        commit: d51693092ecc732fca3f49549cde1c5206331b09
[12/22] ASoC: tegra20: spdif: Filter out unsupported rates
        commit: 9d8f51cd1fa993939db02a014d4f4b6e252c2a18
[13/22] ASoC: tegra20: i2s: Filter out unsupported rates
        commit: bfa4671db1effe315cade5bddd6cf025e1c403d0

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark