Revert "microblaze_mmu_v2: Update signal returning address"
[linux/fpc-iii.git] / sound / soc / codecs / arizona.h
blob59caca8865e8aa355c279dd257cf836d667627aa
1 /*
2 * arizona.h - Wolfson Arizona class device shared support
4 * Copyright 2012 Wolfson Microelectronics plc
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef _ASOC_ARIZONA_H
14 #define _ASOC_ARIZONA_H
16 #include <linux/completion.h>
18 #include <sound/soc.h>
20 #define ARIZONA_CLK_SYSCLK 1
21 #define ARIZONA_CLK_ASYNCCLK 2
23 #define ARIZONA_CLK_SRC_MCLK1 0x0
24 #define ARIZONA_CLK_SRC_MCLK2 0x1
25 #define ARIZONA_CLK_SRC_FLL1 0x4
26 #define ARIZONA_CLK_SRC_FLL2 0x5
27 #define ARIZONA_CLK_SRC_AIF1BCLK 0x8
28 #define ARIZONA_CLK_SRC_AIF2BCLK 0x9
29 #define ARIZONA_CLK_SRC_AIF3BCLK 0xa
31 #define ARIZONA_FLL_SRC_MCLK1 0
32 #define ARIZONA_FLL_SRC_MCLK2 1
33 #define ARIZONA_FLL_SRC_SLIMCLK 2
34 #define ARIZONA_FLL_SRC_FLL1 3
35 #define ARIZONA_FLL_SRC_FLL2 4
36 #define ARIZONA_FLL_SRC_AIF1BCLK 5
37 #define ARIZONA_FLL_SRC_AIF2BCLK 6
38 #define ARIZONA_FLL_SRC_AIF3BCLK 7
39 #define ARIZONA_FLL_SRC_AIF1LRCLK 8
40 #define ARIZONA_FLL_SRC_AIF2LRCLK 9
41 #define ARIZONA_FLL_SRC_AIF3LRCLK 10
43 #define ARIZONA_MIXER_VOL_MASK 0x00FE
44 #define ARIZONA_MIXER_VOL_SHIFT 1
45 #define ARIZONA_MIXER_VOL_WIDTH 7
47 #define ARIZONA_MAX_DAI 3
49 struct arizona;
51 struct arizona_dai_priv {
52 int clk;
55 struct arizona_priv {
56 struct arizona *arizona;
57 int sysclk;
58 int asyncclk;
59 struct arizona_dai_priv dai[ARIZONA_MAX_DAI];
62 #define ARIZONA_NUM_MIXER_INPUTS 57
64 extern const unsigned int arizona_mixer_tlv[];
65 extern const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS];
66 extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
68 #define ARIZONA_MIXER_CONTROLS(name, base) \
69 SOC_SINGLE_RANGE_TLV(name " Input 1 Volume", base + 1, \
70 ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
71 arizona_mixer_tlv), \
72 SOC_SINGLE_RANGE_TLV(name " Input 2 Volume", base + 3, \
73 ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
74 arizona_mixer_tlv), \
75 SOC_SINGLE_RANGE_TLV(name " Input 3 Volume", base + 5, \
76 ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
77 arizona_mixer_tlv), \
78 SOC_SINGLE_RANGE_TLV(name " Input 4 Volume", base + 7, \
79 ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
80 arizona_mixer_tlv)
82 #define ARIZONA_MUX_ENUM_DECL(name, reg) \
83 SOC_VALUE_ENUM_SINGLE_DECL(name, reg, 0, 0xff, \
84 arizona_mixer_texts, arizona_mixer_values)
86 #define ARIZONA_MUX_CTL_DECL(name) \
87 const struct snd_kcontrol_new name##_mux = \
88 SOC_DAPM_VALUE_ENUM("Route", name##_enum)
90 #define ARIZONA_MIXER_ENUMS(name, base_reg) \
91 static ARIZONA_MUX_ENUM_DECL(name##_in1_enum, base_reg); \
92 static ARIZONA_MUX_ENUM_DECL(name##_in2_enum, base_reg + 2); \
93 static ARIZONA_MUX_ENUM_DECL(name##_in3_enum, base_reg + 4); \
94 static ARIZONA_MUX_ENUM_DECL(name##_in4_enum, base_reg + 6); \
95 static ARIZONA_MUX_CTL_DECL(name##_in1); \
96 static ARIZONA_MUX_CTL_DECL(name##_in2); \
97 static ARIZONA_MUX_CTL_DECL(name##_in3); \
98 static ARIZONA_MUX_CTL_DECL(name##_in4)
100 #define ARIZONA_MUX(name, ctrl) \
101 SND_SOC_DAPM_VALUE_MUX(name, SND_SOC_NOPM, 0, 0, ctrl)
103 #define ARIZONA_MIXER_WIDGETS(name, name_str) \
104 ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \
105 ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \
106 ARIZONA_MUX(name_str " Input 3", &name##_in3_mux), \
107 ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \
108 SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0)
110 #define ARIZONA_MIXER_ROUTES(widget, name) \
111 { widget, NULL, name " Mixer" }, \
112 { name " Mixer", NULL, name " Input 1" }, \
113 { name " Mixer", NULL, name " Input 2" }, \
114 { name " Mixer", NULL, name " Input 3" }, \
115 { name " Mixer", NULL, name " Input 4" }, \
116 ARIZONA_MIXER_INPUT_ROUTES(name " Input 1"), \
117 ARIZONA_MIXER_INPUT_ROUTES(name " Input 2"), \
118 ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \
119 ARIZONA_MIXER_INPUT_ROUTES(name " Input 4")
121 extern const struct soc_enum arizona_lhpf1_mode;
122 extern const struct soc_enum arizona_lhpf2_mode;
123 extern const struct soc_enum arizona_lhpf3_mode;
124 extern const struct soc_enum arizona_lhpf4_mode;
126 extern int arizona_in_ev(struct snd_soc_dapm_widget *w,
127 struct snd_kcontrol *kcontrol,
128 int event);
129 extern int arizona_out_ev(struct snd_soc_dapm_widget *w,
130 struct snd_kcontrol *kcontrol,
131 int event);
133 extern int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id,
134 int source, unsigned int freq, int dir);
136 extern const struct snd_soc_dai_ops arizona_dai_ops;
138 #define ARIZONA_FLL_NAME_LEN 20
140 struct arizona_fll {
141 struct arizona *arizona;
142 int id;
143 unsigned int base;
144 unsigned int vco_mult;
145 struct completion lock;
146 struct completion ok;
148 char lock_name[ARIZONA_FLL_NAME_LEN];
149 char clock_ok_name[ARIZONA_FLL_NAME_LEN];
152 extern int arizona_init_fll(struct arizona *arizona, int id, int base,
153 int lock_irq, int ok_irq, struct arizona_fll *fll);
154 extern int arizona_set_fll(struct arizona_fll *fll, int source,
155 unsigned int Fref, unsigned int Fout);
157 extern int arizona_init_dai(struct arizona_priv *priv, int dai);
159 #endif