1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2011 Samsung Electronics Co., Ltd
* http://www.samsung.com
*/
#ifndef __LINUX_MFD_SEC_CORE_H
#define __LINUX_MFD_SEC_CORE_H
/* Macros to represent minimum voltages for LDO/BUCK */
#define MIN_3000_MV 3000000
#define MIN_2500_MV 2500000
#define MIN_2000_MV 2000000
#define MIN_1800_MV 1800000
#define MIN_1500_MV 1500000
#define MIN_1400_MV 1400000
#define MIN_1000_MV 1000000
#define MIN_900_MV 900000
#define MIN_850_MV 850000
#define MIN_800_MV 800000
#define MIN_750_MV 750000
#define MIN_650_MV 650000
#define MIN_600_MV 600000
#define MIN_500_MV 500000
/* Ramp delay in uV/us */
#define RAMP_DELAY_12_MVUS 12000
/* Macros to represent steps for LDO/BUCK */
#define STEP_50_MV 50000
#define STEP_25_MV 25000
#define STEP_12_5_MV 12500
#define STEP_6_25_MV 6250
struct gpio_desc;
enum sec_device_type {
S5M8751X,
S5M8763X,
S5M8767X,
S2MPA01,
S2MPS11X,
S2MPS13X,
S2MPS14X,
S2MPS15X,
S2MPU02,
};
/**
* struct sec_pmic_dev - s2m/s5m master device for sub-drivers
* @dev: Master device of the chip
* @pdata: Platform data populated with data from DTS
* or board files
* @regmap_pmic: Regmap associated with PMIC's I2C address
* @i2c: I2C client of the main driver
* @device_type: Type of device, matches enum sec_device_type
* @irq_base: Base IRQ number for device, required for IRQs
* @irq: Generic IRQ number for device
* @irq_data: Runtime data structure for IRQ controller
* @wakeup: Whether or not this is a wakeup device
*/
struct sec_pmic_dev {
struct device *dev;
struct sec_platform_data *pdata;
struct regmap *regmap_pmic;
struct i2c_client *i2c;
unsigned long device_type;
int irq;
struct regmap_irq_chip_data *irq_data;
};
int sec_irq_init(struct sec_pmic_dev *sec_pmic);
void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
struct sec_platform_data {
struct sec_regulator_data *regulators;
struct sec_opmode_data *opmode;
int num_regulators;
int buck_gpios[3];
int buck_ds[3];
unsigned int buck2_voltage[8];
bool buck2_gpiodvs;
unsigned int buck3_voltage[8];
bool buck3_gpiodvs;
unsigned int buck4_voltage[8];
bool buck4_gpiodvs;
int buck_default_idx;
int buck_ramp_delay;
bool buck2_ramp_enable;
bool buck3_ramp_enable;
bool buck4_ramp_enable;
int buck2_init;
int buck3_init;
int buck4_init;
/* Whether or not manually set PWRHOLD to low during shutdown. */
bool manual_poweroff;
/* Disable the WRSTBI (buck voltage warm reset) when probing? */
bool disable_wrstbi;
};
/**
* sec_regulator_data - regulator data
* @id: regulator id
* @initdata: regulator init data (contraints, supplies, ...)
*/
struct sec_regulator_data {
int id;
struct regulator_init_data *initdata;
struct device_node *reg_node;
struct gpio_desc *ext_control_gpiod;
};
/*
* sec_opmode_data - regulator operation mode data
* @id: regulator id
* @mode: regulator operation mode
*/
struct sec_opmode_data {
int id;
unsigned int mode;
};
/*
* samsung regulator operation mode
* SEC_OPMODE_OFF Regulator always OFF
* SEC_OPMODE_ON Regulator always ON
* SEC_OPMODE_LOWPOWER Regulator is on in low-power mode
* SEC_OPMODE_SUSPEND Regulator is changed by PWREN pin
* If PWREN is high, regulator is on
* If PWREN is low, regulator is off
*/
enum sec_opmode {
SEC_OPMODE_OFF,
SEC_OPMODE_ON,
SEC_OPMODE_LOWPOWER,
SEC_OPMODE_SUSPEND,
};
#endif /* __LINUX_MFD_SEC_CORE_H */
|