Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
aat2870.h
Go to the documentation of this file.
1 /*
2  * linux/include/linux/mfd/aat2870.h
3  *
4  * Copyright (c) 2011, NVIDIA Corporation.
5  * Author: Jin Park <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef __LINUX_MFD_AAT2870_H
23 #define __LINUX_MFD_AAT2870_H
24 
25 #include <linux/debugfs.h>
26 #include <linux/i2c.h>
27 
28 /* Register offsets */
29 #define AAT2870_BL_CH_EN 0x00
30 #define AAT2870_BLM 0x01
31 #define AAT2870_BLS 0x02
32 #define AAT2870_BL1 0x03
33 #define AAT2870_BL2 0x04
34 #define AAT2870_BL3 0x05
35 #define AAT2870_BL4 0x06
36 #define AAT2870_BL5 0x07
37 #define AAT2870_BL6 0x08
38 #define AAT2870_BL7 0x09
39 #define AAT2870_BL8 0x0A
40 #define AAT2870_FLR 0x0B
41 #define AAT2870_FM 0x0C
42 #define AAT2870_FS 0x0D
43 #define AAT2870_ALS_CFG0 0x0E
44 #define AAT2870_ALS_CFG1 0x0F
45 #define AAT2870_ALS_CFG2 0x10
46 #define AAT2870_AMB 0x11
47 #define AAT2870_ALS0 0x12
48 #define AAT2870_ALS1 0x13
49 #define AAT2870_ALS2 0x14
50 #define AAT2870_ALS3 0x15
51 #define AAT2870_ALS4 0x16
52 #define AAT2870_ALS5 0x17
53 #define AAT2870_ALS6 0x18
54 #define AAT2870_ALS7 0x19
55 #define AAT2870_ALS8 0x1A
56 #define AAT2870_ALS9 0x1B
57 #define AAT2870_ALSA 0x1C
58 #define AAT2870_ALSB 0x1D
59 #define AAT2870_ALSC 0x1E
60 #define AAT2870_ALSD 0x1F
61 #define AAT2870_ALSE 0x20
62 #define AAT2870_ALSF 0x21
63 #define AAT2870_SUB_SET 0x22
64 #define AAT2870_SUB_CTRL 0x23
65 #define AAT2870_LDO_AB 0x24
66 #define AAT2870_LDO_CD 0x25
67 #define AAT2870_LDO_EN 0x26
68 #define AAT2870_REG_NUM 0x27
69 
70 /* Device IDs */
71 enum aat2870_id {
77 };
78 
79 /* Backlight channels */
80 #define AAT2870_BL_CH1 0x01
81 #define AAT2870_BL_CH2 0x02
82 #define AAT2870_BL_CH3 0x04
83 #define AAT2870_BL_CH4 0x08
84 #define AAT2870_BL_CH5 0x10
85 #define AAT2870_BL_CH6 0x20
86 #define AAT2870_BL_CH7 0x40
87 #define AAT2870_BL_CH8 0x80
88 #define AAT2870_BL_CH_ALL 0xFF
89 
90 /* Backlight current magnitude (mA) */
124 };
125 
127  bool readable;
128  bool writeable;
130 };
131 
132 struct aat2870_data {
133  struct device *dev;
135 
136  struct mutex io_lock;
137  struct aat2870_register *reg_cache; /* register cache */
138  int en_pin; /* enable GPIO pin (if < 0, ignore this value) */
139  bool is_enable;
140 
141  /* init and uninit for platform specified */
142  int (*init)(struct aat2870_data *aat2870);
143  void (*uninit)(struct aat2870_data *aat2870);
144 
145  /* i2c io funcntions */
146  int (*read)(struct aat2870_data *aat2870, u8 addr, u8 *val);
147  int (*write)(struct aat2870_data *aat2870, u8 addr, u8 val);
148  int (*update)(struct aat2870_data *aat2870, u8 addr, u8 mask, u8 val);
149 
150  /* for debugfs */
153 };
154 
156  int id;
157  const char *name;
159 };
160 
162  int en_pin; /* enable GPIO pin (if < 0, ignore this value) */
163 
166 
167  /* init and uninit for platform specified */
168  int (*init)(struct aat2870_data *aat2870);
169  void (*uninit)(struct aat2870_data *aat2870);
170 };
171 
173  /* backlight channels, default is AAT2870_BL_CH_ALL */
174  int channels;
175  /* backlight current magnitude, default is AAT2870_CURRENT_27_9 */
177  /* maximum brightness, default is 255 */
179 };
180 
181 #endif /* __LINUX_MFD_AAT2870_H */