116216333SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
25928f538SLaxman Dewangan /*
35928f538SLaxman Dewangan  * max8973-regulator.h -- MAXIM 8973 regulator
45928f538SLaxman Dewangan  *
55928f538SLaxman Dewangan  * Interface for regulator driver for MAXIM 8973 DC-DC step-down
65928f538SLaxman Dewangan  * switching regulator.
75928f538SLaxman Dewangan  *
85928f538SLaxman Dewangan  * Copyright (C) 2012 NVIDIA Corporation
95928f538SLaxman Dewangan 
105928f538SLaxman Dewangan  * Author: Laxman Dewangan <ldewangan@nvidia.com>
115928f538SLaxman Dewangan  */
125928f538SLaxman Dewangan 
135928f538SLaxman Dewangan #ifndef __LINUX_REGULATOR_MAX8973_H
145928f538SLaxman Dewangan #define __LINUX_REGULATOR_MAX8973_H
155928f538SLaxman Dewangan 
165928f538SLaxman Dewangan /*
175928f538SLaxman Dewangan  * Control flags for configuration of the device.
185928f538SLaxman Dewangan  * Client need to pass this information with ORed
195928f538SLaxman Dewangan  */
205928f538SLaxman Dewangan #define MAX8973_CONTROL_REMOTE_SENSE_ENABLE			0x00000001
215928f538SLaxman Dewangan #define MAX8973_CONTROL_FALLING_SLEW_RATE_ENABLE		0x00000002
225928f538SLaxman Dewangan #define MAX8973_CONTROL_OUTPUT_ACTIVE_DISCH_ENABLE		0x00000004
235928f538SLaxman Dewangan #define MAX8973_CONTROL_BIAS_ENABLE				0x00000008
245928f538SLaxman Dewangan #define MAX8973_CONTROL_PULL_DOWN_ENABLE			0x00000010
255928f538SLaxman Dewangan #define MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE			0x00000020
265928f538SLaxman Dewangan 
275928f538SLaxman Dewangan #define MAX8973_CONTROL_CLKADV_TRIP_DISABLED			0x00000000
285928f538SLaxman Dewangan #define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US			0x00010000
295928f538SLaxman Dewangan #define MAX8973_CONTROL_CLKADV_TRIP_150mV_PER_US		0x00020000
305928f538SLaxman Dewangan #define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US_HIST_DIS	0x00030000
315928f538SLaxman Dewangan 
325928f538SLaxman Dewangan #define MAX8973_CONTROL_INDUCTOR_VALUE_NOMINAL			0x00000000
335928f538SLaxman Dewangan #define MAX8973_CONTROL_INDUCTOR_VALUE_MINUS_30_PER		0x00100000
345928f538SLaxman Dewangan #define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_30_PER		0x00200000
355928f538SLaxman Dewangan #define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_60_PER		0x00300000
365928f538SLaxman Dewangan 
375928f538SLaxman Dewangan /*
385928f538SLaxman Dewangan  * struct max8973_regulator_platform_data - max8973 regulator platform data.
395928f538SLaxman Dewangan  *
405928f538SLaxman Dewangan  * @reg_init_data: The regulator init data.
415928f538SLaxman Dewangan  * @control_flags: Control flags which are ORed value of above flags to
425928f538SLaxman Dewangan  *		configure device.
43d2d5437bSLaxman Dewangan  * @junction_temp_warning: Junction temp in millicelcius on which warning need
44d2d5437bSLaxman Dewangan  *			   to be set. Thermal functionality is only supported on
45d2d5437bSLaxman Dewangan  *			   MAX77621. The threshold warning supported by MAX77621
46d2d5437bSLaxman Dewangan  *			   are 120C and 140C.
475928f538SLaxman Dewangan  * @enable_ext_control: Enable the voltage enable/disable through external
485928f538SLaxman Dewangan  *		control signal from EN input pin. If it is false then
495928f538SLaxman Dewangan  *		voltage output will be enabled/disabled through EN bit of
505928f538SLaxman Dewangan  *		device register.
5169eb0980SLaxman Dewangan  * @enable_gpio: Enable GPIO. If EN pin is controlled through GPIO from host
5269eb0980SLaxman Dewangan  *		then GPIO number can be provided. If no GPIO controlled then
5369eb0980SLaxman Dewangan  *		it should be -1.
545928f538SLaxman Dewangan  * @dvs_gpio: GPIO for dvs. It should be -1 if this is tied with fixed logic.
555928f538SLaxman Dewangan  * @dvs_def_state: Default state of dvs. 1 if it is high else 0.
565928f538SLaxman Dewangan  */
575928f538SLaxman Dewangan struct max8973_regulator_platform_data {
585928f538SLaxman Dewangan 	struct regulator_init_data *reg_init_data;
595928f538SLaxman Dewangan 	unsigned long control_flags;
60d2d5437bSLaxman Dewangan 	unsigned long junction_temp_warning;
615928f538SLaxman Dewangan 	bool enable_ext_control;
6269eb0980SLaxman Dewangan 	int enable_gpio;
635928f538SLaxman Dewangan 	int dvs_gpio;
645928f538SLaxman Dewangan 	unsigned dvs_def_state:1;
655928f538SLaxman Dewangan };
665928f538SLaxman Dewangan 
675928f538SLaxman Dewangan #endif /* __LINUX_REGULATOR_MAX8973_H */
68