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
{
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
42 struct regmap
*regmap
;
43 struct i2c_client
*i2c
;
44 struct i2c_client
*rtc
;
51 struct regmap_irq_chip_data
*irq_data
;
54 u8 irq_masks_cur
[NUM_IRQ_REGS
];
55 u8 irq_masks_cache
[NUM_IRQ_REGS
];
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
;
77 int (*cfg_pmic_irq
)(void);
81 bool buck_voltage_lock
;
99 int buck2_default_idx
;
100 int buck3_default_idx
;
101 int buck4_default_idx
;
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
;
123 * sec_regulator_data - regulator data
125 * @initdata: regulator init data (contraints, supplies, ...)
127 struct sec_regulator_data
{
129 struct regulator_init_data
*initdata
;
133 * sec_opmode_data - regulator operation mode data
135 * @mode: regulator operation mode
137 struct sec_opmode_data
{
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
159 #endif /* __LINUX_MFD_SEC_CORE_H */