xref: /OK3568_Linux_fs/kernel/include/linux/regulator/max8973-regulator.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * max8973-regulator.h -- MAXIM 8973 regulator
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Interface for regulator driver for MAXIM 8973 DC-DC step-down
6*4882a593Smuzhiyun  * switching regulator.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * Copyright (C) 2012 NVIDIA Corporation
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun  * Author: Laxman Dewangan <ldewangan@nvidia.com>
11*4882a593Smuzhiyun  */
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #ifndef __LINUX_REGULATOR_MAX8973_H
14*4882a593Smuzhiyun #define __LINUX_REGULATOR_MAX8973_H
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun /*
17*4882a593Smuzhiyun  * Control flags for configuration of the device.
18*4882a593Smuzhiyun  * Client need to pass this information with ORed
19*4882a593Smuzhiyun  */
20*4882a593Smuzhiyun #define MAX8973_CONTROL_REMOTE_SENSE_ENABLE			0x00000001
21*4882a593Smuzhiyun #define MAX8973_CONTROL_FALLING_SLEW_RATE_ENABLE		0x00000002
22*4882a593Smuzhiyun #define MAX8973_CONTROL_OUTPUT_ACTIVE_DISCH_ENABLE		0x00000004
23*4882a593Smuzhiyun #define MAX8973_CONTROL_BIAS_ENABLE				0x00000008
24*4882a593Smuzhiyun #define MAX8973_CONTROL_PULL_DOWN_ENABLE			0x00000010
25*4882a593Smuzhiyun #define MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE			0x00000020
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun #define MAX8973_CONTROL_CLKADV_TRIP_DISABLED			0x00000000
28*4882a593Smuzhiyun #define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US			0x00010000
29*4882a593Smuzhiyun #define MAX8973_CONTROL_CLKADV_TRIP_150mV_PER_US		0x00020000
30*4882a593Smuzhiyun #define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US_HIST_DIS	0x00030000
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #define MAX8973_CONTROL_INDUCTOR_VALUE_NOMINAL			0x00000000
33*4882a593Smuzhiyun #define MAX8973_CONTROL_INDUCTOR_VALUE_MINUS_30_PER		0x00100000
34*4882a593Smuzhiyun #define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_30_PER		0x00200000
35*4882a593Smuzhiyun #define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_60_PER		0x00300000
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun /*
38*4882a593Smuzhiyun  * struct max8973_regulator_platform_data - max8973 regulator platform data.
39*4882a593Smuzhiyun  *
40*4882a593Smuzhiyun  * @reg_init_data: The regulator init data.
41*4882a593Smuzhiyun  * @control_flags: Control flags which are ORed value of above flags to
42*4882a593Smuzhiyun  *		configure device.
43*4882a593Smuzhiyun  * @junction_temp_warning: Junction temp in millicelcius on which warning need
44*4882a593Smuzhiyun  *			   to be set. Thermal functionality is only supported on
45*4882a593Smuzhiyun  *			   MAX77621. The threshold warning supported by MAX77621
46*4882a593Smuzhiyun  *			   are 120C and 140C.
47*4882a593Smuzhiyun  * @enable_ext_control: Enable the voltage enable/disable through external
48*4882a593Smuzhiyun  *		control signal from EN input pin. If it is false then
49*4882a593Smuzhiyun  *		voltage output will be enabled/disabled through EN bit of
50*4882a593Smuzhiyun  *		device register.
51*4882a593Smuzhiyun  * @enable_gpio: Enable GPIO. If EN pin is controlled through GPIO from host
52*4882a593Smuzhiyun  *		then GPIO number can be provided. If no GPIO controlled then
53*4882a593Smuzhiyun  *		it should be -1.
54*4882a593Smuzhiyun  * @dvs_gpio: GPIO for dvs. It should be -1 if this is tied with fixed logic.
55*4882a593Smuzhiyun  * @dvs_def_state: Default state of dvs. 1 if it is high else 0.
56*4882a593Smuzhiyun  */
57*4882a593Smuzhiyun struct max8973_regulator_platform_data {
58*4882a593Smuzhiyun 	struct regulator_init_data *reg_init_data;
59*4882a593Smuzhiyun 	unsigned long control_flags;
60*4882a593Smuzhiyun 	unsigned long junction_temp_warning;
61*4882a593Smuzhiyun 	bool enable_ext_control;
62*4882a593Smuzhiyun 	int enable_gpio;
63*4882a593Smuzhiyun 	int dvs_gpio;
64*4882a593Smuzhiyun 	unsigned dvs_def_state:1;
65*4882a593Smuzhiyun };
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun #endif /* __LINUX_REGULATOR_MAX8973_H */
68