ASoC: Add WM8958 VSS support
[pandora-kernel.git] / include / linux / mfd / wm8994 / pdata.h
1 /*
2  * include/linux/mfd/wm8994/pdata.h -- Platform data for WM8994
3  *
4  * Copyright 2009 Wolfson Microelectronics PLC.
5  *
6  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7  *
8  *  This program is free software; you can redistribute  it and/or modify it
9  *  under  the terms of  the GNU General  Public License as published by the
10  *  Free Software Foundation;  either version 2 of the  License, or (at your
11  *  option) any later version.
12  *
13  */
14
15 #ifndef __MFD_WM8994_PDATA_H__
16 #define __MFD_WM8994_PDATA_H__
17
18 #define WM8994_NUM_LDO   2
19 #define WM8994_NUM_GPIO 11
20
21 struct wm8994_ldo_pdata {
22         /** GPIOs to enable regulator, 0 or less if not available */
23         int enable;
24
25         const char *supply;
26         struct regulator_init_data *init_data;
27 };
28
29 #define WM8994_CONFIGURE_GPIO 0x8000
30
31 #define WM8994_DRC_REGS 5
32 #define WM8994_EQ_REGS  20
33 #define WM8958_MBC_CUTOFF_REGS 20
34 #define WM8958_MBC_COEFF_REGS  48
35 #define WM8958_MBC_COMBINED_REGS 56
36 #define WM8958_VSS_HPF_REGS 2
37 #define WM8958_VSS_REGS 148
38
39 /**
40  * DRC configurations are specified with a label and a set of register
41  * values to write (the enable bits will be ignored).  At runtime an
42  * enumerated control will be presented for each DRC block allowing
43  * the user to choose the configration to use.
44  *
45  * Configurations may be generated by hand or by using the DRC control
46  * panel provided by the WISCE - see  http://www.wolfsonmicro.com/wisce/
47  * for details.
48  */
49 struct wm8994_drc_cfg {
50         const char *name;
51         u16 regs[WM8994_DRC_REGS];
52 };
53
54 /**
55  * ReTune Mobile configurations are specified with a label, sample
56  * rate and set of values to write (the enable bits will be ignored).
57  *
58  * Configurations are expected to be generated using the ReTune Mobile
59  * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
60  */
61 struct wm8994_retune_mobile_cfg {
62         const char *name;
63         unsigned int rate;
64         u16 regs[WM8994_EQ_REGS];
65 };
66
67 /**
68  * Multiband compressor configurations are specified with a label and
69  * two sets of values to write.  Configurations are expected to be
70  * generated using the multiband compressor configuration panel in
71  * WISCE - see http://www.wolfsonmicro.com/wisce/
72  */
73 struct wm8958_mbc_cfg {
74         const char *name;
75         u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
76         u16 coeff_regs[WM8958_MBC_COEFF_REGS];
77
78         /* Coefficient layout when using MBC+VSS firmware */
79         u16 combined_regs[WM8958_MBC_COMBINED_REGS];
80 };
81
82 /**
83  * VSS HPF configurations are specified with a label and two values to
84  * write.  Configurations are expected to be generated using the
85  * multiband compressor configuration panel in WISCE - see
86  * http://www.wolfsonmicro.com/wisce/
87  */
88 struct wm8958_vss_hpf_cfg {
89         const char *name;
90         u16 regs[WM8958_VSS_HPF_REGS];
91 };
92
93 /**
94  * VSS configurations are specified with a label and array of values
95  * to write.  Configurations are expected to be generated using the
96  * multiband compressor configuration panel in WISCE - see
97  * http://www.wolfsonmicro.com/wisce/
98  */
99 struct wm8958_vss_cfg {
100         const char *name;
101         u16 regs[WM8958_VSS_REGS];
102 };
103
104 struct wm8994_pdata {
105         int gpio_base;
106
107         /**
108          * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
109          * can be used for all zero values.
110          */
111         int gpio_defaults[WM8994_NUM_GPIO];
112
113         struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
114
115         int irq_base;  /** Base IRQ number for WM8994, required for IRQs */
116
117         int num_drc_cfgs;
118         struct wm8994_drc_cfg *drc_cfgs;
119
120         int num_retune_mobile_cfgs;
121         struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
122
123         int num_mbc_cfgs;
124         struct wm8958_mbc_cfg *mbc_cfgs;
125
126         int num_vss_cfgs;
127         struct wm8958_vss_cfg *vss_cfgs;
128
129         int num_vss_hpf_cfgs;
130         struct wm8958_vss_hpf_cfg *vss_hpf_cfgs;
131
132         /* LINEOUT can be differential or single ended */
133         unsigned int lineout1_diff:1;
134         unsigned int lineout2_diff:1;
135
136         /* Common mode feedback */
137         unsigned int lineout1fb:1;
138         unsigned int lineout2fb:1;
139
140         /* IRQ for microphone detection if brought out directly as a
141          * signal.
142          */
143         int micdet_irq;
144
145         /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
146         unsigned int micbias1_lvl:1;
147         unsigned int micbias2_lvl:1;
148
149         /* WM8994 jack detect threashold levels, see datasheet for values */
150         unsigned int jd_scthr:2;
151         unsigned int jd_thr:2;
152
153         /* WM8958 microphone bias configuration */
154         int micbias[2];
155 };
156
157 #endif