xref: /linux/sound/soc/codecs/arizona.h (revision 0a229b15d99e0a9761f9672f4ff7efeb18ce0ea1)
107ed873eSMark Brown /*
207ed873eSMark Brown  * arizona.h - Wolfson Arizona class device shared support
307ed873eSMark Brown  *
407ed873eSMark Brown  * Copyright 2012 Wolfson Microelectronics plc
507ed873eSMark Brown  *
607ed873eSMark Brown  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
707ed873eSMark Brown  *
807ed873eSMark Brown  * This program is free software; you can redistribute it and/or modify
907ed873eSMark Brown  * it under the terms of the GNU General Public License version 2 as
1007ed873eSMark Brown  * published by the Free Software Foundation.
1107ed873eSMark Brown  */
1207ed873eSMark Brown 
1307ed873eSMark Brown #ifndef _ASOC_ARIZONA_H
1407ed873eSMark Brown #define _ASOC_ARIZONA_H
1507ed873eSMark Brown 
1607ed873eSMark Brown #include <linux/completion.h>
17d3d5c905SCharles Keepax #include <linux/notifier.h>
18d3d5c905SCharles Keepax #include <linux/mfd/arizona/core.h>
1907ed873eSMark Brown 
2007ed873eSMark Brown #include <sound/soc.h>
2107ed873eSMark Brown 
220b09df66SMark Brown #include "wm_adsp.h"
230b09df66SMark Brown 
2407ed873eSMark Brown #define ARIZONA_CLK_SYSCLK         1
2507ed873eSMark Brown #define ARIZONA_CLK_ASYNCCLK       2
26cbd840daSMark Brown #define ARIZONA_CLK_OPCLK          3
27cbd840daSMark Brown #define ARIZONA_CLK_ASYNC_OPCLK    4
2807ed873eSMark Brown 
2907ed873eSMark Brown #define ARIZONA_CLK_SRC_MCLK1    0x0
3007ed873eSMark Brown #define ARIZONA_CLK_SRC_MCLK2    0x1
3107ed873eSMark Brown #define ARIZONA_CLK_SRC_FLL1     0x4
3207ed873eSMark Brown #define ARIZONA_CLK_SRC_FLL2     0x5
3307ed873eSMark Brown #define ARIZONA_CLK_SRC_AIF1BCLK 0x8
3407ed873eSMark Brown #define ARIZONA_CLK_SRC_AIF2BCLK 0x9
3507ed873eSMark Brown #define ARIZONA_CLK_SRC_AIF3BCLK 0xa
3607ed873eSMark Brown 
37f3f1163dSCharles Keepax #define ARIZONA_FLL_SRC_NONE      -1
3807ed873eSMark Brown #define ARIZONA_FLL_SRC_MCLK1      0
3907ed873eSMark Brown #define ARIZONA_FLL_SRC_MCLK2      1
40a8c02db0SMark Brown #define ARIZONA_FLL_SRC_SLIMCLK    3
41a8c02db0SMark Brown #define ARIZONA_FLL_SRC_FLL1       4
42a8c02db0SMark Brown #define ARIZONA_FLL_SRC_FLL2       5
43a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF1BCLK   8
44a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF2BCLK   9
45a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF3BCLK  10
46a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF1LRCLK 12
47a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF2LRCLK 13
48a8c02db0SMark Brown #define ARIZONA_FLL_SRC_AIF3LRCLK 14
4907ed873eSMark Brown 
5007ed873eSMark Brown #define ARIZONA_MIXER_VOL_MASK             0x00FE
5107ed873eSMark Brown #define ARIZONA_MIXER_VOL_SHIFT                 1
5207ed873eSMark Brown #define ARIZONA_MIXER_VOL_WIDTH                 7
5307ed873eSMark Brown 
543f341f74SMark Brown #define ARIZONA_CLK_6MHZ   0
553f341f74SMark Brown #define ARIZONA_CLK_12MHZ  1
563f341f74SMark Brown #define ARIZONA_CLK_24MHZ  2
573f341f74SMark Brown #define ARIZONA_CLK_49MHZ  3
583f341f74SMark Brown #define ARIZONA_CLK_73MHZ  4
593f341f74SMark Brown #define ARIZONA_CLK_98MHZ  5
603f341f74SMark Brown #define ARIZONA_CLK_147MHZ 6
613f341f74SMark Brown 
6231889507SCharles Keepax #define ARIZONA_MAX_DAI  10
630b09df66SMark Brown #define ARIZONA_MAX_ADSP 4
645b2eec3fSMark Brown 
65346d9683SRichard Fitzgerald #define ARIZONA_DVFS_SR1_RQ	0x001
66346d9683SRichard Fitzgerald #define ARIZONA_DVFS_ADSP1_RQ	0x100
67346d9683SRichard Fitzgerald 
687baa7e24SCharles Keepax /* Notifier events */
697baa7e24SCharles Keepax #define ARIZONA_NOTIFY_VOICE_TRIGGER   0x1
707baa7e24SCharles Keepax 
710b09df66SMark Brown struct wm_adsp;
7207ed873eSMark Brown 
735b2eec3fSMark Brown struct arizona_dai_priv {
745b2eec3fSMark Brown 	int clk;
75d81221ffSCharles Keepax 
76d81221ffSCharles Keepax 	struct snd_pcm_hw_constraint_list constraint;
775b2eec3fSMark Brown };
785b2eec3fSMark Brown 
7907ed873eSMark Brown struct arizona_priv {
800b09df66SMark Brown 	struct wm_adsp adsp[ARIZONA_MAX_ADSP];
8107ed873eSMark Brown 	struct arizona *arizona;
8207ed873eSMark Brown 	int sysclk;
8307ed873eSMark Brown 	int asyncclk;
845b2eec3fSMark Brown 	struct arizona_dai_priv dai[ARIZONA_MAX_DAI];
85ddbce97cSMark Brown 
86ddbce97cSMark Brown 	int num_inputs;
87ddbce97cSMark Brown 	unsigned int in_pending;
8856447e13SMark Brown 
89e1ae5fbaSCharles Keepax 	unsigned int out_up_pending;
90e1ae5fbaSCharles Keepax 	unsigned int out_up_delay;
91054e1b48SCharles Keepax 	unsigned int out_down_pending;
92054e1b48SCharles Keepax 	unsigned int out_down_delay;
93054e1b48SCharles Keepax 
94346d9683SRichard Fitzgerald 	unsigned int dvfs_reqs;
95346d9683SRichard Fitzgerald 	struct mutex dvfs_lock;
96346d9683SRichard Fitzgerald 	bool dvfs_cached;
9707ed873eSMark Brown };
9807ed873eSMark Brown 
99546ad3d0SCharles Keepax struct arizona_voice_trigger_info {
100546ad3d0SCharles Keepax 	int core;
101546ad3d0SCharles Keepax };
102546ad3d0SCharles Keepax 
1036ebbce0aSRichard Fitzgerald #define ARIZONA_NUM_MIXER_INPUTS 104
10407ed873eSMark Brown 
10507ed873eSMark Brown extern const unsigned int arizona_mixer_tlv[];
106141bc6a6SCharles Keepax extern const char * const arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS];
107141bc6a6SCharles Keepax extern unsigned int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
10807ed873eSMark Brown 
10950e6168fSRichard Fitzgerald #define ARIZONA_GAINMUX_CONTROLS(name, base) \
11050e6168fSRichard Fitzgerald 	SOC_SINGLE_RANGE_TLV(name " Input Volume", base + 1,		\
11150e6168fSRichard Fitzgerald 			     ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0,	\
11250e6168fSRichard Fitzgerald 			     arizona_mixer_tlv)
11350e6168fSRichard Fitzgerald 
11407ed873eSMark Brown #define ARIZONA_MIXER_CONTROLS(name, base) \
11507ed873eSMark Brown 	SOC_SINGLE_RANGE_TLV(name " Input 1 Volume", base + 1,		\
11607ed873eSMark Brown 			     ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0,	\
11707ed873eSMark Brown 			     arizona_mixer_tlv),			\
11807ed873eSMark Brown 	SOC_SINGLE_RANGE_TLV(name " Input 2 Volume", base + 3,		\
11907ed873eSMark Brown 			     ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0,	\
12007ed873eSMark Brown 			     arizona_mixer_tlv),			\
12107ed873eSMark Brown 	SOC_SINGLE_RANGE_TLV(name " Input 3 Volume", base + 5,		\
12207ed873eSMark Brown 			     ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0,	\
12307ed873eSMark Brown 			     arizona_mixer_tlv),			\
12407ed873eSMark Brown 	SOC_SINGLE_RANGE_TLV(name " Input 4 Volume", base + 7,		\
12507ed873eSMark Brown 			     ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0,	\
12607ed873eSMark Brown 			     arizona_mixer_tlv)
12707ed873eSMark Brown 
12807ed873eSMark Brown #define ARIZONA_MUX_ENUM_DECL(name, reg) \
12921a37e39SCharles Keepax 	SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL( \
13021a37e39SCharles Keepax 		name, reg, 0, 0xff, arizona_mixer_texts, arizona_mixer_values)
13107ed873eSMark Brown 
13207ed873eSMark Brown #define ARIZONA_MUX_CTL_DECL(name) \
13307ed873eSMark Brown 	const struct snd_kcontrol_new name##_mux =	\
134355e3a08SLars-Peter Clausen 		SOC_DAPM_ENUM("Route", name##_enum)
13507ed873eSMark Brown 
13617bd09e5SCharles Keepax #define ARIZONA_MUX_ENUMS(name, base_reg) \
13717bd09e5SCharles Keepax 	static ARIZONA_MUX_ENUM_DECL(name##_enum, base_reg);      \
13817bd09e5SCharles Keepax 	static ARIZONA_MUX_CTL_DECL(name)
13917bd09e5SCharles Keepax 
14007ed873eSMark Brown #define ARIZONA_MIXER_ENUMS(name, base_reg) \
14117bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_in1, base_reg);     \
14217bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_in2, base_reg + 2); \
14317bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_in3, base_reg + 4); \
14417bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_in4, base_reg + 6)
14507ed873eSMark Brown 
1460b09df66SMark Brown #define ARIZONA_DSP_AUX_ENUMS(name, base_reg) \
14717bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_aux1, base_reg);	\
14817bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_aux2, base_reg + 8);	\
14917bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_aux3, base_reg + 16);	\
15017bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_aux4, base_reg + 24);	\
15117bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_aux5, base_reg + 32);	\
15217bd09e5SCharles Keepax 	ARIZONA_MUX_ENUMS(name##_aux6, base_reg + 40)
1530b09df66SMark Brown 
15407ed873eSMark Brown #define ARIZONA_MUX(name, ctrl) \
155355e3a08SLars-Peter Clausen 	SND_SOC_DAPM_MUX(name, SND_SOC_NOPM, 0, 0, ctrl)
15607ed873eSMark Brown 
15717bd09e5SCharles Keepax #define ARIZONA_MUX_WIDGETS(name, name_str) \
15817bd09e5SCharles Keepax 	ARIZONA_MUX(name_str " Input", &name##_mux)
15917bd09e5SCharles Keepax 
16007ed873eSMark Brown #define ARIZONA_MIXER_WIDGETS(name, name_str)	\
16107ed873eSMark Brown 	ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \
16207ed873eSMark Brown 	ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \
16307ed873eSMark Brown 	ARIZONA_MUX(name_str " Input 3", &name##_in3_mux), \
16407ed873eSMark Brown 	ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \
16507ed873eSMark Brown 	SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0)
16607ed873eSMark Brown 
1670b09df66SMark Brown #define ARIZONA_DSP_WIDGETS(name, name_str) \
1680b09df66SMark Brown 	ARIZONA_MIXER_WIDGETS(name##L, name_str "L"), \
1690b09df66SMark Brown 	ARIZONA_MIXER_WIDGETS(name##R, name_str "R"), \
1700b09df66SMark Brown 	ARIZONA_MUX(name_str " Aux 1", &name##_aux1_mux), \
1710b09df66SMark Brown 	ARIZONA_MUX(name_str " Aux 2", &name##_aux2_mux), \
1720b09df66SMark Brown 	ARIZONA_MUX(name_str " Aux 3", &name##_aux3_mux), \
1730b09df66SMark Brown 	ARIZONA_MUX(name_str " Aux 4", &name##_aux4_mux), \
1740b09df66SMark Brown 	ARIZONA_MUX(name_str " Aux 5", &name##_aux5_mux), \
1750b09df66SMark Brown 	ARIZONA_MUX(name_str " Aux 6", &name##_aux6_mux)
1760b09df66SMark Brown 
177e7edb273SCharles Keepax #define ARIZONA_MUX_ROUTES(widget, name) \
178e7edb273SCharles Keepax 	{ widget, NULL, name " Input" }, \
17917bd09e5SCharles Keepax 	ARIZONA_MIXER_INPUT_ROUTES(name " Input")
18017bd09e5SCharles Keepax 
18107ed873eSMark Brown #define ARIZONA_MIXER_ROUTES(widget, name) \
18207ed873eSMark Brown 	{ widget, NULL, name " Mixer" },         \
18307ed873eSMark Brown 	{ name " Mixer", NULL, name " Input 1" }, \
18407ed873eSMark Brown 	{ name " Mixer", NULL, name " Input 2" }, \
18507ed873eSMark Brown 	{ name " Mixer", NULL, name " Input 3" }, \
18607ed873eSMark Brown 	{ name " Mixer", NULL, name " Input 4" }, \
18707ed873eSMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Input 1"), \
18807ed873eSMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Input 2"), \
18907ed873eSMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \
19007ed873eSMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Input 4")
19107ed873eSMark Brown 
1920b09df66SMark Brown #define ARIZONA_DSP_ROUTES(name) \
19312db5eddSCharles Keepax 	{ name, NULL, name " Preloader"}, \
1943577357aSCharles Keepax 	{ name " Preloader", NULL, "SYSCLK" }, \
195af813a6fSCharles Keepax 	{ name " Preload", NULL, name " Preloader"}, \
1965ca7e170SCharles Keepax 	{ name, NULL, name " Aux 1" }, \
1975ca7e170SCharles Keepax 	{ name, NULL, name " Aux 2" }, \
1985ca7e170SCharles Keepax 	{ name, NULL, name " Aux 3" }, \
1995ca7e170SCharles Keepax 	{ name, NULL, name " Aux 4" }, \
2005ca7e170SCharles Keepax 	{ name, NULL, name " Aux 5" }, \
2015ca7e170SCharles Keepax 	{ name, NULL, name " Aux 6" }, \
2020b09df66SMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Aux 1"), \
2030b09df66SMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Aux 2"), \
2040b09df66SMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Aux 3"), \
2050b09df66SMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Aux 4"), \
2060b09df66SMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Aux 5"), \
2070b09df66SMark Brown 	ARIZONA_MIXER_INPUT_ROUTES(name " Aux 6"), \
2085ca7e170SCharles Keepax 	ARIZONA_MIXER_ROUTES(name, name "L"), \
2095ca7e170SCharles Keepax 	ARIZONA_MIXER_ROUTES(name, name "R")
2100b09df66SMark Brown 
211c05d9a8cSCharles Keepax #define ARIZONA_EQ_CONTROL(xname, xbase)                      \
212c05d9a8cSCharles Keepax {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,   \
213c05d9a8cSCharles Keepax 	.info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
214c05d9a8cSCharles Keepax 	.put = arizona_eq_coeff_put, .private_value =         \
215c05d9a8cSCharles Keepax 	((unsigned long)&(struct soc_bytes) { .base = xbase,  \
216c05d9a8cSCharles Keepax 	 .num_regs = 20, .mask = ~ARIZONA_EQ1_B1_MODE }) }
217c05d9a8cSCharles Keepax 
2185f8e671aSCharles Keepax #define ARIZONA_LHPF_CONTROL(xname, xbase)                    \
2195f8e671aSCharles Keepax {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,   \
2205f8e671aSCharles Keepax 	.info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
2215f8e671aSCharles Keepax 	.put = arizona_lhpf_coeff_put, .private_value =       \
2225f8e671aSCharles Keepax 	((unsigned long)&(struct soc_bytes) { .base = xbase,  \
2235f8e671aSCharles Keepax 	 .num_regs = 1 }) }
2245f8e671aSCharles Keepax 
225dc91428aSMark Brown #define ARIZONA_RATE_ENUM_SIZE 4
2266ebbce0aSRichard Fitzgerald #define ARIZONA_SAMPLE_RATE_ENUM_SIZE 14
2276ebbce0aSRichard Fitzgerald 
228141bc6a6SCharles Keepax extern const char * const arizona_rate_text[ARIZONA_RATE_ENUM_SIZE];
229141bc6a6SCharles Keepax extern const unsigned int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE];
2306ebbce0aSRichard Fitzgerald extern const char * const arizona_sample_rate_text[ARIZONA_SAMPLE_RATE_ENUM_SIZE];
2316ebbce0aSRichard Fitzgerald extern const unsigned int arizona_sample_rate_val[ARIZONA_SAMPLE_RATE_ENUM_SIZE];
232dc91428aSMark Brown 
233dc91428aSMark Brown extern const struct soc_enum arizona_isrc_fsl[];
234fbedc8cbSCharles Keepax extern const struct soc_enum arizona_isrc_fsh[];
23556d37d85SCharles Keepax extern const struct soc_enum arizona_asrc_rate1;
236dc91428aSMark Brown 
237e853a00fSMark Brown extern const struct soc_enum arizona_in_vi_ramp;
238e853a00fSMark Brown extern const struct soc_enum arizona_in_vd_ramp;
239e853a00fSMark Brown 
240e853a00fSMark Brown extern const struct soc_enum arizona_out_vi_ramp;
241e853a00fSMark Brown extern const struct soc_enum arizona_out_vd_ramp;
242e853a00fSMark Brown 
24307ed873eSMark Brown extern const struct soc_enum arizona_lhpf1_mode;
24407ed873eSMark Brown extern const struct soc_enum arizona_lhpf2_mode;
24507ed873eSMark Brown extern const struct soc_enum arizona_lhpf3_mode;
24607ed873eSMark Brown extern const struct soc_enum arizona_lhpf4_mode;
24707ed873eSMark Brown 
248845571ccSMark Brown extern const struct soc_enum arizona_ng_hold;
249254dc326SCharles Keepax extern const struct soc_enum arizona_in_hpf_cut_enum;
250c7f38435SCharles Keepax extern const struct soc_enum arizona_in_dmic_osr[];
251845571ccSMark Brown 
252336d0442SRichard Fitzgerald extern const struct snd_kcontrol_new arizona_adsp2_rate_controls[];
253336d0442SRichard Fitzgerald 
254d190106dSCharles Keepax extern const struct soc_enum arizona_anc_input_src[];
255d190106dSCharles Keepax extern const struct soc_enum arizona_anc_ng_enum;
256d190106dSCharles Keepax extern const struct soc_enum arizona_output_anc_src[];
257d190106dSCharles Keepax 
25897126ce8SCharles Keepax extern const struct snd_kcontrol_new arizona_voice_trigger_switch[];
25997126ce8SCharles Keepax 
26073950715SCharles Keepax int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
26107ed873eSMark Brown 		  int event);
26273950715SCharles Keepax int arizona_out_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
26307ed873eSMark Brown 		   int event);
26473950715SCharles Keepax int arizona_hp_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
265f607e31cSMark Brown 		  int event);
26673950715SCharles Keepax int arizona_anc_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
267d190106dSCharles Keepax 		   int event);
26807ed873eSMark Brown 
26973950715SCharles Keepax int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol,
270c05d9a8cSCharles Keepax 			 struct snd_ctl_elem_value *ucontrol);
27173950715SCharles Keepax int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
2725f8e671aSCharles Keepax 			   struct snd_ctl_elem_value *ucontrol);
273c05d9a8cSCharles Keepax 
27473950715SCharles Keepax int arizona_clk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
27573950715SCharles Keepax 		   int event);
27673950715SCharles Keepax int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, int source,
27773950715SCharles Keepax 		       unsigned int freq, int dir);
27807ed873eSMark Brown 
27907ed873eSMark Brown extern const struct snd_soc_dai_ops arizona_dai_ops;
280bd1dd885SMark Brown extern const struct snd_soc_dai_ops arizona_simple_dai_ops;
28107ed873eSMark Brown 
28207ed873eSMark Brown #define ARIZONA_FLL_NAME_LEN 20
28307ed873eSMark Brown 
28407ed873eSMark Brown struct arizona_fll {
28507ed873eSMark Brown 	struct arizona *arizona;
28607ed873eSMark Brown 	int id;
28707ed873eSMark Brown 	unsigned int base;
2882b4d39fcSMark Brown 	unsigned int vco_mult;
28907ed873eSMark Brown 
290de1e6eedSCharles Keepax 	unsigned int fout;
2919e359c64SCharles Keepax 	int sync_src;
2929e359c64SCharles Keepax 	unsigned int sync_freq;
29319b34bdcSCharles Keepax 	int ref_src;
29419b34bdcSCharles Keepax 	unsigned int ref_freq;
29519b34bdcSCharles Keepax 
29607ed873eSMark Brown 	char lock_name[ARIZONA_FLL_NAME_LEN];
29707ed873eSMark Brown 	char clock_ok_name[ARIZONA_FLL_NAME_LEN];
29807ed873eSMark Brown };
29907ed873eSMark Brown 
30073950715SCharles Keepax int arizona_dvfs_up(struct snd_soc_codec *codec, unsigned int flags);
30173950715SCharles Keepax int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags);
30273950715SCharles Keepax int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
303346d9683SRichard Fitzgerald 			   struct snd_kcontrol *kcontrol, int event);
30473950715SCharles Keepax void arizona_init_dvfs(struct arizona_priv *priv);
305346d9683SRichard Fitzgerald 
30673950715SCharles Keepax int arizona_init_fll(struct arizona *arizona, int id, int base,
30707ed873eSMark Brown 		     int lock_irq, int ok_irq, struct arizona_fll *fll);
30873950715SCharles Keepax int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
309ee929a97SCharles Keepax 			   unsigned int Fref, unsigned int Fout);
31073950715SCharles Keepax int arizona_set_fll(struct arizona_fll *fll, int source,
31107ed873eSMark Brown 		    unsigned int Fref, unsigned int Fout);
31207ed873eSMark Brown 
31373950715SCharles Keepax int arizona_init_spk(struct snd_soc_codec *codec);
31473950715SCharles Keepax int arizona_init_gpio(struct snd_soc_codec *codec);
31573950715SCharles Keepax int arizona_init_mono(struct snd_soc_codec *codec);
3169e3f9f36SCharles Keepax 
3179e3f9f36SCharles Keepax int arizona_init_common(struct arizona *arizona);
31856447e13SMark Brown 
31973950715SCharles Keepax int arizona_init_spk_irqs(struct arizona *arizona);
32073950715SCharles Keepax int arizona_free_spk_irqs(struct arizona *arizona);
32154dca701SCharles Keepax 
32273950715SCharles Keepax int arizona_init_dai(struct arizona_priv *priv, int dai);
3235b2eec3fSMark Brown 
324bc9ab6d3SMark Brown int arizona_set_output_mode(struct snd_soc_codec *codec, int output,
325bc9ab6d3SMark Brown 			    bool diff);
326bc9ab6d3SMark Brown 
32773950715SCharles Keepax bool arizona_input_analog(struct snd_soc_codec *codec, int shift);
328002b083bSCharles Keepax 
32973950715SCharles Keepax const char *arizona_sample_rate_val_to_name(unsigned int rate_val);
3302230c49fSCharles Keepax 
331d3d5c905SCharles Keepax static inline int arizona_register_notifier(struct snd_soc_codec *codec,
3322230c49fSCharles Keepax 					    struct notifier_block *nb,
333d3d5c905SCharles Keepax 					    int (*notify)
334d3d5c905SCharles Keepax 					    (struct notifier_block *nb,
335d3d5c905SCharles Keepax 					    unsigned long action, void *data))
336d3d5c905SCharles Keepax {
337d3d5c905SCharles Keepax 	struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
338d3d5c905SCharles Keepax 	struct arizona *arizona = priv->arizona;
339d3d5c905SCharles Keepax 
340d3d5c905SCharles Keepax 	nb->notifier_call = notify;
341d3d5c905SCharles Keepax 
342d3d5c905SCharles Keepax 	return blocking_notifier_chain_register(&arizona->notifier, nb);
343d3d5c905SCharles Keepax }
344d3d5c905SCharles Keepax 
345d3d5c905SCharles Keepax static inline int arizona_unregister_notifier(struct snd_soc_codec *codec,
346d3d5c905SCharles Keepax 					      struct notifier_block *nb)
347d3d5c905SCharles Keepax {
348d3d5c905SCharles Keepax 	struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
349d3d5c905SCharles Keepax 	struct arizona *arizona = priv->arizona;
350d3d5c905SCharles Keepax 
351d3d5c905SCharles Keepax 	return blocking_notifier_chain_unregister(&arizona->notifier, nb);
352d3d5c905SCharles Keepax }
3532230c49fSCharles Keepax 
354*0a229b15SCharles Keepax int arizona_of_get_audio_pdata(struct arizona *arizona);
355*0a229b15SCharles Keepax 
35607ed873eSMark Brown #endif
357