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()
338 static bool adau17x1_has_disused_dsp(struct adau *adau) in adau17x1_has_disused_dsp() argument
340 switch (adau->type) { in adau17x1_has_disused_dsp()
348 static bool adau17x1_has_safeload(struct adau *adau) in adau17x1_has_safeload() argument
350 switch (adau->type) { in adau17x1_has_safeload()
363 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_set_dai_pll() local
369 ret = adau_calc_pll_cfg(freq_in, freq_out, adau->pll_regs); in adau17x1_set_dai_pll()
374 ret = regmap_raw_write(adau->regmap, ADAU17X1_PLL_CONTROL, in adau17x1_set_dai_pll()
375 adau->pll_regs, ARRAY_SIZE(adau->pll_regs)); in adau17x1_set_dai_pll()
379 adau->pll_freq = freq_out; in adau17x1_set_dai_pll()
388 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_sysclk() local
397 if (!adau->mclk) in adau17x1_set_dai_sysclk()
407 switch (adau->clk_src) { in adau17x1_set_dai_sysclk()
419 adau->sysclk = freq; in adau17x1_set_dai_sysclk()
431 adau->clk_src = clk_id; in adau17x1_set_dai_sysclk()
439 struct adau *adau = snd_soc_dai_get_drvdata(dai); in adau17x1_auto_pll() local
466 clk_get_rate(adau->mclk), pll_rate); in adau17x1_auto_pll()
473 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_hw_params() local
478 switch (adau->clk_src) { in adau17x1_hw_params()
485 freq = adau->pll_freq; in adau17x1_hw_params()
488 freq = adau->sysclk; in adau17x1_hw_params()
528 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_hw_params()
531 if (adau17x1_has_dsp(adau) || adau17x1_has_disused_dsp(adau)) in adau17x1_hw_params()
532 regmap_write(adau->regmap, ADAU17X1_SERIAL_SAMPLING_RATE, div); in adau17x1_hw_params()
533 if (adau17x1_has_dsp(adau)) in adau17x1_hw_params()
534 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dsp_div); in adau17x1_hw_params()
536 if (adau->sigmadsp) { in adau17x1_hw_params()
542 if (adau->dai_fmt != SND_SOC_DAIFMT_RIGHT_J) in adau17x1_hw_params()
559 return regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT1, in adau17x1_hw_params()
566 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_fmt() local
574 adau->master = true; in adau17x1_set_dai_fmt()
578 adau->master = false; in adau17x1_set_dai_fmt()
634 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT0, ctrl0_mask, in adau17x1_set_dai_fmt()
636 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT1, in adau17x1_set_dai_fmt()
639 adau->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in adau17x1_set_dai_fmt()
647 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_tdm_slot() local
667 if (adau->type == ADAU1361) in adau17x1_set_dai_tdm_slot()
678 if (adau->type == ADAU1761 || adau->type == ADAU1761_AS_1361) in adau17x1_set_dai_tdm_slot()
693 if (adau->type == ADAU1361) in adau17x1_set_dai_tdm_slot()
705 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 0; in adau17x1_set_dai_tdm_slot()
709 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 1; in adau17x1_set_dai_tdm_slot()
713 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 2; in adau17x1_set_dai_tdm_slot()
717 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 3; in adau17x1_set_dai_tdm_slot()
726 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 0; in adau17x1_set_dai_tdm_slot()
730 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 1; in adau17x1_set_dai_tdm_slot()
734 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 2; in adau17x1_set_dai_tdm_slot()
738 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 3; in adau17x1_set_dai_tdm_slot()
744 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_set_dai_tdm_slot()
746 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER1, in adau17x1_set_dai_tdm_slot()
748 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT0, in adau17x1_set_dai_tdm_slot()
750 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT1, in adau17x1_set_dai_tdm_slot()
753 if (!adau17x1_has_dsp(adau) && !adau17x1_has_disused_dsp(adau)) in adau17x1_set_dai_tdm_slot()
756 if (adau->dsp_bypass[SNDRV_PCM_STREAM_PLAYBACK]) { in adau17x1_set_dai_tdm_slot()
757 regmap_write(adau->regmap, ADAU17X1_SERIAL_INPUT_ROUTE, in adau17x1_set_dai_tdm_slot()
758 (adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] * 2) + 1); in adau17x1_set_dai_tdm_slot()
761 if (adau->dsp_bypass[SNDRV_PCM_STREAM_CAPTURE]) { in adau17x1_set_dai_tdm_slot()
762 regmap_write(adau->regmap, ADAU17X1_SERIAL_OUTPUT_ROUTE, in adau17x1_set_dai_tdm_slot()
763 (adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] * 2) + 1); in adau17x1_set_dai_tdm_slot()
772 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_startup() local
774 if (adau->sigmadsp) in adau17x1_startup()
775 return sigmadsp_restrict_params(adau->sigmadsp, substream); in adau17x1_startup()
793 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_set_micbias_voltage() local
803 return regmap_write(adau->regmap, ADAU17X1_MICBIAS, micbias << 2); in adau17x1_set_micbias_voltage()
884 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_setup_firmware() local
893 if (adau->sigmadsp->current_samplerate == rate) in adau17x1_setup_firmware()
898 ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr); in adau17x1_setup_firmware()
902 ret = regmap_read(adau->regmap, ADAU17X1_DSP_RUN, &dsp_run); in adau17x1_setup_firmware()
906 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1); in adau17x1_setup_firmware()
907 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf); in adau17x1_setup_firmware()
908 regmap_write(adau->regmap, ADAU17X1_DSP_RUN, 0); in adau17x1_setup_firmware()
910 ret = sigmadsp_setup(adau->sigmadsp, rate); in adau17x1_setup_firmware()
912 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0); in adau17x1_setup_firmware()
915 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr); in adau17x1_setup_firmware()
916 regmap_write(adau->regmap, ADAU17X1_DSP_RUN, dsp_run); in adau17x1_setup_firmware()
927 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_add_widgets() local
939 if (adau17x1_has_dsp(adau)) { in adau17x1_add_widgets()
945 if (!adau->sigmadsp) in adau17x1_add_widgets()
948 ret = sigmadsp_attach(adau->sigmadsp, component); in adau17x1_add_widgets()
963 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_add_routes() local
971 if (adau17x1_has_dsp(adau)) { in adau17x1_add_routes()
979 if (adau->clk_src != ADAU17X1_CLK_SRC_MCLK) in adau17x1_add_routes()
988 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_resume() local
990 if (adau->switch_mode) in adau17x1_resume()
991 adau->switch_mode(component->dev); in adau17x1_resume()
993 regcache_sync(adau->regmap); in adau17x1_resume()
1053 struct adau *adau; in adau17x1_probe() local
1059 adau = devm_kzalloc(dev, sizeof(*adau), GFP_KERNEL); in adau17x1_probe()
1060 if (!adau) in adau17x1_probe()
1063 adau->mclk = devm_clk_get(dev, "mclk"); in adau17x1_probe()
1064 if (IS_ERR(adau->mclk)) { in adau17x1_probe()
1065 if (PTR_ERR(adau->mclk) != -ENOENT) in adau17x1_probe()
1066 return PTR_ERR(adau->mclk); in adau17x1_probe()
1068 adau->mclk = NULL; in adau17x1_probe()
1069 } else if (adau->mclk) { in adau17x1_probe()
1070 adau->clk_src = ADAU17X1_CLK_SRC_PLL_AUTO; in adau17x1_probe()
1077 ret = adau_calc_pll_cfg(clk_get_rate(adau->mclk), 48000 * 1024, in adau17x1_probe()
1078 adau->pll_regs); in adau17x1_probe()
1082 ret = clk_prepare_enable(adau->mclk); in adau17x1_probe()
1087 adau->regmap = regmap; in adau17x1_probe()
1088 adau->switch_mode = switch_mode; in adau17x1_probe()
1089 adau->type = type; in adau17x1_probe()
1091 dev_set_drvdata(dev, adau); in adau17x1_probe()
1094 if (adau17x1_has_safeload(adau)) { in adau17x1_probe()
1095 adau->sigmadsp = devm_sigmadsp_init_regmap(dev, regmap, in adau17x1_probe()
1098 adau->sigmadsp = devm_sigmadsp_init_regmap(dev, regmap, in adau17x1_probe()
1101 if (IS_ERR(adau->sigmadsp)) { in adau17x1_probe()
1103 PTR_ERR(adau->sigmadsp)); in adau17x1_probe()
1104 adau->sigmadsp = NULL; in adau17x1_probe()
1117 struct adau *adau = dev_get_drvdata(dev); in adau17x1_remove() local
1119 clk_disable_unprepare(adau->mclk); in adau17x1_remove()