Lines Matching +full:dout +full:- +full:default +full:- +full:2

1 // SPDX-License-Identifier: GPL-2.0-only
3 * cs4265.c -- CS4265 ALSA SoC audio driver
25 #include <sound/soc-dapm.h>
61 default: in cs4265_readable_register()
71 default: in cs4265_volatile_register()
76 static DECLARE_TLV_DB_SCALE(pga_tlv, -1200, 50, 0);
78 static DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 0);
108 static SOC_ENUM_SINGLE_DECL(spdif_mono_stereo_enum, CS4265_SPDIF_CTL2, 2,
136 SOC_SINGLE("De-emp 44.1kHz Switch", CS4265_DAC_CTL, 1,
168 SND_SOC_DAPM_AIF_OUT("DOUT", NULL, 0,
175 SND_SOC_DAPM_ADC("ADC", NULL, CS4265_PWRCTL, 2, 1),
176 SND_SOC_DAPM_PGA("Pre-amp MIC", CS4265_PWRCTL, 3,
219 {"Pre-amp MIC", NULL, "MICL"},
220 {"Pre-amp MIC", NULL, "MICR"},
221 {"ADC Mux", "MIC", "Pre-amp MIC"},
225 {"DOUT", NULL, "ADC"},
226 {"DAI1 Capture", NULL, "DOUT"},
227 {"DAI2 Capture", NULL, "DOUT"},
237 u8 fm_mode; /* values 1, 2, or 4 */
245 {16384000, 32000, 0, 2},
252 {22579200, 44100, 0, 2},
259 {24576000, 48000, 0, 2},
266 {16934400, 64000, 1, 2},
273 {22579200, 88200, 1, 2},
280 {24576000, 96000, 1, 2},
285 {8192000, 128000, 2, 0},
286 {12288000, 128000, 2, 1},
287 {16934400, 128000, 2, 2},
288 {24576000, 128000, 2, 3},
289 {32768000, 128000, 2, 4},
292 {11289600, 176400, 2, 0},
293 {16934400, 176400, 2, 1},
294 {22579200, 176400, 2, 2},
295 {33868000, 176400, 2, 3},
296 {49152000, 176400, 2, 4},
299 {12288000, 192000, 2, 0},
300 {18432000, 192000, 2, 1},
301 {24576000, 192000, 2, 2},
302 {36864000, 192000, 2, 3},
303 {49152000, 192000, 2, 4},
315 return -EINVAL; in cs4265_get_clk_index()
321 struct snd_soc_component *component = codec_dai->component; in cs4265_set_sysclk()
326 dev_err(component->dev, "Invalid clk_id %d\n", clk_id); in cs4265_set_sysclk()
327 return -EINVAL; in cs4265_set_sysclk()
331 cs4265->sysclk = freq; in cs4265_set_sysclk()
335 cs4265->sysclk = 0; in cs4265_set_sysclk()
336 dev_err(component->dev, "Invalid freq parameter %d\n", freq); in cs4265_set_sysclk()
337 return -EINVAL; in cs4265_set_sysclk()
342 struct snd_soc_component *component = codec_dai->component; in cs4265_set_fmt()
357 default: in cs4265_set_fmt()
358 return -EINVAL; in cs4265_set_fmt()
372 default: in cs4265_set_fmt()
373 return -EINVAL; in cs4265_set_fmt()
376 cs4265->format = iface; in cs4265_set_fmt()
382 struct snd_soc_component *component = dai->component; in cs4265_mute()
406 struct snd_soc_component *component = dai->component; in cs4265_pcm_hw_params()
410 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && in cs4265_pcm_hw_params()
411 ((cs4265->format & SND_SOC_DAIFMT_FORMAT_MASK) in cs4265_pcm_hw_params()
413 return -EINVAL; in cs4265_pcm_hw_params()
415 index = cs4265_get_clk_index(cs4265->sysclk, params_rate(params)); in cs4265_pcm_hw_params()
424 dev_err(component->dev, "can't get correct mclk\n"); in cs4265_pcm_hw_params()
425 return -EINVAL; in cs4265_pcm_hw_params()
428 switch (cs4265->format & SND_SOC_DAIFMT_FORMAT_MASK) { in cs4265_pcm_hw_params()
440 CS4265_DAC_CTL_DIF, (2 << 4)); in cs4265_pcm_hw_params()
442 CS4265_SPDIF_CTL2_DIF, (2 << 6)); in cs4265_pcm_hw_params()
459 default: in cs4265_pcm_hw_params()
460 return -EINVAL; in cs4265_pcm_hw_params()
508 .name = "cs4265-dai1",
512 .channels_max = 2,
519 .channels_max = 2,
526 .name = "cs4265-dai2",
530 .channels_max = 2,
537 .channels_max = 2,
577 cs4265 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4265_private), in cs4265_i2c_probe()
580 return -ENOMEM; in cs4265_i2c_probe()
582 cs4265->regmap = devm_regmap_init_i2c(i2c_client, &cs4265_regmap); in cs4265_i2c_probe()
583 if (IS_ERR(cs4265->regmap)) { in cs4265_i2c_probe()
584 ret = PTR_ERR(cs4265->regmap); in cs4265_i2c_probe()
585 dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret); in cs4265_i2c_probe()
589 cs4265->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev, in cs4265_i2c_probe()
591 if (IS_ERR(cs4265->reset_gpio)) in cs4265_i2c_probe()
592 return PTR_ERR(cs4265->reset_gpio); in cs4265_i2c_probe()
594 if (cs4265->reset_gpio) { in cs4265_i2c_probe()
596 gpiod_set_value_cansleep(cs4265->reset_gpio, 1); in cs4265_i2c_probe()
601 ret = regmap_read(cs4265->regmap, CS4265_CHIP_ID, &reg); in cs4265_i2c_probe()
603 dev_err(&i2c_client->dev, "Failed to read chip ID: %d\n", ret); in cs4265_i2c_probe()
609 ret = -ENODEV; in cs4265_i2c_probe()
610 dev_err(&i2c_client->dev, in cs4265_i2c_probe()
615 dev_info(&i2c_client->dev, in cs4265_i2c_probe()
619 regmap_write(cs4265->regmap, CS4265_PWRCTL, 0x0F); in cs4265_i2c_probe()
621 return devm_snd_soc_register_component(&i2c_client->dev, in cs4265_i2c_probe()
630 if (cs4265->reset_gpio) in cs4265_i2c_remove()
631 gpiod_set_value_cansleep(cs4265->reset_gpio, 0); in cs4265_i2c_remove()