xref: /linux/include/linux/regulator/max1586.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * max1586.h  --  Voltage regulation for the Maxim 1586
4  *
5  * Copyright (C) 2008 Robert Jarzmik
6  */
7 
8 #ifndef REGULATOR_MAX1586
9 #define REGULATOR_MAX1586
10 
11 #include <linux/regulator/machine.h>
12 
13 #define MAX1586_V3 0
14 #define MAX1586_V6 1
15 
16 /* precalculated values for v3_gain */
17 #define MAX1586_GAIN_NO_R24   1000000  /* 700000 .. 1475000 mV */
18 #define MAX1586_GAIN_R24_3k32 1051098  /* 735768 .. 1550369 mV */
19 #define MAX1586_GAIN_R24_5k11 1078648  /* 755053 .. 1591005 mV */
20 #define MAX1586_GAIN_R24_7k5  1115432  /* 780802 .. 1645262 mV */
21 
22 /**
23  * max1586_subdev_data - regulator data
24  * @id: regulator Id (either MAX1586_V3 or MAX1586_V6)
25  * @name: regulator cute name (example for V3: "vcc_core")
26  * @platform_data: regulator init data (constraints, supplies, ...)
27  */
28 struct max1586_subdev_data {
29 	int				id;
30 	const char			*name;
31 	struct regulator_init_data	*platform_data;
32 };
33 
34 /**
35  * max1586_platform_data - platform data for max1586
36  * @num_subdevs: number of regulators used (may be 1 or 2)
37  * @subdevs: regulator used
38  *           At most, there will be a regulator for V3 and one for V6 voltages.
39  * @v3_gain: gain on the V3 voltage output multiplied by 1e6.
40  *           This can be calculated as ((1 + R24/R25 + R24/185.5kOhm) * 1e6)
41  *           for an external resistor configuration as described in the
42  *           data sheet (R25=100kOhm).
43  */
44 struct max1586_platform_data {
45 	int num_subdevs;
46 	struct max1586_subdev_data *subdevs;
47 	int v3_gain;
48 };
49 
50 #endif
51