summaryrefslogtreecommitdiff
path: root/include/linux/mfd/as3722-plat.h
blob: 701757898a6f7905449d0274d627f8a81e0eaf34 (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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*
 * as3722.h definitions
 *
 * Copyright (C) 2013 ams
 * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
 *
 * Author: Florian Lobmaier <florian.lobmaier@ams.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
 *
 */

#ifndef __LINUX_MFD_AS3722_PLAT_H
#define __LINUX_MFD_AS3722_PLAT_H

#include <linux/types.h>

#define AS3722_EXT_CONTROL_ENABLE1		0x1
#define AS3722_EXT_CONTROL_ENABLE2		0x2
#define AS3722_EXT_CONTROL_ENABLE3		0x3

/* ADC */
enum as3722_adc_source {
	AS3722_ADC_SD0 = 0,
	AS3722_ADC_SD1 = 1,
	AS3722_ADC_SD6 = 2,
	AS3722_ADC_TEMP_SENSOR = 3,
	AS3722_ADC_VSUP = 4,
	AS3722_ADC_GPIO1 = 5,
	AS3722_ADC_GPIO2 = 6,
	AS3722_ADC_GPIO3 = 7,
	AS3722_ADC_GPIO4 = 8,
	AS3722_ADC_GPIO6 = 9,
	AS3722_ADC_GPIO7 = 10,
	AS3722_ADC_VBAT = 11,
	AS3722_ADC_PWM_CLK2 = 12,
	AS3722_ADC_PWM_DAT2 = 13,
	AS3722_ADC_TEMP1_SD0 = 16,
	AS3722_ADC_TEMP2_SD0 = 17,
	AS3722_ADC_TEMP3_SD0 = 18,
	AS3722_ADC_TEMP4_SD0 = 19,
	AS3722_ADC_TEMP_SD1 = 20,
	AS3722_ADC_TEMP1_SD6 = 21,
	AS3722_ADC_TEMP2_SD6 = 22,
};

enum as3722_adc_channel {
	AS3722_ADC0 = 0,
	AS3722_ADC1 = 1,
};

/* regulator IDs */
enum as3722_regulators_id_ {
	AS3722_SD0,
	AS3722_SD1,
	AS3722_SD2,
	AS3722_SD3,
	AS3722_SD4,
	AS3722_SD5,
	AS3722_SD6,
	AS3722_LDO0,
	AS3722_LDO1,
	AS3722_LDO2,
	AS3722_LDO3,
	AS3722_LDO4,
	AS3722_LDO5,
	AS3722_LDO6,
	AS3722_LDO7,
	AS3722_LDO9,
	AS3722_LDO10,
	AS3722_LDO11,
	AS3722_NUM_REGULATORS,
};

/* GPIO IDs */
enum as3722_gpio_id {
	 AS3722_GPIO0,
	 AS3722_GPIO1,
	 AS3722_GPIO2,
	 AS3722_GPIO3,
	 AS3722_GPIO4,
	 AS3722_GPIO5,
	 AS3722_GPIO6,
	 AS3722_GPIO7,
	 AS3722_NUM_GPIO,
};

/* Power Good OC Mask macro */
#define AS3722_OC_PG_MASK_AC_OK            0x1
#define AS3722_OC_PG_MASK_GPIO3            0x2
#define AS3722_OC_PG_MASK_GPIO4            0x4
#define AS3722_OC_PG_MASK_GPIO5            0x8
#define AS3722_OC_PG_MASK_PWRGOOD_SD0      0x10
#define AS3722_OC_PG_MASK_OVCURR_SD0       0x20
#define AS3722_OC_PG_MASK_POWERGOOD_SD6    0x40
#define AS3722_OC_PG_MASK_OVCURR_SD6       0x80

/*
 * struct as3722_pinctrl_platform_data: Pincontrol platform data.
 * @pin: name of pin.
 * @function: Function option of pin. NULL for default.
 * @prop_bias_pull: Pull up, pull down and normal option. NULL for default.
 * @prop_open_drain: Open drain enable/disable. NULL for default.
 * @prop_high_impedance: High impedance enable/disable. NULL for default.
 * @prop_gpio_mode: GPIO mode, if pin function is in gpio, gpio mode
 *			like input, output-high and output-low.
 */
struct as3722_pinctrl_platform_data {
	const char *pin;
	const char *function;
	const char *prop_bias_pull;
	const char *prop_open_drain;
	const char *prop_high_impedance;
	const char *prop_gpio_mode;
};

/*
 * as3722_regulator_platform_data: Regulator platform data.
 * @ext_control: External control.
 */
struct as3722_regulator_platform_data {
	struct regulator_init_data *reg_init;
	int ext_control;
	bool enable_tracking;
	bool disable_tracking_suspend;
	bool volatile_vsel;
};

/*
 * as3722_adc_extcon_platform_data: ADC platform data.
 * @connection_name: Extcon connection name.
 */
struct as3722_adc_extcon_platform_data {
	const char *connection_name;
	bool enable_adc1_continuous_mode;
	bool enable_low_voltage_range;
	int adc_channel;
	int hi_threshold;
	int low_threshold;
};

struct as3722_platform_data {
	struct as3722_regulator_platform_data *reg_pdata[AS3722_NUM_REGULATORS];
	int gpio_base;
	int irq_base;
	int irq_type;
	int use_internal_int_pullup;
	int use_internal_i2c_pullup;
	bool enable_ac_ok_power_on;
	int num_gpio_cfgs;
	bool use_power_off;
	bool use_power_reset;
	struct as3722_gpio_config *gpio_cfgs;
	struct as3722_pinctrl_platform_data *pinctrl_pdata;
	int num_pinctrl;
	struct as3722_adc_extcon_platform_data *extcon_pdata;
	int watchdog_timer_initial_period;
	int watchdog_timer_mode;
	u32 major_rev;
	u32 minor_rev;
	bool enable_clk32k_out;
	bool backup_battery_chargable;
	bool battery_backup_enable_bypass;
	u32 backup_battery_charge_current;
	u32 battery_backup_charge_mode;
	u32 oc_pg_mask;
};

#endif