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_REG		AS3711_ASIC_ID_2
55 #define AS3711_NUM_REGS		(AS3711_MAX_REG + 1)
56 
57 /* Regulators */
58 enum {
59 	AS3711_REGULATOR_SD_1,
60 	AS3711_REGULATOR_SD_2,
61 	AS3711_REGULATOR_SD_3,
62 	AS3711_REGULATOR_SD_4,
63 	AS3711_REGULATOR_LDO_1,
64 	AS3711_REGULATOR_LDO_2,
65 	AS3711_REGULATOR_LDO_3,
66 	AS3711_REGULATOR_LDO_4,
67 	AS3711_REGULATOR_LDO_5,
68 	AS3711_REGULATOR_LDO_6,
69 	AS3711_REGULATOR_LDO_7,
70 	AS3711_REGULATOR_LDO_8,
71 
72 	AS3711_REGULATOR_MAX,
73 };
74 
75 struct device;
76 struct regmap;
77 
78 struct as3711 {
79 	struct device *dev;
80 	struct regmap *regmap;
81 };
82 
83 #define AS3711_MAX_STEPDOWN 4
84 #define AS3711_MAX_STEPUP 2
85 #define AS3711_MAX_LDO 8
86 
87 enum as3711_su2_feedback {
88 	AS3711_SU2_VOLTAGE,
89 	AS3711_SU2_CURR1,
90 	AS3711_SU2_CURR2,
91 	AS3711_SU2_CURR3,
92 	AS3711_SU2_CURR_AUTO,
93 };
94 
95 enum as3711_su2_fbprot {
96 	AS3711_SU2_LX_SD4,
97 	AS3711_SU2_GPIO2,
98 	AS3711_SU2_GPIO3,
99 	AS3711_SU2_GPIO4,
100 };
101 
102 /*
103  * Platform data
104  */
105 
106 struct as3711_regulator_pdata {
107 	struct regulator_init_data *init_data[AS3711_REGULATOR_MAX];
108 };
109 
110 struct as3711_bl_pdata {
111 	bool su1_fb;
112 	int su1_max_uA;
113 	bool su2_fb;
114 	int su2_max_uA;
115 	enum as3711_su2_feedback su2_feedback;
116 	enum as3711_su2_fbprot su2_fbprot;
117 	bool su2_auto_curr1;
118 	bool su2_auto_curr2;
119 	bool su2_auto_curr3;
120 };
121 
122 struct as3711_platform_data {
123 	struct as3711_regulator_pdata regulator;
124 	struct as3711_bl_pdata backlight;
125 };
126 
127 #endif
128