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