Lines Matching refs:adau
75 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_pll_event() local
78 adau->pll_regs[5] = 1; in adau17x1_pll_event()
80 adau->pll_regs[5] = 0; in adau17x1_pll_event()
83 regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL, in adau17x1_pll_event()
88 regmap_raw_write(adau->regmap, ADAU17X1_PLL_CONTROL, in adau17x1_pll_event()
89 adau->pll_regs, ARRAY_SIZE(adau->pll_regs)); in adau17x1_pll_event()
93 regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL, in adau17x1_pll_event()
105 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_adc_fixup() local
114 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_adc_fixup()
116 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_adc_fixup()
190 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_dsp_mux_enum_put() local
203 adau->dsp_bypass[stream] = false; in adau17x1_dsp_mux_enum_put()
206 val = (adau->tdm_slot[stream] * 2) + 1; in adau17x1_dsp_mux_enum_put()
207 adau->dsp_bypass[stream] = true; in adau17x1_dsp_mux_enum_put()
234 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_dsp_mux_enum_get() local
245 ret = regmap_read(adau->regmap, reg, &val); in adau17x1_dsp_mux_enum_get()
324 static bool adau17x1_has_dsp(struct adau *adau) in adau17x1_has_dsp() argument
326 switch (adau->type) { in adau17x1_has_dsp()
337 static bool adau17x1_has_disused_dsp(struct adau *adau) in adau17x1_has_disused_dsp() argument
339 switch (adau->type) { in adau17x1_has_disused_dsp()
347 static bool adau17x1_has_safeload(struct adau *adau) in adau17x1_has_safeload() argument
349 switch (adau->type) { in adau17x1_has_safeload()
362 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_set_dai_pll() local
368 ret = adau_calc_pll_cfg(freq_in, freq_out, adau->pll_regs); in adau17x1_set_dai_pll()
373 ret = regmap_raw_write(adau->regmap, ADAU17X1_PLL_CONTROL, in adau17x1_set_dai_pll()
374 adau->pll_regs, ARRAY_SIZE(adau->pll_regs)); in adau17x1_set_dai_pll()
378 adau->pll_freq = freq_out; in adau17x1_set_dai_pll()
387 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_sysclk() local
396 if (!adau->mclk) in adau17x1_set_dai_sysclk()
406 switch (adau->clk_src) { in adau17x1_set_dai_sysclk()
418 adau->sysclk = freq; in adau17x1_set_dai_sysclk()
430 adau->clk_src = clk_id; in adau17x1_set_dai_sysclk()
438 struct adau *adau = snd_soc_dai_get_drvdata(dai); in adau17x1_auto_pll() local
465 clk_get_rate(adau->mclk), pll_rate); in adau17x1_auto_pll()
472 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_hw_params() local
477 switch (adau->clk_src) { in adau17x1_hw_params()
484 freq = adau->pll_freq; in adau17x1_hw_params()
487 freq = adau->sysclk; in adau17x1_hw_params()
527 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_hw_params()
530 if (adau17x1_has_dsp(adau) || adau17x1_has_disused_dsp(adau)) in adau17x1_hw_params()
531 regmap_write(adau->regmap, ADAU17X1_SERIAL_SAMPLING_RATE, div); in adau17x1_hw_params()
532 if (adau17x1_has_dsp(adau)) in adau17x1_hw_params()
533 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dsp_div); in adau17x1_hw_params()
535 if (adau->sigmadsp) { in adau17x1_hw_params()
541 if (adau->dai_fmt != SND_SOC_DAIFMT_RIGHT_J) in adau17x1_hw_params()
558 return regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT1, in adau17x1_hw_params()
565 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_fmt() local
573 adau->master = true; in adau17x1_set_dai_fmt()
577 adau->master = false; in adau17x1_set_dai_fmt()
633 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT0, ctrl0_mask, in adau17x1_set_dai_fmt()
635 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT1, in adau17x1_set_dai_fmt()
638 adau->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in adau17x1_set_dai_fmt()
646 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_set_dai_tdm_slot() local
666 if (adau->type == ADAU1361) in adau17x1_set_dai_tdm_slot()
677 if (adau->type == ADAU1761 || adau->type == ADAU1761_AS_1361) in adau17x1_set_dai_tdm_slot()
692 if (adau->type == ADAU1361) in adau17x1_set_dai_tdm_slot()
704 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 0; in adau17x1_set_dai_tdm_slot()
708 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 1; in adau17x1_set_dai_tdm_slot()
712 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 2; in adau17x1_set_dai_tdm_slot()
716 adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] = 3; in adau17x1_set_dai_tdm_slot()
725 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 0; in adau17x1_set_dai_tdm_slot()
729 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 1; in adau17x1_set_dai_tdm_slot()
733 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 2; in adau17x1_set_dai_tdm_slot()
737 adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] = 3; in adau17x1_set_dai_tdm_slot()
743 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER0, in adau17x1_set_dai_tdm_slot()
745 regmap_update_bits(adau->regmap, ADAU17X1_CONVERTER1, in adau17x1_set_dai_tdm_slot()
747 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT0, in adau17x1_set_dai_tdm_slot()
749 regmap_update_bits(adau->regmap, ADAU17X1_SERIAL_PORT1, in adau17x1_set_dai_tdm_slot()
752 if (!adau17x1_has_dsp(adau) && !adau17x1_has_disused_dsp(adau)) in adau17x1_set_dai_tdm_slot()
755 if (adau->dsp_bypass[SNDRV_PCM_STREAM_PLAYBACK]) { in adau17x1_set_dai_tdm_slot()
756 regmap_write(adau->regmap, ADAU17X1_SERIAL_INPUT_ROUTE, in adau17x1_set_dai_tdm_slot()
757 (adau->tdm_slot[SNDRV_PCM_STREAM_PLAYBACK] * 2) + 1); in adau17x1_set_dai_tdm_slot()
760 if (adau->dsp_bypass[SNDRV_PCM_STREAM_CAPTURE]) { in adau17x1_set_dai_tdm_slot()
761 regmap_write(adau->regmap, ADAU17X1_SERIAL_OUTPUT_ROUTE, in adau17x1_set_dai_tdm_slot()
762 (adau->tdm_slot[SNDRV_PCM_STREAM_CAPTURE] * 2) + 1); in adau17x1_set_dai_tdm_slot()
771 struct adau *adau = snd_soc_component_get_drvdata(dai->component); in adau17x1_startup() local
773 if (adau->sigmadsp) in adau17x1_startup()
774 return sigmadsp_restrict_params(adau->sigmadsp, substream); in adau17x1_startup()
792 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_set_micbias_voltage() local
802 return regmap_write(adau->regmap, ADAU17X1_MICBIAS, micbias << 2); in adau17x1_set_micbias_voltage()
883 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_setup_firmware() local
892 if (adau->sigmadsp->current_samplerate == rate) in adau17x1_setup_firmware()
897 ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr); in adau17x1_setup_firmware()
901 ret = regmap_read(adau->regmap, ADAU17X1_DSP_RUN, &dsp_run); in adau17x1_setup_firmware()
905 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1); in adau17x1_setup_firmware()
906 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf); in adau17x1_setup_firmware()
907 regmap_write(adau->regmap, ADAU17X1_DSP_RUN, 0); in adau17x1_setup_firmware()
909 ret = sigmadsp_setup(adau->sigmadsp, rate); in adau17x1_setup_firmware()
911 regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0); in adau17x1_setup_firmware()
914 regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr); in adau17x1_setup_firmware()
915 regmap_write(adau->regmap, ADAU17X1_DSP_RUN, dsp_run); in adau17x1_setup_firmware()
926 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_add_widgets() local
938 if (adau17x1_has_dsp(adau)) { in adau17x1_add_widgets()
944 if (!adau->sigmadsp) in adau17x1_add_widgets()
947 ret = sigmadsp_attach(adau->sigmadsp, component); in adau17x1_add_widgets()
962 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_add_routes() local
970 if (adau17x1_has_dsp(adau)) { in adau17x1_add_routes()
978 if (adau->clk_src != ADAU17X1_CLK_SRC_MCLK) in adau17x1_add_routes()
987 struct adau *adau = snd_soc_component_get_drvdata(component); in adau17x1_resume() local
989 if (adau->switch_mode) in adau17x1_resume()
990 adau->switch_mode(component->dev); in adau17x1_resume()
992 regcache_sync(adau->regmap); in adau17x1_resume()
1052 struct adau *adau; in adau17x1_probe() local
1058 adau = devm_kzalloc(dev, sizeof(*adau), GFP_KERNEL); in adau17x1_probe()
1059 if (!adau) in adau17x1_probe()
1063 adau->mclk = devm_clk_get_optional(dev, "mclk"); in adau17x1_probe()
1064 if (IS_ERR(adau->mclk)) in adau17x1_probe()
1065 return PTR_ERR(adau->mclk); in adau17x1_probe()
1067 if (adau->mclk) { in adau17x1_probe()
1068 adau->clk_src = ADAU17X1_CLK_SRC_PLL_AUTO; in adau17x1_probe()
1075 ret = adau_calc_pll_cfg(clk_get_rate(adau->mclk), 48000 * 1024, in adau17x1_probe()
1076 adau->pll_regs); in adau17x1_probe()
1080 ret = clk_prepare_enable(adau->mclk); in adau17x1_probe()
1085 adau->regmap = regmap; in adau17x1_probe()
1086 adau->switch_mode = switch_mode; in adau17x1_probe()
1087 adau->type = type; in adau17x1_probe()
1089 dev_set_drvdata(dev, adau); in adau17x1_probe()
1092 if (adau17x1_has_safeload(adau)) { in adau17x1_probe()
1093 adau->sigmadsp = devm_sigmadsp_init_regmap(dev, regmap, in adau17x1_probe()
1096 adau->sigmadsp = devm_sigmadsp_init_regmap(dev, regmap, in adau17x1_probe()
1099 if (IS_ERR(adau->sigmadsp)) { in adau17x1_probe()
1101 PTR_ERR(adau->sigmadsp)); in adau17x1_probe()
1102 adau->sigmadsp = NULL; in adau17x1_probe()
1115 struct adau *adau = dev_get_drvdata(dev); in adau17x1_remove() local
1117 clk_disable_unprepare(adau->mclk); in adau17x1_remove()