1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
207ed873eSMark Brown /*
307ed873eSMark Brown * arizona.h - Wolfson Arizona class device shared support
407ed873eSMark Brown *
507ed873eSMark Brown * Copyright 2012 Wolfson Microelectronics plc
607ed873eSMark Brown *
707ed873eSMark Brown * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
807ed873eSMark Brown */
907ed873eSMark Brown
1007ed873eSMark Brown #ifndef _ASOC_ARIZONA_H
1107ed873eSMark Brown #define _ASOC_ARIZONA_H
1207ed873eSMark Brown
1307ed873eSMark Brown #include <linux/completion.h>
14d3d5c905SCharles Keepax #include <linux/notifier.h>
15d3d5c905SCharles Keepax #include <linux/mfd/arizona/core.h>
1607ed873eSMark Brown
1707ed873eSMark Brown #include <sound/soc.h>
1807ed873eSMark Brown
190b09df66SMark Brown #include "wm_adsp.h"
200b09df66SMark Brown
2107ed873eSMark Brown #define ARIZONA_CLK_SYSCLK 1
2207ed873eSMark Brown #define ARIZONA_CLK_ASYNCCLK 2
23cbd840daSMark Brown #define ARIZONA_CLK_OPCLK 3
24cbd840daSMark Brown #define ARIZONA_CLK_ASYNC_OPCLK 4
2507ed873eSMark Brown
2607ed873eSMark Brown #define ARIZONA_CLK_SRC_MCLK1 0x0
2707ed873eSMark Brown #define ARIZONA_CLK_SRC_MCLK2 0x1
2807ed873eSMark Brown #define ARIZONA_CLK_SRC_FLL1 0x4
2907ed873eSMark Brown #define ARIZONA_CLK_SRC_FLL2 0x5
3007ed873eSMark Brown #define ARIZONA_CLK_SRC_AIF1BCLK 0x8
3107ed873eSMark Brown #define ARIZONA_CLK_SRC_AIF2BCLK 0x9
3207ed873eSMark Brown #define ARIZONA_CLK_SRC_AIF3BCLK 0xa
3307ed873eSMark Brown
34f3f1163dSCharles Keepax #define ARIZONA_FLL_SRC_NONE -1
3507ed873eSMark Brown #define ARIZONA_FLL_SRC_MCLK1 0
3607ed873eSMark Brown #define ARIZONA_FLL_SRC_MCLK2 1
37a8c02db0SMark Brown #define ARIZONA_FLL_SRC_SLIMCLK 3
38a8c02db0SMark Brown #define ARIZONA_FLL_SRC_FLL1 4
39a8c02db0SMark Brown #define ARIZONA_FLL_SRC_FLL2 5
40a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF1BCLK 8
41a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF2BCLK 9
42a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF3BCLK 10
43a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF1LRCLK 12
44a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF2LRCLK 13
45a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF3LRCLK 14
4607ed873eSMark Brown
4707ed873eSMark Brown #define ARIZONA_MIXER_VOL_MASK 0x00FE
4807ed873eSMark Brown #define ARIZONA_MIXER_VOL_SHIFT 1
4907ed873eSMark Brown #define ARIZONA_MIXER_VOL_WIDTH 7
5007ed873eSMark Brown
513f341f74SMark Brown #define ARIZONA_CLK_6MHZ 0
523f341f74SMark Brown #define ARIZONA_CLK_12MHZ 1
533f341f74SMark Brown #define ARIZONA_CLK_24MHZ 2
543f341f74SMark Brown #define ARIZONA_CLK_49MHZ 3
553f341f74SMark Brown #define ARIZONA_CLK_73MHZ 4
563f341f74SMark Brown #define ARIZONA_CLK_98MHZ 5
573f341f74SMark Brown #define ARIZONA_CLK_147MHZ 6
583f341f74SMark Brown
5931889507SCharles Keepax #define ARIZONA_MAX_DAI 10
600b09df66SMark Brown #define ARIZONA_MAX_ADSP 4
615b2eec3fSMark Brown
62346d9683SRichard Fitzgerald #define ARIZONA_DVFS_SR1_RQ 0x001
63346d9683SRichard Fitzgerald #define ARIZONA_DVFS_ADSP1_RQ 0x100
64346d9683SRichard Fitzgerald
657baa7e24SCharles Keepax /* Notifier events */
667baa7e24SCharles Keepax #define ARIZONA_NOTIFY_VOICE_TRIGGER 0x1
677baa7e24SCharles Keepax
680b09df66SMark Brown struct wm_adsp;
6907ed873eSMark Brown
705b2eec3fSMark Brown struct arizona_dai_priv {
715b2eec3fSMark Brown int clk;
72d81221ffSCharles Keepax
73d81221ffSCharles Keepax struct snd_pcm_hw_constraint_list constraint;
745b2eec3fSMark Brown };
755b2eec3fSMark Brown
7607ed873eSMark Brown struct arizona_priv {
770b09df66SMark Brown struct wm_adsp adsp[ARIZONA_MAX_ADSP];
7807ed873eSMark Brown struct arizona *arizona;
7907ed873eSMark Brown int sysclk;
8007ed873eSMark Brown int asyncclk;
815b2eec3fSMark Brown struct arizona_dai_priv dai[ARIZONA_MAX_DAI];
82ddbce97cSMark Brown
83ddbce97cSMark Brown int num_inputs;
84ddbce97cSMark Brown unsigned int in_pending;
8556447e13SMark Brown
86e1ae5fbaSCharles Keepax unsigned int out_up_pending;
87e1ae5fbaSCharles Keepax unsigned int out_up_delay;
88054e1b48SCharles Keepax unsigned int out_down_pending;
89054e1b48SCharles Keepax unsigned int out_down_delay;
90054e1b48SCharles Keepax
91346d9683SRichard Fitzgerald unsigned int dvfs_reqs;
92346d9683SRichard Fitzgerald struct mutex dvfs_lock;
93346d9683SRichard Fitzgerald bool dvfs_cached;
94bcda8cc4SHans de Goede
95bcda8cc4SHans de Goede /* Variables used by arizona-jack.c code */
96bcda8cc4SHans de Goede struct mutex lock;
97bcda8cc4SHans de Goede struct delayed_work hpdet_work;
98bcda8cc4SHans de Goede struct delayed_work micd_detect_work;
99bcda8cc4SHans de Goede struct delayed_work micd_timeout_work;
100*236b7285SHans de Goede struct snd_soc_jack *jack;
101bcda8cc4SHans de Goede struct regulator *micvdd;
102bcda8cc4SHans de Goede struct gpio_desc *micd_pol_gpio;
103bcda8cc4SHans de Goede
104bcda8cc4SHans de Goede u16 last_jackdet;
105bcda8cc4SHans de Goede
106bcda8cc4SHans de Goede int micd_mode;
107bcda8cc4SHans de Goede const struct arizona_micd_config *micd_modes;
108bcda8cc4SHans de Goede int micd_num_modes;
109bcda8cc4SHans de Goede
110*236b7285SHans de Goede int micd_button_mask;
111bcda8cc4SHans de Goede const struct arizona_micd_range *micd_ranges;
112bcda8cc4SHans de Goede int num_micd_ranges;
113bcda8cc4SHans de Goede
114bcda8cc4SHans de Goede bool micd_reva;
115bcda8cc4SHans de Goede bool micd_clamp;
116bcda8cc4SHans de Goede
117bcda8cc4SHans de Goede bool hpdet_active;
118bcda8cc4SHans de Goede bool hpdet_done;
119bcda8cc4SHans de Goede bool hpdet_retried;
120bcda8cc4SHans de Goede
121bcda8cc4SHans de Goede bool mic;
122bcda8cc4SHans de Goede bool detecting;
123bcda8cc4SHans de Goede
124bcda8cc4SHans de Goede int num_hpdet_res;
125bcda8cc4SHans de Goede unsigned int hpdet_res[3];
126bcda8cc4SHans de Goede
127bcda8cc4SHans de Goede int jack_flips;
128bcda8cc4SHans de Goede int hpdet_ip_version;
12907ed873eSMark Brown };
13007ed873eSMark Brown
131546ad3d0SCharles Keepax struct arizona_voice_trigger_info {
132546ad3d0SCharles Keepax int core;
133546ad3d0SCharles Keepax };
134546ad3d0SCharles Keepax
1356ebbce0aSRichard Fitzgerald #define ARIZONA_NUM_MIXER_INPUTS 104
13607ed873eSMark Brown
13707ed873eSMark Brown extern const unsigned int arizona_mixer_tlv[];
138141bc6a6SCharles Keepax extern const char * const arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS];
139141bc6a6SCharles Keepax extern unsigned int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
14007ed873eSMark Brown
14150e6168fSRichard Fitzgerald #define ARIZONA_GAINMUX_CONTROLS(name, base) \
14250e6168fSRichard Fitzgerald SOC_SINGLE_RANGE_TLV(name " Input Volume", base + 1, \
14350e6168fSRichard Fitzgerald ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
14450e6168fSRichard Fitzgerald arizona_mixer_tlv)
14550e6168fSRichard Fitzgerald
14607ed873eSMark Brown #define ARIZONA_MIXER_CONTROLS(name, base) \
14707ed873eSMark Brown SOC_SINGLE_RANGE_TLV(name " Input 1 Volume", base + 1, \
14807ed873eSMark Brown ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
14907ed873eSMark Brown arizona_mixer_tlv), \
15007ed873eSMark Brown SOC_SINGLE_RANGE_TLV(name " Input 2 Volume", base + 3, \
15107ed873eSMark Brown ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
15207ed873eSMark Brown arizona_mixer_tlv), \
15307ed873eSMark Brown SOC_SINGLE_RANGE_TLV(name " Input 3 Volume", base + 5, \
15407ed873eSMark Brown ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
15507ed873eSMark Brown arizona_mixer_tlv), \
15607ed873eSMark Brown SOC_SINGLE_RANGE_TLV(name " Input 4 Volume", base + 7, \
15707ed873eSMark Brown ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
15807ed873eSMark Brown arizona_mixer_tlv)
15907ed873eSMark Brown
16007ed873eSMark Brown #define ARIZONA_MUX_ENUM_DECL(name, reg) \
16121a37e39SCharles Keepax SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL( \
16221a37e39SCharles Keepax name, reg, 0, 0xff, arizona_mixer_texts, arizona_mixer_values)
16307ed873eSMark Brown
16407ed873eSMark Brown #define ARIZONA_MUX_CTL_DECL(name) \
16507ed873eSMark Brown const struct snd_kcontrol_new name##_mux = \
166355e3a08SLars-Peter Clausen SOC_DAPM_ENUM("Route", name##_enum)
16707ed873eSMark Brown
16817bd09e5SCharles Keepax #define ARIZONA_MUX_ENUMS(name, base_reg) \
16917bd09e5SCharles Keepax static ARIZONA_MUX_ENUM_DECL(name##_enum, base_reg); \
17017bd09e5SCharles Keepax static ARIZONA_MUX_CTL_DECL(name)
17117bd09e5SCharles Keepax
17207ed873eSMark Brown #define ARIZONA_MIXER_ENUMS(name, base_reg) \
17317bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_in1, base_reg); \
17417bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_in2, base_reg + 2); \
17517bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_in3, base_reg + 4); \
17617bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_in4, base_reg + 6)
17707ed873eSMark Brown
1780b09df66SMark Brown #define ARIZONA_DSP_AUX_ENUMS(name, base_reg) \
17917bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_aux1, base_reg); \
18017bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_aux2, base_reg + 8); \
18117bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_aux3, base_reg + 16); \
18217bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_aux4, base_reg + 24); \
18317bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_aux5, base_reg + 32); \
18417bd09e5SCharles Keepax ARIZONA_MUX_ENUMS(name##_aux6, base_reg + 40)
1850b09df66SMark Brown
18607ed873eSMark Brown #define ARIZONA_MUX(name, ctrl) \
187355e3a08SLars-Peter Clausen SND_SOC_DAPM_MUX(name, SND_SOC_NOPM, 0, 0, ctrl)
18807ed873eSMark Brown
18917bd09e5SCharles Keepax #define ARIZONA_MUX_WIDGETS(name, name_str) \
19017bd09e5SCharles Keepax ARIZONA_MUX(name_str " Input", &name##_mux)
19117bd09e5SCharles Keepax
19207ed873eSMark Brown #define ARIZONA_MIXER_WIDGETS(name, name_str) \
19307ed873eSMark Brown ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \
19407ed873eSMark Brown ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \
19507ed873eSMark Brown ARIZONA_MUX(name_str " Input 3", &name##_in3_mux), \
19607ed873eSMark Brown ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \
19707ed873eSMark Brown SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0)
19807ed873eSMark Brown
1990b09df66SMark Brown #define ARIZONA_DSP_WIDGETS(name, name_str) \
2000b09df66SMark Brown ARIZONA_MIXER_WIDGETS(name##L, name_str "L"), \
2010b09df66SMark Brown ARIZONA_MIXER_WIDGETS(name##R, name_str "R"), \
2020b09df66SMark Brown ARIZONA_MUX(name_str " Aux 1", &name##_aux1_mux), \
2030b09df66SMark Brown ARIZONA_MUX(name_str " Aux 2", &name##_aux2_mux), \
2040b09df66SMark Brown ARIZONA_MUX(name_str " Aux 3", &name##_aux3_mux), \
2050b09df66SMark Brown ARIZONA_MUX(name_str " Aux 4", &name##_aux4_mux), \
2060b09df66SMark Brown ARIZONA_MUX(name_str " Aux 5", &name##_aux5_mux), \
2070b09df66SMark Brown ARIZONA_MUX(name_str " Aux 6", &name##_aux6_mux)
2080b09df66SMark Brown
209e7edb273SCharles Keepax #define ARIZONA_MUX_ROUTES(widget, name) \
210e7edb273SCharles Keepax { widget, NULL, name " Input" }, \
21117bd09e5SCharles Keepax ARIZONA_MIXER_INPUT_ROUTES(name " Input")
21217bd09e5SCharles Keepax
21307ed873eSMark Brown #define ARIZONA_MIXER_ROUTES(widget, name) \
21407ed873eSMark Brown { widget, NULL, name " Mixer" }, \
21507ed873eSMark Brown { name " Mixer", NULL, name " Input 1" }, \
21607ed873eSMark Brown { name " Mixer", NULL, name " Input 2" }, \
21707ed873eSMark Brown { name " Mixer", NULL, name " Input 3" }, \
21807ed873eSMark Brown { name " Mixer", NULL, name " Input 4" }, \
21907ed873eSMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Input 1"), \
22007ed873eSMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Input 2"), \
22107ed873eSMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \
22207ed873eSMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Input 4")
22307ed873eSMark Brown
2240b09df66SMark Brown #define ARIZONA_DSP_ROUTES(name) \
22512db5eddSCharles Keepax { name, NULL, name " Preloader"}, \
2263577357aSCharles Keepax { name " Preloader", NULL, "SYSCLK" }, \
227af813a6fSCharles Keepax { name " Preload", NULL, name " Preloader"}, \
2285ca7e170SCharles Keepax { name, NULL, name " Aux 1" }, \
2295ca7e170SCharles Keepax { name, NULL, name " Aux 2" }, \
2305ca7e170SCharles Keepax { name, NULL, name " Aux 3" }, \
2315ca7e170SCharles Keepax { name, NULL, name " Aux 4" }, \
2325ca7e170SCharles Keepax { name, NULL, name " Aux 5" }, \
2335ca7e170SCharles Keepax { name, NULL, name " Aux 6" }, \
2340b09df66SMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Aux 1"), \
2350b09df66SMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Aux 2"), \
2360b09df66SMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Aux 3"), \
2370b09df66SMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Aux 4"), \
2380b09df66SMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Aux 5"), \
2390b09df66SMark Brown ARIZONA_MIXER_INPUT_ROUTES(name " Aux 6"), \
2405ca7e170SCharles Keepax ARIZONA_MIXER_ROUTES(name, name "L"), \
2415ca7e170SCharles Keepax ARIZONA_MIXER_ROUTES(name, name "R")
2420b09df66SMark Brown
243c05d9a8cSCharles Keepax #define ARIZONA_EQ_CONTROL(xname, xbase) \
244c05d9a8cSCharles Keepax { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
245c05d9a8cSCharles Keepax .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
246c05d9a8cSCharles Keepax .put = arizona_eq_coeff_put, .private_value = \
247c05d9a8cSCharles Keepax ((unsigned long)&(struct soc_bytes) { .base = xbase, \
248c05d9a8cSCharles Keepax .num_regs = 20, .mask = ~ARIZONA_EQ1_B1_MODE }) }
249c05d9a8cSCharles Keepax
2505f8e671aSCharles Keepax #define ARIZONA_LHPF_CONTROL(xname, xbase) \
2515f8e671aSCharles Keepax { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
2525f8e671aSCharles Keepax .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
2535f8e671aSCharles Keepax .put = arizona_lhpf_coeff_put, .private_value = \
2545f8e671aSCharles Keepax ((unsigned long)&(struct soc_bytes) { .base = xbase, \
2555f8e671aSCharles Keepax .num_regs = 1 }) }
2565f8e671aSCharles Keepax
257dc91428aSMark Brown #define ARIZONA_RATE_ENUM_SIZE 4
2586ebbce0aSRichard Fitzgerald #define ARIZONA_SAMPLE_RATE_ENUM_SIZE 14
2596ebbce0aSRichard Fitzgerald
260*236b7285SHans de Goede /* SND_JACK_* mask for supported cable/switch types */
261*236b7285SHans de Goede #define ARIZONA_JACK_MASK (SND_JACK_HEADSET | SND_JACK_LINEOUT | SND_JACK_MECHANICAL)
262*236b7285SHans de Goede
263141bc6a6SCharles Keepax extern const char * const arizona_rate_text[ARIZONA_RATE_ENUM_SIZE];
264141bc6a6SCharles Keepax extern const unsigned int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE];
2656ebbce0aSRichard Fitzgerald extern const char * const arizona_sample_rate_text[ARIZONA_SAMPLE_RATE_ENUM_SIZE];
2666ebbce0aSRichard Fitzgerald extern const unsigned int arizona_sample_rate_val[ARIZONA_SAMPLE_RATE_ENUM_SIZE];
267dc91428aSMark Brown
268dc91428aSMark Brown extern const struct soc_enum arizona_isrc_fsl[];
269fbedc8cbSCharles Keepax extern const struct soc_enum arizona_isrc_fsh[];
27056d37d85SCharles Keepax extern const struct soc_enum arizona_asrc_rate1;
271dc91428aSMark Brown
272e853a00fSMark Brown extern const struct soc_enum arizona_in_vi_ramp;
273e853a00fSMark Brown extern const struct soc_enum arizona_in_vd_ramp;
274e853a00fSMark Brown
275e853a00fSMark Brown extern const struct soc_enum arizona_out_vi_ramp;
276e853a00fSMark Brown extern const struct soc_enum arizona_out_vd_ramp;
277e853a00fSMark Brown
27807ed873eSMark Brown extern const struct soc_enum arizona_lhpf1_mode;
27907ed873eSMark Brown extern const struct soc_enum arizona_lhpf2_mode;
28007ed873eSMark Brown extern const struct soc_enum arizona_lhpf3_mode;
28107ed873eSMark Brown extern const struct soc_enum arizona_lhpf4_mode;
28207ed873eSMark Brown
283845571ccSMark Brown extern const struct soc_enum arizona_ng_hold;
284254dc326SCharles Keepax extern const struct soc_enum arizona_in_hpf_cut_enum;
285c7f38435SCharles Keepax extern const struct soc_enum arizona_in_dmic_osr[];
286845571ccSMark Brown
287336d0442SRichard Fitzgerald extern const struct snd_kcontrol_new arizona_adsp2_rate_controls[];
288336d0442SRichard Fitzgerald
289d190106dSCharles Keepax extern const struct soc_enum arizona_anc_input_src[];
290d190106dSCharles Keepax extern const struct soc_enum arizona_anc_ng_enum;
291d190106dSCharles Keepax extern const struct soc_enum arizona_output_anc_src[];
292d190106dSCharles Keepax
29397126ce8SCharles Keepax extern const struct snd_kcontrol_new arizona_voice_trigger_switch[];
29497126ce8SCharles Keepax
29573950715SCharles Keepax int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
29607ed873eSMark Brown int event);
29773950715SCharles Keepax int arizona_out_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
29807ed873eSMark Brown int event);
29973950715SCharles Keepax int arizona_hp_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
300f607e31cSMark Brown int event);
30173950715SCharles Keepax int arizona_anc_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
302d190106dSCharles Keepax int event);
30307ed873eSMark Brown
30473950715SCharles Keepax int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol,
305c05d9a8cSCharles Keepax struct snd_ctl_elem_value *ucontrol);
30673950715SCharles Keepax int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
3075f8e671aSCharles Keepax struct snd_ctl_elem_value *ucontrol);
308c05d9a8cSCharles Keepax
30973950715SCharles Keepax int arizona_clk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
31073950715SCharles Keepax int event);
3110fe1daa6SKuninori Morimoto int arizona_set_sysclk(struct snd_soc_component *component, int clk_id, int source,
31273950715SCharles Keepax unsigned int freq, int dir);
31307ed873eSMark Brown
31407ed873eSMark Brown extern const struct snd_soc_dai_ops arizona_dai_ops;
315bd1dd885SMark Brown extern const struct snd_soc_dai_ops arizona_simple_dai_ops;
31607ed873eSMark Brown
31707ed873eSMark Brown #define ARIZONA_FLL_NAME_LEN 20
31807ed873eSMark Brown
31907ed873eSMark Brown struct arizona_fll {
32007ed873eSMark Brown struct arizona *arizona;
32107ed873eSMark Brown int id;
32207ed873eSMark Brown unsigned int base;
3232b4d39fcSMark Brown unsigned int vco_mult;
32407ed873eSMark Brown
325de1e6eedSCharles Keepax unsigned int fout;
3269e359c64SCharles Keepax int sync_src;
3279e359c64SCharles Keepax unsigned int sync_freq;
32819b34bdcSCharles Keepax int ref_src;
32919b34bdcSCharles Keepax unsigned int ref_freq;
33019b34bdcSCharles Keepax
33107ed873eSMark Brown char lock_name[ARIZONA_FLL_NAME_LEN];
33207ed873eSMark Brown char clock_ok_name[ARIZONA_FLL_NAME_LEN];
33307ed873eSMark Brown };
33407ed873eSMark Brown
3350fe1daa6SKuninori Morimoto int arizona_dvfs_up(struct snd_soc_component *component, unsigned int flags);
3360fe1daa6SKuninori Morimoto int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags);
33773950715SCharles Keepax int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
338346d9683SRichard Fitzgerald struct snd_kcontrol *kcontrol, int event);
33973950715SCharles Keepax void arizona_init_dvfs(struct arizona_priv *priv);
340346d9683SRichard Fitzgerald
34173950715SCharles Keepax int arizona_init_fll(struct arizona *arizona, int id, int base,
34207ed873eSMark Brown int lock_irq, int ok_irq, struct arizona_fll *fll);
34373950715SCharles Keepax int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
344ee929a97SCharles Keepax unsigned int Fref, unsigned int Fout);
34573950715SCharles Keepax int arizona_set_fll(struct arizona_fll *fll, int source,
34607ed873eSMark Brown unsigned int Fref, unsigned int Fout);
34707ed873eSMark Brown
3480fe1daa6SKuninori Morimoto int arizona_init_spk(struct snd_soc_component *component);
3490fe1daa6SKuninori Morimoto int arizona_init_gpio(struct snd_soc_component *component);
3500fe1daa6SKuninori Morimoto int arizona_init_mono(struct snd_soc_component *component);
3519e3f9f36SCharles Keepax
3529e3f9f36SCharles Keepax int arizona_init_common(struct arizona *arizona);
35385e7dd3fSCharles Keepax int arizona_init_vol_limit(struct arizona *arizona);
35456447e13SMark Brown
35573950715SCharles Keepax int arizona_init_spk_irqs(struct arizona *arizona);
35673950715SCharles Keepax int arizona_free_spk_irqs(struct arizona *arizona);
35754dca701SCharles Keepax
3584988f0ccSPierre-Louis Bossart int arizona_init_dai(struct arizona_priv *priv, int id);
3595b2eec3fSMark Brown
3600fe1daa6SKuninori Morimoto int arizona_set_output_mode(struct snd_soc_component *component, int output,
361bc9ab6d3SMark Brown bool diff);
362bc9ab6d3SMark Brown
3630fe1daa6SKuninori Morimoto bool arizona_input_analog(struct snd_soc_component *component, int shift);
364002b083bSCharles Keepax
36573950715SCharles Keepax const char *arizona_sample_rate_val_to_name(unsigned int rate_val);
3662230c49fSCharles Keepax
arizona_register_notifier(struct snd_soc_component * component,struct notifier_block * nb,int (* notify)(struct notifier_block * nb,unsigned long action,void * data))3670fe1daa6SKuninori Morimoto static inline int arizona_register_notifier(struct snd_soc_component *component,
3682230c49fSCharles Keepax struct notifier_block *nb,
369d3d5c905SCharles Keepax int (*notify)
370d3d5c905SCharles Keepax (struct notifier_block *nb,
371d3d5c905SCharles Keepax unsigned long action, void *data))
372d3d5c905SCharles Keepax {
3730fe1daa6SKuninori Morimoto struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
374d3d5c905SCharles Keepax struct arizona *arizona = priv->arizona;
375d3d5c905SCharles Keepax
376d3d5c905SCharles Keepax nb->notifier_call = notify;
377d3d5c905SCharles Keepax
378d3d5c905SCharles Keepax return blocking_notifier_chain_register(&arizona->notifier, nb);
379d3d5c905SCharles Keepax }
380d3d5c905SCharles Keepax
arizona_unregister_notifier(struct snd_soc_component * component,struct notifier_block * nb)3810fe1daa6SKuninori Morimoto static inline int arizona_unregister_notifier(struct snd_soc_component *component,
382d3d5c905SCharles Keepax struct notifier_block *nb)
383d3d5c905SCharles Keepax {
3840fe1daa6SKuninori Morimoto struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
385d3d5c905SCharles Keepax struct arizona *arizona = priv->arizona;
386d3d5c905SCharles Keepax
387d3d5c905SCharles Keepax return blocking_notifier_chain_unregister(&arizona->notifier, nb);
388d3d5c905SCharles Keepax }
3892230c49fSCharles Keepax
3900a229b15SCharles Keepax int arizona_of_get_audio_pdata(struct arizona *arizona);
3910a229b15SCharles Keepax
392ffcc84b9SHans de Goede int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev);
393ffcc84b9SHans de Goede int arizona_jack_codec_dev_remove(struct arizona_priv *info);
394ffcc84b9SHans de Goede
395ffcc84b9SHans de Goede int arizona_jack_set_jack(struct snd_soc_component *component,
396ffcc84b9SHans de Goede struct snd_soc_jack *jack, void *data);
397ffcc84b9SHans de Goede
39807ed873eSMark Brown #endif
399