aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-01-29 13:20:29 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2010-03-07 16:17:13 -0500
commit9e50108668a70a9927257298bd4e679300124420 (patch)
tree659100bfbfaf64a3b385573a4d4fb7fb50468eb7 /include
parent1c4d3b70a40c666331052adf77933e6994590b74 (diff)
mfd: Add initial WM8994 support
The WM8994 is a highly integrated ultra low power audio hub CODEC. Since it includes on-board regulators and GPIOs it is represented as a multi-function device, though the overwhelming majority of the functionality is provided by the ASoC CODEC driver. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mfd/wm8994/core.h54
-rw-r--r--include/linux/mfd/wm8994/gpio.h72
-rw-r--r--include/linux/mfd/wm8994/pdata.h97
3 files changed, 223 insertions, 0 deletions
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
new file mode 100644
index 00000000000..b06ff284674
--- /dev/null
+++ b/include/linux/mfd/wm8994/core.h
@@ -0,0 +1,54 @@
1/*
2 * include/linux/mfd/wm8994/core.h -- Core interface 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_CORE_H__
16#define __MFD_WM8994_CORE_H__
17
18struct regulator_dev;
19struct regulator_bulk_data;
20
21#define WM8994_NUM_GPIO_REGS 11
22#define WM8994_NUM_LDO_REGS 2
23
24struct wm8994 {
25 struct mutex io_lock;
26
27 struct device *dev;
28 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
29 int bytes, void *dest);
30 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
31 int bytes, void *src);
32
33 void *control_data;
34
35 int gpio_base;
36
37 /* Used over suspend/resume */
38 u16 ldo_regs[WM8994_NUM_LDO_REGS];
39 u16 gpio_regs[WM8994_NUM_GPIO_REGS];
40
41 struct regulator_dev *dbvdd;
42 struct regulator_bulk_data *supplies;
43};
44
45/* Device I/O API */
46int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
47int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
48 unsigned short val);
49int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
50 unsigned short mask, unsigned short val);
51int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
52 int count, u16 *buf);
53
54#endif
diff --git a/include/linux/mfd/wm8994/gpio.h b/include/linux/mfd/wm8994/gpio.h
new file mode 100644
index 00000000000..b4d4c22991e
--- /dev/null
+++ b/include/linux/mfd/wm8994/gpio.h
@@ -0,0 +1,72 @@
1/*
2 * include/linux/mfd/wm8994/gpio.h - GPIO configuration 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_GPIO_H__
16#define __MFD_WM8994_GPIO_H__
17
18#define WM8994_GPIO_MAX 11
19
20#define WM8994_GP_FN_PIN_SPECIFIC 0
21#define WM8994_GP_FN_GPIO 1
22#define WM8994_GP_FN_SDOUT 2
23#define WM8994_GP_FN_IRQ 3
24#define WM8994_GP_FN_TEMPERATURE 4
25#define WM8994_GP_FN_MICBIAS1_DET 5
26#define WM8994_GP_FN_MICBIAS1_SHORT 6
27#define WM8994_GP_FN_MICBIAS2_DET 7
28#define WM8994_GP_FN_MICBIAS2_SHORT 8
29#define WM8994_GP_FN_FLL1_LOCK 9
30#define WM8994_GP_FN_FLL2_LOCK 10
31#define WM8994_GP_FN_SRC1_LOCK 11
32#define WM8994_GP_FN_SRC2_LOCK 12
33#define WM8994_GP_FN_DRC1_ACT 13
34#define WM8994_GP_FN_DRC2_ACT 14
35#define WM8994_GP_FN_DRC3_ACT 15
36#define WM8994_GP_FN_WSEQ_STATUS 16
37#define WM8994_GP_FN_FIFO_ERROR 17
38#define WM8994_GP_FN_OPCLK 18
39
40#define WM8994_GPN_DIR 0x8000 /* GPN_DIR */
41#define WM8994_GPN_DIR_MASK 0x8000 /* GPN_DIR */
42#define WM8994_GPN_DIR_SHIFT 15 /* GPN_DIR */
43#define WM8994_GPN_DIR_WIDTH 1 /* GPN_DIR */
44#define WM8994_GPN_PU 0x4000 /* GPN_PU */
45#define WM8994_GPN_PU_MASK 0x4000 /* GPN_PU */
46#define WM8994_GPN_PU_SHIFT 14 /* GPN_PU */
47#define WM8994_GPN_PU_WIDTH 1 /* GPN_PU */
48#define WM8994_GPN_PD 0x2000 /* GPN_PD */
49#define WM8994_GPN_PD_MASK 0x2000 /* GPN_PD */
50#define WM8994_GPN_PD_SHIFT 13 /* GPN_PD */
51#define WM8994_GPN_PD_WIDTH 1 /* GPN_PD */
52#define WM8994_GPN_POL 0x0400 /* GPN_POL */
53#define WM8994_GPN_POL_MASK 0x0400 /* GPN_POL */
54#define WM8994_GPN_POL_SHIFT 10 /* GPN_POL */
55#define WM8994_GPN_POL_WIDTH 1 /* GPN_POL */
56#define WM8994_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
57#define WM8994_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
58#define WM8994_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
59#define WM8994_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
60#define WM8994_GPN_DB 0x0100 /* GPN_DB */
61#define WM8994_GPN_DB_MASK 0x0100 /* GPN_DB */
62#define WM8994_GPN_DB_SHIFT 8 /* GPN_DB */
63#define WM8994_GPN_DB_WIDTH 1 /* GPN_DB */
64#define WM8994_GPN_LVL 0x0040 /* GPN_LVL */
65#define WM8994_GPN_LVL_MASK 0x0040 /* GPN_LVL */
66#define WM8994_GPN_LVL_SHIFT 6 /* GPN_LVL */
67#define WM8994_GPN_LVL_WIDTH 1 /* GPN_LVL */
68#define WM8994_GPN_FN_MASK 0x001F /* GPN_FN - [4:0] */
69#define WM8994_GPN_FN_SHIFT 0 /* GPN_FN - [4:0] */
70#define WM8994_GPN_FN_WIDTH 5 /* GPN_FN - [4:0] */
71
72#endif
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
new file mode 100644
index 00000000000..70d6a8687dc
--- /dev/null
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -0,0 +1,97 @@
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
21struct 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 19
33
34/**
35 * DRC configurations are specified with a label and a set of register
36 * values to write (the enable bits will be ignored). At runtime an
37 * enumerated control will be presented for each DRC block allowing
38 * the user to choose the configration to use.
39 *
40 * Configurations may be generated by hand or by using the DRC control
41 * panel provided by the WISCE - see http://www.wolfsonmicro.com/wisce/
42 * for details.
43 */
44struct wm8994_drc_cfg {
45 const char *name;
46 u16 regs[WM8994_DRC_REGS];
47};
48
49/**
50 * ReTune Mobile configurations are specified with a label, sample
51 * rate and set of values to write (the enable bits will be ignored).
52 *
53 * Configurations are expected to be generated using the ReTune Mobile
54 * control panel in WISCE - see http://www.wolfsonmicro.com/wisce/
55 */
56struct wm8994_retune_mobile_cfg {
57 const char *name;
58 unsigned int rate;
59 u16 regs[WM8994_EQ_REGS];
60};
61
62struct wm8994_pdata {
63 int gpio_base;
64
65 /**
66 * Default values for GPIOs if non-zero, WM8994_CONFIGURE_GPIO
67 * can be used for all zero values.
68 */
69 int gpio_defaults[WM8994_NUM_GPIO];
70
71 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
72
73
74 int num_drc_cfgs;
75 struct wm8994_drc_cfg *drc_cfgs;
76
77 int num_retune_mobile_cfgs;
78 struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
79
80 /* LINEOUT can be differential or single ended */
81 unsigned int lineout1_diff:1;
82 unsigned int lineout2_diff:1;
83
84 /* Common mode feedback */
85 unsigned int lineout1fb:1;
86 unsigned int lineout2fb:1;
87
88 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
89 unsigned int micbias1_lvl:1;
90 unsigned int micbias2_lvl:1;
91
92 /* Jack detect threashold levels, see datasheet for values */
93 unsigned int jd_scthr:2;
94 unsigned int jd_thr:2;
95};
96
97#endif