[PATCH v2 0/4] Generic HDMI codec: Add channel mapping control

Arnaud Pouliquen arnaud.pouliquen at st.com
Wed Dec 14 15:16:41 UTC 2016

Aim of this patch is to add  'Playback Channel Map' control to export 
audio capabilities in term of HDMI sink speakers allocation.

In this version I use chmap helper functions from pcm_lib.c. 
It is quite tricky to use it from ASoC due to the relation chip of the controls
with the pcm runtime.
After several tries, my conclusion is that it must be handled in ASoC DAI driver.
Main reason is that the DAI driver can not provide snd_pcm_chmap struct
through kcontrol structure. But this induces that soc-core provides pcm runtime
structure to DAI driver during probe.

Base on this conclusion. I reworked my patches by adding 2 
new patches in patch-set
1)  ALSA pcm: allow non constant snd_pcm_chmap_elem
   This patch allows to handle non constant channel mapping. As ELD
   information can change during runtime it is mandatory to properly 
   handle the feature.
   In term of compatibility with legacy it should be straightforward,
   as update just consists in suppressing the 'const' constraint.

2)  ASoC: core: add optional pcm_new callback for DAI driver
    This is the only way i found to be able to use 
    snd_pcm_add_chmap_ctls and associated controls helper functions.
    From my point of view, this is the more simple way to add relationship
    between DAI and associated pcm devices.
   Notice that this patch, if accepted, makes the following one obsolete,
   as it also answer to the associated topic:
  [PATCH v5 0/2] ALSA controls management using index/device/sub-devices fields

If you estimate that this it not reasonable i will come back to my first version.

This patch follow discussion initiates here: 
[RFC] ASOC: HDMI audio info frame speaker allocation

The code is fully inspired from HDA driver.
On hw_param, HDMI sink speaker capabilities are exported via TLV ops
and  a CEA allocation is choson, based on ELD information and the number of
channels requested by user.

Mains differences with HDA implementation are:
 - Control is read only
 - Channel swap is not supported. Consequence is that unused channel in
   the mid of CEA audio infoframe channel mapping are considered as
   example for channel allocation 0x02: FL, FR, 0, FC)
	This configuration is only available for a 4 channels stream.
  - Channel allocation table has been reordered and HDMI 2.0 is not

Arnaud Pouliquen (4):
  DRM: add help to get ELD speaker allocation
  ALSA pcm: allow non constant snd_pcm_chmap_elem
  ASoC: core: add optional pcm_new callback for DAI driver
  ASoC: hdmi-codec: add channel mapping control

 include/drm/drm_edid.h        |  13 ++
 include/sound/pcm.h           |   4 +-
 include/sound/soc-dai.h       |   3 +
 sound/core/pcm_lib.c          |   6 +-
 sound/soc/codecs/hdmi-codec.c | 310 +++++++++++++++++++++++++++++++++++++++++-
 sound/soc/soc-core.c          |  28 ++++
 6 files changed, 358 insertions(+), 6 deletions(-)


More information about the dri-devel mailing list