]> Pileus Git - ~andy/linux/blob - sound/soc/codecs/wm8994.h
Merge branch 'for-linus-3.4' of git://git.linaro.org/people/sumitsemwal/linux-dma-buf
[~andy/linux] / sound / soc / codecs / wm8994.h
1 /*
2  * wm8994.h  --  WM8994 Soc Audio driver
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8
9 #ifndef _WM8994_H
10 #define _WM8994_H
11
12 #include <sound/soc.h>
13 #include <linux/firmware.h>
14 #include <linux/completion.h>
15
16 #include "wm_hubs.h"
17
18 /* Sources for AIF1/2 SYSCLK - use with set_dai_sysclk() */
19 #define WM8994_SYSCLK_MCLK1 1
20 #define WM8994_SYSCLK_MCLK2 2
21 #define WM8994_SYSCLK_FLL1  3
22 #define WM8994_SYSCLK_FLL2  4
23
24 /* OPCLK is also configured with set_dai_sysclk, specify division*10 as rate. */
25 #define WM8994_SYSCLK_OPCLK 5
26
27 #define WM8994_FLL1 1
28 #define WM8994_FLL2 2
29
30 #define WM8994_FLL_SRC_MCLK1  1
31 #define WM8994_FLL_SRC_MCLK2  2
32 #define WM8994_FLL_SRC_LRCLK  3
33 #define WM8994_FLL_SRC_BCLK   4
34
35 enum wm8994_vmid_mode {
36         WM8994_VMID_NORMAL,
37         WM8994_VMID_FORCE,
38 };
39
40 typedef void (*wm8958_micdet_cb)(u16 status, void *data);
41
42 int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
43                       int micbias);
44 int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
45                       wm8958_micdet_cb cb, void *cb_data);
46
47 int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode);
48
49 int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
50                   struct snd_kcontrol *kcontrol, int event);
51
52 void wm8958_dsp2_init(struct snd_soc_codec *codec);
53
54 struct wm8994_micdet {
55         struct snd_soc_jack *jack;
56         bool detecting;
57 };
58
59 /* codec private data */
60 struct wm8994_fll_config {
61         int src;
62         int in;
63         int out;
64 };
65
66 #define WM8994_NUM_DRC 3
67 #define WM8994_NUM_EQ  3
68
69 struct wm8994;
70
71 struct wm8994_priv {
72         struct wm_hubs_data hubs;
73         struct wm8994 *wm8994;
74         struct snd_soc_codec *codec;
75         int sysclk[2];
76         int sysclk_rate[2];
77         int mclk[2];
78         int aifclk[2];
79         struct wm8994_fll_config fll[2], fll_suspend[2];
80         struct completion fll_locked[2];
81         bool fll_locked_irq;
82
83         int vmid_refcount;
84         int active_refcount;
85         enum wm8994_vmid_mode vmid_mode;
86
87         int dac_rates[2];
88         int lrclk_shared[2];
89
90         int mbc_ena[3];
91         int hpf1_ena[3];
92         int hpf2_ena[3];
93         int vss_ena[3];
94         int enh_eq_ena[3];
95
96         /* Platform dependant DRC configuration */
97         const char **drc_texts;
98         int drc_cfg[WM8994_NUM_DRC];
99         struct soc_enum drc_enum;
100
101         /* Platform dependant ReTune mobile configuration */
102         int num_retune_mobile_texts;
103         const char **retune_mobile_texts;
104         int retune_mobile_cfg[WM8994_NUM_EQ];
105         struct soc_enum retune_mobile_enum;
106
107         /* Platform dependant MBC configuration */
108         int mbc_cfg;
109         const char **mbc_texts;
110         struct soc_enum mbc_enum;
111
112         /* Platform dependant VSS configuration */
113         int vss_cfg;
114         const char **vss_texts;
115         struct soc_enum vss_enum;
116
117         /* Platform dependant VSS HPF configuration */
118         int vss_hpf_cfg;
119         const char **vss_hpf_texts;
120         struct soc_enum vss_hpf_enum;
121
122         /* Platform dependant enhanced EQ configuration */
123         int enh_eq_cfg;
124         const char **enh_eq_texts;
125         struct soc_enum enh_eq_enum;
126
127         struct mutex accdet_lock;
128         struct wm8994_micdet micdet[2];
129         bool mic_detecting;
130         bool jack_mic;
131         int btn_mask;
132         bool jackdet;
133         int jackdet_mode;
134
135         wm8958_micdet_cb jack_cb;
136         void *jack_cb_data;
137         int micdet_irq;
138
139         int revision;
140         struct wm8994_pdata *pdata;
141
142         unsigned int aif1clk_enable:1;
143         unsigned int aif2clk_enable:1;
144
145         unsigned int aif1clk_disable:1;
146         unsigned int aif2clk_disable:1;
147
148         int dsp_active;
149         const struct firmware *cur_fw;
150         const struct firmware *mbc;
151         const struct firmware *mbc_vss;
152         const struct firmware *enh_eq;
153 };
154
155 #endif