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