b06ff284674899358dd0a868ba9d82cf66abb41e
[safe/jmp/linux-2.6] / include / linux / mfd / wm8994 / core.h
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
18 struct regulator_dev;
19 struct regulator_bulk_data;
20
21 #define WM8994_NUM_GPIO_REGS 11
22 #define WM8994_NUM_LDO_REGS 2
23
24 struct 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 */
46 int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
47 int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
48                  unsigned short val);
49 int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
50                     unsigned short mask, unsigned short val);
51 int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
52                      int count, u16 *buf);
53
54 #endif