Lines Matching +full:switch +full:- +full:freq +full:- +full:select

1 // SPDX-License-Identifier: GPL-2.0-only
61 /* ---------------------------------------------------------------------
68 struct snd_soc_component *component = dai->component; in aic26_hw_params()
73 dev_dbg(&aic26->spi->dev, "aic26_hw_params(substream=%p, params=%p)\n", in aic26_hw_params()
75 dev_dbg(&aic26->spi->dev, "rate=%i width=%d\n", params_rate(params), in aic26_hw_params()
78 switch (params_rate(params)) { in aic26_hw_params()
89 dev_dbg(&aic26->spi->dev, "bad rate\n"); return -EINVAL; in aic26_hw_params()
92 /* select data word length */ in aic26_hw_params()
93 switch (params_width(params)) { in aic26_hw_params()
99 dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL; in aic26_hw_params()
109 jval = fsref / (aic26->mclk / 2048); in aic26_hw_params()
111 dval = fsref - (jval * (aic26->mclk / 2048)); in aic26_hw_params()
112 dval = (10000 * dval) / (aic26->mclk / 2048); in aic26_hw_params()
113 dev_dbg(&aic26->spi->dev, "Setting PLLM to %d.%04d\n", jval, dval); in aic26_hw_params()
121 if (aic26->clock_provider) in aic26_hw_params()
128 reg = wlen | aic26->datfm | (divisor << 3) | divisor; in aic26_hw_params()
135 * aic26_mute - Mute control to reduce noise when changing audio format
139 struct snd_soc_component *component = dai->component; in aic26_mute()
143 dev_dbg(&aic26->spi->dev, "aic26_mute(dai=%p, mute=%i)\n", in aic26_mute()
156 int clk_id, unsigned int freq, int dir) in aic26_set_sysclk() argument
158 struct snd_soc_component *component = codec_dai->component; in aic26_set_sysclk()
161 dev_dbg(&aic26->spi->dev, "aic26_set_sysclk(dai=%p, clk_id==%i," in aic26_set_sysclk()
162 " freq=%i, dir=%i)\n", in aic26_set_sysclk()
163 codec_dai, clk_id, freq, dir); in aic26_set_sysclk()
166 if ((freq < 2000000) || (freq > 50000000)) in aic26_set_sysclk()
167 return -EINVAL; in aic26_set_sysclk()
169 aic26->mclk = freq; in aic26_set_sysclk()
175 struct snd_soc_component *component = codec_dai->component; in aic26_set_fmt()
178 dev_dbg(&aic26->spi->dev, "aic26_set_fmt(dai=%p, fmt==%i)\n", in aic26_set_fmt()
181 switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { in aic26_set_fmt()
182 case SND_SOC_DAIFMT_CBP_CFP: aic26->clock_provider = 1; break; in aic26_set_fmt()
183 case SND_SOC_DAIFMT_CBC_CFC: aic26->clock_provider = 0; break; in aic26_set_fmt()
185 dev_dbg(&aic26->spi->dev, "bad master\n"); return -EINVAL; in aic26_set_fmt()
189 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { in aic26_set_fmt()
190 case SND_SOC_DAIFMT_I2S: aic26->datfm = AIC26_DATFM_I2S; break; in aic26_set_fmt()
191 case SND_SOC_DAIFMT_DSP_A: aic26->datfm = AIC26_DATFM_DSP; break; in aic26_set_fmt()
192 case SND_SOC_DAIFMT_RIGHT_J: aic26->datfm = AIC26_DATFM_RIGHTJ; break; in aic26_set_fmt()
193 case SND_SOC_DAIFMT_LEFT_J: aic26->datfm = AIC26_DATFM_LEFTJ; break; in aic26_set_fmt()
195 dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL; in aic26_set_fmt()
201 /* ---------------------------------------------------------------------
220 .name = "tlv320aic26-hifi",
238 /* ---------------------------------------------------------------------
249 SOC_DOUBLE("PCM Playback Switch", AIC26_REG_DAC_GAIN, 15, 7, 1, 1),
259 /* ---------------------------------------------------------------------
267 int val, amp, freq, len; in keyclick_show() local
269 val = snd_soc_component_read(aic26->component, AIC26_REG_AUDIO_CTRL2); in keyclick_show()
271 freq = (125 << ((val >> 8) & 0x7)) >> 1; in keyclick_show()
274 return sysfs_emit(buf, "amp=%x freq=%iHz len=%iclks\n", amp, freq, len); in keyclick_show()
284 snd_soc_component_update_bits(aic26->component, AIC26_REG_AUDIO_CTRL2, in keyclick_store()
292 /* ---------------------------------------------------------------------
297 struct aic26 *aic26 = dev_get_drvdata(component->dev); in aic26_probe()
300 aic26->component = component; in aic26_probe()
316 ret = device_create_file(component->dev, &dev_attr_keyclick); in aic26_probe()
318 dev_info(component->dev, "error creating sysfs files\n"); in aic26_probe()
341 /* ---------------------------------------------------------------------
350 dev_dbg(&spi->dev, "probing tlv320aic26 spi device\n"); in aic26_spi_probe()
353 aic26 = devm_kzalloc(&spi->dev, sizeof *aic26, GFP_KERNEL); in aic26_spi_probe()
355 return -ENOMEM; in aic26_spi_probe()
357 aic26->regmap = devm_regmap_init_spi(spi, &aic26_regmap); in aic26_spi_probe()
358 if (IS_ERR(aic26->regmap)) in aic26_spi_probe()
359 return PTR_ERR(aic26->regmap); in aic26_spi_probe()
362 aic26->spi = spi; in aic26_spi_probe()
363 dev_set_drvdata(&spi->dev, aic26); in aic26_spi_probe()
364 aic26->clock_provider = 1; in aic26_spi_probe()
366 ret = devm_snd_soc_register_component(&spi->dev, in aic26_spi_probe()
373 .name = "tlv320aic26-codec",