Lines Matching refs:wm
32 static void snd_wm8766_write(struct snd_wm8766 *wm, u16 addr, u16 data) in snd_wm8766_write() argument
35 wm->regs[addr] = data; in snd_wm8766_write()
36 wm->ops.write(wm, addr, data); in snd_wm8766_write()
151 void snd_wm8766_init(struct snd_wm8766 *wm) in snd_wm8766_init() argument
161 memcpy(wm->ctl, snd_wm8766_default_ctl, sizeof(wm->ctl)); in snd_wm8766_init()
163 snd_wm8766_write(wm, WM8766_REG_RESET, 0x00); /* reset */ in snd_wm8766_init()
167 snd_wm8766_write(wm, i, default_values[i]); in snd_wm8766_init()
170 void snd_wm8766_resume(struct snd_wm8766 *wm) in snd_wm8766_resume() argument
175 snd_wm8766_write(wm, i, wm->regs[i]); in snd_wm8766_resume()
178 void snd_wm8766_set_if(struct snd_wm8766 *wm, u16 dac) in snd_wm8766_set_if() argument
180 u16 val = wm->regs[WM8766_REG_IFCTRL] & ~WM8766_IF_MASK; in snd_wm8766_set_if()
183 snd_wm8766_write(wm, WM8766_REG_IFCTRL, val | dac); in snd_wm8766_set_if()
186 void snd_wm8766_volume_restore(struct snd_wm8766 *wm) in snd_wm8766_volume_restore() argument
188 u16 val = wm->regs[WM8766_REG_DACR1]; in snd_wm8766_volume_restore()
190 snd_wm8766_write(wm, WM8766_REG_DACR1, val | WM8766_VOL_UPDATE); in snd_wm8766_volume_restore()
198 struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol); in snd_wm8766_volume_info() local
202 uinfo->count = (wm->ctl[n].flags & WM8766_FLAG_STEREO) ? 2 : 1; in snd_wm8766_volume_info()
203 uinfo->value.integer.min = wm->ctl[n].min; in snd_wm8766_volume_info()
204 uinfo->value.integer.max = wm->ctl[n].max; in snd_wm8766_volume_info()
212 struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol); in snd_wm8766_enum_info() local
215 return snd_ctl_enum_info(uinfo, 1, wm->ctl[n].max, in snd_wm8766_enum_info()
216 wm->ctl[n].enum_names); in snd_wm8766_enum_info()
222 struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol); in snd_wm8766_ctl_get() local
226 if (wm->ctl[n].get) in snd_wm8766_ctl_get()
227 wm->ctl[n].get(wm, &val1, &val2); in snd_wm8766_ctl_get()
229 val1 = wm->regs[wm->ctl[n].reg1] & wm->ctl[n].mask1; in snd_wm8766_ctl_get()
230 val1 >>= __ffs(wm->ctl[n].mask1); in snd_wm8766_ctl_get()
231 if (wm->ctl[n].flags & WM8766_FLAG_STEREO) { in snd_wm8766_ctl_get()
232 val2 = wm->regs[wm->ctl[n].reg2] & wm->ctl[n].mask2; in snd_wm8766_ctl_get()
233 val2 >>= __ffs(wm->ctl[n].mask2); in snd_wm8766_ctl_get()
234 if (wm->ctl[n].flags & WM8766_FLAG_VOL_UPDATE) in snd_wm8766_ctl_get()
238 if (wm->ctl[n].flags & WM8766_FLAG_INVERT) { in snd_wm8766_ctl_get()
239 val1 = wm->ctl[n].max - (val1 - wm->ctl[n].min); in snd_wm8766_ctl_get()
240 if (wm->ctl[n].flags & WM8766_FLAG_STEREO) in snd_wm8766_ctl_get()
241 val2 = wm->ctl[n].max - (val2 - wm->ctl[n].min); in snd_wm8766_ctl_get()
244 if (wm->ctl[n].flags & WM8766_FLAG_STEREO) in snd_wm8766_ctl_get()
253 struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol); in snd_wm8766_ctl_put() local
260 if (wm->ctl[n].flags & WM8766_FLAG_INVERT) { in snd_wm8766_ctl_put()
261 regval1 = wm->ctl[n].max - (regval1 - wm->ctl[n].min); in snd_wm8766_ctl_put()
262 regval2 = wm->ctl[n].max - (regval2 - wm->ctl[n].min); in snd_wm8766_ctl_put()
264 if (wm->ctl[n].set) in snd_wm8766_ctl_put()
265 wm->ctl[n].set(wm, regval1, regval2); in snd_wm8766_ctl_put()
267 val = wm->regs[wm->ctl[n].reg1] & ~wm->ctl[n].mask1; in snd_wm8766_ctl_put()
268 val |= regval1 << __ffs(wm->ctl[n].mask1); in snd_wm8766_ctl_put()
270 if (wm->ctl[n].flags & WM8766_FLAG_STEREO && in snd_wm8766_ctl_put()
271 wm->ctl[n].reg1 == wm->ctl[n].reg2) { in snd_wm8766_ctl_put()
272 val &= ~wm->ctl[n].mask2; in snd_wm8766_ctl_put()
273 val |= regval2 << __ffs(wm->ctl[n].mask2); in snd_wm8766_ctl_put()
275 snd_wm8766_write(wm, wm->ctl[n].reg1, val); in snd_wm8766_ctl_put()
277 if (wm->ctl[n].flags & WM8766_FLAG_STEREO && in snd_wm8766_ctl_put()
278 wm->ctl[n].reg1 != wm->ctl[n].reg2) { in snd_wm8766_ctl_put()
279 val = wm->regs[wm->ctl[n].reg2] & ~wm->ctl[n].mask2; in snd_wm8766_ctl_put()
280 val |= regval2 << __ffs(wm->ctl[n].mask2); in snd_wm8766_ctl_put()
281 if (wm->ctl[n].flags & WM8766_FLAG_VOL_UPDATE) in snd_wm8766_ctl_put()
283 snd_wm8766_write(wm, wm->ctl[n].reg2, val); in snd_wm8766_ctl_put()
290 static int snd_wm8766_add_control(struct snd_wm8766 *wm, int num) in snd_wm8766_add_control() argument
298 cont.name = wm->ctl[num].name; in snd_wm8766_add_control()
300 if (wm->ctl[num].flags & WM8766_FLAG_LIM || in snd_wm8766_add_control()
301 wm->ctl[num].flags & WM8766_FLAG_ALC) in snd_wm8766_add_control()
307 switch (wm->ctl[num].type) { in snd_wm8766_add_control()
311 cont.tlv.p = wm->ctl[num].tlv; in snd_wm8766_add_control()
314 wm->ctl[num].max = 1; in snd_wm8766_add_control()
315 if (wm->ctl[num].flags & WM8766_FLAG_STEREO) in snd_wm8766_add_control()
326 ctl = snd_ctl_new1(&cont, wm); in snd_wm8766_add_control()
329 wm->ctl[num].kctl = ctl; in snd_wm8766_add_control()
331 return snd_ctl_add(wm->card, ctl); in snd_wm8766_add_control()
334 int snd_wm8766_build_controls(struct snd_wm8766 *wm) in snd_wm8766_build_controls() argument
339 if (wm->ctl[i].name) { in snd_wm8766_build_controls()
340 err = snd_wm8766_add_control(wm, i); in snd_wm8766_build_controls()