Adding support for MOXA ART SoC. Testing port of linux-2.6.32.60-moxart.
[linux-3.6.7-moxart.git] / include / linux / mfd / samsung / core.h
blobb50c38f8bc4829b0460c24f113148df9d82ef54c
1 /*
2 * core.h
4 * copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
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.
14 #ifndef __LINUX_MFD_SEC_CORE_H
15 #define __LINUX_MFD_SEC_CORE_H
17 #define NUM_IRQ_REGS 4
19 enum sec_device_type {
20 S5M8751X,
21 S5M8763X,
22 S5M8767X,
23 S2MPS11X,
26 /**
27 * struct sec_pmic_dev - s5m87xx master device for sub-drivers
28 * @dev: master device of the chip (can be used to access platform data)
29 * @i2c: i2c client private data for regulator
30 * @rtc: i2c client private data for rtc
31 * @iolock: mutex for serializing io access
32 * @irqlock: mutex for buslock
33 * @irq_base: base IRQ number for sec-pmic, required for IRQs
34 * @irq: generic IRQ number for s5m87xx
35 * @ono: power onoff IRQ number for s5m87xx
36 * @irq_masks_cur: currently active value
37 * @irq_masks_cache: cached hardware value
38 * @type: indicate which s5m87xx "variant" is used
40 struct sec_pmic_dev {
41 struct device *dev;
42 struct regmap *regmap;
43 struct i2c_client *i2c;
44 struct i2c_client *rtc;
45 struct mutex iolock;
46 struct mutex irqlock;
48 int device_type;
49 int irq_base;
50 int irq;
51 struct regmap_irq_chip_data *irq_data;
53 int ono;
54 u8 irq_masks_cur[NUM_IRQ_REGS];
55 u8 irq_masks_cache[NUM_IRQ_REGS];
56 int type;
57 bool wakeup;
60 int sec_irq_init(struct sec_pmic_dev *sec_pmic);
61 void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
62 int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
64 extern int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest);
65 extern int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf);
66 extern int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value);
67 extern int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf);
68 extern int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask);
70 struct sec_platform_data {
71 struct sec_regulator_data *regulators;
72 struct sec_opmode_data *opmode;
73 int device_type;
74 int num_regulators;
76 int irq_base;
77 int (*cfg_pmic_irq)(void);
79 int ono;
80 bool wakeup;
81 bool buck_voltage_lock;
83 int buck_gpios[3];
84 int buck_ds[3];
85 int buck2_voltage[8];
86 bool buck2_gpiodvs;
87 int buck3_voltage[8];
88 bool buck3_gpiodvs;
89 int buck4_voltage[8];
90 bool buck4_gpiodvs;
92 int buck_set1;
93 int buck_set2;
94 int buck_set3;
95 int buck2_enable;
96 int buck3_enable;
97 int buck4_enable;
98 int buck_default_idx;
99 int buck2_default_idx;
100 int buck3_default_idx;
101 int buck4_default_idx;
103 int buck_ramp_delay;
105 int buck2_ramp_delay;
106 int buck34_ramp_delay;
107 int buck5_ramp_delay;
108 int buck16_ramp_delay;
109 int buck7810_ramp_delay;
110 int buck9_ramp_delay;
112 bool buck2_ramp_enable;
113 bool buck3_ramp_enable;
114 bool buck4_ramp_enable;
115 bool buck6_ramp_enable;
117 int buck2_init;
118 int buck3_init;
119 int buck4_init;
123 * sec_regulator_data - regulator data
124 * @id: regulator id
125 * @initdata: regulator init data (contraints, supplies, ...)
127 struct sec_regulator_data {
128 int id;
129 struct regulator_init_data *initdata;
133 * sec_opmode_data - regulator operation mode data
134 * @id: regulator id
135 * @mode: regulator operation mode
137 struct sec_opmode_data {
138 int id;
139 int mode;
143 * samsung regulator operation mode
144 * SEC_OPMODE_OFF Regulator always OFF
145 * SEC_OPMODE_ON Regulator always ON
146 * SEC_OPMODE_LOWPOWER Regulator is on in low-power mode
147 * SEC_OPMODE_SUSPEND Regulator is changed by PWREN pin
148 * If PWREN is high, regulator is on
149 * If PWREN is low, regulator is off
152 enum sec_opmode {
153 SEC_OPMODE_OFF,
154 SEC_OPMODE_ON,
155 SEC_OPMODE_LOWPOWER,
156 SEC_OPMODE_SUSPEND,
159 #endif /* __LINUX_MFD_SEC_CORE_H */