Lines Matching refs:adau
76 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_pll_event() local
79 adau->pll_regs[5] = 1; in adau17x1_pll_event()
81 adau->pll_regs[5] = 0; in adau17x1_pll_event()
84 regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL, in adau17x1_pll_event()
89 regmap_raw_write(adau->regmap, ADAU17X1_PLL_CONTROL, in adau17x1_pll_event()
90 adau->pll_regs, ARRAY_SIZE(adau->pll_regs)); in adau17x1_pll_event()
94 regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL, in adau17x1_pll_event()
106 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_adc_fixup() local
115 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_adc_fixup()
117 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_adc_fixup()
191 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_dsp_mux_enum_put() local
204 adau->dsp_bypass[stream] = false; in adau17x1_dsp_mux_enum_put()
207 val = (adau->tdm_slot[stream] * 2) + 1; in adau17x1_dsp_mux_enum_put()
208 adau->dsp_bypass[stream] = true; in adau17x1_dsp_mux_enum_put()
235 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_dsp_mux_enum_get() local
246 ret = regmap_read(adau->regmap, reg, &val); in adau17x1_dsp_mux_enum_get()
325 static bool adau17x1_has_dsp(struct adau *adau) in adau17x1_has_dsp() argument
327 switch (adau->type) { in adau17x1_has_dsp()
337 static bool adau17x1_has_safeload(struct adau *adau) in adau17x1_has_safeload() argument
339 switch (adau->type) { in adau17x1_has_safeload()
352 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_set_dai_pll() local
358 ret = adau_calc_pll_cfg(freq_in, freq_out, adau->pll_regs); in adau17x1_set_dai_pll()
363 ret = regmap_raw_write(adau->regmap, ADAU17X1_PLL_CONTROL, in adau17x1_set_dai_pll()
364 adau->pll_regs, ARRAY_SIZE(adau->pll_regs)); in adau17x1_set_dai_pll()
368 adau->pll_freq = freq_out; in adau17x1_set_dai_pll()
377 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_sysclk() local
386 if (!adau->mclk) in adau17x1_set_dai_sysclk()
396 switch (adau->clk_src) { in adau17x1_set_dai_sysclk()
408 adau->sysclk = freq; in adau17x1_set_dai_sysclk()
420 adau->clk_src = clk_id; in adau17x1_set_dai_sysclk()
428 struct adau *adau = snd_soc_dai_get_drvdata(dai); in adau17x1_auto_pll() local
455 clk_get_rate(adau->mclk), pll_rate); in adau17x1_auto_pll()
462 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_hw_params() local
467 switch (adau->clk_src) { in adau17x1_hw_params()
474 freq = adau->pll_freq; in adau17x1_hw_params()
477 freq = adau->sysclk; in adau17x1_hw_params()
517 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_hw_params()
519 if (adau17x1_has_dsp(adau)) { in adau17x1_hw_params()
520 regmap_write(adau->regmap, ADAU17X1_SERIAL_SAMPLING_RATE, div); in adau17x1_hw_params()
521 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dsp_div); in adau17x1_hw_params()
524 if (adau->sigmadsp) { in adau17x1_hw_params()
530 if (adau->dai_fmt != SND_SOC_DAIFMT_RIGHT_J) in adau17x1_hw_params()
547 return regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT1, in adau17x1_hw_params()
554 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_fmt() local
561 adau->master = true; in adau17x1_set_dai_fmt()
565 adau->master = false; in adau17x1_set_dai_fmt()
615 regmap_write(adau->regmap, ADAU17X1_SERIAL_PORT0, ctrl0); in adau17x1_set_dai_fmt()
616 regmap_write(adau->regmap, ADAU17X1_SERIAL_PORT1, ctrl1); in adau17x1_set_dai_fmt()
618 adau->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in adau17x1_set_dai_fmt()
626 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_tdm_slot() local
646 if (adau->type == ADAU1361) in adau17x1_set_dai_tdm_slot()
657 if (adau->type == ADAU1761) in adau17x1_set_dai_tdm_slot()
672 if (adau->type == ADAU1361) in adau17x1_set_dai_tdm_slot()
684 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 0; in adau17x1_set_dai_tdm_slot()
688 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 1; in adau17x1_set_dai_tdm_slot()
692 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 2; in adau17x1_set_dai_tdm_slot()
696 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 3; in adau17x1_set_dai_tdm_slot()
705 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 0; in adau17x1_set_dai_tdm_slot()
709 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 1; in adau17x1_set_dai_tdm_slot()
713 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 2; in adau17x1_set_dai_tdm_slot()
717 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 3; in adau17x1_set_dai_tdm_slot()
723 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_set_dai_tdm_slot()
725 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER1, in adau17x1_set_dai_tdm_slot()
727 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT0, in adau17x1_set_dai_tdm_slot()
729 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT1, in adau17x1_set_dai_tdm_slot()
732 if (!adau17x1_has_dsp(adau)) in adau17x1_set_dai_tdm_slot()
735 if (adau->dsp_bypass[SNDRV_PCM_STREAM_PLAYBACK]) { in adau17x1_set_dai_tdm_slot()
736 regmap_write(adau->regmap, ADAU17X1_SERIAL_INPUT_ROUTE, in adau17x1_set_dai_tdm_slot()
737 (adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] * 2) + 1); in adau17x1_set_dai_tdm_slot()
740 if (adau->dsp_bypass[SNDRV_PCM_STREAM_CAPTURE]) { in adau17x1_set_dai_tdm_slot()
741 regmap_write(adau->regmap, ADAU17X1_SERIAL_OUTPUT_ROUTE, in adau17x1_set_dai_tdm_slot()
742 (adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] * 2) + 1); in adau17x1_set_dai_tdm_slot()
751 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_startup() local
753 if (adau->sigmadsp) in adau17x1_startup()
754 return sigmadsp_restrict_params(adau->sigmadsp, substream); in adau17x1_startup()
772 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_set_micbias_voltage() local
782 return regmap_write(adau->regmap, ADAU17X1_MICBIAS, micbias << 2); in adau17x1_set_micbias_voltage()
863 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_setup_firmware() local
872 if (adau->sigmadsp->current_samplerate == rate) in adau17x1_setup_firmware()
877 ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr); in adau17x1_setup_firmware()
881 ret = regmap_read(adau->regmap, ADAU17X1_DSP_RUN, &dsp_run); in adau17x1_setup_firmware()
885 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1); in adau17x1_setup_firmware()
886 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf); in adau17x1_setup_firmware()
887 regmap_write(adau->regmap, ADAU17X1_DSP_RUN, 0); in adau17x1_setup_firmware()
889 ret = sigmadsp_setup(adau->sigmadsp, rate); in adau17x1_setup_firmware()
891 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0); in adau17x1_setup_firmware()
894 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr); in adau17x1_setup_firmware()
895 regmap_write(adau->regmap, ADAU17X1_DSP_RUN, dsp_run); in adau17x1_setup_firmware()
906 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_add_widgets() local
918 if (adau17x1_has_dsp(adau)) { in adau17x1_add_widgets()
924 if (!adau->sigmadsp) in adau17x1_add_widgets()
927 ret = sigmadsp_attach(adau->sigmadsp, component); in adau17x1_add_widgets()
942 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_add_routes() local
950 if (adau17x1_has_dsp(adau)) { in adau17x1_add_routes()
958 if (adau->clk_src != ADAU17X1_CLK_SRC_MCLK) in adau17x1_add_routes()
967 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_resume() local
969 if (adau->switch_mode) in adau17x1_resume()
970 adau->switch_mode(component->dev); in adau17x1_resume()
972 regcache_sync(adau->regmap); in adau17x1_resume()
1032 struct adau *adau; in adau17x1_probe() local
1038 adau = devm_kzalloc(dev, sizeof(*adau), GFP_KERNEL); in adau17x1_probe()
1039 if (!adau) in adau17x1_probe()
1042 adau->mclk = devm_clk_get(dev, "mclk"); in adau17x1_probe()
1043 if (IS_ERR(adau->mclk)) { in adau17x1_probe()
1044 if (PTR_ERR(adau->mclk) != -ENOENT) in adau17x1_probe()
1045 return PTR_ERR(adau->mclk); in adau17x1_probe()
1047 adau->mclk = NULL; in adau17x1_probe()
1048 } else if (adau->mclk) { in adau17x1_probe()
1049 adau->clk_src = ADAU17X1_CLK_SRC_PLL_AUTO; in adau17x1_probe()
1056 ret = adau_calc_pll_cfg(clk_get_rate(adau->mclk), 48000 * 1024, in adau17x1_probe()
1057 adau->pll_regs); in adau17x1_probe()
1061 ret = clk_prepare_enable(adau->mclk); in adau17x1_probe()
1066 adau->regmap = regmap; in adau17x1_probe()
1067 adau->switch_mode = switch_mode; in adau17x1_probe()
1068 adau->type = type; in adau17x1_probe()
1070 dev_set_drvdata(dev, adau); in adau17x1_probe()
1073 if (adau17x1_has_safeload(adau)) { in adau17x1_probe()
1074 adau->sigmadsp = devm_sigmadsp_init_regmap(dev, regmap, in adau17x1_probe()
1077 adau->sigmadsp = devm_sigmadsp_init_regmap(dev, regmap, in adau17x1_probe()
1080 if (IS_ERR(adau->sigmadsp)) { in adau17x1_probe()
1082 PTR_ERR(adau->sigmadsp)); in adau17x1_probe()
1083 adau->sigmadsp = NULL; in adau17x1_probe()
1096 struct adau *adau = dev_get_drvdata(dev); in adau17x1_remove() local
1098 if (adau->mclk) in adau17x1_remove()
1099 clk_disable_unprepare(adau->mclk); in adau17x1_remove()