Lines Matching +full:single +full:- +full:ended
53 /* -127.5dB to 0dB with step of 0.5dB */
54 static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
55 /* -64dB to 24dB with step of 0.5dB */
56 static const DECLARE_TLV_DB_SCALE(adc_tlv, -6400, 50, 0);
58 static const char *const cs42xx8_adc_single[] = { "Differential", "Single-Ended" };
83 CS42XX8_VOLAIN2, 0, -0x80, 0x30, 7, 0, adc_tlv),
85 CS42XX8_VOLAIN4, 0, -0x80, 0x30, 7, 0, adc_tlv),
92 SOC_SINGLE("ADC High-Pass Filter Switch", CS42XX8_ADCCTL, 7, 1, 1),
93 SOC_SINGLE("DAC De-emphasis Switch", CS42XX8_ADCCTL, 5, 1, 0),
94 SOC_ENUM("ADC1 Single Ended Mode Switch", adc1_single_enum),
95 SOC_ENUM("ADC2 Single Ended Mode Switch", adc2_single_enum),
96 SOC_SINGLE("DAC Single Volume Control Switch", CS42XX8_TXCTL, 7, 1, 0),
100 SOC_SINGLE("ADC Single Volume Control Switch", CS42XX8_TXCTL, 2, 1, 0),
106 CS42XX8_VOLAIN6, 0, -0x80, 0x30, 7, 0, adc_tlv),
108 SOC_ENUM("ADC3 Single Ended Mode Switch", adc3_single_enum),
206 struct snd_soc_component *component = codec_dai->component; in cs42xx8_set_dai_sysclk()
209 cs42xx8->sysclk = freq; in cs42xx8_set_dai_sysclk()
217 struct snd_soc_component *component = codec_dai->component; in cs42xx8_set_dai_fmt()
236 dev_err(component->dev, "unsupported dai format\n"); in cs42xx8_set_dai_fmt()
237 return -EINVAL; in cs42xx8_set_dai_fmt()
240 regmap_update_bits(cs42xx8->regmap, CS42XX8_INTF, in cs42xx8_set_dai_fmt()
247 cs42xx8->slave_mode = true; in cs42xx8_set_dai_fmt()
250 cs42xx8->slave_mode = false; in cs42xx8_set_dai_fmt()
253 dev_err(component->dev, "unsupported master/slave mode\n"); in cs42xx8_set_dai_fmt()
254 return -EINVAL; in cs42xx8_set_dai_fmt()
264 struct snd_soc_component *component = dai->component; in cs42xx8_hw_params()
266 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in cs42xx8_hw_params()
274 cs42xx8->tx_channels = params_channels(params); in cs42xx8_hw_params()
277 rate[!tx] = cs42xx8->rate[!tx]; in cs42xx8_hw_params()
279 ratio[tx] = rate[tx] > 0 ? cs42xx8->sysclk / rate[tx] : 0; in cs42xx8_hw_params()
280 ratio[!tx] = rate[!tx] > 0 ? cs42xx8->sysclk / rate[!tx] : 0; in cs42xx8_hw_params()
284 if (cs42xx8->slave_mode) { in cs42xx8_hw_params()
294 dev_err(component->dev, in cs42xx8_hw_params()
296 return -EINVAL; in cs42xx8_hw_params()
308 cs42xx8->sysclk >= cs42xx8_ratios[i].min_mclk && in cs42xx8_hw_params()
309 cs42xx8->sysclk <= cs42xx8_ratios[i].max_mclk; in cs42xx8_hw_params()
333 dev_err(component->dev, "unsupported sysclk ratio\n"); in cs42xx8_hw_params()
334 return -EINVAL; in cs42xx8_hw_params()
337 cs42xx8->rate[tx] = params_rate(params); in cs42xx8_hw_params()
342 regmap_update_bits(cs42xx8->regmap, CS42XX8_FUNCMOD, in cs42xx8_hw_params()
352 struct snd_soc_component *component = dai->component; in cs42xx8_hw_free()
354 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in cs42xx8_hw_free()
357 cs42xx8->rate[tx] = 0; in cs42xx8_hw_free()
359 regmap_update_bits(cs42xx8->regmap, CS42XX8_FUNCMOD, in cs42xx8_hw_free()
367 struct snd_soc_component *component = dai->component; in cs42xx8_mute()
369 u8 dac_unmute = cs42xx8->tx_channels ? in cs42xx8_mute()
370 ~((0x1 << cs42xx8->tx_channels) - 1) : 0; in cs42xx8_mute()
372 regmap_write(cs42xx8->regmap, CS42XX8_DACMUTE, in cs42xx8_mute()
408 { 0x05, 0x00 }, /* ADC Control & DAC De-Emphasis */
471 switch (cs42xx8->drvdata->num_adcs) { in cs42xx8_component_probe()
485 regmap_write(cs42xx8->regmap, CS42XX8_DACMUTE, CS42XX8_DACMUTE_ALL); in cs42xx8_component_probe()
536 return -ENOMEM; in cs42xx8_probe()
538 cs42xx8->regmap = regmap; in cs42xx8_probe()
543 cs42xx8->drvdata = of_id->data; in cs42xx8_probe()
545 if (!cs42xx8->drvdata) { in cs42xx8_probe()
547 return -EINVAL; in cs42xx8_probe()
550 cs42xx8->gpiod_reset = devm_gpiod_get_optional(dev, "reset", in cs42xx8_probe()
552 if (IS_ERR(cs42xx8->gpiod_reset)) in cs42xx8_probe()
553 return PTR_ERR(cs42xx8->gpiod_reset); in cs42xx8_probe()
555 gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 0); in cs42xx8_probe()
557 cs42xx8->clk = devm_clk_get(dev, "mclk"); in cs42xx8_probe()
558 if (IS_ERR(cs42xx8->clk)) { in cs42xx8_probe()
560 PTR_ERR(cs42xx8->clk)); in cs42xx8_probe()
561 return -EINVAL; in cs42xx8_probe()
564 cs42xx8->sysclk = clk_get_rate(cs42xx8->clk); in cs42xx8_probe()
566 for (i = 0; i < ARRAY_SIZE(cs42xx8->supplies); i++) in cs42xx8_probe()
567 cs42xx8->supplies[i].supply = cs42xx8_supply_names[i]; in cs42xx8_probe()
570 ARRAY_SIZE(cs42xx8->supplies), cs42xx8->supplies); in cs42xx8_probe()
576 ret = regulator_bulk_enable(ARRAY_SIZE(cs42xx8->supplies), in cs42xx8_probe()
577 cs42xx8->supplies); in cs42xx8_probe()
587 ret = regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val); in cs42xx8_probe()
597 ret = -EINVAL; in cs42xx8_probe()
604 cs42xx8_dai.name = cs42xx8->drvdata->name; in cs42xx8_probe()
607 cs42xx8_dai.capture.channels_max = cs42xx8->drvdata->num_adcs * 2; in cs42xx8_probe()
615 regcache_cache_only(cs42xx8->regmap, true); in cs42xx8_probe()
618 regulator_bulk_disable(ARRAY_SIZE(cs42xx8->supplies), in cs42xx8_probe()
619 cs42xx8->supplies); in cs42xx8_probe()
631 ret = clk_prepare_enable(cs42xx8->clk); in cs42xx8_runtime_resume()
637 gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 0); in cs42xx8_runtime_resume()
639 ret = regulator_bulk_enable(ARRAY_SIZE(cs42xx8->supplies), in cs42xx8_runtime_resume()
640 cs42xx8->supplies); in cs42xx8_runtime_resume()
649 regcache_cache_only(cs42xx8->regmap, false); in cs42xx8_runtime_resume()
650 regcache_mark_dirty(cs42xx8->regmap); in cs42xx8_runtime_resume()
652 ret = regcache_sync(cs42xx8->regmap); in cs42xx8_runtime_resume()
661 regulator_bulk_disable(ARRAY_SIZE(cs42xx8->supplies), in cs42xx8_runtime_resume()
662 cs42xx8->supplies); in cs42xx8_runtime_resume()
664 clk_disable_unprepare(cs42xx8->clk); in cs42xx8_runtime_resume()
673 regcache_cache_only(cs42xx8->regmap, true); in cs42xx8_runtime_suspend()
675 regulator_bulk_disable(ARRAY_SIZE(cs42xx8->supplies), in cs42xx8_runtime_suspend()
676 cs42xx8->supplies); in cs42xx8_runtime_suspend()
678 gpiod_set_value_cansleep(cs42xx8->gpiod_reset, 1); in cs42xx8_runtime_suspend()
680 clk_disable_unprepare(cs42xx8->clk); in cs42xx8_runtime_suspend()