aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/max77686.h
blob: d6ddb93afdf329ad72a6e3829b3e74d8078d762e (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
 * max77686.h - Driver for the Maxim 77686
 *
 *  Copyright (C) 2011 Samsung Electrnoics
 *  Chiwoong Byun <woong.byun@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 max8997.h
 *
 * MAX77686 has PMIC, RTC devices.
 * The devices share the same I2C bus and included in
 * this mfd driver.
 */

#ifndef __LINUX_MFD_MAX77686_H
#define __LINUX_MFD_MAX77686_H

#include <linux/regulator/consumer.h>

#define MAX77686_SMPL_ENABLE			(0x1)
#define MAX77686_WTSR_ENABLE			(0x2)

/* MAX77686 regulator IDs */
enum max77686_regulators {
	MAX77686_LDO1 = 0,
	MAX77686_LDO2,
	MAX77686_LDO3,
	MAX77686_LDO4,
	MAX77686_LDO5,
	MAX77686_LDO6,
	MAX77686_LDO7,
	MAX77686_LDO8,
	MAX77686_LDO9,
	MAX77686_LDO10,
	MAX77686_LDO11,
	MAX77686_LDO12,
	MAX77686_LDO13,
	MAX77686_LDO14,
	MAX77686_LDO15,
	MAX77686_LDO16,
	MAX77686_LDO17,
	MAX77686_LDO18,
	MAX77686_LDO19,
	MAX77686_LDO20,
	MAX77686_LDO21,
	MAX77686_LDO22,
	MAX77686_LDO23,
	MAX77686_LDO24,
	MAX77686_LDO25,
	MAX77686_LDO26,
	MAX77686_BUCK1,
	MAX77686_BUCK2,
	MAX77686_BUCK3,
	MAX77686_BUCK4,
	MAX77686_BUCK5,
	MAX77686_BUCK6,
	MAX77686_BUCK7,
	MAX77686_BUCK8,
	MAX77686_BUCK9,
	MAX77686_EN32KHZ_AP,
	MAX77686_EN32KHZ_CP,
	MAX77686_P32KH,

	MAX77686_REG_MAX,
};

struct max77686_regulator_data {
	int id;
	struct regulator_init_data *initdata;
};

enum max77686_opmode {
	MAX77686_OPMODE_NORMAL,
	MAX77686_OPMODE_LP,
	MAX77686_OPMODE_STANDBY,
};

enum max77686_ramp_rate {
	MAX77686_RAMP_RATE_100MV,
	MAX77686_RAMP_RATE_13MV,
	MAX77686_RAMP_RATE_27MV,
	MAX77686_RAMP_RATE_55MV,
};

struct max77686_opmode_data {
	int id;
	int mode;
};

struct max77686_buck234_gpio_data {
	int gpio;
	int data;
};

struct max77686_platform_data {
	/* IRQ */
	int irq_gpio;
	int irq_base;
	int ono;
	int wakeup;

	/* ---- PMIC ---- */
	struct max77686_regulator_data *regulators;
	int num_regulators;
	int has_full_constraints;

	struct max77686_opmode_data *opmode_data;
	int ramp_rate;
	int wtsr_smpl;

	/*
	 * GPIO-DVS feature is not enabled with the current version of
	 * MAX77686 driver. Buck2/3/4_voltages[0] is used as the default
	 * voltage at probe. DVS/SELB gpios are set as OUTPUT-LOW.
	 */
	struct max77686_buck234_gpio_data buck234_gpio_dvs[3]; /* GPIO of [0]DVS1, [1]DVS2, [2]DVS3 */
	int buck234_gpio_selb[3]; /* [0]SELB2, [1]SELB3, [2]SELB4 */
	unsigned int buck2_voltage[8]; /* buckx_voltage in uV */
	unsigned int buck3_voltage[8];
	unsigned int buck4_voltage[8];
};

#endif /* __LINUX_MFD_MAX77686_H */