aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/samsung/core.h
diff options
context:
space:
mode:
authorSangbeom Kim <sbkim73@samsung.com>2012-07-11 08:07:16 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-07-16 08:28:11 -0400
commit54227bcf20fa0d8a0748c54747b9c39e8b16150d (patch)
tree714cc3d20de5fec08995c3e60ac59661b71380e1 /include/linux/mfd/samsung/core.h
parent63063bfbffe997452e2ee4890f22dcde0119001e (diff)
mfd: Modify samsung mfd header
As Prefix of Samsung pmic changed from s5m to s2m, To make common mfd driver for s2m and s5m series, This patch rename header of Samsung mfd and modify mfd driver. Signed-off-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux/mfd/samsung/core.h')
-rw-r--r--include/linux/mfd/samsung/core.h147
1 files changed, 147 insertions, 0 deletions
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
new file mode 100644
index 000000000000..3f5bcb2d0f18
--- /dev/null
+++ b/include/linux/mfd/samsung/core.h
@@ -0,0 +1,147 @@
1/*
2 * core.h
3 *
4 * copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_SEC_CORE_H
15#define __LINUX_MFD_SEC_CORE_H
16
17#define NUM_IRQ_REGS 4
18
19enum sec_device_type {
20 S5M8751X,
21 S5M8763X,
22 S5M8767X,
23};
24
25/**
26 * struct sec_pmic_dev - s5m87xx master device for sub-drivers
27 * @dev: master device of the chip (can be used to access platform data)
28 * @i2c: i2c client private data for regulator
29 * @rtc: i2c client private data for rtc
30 * @iolock: mutex for serializing io access
31 * @irqlock: mutex for buslock
32 * @irq_base: base IRQ number for sec-pmic, required for IRQs
33 * @irq: generic IRQ number for s5m87xx
34 * @ono: power onoff IRQ number for s5m87xx
35 * @irq_masks_cur: currently active value
36 * @irq_masks_cache: cached hardware value
37 * @type: indicate which s5m87xx "variant" is used
38 */
39struct sec_pmic_dev {
40 struct device *dev;
41 struct regmap *regmap;
42 struct i2c_client *i2c;
43 struct i2c_client *rtc;
44 struct mutex iolock;
45 struct mutex irqlock;
46
47 int device_type;
48 int irq_base;
49 int irq;
50 int ono;
51 u8 irq_masks_cur[NUM_IRQ_REGS];
52 u8 irq_masks_cache[NUM_IRQ_REGS];
53 int type;
54 bool wakeup;
55};
56
57int sec_irq_init(struct sec_pmic_dev *sec_pmic);
58void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
59int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
60
61extern int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest);
62extern int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf);
63extern int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value);
64extern int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf);
65extern int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask);
66
67struct sec_platform_data {
68 struct sec_regulator_data *regulators;
69 struct sec_opmode_data *opmode;
70 int device_type;
71 int num_regulators;
72
73 int irq_base;
74 int (*cfg_pmic_irq)(void);
75
76 int ono;
77 bool wakeup;
78 bool buck_voltage_lock;
79
80 int buck_gpios[3];
81 int buck_ds[3];
82 int buck2_voltage[8];
83 bool buck2_gpiodvs;
84 int buck3_voltage[8];
85 bool buck3_gpiodvs;
86 int buck4_voltage[8];
87 bool buck4_gpiodvs;
88
89 int buck_set1;
90 int buck_set2;
91 int buck_set3;
92 int buck2_enable;
93 int buck3_enable;
94 int buck4_enable;
95 int buck_default_idx;
96 int buck2_default_idx;
97 int buck3_default_idx;
98 int buck4_default_idx;
99
100 int buck_ramp_delay;
101 bool buck2_ramp_enable;
102 bool buck3_ramp_enable;
103 bool buck4_ramp_enable;
104
105 int buck2_init;
106 int buck3_init;
107 int buck4_init;
108};
109
110/**
111 * sec_regulator_data - regulator data
112 * @id: regulator id
113 * @initdata: regulator init data (contraints, supplies, ...)
114 */
115struct sec_regulator_data {
116 int id;
117 struct regulator_init_data *initdata;
118};
119
120/*
121 * sec_opmode_data - regulator operation mode data
122 * @id: regulator id
123 * @mode: regulator operation mode
124 */
125struct sec_opmode_data {
126 int id;
127 int mode;
128};
129
130/*
131 * samsung regulator operation mode
132 * SEC_OPMODE_OFF Regulator always OFF
133 * SEC_OPMODE_ON Regulator always ON
134 * SEC_OPMODE_LOWPOWER Regulator is on in low-power mode
135 * SEC_OPMODE_SUSPEND Regulator is changed by PWREN pin
136 * If PWREN is high, regulator is on
137 * If PWREN is low, regulator is off
138 */
139
140enum sec_opmode {
141 SEC_OPMODE_OFF,
142 SEC_OPMODE_ON,
143 SEC_OPMODE_LOWPOWER,
144 SEC_OPMODE_SUSPEND,
145};
146
147#endif /* __LINUX_MFD_SEC_CORE_H */