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