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