Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: Factor out control notification support

Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>:

This series introduces and uses a helper for notifying control changes
to userspace.

+29 -28
+4
include/sound/soc-component.h
··· 454 454 struct snd_soc_component *component, 455 455 const char *pin); 456 456 457 + /* component controls */ 458 + int snd_soc_component_notify_control(struct snd_soc_component *component, 459 + const char * const ctl); 460 + 457 461 /* component driver ops */ 458 462 int snd_soc_component_open(struct snd_soc_component *component, 459 463 struct snd_pcm_substream *substream);
+2 -9
sound/soc/codecs/ak4118.c
··· 264 264 struct ak4118_priv *ak4118 = data; 265 265 struct snd_soc_component *component = ak4118->component; 266 266 struct snd_kcontrol_new *kctl_new; 267 - struct snd_kcontrol *kctl; 268 - struct snd_ctl_elem_id *id; 269 267 unsigned int i; 270 268 271 269 if (!component) ··· 271 273 272 274 for (i = 0; i < ARRAY_SIZE(ak4118_iec958_controls); i++) { 273 275 kctl_new = &ak4118_iec958_controls[i]; 274 - kctl = snd_soc_card_get_kcontrol(component->card, 275 - kctl_new->name); 276 - if (!kctl) 277 - continue; 278 - id = &kctl->id; 279 - snd_ctl_notify(component->card->snd_card, 280 - SNDRV_CTL_EVENT_MASK_VALUE, id); 276 + 277 + snd_soc_component_notify_control(component, kctl_new->name); 281 278 } 282 279 283 280 return IRQ_HANDLED;
+1 -19
sound/soc/codecs/wm_adsp.c
··· 686 686 { 687 687 struct cs_dsp_coeff_ctl *cs_ctl = cs_dsp_get_ctl(&dsp->cs_dsp, name, type, alg); 688 688 struct wm_coeff_ctl *ctl; 689 - struct snd_kcontrol *kcontrol; 690 - char ctl_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 691 689 int ret; 692 690 693 691 ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len); ··· 697 699 698 700 ctl = cs_ctl->priv; 699 701 700 - if (dsp->component->name_prefix) 701 - snprintf(ctl_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s %s", 702 - dsp->component->name_prefix, ctl->name); 703 - else 704 - snprintf(ctl_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s", 705 - ctl->name); 706 - 707 - kcontrol = snd_soc_card_get_kcontrol(dsp->component->card, ctl_name); 708 - if (!kcontrol) { 709 - adsp_err(dsp, "Can't find kcontrol %s\n", ctl_name); 710 - return -EINVAL; 711 - } 712 - 713 - snd_ctl_notify(dsp->component->card->snd_card, 714 - SNDRV_CTL_EVENT_MASK_VALUE, &kcontrol->id); 715 - 716 - return 0; 702 + return snd_soc_component_notify_control(dsp->component, ctl->name); 717 703 } 718 704 EXPORT_SYMBOL_GPL(wm_adsp_write_ctl); 719 705
+22
sound/soc/soc-component.c
··· 236 236 } 237 237 EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked); 238 238 239 + int snd_soc_component_notify_control(struct snd_soc_component *component, 240 + const char * const ctl) 241 + { 242 + char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 243 + struct snd_kcontrol *kctl; 244 + 245 + if (component->name_prefix) 246 + snprintf(name, ARRAY_SIZE(name), "%s %s", component->name_prefix, ctl); 247 + else 248 + snprintf(name, ARRAY_SIZE(name), "%s", ctl); 249 + 250 + kctl = snd_soc_card_get_kcontrol(component->card, name); 251 + if (!kctl) 252 + return soc_component_ret(component, -EINVAL); 253 + 254 + snd_ctl_notify(component->card->snd_card, 255 + SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); 256 + 257 + return 0; 258 + } 259 + EXPORT_SYMBOL_GPL(snd_soc_component_notify_control); 260 + 239 261 /** 240 262 * snd_soc_component_set_jack - configure component jack. 241 263 * @component: COMPONENTs