blob: 93a6cf1e13080b5c2357feb8d1ae9c969dd98d5a [file] [log] [blame]
Mark Brown9e6e96a2010-01-29 17:47:12 +00001/*
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
Mark Brownf701a2e2011-03-09 19:31:01 +000014#include "wm_hubs.h"
15
Mark Brown9e6e96a2010-01-29 17:47:12 +000016/* Sources for AIF1/2 SYSCLK - use with set_dai_sysclk() */
17#define WM8994_SYSCLK_MCLK1 1
18#define WM8994_SYSCLK_MCLK2 2
19#define WM8994_SYSCLK_FLL1 3
20#define WM8994_SYSCLK_FLL2 4
21
Mark Brown66b47fd2010-07-08 11:25:43 +090022/* OPCLK is also configured with set_dai_sysclk, specify division*10 as rate. */
23#define WM8994_SYSCLK_OPCLK 5
24
Mark Brown9e6e96a2010-01-29 17:47:12 +000025#define WM8994_FLL1 1
26#define WM8994_FLL2 2
27
Mark Brown136ff2a2010-04-20 12:56:18 +090028#define WM8994_FLL_SRC_MCLK1 1
29#define WM8994_FLL_SRC_MCLK2 2
30#define WM8994_FLL_SRC_LRCLK 3
31#define WM8994_FLL_SRC_BCLK 4
32
Mark Brown821edd22010-11-26 15:21:09 +000033typedef void (*wm8958_micdet_cb)(u16 status, void *data);
34
Mark Brown88766982010-03-29 20:57:12 +010035int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
36 int micbias, int det, int shrt);
Mark Brown821edd22010-11-26 15:21:09 +000037int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
38 wm8958_micdet_cb cb, void *cb_data);
Mark Brown88766982010-03-29 20:57:12 +010039
Mark Brown7b306da2010-11-16 20:11:40 +000040#define WM8994_CACHE_SIZE 1570
41
42struct wm8994_access_mask {
43 unsigned short readable; /* Mask of readable bits */
44 unsigned short writable; /* Mask of writable bits */
45};
46
47extern const struct wm8994_access_mask wm8994_access_masks[WM8994_CACHE_SIZE];
Mark Brownb993f92b92011-03-07 16:42:20 +000048extern const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE];
Mark Brown7b306da2010-11-16 20:11:40 +000049
Mark Brownf701a2e2011-03-09 19:31:01 +000050int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
51 struct snd_kcontrol *kcontrol, int event);
52
53void wm8958_dsp2_init(struct snd_soc_codec *codec);
54
55struct wm8994_micdet {
56 struct snd_soc_jack *jack;
57 int det;
58 int shrt;
59};
60
61/* codec private data */
62struct wm8994_fll_config {
63 int src;
64 int in;
65 int out;
66};
67
68#define WM8994_NUM_DRC 3
69#define WM8994_NUM_EQ 3
70
71struct wm8994_priv {
72 struct wm_hubs_data hubs;
73 enum snd_soc_control_type control_type;
74 void *control_data;
75 struct snd_soc_codec *codec;
76 int sysclk[2];
77 int sysclk_rate[2];
78 int mclk[2];
79 int aifclk[2];
80 struct wm8994_fll_config fll[2], fll_suspend[2];
81
82 int dac_rates[2];
83 int lrclk_shared[2];
84
85 int mbc_ena[3];
86
87 /* Platform dependant DRC configuration */
88 const char **drc_texts;
89 int drc_cfg[WM8994_NUM_DRC];
90 struct soc_enum drc_enum;
91
92 /* Platform dependant ReTune mobile configuration */
93 int num_retune_mobile_texts;
94 const char **retune_mobile_texts;
95 int retune_mobile_cfg[WM8994_NUM_EQ];
96 struct soc_enum retune_mobile_enum;
97
98 /* Platform dependant MBC configuration */
99 int mbc_cfg;
100 const char **mbc_texts;
101 struct soc_enum mbc_enum;
102
103 struct wm8994_micdet micdet[2];
104
105 wm8958_micdet_cb jack_cb;
106 void *jack_cb_data;
107 int micdet_irq;
108
109 int revision;
110 struct wm8994_pdata *pdata;
111
112 unsigned int aif1clk_enable:1;
113 unsigned int aif2clk_enable:1;
114
115 unsigned int aif1clk_disable:1;
116 unsigned int aif2clk_disable:1;
117};
118
Mark Brown9e6e96a2010-01-29 17:47:12 +0000119#endif