Lines Matching refs:madera
143 dev_err(_fll->madera->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
145 dev_warn(_fll->madera->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
147 dev_dbg(_fll->madera->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
171 struct madera *madera = priv->madera; in madera_clk_ev() local
176 ret = regmap_read(madera->regmap, w->reg, &val); in madera_clk_ev()
178 dev_err(madera->dev, "Failed to check clock source: %d\n", ret); in madera_clk_ev()
198 return clk_prepare_enable(madera->mclk[clk_idx].clk); in madera_clk_ev()
200 clk_disable_unprepare(madera->mclk[clk_idx].clk); in madera_clk_ev()
210 struct madera *madera = priv->madera; in madera_spin_sysclk() local
215 if (pm_runtime_suspended(madera->dev)) in madera_spin_sysclk()
223 ret = regmap_read(madera->regmap, MADERA_SOFTWARE_RESET, &val); in madera_spin_sysclk()
225 dev_err(madera->dev, in madera_spin_sysclk()
251 static int madera_check_speaker_overheat(struct madera *madera, in madera_check_speaker_overheat() argument
257 ret = regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_15, &val); in madera_check_speaker_overheat()
259 dev_err(madera->dev, "Failed to read thermal status: %d\n", in madera_check_speaker_overheat()
275 struct madera *madera = priv->madera; in madera_spk_ev() local
281 ret = madera_check_speaker_overheat(madera, &warn, &shutdown); in madera_spk_ev()
286 dev_crit(madera->dev, in madera_spk_ev()
291 regmap_update_bits(madera->regmap, MADERA_OUTPUT_ENABLES_1, in madera_spk_ev()
295 regmap_update_bits(madera->regmap, MADERA_OUTPUT_ENABLES_1, in madera_spk_ev()
308 struct madera *madera = data; in madera_thermal_warn() local
312 ret = madera_check_speaker_overheat(madera, &warn, &shutdown); in madera_thermal_warn()
314 dev_crit(madera->dev, "Thermal shutdown\n"); in madera_thermal_warn()
315 ret = regmap_update_bits(madera->regmap, in madera_thermal_warn()
320 dev_crit(madera->dev, in madera_thermal_warn()
324 dev_alert(madera->dev, "Thermal warning\n"); in madera_thermal_warn()
326 dev_info(madera->dev, "Spurious thermal warning\n"); in madera_thermal_warn()
335 struct madera *madera = priv->madera; in madera_init_overheat() local
336 struct device *dev = madera->dev; in madera_init_overheat()
339 ret = madera_request_irq(madera, MADERA_IRQ_SPK_OVERHEAT_WARN, in madera_init_overheat()
341 madera); in madera_init_overheat()
345 ret = madera_request_irq(madera, MADERA_IRQ_SPK_OVERHEAT, in madera_init_overheat()
347 madera); in madera_init_overheat()
357 struct madera *madera = priv->madera; in madera_free_overheat() local
359 madera_free_irq(madera, MADERA_IRQ_SPK_OVERHEAT_WARN, madera); in madera_free_overheat()
360 madera_free_irq(madera, MADERA_IRQ_SPK_OVERHEAT, madera); in madera_free_overheat()
400 struct madera *madera = priv->madera; in madera_prop_get_inmode() local
401 struct madera_codec_pdata *pdata = &madera->pdata.codec; in madera_prop_get_inmode()
408 n = madera_get_variable_u32_array(madera->dev, "cirrus,inmode", in madera_prop_get_inmode()
428 struct madera *madera = priv->madera; in madera_prop_get_pdata() local
429 struct madera_codec_pdata *pdata = &madera->pdata.codec; in madera_prop_get_pdata()
435 n = madera_get_variable_u32_array(madera->dev, "cirrus,out-mono", in madera_prop_get_pdata()
441 madera_get_variable_u32_array(madera->dev, in madera_prop_get_pdata()
447 madera_get_variable_u32_array(madera->dev, "cirrus,pdm-fmt", in madera_prop_get_pdata()
451 madera_get_variable_u32_array(madera->dev, "cirrus,pdm-mute", in madera_prop_get_pdata()
455 madera_get_variable_u32_array(madera->dev, "cirrus,dmic-ref", in madera_prop_get_pdata()
468 if (!dev_get_platdata(priv->madera->dev)) in madera_core_init()
474 priv->madera->out_clamp[i] = true; in madera_core_init()
490 struct madera *madera = priv->madera; in madera_debug_dump_domain_groups() local
494 dev_dbg(madera->dev, "domain_grp_ref[%d]=%d\n", i, in madera_debug_dump_domain_groups()
519 dev_dbg(priv->madera->dev, "Inc ref on domain group %d\n", in madera_domain_clk_ev()
524 dev_dbg(priv->madera->dev, "Dec ref on domain group %d\n", in madera_domain_clk_ev()
548 struct madera *madera = priv->madera; in madera_out1_demux_put() local
570 ret = regmap_update_bits(madera->regmap, MADERA_OUTPUT_ENABLES_1, in madera_out1_demux_put()
573 dev_warn(madera->dev, "Failed to disable outputs: %d\n", ret); in madera_out1_demux_put()
579 if (madera->out_clamp[0]) in madera_out1_demux_put()
580 ret = regmap_update_bits(madera->regmap, in madera_out1_demux_put()
584 dev_err(madera->dev, "Failed to set OUT1 demux: %d\n", ret); in madera_out1_demux_put()
587 if (!ep_sel && !madera->pdata.codec.out_mono[0]) in madera_out1_demux_put()
594 dev_warn(madera->dev, in madera_out1_demux_put()
603 (madera->out_clamp[0] && !madera->out_shorted[0])) { in madera_out1_demux_put()
604 ret = regmap_update_bits(madera->regmap, in madera_out1_demux_put()
607 madera->hp_ena); in madera_out1_demux_put()
609 dev_warn(madera->dev, in madera_out1_demux_put()
612 else if (madera->hp_ena) in madera_out1_demux_put()
623 dev_err(madera->dev, "Failed to update demux power state: %d\n", ret); in madera_out1_demux_put()
655 struct madera *madera = priv->madera; in madera_inmux_put() local
656 struct regmap *regmap = madera->regmap; in madera_inmux_put()
672 inmode = madera->pdata.codec.inmode[0][2 * mux]; in madera_inmux_put()
675 inmode = madera->pdata.codec.inmode[0][1 + (2 * mux)]; in madera_inmux_put()
678 inmode = madera->pdata.codec.inmode[1][2 * mux]; in madera_inmux_put()
681 inmode = madera->pdata.codec.inmode[1][1 + (2 * mux)]; in madera_inmux_put()
690 dev_dbg(madera->dev, "mux=%u reg=0x%x inmode=0x%x mask=0x%x val=0x%x\n", in madera_inmux_put()
864 dev_dbg(priv->madera->dev, "Rate reg 0x%x group ref %d\n", reg, count); in madera_can_change_grp_rate()
915 dev_warn(priv->madera->dev, in madera_adsp_rate_put()
975 switch (priv->madera->type) { in madera_write_adsp_clk_setting()
985 dev_dbg(priv->madera->dev, "Set DSP frequency to 0x%x\n", freq); in madera_write_adsp_clk_setting()
1000 dev_dbg(priv->madera->dev, "Set DSP clocking to 0x%x\n", val); in madera_write_adsp_clk_setting()
1014 struct madera *madera = priv->madera; in madera_set_adsp_clk() local
1029 dev_err(madera->dev, in madera_set_adsp_clk()
1039 dev_dbg(madera->dev, "DSP rate not changed\n"); in madera_set_adsp_clk()
1042 dev_dbg(madera->dev, "DSP rate changed\n"); in madera_set_adsp_clk()
1082 dev_warn(priv->madera->dev, in madera_rate_put()
1099 static void madera_configure_input_mode(struct madera *madera) in madera_configure_input_mode() argument
1104 switch (madera->type) { in madera_configure_input_mode()
1134 dev_dbg(madera->dev, "IN%d mode %u:%u:%u:%u\n", i + 1, in madera_configure_input_mode()
1135 madera->pdata.codec.inmode[i][0], in madera_configure_input_mode()
1136 madera->pdata.codec.inmode[i][1], in madera_configure_input_mode()
1137 madera->pdata.codec.inmode[i][2], in madera_configure_input_mode()
1138 madera->pdata.codec.inmode[i][3]); in madera_configure_input_mode()
1140 dig_mode = madera->pdata.codec.dmic_ref[i] << in madera_configure_input_mode()
1143 switch (madera->pdata.codec.inmode[i][0]) { in madera_configure_input_mode()
1151 dev_warn(madera->dev, in madera_configure_input_mode()
1153 i + 1, madera->pdata.codec.inmode[i][0]); in madera_configure_input_mode()
1157 switch (madera->pdata.codec.inmode[i][1]) { in madera_configure_input_mode()
1165 dev_warn(madera->dev, in madera_configure_input_mode()
1167 i + 1, madera->pdata.codec.inmode[i][1]); in madera_configure_input_mode()
1171 dev_dbg(madera->dev, in madera_configure_input_mode()
1175 regmap_update_bits(madera->regmap, in madera_configure_input_mode()
1182 regmap_update_bits(madera->regmap, in madera_configure_input_mode()
1186 regmap_update_bits(madera->regmap, in madera_configure_input_mode()
1195 struct madera *madera = priv->madera; in madera_init_inputs() local
1197 madera_configure_input_mode(madera); in madera_init_inputs()
1219 struct madera *madera = priv->madera; in madera_init_outputs() local
1220 const struct madera_codec_pdata *pdata = &madera->pdata.codec; in madera_init_outputs()
1225 dev_warn(madera->dev, in madera_init_outputs()
1246 regmap_update_bits(madera->regmap, in madera_init_outputs()
1250 dev_dbg(madera->dev, "OUT%d mono=0x%x\n", i + 1, val); in madera_init_outputs()
1254 dev_dbg(madera->dev, "PDM%d fmt=0x%x mute=0x%x\n", i + 1, in madera_init_outputs()
1258 regmap_update_bits(madera->regmap, in madera_init_outputs()
1265 regmap_update_bits(madera->regmap, in madera_init_outputs()
1278 struct madera *madera = priv->madera; in madera_init_bus_error_irq() local
1281 ret = madera_request_irq(madera, in madera_init_bus_error_irq()
1287 dev_err(madera->dev, in madera_init_bus_error_irq()
1296 struct madera *madera = priv->madera; in madera_free_bus_error_irq() local
1298 madera_free_irq(madera, in madera_free_bus_error_irq()
2256 ret = regmap_update_bits(priv->madera->regmap, in madera_in_set_vu()
2260 dev_warn(priv->madera->dev, in madera_in_set_vu()
2316 struct madera *madera = priv->madera; in madera_out_ev() local
2319 switch (madera->type) { in madera_out_ev()
2416 struct madera *madera = priv->madera; in madera_hp_ev() local
2437 madera->hp_ena &= ~mask; in madera_hp_ev()
2438 madera->hp_ena |= val; in madera_hp_ev()
2440 switch (madera->type) { in madera_hp_ev()
2447 regmap_read(madera->regmap, MADERA_OUTPUT_ENABLES_1, &ep_sel); in madera_hp_ev()
2454 (!madera->out_clamp[out_num] || madera->out_shorted[out_num])) in madera_hp_ev()
2457 regmap_update_bits(madera->regmap, MADERA_OUTPUT_ENABLES_1, mask, val); in madera_hp_ev()
2579 static int madera_get_legacy_dspclk_setting(struct madera *madera, in madera_get_legacy_dspclk_setting() argument
2587 switch (madera->type) { in madera_get_legacy_dspclk_setting()
2590 if (madera->rev < 3) in madera_get_legacy_dspclk_setting()
2606 static int madera_get_dspclk_setting(struct madera *madera, in madera_get_dspclk_setting() argument
2610 switch (madera->type) { in madera_get_dspclk_setting()
2615 return madera_get_legacy_dspclk_setting(madera, freq); in madera_get_dspclk_setting()
2682 struct madera *madera = priv->madera; in madera_set_sysclk() local
2708 clk_freq_sel = madera_get_dspclk_setting(madera, freq, in madera_set_sysclk()
2721 dev_err(madera->dev, in madera_set_sysclk()
2729 dev_dbg(madera->dev, "%s cleared\n", name); in madera_set_sysclk()
2736 ret = regmap_write(madera->regmap, MADERA_DSP_CLOCK_2, in madera_set_sysclk()
2739 dev_err(madera->dev, in madera_set_sysclk()
2754 dev_dbg(madera->dev, "%s set to %uHz\n", name, freq); in madera_set_sysclk()
2756 return regmap_update_bits(madera->regmap, reg, mask, val); in madera_set_sysclk()
2764 struct madera *madera = priv->madera; in madera_set_fmt() local
2839 regmap_update_bits(madera->regmap, base + MADERA_AIF_BCLK_CTRL, in madera_set_fmt()
2842 regmap_update_bits(madera->regmap, base + MADERA_AIF_TX_PIN_CTRL, in madera_set_fmt()
2845 regmap_update_bits(madera->regmap, base + MADERA_AIF_RX_PIN_CTRL, in madera_set_fmt()
2848 regmap_update_bits(madera->regmap, base + MADERA_AIF_FORMAT, in madera_set_fmt()
2945 struct madera *madera = priv->madera; in madera_startup() local
2965 switch (madera->type) { in madera_startup()
3046 ret = regmap_read(priv->madera->regmap, in madera_hw_params_rate()
3103 struct madera *madera = priv->madera; in madera_hw_params() local
3111 madera->pdata.codec.max_channels_clocked[dai->id - 1]; in madera_hw_params()
3178 regmap_read(madera->regmap, base + MADERA_AIF_TX_ENABLES, in madera_hw_params()
3180 regmap_read(madera->regmap, base + MADERA_AIF_RX_ENABLES, in madera_hw_params()
3183 regmap_update_bits(madera->regmap, in madera_hw_params()
3185 regmap_update_bits(madera->regmap, in madera_hw_params()
3194 regmap_update_bits(madera->regmap, in madera_hw_params()
3197 regmap_update_bits(madera->regmap, in madera_hw_params()
3200 regmap_update_bits(madera->regmap, in madera_hw_params()
3204 regmap_update_bits(madera->regmap, in madera_hw_params()
3213 regmap_update_bits(madera->regmap, in madera_hw_params()
3216 regmap_update_bits(madera->regmap, in madera_hw_params()
3315 struct madera *madera = priv->madera; in madera_set_channels_to_mask() local
3323 regmap_write(madera->regmap, base + i, slot); in madera_set_channels_to_mask()
3477 switch (fll->madera->type) { in madera_find_fratio()
3479 switch (fll->madera->rev) { in madera_find_fratio()
3534 switch (fll->madera->type) { in madera_calc_fratio()
3536 switch (fll->madera->rev) { in madera_calc_fratio()
3665 switch (fll->madera->type) { in madera_calc_fll()
3667 switch (fll->madera->rev) { in madera_calc_fll()
3714 static bool madera_write_fll(struct madera *madera, unsigned int base, in madera_write_fll() argument
3721 regmap_update_bits_check(madera->regmap, in madera_write_fll()
3726 regmap_update_bits_check(madera->regmap, in madera_write_fll()
3731 regmap_update_bits_check(madera->regmap, in madera_write_fll()
3737 regmap_update_bits_check(madera->regmap, in madera_write_fll()
3747 regmap_update_bits_check(madera->regmap, in madera_write_fll()
3754 regmap_update_bits_check(madera->regmap, in madera_write_fll()
3762 regmap_update_bits_check(madera->regmap, in madera_write_fll()
3773 struct madera *madera = fll->madera; in madera_is_enabled_fll() local
3777 ret = regmap_read(madera->regmap, in madera_is_enabled_fll()
3789 struct madera *madera = fll->madera; in madera_wait_for_fll() local
3797 regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_2, &val); in madera_wait_for_fll()
3833 regmap_update_bits_check(fll->madera->regmap, in madera_set_fll_phase_integrator()
3846 struct madera *madera = fll->madera; in madera_set_fll_clks_reg() local
3851 ret = regmap_read(madera->regmap, reg, &src); in madera_set_fll_clks_reg()
3862 clk = madera->mclk[MADERA_MCLK1].clk; in madera_set_fll_clks_reg()
3865 clk = madera->mclk[MADERA_MCLK2].clk; in madera_set_fll_clks_reg()
3868 clk = madera->mclk[MADERA_MCLK3].clk; in madera_set_fll_clks_reg()
3908 struct madera *madera = fll->madera; in madera_disable_fll() local
3912 switch (madera->type) { in madera_disable_fll()
3923 regmap_update_bits(madera->regmap, in madera_disable_fll()
3926 regmap_update_bits_check(madera->regmap, in madera_disable_fll()
3929 regmap_update_bits_check(madera->regmap, in madera_disable_fll()
3932 regmap_update_bits(madera->regmap, in madera_disable_fll()
3943 pm_runtime_put_autosuspend(madera->dev); in madera_disable_fll()
3949 struct madera *madera = fll->madera; in madera_enable_fll() local
3977 switch (madera->type) { in madera_enable_fll()
3992 regmap_update_bits(fll->madera->regmap, in madera_enable_fll()
3997 regmap_update_bits(fll->madera->regmap, in madera_enable_fll()
4012 fll_change |= madera_write_fll(madera, sync_base, in madera_enable_fll()
4030 switch (fll->madera->type) { in madera_enable_fll()
4032 switch (fll->madera->rev) { in madera_enable_fll()
4061 fll_change |= madera_write_fll(madera, fll->base, in madera_enable_fll()
4070 regmap_update_bits(madera->regmap, in madera_enable_fll()
4074 regmap_update_bits(madera->regmap, in madera_enable_fll()
4080 pm_runtime_get_sync(madera->dev); in madera_enable_fll()
4084 regmap_update_bits(madera->regmap, in madera_enable_fll()
4091 regmap_update_bits(madera->regmap, in madera_enable_fll()
4096 regmap_update_bits(madera->regmap, in madera_enable_fll()
4173 int madera_init_fll(struct madera *madera, int id, int base, in madera_init_fll() argument
4178 fll->madera = madera; in madera_init_fll()
4182 regmap_update_bits(madera->regmap, in madera_init_fll()
4243 struct madera *madera = fll->madera; in madera_enable_fll_ao() local
4252 pm_runtime_get_sync(madera->dev); in madera_enable_fll_ao()
4258 regmap_update_bits(fll->madera->regmap, in madera_enable_fll_ao()
4275 regmap_write(madera->regmap, patch[i].reg, val); in madera_enable_fll_ao()
4280 regmap_update_bits(madera->regmap, in madera_enable_fll_ao()
4285 regmap_update_bits(madera->regmap, in madera_enable_fll_ao()
4297 struct madera *madera = fll->madera; in madera_disable_fll_ao() local
4302 regmap_update_bits(madera->regmap, in madera_disable_fll_ao()
4305 regmap_update_bits_check(madera->regmap, in madera_disable_fll_ao()
4319 regmap_update_bits(madera->regmap, in madera_disable_fll_ao()
4325 pm_runtime_put_autosuspend(madera->dev); in madera_disable_fll_ao()
4378 struct madera *madera = fll->madera; in madera_fllhj_disable() local
4389 regmap_update_bits(madera->regmap, in madera_fllhj_disable()
4392 regmap_update_bits(madera->regmap, in madera_fllhj_disable()
4395 regmap_update_bits_check(madera->regmap, in madera_fllhj_disable()
4408 regmap_update_bits(madera->regmap, in madera_fllhj_disable()
4414 pm_runtime_put_autosuspend(madera->dev); in madera_fllhj_disable()
4422 struct madera *madera = fll->madera; in madera_fllhj_apply() local
4524 regmap_write(madera->regmap, in madera_fllhj_apply()
4527 regmap_update_bits(madera->regmap, in madera_fllhj_apply()
4531 regmap_update_bits(madera->regmap, in madera_fllhj_apply()
4535 regmap_update_bits(madera->regmap, in madera_fllhj_apply()
4539 regmap_update_bits(madera->regmap, in madera_fllhj_apply()
4543 regmap_update_bits(madera->regmap, in madera_fllhj_apply()
4549 regmap_update_bits(madera->regmap, in madera_fllhj_apply()
4553 regmap_update_bits(madera->regmap, in madera_fllhj_apply()
4557 regmap_update_bits(madera->regmap, in madera_fllhj_apply()
4568 struct madera *madera = fll->madera; in madera_fllhj_enable() local
4576 pm_runtime_get_sync(madera->dev); in madera_fllhj_enable()
4582 regmap_update_bits(fll->madera->regmap, in madera_fllhj_enable()
4596 regmap_update_bits(madera->regmap, in madera_fllhj_enable()
4603 regmap_update_bits(madera->regmap, in madera_fllhj_enable()
4609 regmap_update_bits(madera->regmap, in madera_fllhj_enable()
4614 regmap_update_bits(madera->regmap, in madera_fllhj_enable()
4620 regmap_update_bits(madera->regmap, in madera_fllhj_enable()
4747 struct madera *madera = priv->madera; in madera_eq_coeff_put() local
4754 len = params->num_regs * regmap_get_val_bytes(madera->regmap); in madera_eq_coeff_put()
4767 dev_err(madera->dev, "Rejecting unstable EQ coefficients\n"); in madera_eq_coeff_put()
4772 ret = regmap_read(madera->regmap, params->base, &val); in madera_eq_coeff_put()
4779 ret = regmap_raw_write(madera->regmap, params->base, data, len); in madera_eq_coeff_put()
4794 struct madera *madera = priv->madera; in madera_lhpf_coeff_put() local
4799 dev_err(madera->dev, "Rejecting unstable LHPF coefficients\n"); in madera_lhpf_coeff_put()