mbox series

[v2,00/12] drm/vc4: hdmi: Enable Channel Mapping, IEC958, HBR Passthrough using hdmi-codec

Message ID 20210525132354.297468-1-maxime@cerno.tech
Headers show
Series drm/vc4: hdmi: Enable Channel Mapping, IEC958, HBR Passthrough using hdmi-codec | expand

Message

Maxime Ripard May 25, 2021, 1:23 p.m. UTC
Hi,

hdmi-codec allows to have a lot of HDMI-audio related infrastructure in place,
it's missing a few controls to be able to provide HBR passthrough. This series
adds more infrastructure for the drivers, and leverages it in the vc4 HDMI
controller driver.

Thanks!
Maxime

Changes from v1:
  - Added an extra patch to clarify the iec958 controls iface policy
  - Added kerneldoc for the new iec958 PCM functions
  - s/EXPORT_SYMBOL/EXPORT_SYMBOL_GPL
  - Used the ALSA prefix where relevant
  - Rebased on drm-misc-next-2021-05-17

Dom Cobley (5):
  drm/vc4: hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET
  drm/vc4: hdmi: Set HDMI_MAI_FMT
  drm/vc4: hdmi: Set VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE
  drm/vc4: hdmi: Remove firmware logic for MAI threshold setting
  ARM: dts: bcm2711: Tune DMA parameters for HDMI audio

Maxime Ripard (7):
  ALSA: doc: Clarify IEC958 controls iface
  ALSA: iec958: Split status creation and fill
  ASoC: hdmi-codec: Rework to support more controls
  ASoC: hdmi-codec: Add iec958 controls
  ASoC: hdmi-codec: Add a prepare hook
  drm/vc4: hdmi: Register HDMI codec
  drm/vc4: hdmi: Remove redundant variables

 .../kernel-api/writing-an-alsa-driver.rst     |  13 +-
 arch/arm/boot/dts/bcm2711.dtsi                |   4 +-
 drivers/gpu/drm/vc4/Kconfig                   |   1 +
 drivers/gpu/drm/vc4/vc4_hdmi.c                | 322 ++++++++----------
 drivers/gpu/drm/vc4/vc4_hdmi.h                |   5 +-
 drivers/gpu/drm/vc4/vc4_regs.h                |  30 ++
 include/sound/hdmi-codec.h                    |  12 +-
 include/sound/pcm_iec958.h                    |   8 +
 sound/core/pcm_iec958.c                       | 176 +++++++---
 sound/soc/codecs/hdmi-codec.c                 | 219 +++++++++---
 10 files changed, 508 insertions(+), 282 deletions(-)

-- 
2.31.1

Comments

Takashi Iwai May 25, 2021, 3:58 p.m. UTC | #1
On Tue, 25 May 2021 15:23:43 +0200,
Maxime Ripard wrote:
> 
> The doc currently mentions that the IEC958 Playback Default should be
> exposed on the PCM iface, and the Playback Mask on the mixer iface.
> 
> It's a bit confusing to advise to have two related controls on two
> separate ifaces, and it looks like the drivers that currently expose
> those controls use any combination of the mixer and PCM ifaces.
> 
> Let's try to clarify the situation a bit, and encourage to at least have
> the controls on the same iface.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi


> ---
>  .../sound/kernel-api/writing-an-alsa-driver.rst     | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
> index e6365836fa8b..01d59b8aea92 100644
> --- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
> +++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
> @@ -3508,14 +3508,15 @@ field must be set, though).
>  
>  “IEC958 Playback Con Mask” is used to return the bit-mask for the IEC958
>  status bits of consumer mode. Similarly, “IEC958 Playback Pro Mask”
> -returns the bitmask for professional mode. They are read-only controls,
> -and are defined as MIXER controls (iface =
> -``SNDRV_CTL_ELEM_IFACE_MIXER``).
> +returns the bitmask for professional mode. They are read-only controls.
>  
>  Meanwhile, “IEC958 Playback Default” control is defined for getting and
> -setting the current default IEC958 bits. Note that this one is usually
> -defined as a PCM control (iface = ``SNDRV_CTL_ELEM_IFACE_PCM``),
> -although in some places it's defined as a MIXER control.
> +setting the current default IEC958 bits.
> +
> +Due to historical reasons, both variants of the Playback Mask and the
> +Playback Default controls can be implemented on either a
> +``SNDRV_CTL_ELEM_IFACE_PCM`` or a ``SNDRV_CTL_ELEM_IFACE_MIXER`` iface.
> +Drivers should expose the mask and default on the same iface though.
>  
>  In addition, you can define the control switches to enable/disable or to
>  set the raw bit mode. The implementation will depend on the chip, but
> -- 
> 2.31.1
>
Mark Brown May 26, 2021, 10:38 a.m. UTC | #2
On Tue, May 25, 2021 at 03:23:45PM +0200, Maxime Ripard wrote:
> We're going to add more controls to support the IEC958 output, so let's

> rework the control registration a bit to support more of them.


Acked-by: Mark Brown <broonie@kernel.org>
nicolas saenz julienne June 1, 2021, 8:45 a.m. UTC | #3
On Tue, 2021-05-25 at 15:23 +0200, Maxime Ripard wrote:
> From: Dom Cobley <popcornmix@gmail.com>
> 
> Symptom is random switching of speakers when using multichannel.
> 
> Repeatedly running speakertest -c8 occasionally starts with
> channels jumbled. This is fixed with HD_CTL_WHOLSMP.
> 
> The other bit looks beneficial and apears harmless in testing so
> I'd suggest adding it too.
> 
> Documentation says: HD_CTL_WHILSMP_SET
> Wait for whole sample. When this bit is set MAI transmit will start
> only when there is at least one whole sample available in the fifo.
> 
> Documentation says: HD_CTL_CHALIGN_SET
> Channel Align When Overflow. This bit is used to realign the audio
> channels in case of an overflow.
> If this bit is set, after the detection of an overflow, equal
> amount of dummy words to the missing words will be written to fifo,
> filling up the broken sample and maintaining alignment.
> 
> Signed-off-by: Dom Cobley <popcornmix@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---

Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>

Regards,
Nicolas
nicolas saenz julienne June 1, 2021, 8:47 a.m. UTC | #4
On Tue, 2021-05-25 at 15:23 +0200, Maxime Ripard wrote:
> From: Dom Cobley <popcornmix@gmail.com>
> 
> The hardware uses this for generating the right audio
> data island packets when using formats other than PCM
> 
> Signed-off-by: Dom Cobley <popcornmix@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---

Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>

Regards,
Nicolas