Lines Matching +full:de +full:- +full:assertion
1 // SPDX-License-Identifier: GPL-2.0-only
108 static const char *const pcm3168a_con[] = { "Differential", "Single-Ended" };
126 /* -100db to 0db, register values 0-54 cause mute */
127 static const DECLARE_TLV_DB_SCALE(pcm3168a_dac_tlv, -10050, 50, 1);
129 /* -100db to 20db, register values 0-14 cause mute */
130 static const DECLARE_TLV_DB_SCALE(pcm3168a_adc_tlv, -10050, 50, 1);
133 SOC_SINGLE("DAC Power-Save Switch", PCM3168A_DAC_PWR_MST_FMT,
135 SOC_ENUM("DAC1 Digital Filter roll-off", pcm3168a_d1_roll_off),
136 SOC_ENUM("DAC2 Digital Filter roll-off", pcm3168a_d2_roll_off),
137 SOC_ENUM("DAC3 Digital Filter roll-off", pcm3168a_d3_roll_off),
138 SOC_ENUM("DAC4 Digital Filter roll-off", pcm3168a_d4_roll_off),
145 SOC_ENUM("DAC De-Emphasis", pcm3168a_dac_demp),
167 SOC_SINGLE("ADC1 High-Pass Filter Switch", PCM3168A_ADC_PWR_HPFB,
169 SOC_SINGLE("ADC2 High-Pass Filter Switch", PCM3168A_ADC_PWR_HPFB,
171 SOC_SINGLE("ADC3 High-Pass Filter Switch", PCM3168A_ADC_PWR_HPFB,
271 #define PCM3168A_NUM_SCKI_RATIOS_ADC (ARRAY_SIZE(pcm3168a_scki_ratios) - 2)
279 ret = regmap_write(pcm3168a->regmap, PCM3168A_RST_SMODE, 0); in pcm3168a_reset()
283 /* Internal reset is de-asserted after 3846 SCKI cycles */ in pcm3168a_reset()
284 msleep(DIV_ROUND_UP(3846 * 1000, pcm3168a->sysclk)); in pcm3168a_reset()
286 return regmap_write(pcm3168a->regmap, PCM3168A_RST_SMODE, in pcm3168a_reset()
292 struct snd_soc_component *component = dai->component; in pcm3168a_mute()
295 regmap_write(pcm3168a->regmap, PCM3168A_DAC_MUTE, mute ? 0xff : 0); in pcm3168a_mute()
303 struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(dai->component); in pcm3168a_set_dai_sysclk()
314 return -EINVAL; in pcm3168a_set_dai_sysclk()
316 ret = clk_set_rate(pcm3168a->scki, freq); in pcm3168a_set_dai_sysclk()
320 pcm3168a->sysclk = freq; in pcm3168a_set_dai_sysclk()
327 struct snd_soc_component *component = dai->component; in pcm3168a_update_fixup_pcm_stream()
329 struct pcm3168a_io_params *io_params = &pcm3168a->io_params[dai->id]; in pcm3168a_update_fixup_pcm_stream()
331 unsigned int channel_max = dai->id == PCM3168A_DAI_DAC ? 8 : 6; in pcm3168a_update_fixup_pcm_stream()
333 if (io_params->format == SND_SOC_DAIFMT_RIGHT_J) { in pcm3168a_update_fixup_pcm_stream()
341 if (io_params->tdm_slots != 2) in pcm3168a_update_fixup_pcm_stream()
345 if (dai->id == PCM3168A_DAI_DAC) { in pcm3168a_update_fixup_pcm_stream()
346 dai->driver->playback.channels_max = channel_max; in pcm3168a_update_fixup_pcm_stream()
347 dai->driver->playback.formats = formats; in pcm3168a_update_fixup_pcm_stream()
349 dai->driver->capture.channels_max = channel_max; in pcm3168a_update_fixup_pcm_stream()
350 dai->driver->capture.formats = formats; in pcm3168a_update_fixup_pcm_stream()
356 struct snd_soc_component *component = dai->component; in pcm3168a_set_dai_fmt()
358 struct pcm3168a_io_params *io_params = &pcm3168a->io_params[dai->id]; in pcm3168a_set_dai_fmt()
369 dev_err(component->dev, "unsupported dai format\n"); in pcm3168a_set_dai_fmt()
370 return -EINVAL; in pcm3168a_set_dai_fmt()
381 dev_err(component->dev, "unsupported provider mode\n"); in pcm3168a_set_dai_fmt()
382 return -EINVAL; in pcm3168a_set_dai_fmt()
389 return -EINVAL; in pcm3168a_set_dai_fmt()
392 io_params->provider_mode = provider_mode; in pcm3168a_set_dai_fmt()
393 io_params->format = format & SND_SOC_DAIFMT_FORMAT_MASK; in pcm3168a_set_dai_fmt()
404 struct snd_soc_component *component = dai->component; in pcm3168a_set_tdm_slot()
406 struct pcm3168a_io_params *io_params = &pcm3168a->io_params[dai->id]; in pcm3168a_set_tdm_slot()
409 dev_err(component->dev, in pcm3168a_set_tdm_slot()
412 return -EINVAL; in pcm3168a_set_tdm_slot()
417 dev_err(component->dev, "Unsupported slot_width %d\n", in pcm3168a_set_tdm_slot()
419 return -EINVAL; in pcm3168a_set_tdm_slot()
422 io_params->tdm_slots = slots; in pcm3168a_set_tdm_slot()
423 io_params->slot_width = slot_width; in pcm3168a_set_tdm_slot()
425 if (dai->id == PCM3168A_DAI_DAC) in pcm3168a_set_tdm_slot()
426 io_params->tdm_mask = tx_mask; in pcm3168a_set_tdm_slot()
428 io_params->tdm_mask = rx_mask; in pcm3168a_set_tdm_slot()
439 struct snd_soc_component *component = dai->component; in pcm3168a_hw_params()
441 struct pcm3168a_io_params *io_params = &pcm3168a->io_params[dai->id]; in pcm3168a_hw_params()
447 if (dai->id == PCM3168A_DAI_DAC) { in pcm3168a_hw_params()
461 provider_mode = io_params->provider_mode; in pcm3168a_hw_params()
464 ratio = pcm3168a->sysclk / params_rate(params); in pcm3168a_hw_params()
472 dev_err(component->dev, "unsupported sysclk ratio\n"); in pcm3168a_hw_params()
473 return -EINVAL; in pcm3168a_hw_params()
481 format = io_params->format; in pcm3168a_hw_params()
483 if (io_params->slot_width) in pcm3168a_hw_params()
484 slot_width = io_params->slot_width; in pcm3168a_hw_params()
491 …dev_err(component->dev, "16-bit slots are supported only for consumer mode using right justified\n… in pcm3168a_hw_params()
492 return -EINVAL; in pcm3168a_hw_params()
498 …dev_err(component->dev, "24-bit slots not supported in provider mode, or consumer mode using DSP\n… in pcm3168a_hw_params()
499 return -EINVAL; in pcm3168a_hw_params()
505 dev_err(component->dev, "unsupported frame size: %d\n", slot_width); in pcm3168a_hw_params()
506 return -EINVAL; in pcm3168a_hw_params()
509 if (io_params->tdm_slots) in pcm3168a_hw_params()
510 tdm_slots = io_params->tdm_slots; in pcm3168a_hw_params()
517 * If pcm3168a->tdm_slots is not set or set to more than 2 (8/6 usually) in pcm3168a_hw_params()
519 * If pcm3168a->tdm_slots is set to 2 then DIN1/2/3/4 and DOUT1/2/3 is in pcm3168a_hw_params()
532 dev_err(component->dev, in pcm3168a_hw_params()
534 return -EINVAL; in pcm3168a_hw_params()
556 return -EINVAL; in pcm3168a_hw_params()
559 regmap_update_bits(pcm3168a->regmap, reg, mask, in pcm3168a_hw_params()
602 .name = "pcm3168a-dac",
614 .name = "pcm3168a-adc",
727 return -ENOMEM; in pcm3168a_probe()
739 pcm3168a->gpio_rst = devm_gpiod_get_optional(dev, "reset", in pcm3168a_probe()
742 if (IS_ERR(pcm3168a->gpio_rst)) in pcm3168a_probe()
743 return dev_err_probe(dev, PTR_ERR(pcm3168a->gpio_rst), in pcm3168a_probe()
746 pcm3168a->scki = devm_clk_get(dev, "scki"); in pcm3168a_probe()
747 if (IS_ERR(pcm3168a->scki)) in pcm3168a_probe()
748 return dev_err_probe(dev, PTR_ERR(pcm3168a->scki), in pcm3168a_probe()
751 ret = clk_prepare_enable(pcm3168a->scki); in pcm3168a_probe()
757 pcm3168a->sysclk = clk_get_rate(pcm3168a->scki); in pcm3168a_probe()
759 for (i = 0; i < ARRAY_SIZE(pcm3168a->supplies); i++) in pcm3168a_probe()
760 pcm3168a->supplies[i].supply = pcm3168a_supply_names[i]; in pcm3168a_probe()
763 ARRAY_SIZE(pcm3168a->supplies), pcm3168a->supplies); in pcm3168a_probe()
769 ret = regulator_bulk_enable(ARRAY_SIZE(pcm3168a->supplies), in pcm3168a_probe()
770 pcm3168a->supplies); in pcm3168a_probe()
776 pcm3168a->regmap = regmap; in pcm3168a_probe()
777 if (IS_ERR(pcm3168a->regmap)) { in pcm3168a_probe()
778 ret = PTR_ERR(pcm3168a->regmap); in pcm3168a_probe()
783 if (pcm3168a->gpio_rst) { in pcm3168a_probe()
786 * 3846 SCKI clock cycles for the internal reset de-assertion in pcm3168a_probe()
788 msleep(DIV_ROUND_UP(3846 * 1000, pcm3168a->sysclk)); in pcm3168a_probe()
801 memcpy(pcm3168a->dai_drv, pcm3168a_dais, sizeof(pcm3168a->dai_drv)); in pcm3168a_probe()
803 pcm3168a->dai_drv, in pcm3168a_probe()
804 ARRAY_SIZE(pcm3168a->dai_drv)); in pcm3168a_probe()
813 regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies), in pcm3168a_probe()
814 pcm3168a->supplies); in pcm3168a_probe()
816 clk_disable_unprepare(pcm3168a->scki); in pcm3168a_probe()
826 regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies), in pcm3168a_disable()
827 pcm3168a->supplies); in pcm3168a_disable()
828 clk_disable_unprepare(pcm3168a->scki); in pcm3168a_disable()
841 gpiod_set_value_cansleep(pcm3168a->gpio_rst, 1); in pcm3168a_remove()
855 ret = clk_prepare_enable(pcm3168a->scki); in pcm3168a_rt_resume()
861 ret = regulator_bulk_enable(ARRAY_SIZE(pcm3168a->supplies), in pcm3168a_rt_resume()
862 pcm3168a->supplies); in pcm3168a_rt_resume()
874 regcache_cache_only(pcm3168a->regmap, false); in pcm3168a_rt_resume()
876 regcache_mark_dirty(pcm3168a->regmap); in pcm3168a_rt_resume()
878 ret = regcache_sync(pcm3168a->regmap); in pcm3168a_rt_resume()
887 regulator_bulk_disable(ARRAY_SIZE(pcm3168a->supplies), in pcm3168a_rt_resume()
888 pcm3168a->supplies); in pcm3168a_rt_resume()
890 clk_disable_unprepare(pcm3168a->scki); in pcm3168a_rt_resume()
899 regcache_cache_only(pcm3168a->regmap, true); in pcm3168a_rt_suspend()