15928f538SLaxman Dewangan /*
25928f538SLaxman Dewangan  * max8973-regulator.h -- MAXIM 8973 regulator
35928f538SLaxman Dewangan  *
45928f538SLaxman Dewangan  * Interface for regulator driver for MAXIM 8973 DC-DC step-down
55928f538SLaxman Dewangan  * switching regulator.
65928f538SLaxman Dewangan  *
75928f538SLaxman Dewangan  * Copyright (C) 2012 NVIDIA Corporation
85928f538SLaxman Dewangan 
95928f538SLaxman Dewangan  * Author: Laxman Dewangan <ldewangan@nvidia.com>
105928f538SLaxman Dewangan  *
115928f538SLaxman Dewangan  * This program is free software; you can redistribute it and/or modify
125928f538SLaxman Dewangan  * it under the terms of the GNU General Public License as published by
135928f538SLaxman Dewangan  * the Free Software Foundation; either version 2 of the License, or
145928f538SLaxman Dewangan  * (at your option) any later version.
155928f538SLaxman Dewangan  *
165928f538SLaxman Dewangan  * This program is distributed in the hope that it will be useful, but WITHOUT
175928f538SLaxman Dewangan  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
185928f538SLaxman Dewangan  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
195928f538SLaxman Dewangan  * more details.
205928f538SLaxman Dewangan  *
215928f538SLaxman Dewangan  * You should have received a copy of the GNU General Public License along
225928f538SLaxman Dewangan  * with this program; if not, write to the Free Software Foundation, Inc.,
235928f538SLaxman Dewangan  * 51 Franklin Street, Fifth Floor, Boston, MA	02110-1301, USA.
245928f538SLaxman Dewangan  *
255928f538SLaxman Dewangan  */
265928f538SLaxman Dewangan 
275928f538SLaxman Dewangan #ifndef __LINUX_REGULATOR_MAX8973_H
285928f538SLaxman Dewangan #define __LINUX_REGULATOR_MAX8973_H
295928f538SLaxman Dewangan 
305928f538SLaxman Dewangan /*
315928f538SLaxman Dewangan  * Control flags for configuration of the device.
325928f538SLaxman Dewangan  * Client need to pass this information with ORed
335928f538SLaxman Dewangan  */
345928f538SLaxman Dewangan #define MAX8973_CONTROL_REMOTE_SENSE_ENABLE			0x00000001
355928f538SLaxman Dewangan #define MAX8973_CONTROL_FALLING_SLEW_RATE_ENABLE		0x00000002
365928f538SLaxman Dewangan #define MAX8973_CONTROL_OUTPUT_ACTIVE_DISCH_ENABLE		0x00000004
375928f538SLaxman Dewangan #define MAX8973_CONTROL_BIAS_ENABLE				0x00000008
385928f538SLaxman Dewangan #define MAX8973_CONTROL_PULL_DOWN_ENABLE			0x00000010
395928f538SLaxman Dewangan #define MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE			0x00000020
405928f538SLaxman Dewangan 
415928f538SLaxman Dewangan #define MAX8973_CONTROL_CLKADV_TRIP_DISABLED			0x00000000
425928f538SLaxman Dewangan #define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US			0x00010000
435928f538SLaxman Dewangan #define MAX8973_CONTROL_CLKADV_TRIP_150mV_PER_US		0x00020000
445928f538SLaxman Dewangan #define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US_HIST_DIS	0x00030000
455928f538SLaxman Dewangan 
465928f538SLaxman Dewangan #define MAX8973_CONTROL_INDUCTOR_VALUE_NOMINAL			0x00000000
475928f538SLaxman Dewangan #define MAX8973_CONTROL_INDUCTOR_VALUE_MINUS_30_PER		0x00100000
485928f538SLaxman Dewangan #define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_30_PER		0x00200000
495928f538SLaxman Dewangan #define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_60_PER		0x00300000
505928f538SLaxman Dewangan 
515928f538SLaxman Dewangan /*
525928f538SLaxman Dewangan  * struct max8973_regulator_platform_data - max8973 regulator platform data.
535928f538SLaxman Dewangan  *
545928f538SLaxman Dewangan  * @reg_init_data: The regulator init data.
555928f538SLaxman Dewangan  * @control_flags: Control flags which are ORed value of above flags to
565928f538SLaxman Dewangan  *		configure device.
57d2d5437bSLaxman Dewangan  * @junction_temp_warning: Junction temp in millicelcius on which warning need
58d2d5437bSLaxman Dewangan  *			   to be set. Thermal functionality is only supported on
59d2d5437bSLaxman Dewangan  *			   MAX77621. The threshold warning supported by MAX77621
60d2d5437bSLaxman Dewangan  *			   are 120C and 140C.
615928f538SLaxman Dewangan  * @enable_ext_control: Enable the voltage enable/disable through external
625928f538SLaxman Dewangan  *		control signal from EN input pin. If it is false then
635928f538SLaxman Dewangan  *		voltage output will be enabled/disabled through EN bit of
645928f538SLaxman Dewangan  *		device register.
6569eb0980SLaxman Dewangan  * @enable_gpio: Enable GPIO. If EN pin is controlled through GPIO from host
6669eb0980SLaxman Dewangan  *		then GPIO number can be provided. If no GPIO controlled then
6769eb0980SLaxman Dewangan  *		it should be -1.
685928f538SLaxman Dewangan  * @dvs_gpio: GPIO for dvs. It should be -1 if this is tied with fixed logic.
695928f538SLaxman Dewangan  * @dvs_def_state: Default state of dvs. 1 if it is high else 0.
705928f538SLaxman Dewangan  */
715928f538SLaxman Dewangan struct max8973_regulator_platform_data {
725928f538SLaxman Dewangan 	struct regulator_init_data *reg_init_data;
735928f538SLaxman Dewangan 	unsigned long control_flags;
74d2d5437bSLaxman Dewangan 	unsigned long junction_temp_warning;
755928f538SLaxman Dewangan 	bool enable_ext_control;
7669eb0980SLaxman Dewangan 	int enable_gpio;
775928f538SLaxman Dewangan 	int dvs_gpio;
785928f538SLaxman Dewangan 	unsigned dvs_def_state:1;
795928f538SLaxman Dewangan };
805928f538SLaxman Dewangan 
815928f538SLaxman Dewangan #endif /* __LINUX_REGULATOR_MAX8973_H */
82