add IEC958 channel status control helper
Subsystems (3)
v3 cover add IEC958 channel status control helper
- Define helpers function to handle 'IEC958 Playback Default' control
- add "pcm_new" ops for DAI initialisations that need pcm runtime context.
This patchset is needed to be able to associate control to the
PCM device. The iec control is linked to the DAI but also to the PCM device. Furthermore, some platforms like sti support both HDMI and SPDIF
outputs in parallel. Logical way to differentiate them is to link them
to pcm device index.
V3:
This patchset is extracted from following RFC
http://permalink.gmane.org/gmane.linux.alsa.devel/149876 (sti: add audio interface to the hdmi driver)
Notice that "ASoC: hdmi-codec: add IEC control" patch depends on integration of the hdmi-codec driver
Patches update:
- ALSA: pcm: add IEC958 channel status control helper
- make mutex usage mandatory.
- Set control index to pcm device id ( needed to be supported by iecset)
- ASoC: core: add code to complete dai init after pcm creation
- fix dai param of pcm_new ops for cpu dai.
- ASoC: sti: use iec channel status control helper
new patch: implementation of the helper for sti cpu-dai
V2:
- patch: ALSA: pcm: add IEC958 channel status control helper
- Return 1 instead of 0 in snd_pcm_iec958_put
- Add .access field in control structure
- I have kept condition on mutex for flexibility (but could be cleaned to force user to use a mutex)
V1:
This RFC is the implementation of audio HDMI on sti platform based on
generic hdmi-codec driver:
https://patchwork.kernel.org/patch/7215271/ ("ASoC: hdmi-codec: Add hdmi-codec for external HDMI-encoders")
Arnaud Pouliquen (4):
ALSA: pcm: add IEC958 channel status control helper
ASoC: core: add code to complete dai init after pcm creation
ASoC: sti: use iec channel status control helper
ASoC: hdmi-codec: add IEC control.
include/sound/hdmi-codec.h | 1 + include/sound/pcm_iec958.h | 15 ++++++ include/sound/soc-dai.h | 7 +++ sound/core/pcm_iec958.c | 107 ++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/hdmi-codec.c | 59 ++++++++++++++++------ sound/soc/soc-core.c | 14 ++++++ sound/soc/sti/Kconfig | 1 + sound/soc/sti/uniperif_player.c | 79 ++++++++++++----------------- 8 files changed, 219 insertions(+), 62 deletions(-)
Signature · 1 line
1.9.1
PATCH v3 1/4 ALSA: pcm: add IEC958 channel status control helper
Add IEC958 channel status helper that creates control to handle the IEC60958 status bits.
--- include/sound/pcm_iec958.h | 15 +++++++ sound/core/pcm_iec958.c | 107 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+)
include/sound/pcm_iec958.h +15 -0
@@ -3,7 +3,22 @@#include <linux/types.h> +/* +* IEC 60958 controls parameters +* Describes channel status and associated callback +*/ +struct snd_pcm_iec958_params { +/* call under mutex protection, when control is updated by user */ +int (*ctrl_set)(void *pdata,u8 *status); + +struct snd_aes_iec958 *iec; +void *pdata;/* user private data to retrieve context */ +struct mutex *mutex;/* use to avoid race condition */ +}; +int snd_pcm_create_iec958_consumer (struct snd_pcm_runtime *runtime,u8 *cs,size_t len); +int snd_pcm_create_iec958_ctl (struct snd_pcm *pcm, +struct snd_pcm_iec958_params *params,int stream);#endif
sound/core/pcm_iec958.c +107 -0
120 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v3 1/4] ALSA: pcm: add IEC958 channel status control helper
Quoted 5 lines · Arnaud Pouliquen
Add IEC958 channel status helper that creates control to handle the IEC60958 status bits.
Signed-off-by Arnaud Pouliquen <[email protected]>
What is the reason to make the mutex pointer instead of the own one? Any need for sharing the mutex?
And, if it has to be assigned explicitly by user, you have to write it explicitly, too.
Another small nitpicking:
Quoted 43 lines
--- include/sound/pcm_iec958.h | 15 +++++++ sound/core/pcm_iec958.c | 107 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+)include/sound/pcm_iec958.h +15
-0@@ -3,7 +3,22 @@#include <linux/types.h> +/* +* IEC 60958 controls parameters +* Describes channel status and associated callback +*/ +struct snd_pcm_iec958_params { +/* call under mutex protection, when control is updated by user */ +int (*ctrl_set)(void *pdata,u8 *status); + +struct snd_aes_iec958 *iec; +void *pdata;/* user private data to retrieve context */ +struct mutex *mutex;/* use to avoid race condition */ +}; +int snd_pcm_create_iec958_consumer (struct snd_pcm_runtime *runtime,u8 *cs,size_t len); +int snd_pcm_create_iec958_ctl (struct snd_pcm *pcm, +struct snd_pcm_iec958_params *params,int stream);#endif sound/core/pcm_iec958.c +2
-0@@ -7,10 +7,93 @@*/ #include <linux/export.h> #include <linux/types.h> +#include <linux/wait.h> #include <sound/asoundef.h> +#include <sound/control.h>
sound/core/pcm_iec958.c line 22
Quoted 10 lines
sound/core/pcm_iec958.c +7
-0#include <sound/pcm.h> #include <sound/pcm_iec958.h> +int snd_pcm_iec958_info (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_info *uinfo) +{ + uinfo->type =SNDRV_CTL_ELEM_TYPE_IEC958 ; + uinfo->count =1 ; +return 0 ; +}
No static?
sound/core/pcm_iec958.c line 28
Quoted 6 lines
sound/core/pcm_iec958.c +6
-0+ +/** +* IEC958 channel status default controls callbacks +* +* Callbacks are protected by a mutex provided by user. +*/
You don't need the kernel-doc comment "/**" for static functions, in general. It's basically for API, not for internal ones.
Quoted 4 lines
sound/core/pcm_iec958.c +4
-0+static int snd_pcm_iec958_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *uctl) +{ +struct snd_pcm_iec958_params *params =snd_kcontrol_chip (kcontrol);
sound/core/pcm_iec958.c line 42
Quoted 10 lines
sound/core/pcm_iec958.c +10
-0+ +if (!params->mutex) +return -EINVAL ; + +mutex_lock (params->mutex); + uctl->value.iec958.status[0 ] = params->iec->status[0 ]; + uctl->value.iec958.status[1 ] = params->iec->status[1 ]; + uctl->value.iec958.status[2 ] = params->iec->status[2 ]; + uctl->value.iec958.status[3 ] = params->iec->status[3 ]; + uctl->value.iec958.status[4 ] = params->iec->status[4 ];
A loop might be better :) Let compiler optimize it.
Quoted 8 lines
sound/core/pcm_iec958.c +8
-0+mutex_unlock (params->mutex); + +return 0 ; +} + +static int snd_pcm_iec958_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *uctl) +{
sound/core/pcm_iec958.c line 60
Quoted 10 lines
sound/core/pcm_iec958.c +10
-0+struct snd_pcm_iec958_params *params =snd_kcontrol_chip (kcontrol); +int err =0 ; + +if (!params->mutex) +return -EINVAL ; + +mutex_lock (params->mutex); +if (params->ctrl_set) + err = params->ctrl_set (params->pdata, + uctl->value.iec958.status);
So, in your design, ctrl_set isn't mandatory?
Quoted 4 lines
sound/core/pcm_iec958.c +4
-0+if (err <0 ) { +mutex_unlock (params->mutex); +return err; + }
sound/core/pcm_iec958.c line 74
Quoted 10 lines
sound/core/pcm_iec958.c +10
-0+ + params->iec->status[0 ] = uctl->value.iec958.status[0 ]; + params->iec->status[1 ] = uctl->value.iec958.status[1 ]; + params->iec->status[2 ] = uctl->value.iec958.status[2 ]; + params->iec->status[3 ] = uctl->value.iec958.status[3 ]; + params->iec->status[4 ] = uctl->value.iec958.status[4 ]; + +mutex_unlock (params->mutex); + +return 1 ;
Strictly speaking, the return value of put callback should be zero if the value isn't changed. This will avoid the ctl value change notification.
Quoted 26 lines
sound/core/pcm_iec958.c +22
-0+} + +static const struct snd_kcontrol_new iec958_ctls[] = { + { + .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | +SNDRV_CTL_ELEM_ACCESS_VOLATILE ), + .iface =SNDRV_CTL_ELEM_IFACE_PCM , + .name =SNDRV_CTL_NAME_IEC958 ("" ,PLAYBACK ,DEFAULT ), + .info = snd_pcm_iec958_info, + .get = snd_pcm_iec958_get, + .put = snd_pcm_iec958_put, + }, + { + .access = (SNDRV_CTL_ELEM_ACCESS_READ | +SNDRV_CTL_ELEM_ACCESS_VOLATILE ), + .iface =SNDRV_CTL_ELEM_IFACE_PCM , + .name =SNDRV_CTL_NAME_IEC958 ("" ,CAPTURE ,DEFAULT ), + .info = snd_pcm_iec958_info, + .get = snd_pcm_iec958_get, + }, +}; +/** * snd_pcm_create_iec958_consumer - create consumer format IEC958 channel status * @runtime: pcm runtime structure with ->rate filled in
sound/core/pcm_iec958.c int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs, · line 185
Quoted 10 lines
sound/core/pcm_iec958.c +7
-0@@ -93,3 +176,27 @@ int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs,return len; }EXPORT_SYMBOL (snd_pcm_create_iec958_consumer); + +/** +* snd_pcm_create_iec958_ctl - create IEC958 channel status default control +* pcm: pcm device to associate to the control. +* iec958: snd_pcm_iec958_params structure that contains callbacks +* and channel status buffer +* stream: stream type SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CATURE
Put "@" prefix for arguments in kernel-doc.
Quoted 4 lines
sound/core/pcm_iec958.c +4
-0+* Returns: negative error code if something failed. +*/ +int snd_pcm_create_iec958_ctl (struct snd_pcm *pcm, +struct snd_pcm_iec958_params *params,int stream)
sound/core/pcm_iec958.c int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs, · line 199
Quoted 10 lines
sound/core/pcm_iec958.c +10
-0+{ +struct snd_kcontrol_new knew; + +if (stream >SNDRV_PCM_STREAM_LAST ) +return -EINVAL ; + + knew = iec958_ctls[stream]; + knew.device = pcm->device; + knew.index = pcm->device; + knew.count = pcm->streams[stream].substream_count;
Hmm, this doesn't always work. It will create the substream_count ctls starting from the pcm dev# as index. What if there are 2 PCM devices where both contain 4 substreams?
I admit that the current ctl <-> PCM mapping is messing. There are some heuristics and you're trying to follow that. But blindly applying to all cases doesn't seem to work.
thanks,
Takashi
Re: [PATCH v3 1/4] ALSA: pcm: add IEC958 channel status control helper
Quoted 10 lines · Takashi Iwai
Quoted 5 lines · Arnaud Pouliquen
Add IEC958 channel status helper that creates control to handle the IEC60958 status bits.
Signed-off-by Arnaud Pouliquen <[email protected]>What is the reason to make the mutex pointer instead of the own one? Any need for sharing the mutex?
Yes, need to share mutex to avoid race condition between control update and action on pcm stream ( hw_param or prepare)
Quoted 3 lines
And, if it has to be assigned explicitly by user, you have to write it explicitly, too.
ok, if not enough explicit, i will add comment in snd_pcm_iec958_params definition
Quoted 18 lines
Another small nitpicking:
sound/core/pcm_iec958.c line 60
Quoted 13 lines
sound/core/pcm_iec958.c +13
-0+static int snd_pcm_iec958_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *uctl) +{ +struct snd_pcm_iec958_params *params =snd_kcontrol_chip (kcontrol); +int err =0 ; + +if (!params->mutex) +return -EINVAL ; + +mutex_lock (params->mutex); +if (params->ctrl_set) + err = params->ctrl_set (params->pdata, + uctl->value.iec958.status);So, in your design,
ctrl_setisn't mandatory?
Hypothesis is that for some hardwares, callback is not needed, only channels status values are needed. As example some hardwares could not want to support switch from audio to none-audio mode without stopping PCM.
Quoted 18 lines
sound/core/pcm_iec958.c int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs, · line 199
Quoted 13 lines
sound/core/pcm_iec958.c +12
-0+int snd_pcm_create_iec958_ctl (struct snd_pcm *pcm, +struct snd_pcm_iec958_params *params,int stream) +{ +struct snd_kcontrol_new knew; + +if (stream >SNDRV_PCM_STREAM_LAST ) +return -EINVAL ; + + knew = iec958_ctls[stream]; + knew.device = pcm->device; + knew.index = pcm->device; + knew.count = pcm->streams[stream].substream_count;Hmm, this doesn't always work. It will create the
substream_countctls starting from the pcm dev# as index. What if there are 2 PCM devices where both contain 4 substreams?
Quoted 4 lines
I admit that the current ctl <-> PCM mapping is messing. There are some heuristics and you're trying to follow that. But blindly applying to all cases doesn't seem to work.
yes this is not clean.
i'm not very familiar with substream usage, so any suggestion is welcome. The only use case I have in mind is a HDMI connected through 4 I2S data wire...
I can see 2 options:
- Associate control only to pcm device.
- Create a control per sub-device
Do we really need to associate one IEC control per substream?
Thanks
Arnaud
Re: [PATCH v3 1/4] ALSA: pcm: add IEC958 channel status control helper
Quoted 10 lines · Arnaud Pouliquen
Quoted 6 lines · Takashi Iwai
Quoted 4 lines · Arnaud Pouliquen
Add IEC958 channel status helper that creates control to handle the IEC60958 status bits.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Arnaud Pouliquen <[email protected]>What is the reason to make the mutex pointer instead of the own one? Any need for sharing the mutex?
Yes, need to share mutex to avoid race condition between control update and action on pcm stream (
hw_paramor prepare)
Hrm.... I don't know whether this is in a good form. At least, it's a big confusing to me. In general, a mandatory mutex is usually assigned to its own, not referring to an external one.
Quoted 22 lines
Quoted 2 lines
And, if it has to be assigned explicitly by user, you have to write it explicitly, too.
ok, if not enough explicit, i will add comment in
snd_pcm_iec958_paramsdefinitionQuoted 18 lines
Another small nitpicking:
sound/core/pcm_iec958.c line 60
Quoted 13 lines
sound/core/pcm_iec958.c +13
-0+static int snd_pcm_iec958_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *uctl) +{ +struct snd_pcm_iec958_params *params =snd_kcontrol_chip (kcontrol); +int err =0 ; + +if (!params->mutex) +return -EINVAL ; + +mutex_lock (params->mutex); +if (params->ctrl_set) + err = params->ctrl_set (params->pdata, + uctl->value.iec958.status);So, in your design,
ctrl_setisn't mandatory?
Quoted 4 lines
Hypothesis is that for some hardwares, callback is not needed, only channels status values are needed. As example some hardwares could not want to support switch from audio to none-audio mode without stopping PCM.
OK, fair enough. Then put the comment that this callback is optional.
Quoted 29 lines
Quoted 17 lines
sound/core/pcm_iec958.c int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs, · line 199
Quoted 12 lines
sound/core/pcm_iec958.c +12
-0+int snd_pcm_create_iec958_ctl (struct snd_pcm *pcm, +struct snd_pcm_iec958_params *params,int stream) +{ +struct snd_kcontrol_new knew; + +if (stream >SNDRV_PCM_STREAM_LAST ) +return -EINVAL ; + + knew = iec958_ctls[stream]; + knew.device = pcm->device; + knew.index = pcm->device; + knew.count = pcm->streams[stream].substream_count;Hmm, this doesn't always work. It will create the
substream_countctls starting from the pcm dev# as index. What if there are 2 PCM devices where both contain 4 substreams?Quoted 4 lines
I admit that the current ctl <-> PCM mapping is messing. There are some heuristics and you're trying to follow that. But blindly applying to all cases doesn't seem to work.
yes this is not clean.
i'm not very familiar with substream usage, so any suggestion is welcome. The only use case I have in mind is a HDMI connected through 4 I2S data wire...
I can see 2 options:
- Associate control only to pcm device.
- Create a control per sub-device
Quoted 1 line
Do we really need to associate one IEC control per substream?
This pretty much depends on the hardware design. If each substream is really individual, you'd need to give the control for each substream.
I think you can pass the decision to the caller side: instead of defining it in the function there, give via arguments.
Takashi
Re: [PATCH v3 1/4] ALSA: pcm: add IEC958 channel status control helper
Quoted 14 lines · Takashi Iwai
Quoted 12 lines · Arnaud Pouliquen
Quoted 8 lines · Takashi Iwai
Quoted 5 lines · Arnaud Pouliquen
Add IEC958 channel status helper that creates control to handle the IEC60958 status bits.
Signed-off-by Arnaud Pouliquen <[email protected]>
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
What is the reason to make the mutex pointer instead of the own one? Any need for sharing the mutex?
Yes, need to share mutex to avoid race condition between control update and action on pcm stream (
hw_paramor prepare)Hrm.... I don't know whether this is in a good form. At least, it's a big confusing to me. In general, a mandatory mutex is usually assigned to its own, not referring to an external one.
Severals drivers that use this control use a mutex (e.g ac97_codec.c). So need to shared it between driver and the help function. In my first version mutex was optional (used if not null). I have made it mandatory after discussions with Russel.
Forcing driver to use it to avoid race condition make also sense... Now,I have no fixed idea on it, just need a consensus.
Quoted 59 lines
Quoted 22 lines
Quoted 2 lines
And, if it has to be assigned explicitly by user, you have to write it explicitly, too.
ok, if not enough explicit, i will add comment in
snd_pcm_iec958_paramsdefinitionQuoted 18 lines
Another small nitpicking:
sound/core/pcm_iec958.c line 60
Quoted 13 lines
sound/core/pcm_iec958.c +13
-0+static int snd_pcm_iec958_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *uctl) +{ +struct snd_pcm_iec958_params *params =snd_kcontrol_chip (kcontrol); +int err =0 ; + +if (!params->mutex) +return -EINVAL ; + +mutex_lock (params->mutex); +if (params->ctrl_set) + err = params->ctrl_set (params->pdata, + uctl->value.iec958.status);So, in your design,
ctrl_setisn't mandatory?Quoted 4 lines
Hypothesis is that for some hardwares, callback is not needed, only channels status values are needed. As example some hardwares could not want to support switch from audio to none-audio mode without stopping PCM.
OK, fair enough. Then put the comment that this callback is optional.
Quoted 29 lines
Quoted 17 lines
sound/core/pcm_iec958.c int snd_pcm_create_iec958_consumer(struct snd_pcm_runtime *runtime, u8 *cs, · line 199
Quoted 12 lines
sound/core/pcm_iec958.c +12
-0+int snd_pcm_create_iec958_ctl (struct snd_pcm *pcm, +struct snd_pcm_iec958_params *params,int stream) +{ +struct snd_kcontrol_new knew; + +if (stream >SNDRV_PCM_STREAM_LAST ) +return -EINVAL ; + + knew = iec958_ctls[stream]; + knew.device = pcm->device; + knew.index = pcm->device; + knew.count = pcm->streams[stream].substream_count;Hmm, this doesn't always work. It will create the
substream_countctls starting from the pcm dev# as index. What if there are 2 PCM devices where both contain 4 substreams?Quoted 4 lines
I admit that the current ctl <-> PCM mapping is messing. There are some heuristics and you're trying to follow that. But blindly applying to all cases doesn't seem to work.
yes this is not clean.
i'm not very familiar with substream usage, so any suggestion is welcome. The only use case I have in mind is a HDMI connected through 4 I2S data wire...
I can see 2 options:
- Associate control only to pcm device.
- Create a control per sub-device
Quoted 7 lines
Quoted 1 line
Do we really need to associate one IEC control per substream?
This pretty much depends on the hardware design. If each substream is really individual, you'd need to give the control for each substream.
I think you can pass the decision to the caller side: instead of defining it in the function there, give via arguments.
Ok, one argument to determine if control has to be associated to device or sub-devices is sufficient?
or should i define one argument per sub device?
Thanks
Arnaud
PATCH v3 2/4 ASoC: core: add code to complete dai init after pcm creation
In reply to Arnaud PouliquenSome Controls defined in DAI need to be associated to PCM device (e.g. IEC60958).
This allows to perform post initialization in DAI after PCM device creation.
--- include/sound/soc-dai.h | 7 +++++++ sound/soc/soc-core.c | 14 ++++++++++++++ 2 files changed, 21 insertions(+)
include/sound/soc-dai.h +7 -0
@@ -205,6 +205,13 @@ struct snd_soc_dai_ops {*/ snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,struct snd_soc_dai *); + +/* +* function called by soc_probe_link_dais to post initialize DAI +* after pcm device creation. +* As example, can be used to link a controls to the pcm device +*/ +int (*pcm_new)(struct snd_soc_pcm_runtime *,struct snd_soc_dai *); };/*
sound/soc/soc-core.c +14 -0
@@ -1587,6 +1587,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, {struct snd_soc_dai_link *dai_link = rtd->dai_link;struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +const struct snd_soc_dai_ops *ops;int i, ret; dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n",
@@ -1662,6 +1663,19 @@ static int soc_probe_link_dais(struct snd_soc_card *card, } } +for (i =0 ; i < rtd->num_codecs; i++) { + ops = rtd->codec_dais[i]->driver->ops; +if (ops->pcm_new) + ret = ops->pcm_new (rtd, rtd->codec_dais[i]); +if (ret) +return ret; + } + ops = cpu_dai->driver->ops; +if (ops->pcm_new) + ret = ops->pcm_new (rtd, cpu_dai); +if (ret) +return ret; +return 0 ; }
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH v3 2/4] ASoC: core: add code to complete dai init after pcm creation
Quoted 3 lines · Arnaud Pouliquen
Some Controls defined in DAI need to be associated to PCM device (e.g. IEC60958).
This allows to perform post initialization in DAI after PCM device creation.
Rather than add an explicit callback and make drivers open code this I'd prefer to see us either just move the control creation entirely (I can't immediately think of a particular need for the current ordering) or add a data based mechanism like we currently have. Why do we need to do this via a callback?
Re: [PATCH v3 2/4] ASoC: core: add code to complete dai init after pcm creation
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 4 lines · Mark Brown
Quoted 3 lines · Arnaud Pouliquen
Some Controls defined in DAI need to be associated to PCM device (e.g. IEC60958).
Quoted 9 lines
Quoted 2 lines
This allows to perform post initialization in DAI after PCM device creation.
Rather than add an explicit callback and make drivers open code this I'd prefer to see us either just move the control creation entirely (I can't immediately think of a particular need for the current ordering) or add a data based mechanism like we currently have. Why do we need to do this via a callback?
For time being I identify only a need to link controls to pcm device. So no other justification to implement the pcm_new callback.
I implemented the pcm_new callback because straightforward way to handle generic iec958 control proposed in
[PATCH v3 1/4] ALSA: pcm: add IEC958 channel status control helper
Here is an alternative but with higher impact in soc-core:
1)Create 2 helper functions in soc-core:
- snd_soc_add_dai_pcm_controls:
=>register a control that needs to be linked to pcm device.
if dai probed(pcm device exist) => link control to pcm device else postpone link creation in soc_probe_link_dais
- snd_soc_add_dai_iec_control
same but based on snd_pcm_create_iec958_ctrl
2) add 2 news fields in snd-soc-dai struct
struct snd_kcontrol *pcm_kctl /* list control that will be linked to pcm device*/
struct snd_pcm_iec958_params *params /* if not null iec control is created */
Abandon helper function for iec control should simplify implementation but that also makes sense to have helper for this generic control...
Is is sometime that should be more reasonable?
Thanks
Arnaud
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
iQIcBAEBAgAGBQJW1rM1AAoJEP0ZQ+DAfqbfTnYP/3ILQb0WXjIEel9u40UcT5/z eN6kZSurKaNJq0kX3XpORa7USBct0jxXdgaQEsxMMZxLcc2nkJuxOMgHjtEb/EDj 337mRT+TPG/pdg2e/AH+rafNsUSSgZfuyl1LudLmgxasEVk2cTEJTmz287LmNK9O CSp5U8gs0zGnKiUcEdqgSHLdJYNxJJ87kD7i3d510fx1koYjDPxfgxUnhqIKiqTP S9mEC6y0UqD7RfTVBPdYTHk8qGtJjrPvhuR1I8HiEfa/YUonFvvxxP7ec5ic56cv GQ0PYRLhUkH+45OIoB46rfvu2yCNtFbTqBC64QIV8x7FhbI8gLqkMAzvtmyKE2uk sZ9ZWri9HYpo9QNmVfFyqHoR7UcXKI4XmSZ7eVAcAPFlTf9K3dnPYpNPOeJ+lUoH bAj0I+Rq/rpPVEJnhggSqQPeDk6jyFffxZqIx4A3UEIuwgNtIv2QlWzQ7FhTwuGJ FQM94xqfIT5V7e75FPUkPC5ktTCcXFhg7ClLk3frP4kjXzFKg5BcvRsfT1ZyHSd2 hYRwKIqIp8nsgiM5LYO3ujAz3UJDDtbP9dPE4G+foXokvQWsFl15lh2+4Knm1SNv jZ3MXL/PDaTQydTQ8Hs+jL9Xclpk/wFyIgDI9JYHiA1htuWnCvVF6GZCxBBup2jC R1wZ8q8kjN6JFjyaWgYl
=gmEu
-----END PGP SIGNATURE-----
Mark Brown
maintainerRe: [PATCH v3 2/4] ASoC: core: add code to complete dai init after pcm creation
Quoted 8 lines · Arnaud Pouliquen
Here is an alternative but with higher impact in soc-core:
1)Create 2 helper functions in soc-core:
-snd_soc_add_dai_pcm_controls:
=>register a control that needs to be linked to pcm device.
if dai probed(pcm device exist) => link control to pcm device else postpone link creation insoc_probe_link_dais
-snd_soc_add_dai_iec_control
same but based onsnd_pcm_create_iec958_ctrl
The whole point is to avoid functions...
Quoted 8 lines
2) add 2 news fields in snd-soc-dai struct
structsnd_kcontrol*pcm_kctl/* list control that will be linked to pcm device*/
structsnd_pcm_iec958_params*params /* if not null iec control is created */Abandon helper function for iec control should simplify implementation but that also makes sense to have helper for this generic control...
This seems better though I'm confused about what exactly these would be, I've not looked at the first patch since it seemed to have problems.
PATCH v3 3/4 ASoC: sti: use iec channel status control helper
In reply to Arnaud PouliquenUse helper function instead of internal function for iec control
--- sound/soc/sti/Kconfig | 1 + sound/soc/sti/uniperif_player.c | 79 ++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 48 deletions(-)
sound/soc/sti/Kconfig +1 -0
@@ -6,6 +6,7 @@ menuconfig SND_SOC_STI depends on SND_SOC depends on ARCH_STI || COMPILE_TEST select SND_SOC_GENERIC_DMAENGINE_PCM + select SND_PCM_IEC958 help Say Y if you want to enable ASoC-support for any of the STI platforms (e.g. STIH416).
sound/soc/sti/uniperif_player.c +31 -48
138 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 4/4 ASoC: hdmi-codec: add IEC control.
In reply to Arnaud PouliquenCreate 'IEC958 Playback Default' controls to support IEC61937 formats. the use of the alsa control is optional, using 'iec_ctl' flag.
--- include/sound/hdmi-codec.h | 1 + sound/soc/codecs/hdmi-codec.c | 57 ++++++++++++++++++++++++++++++++----------- 2 files changed, 44 insertions(+), 14 deletions(-)
include/sound/hdmi-codec.h +1 -0
@@ -92,6 +92,7 @@ struct hdmi_codec_pdata {const struct hdmi_codec_ops *ops; uint i2s:1; uint spdif:1; + uint iec_ctl:1;int max_i2s_channels; };
sound/soc/codecs/hdmi-codec.c +43 -14
87 lines not on this page · raw message
Signature · 1 line
1.9.1