From de63c628223b36f5536f1a69232e8259086e6f1d Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Mon, 23 Oct 2017 16:24:01 -0700 Subject: [PATCH] driver: Rename pmic_tps650830 -> pmic_tps650x30. The registers seem to be the same for the TPS650930, therefore, this commit just renames the register map to have a more generic name. BUG=None BRANCH=None TEST=make -j buildall Change-Id: Ib1c604b29e7f0e47cc036e042fe597f644d7ad36 Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/736311 Commit-Ready: Aseda Aboagye Tested-by: Aseda Aboagye Reviewed-by: Shawn N --- board/fizz/board.c | 30 +++++++++++++++--------------- driver/pmic_tps650830.h | 35 ----------------------------------- driver/pmic_tps650x30.h | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 50 deletions(-) delete mode 100644 driver/pmic_tps650830.h create mode 100644 driver/pmic_tps650x30.h diff --git a/board/fizz/board.c b/board/fizz/board.c index 7d5a0d6228..940caeae37 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -17,7 +17,7 @@ #include "charger.h" #include "chipset.h" #include "console.h" -#include "driver/pmic_tps650830.h" +#include "driver/pmic_tps650x30.h" #include "driver/temp_sensor/tmp432.h" #include "driver/tcpm/ps8xxx.h" #include "driver/tcpm/tcpci.h" @@ -280,10 +280,10 @@ BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); /* Initialize PMIC */ #define I2C_PMIC_READ(reg, data) \ - i2c_read8(I2C_PORT_PMIC, TPS650830_I2C_ADDR1, (reg), (data)) + i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1, (reg), (data)) #define I2C_PMIC_WRITE(reg, data) \ - i2c_write8(I2C_PORT_PMIC, TPS650830_I2C_ADDR1, (reg), (data)) + i2c_write8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1, (reg), (data)) static void board_pmic_init(void) { @@ -297,8 +297,8 @@ static void board_pmic_init(void) /* Read vendor ID */ while (1) { int data; - err = I2C_PMIC_READ(TPS650830_REG_VENDORID, &data); - if (!err && data == TPS650830_VENDOR_ID) + err = I2C_PMIC_READ(TPS650X30_REG_VENDORID, &data); + if (!err && data == TPS650X30_VENDOR_ID) break; else if (error_count > 5) goto pmic_error; @@ -310,7 +310,7 @@ static void board_pmic_init(void) * [6] : CSDECAYEN * otherbits: default */ - err = I2C_PMIC_WRITE(TPS650830_REG_VCCIOCNT, 0x4A); + err = I2C_PMIC_WRITE(TPS650X30_REG_VCCIOCNT, 0x4A); if (err) goto pmic_error; @@ -319,7 +319,7 @@ static void board_pmic_init(void) * [4] : VCCIOLPM clear * otherbits: default */ - err = I2C_PMIC_WRITE(TPS650830_REG_VRMODECTRL, 0x2F); + err = I2C_PMIC_WRITE(TPS650X30_REG_VRMODECTRL, 0x2F); if (err) goto pmic_error; @@ -328,7 +328,7 @@ static void board_pmic_init(void) * [7] : MVCCIOPG clear * otherbits: default */ - err = I2C_PMIC_WRITE(TPS650830_REG_PGMASK1, 0x80); + err = I2C_PMIC_WRITE(TPS650X30_REG_PGMASK1, 0x80); if (err) goto pmic_error; @@ -339,7 +339,7 @@ static void board_pmic_init(void) * [2] : 1b V9 Power Fault Masked * [0] : 1b V13 Power Fault Masked */ - err = I2C_PMIC_WRITE(TPS650830_REG_PWFAULT_MASK1, 0x95); + err = I2C_PMIC_WRITE(TPS650X30_REG_PWFAULT_MASK1, 0x95); if (err) goto pmic_error; @@ -350,7 +350,7 @@ static void board_pmic_init(void) * [3:2] : 01b V18S discharge resistance (V8S), 100 Ohm * [1:0] : 01b V100S discharge resistance (V11S), 100 Ohm */ - err = I2C_PMIC_WRITE(TPS650830_REG_DISCHCNT4, 0x15); + err = I2C_PMIC_WRITE(TPS650X30_REG_DISCHCNT4, 0x15); if (err) goto pmic_error; @@ -361,7 +361,7 @@ static void board_pmic_init(void) * [3:2] : 01b V100A discharge resistance (V11), 100 Ohm * [1:0] : 01b V085A discharge resistance (V12), 100 Ohm */ - err = I2C_PMIC_WRITE(TPS650830_REG_DISCHCNT3, 0x55); + err = I2C_PMIC_WRITE(TPS650X30_REG_DISCHCNT3, 0x55); if (err) goto pmic_error; @@ -372,7 +372,7 @@ static void board_pmic_init(void) * [3:2] : 01b V33PCH discharge resistance (V7), 100 Ohm * [1:0] : 01b V18A discharge resistance (V8), 100 Ohm */ - err = I2C_PMIC_WRITE(TPS650830_REG_DISCHCNT2, 0x55); + err = I2C_PMIC_WRITE(TPS650X30_REG_DISCHCNT2, 0x55); if (err) goto pmic_error; @@ -381,7 +381,7 @@ static void board_pmic_init(void) * [7:2] : 00b Reserved * [1:0] : 01b VCCIO discharge resistance (V4), 100 Ohm */ - err = I2C_PMIC_WRITE(TPS650830_REG_DISCHCNT1, 0x01); + err = I2C_PMIC_WRITE(TPS650X30_REG_DISCHCNT1, 0x01); if (err) goto pmic_error; @@ -391,7 +391,7 @@ static void board_pmic_init(void) * [5:4] : 10b default * [5:4] : 01b 5.1V (0x1a) */ - err = I2C_PMIC_WRITE(TPS650830_REG_V5ADS3CNT, 0x1a); + err = I2C_PMIC_WRITE(TPS650X30_REG_V5ADS3CNT, 0x1a); if (err) goto pmic_error; @@ -401,7 +401,7 @@ static void board_pmic_init(void) * [6] : 0b Power button reset timer logic, no action (default) * [5:0] : 011111b Force an Emergency reset time, 31s (default) */ - err = I2C_PMIC_WRITE(TPS650830_REG_PBCONFIG, 0x9F); + err = I2C_PMIC_WRITE(TPS650X30_REG_PBCONFIG, 0x9F); if (err) goto pmic_error; diff --git a/driver/pmic_tps650830.h b/driver/pmic_tps650830.h deleted file mode 100644 index d2fc76ce9d..0000000000 --- a/driver/pmic_tps650830.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2015 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. - * - * TI TPS650830 PMIC driver - */ - -#ifndef __CROS_EC_PMIC_TPS650830_H -#define __CROS_EC_PMIC_TPS650830_H - -/* I2C interface */ -#define TPS650830_I2C_ADDR1 (0x30 << 1) -#define TPS650830_I2C_ADDR2 (0x32 << 1) -#define TPS650830_I2C_ADDR3 (0x34 << 1) - -/* TPS650830 registers */ -#define TPS650830_REG_VENDORID 0x00 -#define TPS650830_REG_PBCONFIG 0x14 -#define TPS650830_REG_PGMASK1 0x18 -#define TPS650830_REG_VCCIOCNT 0x30 -#define TPS650830_REG_V5ADS3CNT 0x31 -#define TPS650830_REG_V33ADSWCNT 0x32 -#define TPS650830_REG_V18ACNT 0x34 -#define TPS650830_REG_V1P2UCNT 0x36 -#define TPS650830_REG_VRMODECTRL 0x3B -#define TPS650830_REG_DISCHCNT1 0x3C -#define TPS650830_REG_DISCHCNT2 0x3D -#define TPS650830_REG_DISCHCNT3 0x3E -#define TPS650830_REG_DISCHCNT4 0x3F -#define TPS650830_REG_PWFAULT_MASK1 0xE5 - -/* TPS650830 register values */ -#define TPS650830_VENDOR_ID 0x22 - -#endif /* __CROS_EC_PMIC_TPS650830_H */ diff --git a/driver/pmic_tps650x30.h b/driver/pmic_tps650x30.h new file mode 100644 index 0000000000..16b923d640 --- /dev/null +++ b/driver/pmic_tps650x30.h @@ -0,0 +1,35 @@ +/* Copyright 2017 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. + * + * TI TPS650x30 PMIC register map. + */ + +#ifndef __CROS_EC_PMIC_TPS650X30_H +#define __CROS_EC_PMIC_TPS650X30_H + +/* I2C interface */ +#define TPS650X30_I2C_ADDR1 (0x30 << 1) +#define TPS650X30_I2C_ADDR2 (0x32 << 1) +#define TPS650X30_I2C_ADDR3 (0x34 << 1) + +/* TPS650X30 registers */ +#define TPS650X30_REG_VENDORID 0x00 +#define TPS650X30_REG_PBCONFIG 0x14 +#define TPS650X30_REG_PGMASK1 0x18 +#define TPS650X30_REG_VCCIOCNT 0x30 +#define TPS650X30_REG_V5ADS3CNT 0x31 +#define TPS650X30_REG_V33ADSWCNT 0x32 +#define TPS650X30_REG_V18ACNT 0x34 +#define TPS650X30_REG_V1P2UCNT 0x36 +#define TPS650X30_REG_VRMODECTRL 0x3B +#define TPS650X30_REG_DISCHCNT1 0x3C +#define TPS650X30_REG_DISCHCNT2 0x3D +#define TPS650X30_REG_DISCHCNT3 0x3E +#define TPS650X30_REG_DISCHCNT4 0x3F +#define TPS650X30_REG_PWFAULT_MASK1 0xE5 + +/* TPS650X30 register values */ +#define TPS650X30_VENDOR_ID 0x22 + +#endif /* __CROS_EC_PMIC_TPS650X30_H */