Lines Matching +full:4 +full:- +full:switch
1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8770.c -- WM8770 ALSA SoC Audio driver
41 { 4, 0x7f },
72 switch (reg) { in wm8770_volatile_reg()
105 regcache_mark_dirty(wm8770->regmap); \
114 static const DECLARE_TLV_DB_SCALE(adc_tlv, -1200, 100, 0);
115 static const DECLARE_TLV_DB_SCALE(dac_dig_tlv, -12750, 50, 1);
116 static const DECLARE_TLV_DB_SCALE(dac_alg_tlv, -12700, 100, 1);
128 SOC_ENUM_DOUBLE(WM8770_DACPHASE, 4, 5, 2, dac_phase_text[2]),
136 SOC_SINGLE("DAC Playback Switch", WM8770_DACMUTE, 4, 1, 1),
137 SOC_SINGLE("DAC Playback ZC Switch", WM8770_DACCTRL1, 0, 1, 0),
142 SOC_SINGLE("VOUT Playback ZC Switch", WM8770_MSALGVOL, 7, 1, 0),
144 /* VOUT1/2/3/4 specific controls */
147 SOC_DOUBLE_R("VOUT1 Playback ZC Switch", WM8770_VOUT1LVOL,
151 SOC_DOUBLE_R("VOUT2 Playback ZC Switch", WM8770_VOUT2LVOL,
155 SOC_DOUBLE_R("VOUT3 Playback ZC Switch", WM8770_VOUT3LVOL,
159 SOC_DOUBLE_R("VOUT4 Playback ZC Switch", WM8770_VOUT4LVOL,
162 /* DAC1/2/3/4 specific controls */
165 SOC_SINGLE("DAC1 Deemphasis Switch", WM8770_DACCTRL2, 0, 1, 0),
169 SOC_SINGLE("DAC2 Deemphasis Switch", WM8770_DACCTRL2, 1, 1, 0),
173 SOC_SINGLE("DAC3 Deemphasis Switch", WM8770_DACCTRL2, 2, 1, 0),
177 SOC_SINGLE("DAC4 Deemphasis Switch", WM8770_DACCTRL2, 3, 1, 0),
183 SOC_DOUBLE_R("Capture Switch", WM8770_ADCLCTRL, WM8770_ADCRCTRL,
187 SOC_SINGLE("ADC 128x Oversampling Switch", WM8770_MSTRCTRL, 3, 1, 0),
188 SOC_SINGLE("ADC Highpass Filter Switch", WM8770_IFACECTRL, 8, 1, 1)
197 WM8770_ADCMUX, 0, 4, ain_text);
203 SOC_DAPM_SINGLE("DAC1 Switch", WM8770_OUTMUX1, 0, 1, 0),
204 SOC_DAPM_SINGLE("AUX1 Switch", WM8770_OUTMUX1, 1, 1, 0),
205 SOC_DAPM_SINGLE("Bypass Switch", WM8770_OUTMUX1, 2, 1, 0)
209 SOC_DAPM_SINGLE("DAC2 Switch", WM8770_OUTMUX1, 3, 1, 0),
210 SOC_DAPM_SINGLE("AUX2 Switch", WM8770_OUTMUX1, 4, 1, 0),
211 SOC_DAPM_SINGLE("Bypass Switch", WM8770_OUTMUX1, 5, 1, 0)
215 SOC_DAPM_SINGLE("DAC3 Switch", WM8770_OUTMUX2, 0, 1, 0),
216 SOC_DAPM_SINGLE("AUX3 Switch", WM8770_OUTMUX2, 1, 1, 0),
217 SOC_DAPM_SINGLE("Bypass Switch", WM8770_OUTMUX2, 2, 1, 0)
221 SOC_DAPM_SINGLE("DAC4 Switch", WM8770_OUTMUX2, 3, 1, 0),
222 SOC_DAPM_SINGLE("Bypass Switch", WM8770_OUTMUX2, 4, 1, 0)
245 SND_SOC_DAPM_DAC("DAC3", "Playback", WM8770_PWDNCTRL, 4, 1),
281 { "VOUT1 Mixer", "DAC1 Switch", "DAC1" },
282 { "VOUT1 Mixer", "AUX1 Switch", "AUX1" },
283 { "VOUT1 Mixer", "Bypass Switch", "Capture Mux" },
286 { "VOUT2 Mixer", "DAC2 Switch", "DAC2" },
287 { "VOUT2 Mixer", "AUX2 Switch", "AUX2" },
288 { "VOUT2 Mixer", "Bypass Switch", "Capture Mux" },
291 { "VOUT3 Mixer", "DAC3 Switch", "DAC3" },
292 { "VOUT3 Mixer", "AUX3 Switch", "AUX3" },
293 { "VOUT3 Mixer", "Bypass Switch", "Capture Mux" },
296 { "VOUT4 Mixer", "DAC4 Switch", "DAC4" },
297 { "VOUT4 Mixer", "Bypass Switch", "Capture Mux" },
308 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in vout12supply_event()
310 switch (event) { in vout12supply_event()
325 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in vout34supply_event()
327 switch (event) { in vout34supply_event()
349 component = dai->component; in wm8770_set_fmt()
351 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { in wm8770_set_fmt()
359 return -EINVAL; in wm8770_set_fmt()
363 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { in wm8770_set_fmt()
373 return -EINVAL; in wm8770_set_fmt()
376 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { in wm8770_set_fmt()
389 return -EINVAL; in wm8770_set_fmt()
418 component = dai->component; in wm8770_hw_params()
422 switch (params_width(params)) { in wm8770_hw_params()
436 switch (substream->stream) { in wm8770_hw_params()
439 shift = 4; in wm8770_hw_params()
446 return -EINVAL; in wm8770_hw_params()
452 ratio = wm8770->sysclk / params_rate(params); in wm8770_hw_params()
458 dev_err(component->dev, in wm8770_hw_params()
460 wm8770->sysclk, params_rate(params)); in wm8770_hw_params()
461 return -EINVAL; in wm8770_hw_params()
464 dev_dbg(component->dev, "MCLK is %dfs\n", mclk_ratios[i]); in wm8770_hw_params()
479 component = dai->component; in wm8770_mute()
481 !!mute << 4); in wm8770_mute()
490 component = dai->component; in wm8770_set_sysclk()
492 wm8770->sysclk = freq; in wm8770_set_sysclk()
504 switch (level) { in wm8770_set_bias_level()
511 ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), in wm8770_set_bias_level()
512 wm8770->supplies); in wm8770_set_bias_level()
514 dev_err(component->dev, in wm8770_set_bias_level()
520 regcache_sync(wm8770->regmap); in wm8770_set_bias_level()
529 regulator_bulk_disable(ARRAY_SIZE(wm8770->supplies), in wm8770_set_bias_level()
530 wm8770->supplies); in wm8770_set_bias_level()
549 .name = "wm8770-hifi",
574 wm8770->component = component; in wm8770_probe()
576 ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), in wm8770_probe()
577 wm8770->supplies); in wm8770_probe()
579 dev_err(component->dev, "Failed to enable supplies: %d\n", ret); in wm8770_probe()
585 dev_err(component->dev, "Failed to issue reset: %d\n", ret); in wm8770_probe()
605 regulator_bulk_disable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); in wm8770_probe()
645 wm8770 = devm_kzalloc(&spi->dev, sizeof(struct wm8770_priv), in wm8770_spi_probe()
648 return -ENOMEM; in wm8770_spi_probe()
650 for (i = 0; i < ARRAY_SIZE(wm8770->supplies); i++) in wm8770_spi_probe()
651 wm8770->supplies[i].supply = wm8770_supply_names[i]; in wm8770_spi_probe()
653 ret = devm_regulator_bulk_get(&spi->dev, ARRAY_SIZE(wm8770->supplies), in wm8770_spi_probe()
654 wm8770->supplies); in wm8770_spi_probe()
656 dev_err(&spi->dev, "Failed to request supplies: %d\n", ret); in wm8770_spi_probe()
660 wm8770->disable_nb[0].notifier_call = wm8770_regulator_event_0; in wm8770_spi_probe()
661 wm8770->disable_nb[1].notifier_call = wm8770_regulator_event_1; in wm8770_spi_probe()
662 wm8770->disable_nb[2].notifier_call = wm8770_regulator_event_2; in wm8770_spi_probe()
665 for (i = 0; i < ARRAY_SIZE(wm8770->supplies); i++) { in wm8770_spi_probe()
667 wm8770->supplies[i].consumer, in wm8770_spi_probe()
668 &wm8770->disable_nb[i]); in wm8770_spi_probe()
670 dev_err(&spi->dev, in wm8770_spi_probe()
676 wm8770->regmap = devm_regmap_init_spi(spi, &wm8770_regmap); in wm8770_spi_probe()
677 if (IS_ERR(wm8770->regmap)) in wm8770_spi_probe()
678 return PTR_ERR(wm8770->regmap); in wm8770_spi_probe()
682 ret = devm_snd_soc_register_component(&spi->dev, in wm8770_spi_probe()