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