1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * (C) Copyright 2010,2011 3*4882a593Smuzhiyun * NVIDIA Corporation <www.nvidia.com> 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+ 6*4882a593Smuzhiyun */ 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun #ifndef _TPS6586X_H_ 9*4882a593Smuzhiyun #define _TPS6586X_H_ 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun enum { 12*4882a593Smuzhiyun /* SM0-2 PWM/PFM Mode Selection */ 13*4882a593Smuzhiyun TPS6586X_PWM_SM0 = 1 << 0, 14*4882a593Smuzhiyun TPS6586X_PWM_SM1 = 1 << 1, 15*4882a593Smuzhiyun TPS6586X_PWM_SM2 = 1 << 2, 16*4882a593Smuzhiyun }; 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun /** 19*4882a593Smuzhiyun * Enable PWM mode for selected SM0-2 20*4882a593Smuzhiyun * 21*4882a593Smuzhiyun * @param mask Mask of synchronous converter to enable (TPS6586X_PWM_...) 22*4882a593Smuzhiyun * @return 0 if ok, -1 on error 23*4882a593Smuzhiyun */ 24*4882a593Smuzhiyun int tps6586x_set_pwm_mode(int mask); 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun /** 27*4882a593Smuzhiyun * Adjust SM0 and SM1 voltages to the given targets in incremental steps. 28*4882a593Smuzhiyun * 29*4882a593Smuzhiyun * @param sm0_target Target voltage for SM0 in 25mW units, 0=725mV, 31=1.5V 30*4882a593Smuzhiyun * @param sm1_target Target voltage for SM1 in 25mW units, 0=725mV, 31=1.5V 31*4882a593Smuzhiyun * @param step Amount to change voltage in each step, in 25mW units 32*4882a593Smuzhiyun * @param rate Slew ratein mV/us: 0=instantly, 1=0.11, 2=0.22, 33*4882a593Smuzhiyun * 3=0.44, 4=0.88, 5=1.76, 6=3.52, 7=7.04 34*4882a593Smuzhiyun * @param min_sm0_over_sm1 Minimum amount by which sm0 must exceed sm1. 35*4882a593Smuzhiyun * If this condition is not met, no adjustment will be 36*4882a593Smuzhiyun * done and an error will be reported. Use -1 to skip 37*4882a593Smuzhiyun * this check. 38*4882a593Smuzhiyun * @return 0 if ok, -1 on error 39*4882a593Smuzhiyun */ 40*4882a593Smuzhiyun int tps6586x_adjust_sm0_sm1(int sm0_target, int sm1_target, int step, int rate, 41*4882a593Smuzhiyun int min_sm0_over_sm1); 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun /** 44*4882a593Smuzhiyun * Set up the TPS6586X I2C bus number. This will be used for all operations 45*4882a593Smuzhiyun * on the device. This function must be called before using other functions. 46*4882a593Smuzhiyun * 47*4882a593Smuzhiyun * @param bus I2C bus containing the TPS6586X chip 48*4882a593Smuzhiyun * @return 0 (always succeeds) 49*4882a593Smuzhiyun */ 50*4882a593Smuzhiyun int tps6586x_init(struct udevice *bus); 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun #endif /* _TPS6586X_H_ */ 53