summaryrefstree
path: root/kernel/include/linux/regulator/s2mpb01.h
blob: 0364082bea4db4c111648eb68ba95561340d6560 (plain)
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
/*
 * s2mpb01.h - Regulator driver for the S.LSI S2MPB01
 *
 * Copyright (C) 2014 Samsung Electronics
 * SangYoung Son <hello.son@samsung.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * This driver is based on max77826.h
 */


#ifndef __LINUX_REGULATOR_S2MPB01_H
#define __LINUX_REGULATOR_S2MPB01_H

#include <linux/regulator/machine.h>

/* S2MPB01 regulator ids */
enum s2mpb01_regulators {
	S2MPB01_LDO1 = 0,
	S2MPB01_LDO2,
	S2MPB01_LDO3,
	S2MPB01_LDO4,
	S2MPB01_LDO5,
	S2MPB01_LDO6,
	S2MPB01_LDO7,
	S2MPB01_LDO8,
	S2MPB01_LDO9,
	S2MPB01_LDO10,
	S2MPB01_LDO11,
	S2MPB01_LDO12,
	S2MPB01_LDO13,
	S2MPB01_LDO14,
	S2MPB01_LDO15,
	S2MPB01_BUCK1,
	S2MPB01_BUCK2,

	S2MPB01_REG_MAX,
};

/* S2MPB01 PMIC Registers. */
enum s2mpb01_pmic_registers {
	S2MPB01_REG_PMIC_ID = 0x00,
	S2MPB01_REG_INT1,
	S2MPB01_REG_INT1M,
	S2MPB01_REG_STATUS1,
	S2MPB01_REG_CTRL,

	S2MPB01_REG_BUCK_CTRL = 0x0B,
	S2MPB01_REG_BUCK_OUT,
	S2MPB01_REG_BB_CTRL,
	S2MPB01_REG_BB_OUT,
	S2MPB01_REG_BUCK_RAMP,

	S2MPB01_REG_LDO1_CTRL = 0x10,
	S2MPB01_REG_LDO2_CTRL,
	S2MPB01_REG_LDO3_CTRL,
	S2MPB01_REG_LDO4_CTRL,
	S2MPB01_REG_LDO5_CTRL,
	S2MPB01_REG_LDO6_CTRL,
	S2MPB01_REG_LDO7_CTRL,
	S2MPB01_REG_LDO8_CTRL,
	S2MPB01_REG_LDO9_CTRL,
	S2MPB01_REG_LDO10_CTRL,
	S2MPB01_REG_LDO11_CTRL,
	S2MPB01_REG_LDO12_CTRL,
	S2MPB01_REG_LDO13_CTRL,
	S2MPB01_REG_LDO14_CTRL,
	S2MPB01_REG_LDO15_CTRL,

	S2MPB01_REG_LDO_DSCH1 = 0x1F,
	S2MPB01_REG_LDO_DSCH2,
};

/* LDO output, mode control */
#define LDO_CTRL_OFF	0x0
#define LDO_CTRL_PWREN	0x1
#define LDO_CTRL_MODE	0x2
#define LDO_CTRL_ON	0x3

struct s2mpb01_dev {
	struct device *dev;
	struct mutex io_lock;
	struct i2c_client *i2c;
	int num_regulators;
	struct regulator_dev **rdev;
};

struct s2mpb01_regulator_subdev {
	int id;
	struct regulator_init_data *initdata;
	struct device_node *reg_node;
};

struct s2mpb01_platform_data {
	char *name;
	int num_regulators;
	struct s2mpb01_regulator_subdev *regulators;
};
#endif	/* __LINUX_REGULATOR_S2MPB01_H */