xref: /linux/include/linux/mfd/as3711.h (revision b889fcf63cb62e7fdb7816565e28f44dbe4a76a5)
1 /*
2  * AS3711 PMIC MFC driver header
3  *
4  * Copyright (C) 2012 Renesas Electronics Corporation
5  * Author: Guennadi Liakhovetski, <g.liakhovetski@gmx.de>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the version 2 of the GNU General Public License as
9  * published by the Free Software Foundation
10  */
11 
12 #ifndef MFD_AS3711_H
13 #define MFD_AS3711_H
14 
15 /*
16  * Client data
17  */
18 
19 /* Register addresses */
20 #define AS3711_SD_1_VOLTAGE		0	/* Digital Step-Down */
21 #define AS3711_SD_2_VOLTAGE		1
22 #define AS3711_SD_3_VOLTAGE		2
23 #define AS3711_SD_4_VOLTAGE		3
24 #define AS3711_LDO_1_VOLTAGE		4	/* Analog LDO */
25 #define AS3711_LDO_2_VOLTAGE		5
26 #define AS3711_LDO_3_VOLTAGE		6	/* Digital LDO */
27 #define AS3711_LDO_4_VOLTAGE		7
28 #define AS3711_LDO_5_VOLTAGE		8
29 #define AS3711_LDO_6_VOLTAGE		9
30 #define AS3711_LDO_7_VOLTAGE		0xa
31 #define AS3711_LDO_8_VOLTAGE		0xb
32 #define AS3711_SD_CONTROL		0x10
33 #define AS3711_GPIO_SIGNAL_OUT		0x20
34 #define AS3711_GPIO_SIGNAL_IN		0x21
35 #define AS3711_SD_CONTROL_1		0x30
36 #define AS3711_SD_CONTROL_2		0x31
37 #define AS3711_CURR_CONTROL		0x40
38 #define AS3711_CURR1_VALUE		0x43
39 #define AS3711_CURR2_VALUE		0x44
40 #define AS3711_CURR3_VALUE		0x45
41 #define AS3711_STEPUP_CONTROL_1		0x50
42 #define AS3711_STEPUP_CONTROL_2		0x51
43 #define AS3711_STEPUP_CONTROL_4		0x53
44 #define AS3711_STEPUP_CONTROL_5		0x54
45 #define AS3711_REG_STATUS		0x73
46 #define AS3711_INTERRUPT_STATUS_1	0x77
47 #define AS3711_INTERRUPT_STATUS_2	0x78
48 #define AS3711_INTERRUPT_STATUS_3	0x79
49 #define AS3711_CHARGER_STATUS_1		0x86
50 #define AS3711_CHARGER_STATUS_2		0x87
51 #define AS3711_ASIC_ID_1		0x90
52 #define AS3711_ASIC_ID_2		0x91
53 
54 #define AS3711_MAX_REGS			0x92
55 
56 /* Regulators */
57 enum {
58 	AS3711_REGULATOR_SD_1,
59 	AS3711_REGULATOR_SD_2,
60 	AS3711_REGULATOR_SD_3,
61 	AS3711_REGULATOR_SD_4,
62 	AS3711_REGULATOR_LDO_1,
63 	AS3711_REGULATOR_LDO_2,
64 	AS3711_REGULATOR_LDO_3,
65 	AS3711_REGULATOR_LDO_4,
66 	AS3711_REGULATOR_LDO_5,
67 	AS3711_REGULATOR_LDO_6,
68 	AS3711_REGULATOR_LDO_7,
69 	AS3711_REGULATOR_LDO_8,
70 
71 	AS3711_REGULATOR_MAX,
72 };
73 
74 struct device;
75 struct regmap;
76 
77 struct as3711 {
78 	struct device *dev;
79 	struct regmap *regmap;
80 };
81 
82 #define AS3711_MAX_STEPDOWN 4
83 #define AS3711_MAX_STEPUP 2
84 #define AS3711_MAX_LDO 8
85 
86 enum as3711_su2_feedback {
87 	AS3711_SU2_VOLTAGE,
88 	AS3711_SU2_CURR1,
89 	AS3711_SU2_CURR2,
90 	AS3711_SU2_CURR3,
91 	AS3711_SU2_CURR_AUTO,
92 };
93 
94 enum as3711_su2_fbprot {
95 	AS3711_SU2_LX_SD4,
96 	AS3711_SU2_GPIO2,
97 	AS3711_SU2_GPIO3,
98 	AS3711_SU2_GPIO4,
99 };
100 
101 /*
102  * Platform data
103  */
104 
105 struct as3711_regulator_pdata {
106 	struct regulator_init_data *init_data[AS3711_REGULATOR_MAX];
107 };
108 
109 struct as3711_bl_pdata {
110 	const char *su1_fb;
111 	int su1_max_uA;
112 	const char *su2_fb;
113 	int su2_max_uA;
114 	enum as3711_su2_feedback su2_feedback;
115 	enum as3711_su2_fbprot su2_fbprot;
116 	bool su2_auto_curr1;
117 	bool su2_auto_curr2;
118 	bool su2_auto_curr3;
119 };
120 
121 struct as3711_platform_data {
122 	struct as3711_regulator_pdata regulator;
123 	struct as3711_bl_pdata backlight;
124 };
125 
126 #endif
127