diff options
author | David Hendricks <dhendrix@chromium.org> | 2013-04-09 17:20:07 -0700 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2013-04-10 17:34:19 +0200 |
commit | 765ff76d8f1c09fefdc533b2facd0d99b1787eca (patch) | |
tree | 32671a0b65900d86cdcb14f7c8743f3004972c55 /src/drivers/ti/tps65090/tps65090.h | |
parent | 6e877ec63e034691139897cd4de876f06fa6def5 (diff) |
[2/2] tps65090: re-factor for coreboot
This does basic re-factoring to fit the driver into coreboot.
Change-Id: Id5f8c12a73ec37ddd545d50b3e8e9b3012657db1
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: http://review.coreboot.org/3061
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/drivers/ti/tps65090/tps65090.h')
-rw-r--r-- | src/drivers/ti/tps65090/tps65090.h | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/src/drivers/ti/tps65090/tps65090.h b/src/drivers/ti/tps65090/tps65090.h index b008a55635..b38db59892 100644 --- a/src/drivers/ti/tps65090/tps65090.h +++ b/src/drivers/ti/tps65090/tps65090.h @@ -1,7 +1,32 @@ /* - * Copyright (c) 2012 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. + * Copyright 2012, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free @@ -14,6 +39,17 @@ /* I2C device address for TPS65090 PMU */ #define TPS65090_I2C_ADDR 0x48 +/* TPS65090 FET control registers */ +enum fet_id { + FET1_CTRL = 0x0f, + FET2_CTRL, + FET3_CTRL, + FET4_CTRL, + FET5_CTRL, + FET6_CTRL, + FET7_CTRL, +}; + enum { /* Status register fields */ TPS65090_ST1_OTC = 1 << 0, @@ -31,53 +67,52 @@ enum { /** * Enable FET * - * @param fet_id FET ID, value between 1 and 7 - * @return 0 on success, non-0 on failure + * @bus I2C bus number the TPS65090 is on + * @fet_id FET ID, value between 1 and 7 + * return 0 on success, non-0 on failure */ -int tps65090_fet_enable(unsigned int fet_id); +int tps65090_fet_enable(unsigned int bus, enum fet_id fet_id); /** * Disable FET * - * @param fet_id FET ID, value between 1 and 7 + * @bus I2C bus number the TPS65090 is on + * @fet_id FET ID, value between 1 and 7 * @return 0 on success, non-0 on failure */ -int tps65090_fet_disable(unsigned int fet_id); +int tps65090_fet_disable(unsigned int bus, enum fet_id fet_id); /** * Is FET enabled? * - * @param fet_id FET ID, value between 1 and 7 + * @bus I2C bus number the TPS65090 is on + * @fet_id FET ID, value between 1 and 7 * @return 1 enabled, 0 disabled, negative value on failure */ -int tps65090_fet_is_enabled(unsigned int fet_id); +int tps65090_fet_is_enabled(unsigned int bus, enum fet_id fet_id); /** * Enable / disable the battery charger * - * @param enable 0 to disable charging, non-zero to enable + * @bus I2C bus number the TPS65090 is on + * @enable 0 to disable charging, non-zero to enable */ -int tps65090_set_charge_enable(int enable); +int tps65090_set_charge_enable(unsigned int bus, int enable); /** * Check whether we have enabled battery charging * + * @bus I2C bus number the TPS65090 is on * @return 1 if enabled, 0 if disabled */ -int tps65090_get_charging(void); +int tps65090_is_charging(unsigned int bus); /** * Return the value of the status register * + * @bus I2C bus number the TPS65090 is on * @return status register value, or -1 on error */ -int tps65090_get_status(void); - -/** - * Initialize the TPS65090 PMU. - * - * @return 0 on success, non-0 on failure - */ -int tps65090_init(void); +int tps65090_get_status(unsigned int bus); #endif /* __TPS65090_H_ */ |