Lines Matching +full:clk +full:- +full:source
1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/clk.h>
17 #include <sound/soc-dai.h>
18 #include <sound/soc-dapm.h>
182 struct clk *clk; member
189 struct regmap *regmap = jz_codec->regmap; in jz4770_codec_set_bias_level()
219 struct snd_soc_component *codec = dai->component; in jz4770_codec_startup()
227 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in jz4770_codec_startup()
236 struct snd_soc_component *codec = dai->component; in jz4770_codec_shutdown()
239 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in jz4770_codec_shutdown()
247 struct snd_soc_component *codec = dai->component; in jz4770_codec_pcm_trigger()
254 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) in jz4770_codec_pcm_trigger()
264 ret = -EINVAL; in jz4770_codec_pcm_trigger()
272 struct snd_soc_component *codec = dai->component; in jz4770_codec_mute_stream()
282 regmap_read(jz_codec->regmap, JZ4770_CODEC_REG_CR_DAC, &val); in jz4770_codec_mute_stream()
287 err = regmap_read_poll_timeout(jz_codec->regmap, in jz4770_codec_mute_stream()
292 dev_err(jz_codec->dev, in jz4770_codec_mute_stream()
298 regmap_set_bits(jz_codec->regmap, JZ4770_CODEC_REG_IFR, in jz4770_codec_mute_stream()
306 static const DECLARE_TLV_DB_MINMAX_MUTE(dac_tlv, -3100, 0);
308 static const DECLARE_TLV_DB_MINMAX(out_tlv, -2500, 600);
309 static const DECLARE_TLV_DB_SCALE(linein_tlv, -2500, 100, 0);
310 static const DECLARE_TLV_DB_MINMAX(mixer_tlv, -3100, 0);
376 struct snd_soc_component *codec = snd_soc_dapm_to_component(w->dapm); in hpout_event()
384 regmap_clear_bits(jz_codec->regmap, JZ4770_CODEC_REG_CR_HP, in hpout_event()
389 /* wait for ramp-up complete (RUP) */ in hpout_event()
390 err = regmap_read_poll_timeout(jz_codec->regmap, in hpout_event()
395 dev_err(jz_codec->dev, "RUP timeout: %d", err); in hpout_event()
400 regmap_set_bits(jz_codec->regmap, JZ4770_CODEC_REG_IFR, in hpout_event()
407 regmap_set_bits(jz_codec->regmap, JZ4770_CODEC_REG_CR_HP, in hpout_event()
410 err = regmap_read_poll_timeout(jz_codec->regmap, in hpout_event()
415 dev_err(jz_codec->dev, "RDO timeout: %d", err); in hpout_event()
420 regmap_set_bits(jz_codec->regmap, JZ4770_CODEC_REG_IFR, in hpout_event()
493 SND_SOC_DAPM_MUX("Headphones Source", SND_SOC_NOPM, 0, 0,
495 SND_SOC_DAPM_MUX("Capture Source", SND_SOC_NOPM, 0, 0,
497 SND_SOC_DAPM_MUX("Line Out Source", SND_SOC_NOPM, 0, 0,
531 SND_SOC_DAPM_SUPPLY("Cap-less", JZ4770_CODEC_REG_CR_HP,
565 { "Headphones Source", "Mic 1", "Mic" },
566 { "Headphones Source", "Mic 2", "Mic" },
567 { "Capture Source", "Mic 1", "Mic" },
568 { "Capture Source", "Mic 2", "Mic" },
570 { "Headphones Source", "Mic 1", "Mic 1" },
571 { "Headphones Source", "Mic 2", "Mic 2" },
572 { "Headphones Source", "Line In", "Line In Bypass" },
573 { "Headphones Source", "PCM", "Headphones Playback" },
574 { "HP Out", NULL, "Headphones Source" },
576 { "Capture Source", "Line In", "Line In" },
577 { "Capture Source", "Mic 1", "Mic 1" },
578 { "Capture Source", "Mic 2", "Mic 2" },
579 { "ADC", NULL, "Capture Source" },
582 { "Line Out Source", "Line In", "Line In Bypass" },
583 { "Line Out Source", "PCM", "PCM Playback" },
588 { "Line Out", NULL, "Line Out Source" },
603 struct regmap *regmap = jz_codec->regmap; in jz4770_codec_codec_init_regs()
618 /* Set mic 1 as default source for ADC */ in jz4770_codec_codec_init_regs()
654 /* default to cap-less mode(0) */ in jz4770_codec_codec_init_regs()
667 clk_prepare_enable(jz_codec->clk); in jz4770_codec_codec_probe()
678 clk_disable_unprepare(jz_codec->clk); in jz4770_codec_codec_remove()
705 struct jz_codec *codec = snd_soc_component_get_drvdata(dai->component); in jz4770_codec_hw_params()
722 return -EINVAL; in jz4770_codec_hw_params()
731 return -EINVAL; in jz4770_codec_hw_params()
733 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in jz4770_codec_hw_params()
734 regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_AICR_DAC, in jz4770_codec_hw_params()
737 regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_FCR_DAC, in jz4770_codec_hw_params()
741 regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_AICR_ADC, in jz4770_codec_hw_params()
744 regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_FCR_ADC, in jz4770_codec_hw_params()
767 .name = "jz4770-hifi",
817 return readl_poll_timeout(codec->base + ICDC_RGADW_OFFSET, reg, in jz4770_codec_io_wait()
834 tmp = readl(codec->base + ICDC_RGADW_OFFSET); in jz4770_codec_reg_read()
837 writel(tmp, codec->base + ICDC_RGADW_OFFSET); in jz4770_codec_reg_read()
841 *val = readl(codec->base + ICDC_RGDATA_OFFSET) & in jz4770_codec_reg_read()
858 codec->base + ICDC_RGADW_OFFSET); in jz4770_codec_reg_write()
894 struct device *dev = &pdev->dev; in jz4770_codec_probe()
900 return -ENOMEM; in jz4770_codec_probe()
902 codec->dev = dev; in jz4770_codec_probe()
904 codec->base = devm_platform_ioremap_resource(pdev, 0); in jz4770_codec_probe()
905 if (IS_ERR(codec->base)) in jz4770_codec_probe()
906 return PTR_ERR(codec->base); in jz4770_codec_probe()
908 codec->regmap = devm_regmap_init(dev, NULL, codec, in jz4770_codec_probe()
910 if (IS_ERR(codec->regmap)) in jz4770_codec_probe()
911 return PTR_ERR(codec->regmap); in jz4770_codec_probe()
913 codec->clk = devm_clk_get(dev, "aic"); in jz4770_codec_probe()
914 if (IS_ERR(codec->clk)) in jz4770_codec_probe()
915 return PTR_ERR(codec->clk); in jz4770_codec_probe()
930 { .compatible = "ingenic,jz4770-codec", },
938 .name = "jz4770-codec",