Lines Matching full:arizona
3 * arizona.c - Wolfson Arizona class device shared support
19 #include <linux/mfd/arizona/core.h>
20 #include <linux/mfd/arizona/registers.h>
22 #include "arizona.h"
67 dev_err(_fll->arizona->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
69 dev_warn(_fll->arizona->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
71 dev_dbg(_fll->arizona->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__)
85 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in arizona_spk_ev() local
93 dev_crit(arizona->dev, in arizona_spk_ev()
98 regmap_update_bits_async(arizona->regmap, in arizona_spk_ev()
103 regmap_update_bits_async(arizona->regmap, in arizona_spk_ev()
116 struct arizona *arizona = data; in arizona_thermal_warn() local
120 ret = regmap_read(arizona->regmap, ARIZONA_INTERRUPT_RAW_STATUS_3, in arizona_thermal_warn()
123 dev_err(arizona->dev, "Failed to read thermal status: %d\n", in arizona_thermal_warn()
126 dev_crit(arizona->dev, "Thermal warning\n"); in arizona_thermal_warn()
134 struct arizona *arizona = data; in arizona_thermal_shutdown() local
138 ret = regmap_read(arizona->regmap, ARIZONA_INTERRUPT_RAW_STATUS_3, in arizona_thermal_shutdown()
141 dev_err(arizona->dev, "Failed to read thermal status: %d\n", in arizona_thermal_shutdown()
144 dev_crit(arizona->dev, "Thermal shutdown\n"); in arizona_thermal_shutdown()
145 ret = regmap_update_bits(arizona->regmap, in arizona_thermal_shutdown()
150 dev_crit(arizona->dev, in arizona_thermal_shutdown()
174 struct arizona *arizona = priv->arizona; in arizona_init_spk() local
181 switch (arizona->type) { in arizona_init_spk()
197 int arizona_init_spk_irqs(struct arizona *arizona) in arizona_init_spk_irqs() argument
201 ret = arizona_request_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT_WARN, in arizona_init_spk_irqs()
203 arizona); in arizona_init_spk_irqs()
205 dev_err(arizona->dev, in arizona_init_spk_irqs()
209 ret = arizona_request_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT, in arizona_init_spk_irqs()
211 arizona); in arizona_init_spk_irqs()
213 dev_err(arizona->dev, in arizona_init_spk_irqs()
221 int arizona_free_spk_irqs(struct arizona *arizona) in arizona_free_spk_irqs() argument
223 arizona_free_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT_WARN, arizona); in arizona_free_spk_irqs()
224 arizona_free_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT, arizona); in arizona_free_spk_irqs()
243 struct arizona *arizona = priv->arizona; in arizona_init_mono() local
247 if (arizona->pdata.out_mono[i]) in arizona_init_mono()
259 struct arizona *arizona = priv->arizona; in arizona_init_gpio() local
262 switch (arizona->type) { in arizona_init_gpio()
274 for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) { in arizona_init_gpio()
275 switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) { in arizona_init_gpio()
293 int arizona_init_common(struct arizona *arizona) in arizona_init_common() argument
295 struct arizona_pdata *pdata = &arizona->pdata; in arizona_init_common()
299 BLOCKING_INIT_NOTIFIER_HEAD(&arizona->notifier); in arizona_init_common()
308 regmap_update_bits(arizona->regmap, in arizona_init_common()
315 regmap_update_bits(arizona->regmap, in arizona_init_common()
322 regmap_update_bits(arizona->regmap, in arizona_init_common()
334 switch (arizona->type) { in arizona_init_common()
337 regmap_update_bits(arizona->regmap, in arizona_init_common()
343 regmap_update_bits(arizona->regmap, in arizona_init_common()
362 regmap_update_bits(arizona->regmap, in arizona_init_common()
371 int arizona_init_vol_limit(struct arizona *arizona) in arizona_init_vol_limit() argument
375 for (i = 0; i < ARRAY_SIZE(arizona->pdata.out_vol_limit); ++i) { in arizona_init_vol_limit()
376 if (arizona->pdata.out_vol_limit[i]) in arizona_init_vol_limit()
377 regmap_update_bits(arizona->regmap, in arizona_init_vol_limit()
380 arizona->pdata.out_vol_limit[i]); in arizona_init_vol_limit()
958 struct arizona *arizona = priv->arizona; in arizona_out_ev() local
975 switch (arizona->type) { in arizona_out_ev()
1025 switch (arizona->type) { in arizona_out_ev()
1076 struct arizona *arizona = priv->arizona; in arizona_hp_ev() local
1095 priv->arizona->hp_ena &= ~mask; in arizona_hp_ev()
1096 priv->arizona->hp_ena |= val; in arizona_hp_ev()
1099 if (priv->arizona->hpdet_clamp) in arizona_hp_ev()
1102 regmap_update_bits_async(arizona->regmap, ARIZONA_OUTPUT_ENABLES_1, in arizona_hp_ev()
1112 struct arizona *arizona = priv->arizona; in arizona_dvfs_enable() local
1115 ret = regulator_set_voltage(arizona->dcvdd, 1800000, 1800000); in arizona_dvfs_enable()
1121 ret = regmap_update_bits(arizona->regmap, in arizona_dvfs_enable()
1127 regulator_set_voltage(arizona->dcvdd, 1200000, 1800000); in arizona_dvfs_enable()
1137 struct arizona *arizona = priv->arizona; in arizona_dvfs_disable() local
1140 ret = regmap_update_bits(arizona->regmap, in arizona_dvfs_disable()
1148 ret = regulator_set_voltage(arizona->dcvdd, 1200000, 1800000); in arizona_dvfs_disable()
1328 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in arizona_clk_ev() local
1333 ret = regmap_read(arizona->regmap, w->reg, &val); in arizona_clk_ev()
1354 return clk_prepare_enable(arizona->mclk[clk_idx]); in arizona_clk_ev()
1356 clk_disable_unprepare(arizona->mclk[clk_idx]); in arizona_clk_ev()
1368 struct arizona *arizona = priv->arizona; in arizona_set_sysclk() local
1423 dev_dbg(arizona->dev, "%s cleared\n", name); in arizona_set_sysclk()
1435 dev_dbg(arizona->dev, "%s set to %uHz", name, freq); in arizona_set_sysclk()
1437 return regmap_update_bits(arizona->regmap, reg, mask, val); in arizona_set_sysclk()
1445 struct arizona *arizona = priv->arizona; in arizona_set_fmt() local
1518 regmap_update_bits_async(arizona->regmap, base + ARIZONA_AIF_BCLK_CTRL, in arizona_set_fmt()
1522 regmap_update_bits_async(arizona->regmap, base + ARIZONA_AIF_TX_PIN_CTRL, in arizona_set_fmt()
1525 regmap_update_bits_async(arizona->regmap, in arizona_set_fmt()
1529 regmap_update_bits(arizona->regmap, base + ARIZONA_AIF_FORMAT, in arizona_set_fmt()
1653 struct arizona *arizona = priv->arizona; in arizona_wm5102_set_dac_comp() local
1661 mutex_lock(&arizona->dac_comp_lock); in arizona_wm5102_set_dac_comp()
1663 dac_comp[1].def = arizona->dac_comp_coeff; in arizona_wm5102_set_dac_comp()
1665 dac_comp[2].def = arizona->dac_comp_enabled; in arizona_wm5102_set_dac_comp()
1667 mutex_unlock(&arizona->dac_comp_lock); in arizona_wm5102_set_dac_comp()
1669 regmap_multi_reg_write(arizona->regmap, in arizona_wm5102_set_dac_comp()
1698 switch (priv->arizona->type) { in arizona_hw_params_rate()
1717 switch (priv->arizona->type) { in arizona_hw_params_rate()
1780 struct arizona *arizona = priv->arizona; in arizona_hw_params() local
1785 int chan_limit = arizona->pdata.max_channels_clocked[dai->id - 1]; in arizona_hw_params()
1786 int tdm_width = arizona->tdm_width[dai->id - 1]; in arizona_hw_params()
1787 int tdm_slots = arizona->tdm_slots[dai->id - 1]; in arizona_hw_params()
1853 regmap_update_bits_async(arizona->regmap, in arizona_hw_params()
1856 regmap_update_bits(arizona->regmap, in arizona_hw_params()
1865 regmap_update_bits_async(arizona->regmap, in arizona_hw_params()
1868 regmap_update_bits_async(arizona->regmap, in arizona_hw_params()
1871 regmap_update_bits_async(arizona->regmap, in arizona_hw_params()
1874 regmap_update_bits_async(arizona->regmap, in arizona_hw_params()
1878 regmap_update_bits(arizona->regmap, in arizona_hw_params()
1887 regmap_update_bits_async(arizona->regmap, in arizona_hw_params()
1890 regmap_update_bits(arizona->regmap, in arizona_hw_params()
1977 struct arizona *arizona = priv->arizona; in arizona_set_channels_to_mask() local
1985 regmap_write(arizona->regmap, base + i, slot); in arizona_set_channels_to_mask()
1999 struct arizona *arizona = priv->arizona; in arizona_set_tdm_slot() local
2018 arizona->tdm_width[dai->id - 1] = slot_width; in arizona_set_tdm_slot()
2019 arizona->tdm_slots[dai->id - 1] = slots; in arizona_set_tdm_slot()
2177 switch (fll->arizona->type) { in arizona_calc_fratio()
2183 if (fll->arizona->rev < 3 || sync) in arizona_calc_fratio()
2328 static void arizona_apply_fll(struct arizona *arizona, unsigned int base, in arizona_apply_fll() argument
2332 regmap_update_bits_async(arizona->regmap, base + 3, in arizona_apply_fll()
2334 regmap_update_bits_async(arizona->regmap, base + 4, in arizona_apply_fll()
2336 regmap_update_bits_async(arizona->regmap, base + 5, in arizona_apply_fll()
2339 regmap_update_bits_async(arizona->regmap, base + 6, in arizona_apply_fll()
2346 regmap_update_bits(arizona->regmap, base + 0x7, in arizona_apply_fll()
2350 regmap_update_bits(arizona->regmap, base + 0x5, in arizona_apply_fll()
2353 regmap_update_bits(arizona->regmap, base + 0x9, in arizona_apply_fll()
2358 regmap_update_bits_async(arizona->regmap, base + 2, in arizona_apply_fll()
2365 struct arizona *arizona = fll->arizona; in arizona_is_enabled_fll() local
2369 ret = regmap_read(arizona->regmap, base + 1, ®); in arizona_is_enabled_fll()
2381 struct arizona *arizona = fll->arizona; in arizona_set_fll_clks() local
2386 ret = regmap_read(arizona->regmap, base + 6, &val); in arizona_set_fll_clks()
2398 clk = arizona->mclk[ARIZONA_MCLK1]; in arizona_set_fll_clks()
2401 clk = arizona->mclk[ARIZONA_MCLK2]; in arizona_set_fll_clks()
2417 struct arizona *arizona = fll->arizona; in arizona_enable_fll() local
2432 regmap_update_bits(fll->arizona->regmap, fll->base + 1, in arizona_enable_fll()
2435 regmap_update_bits_async(fll->arizona->regmap, fll->base + 0x9, in arizona_enable_fll()
2455 arizona_apply_fll(arizona, fll->base, &cfg, fll->ref_src, in arizona_enable_fll()
2460 arizona_apply_fll(arizona, fll->base + 0x10, &cfg, in arizona_enable_fll()
2467 arizona_apply_fll(arizona, fll->base, &cfg, in arizona_enable_fll()
2470 regmap_update_bits_async(arizona->regmap, fll->base + 0x11, in arizona_enable_fll()
2485 regmap_update_bits_async(arizona->regmap, fll->base + 0x17, in arizona_enable_fll()
2488 regmap_update_bits_async(arizona->regmap, fll->base + 0x17, in arizona_enable_fll()
2493 pm_runtime_get_sync(arizona->dev); in arizona_enable_fll()
2497 regmap_update_bits_async(arizona->regmap, fll->base + 0x11, in arizona_enable_fll()
2502 regmap_update_bits_async(arizona->regmap, fll->base + 1, in arizona_enable_fll()
2506 regmap_update_bits_async(arizona->regmap, fll->base + 1, in arizona_enable_fll()
2517 regmap_read(arizona->regmap, in arizona_enable_fll()
2533 struct arizona *arizona = fll->arizona; in arizona_disable_fll() local
2536 regmap_update_bits_async(arizona->regmap, fll->base + 1, in arizona_disable_fll()
2538 regmap_update_bits_check(arizona->regmap, fll->base + 1, in arizona_disable_fll()
2540 regmap_update_bits_check(arizona->regmap, fll->base + 0x11, in arizona_disable_fll()
2542 regmap_update_bits_async(arizona->regmap, fll->base + 1, in arizona_disable_fll()
2550 pm_runtime_put_autosuspend(arizona->dev); in arizona_disable_fll()
2612 int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq, in arizona_init_fll() argument
2619 fll->arizona = arizona; in arizona_init_fll()
2623 regmap_read(arizona->regmap, ARIZONA_CLOCK_32K_1, &val); in arizona_init_fll()
2638 regmap_update_bits(arizona->regmap, fll->base + 1, in arizona_init_fll()
2727 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in arizona_eq_coeff_put() local
2734 len = params->num_regs * regmap_get_val_bytes(arizona->regmap); in arizona_eq_coeff_put()
2747 dev_err(arizona->dev, "Rejecting unstable EQ coefficients\n"); in arizona_eq_coeff_put()
2752 ret = regmap_read(arizona->regmap, params->base, &val); in arizona_eq_coeff_put()
2759 ret = regmap_raw_write(arizona->regmap, params->base, data, len); in arizona_eq_coeff_put()
2771 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in arizona_lhpf_coeff_put() local
2776 dev_err(arizona->dev, "Rejecting unstable LHPF coefficients\n"); in arizona_lhpf_coeff_put()
2784 int arizona_of_get_audio_pdata(struct arizona *arizona) in arizona_of_get_audio_pdata() argument
2786 struct arizona_pdata *pdata = &arizona->pdata; in arizona_of_get_audio_pdata()
2787 struct device_node *np = arizona->dev->of_node; in arizona_of_get_audio_pdata()
2858 MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support");