summaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/as3711.h
blob: 4be16b4d2c8a8b5c1abb4409edbffff0b5d9d58e (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
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * AS3711 PMIC MFC driver header
 *
 * Copyright (C) 2012 Renesas Electronics Corporation
 * Author: Guennadi Liakhovetski, <g.liakhovetski@gmx.de>
 */

#ifndef MFD_AS3711_H
#define MFD_AS3711_H

/*
 * Client data
 */

/* Register addresses */
#define AS3711_SD_1_VOLTAGE		0	/* Digital Step-Down */
#define AS3711_SD_2_VOLTAGE		1
#define AS3711_SD_3_VOLTAGE		2
#define AS3711_SD_4_VOLTAGE		3
#define AS3711_LDO_1_VOLTAGE		4	/* Analog LDO */
#define AS3711_LDO_2_VOLTAGE		5
#define AS3711_LDO_3_VOLTAGE		6	/* Digital LDO */
#define AS3711_LDO_4_VOLTAGE		7
#define AS3711_LDO_5_VOLTAGE		8
#define AS3711_LDO_6_VOLTAGE		9
#define AS3711_LDO_7_VOLTAGE		0xa
#define AS3711_LDO_8_VOLTAGE		0xb
#define AS3711_SD_CONTROL		0x10
#define AS3711_GPIO_SIGNAL_OUT		0x20
#define AS3711_GPIO_SIGNAL_IN		0x21
#define AS3711_SD_CONTROL_1		0x30
#define AS3711_SD_CONTROL_2		0x31
#define AS3711_CURR_CONTROL		0x40
#define AS3711_CURR1_VALUE		0x43
#define AS3711_CURR2_VALUE		0x44
#define AS3711_CURR3_VALUE		0x45
#define AS3711_STEPUP_CONTROL_1		0x50
#define AS3711_STEPUP_CONTROL_2		0x51
#define AS3711_STEPUP_CONTROL_4		0x53
#define AS3711_STEPUP_CONTROL_5		0x54
#define AS3711_REG_STATUS		0x73
#define AS3711_INTERRUPT_STATUS_1	0x77
#define AS3711_INTERRUPT_STATUS_2	0x78
#define AS3711_INTERRUPT_STATUS_3	0x79
#define AS3711_CHARGER_STATUS_1		0x86
#define AS3711_CHARGER_STATUS_2		0x87
#define AS3711_ASIC_ID_1		0x90
#define AS3711_ASIC_ID_2		0x91

#define AS3711_MAX_REG		AS3711_ASIC_ID_2
#define AS3711_NUM_REGS		(AS3711_MAX_REG + 1)

/* Regulators */
enum {
	AS3711_REGULATOR_SD_1,
	AS3711_REGULATOR_SD_2,
	AS3711_REGULATOR_SD_3,
	AS3711_REGULATOR_SD_4,
	AS3711_REGULATOR_LDO_1,
	AS3711_REGULATOR_LDO_2,
	AS3711_REGULATOR_LDO_3,
	AS3711_REGULATOR_LDO_4,
	AS3711_REGULATOR_LDO_5,
	AS3711_REGULATOR_LDO_6,
	AS3711_REGULATOR_LDO_7,
	AS3711_REGULATOR_LDO_8,

	AS3711_REGULATOR_MAX,
};

struct device;
struct regmap;

struct as3711 {
	struct device *dev;
	struct regmap *regmap;
};

#define AS3711_MAX_STEPDOWN 4
#define AS3711_MAX_STEPUP 2
#define AS3711_MAX_LDO 8

enum as3711_su2_feedback {
	AS3711_SU2_VOLTAGE,
	AS3711_SU2_CURR1,
	AS3711_SU2_CURR2,
	AS3711_SU2_CURR3,
	AS3711_SU2_CURR_AUTO,
};

enum as3711_su2_fbprot {
	AS3711_SU2_LX_SD4,
	AS3711_SU2_GPIO2,
	AS3711_SU2_GPIO3,
	AS3711_SU2_GPIO4,
};

/*
 * Platform data
 */

struct as3711_regulator_pdata {
	struct regulator_init_data *init_data[AS3711_REGULATOR_MAX];
};

struct as3711_bl_pdata {
	bool su1_fb;
	int su1_max_uA;
	bool su2_fb;
	int su2_max_uA;
	enum as3711_su2_feedback su2_feedback;
	enum as3711_su2_fbprot su2_fbprot;
	bool su2_auto_curr1;
	bool su2_auto_curr2;
	bool su2_auto_curr3;
};

struct as3711_platform_data {
	struct as3711_regulator_pdata regulator;
	struct as3711_bl_pdata backlight;
};

#endif