summaryrefslogtreecommitdiff
path: root/driver/ppc/sn5s330.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver/ppc/sn5s330.c')
-rw-r--r--driver/ppc/sn5s330.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c
index 13834a8bf3..85db762148 100644
--- a/driver/ppc/sn5s330.c
+++ b/driver/ppc/sn5s330.c
@@ -31,16 +31,16 @@ static int source_enabled[CONFIG_USB_PD_PORT_COUNT];
static int read_reg(uint8_t port, int reg, int *regval)
{
- return i2c_read8__7bf(ppc_chips[port].i2c_port,
- ppc_chips[port].i2c_addr__7bf,
+ return i2c_read8(ppc_chips[port].i2c_port,
+ ppc_chips[port].i2c_addr_flags,
reg,
regval);
}
static int write_reg(uint8_t port, int reg, int regval)
{
- return i2c_write8__7bf(ppc_chips[port].i2c_port,
- ppc_chips[port].i2c_addr__7bf,
+ return i2c_write8(ppc_chips[port].i2c_port,
+ ppc_chips[port].i2c_addr_flags,
reg,
regval);
}
@@ -78,12 +78,12 @@ static int sn5s330_dump(int port)
int i;
int data;
const int i2c_port = ppc_chips[port].i2c_port;
- const uint16_t i2c_addr__7bf = ppc_chips[port].i2c_addr__7bf;
+ const uint16_t i2c_addr_flags = ppc_chips[port].i2c_addr_flags;
/* Flush after every set otherwise console buffer may get full. */
for (i = SN5S330_FUNC_SET1; i <= SN5S330_FUNC_SET12; i++) {
- i2c_read8__7bf(i2c_port, i2c_addr__7bf, i, &data);
+ i2c_read8(i2c_port, i2c_addr_flags, i, &data);
ccprintf("FUNC_SET%d [%02Xh] = 0x%02x\n",
i - SN5S330_FUNC_SET1 + 1,
i,
@@ -93,7 +93,7 @@ static int sn5s330_dump(int port)
cflush();
for (i = SN5S330_INT_STATUS_REG1; i <= SN5S330_INT_STATUS_REG4; i++) {
- i2c_read8__7bf(i2c_port, i2c_addr__7bf, i, &data);
+ i2c_read8(i2c_port, i2c_addr_flags, i, &data);
ccprintf("INT_STATUS_REG%d [%02Xh] = 0x%02x\n",
i - SN5S330_INT_STATUS_REG1 + 1,
i,
@@ -104,7 +104,7 @@ static int sn5s330_dump(int port)
for (i = SN5S330_INT_TRIP_RISE_REG1; i <= SN5S330_INT_TRIP_RISE_REG3;
i++) {
- i2c_read8__7bf(i2c_port, i2c_addr__7bf, i, &data);
+ i2c_read8(i2c_port, i2c_addr_flags, i, &data);
ccprintf("INT_TRIP_RISE_REG%d [%02Xh] = 0x%02x\n",
i - SN5S330_INT_TRIP_RISE_REG1 + 1,
i,
@@ -115,7 +115,7 @@ static int sn5s330_dump(int port)
for (i = SN5S330_INT_TRIP_FALL_REG1; i <= SN5S330_INT_TRIP_FALL_REG3;
i++) {
- i2c_read8__7bf(i2c_port, i2c_addr__7bf, i, &data);
+ i2c_read8(i2c_port, i2c_addr_flags, i, &data);
ccprintf("INT_TRIP_FALL_REG%d [%02Xh] = 0x%02x\n",
i - SN5S330_INT_TRIP_FALL_REG1 + 1,
i,
@@ -126,7 +126,7 @@ static int sn5s330_dump(int port)
for (i = SN5S330_INT_MASK_RISE_REG1; i <= SN5S330_INT_MASK_RISE_REG3;
i++) {
- i2c_read8__7bf(i2c_port, i2c_addr__7bf, i, &data);
+ i2c_read8(i2c_port, i2c_addr_flags, i, &data);
ccprintf("INT_MASK_RISE_REG%d [%02Xh] = 0x%02x\n",
i - SN5S330_INT_MASK_RISE_REG1 + 1,
i,
@@ -137,7 +137,7 @@ static int sn5s330_dump(int port)
for (i = SN5S330_INT_MASK_FALL_REG1; i <= SN5S330_INT_MASK_FALL_REG3;
i++) {
- i2c_read8__7bf(i2c_port, i2c_addr__7bf, i, &data);
+ i2c_read8(i2c_port, i2c_addr_flags, i, &data);
ccprintf("INT_MASK_FALL_REG%d [%02Xh] = 0x%02x\n",
i - SN5S330_INT_MASK_FALL_REG1 + 1,
i,
@@ -184,7 +184,7 @@ static int sn5s330_init(int port)
int retries;
int reg;
const int i2c_port = ppc_chips[port].i2c_port;
- const uint16_t i2c_addr__7bf = ppc_chips[port].i2c_addr__7bf;
+ const uint16_t i2c_addr_flags = ppc_chips[port].i2c_addr_flags;
#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
/* Set the sourcing current limit value. */
@@ -211,7 +211,7 @@ static int sn5s330_init(int port)
*/
retries = 0;
do {
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET1, regval);
if (status) {
CPRINTS("ppc p%d: Failed to set FUNC_SET1! Retrying..",
@@ -225,7 +225,7 @@ static int sn5s330_init(int port)
/* Set Vbus OVP threshold to ~22.325V. */
regval = 0x37;
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET5, regval);
if (status) {
CPRINTS("ppc p%d: Failed to set FUNC_SET5!", port);
@@ -233,7 +233,7 @@ static int sn5s330_init(int port)
}
/* Set Vbus UVP threshold to ~2.75V. */
- status = i2c_read8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_read8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET6, &regval);
if (status) {
CPRINTS("ppc p%d: Failed to read FUNC_SET6!", port);
@@ -241,7 +241,7 @@ static int sn5s330_init(int port)
}
regval &= ~0x3F;
regval |= 1;
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET6, regval);
if (status) {
CPRINTS("ppc p%d: Failed to write FUNC_SET6!", port);
@@ -250,7 +250,7 @@ static int sn5s330_init(int port)
/* Enable SBU Fets and set PP2 current limit to ~3A. */
regval = SN5S330_SBU_EN | 0x8;
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET2, regval);
if (status) {
CPRINTS("ppc p%d: Failed to set FUNC_SET2!", port);
@@ -270,7 +270,7 @@ static int sn5s330_init(int port)
* low voltage protection).
*/
regval = SN5S330_OVP_EN_CC | SN5S330_PP2_CONFIG | SN5S330_CONFIG_UVP;
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET9, regval);
if (status) {
CPRINTS("ppc p%d: Failed to set FUNC_SET9!", port);
@@ -279,7 +279,7 @@ static int sn5s330_init(int port)
/* Set analog current limit delay to 200 us for both PP1 & PP2. */
regval = (PPX_ILIM_DEGLITCH_0_US_200 << 3) | PPX_ILIM_DEGLITCH_0_US_200;
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET11, regval);
if (status) {
CPRINTS("ppc p%d: Failed to set FUNC_SET11", port);
@@ -293,7 +293,7 @@ static int sn5s330_init(int port)
* reset default (20 us).
*/
regval = 0;
- status = i2c_read8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_read8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET8, &regval);
if (status) {
CPRINTS("ppc p%d: Failed to read FUNC_SET8!", port);
@@ -301,7 +301,7 @@ static int sn5s330_init(int port)
}
regval &= ~SN5S330_VCONN_DEGLITCH_MASK;
regval |= SN5S330_VCONN_DEGLITCH_640_US;
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_FUNC_SET8, regval);
if (status) {
CPRINTS("ppc p%d: Failed to set FUNC_SET8!", port);
@@ -354,7 +354,7 @@ static int sn5s330_init(int port)
* is checked below.
*/
regval = SN5S330_DIG_RES | SN5S330_VSAFE0V_MASK;
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_INT_STATUS_REG4, regval);
if (status) {
CPRINTS("ppc p%d: Failed to write INT_STATUS_REG4!", port);
@@ -372,14 +372,14 @@ static int sn5s330_init(int port)
*/
regval = ~SN5S330_ILIM_PP1_MASK;
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_INT_MASK_RISE_REG1, regval);
if (status) {
CPRINTS("ppc p%d: Failed to write INT_MASK_RISE1!", port);
return status;
}
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_INT_MASK_FALL_REG1, regval);
if (status) {
CPRINTS("ppc p%d: Failed to write INT_MASK_FALL1!", port);
@@ -387,14 +387,14 @@ static int sn5s330_init(int port)
}
/* Now mask all the other interrupts. */
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_INT_MASK_RISE_REG2, 0xFF);
if (status) {
CPRINTS("ppc p%d: Failed to write INT_MASK_RISE2!", port);
return status;
}
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_INT_MASK_FALL_REG2, 0xFF);
if (status) {
CPRINTS("ppc p%d: Failed to write INT_MASK_FALL2!", port);
@@ -408,14 +408,14 @@ static int sn5s330_init(int port)
regval = 0xFF;
#endif /* CONFIG_USB_PD_VBUS_DETECT_PPC && CONFIG_USB_CHARGER */
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_INT_MASK_RISE_REG3, regval);
if (status) {
CPRINTS("ppc p%d: Failed to write INT_MASK_RISE3!", port);
return status;
}
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_INT_MASK_FALL_REG3, regval);
if (status) {
CPRINTS("ppc p%d: Failed to write INT_MASK_FALL3!", port);
@@ -426,7 +426,7 @@ static int sn5s330_init(int port)
for (reg = SN5S330_INT_TRIP_RISE_REG1;
reg <= SN5S330_INT_TRIP_FALL_REG3;
reg++) {
- status = i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_write8(i2c_port, i2c_addr_flags,
reg, 0xFF);
if (status) {
CPRINTS("ppc p%d: Failed to write reg 0x%2x!", port);
@@ -439,7 +439,7 @@ static int sn5s330_init(int port)
* For PP2, check to see if we booted in dead battery mode. If we
* booted in dead battery mode, the PP2 FET will already be enabled.
*/
- status = i2c_read8__7bf(i2c_port, i2c_addr__7bf,
+ status = i2c_read8(i2c_port, i2c_addr_flags,
SN5S330_INT_STATUS_REG4, &regval);
if (status) {
CPRINTS("ppc p%d: Failed to read INT_STATUS_REG4!", port);
@@ -451,7 +451,7 @@ static int sn5s330_init(int port)
* Clear the bit by writing 1 and keep vSafe0V_MASK
* unchanged.
*/
- i2c_write8__7bf(i2c_port, i2c_addr__7bf,
+ i2c_write8(i2c_port, i2c_addr_flags,
SN5S330_INT_STATUS_REG4, regval);
/* Turn on PP2 FET. */