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.

ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly

DSP controls are exposed as ALSA controls, however,
some of these controls are required to be accessed by
the driver. Add apis which allow read/write of these
controls. The write api will also notify the ALSA control
on value change.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220630002335.366545-3-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Stefan Binding and committed by
Takashi Iwai
e414b05e 3233b978

+43
+39
sound/pci/hda/hda_cs_dsp_ctl.c
··· 188 188 } 189 189 EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_control_remove, SND_HDA_CS_DSP_CONTROLS); 190 190 191 + int hda_cs_dsp_write_ctl(struct cs_dsp *dsp, const char *name, int type, 192 + unsigned int alg, const void *buf, size_t len) 193 + { 194 + struct cs_dsp_coeff_ctl *cs_ctl; 195 + struct hda_cs_dsp_coeff_ctl *ctl; 196 + int ret; 197 + 198 + cs_ctl = cs_dsp_get_ctl(dsp, name, type, alg); 199 + if (!cs_ctl) 200 + return -EINVAL; 201 + 202 + ctl = cs_ctl->priv; 203 + 204 + ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len); 205 + if (ret) 206 + return ret; 207 + 208 + if (cs_ctl->flags & WMFW_CTL_FLAG_SYS) 209 + return 0; 210 + 211 + snd_ctl_notify(ctl->card, SNDRV_CTL_EVENT_MASK_VALUE, &ctl->kctl->id); 212 + 213 + return 0; 214 + } 215 + EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_write_ctl, SND_HDA_CS_DSP_CONTROLS); 216 + 217 + int hda_cs_dsp_read_ctl(struct cs_dsp *dsp, const char *name, int type, 218 + unsigned int alg, void *buf, size_t len) 219 + { 220 + struct cs_dsp_coeff_ctl *cs_ctl; 221 + 222 + cs_ctl = cs_dsp_get_ctl(dsp, name, type, alg); 223 + if (!cs_ctl) 224 + return -EINVAL; 225 + 226 + return cs_dsp_coeff_read_ctrl(cs_ctl, 0, buf, len); 227 + } 228 + EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_read_ctl, SND_HDA_CS_DSP_CONTROLS); 229 + 191 230 MODULE_DESCRIPTION("CS_DSP ALSA Control HDA Library"); 192 231 MODULE_AUTHOR("Stefan Binding, <sbinding@opensource.cirrus.com>"); 193 232 MODULE_LICENSE("GPL");
+4
sound/pci/hda/hda_cs_dsp_ctl.h
··· 29 29 30 30 int hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl, struct hda_cs_dsp_ctl_info *info); 31 31 void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl); 32 + int hda_cs_dsp_write_ctl(struct cs_dsp *dsp, const char *name, int type, 33 + unsigned int alg, const void *buf, size_t len); 34 + int hda_cs_dsp_read_ctl(struct cs_dsp *dsp, const char *name, int type, 35 + unsigned int alg, void *buf, size_t len); 32 36 33 37 #endif /*__HDA_CS_DSP_CTL_H__*/