Message ID | 1445355532-28310-2-git-send-email-vinod.koul@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 10/20/2015 05:38 PM, Vinod Koul wrote: > From: Jeeja KP <jeeja.kp@intel.com> > > For DSPs we can define processing blocks as DAPM PGA widgets. > Some of these proceesing blocks can be configured by usermode > like EQ etc. So we need to add support of kcontrol for PGA > widgets. > > Signed-off-by: Jeeja KP <jeeja.kp@intel.com> > Signed-off-by: Mythri P K <mythri.p.k@intel.com> > Signed-off-by: Vinod Koul <vinod.koul@intel.com> This looks ok ... > --- > sound/soc/soc-dapm.c | 22 +++++++++++++++------- > 1 file changed, 15 insertions(+), 7 deletions(-) > > diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c > index ff8bda471b25..746800380eb7 100644 > --- a/sound/soc/soc-dapm.c > +++ b/sound/soc/soc-dapm.c > @@ -779,8 +779,8 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm, > * Determine if a kcontrol is shared. If it is, look it up. If it isn't, > * create it. Either way, add the widget into the control's widget list > */ > -static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, > - int kci) > +static int dapm_create_or_share_mixmuxpga_kcontrol( ... but maybe just call it dapm_create_or_share_kcontrol() > + struct snd_soc_dapm_widget *w, int kci) > { > struct snd_soc_dapm_context *dapm = w->dapm; > struct snd_card *card = dapm->card->snd_card; > @@ -822,6 +822,10 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, > wname_in_long_name = true; > kcname_in_long_name = false; > break; > + case snd_soc_dapm_pga: This should have the same behavior as mixers and switches, just add the case there instead having a different path. > + wname_in_long_name = true; > + kcname_in_long_name = true; > + break; > default: > return -EINVAL;
On Tue, Oct 20, 2015 at 05:58:46PM +0200, Lars-Peter Clausen wrote: > > -static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, > > - int kci) > > +static int dapm_create_or_share_mixmuxpga_kcontrol( > > ... but maybe just call it dapm_create_or_share_kcontrol() I don't mind that > > > + struct snd_soc_dapm_widget *w, int kci) > > { > > struct snd_soc_dapm_context *dapm = w->dapm; > > struct snd_card *card = dapm->card->snd_card; > > @@ -822,6 +822,10 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, > > wname_in_long_name = true; > > kcname_in_long_name = false; > > break; > > + case snd_soc_dapm_pga: > > This should have the same behavior as mixers and switches, just add the case > there instead having a different path. Oh yes thanks for pointing out that makese better sense, will update in v2.
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ff8bda471b25..746800380eb7 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -779,8 +779,8 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm, * Determine if a kcontrol is shared. If it is, look it up. If it isn't, * create it. Either way, add the widget into the control's widget list */ -static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, - int kci) +static int dapm_create_or_share_mixmuxpga_kcontrol( + struct snd_soc_dapm_widget *w, int kci) { struct snd_soc_dapm_context *dapm = w->dapm; struct snd_card *card = dapm->card->snd_card; @@ -822,6 +822,10 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, wname_in_long_name = true; kcname_in_long_name = false; break; + case snd_soc_dapm_pga: + wname_in_long_name = true; + kcname_in_long_name = true; + break; default: return -EINVAL; } @@ -899,7 +903,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w) continue; if (!w->kcontrols[i]) { - ret = dapm_create_or_share_mixmux_kcontrol(w, i); + ret = dapm_create_or_share_mixmuxpga_kcontrol(w, i); if (ret < 0) return ret; } @@ -952,7 +956,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) return -EINVAL; } - ret = dapm_create_or_share_mixmux_kcontrol(w, 0); + ret = dapm_create_or_share_mixmuxpga_kcontrol(w, 0); if (ret < 0) return ret; @@ -967,9 +971,13 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) /* create new dapm volume control */ static int dapm_new_pga(struct snd_soc_dapm_widget *w) { - if (w->num_kcontrols) - dev_err(w->dapm->dev, - "ASoC: PGA controls not supported: '%s'\n", w->name); + int i, ret; + + for (i = 0; i < w->num_kcontrols; i++) { + ret = dapm_create_or_share_mixmuxpga_kcontrol(w, i); + if (ret < 0) + return ret; + } return 0; }