1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 21aa7e23eSSimon Glass /* 31aa7e23eSSimon Glass * (C) Copyright 2010,2011 41aa7e23eSSimon Glass * NVIDIA Corporation <www.nvidia.com> 51aa7e23eSSimon Glass */ 61aa7e23eSSimon Glass 77ffdc831SJeroen Hofstee #ifndef _TPS6586X_H_ 81aa7e23eSSimon Glass #define _TPS6586X_H_ 91aa7e23eSSimon Glass 101aa7e23eSSimon Glass enum { 111aa7e23eSSimon Glass /* SM0-2 PWM/PFM Mode Selection */ 121aa7e23eSSimon Glass TPS6586X_PWM_SM0 = 1 << 0, 131aa7e23eSSimon Glass TPS6586X_PWM_SM1 = 1 << 1, 141aa7e23eSSimon Glass TPS6586X_PWM_SM2 = 1 << 2, 151aa7e23eSSimon Glass }; 161aa7e23eSSimon Glass 171aa7e23eSSimon Glass /** 181aa7e23eSSimon Glass * Enable PWM mode for selected SM0-2 191aa7e23eSSimon Glass * 201aa7e23eSSimon Glass * @param mask Mask of synchronous converter to enable (TPS6586X_PWM_...) 211aa7e23eSSimon Glass * @return 0 if ok, -1 on error 221aa7e23eSSimon Glass */ 231aa7e23eSSimon Glass int tps6586x_set_pwm_mode(int mask); 241aa7e23eSSimon Glass 251aa7e23eSSimon Glass /** 261aa7e23eSSimon Glass * Adjust SM0 and SM1 voltages to the given targets in incremental steps. 271aa7e23eSSimon Glass * 281aa7e23eSSimon Glass * @param sm0_target Target voltage for SM0 in 25mW units, 0=725mV, 31=1.5V 291aa7e23eSSimon Glass * @param sm1_target Target voltage for SM1 in 25mW units, 0=725mV, 31=1.5V 301aa7e23eSSimon Glass * @param step Amount to change voltage in each step, in 25mW units 311aa7e23eSSimon Glass * @param rate Slew ratein mV/us: 0=instantly, 1=0.11, 2=0.22, 321aa7e23eSSimon Glass * 3=0.44, 4=0.88, 5=1.76, 6=3.52, 7=7.04 331aa7e23eSSimon Glass * @param min_sm0_over_sm1 Minimum amount by which sm0 must exceed sm1. 341aa7e23eSSimon Glass * If this condition is not met, no adjustment will be 351aa7e23eSSimon Glass * done and an error will be reported. Use -1 to skip 361aa7e23eSSimon Glass * this check. 371aa7e23eSSimon Glass * @return 0 if ok, -1 on error 381aa7e23eSSimon Glass */ 391aa7e23eSSimon Glass int tps6586x_adjust_sm0_sm1(int sm0_target, int sm1_target, int step, int rate, 401aa7e23eSSimon Glass int min_sm0_over_sm1); 411aa7e23eSSimon Glass 421aa7e23eSSimon Glass /** 431aa7e23eSSimon Glass * Set up the TPS6586X I2C bus number. This will be used for all operations 441aa7e23eSSimon Glass * on the device. This function must be called before using other functions. 451aa7e23eSSimon Glass * 46b0e6ef46SSimon Glass * @param bus I2C bus containing the TPS6586X chip 471aa7e23eSSimon Glass * @return 0 (always succeeds) 481aa7e23eSSimon Glass */ 49b0e6ef46SSimon Glass int tps6586x_init(struct udevice *bus); 501aa7e23eSSimon Glass 511aa7e23eSSimon Glass #endif /* _TPS6586X_H_ */ 52