blob: e3956a654cbcfe8122a3a8ed0976eba4d7430df5 [file] [log] [blame]
Kyungmin Park156f2522010-06-16 09:04:16 +02001/*
Joonyoung Shim2c7e6f52010-09-10 18:36:39 +02002 * max8998.h - Voltage regulator driver for the Maxim 8998
Kyungmin Park156f2522010-06-16 09:04:16 +02003 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MFD_MAX8998_H
24#define __LINUX_MFD_MAX8998_H
25
26#include <linux/regulator/machine.h>
27
28/* MAX 8998 regulator ids */
29enum {
30 MAX8998_LDO2 = 2,
31 MAX8998_LDO3,
32 MAX8998_LDO4,
33 MAX8998_LDO5,
34 MAX8998_LDO6,
35 MAX8998_LDO7,
36 MAX8998_LDO8,
37 MAX8998_LDO9,
38 MAX8998_LDO10,
39 MAX8998_LDO11,
40 MAX8998_LDO12,
41 MAX8998_LDO13,
42 MAX8998_LDO14,
43 MAX8998_LDO15,
44 MAX8998_LDO16,
45 MAX8998_LDO17,
46 MAX8998_BUCK1,
47 MAX8998_BUCK2,
48 MAX8998_BUCK3,
49 MAX8998_BUCK4,
50 MAX8998_EN32KHZ_AP,
51 MAX8998_EN32KHZ_CP,
52 MAX8998_ENVICHG,
53 MAX8998_ESAFEOUT1,
54 MAX8998_ESAFEOUT2,
55};
56
57/**
58 * max8998_regulator_data - regulator data
59 * @id: regulator id
60 * @initdata: regulator init data (contraints, supplies, ...)
Tomasz Figaee999fb2013-06-25 16:08:10 +020061 * @reg_node: DT node of regulator (unused on non-DT platforms)
Kyungmin Park156f2522010-06-16 09:04:16 +020062 */
63struct max8998_regulator_data {
64 int id;
65 struct regulator_init_data *initdata;
Tomasz Figaee999fb2013-06-25 16:08:10 +020066 struct device_node *reg_node;
Kyungmin Park156f2522010-06-16 09:04:16 +020067};
68
69/**
70 * struct max8998_board - packages regulator init data
Kyungmin Park156f2522010-06-16 09:04:16 +020071 * @regulators: array of defined regulators
Masanari Iida5a4432b2012-08-13 21:00:25 +090072 * @num_regulators: number of regulators used
Joonyoung Shim2c7e6f52010-09-10 18:36:39 +020073 * @irq_base: base IRQ number for max8998, required for IRQs
74 * @ono: power onoff IRQ number for max8998
MyungJoo Ham735a3d92011-01-11 12:20:05 +010075 * @buck_voltage_lock: Do NOT change the values of the following six
76 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
77 * be other than the preset values.
Tomasz Figa4280e0b42013-06-24 14:39:53 +020078 * @buck1_voltage: BUCK1 DVS mode 1 voltage registers
79 * @buck2_voltage: BUCK2 DVS mode 2 voltage registers
Lukasz Majewski58aa6332010-09-27 14:32:26 +020080 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
81 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
MyungJoo Ham735a3d92011-01-11 12:20:05 +010082 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
Lukasz Majewski58aa6332010-09-27 14:32:26 +020083 * @buck2_set3: BUCK2 gpio pin to set output voltage
MyungJoo Ham735a3d92011-01-11 12:20:05 +010084 * @buck2_default_idx: Default for BUCK2 gpio pin.
MyungJoo Ham337ce5d2011-01-04 14:17:39 +090085 * @wakeup: Allow to wake up from suspend
86 * @rtc_delay: LP3974 RTC chip bug that requires delay after a register
87 * write before reading it.
Donggeun Kimbb4ce972011-06-24 19:04:18 +090088 * @eoc: End of Charge Level in percent: 10% ~ 45% by 5% step
89 * If it equals 0, leave it unchanged.
90 * Otherwise, it is a invalid value.
91 * @restart: Restart Level in mV: 100, 150, 200, and -1 for disable.
92 * If it equals 0, leave it unchanged.
93 * Otherwise, it is a invalid value.
94 * @timeout: Full Timeout in hours: 5, 6, 7, and -1 for disable.
95 * If it equals 0, leave it unchanged.
96 * Otherwise, leave it unchanged.
Kyungmin Park156f2522010-06-16 09:04:16 +020097 */
Kyungmin Park156f2522010-06-16 09:04:16 +020098struct max8998_platform_data {
Kyungmin Park156f2522010-06-16 09:04:16 +020099 struct max8998_regulator_data *regulators;
Joonyoung Shim2c7e6f52010-09-10 18:36:39 +0200100 int num_regulators;
Tomasz Figa443c6ae2013-06-24 14:39:52 +0200101 unsigned int irq_base;
Joonyoung Shim2c7e6f52010-09-10 18:36:39 +0200102 int ono;
MyungJoo Ham735a3d92011-01-11 12:20:05 +0100103 bool buck_voltage_lock;
Tomasz Figa4280e0b42013-06-24 14:39:53 +0200104 int buck1_voltage[4];
105 int buck2_voltage[2];
Lukasz Majewski58aa6332010-09-27 14:32:26 +0200106 int buck1_set1;
107 int buck1_set2;
MyungJoo Ham735a3d92011-01-11 12:20:05 +0100108 int buck1_default_idx;
Lukasz Majewski58aa6332010-09-27 14:32:26 +0200109 int buck2_set3;
MyungJoo Ham735a3d92011-01-11 12:20:05 +0100110 int buck2_default_idx;
MyungJoo Hamcdd137c2010-12-23 17:53:36 +0900111 bool wakeup;
MyungJoo Ham337ce5d2011-01-04 14:17:39 +0900112 bool rtc_delay;
Donggeun Kimbb4ce972011-06-24 19:04:18 +0900113 int eoc;
114 int restart;
115 int timeout;
Kyungmin Park156f2522010-06-16 09:04:16 +0200116};
117
118#endif /* __LINUX_MFD_MAX8998_H */