summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-07-16 15:10:11 -0600
committerCommit Bot <commit-bot@chromium.org>2019-07-20 23:09:18 +0000
commit473bd883b60fd5b00377766dae2bacad246de0d2 (patch)
tree992d9f03104277934c22c869eceb634e2cf5f7ec /include
parent053491b560d2c4e374bb739373d8ae25c41f6315 (diff)
downloadchrome-ec-473bd883b60fd5b00377766dae2bacad246de0d2.tar.gz
Remove __7b, __8b and __7bf
The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/battery_smart.h4
-rw-r--r--include/charge_state_v2.h2
-rw-r--r--include/config.h18
-rw-r--r--include/ec_commands.h10
-rw-r--r--include/i2c.h106
-rw-r--r--include/motion_sense.h12
-rw-r--r--include/test_util.h10
-rw-r--r--include/usb_i2c.h2
-rw-r--r--include/usb_mux.h10
-rw-r--r--include/usb_pd_tcpc.h4
-rw-r--r--include/usbc_ppc.h2
-rw-r--r--include/virtual_battery.h2
12 files changed, 83 insertions, 99 deletions
diff --git a/include/battery_smart.h b/include/battery_smart.h
index 84b80fd162..1c088a5e27 100644
--- a/include/battery_smart.h
+++ b/include/battery_smart.h
@@ -11,8 +11,8 @@
#include "common.h"
/* Smart battery and charger I2C address */
-#define BATTERY_ADDR__7bf (0x0B)
-#define CHARGER_ADDR__7bf (0x09)
+#define BATTERY_ADDR_FLAGS 0x0B
+#define CHARGER_ADDR_FLAGS 0x09
/* Charger functions */
#define SB_CHARGER_SPEC_INFO 0x11
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h
index 1a7f698cc4..c958c0ed7c 100644
--- a/include/charge_state_v2.h
+++ b/include/charge_state_v2.h
@@ -14,7 +14,7 @@
#define __CROS_EC_CHARGE_STATE_V2_H
#if defined(CONFIG_I2C_VIRTUAL_BATTERY) && defined(CONFIG_BATTERY_SMART)
-#define VIRTUAL_BATTERY_ADDR__7bf BATTERY_ADDR__7bf
+#define VIRTUAL_BATTERY_ADDR_FLAGS BATTERY_ADDR_FLAGS
#endif
/*
* The values exported by charge_get_state() and charge_get_flags() are used
diff --git a/include/config.h b/include/config.h
index 95258abd54..14670e0be6 100644
--- a/include/config.h
+++ b/include/config.h
@@ -139,7 +139,7 @@
#undef CONFIG_KX022_ORIENTATION_SENSOR
/* Define the i2c address of the sensor behind the main sensor, if present. */
-#undef CONFIG_ACCELGYRO_SEC_ADDR__7BF
+#undef CONFIG_ACCELGYRO_SEC_ADDR_FLAGS
/*
* Define if either CONFIG_BMI160_ORIENTATION_SUPPORT or
@@ -601,7 +601,7 @@
#undef CONFIG_BOARD_VERSION_GPIO
/* EC responses to a board defined I2C slave address */
-#undef CONFIG_BOARD_I2C_SLAVE_ADDR__7BF
+#undef CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS
/*
* The board is unable to distinguish EC reset from power-on so it should treat
@@ -2030,7 +2030,7 @@
* For ECs where the host command interface is I2C, slave
* address which the EC will respond to.
*/
-#undef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#undef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
/*
* Accept EC host commands over the SPI slave (SPS) interface.
@@ -2199,7 +2199,7 @@
* transaction is done, the pin is set back to low.
*/
#undef CONFIG_I2C_SCL_GATE_PORT
-#undef CONFIG_I2C_SCL_GATE_ADDR__7BF
+#undef CONFIG_I2C_SCL_GATE_ADDR_FLAGS
#undef CONFIG_I2C_SCL_GATE_GPIO
/*
@@ -3413,7 +3413,7 @@
/* Set I2C port and address (7-bit) */
#undef CONFIG_TOUCHPAD_I2C_PORT
-#undef CONFIG_TOUCHPAD_I2C_ADDR__7BF
+#undef CONFIG_TOUCHPAD_I2C_ADDR_FLAGS
/*
* Enable touchpad FW update over USB update protocol, and define touchpad
@@ -3624,7 +3624,7 @@
#undef CONFIG_USB_PD_IDENTITY_SW_VERS
/* USB PD MCU slave address for host commands */
-#define CONFIG_USB_PD_I2C_SLAVE_ADDR__7BF 0x1E
+#define CONFIG_USB_PD_I2C_SLAVE_ADDR_FLAGS 0x1E
/* Define if using internal comparator for PD receive */
#undef CONFIG_USB_PD_INTERNAL_COMP
@@ -3736,7 +3736,7 @@
#undef CONFIG_USB_PD_VBUS_MEASURE_NOT_PRESENT
/* Define the type-c port controller I2C base address. */
-#define CONFIG_TCPC_I2C_BASE_ADDR__7BF 0x4E
+#define CONFIG_TCPC_I2C_BASE_ADDR_FLAGS 0x4E
/* Use this option to enable Try.SRC mode for Dual Role devices */
#undef CONFIG_USB_PD_TRY_SRC
@@ -4713,7 +4713,7 @@
#if defined(CONFIG_MAG_BMI160_LIS2MDL) || \
defined(CONFIG_MAG_LSM6DSM_LIS2MDL)
#define CONFIG_MAG_LIS2MDL
-#ifndef CONFIG_ACCELGYRO_SEC_ADDR__7BF
+#ifndef CONFIG_ACCELGYRO_SEC_ADDR_FLAGS
#error "The i2c address of the magnetometer is not set."
#endif
#endif
@@ -4722,7 +4722,7 @@
#if defined(CONFIG_MAG_BMI160_BMM150) || \
defined(CONFIG_MAG_LSM6DSM_BMM150)
#define CONFIG_MAG_BMM150
-#ifndef CONFIG_ACCELGYRO_SEC_ADDR__7BF
+#ifndef CONFIG_ACCELGYRO_SEC_ADDR_FLAGS
#error "The i2c address of the magnetometer is not set."
#endif
#endif
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 0861b3c34e..3c0810504f 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -4008,10 +4008,7 @@ struct ec_response_power_info {
#define EC_I2C_STATUS_ERROR (EC_I2C_STATUS_NAK | EC_I2C_STATUS_TIMEOUT)
struct ec_params_i2c_passthru_msg {
- union {
- uint16_t addr_flags; /* I2C slave address and flags */
- uint16_t addr_flags__7bf; /* remove before final merge */
- };
+ uint16_t addr_flags; /* I2C slave address and flags */
uint16_t len; /* Number of bytes to read or write */
} __ec_align2;
@@ -5411,10 +5408,7 @@ enum ec_bus_type {
struct ec_i2c_info {
uint16_t port; /* Physical port for device */
- union {
- uint16_t addr_flags; /* 7-bit (or 10-bit) address */
- uint16_t addr__7bf; /* remove before final merge */
- };
+ uint16_t addr_flags; /* 7-bit (or 10-bit) address */
};
struct ec_params_locate_chip {
diff --git a/include/i2c.h b/include/i2c.h
index 1281b8280d..ccb65fc7a0 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -27,7 +27,7 @@
* Some of the drivers use an 8bit left shifted 7bit address. Since
* this is driver specific, it will be up to the driver to make this
* clear. I suggest, since this is a very small amount of usage, that
- * ending the variable as "addr__8bit" would make this clear.
+ * ending the variable as "addr_8bit" would make this clear.
*
* NOTE: Slave addresses are always 16 bit values. The least significant
* 10 bits are available as an address. More significant bits are
@@ -39,9 +39,8 @@
/* BIT(15) SPI_FLAG - used in motion_sense to overload address */
#define I2C_FLAG_ADDR_IS_SPI BIT(15)
-#define I2C_GET_ADDR(x) (I2C_GET_ADDR__7b(x))
-#define I2C_GET_ADDR__7b(x__7bf) ((x__7bf) & I2C_ADDR_MASK)
-#define I2C_IS_BIG_ENDIAN(x__7bf) ((x__7bf) & I2C_FLAG_BIG_ENDIAN)
+#define I2C_GET_ADDR(addr_flags) ((addr_flags) & I2C_ADDR_MASK)
+#define I2C_IS_BIG_ENDIAN(addr_flags) ((addr_flags) & I2C_FLAG_BIG_ENDIAN)
/*
* Max data size for a version 3 request/response packet. This is
@@ -62,16 +61,7 @@ enum i2c_freq {
struct i2c_info_t {
uint16_t port; /* Physical port for device */
-
- /*
- * union is temporary to accommodate ec_tools
- * and will be reduced to the non-__7bf version
- * before the final merge
- */
- union {
- uint16_t addr_flags;
- uint16_t addr__7bf;
- };
+ uint16_t addr_flags;
};
/* Data structure to define I2C port configuration. */
@@ -83,8 +73,8 @@ struct i2c_port_t {
enum gpio_signal sda; /* Port SDA GPIO line */
/* When bus is protected, returns true if passthru allowed for address.
* If the function is not defined, the default value is true. */
- int (*passthru_allowed__7bf)(const struct i2c_port_t *port,
- uint16_t addr__7bf);
+ int (*passthru_allowed)(const struct i2c_port_t *port,
+ uint16_t addr_flags);
};
extern const struct i2c_port_t i2c_ports[];
@@ -108,11 +98,11 @@ struct i2c_test_results {
struct i2c_stress_test_dev {
struct i2c_test_reg_info reg_info;
struct i2c_test_results test_results;
- int (*i2c_read__7bf)(const int port,
- const uint16_t slave_addr__7bf,
+ int (*i2c_read)(const int port,
+ const uint16_t slave_addr_flags,
const int reg, int *data);
- int (*i2c_write__7bf)(const int port,
- const uint16_t slave_addr__7bf,
+ int (*i2c_write)(const int port,
+ const uint16_t slave_addr_flags,
const int reg, int data);
int (*i2c_read_dev)(const int reg, int *data);
int (*i2c_write_dev)(const int reg, int data);
@@ -120,7 +110,7 @@ struct i2c_stress_test_dev {
struct i2c_stress_test {
int port;
- uint16_t addr__7bf;
+ uint16_t addr_flags;
struct i2c_stress_test_dev *i2c_test;
};
@@ -147,8 +137,8 @@ extern const int i2c_test_dev_used;
* @param in_size Number of bytes to receive
* @return EC_SUCCESS, or non-zero if error.
*/
-int i2c_xfer__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_xfer(const int port,
+ const uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size);
@@ -158,8 +148,8 @@ int i2c_xfer__7bf(const int port,
*
* @param flags Flags (see I2C_XFER_* above)
*/
-int i2c_xfer_unlocked__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_xfer_unlocked(const int port,
+ const uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags);
@@ -183,8 +173,8 @@ int i2c_xfer_unlocked__7bf(const int port,
* @param flags Flags (see I2C_XFER_* above)
* @return EC_SUCCESS, or non-zero if error.
*/
-int chip_i2c_xfer__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int chip_i2c_xfer(const int port,
+ const uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags);
@@ -282,80 +272,80 @@ void i2c_set_timeout(int port, uint32_t timeout);
* Read a 32-bit register from the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_read32__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read32(const int port,
+ const uint16_t slave_addr_flags,
int offset, int *data);
/**
* Write a 32-bit register to the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_write32__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write32(const int port,
+ const uint16_t slave_addr_flags,
int offset, int data);
/**
* Read a 16-bit register from the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_read16__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read16(const int port,
+ const uint16_t slave_addr_flags,
int offset, int *data);
/**
* Write a 16-bit register to the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_write16__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write16(const int port,
+ const uint16_t slave_addr_flags,
int offset, int data);
/**
* Read an 8-bit register from the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_read8__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read8(const int port,
+ const uint16_t slave_addr_flags,
int offset, int *data);
/**
* Write an 8-bit register to the slave at 7-bit slave address <slaveaddr>, at
* the specified 8-bit <offset> in the slave's address space.
*/
-int i2c_write8__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write8(const int port,
+ const uint16_t slave_addr_flags,
int offset, int data);
/**
* Read one or two bytes data from the slave at 7-bit slave address
* * <slaveaddr>, at 16-bit <offset> in the slave's address space.
*/
-int i2c_read_offset16__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read_offset16(const int port,
+ const uint16_t slave_addr_flags,
uint16_t offset, int *data, int len);
/**
* Write one or two bytes data to the slave at 7-bit slave address
* <slaveaddr>, at 16-bit <offset> in the slave's address space.
*/
-int i2c_write_offset16__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write_offset16(const int port,
+ const uint16_t slave_addr_flags,
uint16_t offset, int data, int len);
/**
* Read <len> bytes block data from the slave at 7-bit slave address
* * <slaveaddr>, at 16-bit <offset> in the slave's address space.
*/
-int i2c_read_offset16_block__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read_offset16_block(const int port,
+ const uint16_t slave_addr_flags,
uint16_t offset, uint8_t *data, int len);
/**
* Write <len> bytes block data to the slave at 7-bit slave address
* <slaveaddr>, at 16-bit <offset> in the slave's address space.
*/
-int i2c_write_offset16_block__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write_offset16_block(const int port,
+ const uint16_t slave_addr_flags,
uint16_t offset, const uint8_t *data, int len);
/**
@@ -383,8 +373,8 @@ int i2c_unwedge(int port);
* always written into the output buffer.
* <len> == 0 : buffer size > 255
*/
-int i2c_read_string__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read_string(const int port,
+ const uint16_t slave_addr_flags,
int offset, uint8_t *data, int len);
/**
@@ -392,8 +382,8 @@ int i2c_read_string__7bf(const int port,
* address <slaveaddr>, at the specified 8-bit <offset> in the slave's address
* space.
*/
-int i2c_read_block__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_read_block(const int port,
+ const uint16_t slave_addr_flags,
int offset, uint8_t *data, int len);
/**
@@ -401,8 +391,8 @@ int i2c_read_block__7bf(const int port,
* address <slaveaddr>, at the specified 8-bit <offset> in the slave's address
* space.
*/
-int i2c_write_block__7bf(const int port,
- const uint16_t slave_addr__7bf,
+int i2c_write_block(const int port,
+ const uint16_t slave_addr_flags,
int offset, const uint8_t *data, int len);
/**
@@ -476,8 +466,8 @@ int board_is_i2c_port_powered(int port);
* @param slave_addr: Slave device address
*
*/
-void i2c_start_xfer_notify__7bf(const int port,
- const uint16_t slave_addr__7bf);
+void i2c_start_xfer_notify(const int port,
+ const uint16_t slave_addr_flags);
/**
* Function to allow board to take any action after an i2c transaction on a
@@ -488,8 +478,8 @@ void i2c_start_xfer_notify__7bf(const int port,
* @param slave_addr: Slave device address
*
*/
-void i2c_end_xfer_notify__7bf(const int port,
- const uint16_t slave_addr__7bf);
+void i2c_end_xfer_notify(const int port,
+ const uint16_t slave_addr_flags);
/**
* Defined in common/i2c_trace.c, used by i2c master to notify tracing
@@ -502,7 +492,7 @@ void i2c_end_xfer_notify__7bf(const int port,
* @param data: pointer to data read or written
* @param size: size of data read or written
*/
-void i2c_trace_notify__7bf(int port, uint16_t slave_addr__7bf,
+void i2c_trace_notify(int port, uint16_t slave_addr_flags,
int direction, const uint8_t *data, size_t size);
#endif /* __CROS_EC_I2C_H */
diff --git a/include/motion_sense.h b/include/motion_sense.h
index 0e9f79e422..f6abf8949c 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -91,13 +91,13 @@ enum sensor_config {
* use slave addressing, it is up to the driver to use this
* field as it sees fit
*/
-#define SLAVE_MK_I2C_ADDR__7bf(x__7b) (x__7b)
-#define SLAVE_MK_SPI_ADDR__7bf(x__7b) ((x__7b) | I2C_FLAG_ADDR_IS_SPI)
+#define SLAVE_MK_I2C_ADDR_FLAGS(addr) (addr)
+#define SLAVE_MK_SPI_ADDR_FLAGS(addr) ((addr) | I2C_FLAG_ADDR_IS_SPI)
-#define SLAVE_GET_I2C_ADDR__7b(x__7bf) (I2C_GET_ADDR__7b(x__7bf))
-#define SLAVE_GET_SPI_ADDR__7b(x__7bf) ((x__7bf) & I2C_ADDR_MASK)
+#define SLAVE_GET_I2C_ADDR(addr_flags) (I2C_GET_ADDR(addr_flags))
+#define SLAVE_GET_SPI_ADDR(addr_flags) ((addr_flags) & I2C_ADDR_MASK)
-#define SLAVE_IS_SPI(x__7bf) ((x__7bf) & I2C_FLAG_ADDR_IS_SPI)
+#define SLAVE_IS_SPI(addr_flags) ((addr_flags) & I2C_FLAG_ADDR_IS_SPI)
/*
* Define the frequency to use in max_frequency based on the maximal frequency
@@ -150,7 +150,7 @@ struct motion_sensor_t {
/* i2c port */
uint8_t port;
/* i2c address or SPI slave logic GPIO. */
- uint16_t i2c_spi_addr__7bf;
+ uint16_t i2c_spi_addr_flags;
/*
* Various flags, see MOTIONSENSE_FLAG_*
diff --git a/include/test_util.h b/include/test_util.h
index a812817b8f..7ee2fed284 100644
--- a/include/test_util.h
+++ b/include/test_util.h
@@ -218,20 +218,20 @@ void test_reboot_to_next_step(enum test_state_t step);
struct test_i2c_read_string_dev {
/* I2C string read handler */
- int (*routine__7bf)(const int port, const uint16_t i2c_addr__7bf,
+ int (*routine)(const int port, const uint16_t i2c_addr_flags,
int offset, uint8_t *data, int len);
};
struct test_i2c_xfer {
/* I2C xfer handler */
- int (*routine__7bf)(const int port, const uint16_t i2c_addr__7bf,
+ int (*routine)(const int port, const uint16_t i2c_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags);
};
struct test_i2c_write_dev {
/* I2C write handler */
- int (*routine__7bf)(const int port, const uint16_t i2c_addr__7bf,
+ int (*routine)(const int port, const uint16_t i2c_addr_flags,
int offset, int data);
};
@@ -259,7 +259,7 @@ struct test_i2c_write_dev {
* @return EC_SUCCESS if detached; EC_ERROR_OVERFLOW if too many devices are
* detached.
*/
-int test_detach_i2c__7bf(const int port, const uint16_t slave_addr__7bf);
+int test_detach_i2c(const int port, const uint16_t slave_addr_flags);
/*
* Re-attach an I2C device.
@@ -269,6 +269,6 @@ int test_detach_i2c__7bf(const int port, const uint16_t slave_addr__7bf);
* @return EC_SUCCESS if re-attached; EC_ERROR_INVAL if the specified device
* is not a detached device.
*/
-int test_attach_i2c__7bf(const int port, const uint16_t slave_addr__7bf);
+int test_attach_i2c(const int port, const uint16_t slave_addr_flags);
#endif /* __CROS_EC_TEST_UTIL_H */
diff --git a/include/usb_i2c.h b/include/usb_i2c.h
index 629f495b69..5719ee4333 100644
--- a/include/usb_i2c.h
+++ b/include/usb_i2c.h
@@ -218,7 +218,7 @@ int usb_i2c_board_is_enabled(void);
* Special i2c address to use when the client is required to execute some
* command which does not directly involve the i2c master driver.
*/
-#define USB_I2C_CMD_ADDR__7bf 0x78
+#define USB_I2C_CMD_ADDR_FLAGS 0x78
/*
* Function to call to register a handler for commands sent to the special i2c
diff --git a/include/usb_mux.h b/include/usb_mux.h
index 94e2d6dbac..8351bdfe28 100644
--- a/include/usb_mux.h
+++ b/include/usb_mux.h
@@ -27,7 +27,7 @@ typedef uint8_t mux_state_t;
*/
#define MUX_PORT_AND_ADDR(port, addr) ((port << 8) | (addr & 0xFF))
#define MUX_PORT(port) (usb_muxes[port].port_addr >> 8)
-#define MUX_ADDR__7bf(port) (usb_muxes[port].port_addr & 0xFF)
+#define MUX_ADDR(port) (usb_muxes[port].port_addr & 0xFF)
/* Mux state attributes */
/* TODO: Directly use USB_PD_MUX_* everywhere and remove these 3 defines */
@@ -143,21 +143,21 @@ extern struct usb_mux usb_muxes[];
static inline int mux_write(int port, int reg, int val)
{
return usb_muxes[port].flags & USB_MUX_FLAG_NOT_TCPC
- ? i2c_write8__7bf(MUX_PORT(port), MUX_ADDR__7bf(port), reg, val)
+ ? i2c_write8(MUX_PORT(port), MUX_ADDR(port), reg, val)
: tcpc_write(port, reg, val);
}
static inline int mux_read(int port, int reg, int *val)
{
return usb_muxes[port].flags & USB_MUX_FLAG_NOT_TCPC
- ? i2c_read8__7bf(MUX_PORT(port), MUX_ADDR__7bf(port), reg, val)
+ ? i2c_read8(MUX_PORT(port), MUX_ADDR(port), reg, val)
: tcpc_read(port, reg, val);
}
static inline int mux_write16(int port, int reg, int val)
{
return usb_muxes[port].flags & USB_MUX_FLAG_NOT_TCPC
- ? i2c_write16__7bf(MUX_PORT(port), MUX_ADDR__7bf(port),
+ ? i2c_write16(MUX_PORT(port), MUX_ADDR(port),
reg, val)
: tcpc_write16(port, reg, val);
}
@@ -165,7 +165,7 @@ static inline int mux_write16(int port, int reg, int val)
static inline int mux_read16(int port, int reg, int *val)
{
return usb_muxes[port].flags & USB_MUX_FLAG_NOT_TCPC
- ? i2c_read16__7bf(MUX_PORT(port), MUX_ADDR__7bf(port),
+ ? i2c_read16(MUX_PORT(port), MUX_ADDR(port),
reg, val)
: tcpc_read16(port, reg, val);
}
diff --git a/include/usb_pd_tcpc.h b/include/usb_pd_tcpc.h
index ba911f00ad..04426315f9 100644
--- a/include/usb_pd_tcpc.h
+++ b/include/usb_pd_tcpc.h
@@ -19,10 +19,10 @@
#ifdef TCPCI_I2C_SLAVE
/* Convert TCPC address to type-C port number */
#define TCPC_ADDR_TO_PORT(addr) ((addr) \
- - I2C_GET_ADDR__7b(CONFIG_TCPC_I2C_BASE_ADDR__7BF))
+ - I2C_GET_ADDR(CONFIG_TCPC_I2C_BASE_ADDR_FLAGS))
/* Check if the i2c address belongs to TCPC */
#define ADDR_IS_TCPC(addr) (((addr) & 0x7E) \
- == I2C_GET_ADDR__7b(CONFIG_TCPC_I2C_BASE_ADDR__7BF))
+ == I2C_GET_ADDR(CONFIG_TCPC_I2C_BASE_ADDR_FLAGS))
#endif
/**
diff --git a/include/usbc_ppc.h b/include/usbc_ppc.h
index 3e74f37956..d553c2a767 100644
--- a/include/usbc_ppc.h
+++ b/include/usbc_ppc.h
@@ -141,7 +141,7 @@ struct ppc_drv {
struct ppc_config_t {
int i2c_port;
- uint16_t i2c_addr__7bf;
+ uint16_t i2c_addr_flags;
const struct ppc_drv *drv;
};
diff --git a/include/virtual_battery.h b/include/virtual_battery.h
index 99fb30e03b..4e7ca31d05 100644
--- a/include/virtual_battery.h
+++ b/include/virtual_battery.h
@@ -7,7 +7,7 @@
#define __CROS_EC_VIRTUAL_BATTERY_H
#if defined(CONFIG_I2C_VIRTUAL_BATTERY) && defined(CONFIG_BATTERY_SMART)
-#define VIRTUAL_BATTERY_ADDR__7bf BATTERY_ADDR__7bf
+#define VIRTUAL_BATTERY_ADDR_FLAGS BATTERY_ADDR_FLAGS
#endif
/**