summaryrefslogtreecommitdiff
path: root/include/linux/regulator/max77663-regulator.h
blob: d8ab389c425c6fa3df6cc6999c0ff0a2e0f3fbbe (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
/*
 * include/linux/regulator/max77663-regulator.h
 * Maxim LDO and Buck regulators driver
 *
 * Copyright 2011-2012 Maxim Integrated Products, Inc.
 * Copyright (C) 2011-2012 NVIDIA Corporation
 *
 * 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.
 *
 */

#ifndef __LINUX_REGULATOR_MAX77663_REGULATOR_H__
#define __LINUX_REGULATOR_MAX77663_REGULATOR_H__

#include <linux/regulator/machine.h>

#define max77663_rails(_name)	"max77663_"#_name

enum max77663_regulator_id {
	MAX77663_REGULATOR_ID_SD0,
	MAX77663_REGULATOR_ID_DVSSD0,
	MAX77663_REGULATOR_ID_SD1,
	MAX77663_REGULATOR_ID_DVSSD1,
	MAX77663_REGULATOR_ID_SD2,
	MAX77663_REGULATOR_ID_SD3,
	MAX77663_REGULATOR_ID_SD4,
	MAX77663_REGULATOR_ID_LDO0,
	MAX77663_REGULATOR_ID_LDO1,
	MAX77663_REGULATOR_ID_LDO2,
	MAX77663_REGULATOR_ID_LDO3,
	MAX77663_REGULATOR_ID_LDO4,
	MAX77663_REGULATOR_ID_LDO5,
	MAX77663_REGULATOR_ID_LDO6,
	MAX77663_REGULATOR_ID_LDO7,
	MAX77663_REGULATOR_ID_LDO8,
	MAX77663_REGULATOR_ID_NR,
};

/* FPS Power Up/Down Period */
enum max77663_regulator_fps_power_period {
	FPS_POWER_PERIOD_0,
	FPS_POWER_PERIOD_1,
	FPS_POWER_PERIOD_2,
	FPS_POWER_PERIOD_3,
	FPS_POWER_PERIOD_4,
	FPS_POWER_PERIOD_5,
	FPS_POWER_PERIOD_6,
	FPS_POWER_PERIOD_7,
	FPS_POWER_PERIOD_DEF = -1,
};

/* FPS Time Period */
enum max77663_regulator_fps_time_period {
	FPS_TIME_PERIOD_20US,
	FPS_TIME_PERIOD_40US,
	FPS_TIME_PERIOD_80US,
	FPS_TIME_PERIOD_160US,
	FPS_TIME_PERIOD_320US,
	FPS_TIME_PERIOD_640US,
	FPS_TIME_PERIOD_1280US,
	FPS_TIME_PERIOD_2560US,
	FPS_TIME_PERIOD_DEF = -1,
};

/* FPS Enable Source */
enum max77663_regulator_fps_en_src {
	FPS_EN_SRC_EN0,
	FPS_EN_SRC_EN1,
	FPS_EN_SRC_SW,
	FPS_EN_SRC_RSVD,
};

/* FPS Source */
enum max77663_regulator_fps_src {
	FPS_SRC_0,
	FPS_SRC_1,
	FPS_SRC_2,
	FPS_SRC_NONE,
	FPS_SRC_DEF = -1,
};

/*
 * Flags
 */
/* SD0 is controlled by EN2 */
#define EN2_CTRL_SD0		0x01

/* SD Slew Rate */
#define SD_SLEW_RATE_SLOWEST	0x02	/*  13.75mV/us */
#define SD_SLEW_RATE_SLOW	0x04	/*  27.50mV/us */
#define SD_SLEW_RATE_FAST	0x08	/*  55.00mV/us */
#define SD_SLEW_RATE_FASTEST	0x10	/* 100.00mV/us */
#define SD_SLEW_RATE_MASK	0x1E

/* SD Forced PWM Mode */
#define SD_FORCED_PWM_MODE	0x20

/* SD Failling Slew Rate Active-Discharge Mode */
#define SD_FSRADE_DISABLE	0x40

/* Group Low-Power Mode */
#define GLPM_ENABLE		0x80

/* Tracking for LDO4 */
#define LDO4_EN_TRACKING	0x100

struct max77663_regulator_fps_cfg {
	enum max77663_regulator_fps_src src;
	enum max77663_regulator_fps_en_src en_src;
	enum max77663_regulator_fps_time_period time_period;
};

struct max77663_regulator_platform_data {
	struct regulator_init_data init_data;
	bool init_apply;
	bool init_enable;
	int init_uV;
	enum max77663_regulator_fps_src fps_src;
	enum max77663_regulator_fps_power_period fps_pu_period;
	enum max77663_regulator_fps_power_period fps_pd_period;

	int num_fps_cfgs;
	struct max77663_regulator_fps_cfg *fps_cfgs;

	unsigned int flags;
};

#endif /* __LINUX_REGULATOR_MAX77663_REGULATOR_H__ */