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