1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/include/linux/mfd/aat2870.h
5 * Copyright (c) 2011, NVIDIA Corporation.
9 #ifndef __LINUX_MFD_AAT2870_H
10 #define __LINUX_MFD_AAT2870_H
12 #include <linux/debugfs.h>
13 #include <linux/i2c.h>
15 /* Register offsets */
16 #define AAT2870_BL_CH_EN 0x00
17 #define AAT2870_BLM 0x01
18 #define AAT2870_BLS 0x02
19 #define AAT2870_BL1 0x03
20 #define AAT2870_BL2 0x04
21 #define AAT2870_BL3 0x05
22 #define AAT2870_BL4 0x06
23 #define AAT2870_BL5 0x07
24 #define AAT2870_BL6 0x08
25 #define AAT2870_BL7 0x09
26 #define AAT2870_BL8 0x0A
27 #define AAT2870_FLR 0x0B
28 #define AAT2870_FM 0x0C
29 #define AAT2870_FS 0x0D
30 #define AAT2870_ALS_CFG0 0x0E
31 #define AAT2870_ALS_CFG1 0x0F
32 #define AAT2870_ALS_CFG2 0x10
33 #define AAT2870_AMB 0x11
34 #define AAT2870_ALS0 0x12
35 #define AAT2870_ALS1 0x13
36 #define AAT2870_ALS2 0x14
37 #define AAT2870_ALS3 0x15
38 #define AAT2870_ALS4 0x16
39 #define AAT2870_ALS5 0x17
40 #define AAT2870_ALS6 0x18
41 #define AAT2870_ALS7 0x19
42 #define AAT2870_ALS8 0x1A
43 #define AAT2870_ALS9 0x1B
44 #define AAT2870_ALSA 0x1C
45 #define AAT2870_ALSB 0x1D
46 #define AAT2870_ALSC 0x1E
47 #define AAT2870_ALSD 0x1F
48 #define AAT2870_ALSE 0x20
49 #define AAT2870_ALSF 0x21
50 #define AAT2870_SUB_SET 0x22
51 #define AAT2870_SUB_CTRL 0x23
52 #define AAT2870_LDO_AB 0x24
53 #define AAT2870_LDO_CD 0x25
54 #define AAT2870_LDO_EN 0x26
55 #define AAT2870_REG_NUM 0x27
66 /* Backlight channels */
67 #define AAT2870_BL_CH1 0x01
68 #define AAT2870_BL_CH2 0x02
69 #define AAT2870_BL_CH3 0x04
70 #define AAT2870_BL_CH4 0x08
71 #define AAT2870_BL_CH5 0x10
72 #define AAT2870_BL_CH6 0x20
73 #define AAT2870_BL_CH7 0x40
74 #define AAT2870_BL_CH8 0x80
75 #define AAT2870_BL_CH_ALL 0xFF
77 /* Backlight current magnitude (mA) */
78 enum aat2870_current {
79 AAT2870_CURRENT_0_45 = 1,
100 AAT2870_CURRENT_18_9,
101 AAT2870_CURRENT_19_8,
102 AAT2870_CURRENT_20_7,
103 AAT2870_CURRENT_21_6,
104 AAT2870_CURRENT_22_5,
105 AAT2870_CURRENT_23_4,
106 AAT2870_CURRENT_24_3,
107 AAT2870_CURRENT_25_2,
108 AAT2870_CURRENT_26_1,
109 AAT2870_CURRENT_27_0,
113 struct aat2870_register {
119 struct aat2870_data {
121 struct i2c_client *client;
123 struct mutex io_lock;
124 struct aat2870_register *reg_cache; /* register cache */
125 int en_pin; /* enable GPIO pin (if < 0, ignore this value) */
128 /* init and uninit for platform specified */
129 int (*init)(struct aat2870_data *aat2870);
130 void (*uninit)(struct aat2870_data *aat2870);
132 /* i2c io funcntions */
133 int (*read)(struct aat2870_data *aat2870, u8 addr, u8 *val);
134 int (*write)(struct aat2870_data *aat2870, u8 addr, u8 val);
135 int (*update)(struct aat2870_data *aat2870, u8 addr, u8 mask, u8 val);
138 struct dentry *dentry_root;
141 struct aat2870_subdev_info {
147 struct aat2870_platform_data {
148 int en_pin; /* enable GPIO pin (if < 0, ignore this value) */
150 struct aat2870_subdev_info *subdevs;
153 /* init and uninit for platform specified */
154 int (*init)(struct aat2870_data *aat2870);
155 void (*uninit)(struct aat2870_data *aat2870);
158 struct aat2870_bl_platform_data {
159 /* backlight channels, default is AAT2870_BL_CH_ALL */
161 /* backlight current magnitude, default is AAT2870_CURRENT_27_9 */
163 /* maximum brightness, default is 255 */
167 #endif /* __LINUX_MFD_AAT2870_H */