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()
216 struct snd_soc_component *codec = dai->component; in jz4770_codec_startup()
224 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in jz4770_codec_startup()
233 struct snd_soc_component *codec = dai->component; in jz4770_codec_shutdown()
236 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in jz4770_codec_shutdown()
244 struct snd_soc_component *codec = dai->component; in jz4770_codec_pcm_trigger()
251 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) in jz4770_codec_pcm_trigger()
261 ret = -EINVAL; in jz4770_codec_pcm_trigger()
269 struct snd_soc_component *codec = dai->component; in jz4770_codec_mute_stream()
279 regmap_read(jz_codec->regmap, JZ4770_CODEC_REG_CR_DAC, &val); in jz4770_codec_mute_stream()
284 err = regmap_read_poll_timeout(jz_codec->regmap, in jz4770_codec_mute_stream()
289 dev_err(jz_codec->dev, in jz4770_codec_mute_stream()
295 regmap_update_bits(jz_codec->regmap, JZ4770_CODEC_REG_IFR, in jz4770_codec_mute_stream()
303 static const DECLARE_TLV_DB_MINMAX_MUTE(dac_tlv, -3100, 0);
305 static const DECLARE_TLV_DB_MINMAX(out_tlv, -2500, 600);
306 static const DECLARE_TLV_DB_SCALE(linein_tlv, -2500, 100, 0);
364 struct snd_soc_component *codec = snd_soc_dapm_to_component(w->dapm); in hpout_event()
371 /* set cap-less, unmute HP */ in hpout_event()
372 regmap_update_bits(jz_codec->regmap, JZ4770_CODEC_REG_CR_HP, in hpout_event()
377 /* wait for ramp-up complete (RUP) */ in hpout_event()
378 err = regmap_read_poll_timeout(jz_codec->regmap, in hpout_event()
383 dev_err(jz_codec->dev, "RUP timeout: %d", err); in hpout_event()
388 regmap_update_bits(jz_codec->regmap, JZ4770_CODEC_REG_IFR, in hpout_event()
394 /* set cap-couple, mute HP */ in hpout_event()
395 regmap_update_bits(jz_codec->regmap, JZ4770_CODEC_REG_CR_HP, in hpout_event()
399 err = regmap_read_poll_timeout(jz_codec->regmap, in hpout_event()
404 dev_err(jz_codec->dev, "RDO timeout: %d", err); in hpout_event()
409 regmap_update_bits(jz_codec->regmap, JZ4770_CODEC_REG_IFR, in hpout_event()
482 SND_SOC_DAPM_MUX("Headphones Source", SND_SOC_NOPM, 0, 0,
484 SND_SOC_DAPM_MUX("Capture Source", SND_SOC_NOPM, 0, 0,
486 SND_SOC_DAPM_MUX("Line Out Source", SND_SOC_NOPM, 0, 0,
551 { "Headphones Source", "Mic 1", "Mic" },
552 { "Headphones Source", "Mic 2", "Mic" },
553 { "Capture Source", "Mic 1", "Mic" },
554 { "Capture Source", "Mic 2", "Mic" },
556 { "Headphones Source", "Mic 1", "Mic 1" },
557 { "Headphones Source", "Mic 2", "Mic 2" },
558 { "Headphones Source", "Line In", "Line In Bypass" },
559 { "Headphones Source", "PCM", "Headphones Playback" },
560 { "HP Out", NULL, "Headphones Source" },
562 { "Capture Source", "Line In", "Line In" },
563 { "Capture Source", "Mic 1", "Mic 1" },
564 { "Capture Source", "Mic 2", "Mic 2" },
565 { "ADC", NULL, "Capture Source" },
568 { "Line Out Source", "Line In", "Line In Bypass" },
569 { "Line Out Source", "PCM", "PCM Playback" },
574 { "Line Out", NULL, "Line Out Source" },
589 struct regmap *regmap = jz_codec->regmap; in jz4770_codec_codec_init_regs()
606 /* Set mic 1 as default source for ADC */ in jz4770_codec_codec_init_regs()
649 /* default to cap-less mode(0) */ in jz4770_codec_codec_init_regs()
665 clk_prepare_enable(jz_codec->clk); in jz4770_codec_codec_probe()
676 clk_disable_unprepare(jz_codec->clk); in jz4770_codec_codec_remove()
703 struct jz_codec *codec = snd_soc_component_get_drvdata(dai->component); in jz4770_codec_hw_params()
720 return -EINVAL; in jz4770_codec_hw_params()
729 return -EINVAL; in jz4770_codec_hw_params()
731 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in jz4770_codec_hw_params()
732 regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_AICR_DAC, in jz4770_codec_hw_params()
735 regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_FCR_DAC, in jz4770_codec_hw_params()
739 regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_AICR_ADC, in jz4770_codec_hw_params()
742 regmap_update_bits(codec->regmap, JZ4770_CODEC_REG_FCR_ADC, in jz4770_codec_hw_params()
765 .name = "jz4770-hifi",
815 return readl_poll_timeout(codec->base + ICDC_RGADW_OFFSET, reg, in jz4770_codec_io_wait()
832 tmp = readl(codec->base + ICDC_RGADW_OFFSET); in jz4770_codec_reg_read()
835 writel(tmp, codec->base + ICDC_RGADW_OFFSET); in jz4770_codec_reg_read()
839 *val = readl(codec->base + ICDC_RGDATA_OFFSET) & in jz4770_codec_reg_read()
856 codec->base + ICDC_RGADW_OFFSET); in jz4770_codec_reg_write()
892 struct device *dev = &pdev->dev; in jz4770_codec_probe()
898 return -ENOMEM; in jz4770_codec_probe()
900 codec->dev = dev; in jz4770_codec_probe()
902 codec->base = devm_platform_ioremap_resource(pdev, 0); in jz4770_codec_probe()
903 if (IS_ERR(codec->base)) { in jz4770_codec_probe()
904 ret = PTR_ERR(codec->base); in jz4770_codec_probe()
909 codec->regmap = devm_regmap_init(dev, NULL, codec, in jz4770_codec_probe()
911 if (IS_ERR(codec->regmap)) in jz4770_codec_probe()
912 return PTR_ERR(codec->regmap); in jz4770_codec_probe()
914 codec->clk = devm_clk_get(dev, "aic"); in jz4770_codec_probe()
915 if (IS_ERR(codec->clk)) in jz4770_codec_probe()
916 return PTR_ERR(codec->clk); in jz4770_codec_probe()
931 { .compatible = "ingenic,jz4770-codec", },
939 .name = "jz4770-codec",