Skip to contentSkip to conversation

ASoC: dapm: add code to configure dai link parameters

PATCH Superseded Nikesh Oswal 2 participants 2 messages Sep 11, 2014

Subsystems (2)

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 ASoC: dapm: add code to configure dai link parameters

dai-link params for codec-codec links were fixed. The fixed link between codec and another chip which may be another codec, baseband, bluetooth codec etc may require run time configuaration changes. This change provides an optional alsa control to select one of the params from a list of params.

---
 include/sound/soc-dapm.h |    3 +
 include/sound/soc.h      |    1 +
 sound/soc/soc-core.c     |    6 +-
 sound/soc/soc-dapm.c     |  143 ++++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 146 insertions(+), 7 deletions(-)
include/sound/soc-dapm.h +3 -0
index 6b59471..3ee031e 100644
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
 int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 			 const struct snd_soc_pcm_stream *params,
+			 unsigned int num_params,
 			 struct snd_soc_dapm_widget *source,
 			 struct snd_soc_dapm_widget *sink);
 
@@ -531,6 +532,8 @@ struct snd_soc_dapm_widget {
 	void *priv;				/* widget specific data */
 	struct regulator *regulator;		/* attached regulator */
 	const struct snd_soc_pcm_stream *params; /* params for dai links */
+	unsigned int num_params; /* number of params for dai links */
+	unsigned int params_select; /* currently selected param for dai link */
 
 	/* dapm control */
 	int reg;				/* negative reg = no direct dapm */
include/sound/soc.h +1 -0
index ed9e2d7..51c6c4f 100644
@@ -906,6 +906,7 @@ struct snd_soc_dai_link {
 	int be_id;	/* optional ID for machine driver BE identification */
 
 	const struct snd_soc_pcm_stream *params;
+	unsigned int num_params;
 
 	unsigned int dai_fmt;           /* format to set on init */
 
sound/soc/soc-core.c +4 -2
index b87d7d8..1db2168 100644
@@ -1461,7 +1461,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
 	capture_w = cpu_dai->capture_widget;
 	if (play_w && capture_w) {
 		ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-					   capture_w, play_w);
+					   dai_link->num_params, capture_w,
+					   play_w);
 		if (ret != 0) {
 			dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
 				play_w->name, capture_w->name, ret);
@@ -1473,7 +1474,8 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
 	capture_w = codec_dai->capture_widget;
 	if (play_w && capture_w) {
 		ret = snd_soc_dapm_new_pcm(card, dai_link->params,
-					   capture_w, play_w);
+					   dai_link->num_params, capture_w,
+					   play_w);
 		if (ret != 0) {
 			dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
 				play_w->name, capture_w->name, ret);
sound/soc/soc-dapm.c +138 -5

199 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

sound/soc/soc-dapm.c static int dapm_new_pga(struct snd_soc_dapm_widget *w) · line 748

Quoted 5 lines · Nikesh Oswal
sound/soc/soc-dapm.c +5 -0
+	/* add kcontrol */
+	for (i = 0; i < w->num_kcontrols; i++) {
+		kcontrol = snd_soc_cnew(&w->kcontrol_news[i], w,
+		w->name, NULL);
+		ret = snd_ctl_add(card, kcontrol);

*sigh* As I wrote before in response to exactly the same code:

| Throughout this you've got coding style problems, you're not indenting
| the continuations of multi-line statements.  Please try to follow the
| kernel coding style, if your code is visibly different to the rest of
| the codebase that's not good.

Please pay attention to review comments, just completely ignoring them isn't good. If you don't feel some change should be made then reply and discuss.