Lines Matching +full:switch +full:- +full:freq +full:- +full:select
1 // SPDX-License-Identifier: GPL-2.0-only
3 // rt1019.c -- RT1019 ALSA SoC audio amplifier driver
25 #include <sound/soc-dapm.h>
61 switch (reg) { in rt1019_volatile_register()
77 switch (reg) { in rt1019_readable_register()
108 static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -9525, 75, 0);
122 SOC_ENUM("Mono LR Select", rt1019_mono_lr_sel),
128 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in r1019_dac_event()
130 switch (event) { in r1019_dac_event()
159 struct snd_soc_component *component = dai->component; in rt1019_hw_params()
166 rt1019->lrck = params_rate(params); in rt1019_hw_params()
167 pre_div = rl6231_get_clk_info(rt1019->sysclk, rt1019->lrck); in rt1019_hw_params()
169 dev_err(component->dev, "Unsupported clock setting\n"); in rt1019_hw_params()
170 return -EINVAL; in rt1019_hw_params()
175 dev_err(component->dev, "Unsupported frame size: %d\n", frame_size); in rt1019_hw_params()
176 return -EINVAL; in rt1019_hw_params()
180 rt1019->bclk = rt1019->lrck * (32 << bclk_ms); in rt1019_hw_params()
182 dev_dbg(dai->dev, "bclk is %dHz and lrck is %dHz\n", in rt1019_hw_params()
183 rt1019->bclk, rt1019->lrck); in rt1019_hw_params()
184 dev_dbg(dai->dev, "bclk_ms is %d and pre_div is %d for iis %d\n", in rt1019_hw_params()
185 bclk_ms, pre_div, dai->id); in rt1019_hw_params()
187 switch (pre_div) { in rt1019_hw_params()
210 return -EINVAL; in rt1019_hw_params()
213 switch (params_width(params)) { in rt1019_hw_params()
229 return -EINVAL; in rt1019_hw_params()
248 struct snd_soc_component *component = dai->component; in rt1019_set_dai_fmt()
251 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { in rt1019_set_dai_fmt()
258 return -EINVAL; in rt1019_set_dai_fmt()
261 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { in rt1019_set_dai_fmt()
278 return -EINVAL; in rt1019_set_dai_fmt()
290 int clk_id, unsigned int freq, int dir) in rt1019_set_dai_sysclk() argument
292 struct snd_soc_component *component = dai->component; in rt1019_set_dai_sysclk()
296 if (freq == rt1019->sysclk && clk_id == rt1019->sysclk_src) in rt1019_set_dai_sysclk()
299 switch (clk_id) { in rt1019_set_dai_sysclk()
309 dev_err(component->dev, "Invalid clock id (%d)\n", clk_id); in rt1019_set_dai_sysclk()
310 return -EINVAL; in rt1019_set_dai_sysclk()
313 rt1019->sysclk = freq; in rt1019_set_dai_sysclk()
314 rt1019->sysclk_src = clk_id; in rt1019_set_dai_sysclk()
316 dev_dbg(dai->dev, "Sysclk is %dHz and clock id is %d\n", freq, clk_id); in rt1019_set_dai_sysclk()
327 struct snd_soc_component *component = dai->component; in rt1019_set_dai_pll()
333 dev_dbg(component->dev, "PLL disabled\n"); in rt1019_set_dai_pll()
334 rt1019->pll_in = 0; in rt1019_set_dai_pll()
335 rt1019->pll_out = 0; in rt1019_set_dai_pll()
339 if (source == rt1019->pll_src && freq_in == rt1019->pll_in && in rt1019_set_dai_pll()
340 freq_out == rt1019->pll_out) in rt1019_set_dai_pll()
343 switch (source) { in rt1019_set_dai_pll()
355 dev_err(component->dev, "Unknown PLL source %d\n", source); in rt1019_set_dai_pll()
356 return -EINVAL; in rt1019_set_dai_pll()
361 dev_err(component->dev, "Unsupported input clock %d\n", freq_in); in rt1019_set_dai_pll()
365 dev_dbg(component->dev, "bypass=%d m=%d n=%d k=%d\n", in rt1019_set_dai_pll()
382 rt1019->pll_in = freq_in; in rt1019_set_dai_pll()
383 rt1019->pll_out = freq_out; in rt1019_set_dai_pll()
384 rt1019->pll_src = source; in rt1019_set_dai_pll()
392 struct snd_soc_component *component = dai->component; in rt1019_set_tdm_slot()
396 switch (slots) { in rt1019_set_tdm_slot()
409 return -EINVAL; in rt1019_set_tdm_slot()
412 switch (slot_width) { in rt1019_set_tdm_slot()
428 return -EINVAL; in rt1019_set_tdm_slot()
434 ret = -EINVAL; in rt1019_set_tdm_slot()
435 dev_err(component->dev, "too many rx slots or zero slot\n"); in rt1019_set_tdm_slot()
440 * as the starting slot. The users could select the channel from in rt1019_set_tdm_slot()
441 * L/R/L+R by "Mono LR Select" control. in rt1019_set_tdm_slot()
444 switch (first_bit) { in rt1019_set_tdm_slot()
464 ((first_bit - 1) << RT1019_TDM_I2S_TX_L_DAC1_1_SFT) | in rt1019_set_tdm_slot()
468 ret = -EINVAL; in rt1019_set_tdm_slot()
485 rt1019->component = component; in rt1019_probe()
505 .name = "rt1019-aif",
568 rt1019 = devm_kzalloc(&i2c->dev, sizeof(struct rt1019_priv), in rt1019_i2c_probe()
571 return -ENOMEM; in rt1019_i2c_probe()
575 rt1019->regmap = devm_regmap_init_i2c(i2c, &rt1019_regmap); in rt1019_i2c_probe()
576 if (IS_ERR(rt1019->regmap)) { in rt1019_i2c_probe()
577 ret = PTR_ERR(rt1019->regmap); in rt1019_i2c_probe()
578 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", in rt1019_i2c_probe()
583 regmap_read(rt1019->regmap, RT1019_DEV_ID_1, &val); in rt1019_i2c_probe()
584 regmap_read(rt1019->regmap, RT1019_DEV_ID_2, &val2); in rt1019_i2c_probe()
587 dev_err(&i2c->dev, in rt1019_i2c_probe()
589 return -ENODEV; in rt1019_i2c_probe()
592 return devm_snd_soc_register_component(&i2c->dev, in rt1019_i2c_probe()