@@ -599,7 +599,8 @@ int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
const struct snd_kcontrol_new *controls, int num_controls);
int snd_soc_add_dai_pcm_controls(struct snd_soc_dai *dai,
- const struct snd_kcontrol_new *controls, int num_controls);
+ const struct snd_kcontrol_new *controls,
+ int num_controls, void *data);
int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo);
int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
@@ -1606,6 +1606,7 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
struct snd_soc_dai_pcm_ctls {
struct snd_kcontrol_new *controls;
int num_controls;
+ void *controls_data;
struct list_head list;
};
@@ -1623,7 +1624,8 @@ static int soc_link_dai_pcm_controls(struct snd_soc_card *card,
kctl[i].device = rtd->pcm->device;
ret = snd_soc_add_controls(card->snd_card, dai->dev, kctl,
- ctls->num_controls, NULL, dai);
+ ctls->num_controls, NULL,
+ ctls->controls_data);
if (ret < 0)
return ret;
kfree(kctl);
@@ -2387,12 +2389,13 @@ EXPORT_SYMBOL_GPL(snd_soc_add_dai_controls);
* @dai: DAI to add controls to
* @controls: array of controls to add
* @num_controls: number of elements in the array
+ * @data: control private data
*
* Return 0 for success, else error.
*/
int snd_soc_add_dai_pcm_controls(struct snd_soc_dai *dai,
const struct snd_kcontrol_new *controls,
- int num_controls)
+ int num_controls, void *data)
{
struct snd_soc_card *card = dai->component->card;
struct snd_soc_pcm_runtime *rtd;
@@ -2425,13 +2428,14 @@ int snd_soc_add_dai_pcm_controls(struct snd_soc_dai *dai,
for (i = 0; i < num_controls; i++)
kctl[i].device = rtd->pcm->device;
snd_soc_add_controls(card->snd_card, dai->dev, kctl,
- num_controls, NULL, dai);
+ num_controls, NULL, data);
kfree(kctl);
} else {
/* pcm device does not exists. Postpone to dai link creation */
ctls_list = kzalloc(sizeof(*ctls_list), GFP_KERNEL);
ctls_list->controls = kctl;
ctls_list->num_controls = num_controls;
+ ctls_list->controls_data = data;
list_add(&ctls_list->list, &dai->list_pcm_ctl);
}
@@ -97,7 +97,7 @@ static int sti_uniperiph_dai_probe(struct snd_soc_dai *dai)
if (uni->num_ctrls)
return snd_soc_add_dai_pcm_controls(dai, uni->snd_ctrls,
- uni->num_ctrls);
+ uni->num_ctrls, dai);
return 0;
}
To support generic iec958 control implementation, dai needs to provide control private data to allow to retrieve context. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> --- include/sound/soc.h | 3 ++- sound/soc/soc-core.c | 10 +++++++--- sound/soc/sti/sti_uniperif.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-)