summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baseboard/dragonegg/baseboard.c8
-rw-r--r--baseboard/dragonegg/baseboard.h2
-rw-r--r--baseboard/grunt/baseboard.c14
-rw-r--r--baseboard/hatch/baseboard.c4
-rw-r--r--baseboard/hatch/baseboard.h2
-rw-r--r--baseboard/kalista/baseboard.c8
-rw-r--r--baseboard/kalista/baseboard.h4
-rw-r--r--baseboard/octopus/baseboard.h4
-rw-r--r--baseboard/octopus/variant_usbc_ec_tcpcs.c8
-rw-r--r--baseboard/octopus/variant_usbc_standalone_tcpcs.c10
-rw-r--r--baseboard/zork/baseboard.c14
-rw-r--r--board/ampton/board.c10
-rw-r--r--board/arcada_ish/board.c8
-rw-r--r--board/atlas/board.c48
-rw-r--r--board/atlas/board.h8
-rw-r--r--board/bloog/board.c6
-rw-r--r--board/bobba/board.c6
-rw-r--r--board/casta/board.c10
-rw-r--r--board/chell/board.c20
-rw-r--r--board/cheza/board.c12
-rw-r--r--board/cheza/board.h2
-rw-r--r--board/coral/board.c20
-rw-r--r--board/elm/board.c18
-rw-r--r--board/elm/board.h4
-rw-r--r--board/eve/board.c42
-rw-r--r--board/eve/board.h6
-rw-r--r--board/fizz/board.c8
-rw-r--r--board/fizz/board.h4
-rw-r--r--board/flapjack/battery.c4
-rw-r--r--board/flapjack/board.c14
-rw-r--r--board/flapjack/board.h4
-rw-r--r--board/fleex/board.c6
-rw-r--r--board/fluffy/board.c10
-rw-r--r--board/garg/board.c6
-rw-r--r--board/glados/battery.c4
-rw-r--r--board/glados/board.c14
-rw-r--r--board/glados/board.h2
-rw-r--r--board/glados_pd/board.h2
-rw-r--r--board/glkrvp/battery.c6
-rw-r--r--board/glkrvp/board.c16
-rw-r--r--board/glkrvp/chg_usb_pd.c4
-rw-r--r--board/glkrvp_ite/battery.c4
-rw-r--r--board/glkrvp_ite/board.c44
-rw-r--r--board/glkrvp_ite/board.h2
-rw-r--r--board/glkrvp_ite/chg_usb_pd.c4
-rw-r--r--board/hammer/board.h2
-rw-r--r--board/hatch/board.c16
-rw-r--r--board/helios/board.c16
-rw-r--r--board/helios/board.h2
-rw-r--r--board/host/battery.c6
-rw-r--r--board/kindred/board.c16
-rw-r--r--board/kindred/board.h2
-rw-r--r--board/kohaku/board.c14
-rw-r--r--board/kukui/board.c14
-rw-r--r--board/kukui/board.h4
-rw-r--r--board/mchpevb1/battery.c4
-rw-r--r--board/mchpevb1/board.c24
-rw-r--r--board/mchpevb1/board.h2
-rw-r--r--board/meep/board.c6
-rw-r--r--board/nami/board.c20
-rw-r--r--board/nami/board.h4
-rw-r--r--board/nautilus/board.c56
-rw-r--r--board/nautilus/board.h4
-rw-r--r--board/nocturne/board.c52
-rw-r--r--board/nocturne/board.h6
-rw-r--r--board/nucleo-f411re/board.c4
-rw-r--r--board/oak/battery.c4
-rw-r--r--board/oak/board.c10
-rw-r--r--board/oak/board.h2
-rw-r--r--board/pdeval-stm32f072/board.c2
-rw-r--r--board/phaser/board.c6
-rw-r--r--board/plankton/board.c20
-rw-r--r--board/poppy/board.c50
-rw-r--r--board/poppy/board.h8
-rw-r--r--board/rainier/board.c8
-rw-r--r--board/rammus/board.c44
-rw-r--r--board/rammus/board.h6
-rw-r--r--board/reef/board.c30
-rw-r--r--board/reef/board.h2
-rw-r--r--board/reef_mchp/board.c30
-rw-r--r--board/reef_mchp/board.h2
-rw-r--r--board/samus/battery.c4
-rw-r--r--board/samus/board.c62
-rw-r--r--board/samus/extpower.c6
-rw-r--r--board/samus/panel.c10
-rw-r--r--board/samus_pd/board.h2
-rw-r--r--board/scarlet/board.c6
-rw-r--r--board/scarlet/board.h2
-rw-r--r--board/servo_micro/board.c12
-rw-r--r--board/servo_v4/board.c18
-rw-r--r--board/strago/board.c6
-rw-r--r--board/sweetberry/board.c2
-rw-r--r--board/yorp/board.c6
-rw-r--r--chip/g/i2cm.c14
-rw-r--r--chip/host/i2c.c22
-rw-r--r--chip/ish/i2c.c14
-rw-r--r--chip/it83xx/i2c.c18
-rw-r--r--chip/lm4/i2c.c6
-rw-r--r--chip/mchp/i2c.c10
-rw-r--r--chip/mec1322/i2c.c8
-rw-r--r--chip/npcx/i2c.c16
-rw-r--r--chip/nrf51/i2c.c14
-rw-r--r--chip/stm32/i2c-stm32f0.c24
-rw-r--r--chip/stm32/i2c-stm32f4.c68
-rw-r--r--chip/stm32/i2c-stm32l.c14
-rw-r--r--chip/stm32/i2c-stm32l4.c16
-rw-r--r--chip/stm32/usb_power.c58
-rw-r--r--chip/stm32/usb_power.h4
-rw-r--r--common/cbi.c4
-rw-r--r--common/host_command_master.c12
-rw-r--r--common/i2c_master.c212
-rw-r--r--common/i2c_trace.c10
-rw-r--r--common/lb_common.c10
-rw-r--r--common/motion_sense.c4
-rw-r--r--common/peripheral.c6
-rw-r--r--common/usb_i2c.c14
-rw-r--r--cts/i2c/dut.c14
-rw-r--r--driver/accel_bma2x2.c38
-rw-r--r--driver/accel_bma2x2.h8
-rw-r--r--driver/accel_kionix.c76
-rw-r--r--driver/accel_kx022.h4
-rw-r--r--driver/accel_kxcj9.h4
-rw-r--r--driver/accel_lis2dh.c18
-rw-r--r--driver/accel_lis2dh.h12
-rw-r--r--driver/accelgyro_bmi160.c226
-rw-r--r--driver/accelgyro_bmi160.h21
-rw-r--r--driver/accelgyro_lsm6ds0.c32
-rw-r--r--driver/accelgyro_lsm6ds0.h4
-rw-r--r--driver/accelgyro_lsm6dsm.c50
-rw-r--r--driver/accelgyro_lsm6dsm.h4
-rw-r--r--driver/accelgyro_lsm6dso.c24
-rw-r--r--driver/accelgyro_lsm6dso.h4
-rw-r--r--driver/als_al3010.h6
-rw-r--r--driver/als_bh1730.c8
-rw-r--r--driver/als_bh1730.h2
-rw-r--r--driver/als_isl29035.c8
-rw-r--r--driver/als_opt3001.c33
-rw-r--r--driver/als_opt3001.h8
-rw-r--r--driver/als_si114x.c52
-rw-r--r--driver/als_si114x.h2
-rw-r--r--driver/als_tcs3400.c6
-rw-r--r--driver/als_tcs3400.h2
-rw-r--r--driver/baro_bmp280.c18
-rw-r--r--driver/baro_bmp280.h4
-rw-r--r--driver/battery/bq27541.c2
-rw-r--r--driver/battery/bq27621_g1.c2
-rw-r--r--driver/battery/max17055.c4
-rw-r--r--driver/battery/max17055.h2
-rw-r--r--driver/battery/mm8013.c4
-rw-r--r--driver/battery/mm8013.h2
-rw-r--r--driver/battery/smart.c8
-rw-r--r--driver/bc12/pi3usb9201.c8
-rw-r--r--driver/bc12/pi3usb9201.h10
-rw-r--r--driver/bc12/pi3usb9281.c6
-rw-r--r--driver/charger/bd9995x.c10
-rw-r--r--driver/charger/bd9995x.h4
-rw-r--r--driver/charger/bq24192.h2
-rw-r--r--driver/charger/bq24715.c4
-rw-r--r--driver/charger/bq24773.h16
-rw-r--r--driver/charger/bq25703.h2
-rw-r--r--driver/charger/bq25710.c4
-rw-r--r--driver/charger/bq25710.h2
-rw-r--r--driver/charger/bq2589x.h6
-rw-r--r--driver/charger/isl923x.c16
-rw-r--r--driver/charger/isl923x.h4
-rw-r--r--driver/charger/isl9241.h4
-rw-r--r--driver/charger/rt946x.c6
-rw-r--r--driver/charger/rt946x.h6
-rw-r--r--driver/charger/sy21612.c6
-rw-r--r--driver/charger/sy21612.h4
-rw-r--r--driver/gyro_l3gd20h.h4
-rw-r--r--driver/ina2xx.c6
-rw-r--r--driver/ioexpander_pca9534.c22
-rw-r--r--driver/ioexpander_pca9534.h6
-rw-r--r--driver/ioexpander_pca9555.h12
-rw-r--r--driver/led/lm3509.c4
-rw-r--r--driver/led/lm3509.h2
-rw-r--r--driver/led/lm3630a.c6
-rw-r--r--driver/led/lp5562.c6
-rw-r--r--driver/led/max695x.h4
-rw-r--r--driver/led/oz554.c6
-rw-r--r--driver/mag_bmm150.c34
-rw-r--r--driver/mag_bmm150.h8
-rw-r--r--driver/mag_lis2mdl.c24
-rw-r--r--driver/mag_lis2mdl.h2
-rw-r--r--driver/pmic_tps650x30.h6
-rw-r--r--driver/ppc/nx20p348x.c8
-rw-r--r--driver/ppc/nx20p348x.h18
-rw-r--r--driver/ppc/sn5s330.c62
-rw-r--r--driver/ppc/sn5s330.h10
-rw-r--r--driver/ppc/syv682x.c12
-rw-r--r--driver/ppc/syv682x.h8
-rw-r--r--driver/regulator_ir357x.c2
-rw-r--r--driver/sensorhub_lsm6dsm.c60
-rw-r--r--driver/sensorhub_lsm6dsm.h12
-rw-r--r--driver/stm_mems_common.c16
-rw-r--r--driver/stm_mems_common.h20
-rw-r--r--driver/tcpm/anx7447.c39
-rw-r--r--driver/tcpm/anx7447.h20
-rw-r--r--driver/tcpm/anx74xx.c4
-rw-r--r--driver/tcpm/anx74xx.h8
-rw-r--r--driver/tcpm/anx7688.c6
-rw-r--r--driver/tcpm/fusb302.h8
-rw-r--r--driver/tcpm/mt6370.c4
-rw-r--r--driver/tcpm/mt6370.h2
-rw-r--r--driver/tcpm/nct38xx.h18
-rw-r--r--driver/tcpm/ps8xxx.c4
-rw-r--r--driver/tcpm/ps8xxx.h8
-rw-r--r--driver/tcpm/tcpci.c28
-rw-r--r--driver/tcpm/tcpm.h36
-rw-r--r--driver/tcpm/tusb422.h2
-rw-r--r--driver/temp_sensor/adt7481.c4
-rw-r--r--driver/temp_sensor/adt7481.h2
-rw-r--r--driver/temp_sensor/bd99992gw.c4
-rw-r--r--driver/temp_sensor/bd99992gw.h2
-rw-r--r--driver/temp_sensor/f75303.c2
-rw-r--r--driver/temp_sensor/f75303.h2
-rw-r--r--driver/temp_sensor/g78x.c4
-rw-r--r--driver/temp_sensor/g78x.h2
-rw-r--r--driver/temp_sensor/sb_tsi.c2
-rw-r--r--driver/temp_sensor/sb_tsi.h2
-rw-r--r--driver/temp_sensor/tmp006.c40
-rw-r--r--driver/temp_sensor/tmp006.h10
-rw-r--r--driver/temp_sensor/tmp112.c4
-rw-r--r--driver/temp_sensor/tmp112.h2
-rw-r--r--driver/temp_sensor/tmp411.h2
-rw-r--r--driver/temp_sensor/tmp432.c4
-rw-r--r--driver/temp_sensor/tmp432.h2
-rw-r--r--driver/temp_sensor/tmp468.c4
-rw-r--r--driver/temp_sensor/tmp468.h2
-rw-r--r--driver/touchpad_elan.c24
-rw-r--r--driver/usb_mux/it5205.c4
-rw-r--r--driver/usb_mux/it5205.h4
-rw-r--r--driver/usb_mux/pi3usb30532.c6
-rw-r--r--driver/usb_mux/ps874x.c6
-rw-r--r--driver/wpc/p9221.c12
-rw-r--r--driver/wpc/p9221.h2
-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
-rw-r--r--test/battery_get_params_smart.c4
-rw-r--r--test/sbs_charging_v2.c4
251 files changed, 1693 insertions, 1718 deletions
diff --git a/baseboard/dragonegg/baseboard.c b/baseboard/dragonegg/baseboard.c
index e14013c756..ecd6ee5862 100644
--- a/baseboard/dragonegg/baseboard.c
+++ b/baseboard/dragonegg/baseboard.c
@@ -158,7 +158,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_USBC1C2,
- .addr__7bf = TUSB422_I2C_ADDR__7bf,
+ .addr_flags = TUSB422_I2C_ADDR_FLAGS,
},
.drv = &tusb422_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -171,19 +171,19 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ITE_0] = {
.i2c_port = I2C_PORT_USBC0,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
[USB_PD_PORT_ITE_1] = {
.i2c_port = I2C_PORT_USBC1C2,
- .i2c_addr__7bf = SYV682X_ADDR0__7bf,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
.drv = &syv682x_drv
},
[USB_PD_PORT_TUSB422_2] = {
.i2c_port = I2C_PORT_USBC1C2,
- .i2c_addr__7bf = NX20P3481_ADDR2__7bf,
+ .i2c_addr_flags = NX20P3481_ADDR2_FLAGS,
.drv = &nx20p348x_drv,
},
};
diff --git a/baseboard/dragonegg/baseboard.h b/baseboard/dragonegg/baseboard.h
index 4d02166703..38e459b2fd 100644
--- a/baseboard/dragonegg/baseboard.h
+++ b/baseboard/dragonegg/baseboard.h
@@ -133,7 +133,7 @@
#define I2C_PORT_USBC0 IT83XX_I2C_CH_E
#define I2C_PORT_USBC1C2 IT83XX_I2C_CH_C
#define I2C_PORT_EEPROM IT83XX_I2C_CH_A
-#define I2C_ADDR_EEPROM__7bf 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#ifndef __ASSEMBLER__
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c
index 592c821ca7..831fed4300 100644
--- a/baseboard/grunt/baseboard.c
+++ b/baseboard/grunt/baseboard.c
@@ -82,7 +82,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
},
.drv = &anx74xx_tcpm_drv,
/* Alert is active-low, open-drain */
@@ -92,7 +92,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -133,12 +133,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
struct ppc_config_t ppc_chips[] = {
{
.i2c_port = I2C_PORT_TCPC0,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
{
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
};
@@ -380,7 +380,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = (const mat33_fp_t *)&lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -408,7 +408,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 2, /* g, enough for laptop */
.rot_standard_ref = (const mat33_fp_t *)&grunt_base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -436,7 +436,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = (const mat33_fp_t *)&grunt_base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/baseboard/hatch/baseboard.c b/baseboard/hatch/baseboard.c
index b2aa3810ed..6410e1b456 100644
--- a/baseboard/hatch/baseboard.c
+++ b/baseboard/hatch/baseboard.c
@@ -119,13 +119,13 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, baseboard_chipset_shutdown,
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_PPC0,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
[USB_PD_PORT_TCPC_1] = {
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
};
diff --git a/baseboard/hatch/baseboard.h b/baseboard/hatch/baseboard.h
index 4ad634df45..e98a4c0119 100644
--- a/baseboard/hatch/baseboard.h
+++ b/baseboard/hatch/baseboard.h
@@ -155,7 +155,7 @@
#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
#define I2C_PORT_POWER NPCX_I2C_PORT5_0
#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM__7bf 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define I2C_PORT_BATTERY I2C_PORT_POWER
#define I2C_PORT_CHARGER I2C_PORT_POWER
diff --git a/baseboard/kalista/baseboard.c b/baseboard/kalista/baseboard.c
index 20520e3f50..b7caafb4ad 100644
--- a/baseboard/kalista/baseboard.c
+++ b/baseboard/kalista/baseboard.c
@@ -144,7 +144,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = I2C_ADDR_TCPC0__7bf,
+ .addr_flags = I2C_ADDR_TCPC0_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -193,7 +193,7 @@ void board_tcpc_init(void)
* TCPM_INIT will fail due to not able to access PS8751.
* Note PS8751 A3 will wake on any I2C access.
*/
- i2c_read8__7bf(I2C_PORT_TCPC0, I2C_ADDR_TCPC0__7bf, 0xA0, &reg);
+ i2c_read8(I2C_PORT_TCPC0, I2C_ADDR_TCPC0_FLAGS, 0xA0, &reg);
/* Enable TCPC interrupts */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -249,10 +249,10 @@ BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
/* Initialize PMIC */
#define I2C_PMIC_READ(reg, data) \
- i2c_read8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf, (reg), (data))
+ i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS, (reg), (data))
#define I2C_PMIC_WRITE(reg, data) \
- i2c_write8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf, (reg), (data))
+ i2c_write8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS, (reg), (data))
static void board_pmic_init(void)
{
diff --git a/baseboard/kalista/baseboard.h b/baseboard/kalista/baseboard.h
index 2cb8a06481..e494b83e46 100644
--- a/baseboard/kalista/baseboard.h
+++ b/baseboard/kalista/baseboard.h
@@ -120,8 +120,8 @@
#define I2C_PORT_THERMAL NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_TCPC0__7bf 0x0b
-#define I2C_ADDR_EEPROM__7bf 0x50
+#define I2C_ADDR_TCPC0_FLAGS 0x0b
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Verify and jump to RW image on boot */
#define CONFIG_VBOOT_EFS
diff --git a/baseboard/octopus/baseboard.h b/baseboard/octopus/baseboard.h
index c78d3ee72d..d18acda50f 100644
--- a/baseboard/octopus/baseboard.h
+++ b/baseboard/octopus/baseboard.h
@@ -47,7 +47,7 @@
#define I2C_PORT_EEPROM NPCX_I2C_PORT3_0
#define I2C_PORT_CHARGER NPCX_I2C_PORT4_1
#define I2C_PORT_SENSOR NPCX_I2C_PORT7_0
- #define I2C_ADDR_EEPROM__7bf 0x50
+ #define I2C_ADDR_EEPROM_FLAGS 0x50
/* Enable PSL hibernate mode. */
#define CONFIG_HIBERNATE_PSL
@@ -69,7 +69,7 @@
#define I2C_PORT_USBC1 IT83XX_I2C_CH_E
#define I2C_PORT_USB_MUX I2C_PORT_USBC0 /* For MUX driver */
#define I2C_PORT_EEPROM IT83XX_I2C_CH_F
- #define I2C_ADDR_EEPROM__7bf 0x50
+ #define I2C_ADDR_EEPROM_FLAGS 0x50
/* EC variant determines USB-C variant */
#define VARIANT_OCTOPUS_USBC_ITE_EC_TCPCS
diff --git a/baseboard/octopus/variant_usbc_ec_tcpcs.c b/baseboard/octopus/variant_usbc_ec_tcpcs.c
index 071c6388d3..408552e7fc 100644
--- a/baseboard/octopus/variant_usbc_ec_tcpcs.c
+++ b/baseboard/octopus/variant_usbc_ec_tcpcs.c
@@ -68,14 +68,14 @@ static void board_it83xx_hpd_status(int port, int hpd_lvl, int hpd_irq)
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ITE_0] = {
/* Driver uses I2C_PORT_USB_MUX as I2C port */
- .port_addr = IT5205_I2C_ADDR1__7bf,
+ .port_addr = IT5205_I2C_ADDR1_FLAGS,
.driver = &it5205_usb_mux_driver,
.hpd_update = &board_it83xx_hpd_status,
},
[USB_PD_PORT_ITE_1] = {
/* Use PS8751 as mux only */
.port_addr = MUX_PORT_AND_ADDR(
- I2C_PORT_USBC1, PS8751_I2C_ADDR1__7bf),
+ I2C_PORT_USBC1, PS8751_I2C_ADDR1_FLAGS),
.flags = USB_MUX_FLAG_NOT_TCPC,
.driver = &ps8xxx_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -87,12 +87,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ITE_0] = {
.i2c_port = I2C_PORT_USBC0,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
[USB_PD_PORT_ITE_1] = {
.i2c_port = I2C_PORT_USBC1,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
};
diff --git a/baseboard/octopus/variant_usbc_standalone_tcpcs.c b/baseboard/octopus/variant_usbc_standalone_tcpcs.c
index c9921b8a4b..567d26341a 100644
--- a/baseboard/octopus/variant_usbc_standalone_tcpcs.c
+++ b/baseboard/octopus/variant_usbc_standalone_tcpcs.c
@@ -35,14 +35,14 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
#else
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = AN7447_TCPC0_I2C_ADDR__7bf,
+ .addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
},
.drv = &anx7447_tcpm_drv,
#endif
@@ -51,7 +51,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -91,12 +91,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_TCPC0,
- .i2c_addr__7bf = NX20P3483_ADDR2__7bf,
+ .i2c_addr_flags = NX20P3483_ADDR2_FLAGS,
.drv = &nx20p348x_drv,
},
[USB_PD_PORT_TCPC_1] = {
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr__7bf = NX20P3483_ADDR2__7bf,
+ .i2c_addr_flags = NX20P3483_ADDR2_FLAGS,
.drv = &nx20p348x_drv,
},
};
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index 1014b1dec5..9d2158195b 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -89,7 +89,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
},
.drv = &anx74xx_tcpm_drv,
/* Alert is active-low, open-drain */
@@ -99,7 +99,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -140,12 +140,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
struct ppc_config_t ppc_chips[] = {
{
.i2c_port = I2C_PORT_TCPC0,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
{
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
};
@@ -387,7 +387,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = (const mat33_fp_t *)&lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -415,7 +415,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 2, /* g, enough for laptop */
.rot_standard_ref = (const mat33_fp_t *)&zork_base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -443,7 +443,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = (const mat33_fp_t *)&zork_base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/ampton/board.c b/board/ampton/board.c
index 15b3af652a..4b5e7ed3f5 100644
--- a/board/ampton/board.c
+++ b/board/ampton/board.c
@@ -72,7 +72,7 @@ struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ITE_0] = {
/* Use PS8751 as mux only */
.port_addr = MUX_PORT_AND_ADDR(
- I2C_PORT_USBC0, PS8751_I2C_ADDR1__7bf),
+ I2C_PORT_USBC0, PS8751_I2C_ADDR1_FLAGS),
.flags = USB_MUX_FLAG_NOT_TCPC,
.driver = &ps8xxx_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -81,7 +81,7 @@ struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ITE_1] = {
/* Use PS8751 as mux only */
.port_addr = MUX_PORT_AND_ADDR(
- I2C_PORT_USBC1, PS8751_I2C_ADDR1__7bf),
+ I2C_PORT_USBC1, PS8751_I2C_ADDR1_FLAGS),
.flags = USB_MUX_FLAG_NOT_TCPC,
.driver = &ps8xxx_usb_mux_driver,
.hpd_update = &ps8xxx_tcpc_update_hpd_status,
@@ -188,7 +188,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.config = {
@@ -212,7 +212,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -240,7 +240,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &gyro_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/arcada_ish/board.c b/board/arcada_ish/board.c
index f18a530568..631022aaae 100644
--- a/board/arcada_ish/board.c
+++ b/board/arcada_ish/board.c
@@ -63,7 +63,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_ACCEL_GYRO_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR1__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR1_FLAGS,
.rot_standard_ref = &lid_rot_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -93,7 +93,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_ACCEL_GYRO_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR1__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR1_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &lid_rot_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -110,7 +110,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_lis2dh_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LNG2DM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LNG2DM_ADDR0_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix */
/* We only use 2g because its resolution is only 8-bits */
.default_range = 2, /* g */
@@ -138,7 +138,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mag_mutex,
.drv_data = LIS2MDL_ST_DATA(lis2mdl_a_data),
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LIS2MDL_ADDR__7bf,
+ .i2c_spi_addr_flags = LIS2MDL_ADDR_FLAGS,
.default_range = 1 << 11, /* 16LSB / uT, fixed */
.rot_standard_ref = &lid_rot_ref,
.min_frequency = LIS2MDL_ODR_MIN_VAL,
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 3d6e52ed89..1c86e589d8 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -159,7 +159,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = I2C_ADDR_TCPC__7bf,
+ .addr_flags = I2C_ADDR_TCPC_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -170,7 +170,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = I2C_ADDR_TCPC__7bf,
+ .addr_flags = I2C_ADDR_TCPC_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -262,7 +262,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_RESETIRQ1, &vrfault) != EC_SUCCESS)
return;
@@ -272,11 +272,11 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_PWRSTAT1, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_PWRSTAT2, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
@@ -284,11 +284,11 @@ static void board_report_pmic_fault(const char *str)
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_RESETIRQ1, BIT(4));
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_PWRSTAT1, pwrstat1);
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_PWRSTAT2, pwrstat2);
/*
@@ -308,7 +308,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_VCCIOCNT, 0x3a);
/*
@@ -318,7 +318,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_V18ACNT, 0x2a);
/*
@@ -328,7 +328,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_V085ACNT, 0x2a);
}
@@ -341,7 +341,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_VCCIOCNT, 0x7a);
/*
@@ -351,7 +351,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_V18ACNT, 0x6a);
/*
@@ -361,7 +361,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_V085ACNT, 0x6a);
}
@@ -378,25 +378,25 @@ static void board_pmic_init(void)
board_report_pmic_fault("SYSJUMP");
/* Clear power source events */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_PWRSRCINT, 0xff);
/* Disable power button shutdown timer */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_PBCONFIG, 0x00);
if (system_jumped_to_this_image())
return;
/* DISCHGCNT1 - enable 100 ohm discharge on VCCIO */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_DISCHGCNT1, 0x01);
/*
* DISCHGCNT2 - enable 100 ohm discharge on
* V5.0A, V3.3DSW, V3.3A and V1.8A
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_DISCHGCNT2, 0x55);
/*
@@ -405,19 +405,19 @@ static void board_pmic_init(void)
* DISCHGCNT3 - enable 100 ohm discharge on
* V12U, V1.00A, V0.85A
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_DISCHGCNT3, 0xd5);
/* DISCHGCNT4 - enable 100 ohm discharge on V33S, V18S, V100S */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_DISCHGCNT4, 0x15);
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_VRMODECTRL, 0x1f);
/* V5ADS3CNT - boost V5A_DS3 by 2% */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_V5ADS3CNT, 0x1a);
board_pmic_disable_slp_s0_vr_decay();
@@ -440,7 +440,7 @@ void board_hibernate(void)
system_enter_psl_mode();
/* Cut off DSW power via the ROP PMIC. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
BD99992GW_REG_SDWNCTRL, BD99992GW_SDWNCTRL_SWDN);
/* Wait for power to be cut. */
@@ -593,7 +593,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = OPT3001_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x2b11a1, /* from nocturne */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/atlas/board.h b/board/atlas/board.h
index 2d27e89314..37d8c5afd1 100644
--- a/board/atlas/board.h
+++ b/board/atlas/board.h
@@ -113,7 +113,7 @@
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define ALS_COUNT 1
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
#define CONFIG_ACCEL_FIFO 1024
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
#define CONFIG_ACCEL_INTERRUPTS
@@ -166,9 +166,9 @@
#define I2C_PORT_THERMAL I2C_PORT_POWER
/* I2C addresses */
-#define I2C_ADDR_TCPC__7bf 0x0B
-#define I2C_ADDR_MP2949__7bf 0x20
-#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_TCPC_FLAGS 0x0B
+#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
#ifndef __ASSEMBLER__
diff --git a/board/bloog/board.c b/board/bloog/board.c
index f14989ad73..b472f6fe8d 100644
--- a/board/bloog/board.c
+++ b/board/bloog/board.c
@@ -138,7 +138,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &kx022_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = &lid_standrd_ref,
.default_range = 2, /* g */
.config = {
@@ -166,7 +166,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -198,7 +198,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/board/bobba/board.c b/board/bobba/board.c
index 251c545290..8e68d0b125 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -168,7 +168,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 4, /* g */
.config = {
@@ -192,7 +192,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -220,7 +220,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/casta/board.c b/board/casta/board.c
index ae3f61e0c1..6d7bd9cf46 100644
--- a/board/casta/board.c
+++ b/board/casta/board.c
@@ -95,10 +95,10 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
static timestamp_t battery_last_i2c_time;
-static int is_battery_i2c__7bf(const int port, const uint16_t slave_addr__7bf)
+static int is_battery_i2c(const int port, const uint16_t slave_addr_flags)
{
return (port == I2C_PORT_BATTERY)
- && (slave_addr__7bf == BATTERY_ADDR__7bf);
+ && (slave_addr_flags == BATTERY_ADDR_FLAGS);
}
static int is_battery_port(int port)
@@ -106,11 +106,11 @@ static int is_battery_port(int port)
return (port == I2C_PORT_BATTERY);
}
-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)
{
unsigned int time_delta_us;
- if (!is_battery_i2c__7bf(port, slave_addr__7bf))
+ if (!is_battery_i2c(port, slave_addr_flags))
return;
time_delta_us = time_since32(battery_last_i2c_time);
@@ -120,7 +120,7 @@ void i2c_start_xfer_notify__7bf(const int port, const uint16_t slave_addr__7bf)
usleep(BATTERY_FREE_MIN_DELTA_US - time_delta_us);
}
-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)
{
/*
* The bus free time needs to be maintained from last transaction
diff --git a/board/chell/board.c b/board/chell/board.c
index 7ecad3f1c1..48e71a6366 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -42,7 +42,7 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_BD99992_FLAGS 0x30
/* Exchange status with PD MCU. */
static void pd_mcu_interrupt(enum gpio_signal signal)
@@ -111,7 +111,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
+ .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS,
},
.drv = &tcpci_tcpm_drv,
},
@@ -119,7 +119,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF + 1,
+ .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS + 1,
},
.drv = &tcpci_tcpm_drv,
@@ -230,7 +230,7 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
static void board_pmic_init(void)
{
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x04);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3e, 0x04);
/*
* No need to re-init below settings since they are present on all MP
@@ -240,23 +240,23 @@ static void board_pmic_init(void)
return;
/* Set CSDECAYEN / VCCIO decays to 0V at assertion of SLP_S0# */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x4a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x4a);
/*
* Set V100ACNT / V1.00A Control Register:
* Nominal output = 1.0V.
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x1a);
/*
* Set V085ACNT / V0.85A Control Register:
* Lower power mode = 0.7V.
* Nominal output = 1.0V.
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
/* VRMODECTRL - enable low-power mode for VCCIO and V0.85A */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x18);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3b, 0x18);
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
@@ -394,7 +394,7 @@ void board_hibernate(void)
uart_flush_output();
/* Trigger PMIC shutdown. */
- if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x01)) {
+ if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -466,7 +466,7 @@ void chipset_set_pmic_slp_sus_l(int level)
if (!level)
msleep(25);
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
0x43, val);
previous_level = level;
}
diff --git a/board/cheza/board.c b/board/cheza/board.c
index 8f11d0150b..6874503238 100644
--- a/board/cheza/board.c
+++ b/board/cheza/board.c
@@ -242,7 +242,7 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
struct ppc_config_t ppc_chips[] = {
{
.i2c_port = I2C_PORT_TCPC0,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
/*
@@ -261,7 +261,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = 0x28,
+ .addr_flags = 0x28,
},
.drv = &anx74xx_tcpm_drv,
.flags = TCPC_FLAGS_ALERT_OD,
@@ -270,7 +270,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = 0x0B,
+ .addr_flags = 0x0B,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -649,7 +649,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -670,7 +670,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -685,7 +685,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = OPT3001_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1; uscale = 0 */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/cheza/board.h b/board/cheza/board.h
index e35502fa57..39adbcf500 100644
--- a/board/cheza/board.h
+++ b/board/cheza/board.h
@@ -138,7 +138,7 @@
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define ALS_COUNT 1
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
/* PD */
#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
diff --git a/board/coral/board.c b/board/coral/board.c
index 936817db76..40d7a211b3 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -174,7 +174,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
.i2c_test = &anx74xx_i2c_stress_test_dev,
},
#endif
@@ -183,7 +183,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = NPCX_I2C_PORT0_1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
.i2c_test = &ps8xxx_i2c_stress_test_dev,
},
#endif
@@ -192,7 +192,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_GYRO,
- .addr__7bf = BMI160_ADDR0__7bf,
+ .addr_flags = BMI160_ADDR0_FLAGS,
.i2c_test = &bmi160_i2c_stress_test_dev,
},
#endif
@@ -201,7 +201,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_LID_ACCEL,
- .addr__7bf = KX022_ADDR1__7bf,
+ .addr_flags = KX022_ADDR1_FLAGS,
.i2c_test = &kionix_i2c_stress_test_dev,
},
#endif
@@ -226,7 +226,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -234,7 +234,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -373,7 +373,7 @@ static void board_tcpc_init(void)
*
* NOTE: PS8751 A3 will wake on any I2C access.
*/
- i2c_read8__7bf(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
+ i2c_read8(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
/* Enable TCPC0 interrupt */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -723,7 +723,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_LID_ACCEL,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.config = {
@@ -748,7 +748,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.config = {
@@ -775,7 +775,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
},
diff --git a/board/elm/board.c b/board/elm/board.c
index 3568564621..7dfc0a503d 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -92,14 +92,16 @@ const struct adc_t adc_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-int anx7688_passthru_allowed__7bf(const struct i2c_port_t *port,
- const uint16_t addr__7bf)
+int anx7688_passthru_allowed(const struct i2c_port_t *port,
+ const uint16_t addr_flags)
{
+ uint16_t addr = I2C_GET_ADDR(addr_flags);
+
/* Allow access to 0x2c (TCPC) */
- if (I2C_GET_ADDR__7b(addr__7bf) == 0x2c)
+ if (addr == 0x2c)
return 1;
- CPRINTF("Passthru rejected on %x", I2C_GET_ADDR__7b(addr__7bf));
+ CPRINTF("Passthru rejected on %x", addr);
return 0;
}
@@ -108,7 +110,7 @@ int anx7688_passthru_allowed__7bf(const struct i2c_port_t *port,
const struct i2c_port_t i2c_ports[] = {
{"battery", I2C_PORT_BATTERY, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
{"pd", I2C_PORT_PD_MCU, 1000, GPIO_I2C1_SCL, GPIO_I2C1_SDA,
- anx7688_passthru_allowed__7bf}
+ anx7688_passthru_allowed}
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -126,7 +128,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
+ .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS,
},
.drv = &anx7688_tcpm_drv,
},
@@ -467,7 +469,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &kionix_accel_drv,
.mutex = &g_kx022_mutex[0],
.drv_data = &g_kx022_data[0],
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(0),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(0),
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -490,7 +492,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &kionix_accel_drv,
.mutex = &g_kx022_mutex[1],
.drv_data = &g_kx022_data[1],
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(1),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(1),
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
diff --git a/board/elm/board.h b/board/elm/board.h
index d9e336f720..9312782599 100644
--- a/board/elm/board.h
+++ b/board/elm/board.h
@@ -99,8 +99,8 @@
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
-#undef CONFIG_TCPC_I2C_BASE_ADDR__7BF
-#define CONFIG_TCPC_I2C_BASE_ADDR__7BF 0x2C
+#undef CONFIG_TCPC_I2C_BASE_ADDR_FLAGS
+#define CONFIG_TCPC_I2C_BASE_ADDR_FLAGS 0x2C
#define CONFIG_USB_PD_ANX7688
/* UART DMA */
diff --git a/board/eve/board.c b/board/eve/board.c
index 72877fd100..4d408915f7 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -207,7 +207,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -215,7 +215,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -363,7 +363,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -373,19 +373,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, BIT(4));
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, pwrstat1);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
@@ -403,32 +403,32 @@ static void board_pmic_init(void)
return;
/* DISCHGCNT2 - enable 100 ohm discharge on V3.3A and V1.8A */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3d, 0x05);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3d, 0x05);
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x04);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3e, 0x04);
/* Set CSDECAYEN / VCCIO decays to 0V at assertion of SLP_S0# */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x7a);
/*
* Set V100ACNT / V1.00A Control Register:
* Nominal output = 1.0V.
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x1a);
/*
* Set V085ACNT / V0.85A Control Register:
* Lower power mode = 0.7V.
* Nominal output = 1.0V.
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x1f);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3b, 0x1f);
/* Clear power source events */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x04, 0xff);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x04, 0xff);
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
@@ -722,7 +722,7 @@ void board_hibernate(void)
/* Shut down PMIC */
CPRINTS("Triggering PMIC shutdown");
uart_flush_output();
- if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x01)) {
+ if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -815,7 +815,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kxcj9_data,
.port = I2C_PORT_LID_ACCEL,
- .i2c_spi_addr__7bf = KXCJ9_ADDR0__7bf,
+ .i2c_spi_addr_flags = KXCJ9_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KXCJ9_ACCEL_MIN_FREQ,
@@ -842,7 +842,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = NULL,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -876,7 +876,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = NULL,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -893,7 +893,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -910,7 +910,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_si114x_data,
.port = I2C_PORT_ALS,
- .i2c_spi_addr__7bf = SI114X_ADDR__7bf,
+ .i2c_spi_addr_flags = SI114X_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 3088, /* 30.88%: int = 0 - frac = 3088/10000 */
.min_frequency = SI114X_LIGHT_MIN_FREQ,
diff --git a/board/eve/board.h b/board/eve/board.h
index 88938e9719..642db72eb3 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -128,7 +128,7 @@
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
+#define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS
#define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT /* Unused */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_LID_ANGLE
@@ -195,8 +195,8 @@
#define I2C_PORT_MP2949 NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_BD99992__7bf 0x30
-#define I2C_ADDR_MP2949__7bf 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
#ifndef __ASSEMBLER__
diff --git a/board/fizz/board.c b/board/fizz/board.c
index 405d34cbb4..dbb898c69b 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -179,7 +179,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = I2C_ADDR_TCPC0__7bf,
+ .addr_flags = I2C_ADDR_TCPC0_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -229,7 +229,7 @@ void board_tcpc_init(void)
* TCPM_INIT will fail due to not able to access PS8751.
* Note PS8751 A3 will wake on any I2C access.
*/
- i2c_read8__7bf(I2C_PORT_TCPC0, I2C_ADDR_TCPC0__7bf, 0xA0, &reg);
+ i2c_read8(I2C_PORT_TCPC0, I2C_ADDR_TCPC0_FLAGS, 0xA0, &reg);
/* Enable TCPC interrupts */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -289,10 +289,10 @@ BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
/* Initialize PMIC */
#define I2C_PMIC_READ(reg, data) \
- i2c_read8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf, (reg), (data))
+ i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS, (reg), (data))
#define I2C_PMIC_WRITE(reg, data) \
- i2c_write8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf, (reg), (data))
+ i2c_write8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS, (reg), (data))
static void board_pmic_init(void)
{
diff --git a/board/fizz/board.h b/board/fizz/board.h
index 40aa840d59..6071a163e8 100644
--- a/board/fizz/board.h
+++ b/board/fizz/board.h
@@ -139,8 +139,8 @@
#define I2C_PORT_THERMAL NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_TCPC0__7bf 0x0b
-#define I2C_ADDR_EEPROM__7bf 0x50
+#define I2C_ADDR_TCPC0_FLAGS 0x0b
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Verify and jump to RW image on boot */
#define CONFIG_VBOOT_EFS
diff --git a/board/flapjack/battery.c b/board/flapjack/battery.c
index 5bb6b07a9f..981edea013 100644
--- a/board/flapjack/battery.c
+++ b/board/flapjack/battery.c
@@ -398,10 +398,10 @@ int charger_profile_override(struct charge_state_data *curr)
* Pull down WPC VBUS. Need to use raw i2c APIs because RO
* doesn't have p9221 driver. If WPC is off, this is a no-op.
*/
- if (i2c_read_offset16__7bf(I2C_PORT_WPC, P9221_R7_ADDR__7bf,
+ if (i2c_read_offset16(I2C_PORT_WPC, P9221_R7_ADDR_FLAGS,
P9221R7_VOUT_SET_REG, &val, 1) == EC_SUCCESS
&& val * 100 != wpc_mv)
- i2c_write_offset16__7bf(I2C_PORT_WPC, P9221_R7_ADDR__7bf,
+ i2c_write_offset16(I2C_PORT_WPC, P9221_R7_ADDR_FLAGS,
P9221R7_VOUT_SET_REG, wpc_mv / 100, 1);
if ((curr->batt.flags & BATT_FLAG_BAD_TEMPERATURE) ||
diff --git a/board/flapjack/board.c b/board/flapjack/board.c
index fcbf71938c..7ea93796be 100644
--- a/board/flapjack/board.c
+++ b/board/flapjack/board.c
@@ -138,11 +138,11 @@ static void board_setup_panel(void)
dim = sku & SKU_ID_PANEL_SIZE_MASK ? 0xc4 : 0xc8;
}
- rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf,
+ rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR_FLAGS,
MT6370_BACKLIGHT_BLEN, channel);
- rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf,
+ rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR_FLAGS,
MT6370_BACKLIGHT_BLDIM, dim);
- rv |= i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf,
+ rv |= i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR_FLAGS,
MT6370_BACKLIGHT_BLPWM, 0xac);
if (rv)
CPRINTS("Board setup panel failed");
@@ -288,7 +288,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = MT6370_TCPC_I2C_ADDR__7bf,
+ .addr_flags = MT6370_TCPC_I2C_ADDR_FLAGS,
},
.drv = &mt6370_tcpm_drv},
};
@@ -500,7 +500,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -523,7 +523,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -538,7 +538,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &tcs3400_drv,
.drv_data = &g_tcs3400_data,
.port = I2C_PORT_ALS,
- .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1x, uscale = 0 */
.min_frequency = TCS3400_LIGHT_MIN_FREQ,
diff --git a/board/flapjack/board.h b/board/flapjack/board.h
index 13a010f416..e76a82f444 100644
--- a/board/flapjack/board.h
+++ b/board/flapjack/board.h
@@ -225,10 +225,10 @@
#define I2C_PORT_EEPROM 1
/* I2C addresses */
-#define I2C_ADDR_EEPROM__7bf 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Route sbs host requests to virtual battery driver */
-#define VIRTUAL_BATTERY_ADDR__7bf 0x0B
+#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
/* Enable Accel over SPI */
#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
diff --git a/board/fleex/board.c b/board/fleex/board.c
index 444d585308..80b7fed9d0 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -133,7 +133,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_lis2dh_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LIS2DH_ADDR1__7bf,
+ .i2c_spi_addr_flags = LIS2DH_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g */
/* We only use 2g because its resolution is only 8-bits */
@@ -164,7 +164,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -196,7 +196,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/board/fluffy/board.c b/board/fluffy/board.c
index 4631b4a851..bf2c204366 100644
--- a/board/fluffy/board.c
+++ b/board/fluffy/board.c
@@ -113,7 +113,7 @@ DECLARE_CONSOLE_COMMAND(ccflip, command_cc_flip,
/*
* Support tca6416 I2C ioexpander.
*/
-#define GPIOX_I2C_ADDR__7bf 0x20
+#define GPIOX_I2C_ADDR_FLAGS 0x20
#define GPIOX_IN_PORT_A 0x0
#define GPIOX_IN_PORT_B 0x1
#define GPIOX_OUT_PORT_A 0x2
@@ -129,9 +129,9 @@ static void i2c_expander_init(void)
/*
* Setup P00, P02, P04, P10, and P12 on the I/O expander as an output.
*/
- i2c_write8__7bf(I2C_PORT_MASTER, GPIOX_I2C_ADDR__7bf,
+ i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS,
GPIOX_DIR_PORT_A, 0xea);
- i2c_write8__7bf(I2C_PORT_MASTER, GPIOX_I2C_ADDR__7bf,
+ i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS,
GPIOX_DIR_PORT_B, 0xfa);
}
DECLARE_HOOK(HOOK_INIT, i2c_expander_init, HOOK_PRIO_INIT_I2C+1);
@@ -142,14 +142,14 @@ static void write_ioexpander(int bank, int gpio, int reg, int val)
int tmp;
/* Read output port register */
- i2c_read8__7bf(I2C_PORT_MASTER, GPIOX_I2C_ADDR__7bf,
+ i2c_read8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS,
reg + bank, &tmp);
if (val)
tmp |= BIT(gpio);
else
tmp &= ~BIT(gpio);
/* Write back modified output port register */
- i2c_write8__7bf(I2C_PORT_MASTER, GPIOX_I2C_ADDR__7bf,
+ i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS,
reg + bank, tmp);
}
diff --git a/board/garg/board.c b/board/garg/board.c
index b0ec0ef955..8eaa10034d 100644
--- a/board/garg/board.c
+++ b/board/garg/board.c
@@ -154,7 +154,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 4, /* g */
.config = {
@@ -178,7 +178,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -206,7 +206,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/glados/battery.c b/board/glados/battery.c
index d6c702127e..fcc09994bf 100644
--- a/board/glados/battery.c
+++ b/board/glados/battery.c
@@ -47,9 +47,9 @@ int board_cut_off_battery(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
buf, 3, NULL, 0, I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
buf, 3, NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
diff --git a/board/glados/board.c b/board/glados/board.c
index c3a05289ad..1b1ac7ebcc 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -48,7 +48,7 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_BD99992_FLAGS 0x30
/* Exchange status with PD MCU. */
static void pd_mcu_interrupt(enum gpio_signal signal)
@@ -123,7 +123,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
+ .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS,
},
.drv = &tcpci_tcpm_drv,
},
@@ -131,7 +131,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF + 1,
+ .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS + 1,
},
.drv = &tcpci_tcpm_drv,
},
@@ -213,23 +213,23 @@ static void board_pmic_init(void)
return;
/* Set CSDECAYEN / VCCIO decays to 0V at assertion of SLP_S0# */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x4a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x4a);
/*
* Set V100ACNT / V1.00A Control Register:
* Nominal output = 1.0V.
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x1a);
/*
* Set V085ACNT / V0.85A Control Register:
* Lower power mode = 0.7V.
* Nominal output = 1.0V.
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
/* VRMODECTRL - enable low-power mode for VCCIO and V0.85A */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x18);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3b, 0x18);
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
diff --git a/board/glados/board.h b/board/glados/board.h
index 93c5bbd500..719a871abd 100644
--- a/board/glados/board.h
+++ b/board/glados/board.h
@@ -134,7 +134,7 @@
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* Ambient Light Sensor address */
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
/* Modules we want to exclude */
#undef CONFIG_CMD_HASH
diff --git a/board/glados_pd/board.h b/board/glados_pd/board.h
index 0d513b6e67..e2c26e1afe 100644
--- a/board/glados_pd/board.h
+++ b/board/glados_pd/board.h
@@ -97,7 +97,7 @@
/* slave address for host commands */
#ifdef HAS_TASK_HOSTCMD
-#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF CONFIG_USB_PD_I2C_SLAVE_ADDR__7BF
+#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS CONFIG_USB_PD_I2C_SLAVE_ADDR_FLAGS
#endif
#ifndef __ASSEMBLER__
diff --git a/board/glkrvp/battery.c b/board/glkrvp/battery.c
index 36dec46702..8f0ff23d14 100644
--- a/board/glkrvp/battery.c
+++ b/board/glkrvp/battery.c
@@ -14,10 +14,10 @@
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
#define I2C_PORT_PCA555_BATT_PRESENT_GPIO NPCX_I2C_PORT0_0
-#define I2C_ADDR_PCA555_BATT_PRESENT_GPIO__7bf 0x21
+#define I2C_ADDR_PCA555_BATT_PRESENT_GPIO_FLAGS 0x21
#define PCA555_BATT_PRESENT_GPIO_READ(reg, data) \
- pca9555_read__7bf(I2C_PORT_PCA555_BATT_PRESENT_GPIO, \
- I2C_ADDR_PCA555_BATT_PRESENT_GPIO__7bf, (reg), (data))
+ pca9555_read(I2C_PORT_PCA555_BATT_PRESENT_GPIO, \
+ I2C_ADDR_PCA555_BATT_PRESENT_GPIO_FLAGS, (reg), (data))
/* Shutdown mode parameter to write to manufacturer access register */
#define SB_SHUTDOWN_DATA 0x0010
diff --git a/board/glkrvp/board.c b/board/glkrvp/board.c
index e748373ad0..c8a723ba45 100644
--- a/board/glkrvp/board.c
+++ b/board/glkrvp/board.c
@@ -29,19 +29,19 @@
#include "gpio_list.h"
#define I2C_PORT_PCA555_PMIC_GPIO NPCX_I2C_PORT0_0
-#define I2C_ADDR_PCA555_PMIC_GPIO__7bf 0x21
+#define I2C_ADDR_PCA555_PMIC_GPIO_FLAGS 0x21
#define PCA555_PMIC_GPIO_WRITE(reg, data) \
- pca9555_write__7bf(I2C_PORT_PCA555_PMIC_GPIO, \
- I2C_ADDR_PCA555_PMIC_GPIO__7bf, (reg), (data))
+ pca9555_write(I2C_PORT_PCA555_PMIC_GPIO, \
+ I2C_ADDR_PCA555_PMIC_GPIO_FLAGS, (reg), (data))
#define PCA555_PMIC_GPIO_READ(reg, data) \
- pca9555_read__7bf(I2C_PORT_PCA555_PMIC_GPIO, \
- I2C_ADDR_PCA555_PMIC_GPIO__7bf, (reg), (data))
+ pca9555_read(I2C_PORT_PCA555_PMIC_GPIO, \
+ I2C_ADDR_PCA555_PMIC_GPIO_FLAGS, (reg), (data))
#define I2C_PORT_PCA555_BOARD_ID_GPIO NPCX_I2C_PORT0_0
-#define I2C_ADDR_PCA555_BOARD_ID_GPIO__7bf 0x20
+#define I2C_ADDR_PCA555_BOARD_ID_GPIO_FLAGS 0x20
#define PCA555_BOARD_ID_GPIO_READ(reg, data) \
- pca9555_read__7bf(I2C_PORT_PCA555_BOARD_ID_GPIO, \
- I2C_ADDR_PCA555_BOARD_ID_GPIO__7bf, (reg), (data))
+ pca9555_read(I2C_PORT_PCA555_BOARD_ID_GPIO, \
+ I2C_ADDR_PCA555_BOARD_ID_GPIO_FLAGS, (reg), (data))
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
diff --git a/board/glkrvp/chg_usb_pd.c b/board/glkrvp/chg_usb_pd.c
index fd4b1fd0e2..cdab48d47b 100644
--- a/board/glkrvp/chg_usb_pd.c
+++ b/board/glkrvp/chg_usb_pd.c
@@ -35,7 +35,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT7_0,
- .addr__7bf = 0x50,
+ .addr_flags = 0x50,
},
.drv = &tcpci_tcpm_drv,
},
@@ -43,7 +43,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT7_0,
- .addr__7bf = 0x52,
+ .addr_flags = 0x52,
},
.drv = &tcpci_tcpm_drv,
},
diff --git a/board/glkrvp_ite/battery.c b/board/glkrvp_ite/battery.c
index 5665b1f557..f8665e2b58 100644
--- a/board/glkrvp_ite/battery.c
+++ b/board/glkrvp_ite/battery.c
@@ -199,8 +199,8 @@ enum battery_present battery_hw_present(void)
int data;
int rv;
- rv = pca9555_read__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ rv = pca9555_read(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
PCA9555_CMD_INPUT_PORT_0, &data);
/* GPIO is low when the battery is physically present */
diff --git a/board/glkrvp_ite/board.c b/board/glkrvp_ite/board.c
index 9721549b14..33d98477bf 100644
--- a/board/glkrvp_ite/board.c
+++ b/board/glkrvp_ite/board.c
@@ -31,7 +31,7 @@
#include "gpio_list.h"
#define I2C_PORT_PCA555_BOARD_ID_GPIO IT83XX_I2C_CH_C
-#define I2C_ADDR_PCA555_BOARD_ID_GPIO__7bf 0x20
+#define I2C_ADDR_PCA555_BOARD_ID_GPIO_FLAGS 0x20
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
@@ -55,8 +55,8 @@ void chipset_pre_init_callback(void)
{
int data;
- if (pca9555_read__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ if (pca9555_read(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
PCA9555_CMD_OUTPUT_PORT_0, &data))
return;
@@ -70,16 +70,16 @@ void chipset_pre_init_callback(void)
/* Enable SOC_3P3_EN_L: Set the Output port O0.1 to low level */
data &= ~PCA9555_IO_1;
- pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
PCA9555_CMD_OUTPUT_PORT_0, data);
/* TODO: Find out from the spec */
msleep(10);
/* Enable PMIC_EN: Set the Output port O0.0 to high level */
- pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
PCA9555_CMD_OUTPUT_PORT_0,
data | PCA9555_IO_0);
}
@@ -106,23 +106,23 @@ void chipset_do_shutdown(void)
{
int data;
- if (pca9555_read__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ if (pca9555_read(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
PCA9555_CMD_OUTPUT_PORT_0, &data))
return;
/* Disable SOC_3P3_EN_L: Set the Output port O0.1 to high level */
data |= PCA9555_IO_1;
- pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
PCA9555_CMD_OUTPUT_PORT_0, data);
/* TODO: Find out from the spec */
msleep(10);
/* Disable PMIC_EN: Set the Output port O0.0 to low level */
- pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
+ pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
PCA9555_CMD_OUTPUT_PORT_0,
data & ~PCA9555_IO_0);
}
@@ -147,9 +147,9 @@ int board_get_version(void)
{
int data;
- if (pca9555_read__7bf(I2C_PORT_PCA555_BOARD_ID_GPIO,
- I2C_ADDR_PCA555_BOARD_ID_GPIO__7bf,
- PCA9555_CMD_INPUT_PORT_1, &data))
+ if (pca9555_read(I2C_PORT_PCA555_BOARD_ID_GPIO,
+ I2C_ADDR_PCA555_BOARD_ID_GPIO_FLAGS,
+ PCA9555_CMD_INPUT_PORT_1, &data))
return -1;
return data & 0x0f;
@@ -166,9 +166,9 @@ static void pmic_init(void)
* Configure Port O0.0 as Output port - PMIC_EN
* Configure Port O0.1 as Output port - SOC_3P3_EN_L
*/
- pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
- PCA9555_CMD_CONFIGURATION_PORT_0, 0xfc);
+ pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
+ PCA9555_CMD_CONFIGURATION_PORT_0, 0xfc);
/*
* Set the Output port O0.0 to low level - PMIC_EN
@@ -177,9 +177,9 @@ static void pmic_init(void)
* POR of PCA9555 port is input with high impedance hence explicitly
* configure the SOC_3P3_EN_L to high level.
*/
- pca9555_write__7bf(I2C_PORT_PCA555_PMIC_BATT_GPIO,
- I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf,
- PCA9555_CMD_OUTPUT_PORT_0, 0xfe);
+ pca9555_write(I2C_PORT_PCA555_PMIC_BATT_GPIO,
+ I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS,
+ PCA9555_CMD_OUTPUT_PORT_0, 0xfe);
}
DECLARE_HOOK(HOOK_INIT, pmic_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/glkrvp_ite/board.h b/board/glkrvp_ite/board.h
index 7c7834353c..8b6f7149ad 100644
--- a/board/glkrvp_ite/board.h
+++ b/board/glkrvp_ite/board.h
@@ -115,7 +115,7 @@
#define I2C_PORT_USB_MUX IT83XX_I2C_CH_B
#define I2C_PORT_PCA555_PMIC_BATT_GPIO IT83XX_I2C_CH_C
-#define I2C_ADDR_PCA555_PMIC_BATT_GPIO__7bf 0x21
+#define I2C_ADDR_PCA555_PMIC_BATT_GPIO_FLAGS 0x21
/* EC exclude modules */
#undef CONFIG_ADC
diff --git a/board/glkrvp_ite/chg_usb_pd.c b/board/glkrvp_ite/chg_usb_pd.c
index 7f3d049b29..45621c3202 100644
--- a/board/glkrvp_ite/chg_usb_pd.c
+++ b/board/glkrvp_ite/chg_usb_pd.c
@@ -35,7 +35,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = IT83XX_I2C_CH_B,
- .addr__7bf = 0x50,
+ .addr_flags = 0x50,
},
.drv = &tcpci_tcpm_drv,
},
@@ -43,7 +43,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = IT83XX_I2C_CH_B,
- .addr__7bf = 0x52,
+ .addr_flags = 0x52,
},
.drv = &tcpci_tcpm_drv,
},
diff --git a/board/hammer/board.h b/board/hammer/board.h
index 0e43ac877c..812ee6e6c3 100644
--- a/board/hammer/board.h
+++ b/board/hammer/board.h
@@ -275,7 +275,7 @@
#define CONFIG_TOUCHPAD
#define CONFIG_TOUCHPAD_ELAN
#define CONFIG_TOUCHPAD_I2C_PORT I2C_PORT_MASTER
-#define CONFIG_TOUCHPAD_I2C_ADDR__7BF 0x15
+#define CONFIG_TOUCHPAD_I2C_ADDR_FLAGS 0x15
#endif /* BOARD_WHISKERS */
#define CONFIG_CURVE25519
diff --git a/board/hatch/board.c b/board/hatch/board.c
index 364c9e3d31..2d7da1a1cf 100644
--- a/board/hatch/board.c
+++ b/board/hatch/board.c
@@ -130,7 +130,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = AN7447_TCPC0_I2C_ADDR__7bf,
+ .addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
},
.drv = &anx7447_tcpm_drv,
.flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
@@ -139,7 +139,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -159,12 +159,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
const struct pi3usb2901_config_t pi3usb2901_bc12_chips[] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_PPC0,
- .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
[USB_PD_PORT_TCPC_1] = {
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
};
@@ -233,7 +233,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -260,7 +260,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -286,7 +286,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -302,7 +302,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &tcs3400_drv,
.drv_data = &g_tcs3400_data,
.port = I2C_PORT_ALS,
- .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1x, uscale = 0 */
.min_frequency = TCS3400_LIGHT_MIN_FREQ,
diff --git a/board/helios/board.c b/board/helios/board.c
index 6a47979565..033056618f 100644
--- a/board/helios/board.c
+++ b/board/helios/board.c
@@ -119,7 +119,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -127,7 +127,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -147,12 +147,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
const struct pi3usb2901_config_t pi3usb2901_bc12_chips[] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_PPC0,
- .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
[USB_PD_PORT_TCPC_1] = {
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
};
@@ -198,7 +198,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -225,7 +225,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -251,7 +251,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -267,7 +267,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = OPT3001_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x2b11a1,
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/helios/board.h b/board/helios/board.h
index b85299e19d..e609249bd4 100644
--- a/board/helios/board.h
+++ b/board/helios/board.h
@@ -48,7 +48,7 @@
#define CONFIG_ALS
#define ALS_COUNT 1
#define CONFIG_ALS_OPT3001
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_TCPM_PS8751
diff --git a/board/host/battery.c b/board/host/battery.c
index 6ec74c61b4..1228485ab7 100644
--- a/board/host/battery.c
+++ b/board/host/battery.c
@@ -14,14 +14,14 @@
static uint16_t mock_smart_battery[SB_MANUFACTURER_DATA + 1];
-int sb_i2c_xfer__7bf(int port, uint16_t slave_addr__7bf,
+int sb_i2c_xfer(int port, uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
if (out_size == 0)
return EC_SUCCESS;
- if (port != I2C_PORT_BATTERY || slave_addr__7bf != BATTERY_ADDR__7bf)
+ if (port != I2C_PORT_BATTERY || slave_addr_flags != BATTERY_ADDR_FLAGS)
return EC_ERROR_INVAL;
if (out[0] >= ARRAY_SIZE(mock_smart_battery))
return EC_ERROR_UNIMPLEMENTED;
@@ -42,7 +42,7 @@ int sb_i2c_xfer__7bf(int port, uint16_t slave_addr__7bf,
}
return EC_SUCCESS;
}
-DECLARE_TEST_I2C_XFER(sb_i2c_xfer__7bf);
+DECLARE_TEST_I2C_XFER(sb_i2c_xfer);
int battery_time_at_rate(int rate, int *minutes)
{
diff --git a/board/kindred/board.c b/board/kindred/board.c
index 66862f706a..ddb717019c 100644
--- a/board/kindred/board.c
+++ b/board/kindred/board.c
@@ -130,7 +130,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = AN7447_TCPC0_I2C_ADDR__7bf,
+ .addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
},
.drv = &anx7447_tcpm_drv,
.flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
@@ -139,7 +139,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
.flags = 0,
@@ -160,12 +160,12 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
const struct pi3usb2901_config_t pi3usb2901_bc12_chips[] = {
[USB_PD_PORT_TCPC_0] = {
.i2c_port = I2C_PORT_PPC0,
- .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
[USB_PD_PORT_TCPC_1] = {
.i2c_port = I2C_PORT_TCPC1,
- .i2c_addr__7bf = PI3USB9201_I2C_ADDR_3__7bf,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
};
@@ -216,7 +216,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -243,7 +243,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -269,7 +269,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -285,7 +285,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = OPT3001_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x2b11a1,
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/kindred/board.h b/board/kindred/board.h
index 1d327abbcf..c11499e535 100644
--- a/board/kindred/board.h
+++ b/board/kindred/board.h
@@ -47,7 +47,7 @@
#define CONFIG_ALS
#define ALS_COUNT 1
#define CONFIG_ALS_OPT3001
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_TCPM_ANX7447
diff --git a/board/kohaku/board.c b/board/kohaku/board.c
index 0fa7b42ac7..bea950fe89 100644
--- a/board/kohaku/board.c
+++ b/board/kohaku/board.c
@@ -117,7 +117,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -125,7 +125,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -224,7 +224,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -251,7 +251,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -277,7 +277,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -293,7 +293,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bh1730_drv,
.drv_data = &g_bh1730_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BH1730_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = BH1730_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 65535,
.min_frequency = 10,
@@ -327,7 +327,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &tcs3400_drv,
.drv_data = &g_tcs3400_data,
.port = I2C_PORT_ALS,
- .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1x, uscale = 0 */
.min_frequency = TCS3400_LIGHT_MIN_FREQ,
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 95f177bf6b..12a46db970 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -80,7 +80,7 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-#define BC12_I2C_ADDR__7bf PI3USB9201_I2C_ADDR_3__7bf
+#define BC12_I2C_ADDR_FLAGS PI3USB9201_I2C_ADDR_3_FLAGS
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
@@ -101,7 +101,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = MT6370_TCPC_I2C_ADDR__7bf,
+ .addr_flags = MT6370_TCPC_I2C_ADDR_FLAGS,
},
.drv = &mt6370_tcpm_drv,
},
@@ -303,7 +303,7 @@ static void board_rev_init(void)
if (board_get_version() == 2) {
/* configure PI3USB9201 to USB Path ON Mode */
- i2c_write8__7bf(I2C_PORT_BC12, BC12_I2C_ADDR__7bf,
+ i2c_write8(I2C_PORT_BC12, BC12_I2C_ADDR_FLAGS,
PI3USB9201_REG_CTRL_1,
(PI3USB9201_USB_PATH_ON <<
PI3USB9201_REG_CTRL_1_MODE_SHIFT));
@@ -470,7 +470,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -493,7 +493,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -510,7 +510,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -526,7 +526,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &tcs3400_drv,
.drv_data = &g_tcs3400_data,
.port = I2C_PORT_ALS,
- .i2c_spi_addr__7bf = TCS3400_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1x, uscale = 0 */
.min_frequency = TCS3400_LIGHT_MIN_FREQ,
diff --git a/board/kukui/board.h b/board/kukui/board.h
index 95378757bc..fe9b415b36 100644
--- a/board/kukui/board.h
+++ b/board/kukui/board.h
@@ -91,7 +91,7 @@
#ifdef SECTION_IS_RW
#ifndef BOARD_KRANE
#define CONFIG_MAG_BMI160_BMM150
-#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
+#define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS
#define CONFIG_MAG_CALIBRATE
#endif /* !BOARD_KRANE */
#define CONFIG_ACCELGYRO_BMI160
@@ -221,7 +221,7 @@
#define I2C_PORT_ALS 1
/* Route sbs host requests to virtual battery driver */
-#define VIRTUAL_BATTERY_ADDR__7bf 0x0B
+#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
/* Enable Accel over SPI */
#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
diff --git a/board/mchpevb1/battery.c b/board/mchpevb1/battery.c
index d6c702127e..fcc09994bf 100644
--- a/board/mchpevb1/battery.c
+++ b/board/mchpevb1/battery.c
@@ -47,9 +47,9 @@ int board_cut_off_battery(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
buf, 3, NULL, 0, I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
buf, 3, NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c
index f11e65302b..9056f904dd 100644
--- a/board/mchpevb1/board.c
+++ b/board/mchpevb1/board.c
@@ -66,14 +66,14 @@
/* NOTE: MEC17xx EVB + SKL RVP3 does not use BD99992 PMIC.
* RVP3 PMIC controlled by RVP3 logic.
*/
-#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_BD99992_FLAGS 0x30
/*
* Maxim DS1624 I2C temperature sensor used for testing I2C.
* DS1624 contains one internal temperature sensor
* and EEPROM. It has no external temperature inputs.
*/
-#define DS1624_I2C_ADDR__7bf (0x48 | I2C_FLAG_BIG_ENDIAN)
+#define DS1624_I2C_ADDR_FLAGS (0x48 | I2C_FLAG_BIG_ENDIAN)
#define DS1624_IDX_LOCAL 0
#define DS1624_READ_TEMP16 0xAA /* read 16-bit temperature */
#define DS1624_ACCESS_CFG 0xAC /* read/write 8-bit config */
@@ -265,11 +265,11 @@ int board_i2c_p2c(int port)
#ifdef CONFIG_USB_POWER_DELIVERY
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
{I2C_PORT_TCPC,
- CONFIG_TCPC_I2C_BASE_ADDR__7BF,
+ CONFIG_TCPC_I2C_BASE_ADDR_FLAGS,
&tcpci_tcpm_drv},
{I2C_PORT_TCPC,
- CONFIG_TCPC_I2C_BASE_ADDR__7BF + 1,
+ CONFIG_TCPC_I2C_BASE_ADDR_FLAGS + 1,
&tcpci_tcpm_drv},
};
#endif
@@ -510,14 +510,14 @@ static void board_pmic_init(void)
/* Config DS1624 temperature sensor for continuous conversion */
cfg = 0x66;
- rv = i2c_read8__7bf(I2C_PORT_THERMAL, DS1624_I2C_ADDR__7bf,
- DS1624_ACCESS_CFG, &cfg);
+ rv = i2c_read8(I2C_PORT_THERMAL, DS1624_I2C_ADDR_FLAGS,
+ DS1624_ACCESS_CFG, &cfg);
trace2(0, BRD, 0, "Read DS1624 Config rv = %d cfg = 0x%02X",
rv, cfg);
if ((rv == EC_SUCCESS) && (cfg & (1u << 0))) {
/* one-shot mode switch to continuous */
- rv = i2c_write8__7bf(I2C_PORT_THERMAL, DS1624_I2C_ADDR__7bf,
+ rv = i2c_write8(I2C_PORT_THERMAL, DS1624_I2C_ADDR_FLAGS,
DS1624_ACCESS_CFG, 0);
trace1(0, BRD, 0, "Write DS1624 Config to 0, rv = %d", rv);
/* writes to config require 10ms until next I2C command */
@@ -526,7 +526,7 @@ static void board_pmic_init(void)
}
/* Send start command */
- rv = i2c_write8__7bf(I2C_PORT_THERMAL, DS1624_I2C_ADDR__7bf,
+ rv = i2c_write8(I2C_PORT_THERMAL, DS1624_I2C_ADDR_FLAGS,
DS1624_CMD_START, 1);
trace1(0, BRD, 0, "Send Start command to DS1624 rv = %d", rv);
@@ -869,7 +869,7 @@ static void ds1624_update(void)
int temp;
int rv __attribute__((unused));
- rv = i2c_read16__7bf(I2C_PORT_THERMAL, DS1624_I2C_ADDR__7bf,
+ rv = i2c_read16(I2C_PORT_THERMAL, DS1624_I2C_ADDR_FLAGS,
DS1624_READ_TEMP16, &temp);
d = (temp & 0x7FFF) >> 8;
@@ -932,7 +932,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(
CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
@@ -957,7 +957,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(
CONFIG_SPI_ACCEL_PORT),
.default_range = 1000, /* dps */
.rot_standard_ref = NULL, /* Identity Matrix. */
@@ -975,7 +975,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
diff --git a/board/mchpevb1/board.h b/board/mchpevb1/board.h
index 8fcaadc4bf..e229f29ec4 100644
--- a/board/mchpevb1/board.h
+++ b/board/mchpevb1/board.h
@@ -400,7 +400,7 @@
#endif
/* Ambient Light Sensor address */
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
/* Modules we want to exclude */
#undef CONFIG_CMD_HASH
diff --git a/board/meep/board.c b/board/meep/board.c
index a5e37b69ed..e09db291ee 100644
--- a/board/meep/board.c
+++ b/board/meep/board.c
@@ -138,7 +138,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &kx022_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = &lid_standrd_ref,
.default_range = 2, /* g */
.config = {
@@ -166,7 +166,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -198,7 +198,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/board/nami/board.c b/board/nami/board.c
index ba9bb571aa..16d4dcbff5 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -233,7 +233,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -243,7 +243,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_1,
- .addr__7bf = AN7447_TCPC3_I2C_ADDR__7bf,
+ .addr_flags = AN7447_TCPC3_I2C_ADDR_FLAGS,
},
.drv = &anx7447_tcpm_drv,
/* Alert is active-low, push-pull */
@@ -487,10 +487,10 @@ const static struct ec_thermal_config thermal_d2 = {
};
#define I2C_PMIC_READ(reg, data) \
- i2c_read8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf,\
+ i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS,\
(reg), (data))
#define I2C_PMIC_WRITE(reg, data) \
- i2c_write8__7bf(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1__7bf,\
+ i2c_write8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS,\
(reg), (data))
static void board_pmic_init(void)
@@ -751,7 +751,7 @@ const struct motion_sensor_t lid_accel_1 = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = &rotation_x180_z90,
.min_frequency = KX022_ACCEL_MIN_FREQ,
.max_frequency = KX022_ACCEL_MAX_FREQ,
@@ -779,7 +779,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -807,7 +807,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -835,7 +835,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -991,10 +991,10 @@ static void board_init(void)
gpio_set_level(GPIO_PCH_ACPRESENT, extpower_is_present());
/* Reduce Buck-boost mode switching frequency to reduce heat */
- if (i2c_read16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ if (i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
ISL9238_REG_CONTROL3, &reg) == EC_SUCCESS) {
reg |= ISL9238_C3_BB_SWITCHING_PERIOD;
- if (i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ if (i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
ISL9238_REG_CONTROL3, reg))
CPRINTF("Failed to set isl9238\n");
}
diff --git a/board/nami/board.h b/board/nami/board.h
index 04dfef4eff..2a93975747 100644
--- a/board/nami/board.h
+++ b/board/nami/board.h
@@ -210,8 +210,8 @@
#define I2C_PORT_ALS NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_MP2949__7bf 0x20
-#define I2C_ADDR_EEPROM__7bf 0x50
+#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#ifndef __ASSEMBLER__
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index bf89d0edad..5f79473bd7 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -151,7 +151,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -159,7 +159,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -268,7 +268,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -278,19 +278,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, BIT(4));
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, pwrstat1);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
@@ -309,7 +309,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x3a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x3a);
/*
* V18ACNT:
@@ -318,7 +318,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x2a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x2a);
/*
* V100ACNT:
@@ -327,7 +327,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x1a);
/*
* V085ACNT:
@@ -336,7 +336,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x3a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x3a);
}
static void board_pmic_enable_slp_s0_vr_decay(void)
@@ -348,7 +348,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x7a);
/*
* V18ACNT:
@@ -357,7 +357,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x6a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x6a);
/*
* V100ACNT:
@@ -366,7 +366,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x5a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x5a);
/*
* V085ACNT:
@@ -375,7 +375,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
void power_board_handle_host_sleep_event(enum host_sleep_event state)
@@ -394,12 +394,12 @@ static void board_pmic_init(void)
return;
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x04);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3e, 0x04);
board_pmic_disable_slp_s0_vr_decay();
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x1f);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3b, 0x1f);
}
DECLARE_DEFERRED(board_pmic_init);
@@ -535,7 +535,7 @@ void board_hibernate(void)
uart_flush_output();
/* Trigger PMIC shutdown. */
- if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x01)) {
+ if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -611,7 +611,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -637,7 +637,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -664,7 +664,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -747,17 +747,17 @@ int board_has_working_reset_flags(void)
#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
static timestamp_t battery_last_i2c_time;
-static int is_battery_i2c__7bf(const int port, const uint16_t slave_addr__7bf)
+static int is_battery_i2c(const int port, const uint16_t slave_addr_flags)
{
return (port == I2C_PORT_BATTERY)
- && (slave_addr__7bf == BATTERY_ADDR__7bf);
+ && (slave_addr_flags == BATTERY_ADDR_FLAGS);
}
-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)
{
unsigned int time_delta_us;
- if (!is_battery_i2c__7bf(port, slave_addr__7bf))
+ if (!is_battery_i2c(port, slave_addr_flags))
return;
time_delta_us = time_since32(battery_last_i2c_time);
@@ -767,9 +767,9 @@ void i2c_start_xfer_notify__7bf(const int port, const uint16_t slave_addr__7bf)
usleep(BATTERY_FREE_MIN_DELTA_US - time_delta_us);
}
-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)
{
- if (!is_battery_i2c__7bf(port, slave_addr__7bf))
+ if (!is_battery_i2c(port, slave_addr_flags))
return;
battery_last_i2c_time = get_time();
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index ff5a4c586e..30b21ef9f1 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -181,8 +181,8 @@
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992__7bf 0x30
-#define I2C_ADDR_MP2949__7bf 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
#ifndef __ASSEMBLER__
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 5df9e338ed..faf18c359f 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -190,7 +190,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ALS_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -213,7 +213,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ALS_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 1000, /* dps */
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -229,7 +229,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ALS_GYRO,
- .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = OPT3001_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
/* scale = 43.4513 http://b/111528815#comment14 */
.default_range = 0x2b11a1,
@@ -287,12 +287,12 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, enable_sensor_irqs, HOOK_PRIO_DEFAULT);
struct ppc_config_t ppc_chips[] = {
{
.i2c_port = I2C_PORT_USB_C0,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
{
.i2c_port = I2C_PORT_USB_C1,
- .i2c_addr__7bf = SN5S330_ADDR0__7bf,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv,
},
};
@@ -303,7 +303,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_USB_C0,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &tcpci_tcpm_drv,
},
@@ -311,7 +311,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_USB_C1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &tcpci_tcpm_drv,
},
@@ -342,7 +342,7 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
static void imvp8_tune_deferred(void)
{
/* For the IMVP8, reduce the steps during decay from 3 to 1. */
- if (i2c_write16__7bf(I2C_PORT_POWER, I2C_ADDR_MP2949__7bf,
+ if (i2c_write16(I2C_PORT_POWER, I2C_ADDR_MP2949_FLAGS,
0xFA, 0x0AC5))
CPRINTS("Failed to change step decay!");
}
@@ -401,7 +401,7 @@ void board_hibernate(void)
system_enter_psl_mode();
/* Cut off DSW power via the ROP PMIC. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x1);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x49, 0x1);
/* Wait for power to be cut. */
while (1)
@@ -451,7 +451,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x3a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x3a);
/*
* V18ACNT:
@@ -460,7 +460,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x2a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x2a);
/*
* V100ACNT:
@@ -469,7 +469,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x1a);
/*
* V085ACNT:
@@ -478,7 +478,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x2a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x2a);
}
static void board_pmic_enable_slp_s0_vr_decay(void)
@@ -490,7 +490,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x7a);
/*
* V18ACNT:
@@ -499,7 +499,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x6a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x6a);
/*
* V100ACNT:
@@ -508,7 +508,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x5a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x5a);
/*
* V085ACNT:
@@ -517,7 +517,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x6a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x6a);
}
void power_board_handle_host_sleep_event(enum host_sleep_event state)
@@ -533,16 +533,16 @@ static void board_pmic_init(void)
int pgmask1;
/* Mask V5A_DS3_PG from PMIC PGMASK1. */
- if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
0x18, &pgmask1))
return;
pgmask1 |= BIT(2);
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x18, pgmask1);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x18, pgmask1);
board_pmic_disable_slp_s0_vr_decay();
/* Enable active discharge (100 ohms) on V33A_PCH and V1.8A. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3D, 0x5);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3D, 0x5);
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
@@ -633,7 +633,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -643,19 +643,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, BIT(4));
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, pwrstat1);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
diff --git a/board/nocturne/board.h b/board/nocturne/board.h
index d678f70a3e..3186090f20 100644
--- a/board/nocturne/board.h
+++ b/board/nocturne/board.h
@@ -93,7 +93,7 @@
#define CONFIG_ALS
#define ALS_COUNT 1
#define CONFIG_ALS_OPT3001
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
#define CONFIG_ACCEL_FIFO 512 /* Must be a power of 2 */
/* Depends on how fast the AP boots and typical ODRs */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
@@ -175,8 +175,8 @@
#define GPIO_USB_C1_SCL GPIO_EC_I2C2_USB_C1_SCL
#define GPIO_USB_C1_SDA GPIO_EC_I2C2_USB_C1_SDA
-#define I2C_ADDR_MP2949__7bf 0x20
-#define I2C_ADDR_BD99992__7bf 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
/*
* Remapping of schematic GPIO names to common GPIO names expected (hardcoded)
diff --git a/board/nucleo-f411re/board.c b/board/nucleo-f411re/board.c
index d2f587321f..adaed9e3de 100644
--- a/board/nucleo-f411re/board.c
+++ b/board/nucleo-f411re/board.c
@@ -75,7 +75,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = NULL,
.default_range = 2, /* g, enough for laptop. */
.config = {
@@ -102,7 +102,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = NULL,
},
diff --git a/board/oak/battery.c b/board/oak/battery.c
index 25d6b6e46d..fffd2f7763 100644
--- a/board/oak/battery.c
+++ b/board/oak/battery.c
@@ -57,9 +57,9 @@ static int cutoff(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
buf, 3, NULL, 0, I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
buf, 3, NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
diff --git a/board/oak/board.c b/board/oak/board.c
index 2f0046fac6..2cc9b23457 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -117,7 +117,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
+ .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS,
},
.drv = &tcpci_tcpm_drv,
},
@@ -125,7 +125,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF + 1,
+ .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS + 1,
},
.drv = &tcpci_tcpm_drv,
},
@@ -647,7 +647,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(0),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(0),
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -671,7 +671,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(0),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(0),
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -689,7 +689,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
diff --git a/board/oak/board.h b/board/oak/board.h
index bc1e71c98f..14f8e5788f 100644
--- a/board/oak/board.h
+++ b/board/oak/board.h
@@ -160,7 +160,7 @@
#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI master port (SPI2) */
/* Ambient Light Sensor address */
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
/* Timer selection */
#define TIM_CLOCK32 2
diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c
index e2e6bc63b6..d9462f4e1d 100644
--- a/board/pdeval-stm32f072/board.c
+++ b/board/pdeval-stm32f072/board.c
@@ -62,7 +62,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = AN7447_TCPC3_I2C_ADDR__7bf,
+ .addr_flags = AN7447_TCPC3_I2C_ADDR_FLAGS,
},
.drv = &anx7447_tcpm_drv,
},
diff --git a/board/phaser/board.c b/board/phaser/board.c
index 353eeed9e5..a0097f2d8f 100644
--- a/board/phaser/board.c
+++ b/board/phaser/board.c
@@ -120,7 +120,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_lis2dh_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LIS2DH_ADDR1__7bf,
+ .i2c_spi_addr_flags = LIS2DH_ADDR1_FLAGS,
.rot_standard_ref = &standard_rot_ref,
/* We only use 2g because its resolution is only 8-bits */
.default_range = 2, /* g */
@@ -151,7 +151,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &standard_rot_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -183,7 +183,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &standard_rot_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/board/plankton/board.c b/board/plankton/board.c
index 886e8776ef..dbb3ff62b2 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -467,7 +467,7 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* 8-bit address */
-#define SN75DP130_I2C_ADDR__7bf 0x2e
+#define SN75DP130_I2C_ADDR_FLAGS 0x2e
/*
* Pin number for active-high reset from PCA9534 to CMOS pull-down to
* SN75DP130's RSTN (active-low)
@@ -476,7 +476,7 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
static int sn75dp130_i2c_write(uint8_t index, uint8_t value)
{
- return i2c_write8__7bf(I2C_PORT_MASTER, SN75DP130_I2C_ADDR__7bf,
+ return i2c_write8(I2C_PORT_MASTER, SN75DP130_I2C_ADDR_FLAGS,
index, value);
}
@@ -490,16 +490,16 @@ static int sn75dp130_reset(void)
{
int rv;
- rv = pca9534_config_pin__7bf(I2C_PORT_MASTER, 0x20,
+ rv = pca9534_config_pin(I2C_PORT_MASTER, 0x20,
REDRIVER_RST_PIN, PCA9534_OUTPUT);
/* Assert (its active high) */
- rv |= pca9534_set_level__7bf(I2C_PORT_MASTER, 0x20,
+ rv |= pca9534_set_level(I2C_PORT_MASTER, 0x20,
REDRIVER_RST_PIN, 1);
/* datasheet recommends > 100usec */
usleep(200);
/* De-assert */
- rv |= pca9534_set_level__7bf(I2C_PORT_MASTER, 0x20,
+ rv |= pca9534_set_level(I2C_PORT_MASTER, 0x20,
REDRIVER_RST_PIN, 0);
/* datasheet recommends > 400msec */
usleep(450 * MSEC);
@@ -596,11 +596,11 @@ int board_in_hub_mode(void)
int ret;
int level;
- ret = pca9534_config_pin__7bf(I2C_PORT_MASTER, 0x20,
+ ret = pca9534_config_pin(I2C_PORT_MASTER, 0x20,
6, PCA9534_INPUT);
if (ret)
return -1;
- ret = pca9534_get_level__7bf(I2C_PORT_MASTER, 0x20,
+ ret = pca9534_get_level(I2C_PORT_MASTER, 0x20,
6, &level);
if (ret)
return -1;
@@ -611,16 +611,16 @@ static int board_usb_hub_reset(void)
{
int ret;
- ret = pca9534_config_pin__7bf(I2C_PORT_MASTER, 0x20,
+ ret = pca9534_config_pin(I2C_PORT_MASTER, 0x20,
7, PCA9534_OUTPUT);
if (ret)
return ret;
- ret = pca9534_set_level__7bf(I2C_PORT_MASTER, 0x20,
+ ret = pca9534_set_level(I2C_PORT_MASTER, 0x20,
7, 0);
if (ret)
return ret;
usleep(100 * MSEC);
- return pca9534_set_level__7bf(I2C_PORT_MASTER, 0x20,
+ return pca9534_set_level(I2C_PORT_MASTER, 0x20,
7, 1);
}
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 90e56b6fa8..a6125ff3c6 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -193,7 +193,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -201,7 +201,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -291,7 +291,7 @@ void board_tcpc_init(void)
*
* NOTE: PS8751 A3 will wake on any I2C access.
*/
- i2c_read8__7bf(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
+ i2c_read8(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
/* Enable TCPC interrupts */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -358,7 +358,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -368,19 +368,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, BIT(4));
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, pwrstat1);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
@@ -399,7 +399,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x3a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x3a);
/*
* V18ACNT:
@@ -408,7 +408,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x2a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x2a);
/*
* V100ACNT:
@@ -417,7 +417,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x1a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x1a);
/*
* V085ACNT:
@@ -426,7 +426,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x3a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x3a);
}
static void board_pmic_enable_slp_s0_vr_decay(void)
@@ -438,7 +438,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x7a);
/*
* V18ACNT:
@@ -447,7 +447,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x6a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x6a);
/*
* V100ACNT:
@@ -456,7 +456,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x37, 0x5a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x37, 0x5a);
/*
* V085ACNT:
@@ -465,7 +465,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
void power_board_handle_host_sleep_event(enum host_sleep_event state)
@@ -484,15 +484,15 @@ static void board_pmic_init(void)
return;
/* DISCHGCNT3 - enable 100 ohm discharge on V1.00A */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x04);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3e, 0x04);
board_pmic_disable_slp_s0_vr_decay();
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x1f);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3b, 0x1f);
/* Disable power button shutdown timer. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x14, 0x00);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x14, 0x00);
}
DECLARE_DEFERRED(board_pmic_init);
@@ -656,7 +656,7 @@ void board_hibernate(void)
uart_flush_output();
/* Trigger PMIC shutdown. */
- if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf,
+ if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
@@ -751,7 +751,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -775,7 +775,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -792,7 +792,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -807,7 +807,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ALS,
- .i2c_spi_addr__7bf = OPT3001_I2C_ADDR__7bf,
+ .i2c_spi_addr_flags = OPT3001_I2C_ADDR_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1; uscale = 0 */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/poppy/board.h b/board/poppy/board.h
index fc8a7c255c..36055bb1cc 100644
--- a/board/poppy/board.h
+++ b/board/poppy/board.h
@@ -115,7 +115,7 @@
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define ALS_COUNT 1
-#define OPT3001_I2C_ADDR__7bf OPT3001_I2C_ADDR1__7bf
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_BD99992GW
#define CONFIG_THERMISTOR_NCP15WB
@@ -128,7 +128,7 @@
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
-#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
+#define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS
#define CONFIG_MAG_CALIBRATE
/* Lower maximal ODR to 100Hz */
#define CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ 100000
@@ -192,8 +192,8 @@
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992__7bf 0x30
-#define I2C_ADDR_MP2949__7bf 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
#ifndef __ASSEMBLER__
diff --git a/board/rainier/board.c b/board/rainier/board.c
index 8173414bf7..39da51f73d 100644
--- a/board/rainier/board.c
+++ b/board/rainier/board.c
@@ -131,7 +131,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = FUSB302_I2C_SLAVE_ADDR__7bf,
+ .addr_flags = FUSB302_I2C_SLAVE_ADDR_FLAGS,
},
.drv = &fusb302_tcpm_drv,
},
@@ -377,7 +377,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -400,7 +400,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -422,7 +422,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bmp280_drv,
.drv_data = &bmp280_drv_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
.default_range = BIT(18), /* 1bit = 4 Pa, 16bit ~= 2600 hPa */
.min_frequency = BMP280_BARO_MIN_FREQ,
.max_frequency = BMP280_BARO_MAX_FREQ,
diff --git a/board/rammus/board.c b/board/rammus/board.c
index 82af7a2667..6ba7907346 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -151,7 +151,7 @@ struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -160,7 +160,7 @@ struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.i2c_info = {
.port = I2C_PORT_TCPC0,
/* Verified on v1.1 */
- .addr__7bf = AN7447_TCPC3_I2C_ADDR__7bf,
+ .addr_flags = AN7447_TCPC3_I2C_ADDR_FLAGS,
},
.drv = &anx7447_tcpm_drv,
},
@@ -298,7 +298,7 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, &vrfault)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
!= EC_SUCCESS)
return;
@@ -308,19 +308,19 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, &pwrstat1);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, &pwrstat1);
/* PWRSTAT2 */
- i2c_read8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, &pwrstat2);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
pwrstat2);
/* Clear all faults -- Write 1 to clear. */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x8, BIT(4));
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x16, pwrstat1);
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x17, pwrstat2);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, BIT(4));
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x16, pwrstat1);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x17, pwrstat2);
/*
* Status of the fault registers can be checked in the OS by looking at
@@ -339,7 +339,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x3a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x3a);
/*
* V18ACNT:
@@ -348,7 +348,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x2a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x2a);
/*
* V085ACNT:
@@ -357,7 +357,7 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x3a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x3a);
}
static void board_pmic_enable_slp_s0_vr_decay(void)
@@ -369,7 +369,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x30, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x30, 0x7a);
/*
* V18ACNT:
@@ -378,7 +378,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x34, 0x6a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x34, 0x6a);
/*
* V085ACNT:
@@ -387,7 +387,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x38, 0x7a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
void power_board_handle_host_sleep_event(enum host_sleep_event state)
@@ -409,16 +409,16 @@ static void board_pmic_init(void)
* DISCHGCNT2 - enable 100 ohm discharge on
* V5A_DS3/V33A_DSW/V33A_PCH/V1.8A
*/
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3d, 0x55);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3d, 0x55);
/* DISCHGCNT3 - enable 100 ohm discharge on V1.8U_25U/V1.00A */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3e, 0x44);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3e, 0x44);
/* DISCHGCNT4 - enable 100 ohm discharge on v1.8S */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3f, 0x04);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3f, 0x04);
board_pmic_disable_slp_s0_vr_decay();
/* VRMODECTRL - disable low-power mode for all rails */
- i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x3b, 0x1f);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x3b, 0x1f);
}
DECLARE_DEFERRED(board_pmic_init);
@@ -544,7 +544,7 @@ void board_hibernate(void)
uart_flush_output();
/* Trigger PMIC shutdown. */
- if (i2c_write8__7bf(I2C_PORT_PMIC, I2C_ADDR_BD99992__7bf, 0x49, 0x01)) {
+ if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -602,7 +602,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMA2x2_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.min_frequency = BMA255_ACCEL_MIN_FREQ,
.max_frequency = BMA255_ACCEL_MAX_FREQ,
@@ -630,7 +630,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
@@ -658,7 +658,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/rammus/board.h b/board/rammus/board.h
index 5d577be79d..da73f7acd4 100644
--- a/board/rammus/board.h
+++ b/board/rammus/board.h
@@ -187,9 +187,9 @@
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992__7bf 0x30
-#define I2C_ADDR_MP2949__7bf 0x20
-#define I2C_ADDR_EEPROM__7bf 0x50
+#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Rename GPIOs */
#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
diff --git a/board/reef/board.c b/board/reef/board.c
index ea9e8e9e43..8a73f6c3c7 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -167,7 +167,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
.i2c_test = &anx74xx_i2c_stress_test_dev,
},
#endif
@@ -176,7 +176,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = NPCX_I2C_PORT0_1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
.i2c_test = &ps8xxx_i2c_stress_test_dev,
},
#endif
@@ -185,7 +185,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_GYRO,
- .addr__7bf = BMI160_ADDR0__7bf,
+ .addr_flags = BMI160_ADDR0_FLAGS,
.i2c_test = &bmi160_i2c_stress_test_dev,
},
#endif
@@ -194,19 +194,19 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_BARO,
- .addr__7bf = BMP280_I2C_ADDRESS1__7bf,
+ .addr_flags = BMP280_I2C_ADDRESS1_FLAGS,
.i2c_test = &bmp280_i2c_stress_test_dev,
},
{
.port = I2C_PORT_LID_ACCEL,
- .addr__7bf = KX022_ADDR1__7bf,
+ .addr_flags = KX022_ADDR1_FLAGS,
.i2c_test = &kionix_i2c_stress_test_dev,
},
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ALS
{
.port = I2C_PORT_ALS,
- .addr__7bf = OPT3001_I2C_ADDR1__7bf,
+ .addr_flags = OPT3001_I2C_ADDR1_FLAGS,
.i2c_test = &opt3001_i2c_stress_test_dev,
},
#endif
@@ -231,7 +231,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_0,
- .addr__7bf = ANX74XX_I2C_ADDR1__7bf,
+ .addr_flags = ANX74XX_I2C_ADDR1_FLAGS,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -239,7 +239,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = NPCX_I2C_PORT0_1,
- .addr__7bf = PS8751_I2C_ADDR1__7bf,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -367,7 +367,7 @@ void board_tcpc_init(void)
*
* NOTE: PS8751 A3 will wake on any I2C access.
*/
- i2c_read8__7bf(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
+ i2c_read8(NPCX_I2C_PORT0_1, 0x08, 0xA0, &reg);
/* Enable TCPC0 interrupt */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -715,7 +715,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_LID_ACCEL,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -742,7 +742,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -771,7 +771,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -787,7 +787,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -802,7 +802,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bmp280_drv,
.drv_data = &bmp280_drv_data,
.port = I2C_PORT_BARO,
- .i2c_spi_addr__7bf = BMP280_I2C_ADDRESS1__7bf,
+ .i2c_spi_addr_flags = BMP280_I2C_ADDRESS1_FLAGS,
.default_range = BIT(18), /* 1bit = 4 Pa, 16bit ~= 2600 hPa */
.min_frequency = BMP280_BARO_MIN_FREQ,
.max_frequency = BMP280_BARO_MAX_FREQ,
@@ -816,7 +816,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ALS,
- .i2c_spi_addr__7bf = OPT3001_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = OPT3001_I2C_ADDR1_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1; uscale = 0 */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/reef/board.h b/board/reef/board.h
index 245ccaf7e4..d3493e347f 100644
--- a/board/reef/board.h
+++ b/board/reef/board.h
@@ -196,7 +196,7 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_MAG_BMI160_BMM150
-#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
+#define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
#define CONFIG_ALS_OPT3001
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index 206d6dd1d0..3b90eb4934 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -283,7 +283,7 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = MCHP_I2C_PORT0,
- .addr__7bf = 0x28,
+ .addr_flags = 0x28,
.i2c_test = &anx74xx_i2c_stress_test_dev,
},
#endif
@@ -291,33 +291,33 @@ struct i2c_stress_test i2c_stress_tests[] = {
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
{
.port = MCHP_I2C_PORT2,
- .addr__7bf = 0x0B,
+ .addr_flags = 0x0B,
.i2c_test = &ps8xxx_i2c_stress_test_dev,
},
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_GYRO,
- .addr__7bf = BMI160_ADDR0__7bf,
+ .addr_flags = BMI160_ADDR0_FLAGS,
.i2c_test = &bmi160_i2c_stress_test_dev,
},
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
{
.port = I2C_PORT_BARO,
- .addr__7bf = BMP280_I2C_ADDRESS1__7bf,
+ .addr_flags = BMP280_I2C_ADDRESS1_FLAGS,
.i2c_test = &bmp280_i2c_stress_test_dev,
},
{
.port = I2C_PORT_LID_ACCEL,
- .addr__7bf = KX022_ADDR1__7bf,
+ .addr_flags = KX022_ADDR1_FLAGS,
.i2c_test = &kionix_i2c_stress_test_dev,
},
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_ALS
{
.port = I2C_PORT_ALS,
- .addr__7bf = OPT3001_I2C_ADDR1__7bf,
+ .addr_flags = OPT3001_I2C_ADDR1_FLAGS,
.i2c_test = &opt3001_i2c_stress_test_dev,
},
#endif
@@ -342,7 +342,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = MCHP_I2C_PORT0,
- .addr__7bf = 0x28,
+ .addr_flags = 0x28,
},
.drv = &anx74xx_tcpm_drv,
},
@@ -350,7 +350,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = MCHP_I2C_PORT2,
- .addr__7bf = 0x0B,
+ .addr_flags = 0x0B,
},
.drv = &ps8xxx_tcpm_drv,
},
@@ -513,7 +513,7 @@ void board_tcpc_init(void)
* address 0x10. Is this another attempt at waking PS8751
* from DRP low power idle mode?
*/
- i2c_read8__7bf(MCHP_I2C_PORT2, 0x08, 0xA0, &reg);
+ i2c_read8(MCHP_I2C_PORT2, 0x08, 0xA0, &reg);
/* Enable TCPC0 interrupt */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -961,7 +961,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_LID_ACCEL,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -988,7 +988,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -1017,7 +1017,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
@@ -1033,7 +1033,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = I2C_PORT_GYRO,
- .i2c_spi_addr__7bf = BMI160_ADDR0__7bf,
+ .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = BIT(11), /* 16LSB / uT, fixed */
.rot_standard_ref = &mag_standard_ref,
.min_frequency = BMM150_MAG_MIN_FREQ,
@@ -1048,7 +1048,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bmp280_drv,
.drv_data = &bmp280_drv_data,
.port = I2C_PORT_BARO,
- .i2c_spi_addr__7bf = BMP280_I2C_ADDRESS1__7bf,
+ .i2c_spi_addr_flags = BMP280_I2C_ADDRESS1_FLAGS,
.default_range = BIT(18), /* 1bit = 4 Pa, 16bit ~= 2600 hPa */
.min_frequency = BMP280_BARO_MIN_FREQ,
.max_frequency = BMP280_BARO_MAX_FREQ,
@@ -1062,7 +1062,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &opt3001_drv,
.drv_data = &g_opt3001_data,
.port = I2C_PORT_ALS,
- .i2c_spi_addr__7bf = OPT3001_I2C_ADDR1__7bf,
+ .i2c_spi_addr_flags = OPT3001_I2C_ADDR1_FLAGS,
.rot_standard_ref = NULL,
.default_range = 0x10000, /* scale = 1; uscale = 0 */
.min_frequency = OPT3001_LIGHT_MIN_FREQ,
diff --git a/board/reef_mchp/board.h b/board/reef_mchp/board.h
index 7c4189e4b5..3befb5bf05 100644
--- a/board/reef_mchp/board.h
+++ b/board/reef_mchp/board.h
@@ -203,7 +203,7 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_MAG_BMI160_BMM150
-#define CONFIG_ACCELGYRO_SEC_ADDR__7BF BMM150_ADDR0__7bf
+#define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
#define CONFIG_ALS_OPT3001
diff --git a/board/samus/battery.c b/board/samus/battery.c
index e21f51e3b5..bc73cbc1c3 100644
--- a/board/samus/battery.c
+++ b/board/samus/battery.c
@@ -290,9 +290,9 @@ int board_cut_off_battery(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
buf, 3, NULL, 0, I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
buf, 3, NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
diff --git a/board/samus/board.c b/board/samus/board.c
index 323789a7a3..02b80940f8 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -132,35 +132,35 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-#define TEMP_U40_REG_ADDR__7bf (0x40 | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U41_REG_ADDR__7bf (0x44 | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U42_REG_ADDR__7bf (0x41 | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U43_REG_ADDR__7bf (0x45 | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U115_REG_ADDR__7bf (0x42 | I2C_FLAG_BIG_ENDIAN)
-#define TEMP_U116_REG_ADDR__7bf (0x43 | I2C_FLAG_BIG_ENDIAN)
-
-#define TEMP_U40_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
- TEMP_U40_REG_ADDR__7bf)
-#define TEMP_U41_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
- TEMP_U41_REG_ADDR__7bf)
-#define TEMP_U42_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
- TEMP_U42_REG_ADDR__7bf)
-#define TEMP_U43_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
- TEMP_U43_REG_ADDR__7bf)
-#define TEMP_U115_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
- TEMP_U115_REG_ADDR__7bf)
-#define TEMP_U116_ADDR__7bf TMP006_ADDR__7bf(I2C_PORT_THERMAL,\
- TEMP_U116_REG_ADDR__7bf)
-
-const struct tmp006_t tmp006_sensors__7bf[TMP006_COUNT] = {
- {"Charger", TEMP_U40_ADDR__7bf},
- {"CPU", TEMP_U41_ADDR__7bf},
- {"Left C", TEMP_U42_ADDR__7bf},
- {"Right C", TEMP_U43_ADDR__7bf},
- {"Right D", TEMP_U115_ADDR__7bf},
- {"Left D", TEMP_U116_ADDR__7bf},
+#define TEMP_U40_REG_ADDR_FLAGS (0x40 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U41_REG_ADDR_FLAGS (0x44 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U42_REG_ADDR_FLAGS (0x41 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U43_REG_ADDR_FLAGS (0x45 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U115_REG_ADDR_FLAGS (0x42 | I2C_FLAG_BIG_ENDIAN)
+#define TEMP_U116_REG_ADDR_FLAGS (0x43 | I2C_FLAG_BIG_ENDIAN)
+
+#define TEMP_U40_ADDR_FLAGS TMP006_ADDR(I2C_PORT_THERMAL,\
+ TEMP_U40_REG_ADDR_FLAGS)
+#define TEMP_U41_ADDR_FLAGS TMP006_ADDR(I2C_PORT_THERMAL,\
+ TEMP_U41_REG_ADDR_FLAGS)
+#define TEMP_U42_ADDR_FLAGS TMP006_ADDR(I2C_PORT_THERMAL,\
+ TEMP_U42_REG_ADDR_FLAGS)
+#define TEMP_U43_ADDR_FLAGS TMP006_ADDR(I2C_PORT_THERMAL,\
+ TEMP_U43_REG_ADDR_FLAGS)
+#define TEMP_U115_ADDR_FLAGS TMP006_ADDR(I2C_PORT_THERMAL,\
+ TEMP_U115_REG_ADDR_FLAGS)
+#define TEMP_U116_ADDR_FLAGS TMP006_ADDR(I2C_PORT_THERMAL,\
+ TEMP_U116_REG_ADDR_FLAGS)
+
+const struct tmp006_t tmp006_sensors[TMP006_COUNT] = {
+ {"Charger", TEMP_U40_ADDR_FLAGS},
+ {"CPU", TEMP_U41_ADDR_FLAGS},
+ {"Left C", TEMP_U42_ADDR_FLAGS},
+ {"Right C", TEMP_U43_ADDR_FLAGS},
+ {"Right D", TEMP_U115_ADDR_FLAGS},
+ {"Left D", TEMP_U116_ADDR_FLAGS},
};
-BUILD_ASSERT(ARRAY_SIZE(tmp006_sensors__7bf) == TMP006_COUNT);
+BUILD_ASSERT(ARRAY_SIZE(tmp006_sensors) == TMP006_COUNT);
/* Temperature sensors data; must be in same order as enum temp_sensor_id. */
const struct temp_sensor_t temp_sensors[] = {
@@ -332,7 +332,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_saved_data[0],
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = LSM6DS0_ADDR1__7bf,
+ .i2c_spi_addr_flags = LSM6DS0_ADDR1_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = LSM6DS0_ACCEL_MIN_FREQ,
@@ -364,7 +364,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kxcj9_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = KXCJ9_ADDR0__7bf,
+ .i2c_spi_addr_flags = KXCJ9_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KXCJ9_ACCEL_MIN_FREQ,
@@ -387,7 +387,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_saved_data[1],
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = LSM6DS0_ADDR1__7bf,
+ .i2c_spi_addr_flags = LSM6DS0_ADDR1_FLAGS,
.rot_standard_ref = NULL,
.default_range = 2000, /* g, enough for laptop. */
.min_frequency = LSM6DS0_GYRO_MIN_FREQ,
diff --git a/board/samus/extpower.c b/board/samus/extpower.c
index cddb4a76e1..22cd13b44d 100644
--- a/board/samus/extpower.c
+++ b/board/samus/extpower.c
@@ -159,7 +159,7 @@ static void allow_max_request(void)
int prochot_status;
if (charge_circuit_state == CHARGE_CIRCUIT_WEDGED) {
/* Read PROCHOT status register to clear it */
- i2c_read8__7bf(I2C_PORT_CHARGER, BQ24773_ADDR__7bf,
+ i2c_read8(I2C_PORT_CHARGER, BQ24773_ADDR_FLAGS,
BQ24773_PROCHOT_STATUS, &prochot_status);
charge_circuit_state = CHARGE_CIRCUIT_OK;
}
@@ -301,8 +301,8 @@ static void check_charge_wedged(void)
if (charge_circuit_state == CHARGE_CIRCUIT_OK) {
/* Check PROCHOT warning */
- rv = i2c_read8__7bf(I2C_PORT_CHARGER, BQ24773_ADDR__7bf,
- BQ24773_PROCHOT_STATUS, &prochot_status);
+ rv = i2c_read8(I2C_PORT_CHARGER, BQ24773_ADDR_FLAGS,
+ BQ24773_PROCHOT_STATUS, &prochot_status);
if (rv)
prochot_status = 0;
diff --git a/board/samus/panel.c b/board/samus/panel.c
index 0c60b2a492..beb0d32e9d 100644
--- a/board/samus/panel.c
+++ b/board/samus/panel.c
@@ -15,7 +15,7 @@
#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
-#define I2C_ADDR_BACKLIGHT__7bf (0x2C | I2C_FLAG_BIG_ENDIAN)
+#define I2C_ADDR_BACKLIGHT_FLAGS (0x2C | I2C_FLAG_BIG_ENDIAN)
#define I2C_RETRIES 3
#define I2C_RETRY_DELAY (5*MSEC)
@@ -61,8 +61,8 @@ static int lp8555_read_with_retry(int reg, int *data)
int i, rv;
for (i = 0; i < I2C_RETRIES; i++) {
- rv = i2c_read8__7bf(I2C_PORT_BACKLIGHT,
- I2C_ADDR_BACKLIGHT__7bf,
+ rv = i2c_read8(I2C_PORT_BACKLIGHT,
+ I2C_ADDR_BACKLIGHT_FLAGS,
reg, data);
if (rv == EC_SUCCESS)
return EC_SUCCESS;
@@ -79,8 +79,8 @@ static int lp8555_write_with_retry(int reg, int data)
int i, rv;
for (i = 0; i < I2C_RETRIES; i++) {
- rv = i2c_write8__7bf(I2C_PORT_BACKLIGHT,
- I2C_ADDR_BACKLIGHT__7bf,
+ rv = i2c_write8(I2C_PORT_BACKLIGHT,
+ I2C_ADDR_BACKLIGHT_FLAGS,
reg, data);
if (rv == EC_SUCCESS)
return EC_SUCCESS;
diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h
index 032e0bf0f2..075e531e35 100644
--- a/board/samus_pd/board.h
+++ b/board/samus_pd/board.h
@@ -89,7 +89,7 @@
/* slave address for host commands */
#ifdef HAS_TASK_HOSTCMD
-#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF CONFIG_USB_PD_I2C_SLAVE_ADDR__7BF
+#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS CONFIG_USB_PD_I2C_SLAVE_ADDR_FLAGS
#endif
#ifndef __ASSEMBLER__
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 061e2d62dc..1ba595479b 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -127,7 +127,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC0,
- .addr__7bf = FUSB302_I2C_SLAVE_ADDR__7bf,
+ .addr_flags = FUSB302_I2C_SLAVE_ADDR_FLAGS,
},
.drv = &fusb302_tcpm_drv,
},
@@ -401,7 +401,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = BMI160_ACCEL_MIN_FREQ,
@@ -424,7 +424,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr__7bf = SLAVE_MK_SPI_ADDR__7bf(CONFIG_SPI_ACCEL_PORT),
+ .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index a9bc49fdc9..5187ac4eb8 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -174,7 +174,7 @@
#define I2C_PORT_TCPC0 1
/* Route sbs host requests to virtual battery driver */
-#define VIRTUAL_BATTERY_ADDR__7bf 0x0B
+#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
/* Enable Accel over SPI */
#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
diff --git a/board/servo_micro/board.c b/board/servo_micro/board.c
index b5384ba8ca..0c966176fc 100644
--- a/board/servo_micro/board.c
+++ b/board/servo_micro/board.c
@@ -248,8 +248,8 @@ DECLARE_CONSOLE_COMMAND(baud, command_uart_baud,
* enable_ite_dfu stops working, or does not work on a new ITE EC chip revision.
*/
-#define ITE_DFU_I2C_CMD_ADDR__7bf 0x5A
-#define ITE_DFU_I2C_DATA_ADDR__7bf 0x35
+#define ITE_DFU_I2C_CMD_ADDR_FLAGS 0x5A
+#define ITE_DFU_I2C_DATA_ADDR_FLAGS 0x35
#define SMCLK_WAVEFORM_PERIOD_HZ (100 * KHz)
#define SMDAT_WAVEFORM_PERIOD_HZ (200 * KHz)
@@ -287,15 +287,15 @@ static int ite_i2c_read_register(uint8_t register_offset, uint8_t *output)
*/
int ret;
/* Tell the ITE EC which register we want to read. */
- ret = i2c_xfer_unlocked__7bf(I2C_PORT_MASTER,
- ITE_DFU_I2C_CMD_ADDR__7bf,
+ ret = i2c_xfer_unlocked(I2C_PORT_MASTER,
+ ITE_DFU_I2C_CMD_ADDR_FLAGS,
&register_offset, sizeof(register_offset),
NULL, 0, I2C_XFER_SINGLE);
if (ret != EC_SUCCESS)
return ret;
/* Read in the 1 byte register value. */
- ret = i2c_xfer_unlocked__7bf(I2C_PORT_MASTER,
- ITE_DFU_I2C_DATA_ADDR__7bf,
+ ret = i2c_xfer_unlocked(I2C_PORT_MASTER,
+ ITE_DFU_I2C_DATA_ADDR_FLAGS,
NULL, 0,
output, sizeof(*output), I2C_XFER_SINGLE);
return ret;
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c
index b26d86abf6..0d5abc58e2 100644
--- a/board/servo_v4/board.c
+++ b/board/servo_v4/board.c
@@ -211,7 +211,7 @@ int usb_i2c_board_is_enabled(void) { return 1; }
/*
* Support tca6416 I2C ioexpander.
*/
-#define GPIOX_I2C_ADDR__7bf 0x20
+#define GPIOX_I2C_ADDR_FLAGS 0x20
#define GPIOX_IN_PORT_A 0x0
#define GPIOX_IN_PORT_B 0x1
#define GPIOX_OUT_PORT_A 0x2
@@ -226,13 +226,13 @@ static void write_ioexpander(int bank, int gpio, int val)
int tmp;
/* Read output port register */
- i2c_read8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A + bank, &tmp);
+ i2c_read8(1, GPIOX_I2C_ADDR_FLAGS, GPIOX_OUT_PORT_A + bank, &tmp);
if (val)
tmp |= BIT(gpio);
else
tmp &= ~BIT(gpio);
/* Write back modified output port register */
- i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A + bank, tmp);
+ i2c_write8(1, GPIOX_I2C_ADDR_FLAGS, GPIOX_OUT_PORT_A + bank, tmp);
}
/* Read a single GPIO input on the tca6416 I2C ioexpander. */
@@ -242,7 +242,7 @@ static int read_ioexpander_bit(int bank, int bit)
int mask = 1 << bit;
/* Read input port register */
- i2c_read8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_IN_PORT_A + bank, &tmp);
+ i2c_read8(1, GPIOX_I2C_ADDR_FLAGS, GPIOX_IN_PORT_A + bank, &tmp);
return (tmp & mask) >> bit;
}
@@ -271,15 +271,15 @@ static void init_usb3_port(void)
static void init_ioexpander(void)
{
/* Write all GPIO to output 0 */
- i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_A, 0x0);
- i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_OUT_PORT_B, 0x0);
+ i2c_write8(1, GPIOX_I2C_ADDR_FLAGS, GPIOX_OUT_PORT_A, 0x0);
+ i2c_write8(1, GPIOX_I2C_ADDR_FLAGS, GPIOX_OUT_PORT_B, 0x0);
/*
* Write GPIO direction: strap resistors to input,
* all others to output.
*/
- i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_DIR_PORT_A, 0x0);
- i2c_write8__7bf(1, GPIOX_I2C_ADDR__7bf, GPIOX_DIR_PORT_B, 0x18);
+ i2c_write8(1, GPIOX_I2C_ADDR_FLAGS, GPIOX_DIR_PORT_A, 0x0);
+ i2c_write8(1, GPIOX_I2C_ADDR_FLAGS, GPIOX_DIR_PORT_B, 0x18);
}
/*
@@ -429,7 +429,7 @@ static void board_init(void)
* Write USB3 Mode to PS8742 USB/DP Mux.
* 0x0:disable 0x20:enable.
*/
- i2c_write8__7bf(1, 0x10, 0x0, 0x0);
+ i2c_write8(1, 0x10, 0x0, 0x0);
/* Enable uservo USB by default. */
init_ioexpander();
diff --git a/board/strago/board.c b/board/strago/board.c
index 8764c4a84b..f63d95da27 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -110,7 +110,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_TCPC,
- .addr__7bf = CONFIG_TCPC_I2C_BASE_ADDR__7BF,
+ .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS,
},
.drv = &tcpci_tcpm_drv,
},
@@ -213,7 +213,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_kxcj9_mutex[0],
.drv_data = &g_kxcj9_data[0],
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = KXCJ9_ADDR1__7bf,
+ .i2c_spi_addr_flags = KXCJ9_ADDR1_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KXCJ9_ACCEL_MIN_FREQ,
@@ -236,7 +236,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_kxcj9_mutex[1],
.drv_data = &g_kxcj9_data[1],
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr__7bf = KXCJ9_ADDR0__7bf,
+ .i2c_spi_addr_flags = KXCJ9_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KXCJ9_ACCEL_MIN_FREQ,
diff --git a/board/sweetberry/board.c b/board/sweetberry/board.c
index 943cb1c1ae..66b21a81b9 100644
--- a/board/sweetberry/board.c
+++ b/board/sweetberry/board.c
@@ -121,6 +121,6 @@ static void board_init(void)
uint8_t tmp;
/* i2c 0 has a tendancy to get wedged. TODO(nsanders): why? */
- i2c_xfer__7bf(0, 0, NULL, 0, &tmp, 1);
+ i2c_xfer(0, 0, NULL, 0, &tmp, 1);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/yorp/board.c b/board/yorp/board.c
index 409914c898..cc44a6c088 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -119,7 +119,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = KX022_ADDR1__7bf,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 4, /* g */
.config = {
@@ -147,7 +147,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
@@ -179,7 +179,7 @@ struct motion_sensor_t motion_sensors[] = {
.int_signal = GPIO_BASE_SIXAXIS_INT_L,
.flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr__7bf = LSM6DSM_ADDR0__7bf,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
diff --git a/chip/g/i2cm.c b/chip/g/i2cm.c
index a7b8f9ad7e..9deed8e66d 100644
--- a/chip/g/i2cm.c
+++ b/chip/g/i2cm.c
@@ -247,7 +247,7 @@ static int i2cm_poll_for_complete(int port)
return EC_ERROR_TIMEOUT;
}
-static uint32_t i2cm_create_inst__7bf(int slave_addr__7bf, int is_write,
+static uint32_t i2cm_create_inst(int slave_addr_flags, int is_write,
size_t size, uint32_t flags)
{
uint32_t inst = 0;
@@ -258,7 +258,7 @@ static uint32_t i2cm_create_inst__7bf(int slave_addr__7bf, int is_write,
* to be included.
*/
inst |= INST_START;
- inst |= INST_DEVADDRVAL(I2C_GET_ADDR__7b(slave_addr__7bf));
+ inst |= INST_DEVADDRVAL(I2C_GET_ADDR(slave_addr_flags));
inst |= INST_RWDEVADDR;
}
@@ -276,7 +276,7 @@ static uint32_t i2cm_create_inst__7bf(int slave_addr__7bf, int is_write,
return inst;
}
-static int i2cm_execute_sequence__7bf(int port, int slave_addr__7bf,
+static int i2cm_execute_sequence(int port, int slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size,
int flags)
@@ -309,7 +309,7 @@ static int i2cm_execute_sequence__7bf(int port, int slave_addr__7bf,
seq_flags &= ~I2C_XFER_STOP;
/* Build sequence instruction */
- inst = i2cm_create_inst__7bf(slave_addr__7bf, is_write,
+ inst = i2cm_create_inst(slave_addr_flags, is_write,
batch_size, seq_flags);
/* If this is a write - copy data into the FIFO. */
@@ -353,7 +353,7 @@ static int i2cm_execute_sequence__7bf(int port, int slave_addr__7bf,
/* Perform an i2c transaction. */
-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)
{
@@ -376,14 +376,14 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
if (out_size) {
/* Process write before read. */
- rv = i2cm_execute_sequence__7bf(port, slave_addr__7bf, out,
+ rv = i2cm_execute_sequence(port, slave_addr_flags, out,
out_size, NULL, 0, flags);
if (rv != EC_SUCCESS)
return rv;
}
if (in_size)
- rv = i2cm_execute_sequence__7bf(port, slave_addr__7bf,
+ rv = i2cm_execute_sequence(port, slave_addr_flags,
NULL, 0, in, in_size, flags);
return rv;
diff --git a/chip/host/i2c.c b/chip/host/i2c.c
index af80926223..28a6f5f158 100644
--- a/chip/host/i2c.c
+++ b/chip/host/i2c.c
@@ -14,7 +14,7 @@
struct i2c_dev {
int port;
- uint16_t slave_addr__7bf;
+ uint16_t slave_addr_flags;
int valid;
};
@@ -28,7 +28,7 @@ static void detach_init(void)
}
DECLARE_HOOK(HOOK_INIT, detach_init, HOOK_PRIO_FIRST);
-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)
{
int i;
@@ -40,20 +40,20 @@ int test_detach_i2c__7bf(const int port, const uint16_t slave_addr__7bf)
return EC_ERROR_OVERFLOW;
detached_devs[i].port = port;
- detached_devs[i].slave_addr__7bf = slave_addr__7bf;
+ detached_devs[i].slave_addr_flags = slave_addr_flags;
detached_devs[i].valid = 1;
return EC_SUCCESS;
}
-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)
{
int i;
for (i = 0; i < MAX_DETACHED_DEV_COUNT; ++i)
if (detached_devs[i].valid &&
detached_devs[i].port == port &&
- detached_devs[i].slave_addr__7bf == slave_addr__7bf)
+ detached_devs[i].slave_addr_flags == slave_addr_flags)
break;
if (i == MAX_DETACHED_DEV_COUNT)
@@ -63,30 +63,30 @@ int test_attach_i2c__7bf(const int port, const uint16_t slave_addr__7bf)
return EC_SUCCESS;
}
-static int test_check_detached__7bf(const int port,
- const uint16_t slave_addr__7bf)
+static int test_check_detached(const int port,
+ const uint16_t slave_addr_flags)
{
int i;
for (i = 0; i < MAX_DETACHED_DEV_COUNT; ++i)
if (detached_devs[i].valid &&
detached_devs[i].port == port &&
- detached_devs[i].slave_addr__7bf == slave_addr__7bf)
+ detached_devs[i].slave_addr_flags == slave_addr_flags)
return 1;
return 0;
}
-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)
{
const struct test_i2c_xfer *p;
int rv;
- if (test_check_detached__7bf(port, slave_addr__7bf))
+ if (test_check_detached(port, slave_addr_flags))
return EC_ERROR_UNKNOWN;
for (p = __test_i2c_xfer; p < __test_i2c_xfer_end; ++p) {
- rv = p->routine__7bf(port, slave_addr__7bf,
+ rv = p->routine(port, slave_addr_flags,
out, out_size,
in, in_size, flags);
if (rv != EC_ERROR_INVAL)
diff --git a/chip/ish/i2c.c b/chip/ish/i2c.c
index fa3aca627a..405e63935e 100644
--- a/chip/ish/i2c.c
+++ b/chip/ish/i2c.c
@@ -150,8 +150,8 @@ static void i2c_intr_switch(uint32_t *base, int mode)
}
}
-static void i2c_init_transaction__7b(struct i2c_context *ctx,
- uint16_t slave_addr__7b, uint8_t flags)
+static void i2c_init_transaction(struct i2c_context *ctx,
+ uint16_t slave_addr, uint8_t flags)
{
uint32_t con_value;
uint32_t *base = ctx->base;
@@ -162,7 +162,7 @@ static void i2c_init_transaction__7b(struct i2c_context *ctx,
i2c_intr_switch(base, DISABLE_INT);
i2c_mmio_write(base, IC_ENABLE, IC_ENABLE_DISABLE);
- i2c_mmio_write(base, IC_TAR, (slave_addr__7b << IC_TAR_OFFSET) |
+ i2c_mmio_write(base, IC_TAR, (slave_addr << IC_TAR_OFFSET) |
TAR_SPECIAL_VAL | IC_10BITADDR_MASTER_VAL);
/* set Clock SCL Count */
@@ -286,7 +286,7 @@ static void i2c_write_read_commands(uint32_t *base, uint8_t len, int more_data,
}
}
-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)
{
@@ -295,7 +295,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
uint64_t expire_ts;
struct i2c_context *ctx;
ssize_t curr_index = 0;
- uint16_t addr__7b = I2C_GET_ADDR__7b(slave_addr__7bf);
+ uint16_t addr = I2C_GET_ADDR(slave_addr_flags);
int begin_indx;
uint8_t repeat_start = 0;
@@ -309,7 +309,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
* Address cannot be any of the reserved address locations:
* 0x00 to 0x07 or 0x78 to 0x7f.
*/
- if (addr__7b <= 0x07 || (addr__7b >= 0x78 && addr__7b <= 0x7F))
+ if (addr <= 0x07 || (addr >= 0x78 && addr <= 0x7F))
return EC_ERROR_INVAL;
/* assume that if both out_size and in_size are not zero,
@@ -323,7 +323,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
total_len = in_size + out_size;
- i2c_init_transaction__7b(ctx, addr__7b, repeat_start);
+ i2c_init_transaction(ctx, addr, repeat_start);
/* Write W data */
if (out_size)
diff --git a/chip/it83xx/i2c.c b/chip/it83xx/i2c.c
index 6383b773d2..4fe5ee62cc 100644
--- a/chip/it83xx/i2c.c
+++ b/chip/it83xx/i2c.c
@@ -194,7 +194,7 @@ struct i2c_port_data {
int widx; /* Index into output data */
int ridx; /* Index into input data */
int err; /* Error code, if any */
- uint8_t addr__8b; /* address of device */
+ uint8_t addr_8bit; /* address of device */
uint32_t timeout_us; /* Transaction timeout, or 0 to use default */
uint8_t freq; /* Frequency setting */
@@ -319,7 +319,7 @@ static int i2c_tran_write(int p)
* bit0, Direction of the host transfer.
* bit[1:7}, Address of the targeted slave.
*/
- IT83XX_SMB_TRASLA(p) = pd->addr__8b;
+ IT83XX_SMB_TRASLA(p) = pd->addr_8bit;
/* Send first byte */
IT83XX_SMB_HOBDB(p) = *(pd->out++);
pd->widx++;
@@ -379,7 +379,7 @@ static int i2c_tran_read(int p)
* bit0, Direction of the host transfer.
* bit[1:7}, Address of the targeted slave.
*/
- IT83XX_SMB_TRASLA(p) = pd->addr__8b | 0x01;
+ IT83XX_SMB_TRASLA(p) = pd->addr_8bit | 0x01;
/* clear start flag */
pd->flags &= ~I2C_XFER_START;
/*
@@ -468,7 +468,7 @@ static int enhanced_i2c_tran_write(int p)
pd->flags &= ~I2C_XFER_START;
enhanced_i2c_start(p);
/* Send ID */
- i2c_pio_trans_data(p, TX_DIRECT, pd->addr__8b, 1);
+ i2c_pio_trans_data(p, TX_DIRECT, pd->addr_8bit, 1);
} else {
/* Host has completed the transmission of a byte */
if (pd->widx < pd->out_size) {
@@ -489,7 +489,7 @@ static int enhanced_i2c_tran_write(int p)
pd->i2ccs = I2C_CH_REPEAT_START;
/* Repeat Start */
i2c_pio_trans_data(p, RX_DIRECT,
- pd->addr__8b, 1);
+ pd->addr_8bit, 1);
} else {
if (pd->flags & I2C_XFER_STOP) {
IT83XX_I2C_CTR(p_ch) = E_FINISH;
@@ -521,7 +521,7 @@ static int enhanced_i2c_tran_read(int p)
/* Direct read */
pd->i2ccs = I2C_CH_WAIT_READ;
/* Send ID */
- i2c_pio_trans_data(p, RX_DIRECT, pd->addr__8b, 1);
+ i2c_pio_trans_data(p, RX_DIRECT, pd->addr_8bit, 1);
} else {
if (pd->i2ccs) {
if (pd->i2ccs == I2C_CH_REPEAT_START) {
@@ -539,7 +539,7 @@ static int enhanced_i2c_tran_read(int p)
pd->i2ccs = I2C_CH_WAIT_READ;
/* Send ID */
i2c_pio_trans_data(p, RX_DIRECT,
- pd->addr__8b, 1);
+ pd->addr_8bit, 1);
task_enable_irq(i2c_ctrl_regs[p].irq);
}
} else {
@@ -641,7 +641,7 @@ int i2c_is_busy(int port)
return (IT83XX_I2C_STR(p_ch) & E_HOSTA_BB);
}
-int chip_i2c_xfer__7bf(int port, uint16_t slave_addr__7bf,
+int chip_i2c_xfer(int port, uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
@@ -665,7 +665,7 @@ int chip_i2c_xfer__7bf(int port, uint16_t slave_addr__7bf,
pd->widx = 0;
pd->ridx = 0;
pd->err = 0;
- pd->addr__8b = I2C_GET_ADDR__7b(slave_addr__7bf) << 1;
+ pd->addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1;
/* Make sure we're in a good state to start */
if ((flags & I2C_XFER_START) && (i2c_is_busy(port)
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index f831997e68..b95fcba0b0 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -165,7 +165,7 @@ int i2c_do_work(int port)
return 0;
}
-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)
{
@@ -193,7 +193,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
CPRINTS("I2C%d Addr:%02X bad status 0x%02x, SCL=%d, SDA=%d",
port,
- I2C_GET_ADDR__7b(slave_addr__7bf),
+ I2C_GET_ADDR(slave_addr_flags),
reg_mcs,
i2c_get_line_levels(port) & I2C_LINE_SCL_HIGH,
i2c_get_line_levels(port) & I2C_LINE_SDA_HIGH);
@@ -219,7 +219,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
}
/* Set slave address for transmit */
- LM4_I2C_MSA(port) = (I2C_GET_ADDR__7b(slave_addr__7bf) << 1) & 0xff;
+ LM4_I2C_MSA(port) = (I2C_GET_ADDR(slave_addr_flags) << 1) & 0xff;
/* Enable interrupts */
pd->task_waiting = task_get_current();
diff --git a/chip/mchp/i2c.c b/chip/mchp/i2c.c
index 96a0914a4b..2a43ab4496 100644
--- a/chip/mchp/i2c.c
+++ b/chip/mchp/i2c.c
@@ -132,7 +132,7 @@ static struct {
uint32_t i2c_complete; /* ISR write */
uint32_t flags;
uint8_t port;
- uint8_t slv_addr__8b;
+ uint8_t slv_addr_8bit;
uint8_t ctrl;
uint8_t hwsts;
uint8_t hwsts2;
@@ -545,7 +545,7 @@ static int i2c_mtx(int ctrl)
cdata[ctrl].flags |= (1ul << 1);
if (cdata[ctrl].xflags & I2C_XFER_START) {
cdata[ctrl].flags |= (1ul << 2);
- MCHP_I2C_DATA(ctrl) = cdata[ctrl].slv_addr__8b;
+ MCHP_I2C_DATA(ctrl) = cdata[ctrl].slv_addr_8bit;
/* Clock out the slave address, sending START bit */
MCHP_I2C_CTRL(ctrl) = CTRL_PIN | CTRL_ESO | CTRL_ENI |
CTRL_ACK | CTRL_STA;
@@ -629,7 +629,7 @@ static int i2c_mrx_start(int ctrl)
/* Repeated-START then address */
MCHP_I2C_CTRL(ctrl) = u8;
}
- MCHP_I2C_DATA(ctrl) = cdata[ctrl].slv_addr__8b | 0x01;
+ MCHP_I2C_DATA(ctrl) = cdata[ctrl].slv_addr_8bit | 0x01;
if (cdata[ctrl].transaction_state == I2C_TRANSACTION_STOPPED) {
cdata[ctrl].flags |= (1ul << 6);
/* address then START */
@@ -716,7 +716,7 @@ static int i2c_mrx_data(int ctrl)
/*
* Called from common/i2c_master
*/
-int chip_i2c_xfer__7bf(int port, uint16_t slave_addr__7bf,
+int chip_i2c_xfer(int port, uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
@@ -741,7 +741,7 @@ int chip_i2c_xfer__7bf(int port, uint16_t slave_addr__7bf,
cdata[ctrl].hwsts3 = 0;
cdata[ctrl].hwsts4 = 0;
cdata[ctrl].port = port & 0xff;
- cdata[ctrl].slv_addr__8b = I2C_GET_ADDR__7b(slave_addr__7bf) << 1;
+ cdata[ctrl].slv_addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1;
cdata[ctrl].out_size = out_size;
cdata[ctrl].outp = out;
cdata[ctrl].in_size = in_size;
diff --git a/chip/mec1322/i2c.c b/chip/mec1322/i2c.c
index 4920070432..6a0fa0a5cc 100644
--- a/chip/mec1322/i2c.c
+++ b/chip/mec1322/i2c.c
@@ -236,8 +236,8 @@ static inline void push_in_buf(uint8_t **in, uint8_t val, int skip)
}
}
-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)
{
@@ -287,7 +287,7 @@ int chip_i2c_xfer__7bf(const int port,
if (out_size) {
if (send_start) {
MEC1322_I2C_DATA(controller) =
- (uint8_t)(I2C_GET_ADDR__7b(slave_addr__7bf)
+ (uint8_t)(I2C_GET_ADDR(slave_addr_flags)
<< 1);
/* Clock out the slave address, sending START bit */
@@ -332,7 +332,7 @@ int chip_i2c_xfer__7bf(const int port,
CTRL_ENI;
MEC1322_I2C_DATA(controller) =
- (uint8_t)(I2C_GET_ADDR__7b(slave_addr__7bf)
+ (uint8_t)(I2C_GET_ADDR(slave_addr_flags)
<< 1)
| 0x01;
diff --git a/chip/npcx/i2c.c b/chip/npcx/i2c.c
index 23023abf1d..91590c80ec 100644
--- a/chip/npcx/i2c.c
+++ b/chip/npcx/i2c.c
@@ -84,7 +84,7 @@ struct i2c_status {
uint16_t sz_txbuf; /* Size of Tx buffer in bytes */
uint16_t sz_rxbuf; /* Size of rx buffer in bytes */
uint16_t idx_buf; /* Current index of Tx/Rx buffer */
- uint8_t slave_addr__7bf;/* Target slave address */
+ uint8_t slave_addr_flags;/* Target slave address */
enum smb_oper_state_t oper_state;/* Smbus operation state */
enum smb_error err_code; /* Error code */
int task_waiting; /* Task waiting on controller */
@@ -344,7 +344,7 @@ void i2c_done(int controller)
static void i2c_handle_sda_irq(int controller)
{
volatile struct i2c_status *p_status = i2c_stsobjs + controller;
- uint8_t addr__8b = I2C_GET_ADDR__7b(p_status->slave_addr__7bf) << 1;
+ uint8_t addr_8bit = I2C_GET_ADDR(p_status->slave_addr_flags) << 1;
/* 1 Issue Start is successful ie. write address byte */
if (p_status->oper_state == SMB_MASTER_START
|| p_status->oper_state == SMB_REPEAT_START) {
@@ -360,12 +360,12 @@ static void i2c_handle_sda_irq(int controller)
I2C_STALL(controller);
/* Write the address to the bus R bit*/
- I2C_WRITE_BYTE(controller, (addr__8b | 0x1));
+ I2C_WRITE_BYTE(controller, (addr_8bit | 0x1));
CPRINTS("-ARR-0x%02x", addr);
} else {/* Transmit mode */
p_status->oper_state = SMB_WRITE_OPER;
/* Write the address to the bus W bit*/
- I2C_WRITE_BYTE(controller, addr__8b);
+ I2C_WRITE_BYTE(controller, addr_8bit);
CPRINTS("-ARW-0x%02x", addr);
}
/* Completed handling START condition */
@@ -405,7 +405,7 @@ static void i2c_handle_sda_irq(int controller)
}
/* Write the address to the bus R bit*/
I2C_WRITE_BYTE(controller,
- (addr__8b | 0x1));
+ (addr_8bit | 0x1));
CPUTS("-ARR");
}
}
@@ -609,8 +609,8 @@ void i2c_set_timeout(int port, uint32_t timeout)
timeout ? timeout : I2C_TIMEOUT_DEFAULT_US;
}
-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)
{
@@ -639,7 +639,7 @@ int chip_i2c_xfer__7bf(const int port,
p_status->sz_txbuf = out_size;
p_status->rx_buf = in;
p_status->sz_rxbuf = in_size;
- p_status->slave_addr__7bf = slave_addr__7bf;
+ p_status->slave_addr_flags = slave_addr_flags;
/* Reset index & error */
p_status->idx_buf = 0;
diff --git a/chip/nrf51/i2c.c b/chip/nrf51/i2c.c
index 7f4903ee1b..ab20b2a16b 100644
--- a/chip/nrf51/i2c.c
+++ b/chip/nrf51/i2c.c
@@ -141,13 +141,13 @@ static void handle_i2c_error(int port, int rv)
i2c_recover(port);
}
-static int i2c_master_write__7bf(const int port, const uint16_t slave_addr__7bf,
+static int i2c_master_write(const int port, const uint16_t slave_addr_flags,
const uint8_t *data, int size, int stop)
{
int bytes_sent;
int timeout = I2C_TIMEOUT;
- NRF51_TWI_ADDRESS__7b(port) = I2C_GET_ADDR__7b(slave_addr__7bf);
+ NRF51_TWI_ADDRESS(port) = I2C_GET_ADDR(slave_addr_flags);
/* Clear the sent bit */
NRF51_TWI_TXDSENT(port) = 0;
@@ -187,13 +187,13 @@ static int i2c_master_write__7bf(const int port, const uint16_t slave_addr__7bf,
return EC_SUCCESS;
}
-static int i2c_master_read__7bf(const int port, const uint16_t slave__addr__7bf,
+static int i2c_master_read(const int port, const uint16_t slave_addr_flags,
uint8_t *data, int size)
{
int curr_byte;
int timeout = I2C_TIMEOUT;
- NRF51_TWI_ADDRESS__7b(port) = I2C_GET_ADDR__7b(slave_addr__7bf);
+ NRF51_TWI_ADDRESS(port) = I2C_GET_ADDR(slave_addr_flags);
if (size == 1) /* Last byte: stop after this one. */
NRF51_PPI_TEP(i2c_ppi_chan[port]) =
@@ -253,7 +253,7 @@ static int i2c_master_read__7bf(const int port, const uint16_t slave__addr__7bf,
return EC_SUCCESS;
}
-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_bytes,
uint8_t *in, int in_bytes, int flags)
{
@@ -263,11 +263,11 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
ASSERT(in || !in_bytes);
if (out_bytes)
- rv = i2c_master_write__7bf(port, slave_addr__7bf,
+ rv = i2c_master_write(port, slave_addr_flags,
out, out_bytes,
in_bytes ? 0 : 1);
if (rv == EC_SUCCESS && in_bytes)
- rv = i2c_master_read__7bf(port, slave_addr__7bf,
+ rv = i2c_master_read(port, slave_addr_flags,
in, in_bytes);
handle_i2c_error(port, rv);
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c
index e2aa3f8af9..c612e922c5 100644
--- a/chip/stm32/i2c-stm32f0.c
+++ b/chip/stm32/i2c-stm32f0.c
@@ -27,7 +27,7 @@
/* Transmit timeout in microseconds */
#define I2C_TX_TIMEOUT_MASTER (10 * MSEC)
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
#if (I2C_PORT_EC == STM32_I2C1_PORT)
#define IRQ_SLAVE STM32_IRQ_I2C1
#else
@@ -146,7 +146,7 @@ static void i2c_init_port(const struct i2c_port_t *p)
STM32_RCC_APB1ENR |= 1 << (21 + port);
if (port == STM32_I2C1_PORT) {
-#if defined(CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF) && \
+#if defined(CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS) && \
defined(CONFIG_LOW_POWER_IDLE) && \
(I2C_PORT_EC == STM32_I2C1_PORT)
/*
@@ -189,7 +189,7 @@ defined(CONFIG_LOW_POWER_IDLE) && \
}
/*****************************************************************************/
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
/* Host command slave */
/*
* Buffer for received host command packets (including prefix byte on request,
@@ -426,11 +426,11 @@ DECLARE_IRQ(IRQ_SLAVE, i2c2_event_interrupt, 2);
/*****************************************************************************/
/* Interface */
-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_bytes,
uint8_t *in, int in_bytes, int flags)
{
- int addr__8b = I2C_GET_ADDR__7b(slave_addr__7bf) << 1;
+ int addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1;
int rv = EC_SUCCESS;
int i;
int xfer_start = flags & I2C_XFER_START;
@@ -438,7 +438,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
#if defined(CONFIG_I2C_SCL_GATE_ADDR) && defined(CONFIG_I2C_SCL_GATE_PORT)
if (port == CONFIG_I2C_SCL_GATE_PORT &&
- slave_addr__7bf == CONFIG_I2C_SCL_GATE_ADDR__7BF)
+ slave_addr_flags == CONFIG_I2C_SCL_GATE_ADDR_FLAGS)
gpio_set_level(CONFIG_I2C_SCL_GATE_GPIO, 1);
#endif
@@ -459,7 +459,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
* NBYTES again. if we are starting, then set START bit.
*/
STM32_I2C_CR2(port) = ((out_bytes & 0xFF) << 16)
- | addr__8b
+ | addr_8bit
| ((in_bytes == 0 && xfer_stop) ?
STM32_I2C_CR2_AUTOEND : 0)
| ((in_bytes == 0 && !xfer_stop) ?
@@ -488,7 +488,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
* set START bit to send (re)start and begin read transaction.
*/
STM32_I2C_CR2(port) = ((in_bytes & 0xFF) << 16)
- | STM32_I2C_CR2_RD_WRN | addr__8b
+ | STM32_I2C_CR2_RD_WRN | addr_8bit
| (xfer_stop ? STM32_I2C_CR2_AUTOEND : 0)
| (!xfer_stop ? STM32_I2C_CR2_RELOAD : 0)
| (out_bytes || xfer_start ? STM32_I2C_CR2_START : 0);
@@ -545,7 +545,7 @@ xfer_exit:
#ifdef CONFIG_I2C_SCL_GATE_ADDR
if (port == CONFIG_I2C_SCL_GATE_PORT &&
- slave_addr__7bf == CONFIG_I2C_SCL_GATE_ADDR__7BF)
+ slave_addr_flags == CONFIG_I2C_SCL_GATE_ADDR_FLAGS)
gpio_set_level(CONFIG_I2C_SCL_GATE_GPIO, 0);
#endif
@@ -588,7 +588,7 @@ static void i2c_init(void)
for (i = 0; i < i2c_ports_used; i++, p++)
i2c_init_port(p);
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
STM32_I2C_CR1(I2C_PORT_EC) |= STM32_I2C_CR1_RXIE | STM32_I2C_CR1_ERRIE
| STM32_I2C_CR1_ADDRIE | STM32_I2C_CR1_STOPIE
| STM32_I2C_CR1_NACKIE;
@@ -601,14 +601,14 @@ static void i2c_init(void)
STM32_I2C_CR1(I2C_PORT_EC) |= STM32_I2C_CR1_WUPEN;
#endif
STM32_I2C_OAR1(I2C_PORT_EC) = 0x8000
- | (I2C_GET_ADDR__7b(CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF) << 1);
+ | (I2C_GET_ADDR(CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS) << 1);
#ifdef TCPCI_I2C_SLAVE
/*
* Configure TCPC address with OA2[1] masked so that we respond
* to CONFIG_TCPC_I2C_BASE_ADDR and CONFIG_TCPC_I2C_BASE_ADDR + 2.
*/
STM32_I2C_OAR2(I2C_PORT_EC) = 0x8100
- | (I2C_GET_ADDR__7b(CONFIG_TCPC_I2C_BASE_ADDR__7BF) << 1);
+ | (I2C_GET_ADDR(CONFIG_TCPC_I2C_BASE_ADDR_FLAGS) << 1);
#endif
task_enable_irq(IRQ_SLAVE);
#endif
diff --git a/chip/stm32/i2c-stm32f4.c b/chip/stm32/i2c-stm32f4.c
index 6b774e829b..1fe95d1722 100644
--- a/chip/stm32/i2c-stm32f4.c
+++ b/chip/stm32/i2c-stm32f4.c
@@ -25,7 +25,7 @@
/* Transmit timeout in microseconds */
#define I2C_TX_TIMEOUT_MASTER (10 * MSEC)
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
#if (I2C_PORT_EC == STM32_I2C1_PORT)
#define IRQ_SLAVE_EV STM32_IRQ_I2C1_EV
#define IRQ_SLAVE_ER STM32_IRQ_I2C1_ER
@@ -171,7 +171,7 @@ static int wait_sr1(int port, int mask)
*
* @return Non-zero if error.
*/
-static int send_start__8b(const int port, const uint16_t slave_addr__8b)
+static int send_start(const int port, const uint16_t slave_addr_8bit)
{
int rv;
@@ -182,7 +182,7 @@ static int send_start__8b(const int port, const uint16_t slave_addr__8b)
return I2C_ERROR_FAILED_START;
/* Write slave address */
- STM32_I2C_DR(port) = slave_addr__8b;
+ STM32_I2C_DR(port) = slave_addr_8bit;
rv = wait_sr1_poll(port, STM32_I2C_SR1_ADDR, SET, 1);
if (rv)
return rv;
@@ -263,7 +263,7 @@ static int wait_fmpi2c_isr(int port, int mask)
*
* @return Non-zero if error.
*/
-static int send_fmpi2c_start__8b(const int port, const uint16_t slave_addr__8b,
+static int send_fmpi2c_start(const int port, const uint16_t slave_addr_8bit,
int size, int is_read)
{
uint32_t reg;
@@ -274,7 +274,7 @@ static int send_fmpi2c_start__8b(const int port, const uint16_t slave_addr__8b,
FMPI2C_CR2_RELOAD | FMPI2C_CR2_AUTOEND |
FMPI2C_CR2_RD_WRN | FMPI2C_CR2_START | FMPI2C_CR2_STOP);
reg |= FMPI2C_CR2_START | FMPI2C_CR2_AUTOEND |
- slave_addr__8b | FMPI2C_CR2_SIZE(size) |
+ slave_addr_8bit | FMPI2C_CR2_SIZE(size) |
(is_read ? FMPI2C_CR2_RD_WRN : 0);
STM32_FMPI2C_CR2(port) = reg;
@@ -401,7 +401,7 @@ static void fmpi2c_clear_regs(int port)
*
* @return EC_SUCCESS on success.
*/
-static int chip_fmpi2c_xfer__8b(const int port, const uint16_t slave_addr__8b,
+static int chip_fmpi2c_xfer(const int port, const uint16_t slave_addr_8bit,
const uint8_t *out, int out_bytes,
uint8_t *in, int in_bytes, int flags)
{
@@ -422,8 +422,8 @@ static int chip_fmpi2c_xfer__8b(const int port, const uint16_t slave_addr__8b,
/* No out bytes and no in bytes means just check for active */
if (out_bytes || !in_bytes) {
- rv = send_fmpi2c_start__8b(
- port, slave_addr__8b, out_bytes, FMPI2C_WRITE);
+ rv = send_fmpi2c_start(
+ port, slave_addr_8bit, out_bytes, FMPI2C_WRITE);
if (rv)
goto xfer_exit;
@@ -448,8 +448,8 @@ static int chip_fmpi2c_xfer__8b(const int port, const uint16_t slave_addr__8b,
dma_start_rx(dma, in_bytes, in);
i2c_dma_enable_tc_interrupt(dma->channel, port);
- rv_start = send_fmpi2c_start__8b(
- port, slave_addr__8b, in_bytes, FMPI2C_READ);
+ rv_start = send_fmpi2c_start(
+ port, slave_addr_8bit, in_bytes, FMPI2C_READ);
if (rv_start)
goto xfer_exit;
@@ -553,11 +553,11 @@ static void i2c_clear_regs(int port)
*/
/* Perform an i2c transaction. */
-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_bytes,
uint8_t *in, int in_bytes, int flags)
{
- int addr__8b = I2C_GET_ADDR__7b(slave_addr__7bf) << 1;
+ int addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1;
int started = (flags & I2C_XFER_START) ? 0 : 1;
int rv = EC_SUCCESS;
int i;
@@ -568,7 +568,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
ASSERT(!started);
if (p->port == STM32F4_FMPI2C_PORT) {
- return chip_fmpi2c_xfer__8b(port, addr__8b,
+ return chip_fmpi2c_xfer(port, addr_8bit,
out, out_bytes,
in, in_bytes, flags);
}
@@ -577,7 +577,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
/* No out bytes and no in bytes means just check for active */
if (out_bytes || !in_bytes) {
- rv = send_start__8b(port, addr__8b);
+ rv = send_start(port, addr_8bit);
if (rv)
goto xfer_exit;
@@ -616,7 +616,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
STM32_I2C_CR2(port) |= STM32_I2C_CR2_LAST;
STM32_I2C_CR2(port) |= STM32_I2C_CR2_DMAEN;
- rv_start = send_start__8b(port, addr__8b | 0x01);
+ rv_start = send_start(port, addr_8bit | 0x01);
if ((in_bytes == 1) && (flags & I2C_XFER_STOP))
STM32_I2C_CR1(port) |= STM32_I2C_CR1_STOP;
@@ -760,7 +760,7 @@ DECLARE_HOOK(HOOK_FREQ_CHANGE, i2c_freq_change_hook, HOOK_PRIO_DEFAULT);
/*****************************************************************************/
/* Slave */
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
/* Host command slave */
/*
* Buffer for received host command packets (including prefix byte on request,
@@ -839,7 +839,7 @@ static void i2c_process_command(void)
host_packet_receive(&i2c_packet);
}
-#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS
static void i2c_send_board_response(int len)
{
/* host_buffer data range, beyond this length, will return 0xec */
@@ -863,7 +863,7 @@ static void i2c_event_handler(int port)
volatile uint32_t i2c_sr2;
volatile uint32_t i2c_sr1;
static int rx_pending, buf_idx;
- static uint16_t addr__8b;
+ static uint16_t addr_8bit;
volatile uint32_t dummy __attribute__((unused));
@@ -888,15 +888,15 @@ static void i2c_event_handler(int port)
/* Transfer matched our slave address */
if (i2c_sr1 & STM32_I2C_SR1_ADDR) {
- addr__8b = ((i2c_sr2 & STM32_I2C_SR2_DUALF) ?
+ addr_8bit = ((i2c_sr2 & STM32_I2C_SR2_DUALF) ?
STM32_I2C_OAR2(port) : STM32_I2C_OAR1(port)) & 0xfe;
if (i2c_sr2 & STM32_I2C_SR2_TRA) {
/* Transmitter slave */
i2c_sr1 |= STM32_I2C_SR1_TXE;
-#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS
if (!rx_pending && !tx_pending) {
tx_pending = 1;
- i2c_process_board_command(1, addr__8b, 0);
+ i2c_process_board_command(1, addr_8bit, 0);
}
#endif
} else {
@@ -931,11 +931,11 @@ static void i2c_event_handler(int port)
host_i2c_resp_port = port;
/* Disable buffer interrupt */
STM32_I2C_CR2(port) &= ~STM32_I2C_CR2_ITBUFEN;
-#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR__7BF
- if ((addr__8b >> 1) ==
- I2C_GET_ADDR__7b(
- CONFIG_BOARD_I2C_SLAVE_ADDR__7BF))
- i2c_process_board_command(1, addr__8b,
+#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS
+ if ((addr_8bit >> 1) ==
+ I2C_GET_ADDR(
+ CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS))
+ i2c_process_board_command(1, addr_8bit,
buf_idx);
else
#endif
@@ -957,11 +957,11 @@ static void i2c_event_handler(int port)
/* Disable buffer interrupt */
STM32_I2C_CR2(port) &= ~STM32_I2C_CR2_ITBUFEN;
-#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS
if (rx_pending &&
- (addr__8b >> 1) ==
- I2C_GET_ADDR__7b(CONFIG_BOARD_I2C_SLAVE_ADDR__7BF))
- i2c_process_board_command(0, addr__8b, buf_idx);
+ (addr_8b >> 1) ==
+ I2C_GET_ADDR(CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS))
+ i2c_process_board_command(0, addr_8bit, buf_idx);
#endif
rx_pending = 0;
tx_pending = 0;
@@ -996,7 +996,7 @@ static void i2c_init(void)
i2c_init_port(p);
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
/* Enable ACK */
STM32_I2C_CR1(I2C_PORT_EC) |= STM32_I2C_CR1_ACK;
/* Enable interrupts */
@@ -1004,10 +1004,10 @@ static void i2c_init(void)
| STM32_I2C_CR2_ITERREN;
/* Setup host command slave */
STM32_I2C_OAR1(I2C_PORT_EC) = STM32_I2C_OAR1_B14
- | (I2C_GET_ADDR__7b(CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF) << 1);
-#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR__7BF
+ | (I2C_GET_ADDR(CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS) << 1);
+#ifdef CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS
STM32_I2C_OAR2(I2C_PORT_EC) = STM32_I2C_OAR2_ENDUAL
- | (I2C_GET_ADDR__7b(CONFIG_BOARD_I2C_SLAVE_ADDR__7BF) << 1);
+ | (I2C_GET_ADDR(CONFIG_BOARD_I2C_SLAVE_ADDR_FLAGS) << 1);
#endif
task_enable_irq(IRQ_SLAVE_EV);
task_enable_irq(IRQ_SLAVE_ER);
diff --git a/chip/stm32/i2c-stm32l.c b/chip/stm32/i2c-stm32l.c
index d56d78d8eb..02d842d75c 100644
--- a/chip/stm32/i2c-stm32l.c
+++ b/chip/stm32/i2c-stm32l.c
@@ -98,7 +98,7 @@ static int wait_sr1(int port, int mask)
*
* @return Non-zero if error.
*/
-static int send_start__8b(int port, uint16_t slave_addr__8b)
+static int send_start(int port, uint16_t slave_addr_8bit)
{
int rv;
@@ -110,7 +110,7 @@ static int send_start__8b(int port, uint16_t slave_addr__8b)
return I2C_ERROR_FAILED_START;
/* Write slave address */
- STM32_I2C_DR(port) = slave_addr__8b & 0xff;
+ STM32_I2C_DR(port) = slave_addr_8bit & 0xff;
rv = wait_sr1(port, STM32_I2C_SR1_ADDR);
if (rv)
return rv;
@@ -164,12 +164,12 @@ static void i2c_init_port(const struct i2c_port_t *p)
/*****************************************************************************/
/* Interface */
-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_bytes,
uint8_t *in, int in_bytes, int flags)
{
- int addr__8b == I2C_GET_ADDR__7b(slave_addr__7bf) << 1;
+ int addr_8bit == I2C_GET_ADDR(slave_addr_flags) << 1;
int started = (flags & I2C_XFER_START) ? 0 : 1;
int rv = EC_SUCCESS;
int i;
@@ -196,7 +196,7 @@ int chip_i2c_xfer__7bf(const int port,
/* No out bytes and no in bytes means just check for active */
if (out_bytes || !in_bytes) {
if (!started) {
- rv = send_start__8b(port, addr__8b);
+ rv = send_start(port, addr_8bit);
if (rv)
goto xfer_exit;
}
@@ -228,7 +228,7 @@ int chip_i2c_xfer__7bf(const int port,
STM32_I2C_CR1(port) |= STM32_I2C_CR1_ACK;
if (!started) {
- rv = send_start__8b(port, addr__8b | 0x01);
+ rv = send_start(port, addr_8bit | 0x01);
if (rv)
goto xfer_exit;
}
diff --git a/chip/stm32/i2c-stm32l4.c b/chip/stm32/i2c-stm32l4.c
index e263394880..d30bcded0c 100644
--- a/chip/stm32/i2c-stm32l4.c
+++ b/chip/stm32/i2c-stm32l4.c
@@ -26,7 +26,7 @@
/* Transmit timeout in microseconds */
#define I2C_TX_TIMEOUT_MASTER (10 * MSEC)
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
#define I2C_SLAVE_ERROR_CODE 0xec
#if (I2C_PORT_EC == STM32_I2C1_PORT)
#define IRQ_SLAVE STM32_IRQ_I2C1
@@ -177,7 +177,7 @@ static void i2c_init_port(const struct i2c_port_t *p)
/*****************************************************************************/
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
static void i2c_event_handler(int port)
{
@@ -303,11 +303,11 @@ DECLARE_IRQ(IRQ_SLAVE, i2c_event_interrupt, 2);
/*****************************************************************************/
/* Interface */
-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_bytes,
uint8_t *in, int in_bytes, int flags)
{
- int addr__8b = I2C_GET_ADDR__7b(slave_addr__7bf) << 1;
+ int addr_8bit = I2C_GET_ADDR(slave_addr_flags) << 1;
int rv = EC_SUCCESS;
int i;
int xfer_start = flags & I2C_XFER_START;
@@ -330,7 +330,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
* NBYTES again. if we are starting, then set START bit.
*/
STM32_I2C_CR2(port) = ((out_bytes & 0xFF) << 16)
- | addr__8b
+ | addr_8bit
| ((in_bytes == 0 && xfer_stop) ?
STM32_I2C_CR2_AUTOEND : 0)
| ((in_bytes == 0 && !xfer_stop) ?
@@ -359,7 +359,7 @@ int chip_i2c_xfer__7bf(const int port, const uint16_t slave_addr__7bf,
* set START bit to send (re)start and begin read transaction.
*/
STM32_I2C_CR2(port) = ((in_bytes & 0xFF) << 16)
- | STM32_I2C_CR2_RD_WRN | addr__8b
+ | STM32_I2C_CR2_RD_WRN | addr_8bit
| (xfer_stop ? STM32_I2C_CR2_AUTOEND : 0)
| (!xfer_stop ? STM32_I2C_CR2_RELOAD : 0)
| (out_bytes || xfer_start ? STM32_I2C_CR2_START : 0);
@@ -453,12 +453,12 @@ static void i2c_init(void)
for (i = 0; i < i2c_ports_used; i++, p++)
i2c_init_port(p);
-#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS
STM32_I2C_CR1(I2C_PORT_EC) |= STM32_I2C_CR1_RXIE | STM32_I2C_CR1_ERRIE
| STM32_I2C_CR1_ADDRIE | STM32_I2C_CR1_STOPIE
| STM32_I2C_CR1_NACKIE;
STM32_I2C_OAR1(I2C_PORT_EC) = 0x8000
- | (I2C_GET_ADDR__7b(CONFIG_HOSTCMD_I2C_SLAVE_ADDR__7BF) << 1);
+ | (I2C_GET_ADDR(CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS) << 1);
task_enable_irq(IRQ_SLAVE);
#endif
}
diff --git a/chip/stm32/usb_power.c b/chip/stm32/usb_power.c
index 4cf8bac99e..90f0039c2c 100644
--- a/chip/stm32/usb_power.c
+++ b/chip/stm32/usb_power.c
@@ -249,7 +249,7 @@ static int usb_power_state_addina(struct usb_power_config const *config,
ina = state->ina_cfg + state->ina_count;
ina->port = cmd->addina.port;
- ina->addr__7bf = cmd->addina.addr__7bf;
+ ina->addr_flags = cmd->addina.addr_flags;
ina->rs = cmd->addina.rs;
ina->type = cmd->addina.type;
@@ -270,7 +270,7 @@ static int usb_power_state_addina(struct usb_power_config const *config,
struct usb_power_ina_cfg *tmp = state->ina_cfg + i;
if ((tmp->port == ina->port) &&
- (tmp->addr__7bf == ina->addr__7bf)) {
+ (tmp->addr_flags == ina->addr_flags)) {
ina->shared = 1;
tmp->shared = 1;
}
@@ -406,46 +406,46 @@ int reg_type_mapping(enum usb_power_ina_type ina_type)
}
}
-uint16_t ina2xx_readagain__7bf(uint8_t port, uint16_t slave_addr__7bf)
+uint16_t ina2xx_readagain(uint8_t port, uint16_t slave_addr_flags)
{
int res;
uint16_t val;
- res = i2c_xfer__7bf(port, slave_addr__7bf,
+ res = i2c_xfer(port, slave_addr_flags,
NULL, 0, (uint8_t *)&val, sizeof(uint16_t));
if (res) {
CPRINTS("INA2XX I2C readagain failed p:%d a:%02x",
- (int)port, (int)I2C_GET_ADDR__7b(slave_addr__7bf));
+ (int)port, (int)I2C_GET_ADDR(slave_addr_flags));
return 0x0bad;
}
return (val >> 8) | ((val & 0xff) << 8);
}
-uint16_t ina2xx_read__7bf(uint8_t port, uint16_t slave_addr__7bf,
+uint16_t ina2xx_read(uint8_t port, uint16_t slave_addr_flags,
uint8_t reg)
{
int res;
int val;
- res = i2c_read16__7bf(port, slave_addr__7bf, reg, &val);
+ res = i2c_read16(port, slave_addr_flags, reg, &val);
if (res) {
CPRINTS("INA2XX I2C read failed p:%d a:%02x, r:%02x",
- (int)port, (int)I2C_GET_ADDR__7b(slave_addr__7bf),
+ (int)port, (int)I2C_GET_ADDR(slave_addr_flags),
(int)reg);
return 0x0bad;
}
return (val >> 8) | ((val & 0xff) << 8);
}
-int ina2xx_write__7bf(uint8_t port, uint16_t slave_addr__7bf,
+int ina2xx_write(uint8_t port, uint16_t slave_addr_flags,
uint8_t reg, uint16_t val)
{
int res;
uint16_t be_val = (val >> 8) | ((val & 0xff) << 8);
- res = i2c_write16__7bf(port, slave_addr__7bf, reg, be_val);
+ res = i2c_write16(port, slave_addr_flags, reg, be_val);
if (res)
CPRINTS("INA2XX I2C write failed");
return res;
@@ -509,12 +509,12 @@ static int usb_power_init_inas(struct usb_power_config const *config)
{
int conf, cal;
- conf = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ conf = ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_CONF);
- cal = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ cal = ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_CAL);
CPRINTS("[CAP] %d (%d,0x%02x): conf:%x, cal:%x",
- i, ina->port, I2C_GET_ADDR__7b(ina->addr__7bf),
+ i, ina->port, I2C_GET_ADDR(ina->addr_flags),
conf, cal);
}
#endif
@@ -536,7 +536,7 @@ static int usb_power_init_inas(struct usb_power_config const *config)
if (ina->scale == 0)
return -1;
value = (5120000 * 100) / (ina->scale * ina->rs);
- ret = ina2xx_write__7bf(ina->port, ina->addr__7bf,
+ ret = ina2xx_write(ina->port, ina->addr_flags,
INA231_REG_CAL, value);
if (ret != EC_SUCCESS) {
CPRINTS("[CAP] usb_power_init_inas CAL FAIL: %d", ret);
@@ -546,7 +546,7 @@ static int usb_power_init_inas(struct usb_power_config const *config)
{
int actual;
- actual = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ actual = ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_CAL);
CPRINTS("[CAP] scale: %d uA/div, %d uW/div, cal:%x act:%x",
ina->scale / 100, ina->scale*25/100, value, actual);
@@ -557,7 +557,7 @@ static int usb_power_init_inas(struct usb_power_config const *config)
INA231_CONF_SHUNT_TIME(shunt_time) |
INA231_CONF_BUS_TIME(shunt_time) |
INA231_CONF_AVG(avg);
- ret = ina2xx_write__7bf(ina->port, ina->addr__7bf,
+ ret = ina2xx_write(ina->port, ina->addr_flags,
INA231_REG_CONF, value);
if (ret != EC_SUCCESS) {
CPRINTS("[CAP] usb_power_init_inas CONF FAIL: %d", ret);
@@ -567,22 +567,22 @@ static int usb_power_init_inas(struct usb_power_config const *config)
{
int actual;
- actual = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ actual = ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_CONF);
CPRINTS("[CAP] %d (%d,0x%02x): conf:%x, act:%x",
- i, ina->port, I2C_GET_ADDR__7b(ina->addr__7bf),
+ i, ina->port, I2C_GET_ADDR(ina->addr_flags),
value, actual);
}
#endif
#ifdef USB_POWER_VERBOSE
{
int busv_mv =
- (ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ (ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_BUSV)
* 125) / 100;
CPRINTS("[CAP] %d (%d,0x%02x): busv:%dmv",
- i, ina->port, I2C_GET_ADDR__7b(ina->addr__7bf),
+ i, ina->port, I2C_GET_ADDR(ina->addr_flags),
busv_mv);
}
#endif
@@ -590,7 +590,7 @@ static int usb_power_init_inas(struct usb_power_config const *config)
* will be cached and all ina2xx_readagain() calls will read
* from the same address.
*/
- ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ ina2xx_read(ina->port, ina->addr_flags,
reg_type_mapping(ina->type));
#ifdef USB_POWER_VERBOSE
CPRINTS("[CAP] %d (%d,0x%02x): type:%d", (int)(ina->type));
@@ -649,11 +649,11 @@ static int usb_power_get_samples(struct usb_power_config const *config)
* transaction.
*/
if (ina->shared)
- regval = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ regval = ina2xx_read(ina->port, ina->addr_flags,
reg_type_mapping(ina->type));
else
- regval = ina2xx_readagain__7bf(ina->port,
- ina->addr__7bf);
+ regval = ina2xx_readagain(ina->port,
+ ina->addr_flags);
r->power[i] = regval;
#ifdef USB_POWER_VERBOSE
{
@@ -662,13 +662,13 @@ static int usb_power_get_samples(struct usb_power_config const *config)
int voltage;
int bvoltage;
- voltage = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ voltage = ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_RSHV);
- bvoltage = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ bvoltage = ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_BUSV);
- current = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ current = ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_CURR);
- power = ina2xx_read__7bf(ina->port, ina->addr__7bf,
+ power = ina2xx_read(ina->port, ina->addr_flags,
INA231_REG_PWR);
{
int uV = ((int)voltage * 25) / 10;
@@ -678,7 +678,7 @@ static int usb_power_get_samples(struct usb_power_config const *config)
int uW = (((int)power * ina->scale*25)/100);
CPRINTS("[CAP] %d (%d,0x%02x): %dmV / %dmO = %dmA",
- i, ina->port, I2C_GET_ADDR__7b(ina->addr__7bf),
+ i, ina->port, I2C_GET_ADDR(ina->addr_flags),
uV/1000, ina->rs, uA/1000);
CPRINTS("[CAP] %duV %dmV %duA %dCuA "
"%duW v:%04x, b:%04x, p:%04x",
diff --git a/chip/stm32/usb_power.h b/chip/stm32/usb_power.h
index f2f1426691..cbea9554a5 100644
--- a/chip/stm32/usb_power.h
+++ b/chip/stm32/usb_power.h
@@ -138,7 +138,7 @@ struct usb_power_ina_cfg {
/* i2c bus. TODO(nsanders): specify what kind of index. */
int port;
/* 7-bit i2c addr */
- uint16_t addr__7bf;
+ uint16_t addr_flags;
/* Base voltage. mV */
int mv;
@@ -243,7 +243,7 @@ struct __attribute__ ((__packed__)) usb_power_command_addina {
uint16_t command;
uint8_t port;
uint8_t type;
- uint16_t addr__7bf;
+ uint16_t addr_flags;
uint8_t extra;
uint32_t rs;
};
diff --git a/common/cbi.c b/common/cbi.c
index 69c3298d42..29b22e5e83 100644
--- a/common/cbi.c
+++ b/common/cbi.c
@@ -88,7 +88,7 @@ static struct cbi_header * const head = (struct cbi_header *)cbi;
static int read_eeprom(uint8_t offset, uint8_t *in, int in_size)
{
- return i2c_read_block__7bf(I2C_PORT_EEPROM, I2C_ADDR_EEPROM__7bf,
+ return i2c_read_block(I2C_PORT_EEPROM, I2C_ADDR_EEPROM_FLAGS,
offset, in, in_size);
}
@@ -244,7 +244,7 @@ static int write_board_info(void)
while (rest > 0) {
int size = MIN(EEPROM_PAGE_WRITE_SIZE, rest);
int rv;
- rv = i2c_write_block__7bf(I2C_PORT_EEPROM, I2C_ADDR_EEPROM__7bf,
+ rv = i2c_write_block(I2C_PORT_EEPROM, I2C_ADDR_EEPROM_FLAGS,
p - cbi, p, size);
if (rv) {
CPRINTS("Failed to write for %d", rv);
diff --git a/common/host_command_master.c b/common/host_command_master.c
index 57223f2346..5f707eac1a 100644
--- a/common/host_command_master.c
+++ b/common/host_command_master.c
@@ -81,8 +81,8 @@ static int pd_host_command_internal(int command, int version,
*/
i2c_lock(I2C_PORT_PD_MCU, 1);
i2c_set_timeout(I2C_PORT_PD_MCU, PD_HOST_COMMAND_TIMEOUT_US);
- ret = i2c_xfer_unlocked__7bf(I2C_PORT_PD_MCU,
- CONFIG_USB_PD_I2C_SLAVE_ADDR__7BF,
+ ret = i2c_xfer_unlocked(I2C_PORT_PD_MCU,
+ CONFIG_USB_PD_I2C_SLAVE_ADDR_FLAGS,
&req_buf[0], outsize + sizeof(rq) + 1,
&resp_buf[0], 2, I2C_XFER_START);
i2c_set_timeout(I2C_PORT_PD_MCU, 0);
@@ -96,8 +96,8 @@ static int pd_host_command_internal(int command, int version,
if (resp_len > (insize + sizeof(rs))) {
/* Do a dummy read to generate stop condition */
- i2c_xfer_unlocked__7bf(I2C_PORT_PD_MCU,
- CONFIG_USB_PD_I2C_SLAVE_ADDR__7BF,
+ i2c_xfer_unlocked(I2C_PORT_PD_MCU,
+ CONFIG_USB_PD_I2C_SLAVE_ADDR_FLAGS,
0, 0, &resp_buf[2], 1, I2C_XFER_STOP);
i2c_lock(I2C_PORT_PD_MCU, 0);
CPRINTS("response size is too large %d > %d",
@@ -106,8 +106,8 @@ static int pd_host_command_internal(int command, int version,
}
/* Receive remaining data */
- ret = i2c_xfer_unlocked__7bf(I2C_PORT_PD_MCU,
- CONFIG_USB_PD_I2C_SLAVE_ADDR__7BF,
+ ret = i2c_xfer_unlocked(I2C_PORT_PD_MCU,
+ CONFIG_USB_PD_I2C_SLAVE_ADDR_FLAGS,
0, 0,
&resp_buf[2], resp_len, I2C_XFER_STOP);
i2c_lock(I2C_PORT_PD_MCU, 0);
diff --git a/common/i2c_master.c b/common/i2c_master.c
index bfb9e01c3c..5975570fdb 100644
--- a/common/i2c_master.c
+++ b/common/i2c_master.c
@@ -70,29 +70,27 @@ const struct i2c_port_t *get_i2c_port(const int port)
return NULL;
}
-static int chip_i2c_xfer_with_notify__7bf(const int port,
- const uint16_t slave_addr__7bf,
+static int chip_i2c_xfer_with_notify(const int port,
+ const uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
int ret;
if (IS_ENABLED(CONFIG_I2C_DEBUG))
- i2c_trace_notify__7bf(port, slave_addr__7bf,
- 0, out, out_size);
+ i2c_trace_notify(port, slave_addr_flags, 0, out, out_size);
if (IS_ENABLED(CONFIG_I2C_XFER_BOARD_CALLBACK))
- i2c_start_xfer_notify__7bf(port, slave_addr__7bf);
+ i2c_start_xfer_notify(port, slave_addr_flags);
- ret = chip_i2c_xfer__7bf(port, slave_addr__7bf,
+ ret = chip_i2c_xfer(port, slave_addr_flags,
out, out_size, in, in_size, flags);
if (IS_ENABLED(CONFIG_I2C_XFER_BOARD_CALLBACK))
- i2c_end_xfer_notify__7bf(port, slave_addr__7bf);
+ i2c_end_xfer_notify(port, slave_addr_flags);
if (IS_ENABLED(CONFIG_I2C_DEBUG))
- i2c_trace_notify__7bf(port, slave_addr__7bf,
- 1, in, in_size);
+ i2c_trace_notify(port, slave_addr_flags, 1, in, in_size);
return ret;
}
@@ -102,8 +100,8 @@ static int chip_i2c_xfer_with_notify__7bf(const int port,
* Internal function that splits reading into multiple chip_i2c_xfer() calls
* if in_size exceeds CONFIG_I2C_CHIP_MAX_READ_SIZE.
*/
-static int i2c_xfer_no_retry__7bf(const int port,
- const uint16_t slave_addr__7bf,
+static int i2c_xfer_no_retry(const int port,
+ const uint16_t slave_addr_flags,
const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
@@ -113,14 +111,14 @@ static int i2c_xfer_no_retry__7bf(const int port,
in_size -= in_chunk_size;
out_flags |= !in_size ? (flags & I2C_XFER_STOP) : 0;
- ret = chip_i2c_xfer_with_notify__7bf(port, slave_addr__7bf,
+ ret = chip_i2c_xfer_with_notify(port, slave_addr_flags,
out, out_size, in,
in_chunk_size, out_flags);
in += in_chunk_size;
while (in_size && ret == EC_SUCCESS) {
in_chunk_size = MIN(in_size, CONFIG_I2C_CHIP_MAX_READ_SIZE);
in_size -= in_chunk_size;
- ret = chip_i2c_xfer_with_notify__7bf(port, slave_addr__7bf,
+ ret = chip_i2c_xfer_with_notify(port, slave_addr_flags,
NULL, 0, in,
in_chunk_size, !in_size ? (flags & I2C_XFER_STOP) : 0);
in += in_chunk_size;
@@ -129,8 +127,8 @@ static int i2c_xfer_no_retry__7bf(const int port,
}
#endif /* CONFIG_I2C_XFER_LARGE_READ */
-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)
{
@@ -144,11 +142,11 @@ int i2c_xfer_unlocked__7bf(const int port,
for (i = 0; i <= CONFIG_I2C_NACK_RETRY_COUNT; i++) {
#ifdef CONFIG_I2C_XFER_LARGE_READ
- ret = i2c_xfer_no_retry__7bf(port, slave_addr__7bf,
+ ret = i2c_xfer_no_retry(port, slave_addr_flags,
out, out_size, in,
in_size, flags);
#else
- ret = chip_i2c_xfer_with_notify__7bf(port, slave_addr__7bf,
+ ret = chip_i2c_xfer_with_notify(port, slave_addr_flags,
out, out_size,
in, in_size, flags);
#endif /* CONFIG_I2C_XFER_LARGE_READ */
@@ -158,15 +156,15 @@ int i2c_xfer_unlocked__7bf(const int port,
return ret;
}
-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)
{
int rv;
i2c_lock(port, 1);
- rv = i2c_xfer_unlocked__7bf(port, slave_addr__7bf,
+ rv = i2c_xfer_unlocked(port, slave_addr_flags,
out, out_size, in, in_size,
I2C_XFER_SINGLE);
i2c_lock(port, 0);
@@ -217,8 +215,8 @@ void i2c_prepare_sysjump(void)
mutex_lock(port_mutex + i);
}
-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)
{
int rv;
@@ -226,13 +224,13 @@ int i2c_read32__7bf(const int port,
reg = offset & 0xff;
/* I2C read 32-bit word: transmit 8-bit offset, and read 32bits */
- rv = i2c_xfer__7bf(port, slave_addr__7bf,
+ rv = i2c_xfer(port, slave_addr_flags,
&reg, 1, buf, sizeof(uint32_t));
if (rv)
return rv;
- if (I2C_IS_BIG_ENDIAN(slave_addr__7bf))
+ if (I2C_IS_BIG_ENDIAN(slave_addr_flags))
*data = ((int)buf[0] << 24) | ((int)buf[1] << 16) |
((int)buf[0] << 8) | buf[1];
else
@@ -242,15 +240,15 @@ int i2c_read32__7bf(const int port,
return EC_SUCCESS;
}
-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)
{
uint8_t buf[1 + sizeof(uint32_t)];
buf[0] = offset & 0xff;
- if (I2C_IS_BIG_ENDIAN(slave_addr__7bf)) {
+ if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) {
buf[1] = (data >> 24) & 0xff;
buf[2] = (data >> 16) & 0xff;
buf[3] = (data >> 8) & 0xff;
@@ -262,12 +260,12 @@ int i2c_write32__7bf(const int port,
buf[4] = (data >> 24) & 0xff;
}
- return i2c_xfer__7bf(port, slave_addr__7bf,
+ return i2c_xfer(port, slave_addr_flags,
buf, sizeof(uint32_t) + 1, NULL, 0);
}
-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)
{
int rv;
@@ -275,13 +273,13 @@ int i2c_read16__7bf(const int port,
reg = offset & 0xff;
/* I2C read 16-bit word: transmit 8-bit offset, and read 16bits */
- rv = i2c_xfer__7bf(port, slave_addr__7bf,
+ rv = i2c_xfer(port, slave_addr_flags,
&reg, 1, buf, sizeof(uint16_t));
if (rv)
return rv;
- if (I2C_IS_BIG_ENDIAN(slave_addr__7bf))
+ if (I2C_IS_BIG_ENDIAN(slave_addr_flags))
*data = ((int)buf[0] << 8) | buf[1];
else
*data = ((int)buf[1] << 8) | buf[0];
@@ -289,15 +287,15 @@ int i2c_read16__7bf(const int port,
return EC_SUCCESS;
}
-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)
{
uint8_t buf[1 + sizeof(uint16_t)];
buf[0] = offset & 0xff;
- if (I2C_IS_BIG_ENDIAN(slave_addr__7bf)) {
+ if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) {
buf[1] = (data >> 8) & 0xff;
buf[2] = data & 0xff;
} else {
@@ -305,12 +303,12 @@ int i2c_write16__7bf(const int port,
buf[2] = (data >> 8) & 0xff;
}
- return i2c_xfer__7bf(port, slave_addr__7bf,
+ return i2c_xfer(port, slave_addr_flags,
buf, 1 + sizeof(uint16_t), NULL, 0);
}
-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)
{
int rv;
@@ -319,15 +317,15 @@ int i2c_read8__7bf(const int port,
reg = offset;
- rv = i2c_xfer__7bf(port, slave_addr__7bf, &reg, 1, &buf, 1);
+ rv = i2c_xfer(port, slave_addr_flags, &reg, 1, &buf, 1);
if (!rv)
*data = buf;
return rv;
}
-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)
{
uint8_t buf[2];
@@ -335,11 +333,11 @@ int i2c_write8__7bf(const int port,
buf[0] = offset;
buf[1] = data;
- return i2c_xfer__7bf(port, slave_addr__7bf, buf, 2, 0, 0);
+ return i2c_xfer(port, slave_addr_flags, buf, 2, 0, 0);
}
-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)
{
int rv;
@@ -352,7 +350,7 @@ int i2c_read_offset16__7bf(const int port,
addr[1] = offset & 0xff;
/* I2C read 16-bit word: transmit 16-bit offset, and read buffer */
- rv = i2c_xfer__7bf(port, slave_addr__7bf, addr, 2, buf, len);
+ rv = i2c_xfer(port, slave_addr_flags, addr, 2, buf, len);
if (rv)
return rv;
@@ -360,7 +358,7 @@ int i2c_read_offset16__7bf(const int port,
if (len == 1) {
*data = buf[0];
} else {
- if (I2C_IS_BIG_ENDIAN(slave_addr__7bf))
+ if (I2C_IS_BIG_ENDIAN(slave_addr_flags))
*data = ((int)buf[0] << 8) | buf[1];
else
*data = ((int)buf[1] << 8) | buf[0];
@@ -369,8 +367,8 @@ int i2c_read_offset16__7bf(const int port,
return EC_SUCCESS;
}
-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)
{
uint8_t buf[2 + sizeof(uint16_t)];
@@ -384,7 +382,7 @@ int i2c_write_offset16__7bf(const int port,
if (len == 1) {
buf[2] = data & 0xff;
} else {
- if (I2C_IS_BIG_ENDIAN(slave_addr__7bf)) {
+ if (I2C_IS_BIG_ENDIAN(slave_addr_flags)) {
buf[2] = (data >> 8) & 0xff;
buf[3] = data & 0xff;
} else {
@@ -393,11 +391,11 @@ int i2c_write_offset16__7bf(const int port,
}
}
- return i2c_xfer__7bf(port, slave_addr__7bf, buf, 2 + len, NULL, 0);
+ return i2c_xfer(port, slave_addr_flags, buf, 2 + len, NULL, 0);
}
-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)
{
uint8_t addr[sizeof(uint16_t)];
@@ -405,11 +403,11 @@ int i2c_read_offset16_block__7bf(const int port,
addr[0] = (offset >> 8) & 0xff;
addr[1] = offset & 0xff;
- return i2c_xfer__7bf(port, slave_addr__7bf, addr, 2, data, len);
+ return i2c_xfer(port, slave_addr_flags, addr, 2, data, len);
}
-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)
{
int rv;
@@ -423,18 +421,18 @@ int i2c_write_offset16_block__7bf(const int port,
* appending the destination address with the data array.
*/
i2c_lock(port, 1);
- rv = i2c_xfer_unlocked__7bf(port, slave_addr__7bf, addr, 2, NULL, 0,
+ rv = i2c_xfer_unlocked(port, slave_addr_flags, addr, 2, NULL, 0,
I2C_XFER_START);
if (!rv)
- rv = i2c_xfer_unlocked__7bf(port, slave_addr__7bf,
+ rv = i2c_xfer_unlocked(port, slave_addr_flags,
data, len, NULL, 0, I2C_XFER_STOP);
i2c_lock(port, 0);
return rv;
}
-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)
{
int rv;
@@ -447,7 +445,7 @@ int i2c_read_string__7bf(const int port,
* Send device reg space offset, and read back block length. Keep this
* session open without a stop.
*/
- rv = i2c_xfer_unlocked__7bf(port, slave_addr__7bf,
+ rv = i2c_xfer_unlocked(port, slave_addr_flags,
&reg, 1, &block_length, 1, I2C_XFER_START);
if (rv)
goto exit;
@@ -455,7 +453,7 @@ int i2c_read_string__7bf(const int port,
if (len && block_length > (len - 1))
block_length = len - 1;
- rv = i2c_xfer_unlocked__7bf(port, slave_addr__7bf,
+ rv = i2c_xfer_unlocked(port, slave_addr_flags,
0, 0, data, block_length, I2C_XFER_STOP);
data[block_length] = 0;
@@ -464,19 +462,19 @@ exit:
return rv;
}
-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)
{
int rv;
uint8_t reg_address = offset;
- rv = i2c_xfer__7bf(port, slave_addr__7bf, &reg_address, 1, data, len);
+ rv = i2c_xfer(port, slave_addr_flags, &reg_address, 1, data, len);
return rv;
}
-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)
{
int rv;
@@ -487,10 +485,10 @@ int i2c_write_block__7bf(const int port,
* appending the destination address with the data array.
*/
i2c_lock(port, 1);
- rv = i2c_xfer_unlocked__7bf(port, slave_addr__7bf,
+ rv = i2c_xfer_unlocked(port, slave_addr_flags,
&reg_address, 1, NULL, 0, I2C_XFER_START);
if (!rv) {
- rv = i2c_xfer_unlocked__7bf(port, slave_addr__7bf,
+ rv = i2c_xfer_unlocked(port, slave_addr_flags,
data, len, NULL, 0, I2C_XFER_STOP);
}
i2c_lock(port, 0);
@@ -747,7 +745,7 @@ static int check_i2c_params(const struct host_cmd_handler_args *args)
/* Loop and process messages */;
for (msgnum = 0, msg = params->msg; msgnum < params->num_msgs;
msgnum++, msg++) {
- unsigned int addr_flags = msg->addr_flags__7bf;
+ unsigned int addr_flags = msg->addr_flags;
PTHRUPRINTS("port=%d, %s, addr=0x%x(7-bit), len=%d",
params->port,
@@ -804,10 +802,10 @@ static int i2c_command_passthru(struct host_cmd_handler_args *args)
if (ret)
return ret;
- if (port_protected[params->port] && i2c_port->passthru_allowed__7bf) {
+ if (port_protected[params->port] && i2c_port->passthru_allowed) {
for (i = 0; i < params->num_msgs; i++) {
- if (!i2c_port->passthru_allowed__7bf(i2c_port,
- params->msg[i].addr_flags__7bf))
+ if (!i2c_port->passthru_allowed(i2c_port,
+ params->msg[i].addr_flags))
return EC_RES_ACCESS_DENIED;
}
}
@@ -825,10 +823,10 @@ static int i2c_command_passthru(struct host_cmd_handler_args *args)
int rv = 1;
/* Have to remove the EC flags from the address flags */
- uint16_t addr__7bf = msg->addr_flags__7bf & EC_I2C_ADDR_MASK;
+ uint16_t addr_flags = msg->addr_flags & EC_I2C_ADDR_MASK;
- if (msg->addr_flags__7bf & EC_I2C_FLAG_READ)
+ if (msg->addr_flags & EC_I2C_FLAG_READ)
read_len = msg->len;
else
write_len = msg->len;
@@ -837,9 +835,9 @@ static int i2c_command_passthru(struct host_cmd_handler_args *args)
if (resp->num_msgs == params->num_msgs - 1)
xferflags |= I2C_XFER_STOP;
-#if defined(VIRTUAL_BATTERY_ADDR__7bf) && defined(I2C_PORT_VIRTUAL_BATTERY)
+#if defined(VIRTUAL_BATTERY_ADDR_FLAGS) && defined(I2C_PORT_VIRTUAL_BATTERY)
if (params->port == I2C_PORT_VIRTUAL_BATTERY &&
- VIRTUAL_BATTERY_ADDR__7bf == addr__7bf) {
+ addr_flags == VIRTUAL_BATTERY_ADDR_FLAGS) {
if (virtual_battery_handler(resp, in_len, &rv,
xferflags, read_len,
write_len, out))
@@ -848,7 +846,7 @@ static int i2c_command_passthru(struct host_cmd_handler_args *args)
#endif
/* Transfer next message */
PTHRUPRINTS("xfer port=%x addr=0x%x rlen=%d flags=0x%x",
- params->port, addr__7bf,
+ params->port, addr_flags,
read_len, xferflags);
if (write_len) {
PTHRUPRINTF(" out:");
@@ -867,8 +865,8 @@ static int i2c_command_passthru(struct host_cmd_handler_args *args)
#endif
if (!port_is_locked)
i2c_lock(params->port, (port_is_locked = 1));
- rv = i2c_xfer_unlocked__7bf(params->port,
- addr__7bf,
+ rv = i2c_xfer_unlocked(params->port,
+ addr_flags,
out, write_len,
&resp->data[in_len], read_len,
xferflags);
@@ -924,7 +922,7 @@ static void i2c_passthru_protect_tcpc_ports(void)
for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
/* TCPC tunnel not configured. No need to protect anything */
- if (!I2C_GET_ADDR__7b(tcpc_config[i].i2c_info.addr__7bf))
+ if (!I2C_GET_ADDR(tcpc_config[i].i2c_info.addr_flags))
continue;
i2c_passthru_protect_port(tcpc_config[i].i2c_info.port);
}
@@ -1017,7 +1015,7 @@ static void scan_bus(int port, const char *desc)
{
int level;
uint8_t tmp;
- uint16_t addr__7bf;
+ uint16_t addr_flags;
ccprintf("Scanning %d %s", port, desc);
@@ -1032,14 +1030,14 @@ static void scan_bus(int port, const char *desc)
goto scan_bus_exit;
}
- for (addr__7bf = 0; addr__7bf <= 0xEF; ++addr__7bf) {
+ for (addr_flags = 0; addr_flags <= 0xEF; ++addr_flags) {
watchdog_reload(); /* Otherwise a full scan trips watchdog */
ccputs(".");
/* Do a single read */
- if (!i2c_xfer_unlocked__7bf(port, addr__7bf,
+ if (!i2c_xfer_unlocked(port, addr_flags,
NULL, 0, &tmp, 1, I2C_XFER_SINGLE))
- ccprintf("\n 0x%02x", addr__7bf);
+ ccprintf("\n 0x%02x", addr_flags);
}
scan_bus_exit:
@@ -1075,7 +1073,7 @@ DECLARE_CONSOLE_COMMAND(i2cscan, command_scan,
static int command_i2cxfer(int argc, char **argv)
{
int port;
- uint16_t addr__7bf;
+ uint16_t addr_flags;
uint16_t offset = 0;
uint8_t offset_size = 0;
int v = 0;
@@ -1090,7 +1088,7 @@ static int command_i2cxfer(int argc, char **argv)
if (*e)
return EC_ERROR_PARAM2;
- addr__7bf = strtoi(argv[3], &e, 0);
+ addr_flags = strtoi(argv[3], &e, 0);
if (*e)
return EC_ERROR_PARAM3;
@@ -1109,10 +1107,10 @@ static int command_i2cxfer(int argc, char **argv)
if (strcasecmp(argv[1], "r") == 0) {
/* 8-bit read */
if (offset_size == 2)
- rv = i2c_read_offset16__7bf(port, addr__7bf,
+ rv = i2c_read_offset16(port, addr_flags,
offset, &v, 1);
else
- rv = i2c_read8__7bf(port, addr__7bf,
+ rv = i2c_read8(port, addr_flags,
offset, &v);
if (!rv)
ccprintf("0x%02x [%d]\n", v, v);
@@ -1120,10 +1118,10 @@ static int command_i2cxfer(int argc, char **argv)
} else if (strcasecmp(argv[1], "r16") == 0) {
/* 16-bit read */
if (offset_size == 2)
- rv = i2c_read_offset16__7bf(port, addr__7bf,
+ rv = i2c_read_offset16(port, addr_flags,
offset, &v, 2);
else
- rv = i2c_read16__7bf(port, addr__7bf,
+ rv = i2c_read16(port, addr_flags,
offset, &v);
if (!rv)
ccprintf("0x%04x [%d]\n", v, v);
@@ -1133,7 +1131,7 @@ static int command_i2cxfer(int argc, char **argv)
if (argc < 6 || v < 0 || v > sizeof(data))
return EC_ERROR_PARAM5;
- rv = i2c_xfer__7bf(port, addr__7bf,
+ rv = i2c_xfer(port, addr_flags,
(uint8_t *)&offset, 1, data, v);
if (!rv)
@@ -1144,10 +1142,10 @@ static int command_i2cxfer(int argc, char **argv)
if (argc < 6)
return EC_ERROR_PARAM5;
if (offset_size == 2)
- rv = i2c_write_offset16__7bf(port, addr__7bf,
+ rv = i2c_write_offset16(port, addr_flags,
offset, v, 1);
else
- rv = i2c_write8__7bf(port, addr__7bf,
+ rv = i2c_write8(port, addr_flags,
offset, v);
} else if (strcasecmp(argv[1], "w16") == 0) {
@@ -1155,10 +1153,10 @@ static int command_i2cxfer(int argc, char **argv)
if (argc < 6)
return EC_ERROR_PARAM5;
if (offset_size == 2)
- rv = i2c_write_offset16__7bf(port, addr__7bf,
+ rv = i2c_write_offset16(port, addr_flags,
offset, v, 2);
else
- rv = i2c_write16__7bf(port, addr__7bf,
+ rv = i2c_write16(port, addr_flags,
offset, v);
} else {
@@ -1227,7 +1225,7 @@ static int command_i2ctest(int argc, char **argv)
for (i = 0; i < count; i++) {
int port;
- uint16_t addr__7bf;
+ uint16_t addr_flags;
if (!(i % 1000))
ccprintf("running test %d\n", i);
@@ -1238,7 +1236,7 @@ static int command_i2ctest(int argc, char **argv)
}
port = i2c_stress_tests[test_dev].port;
- addr__7bf = i2c_stress_tests[test_dev].addr__7bf;
+ addr_flags = i2c_stress_tests[test_dev].addr_flags;
i2c_s_test = i2c_stress_tests[test_dev].i2c_test;
reg_s_info = &i2c_s_test->reg_info;
test_s_results = &i2c_s_test->test_results;
@@ -1246,8 +1244,8 @@ static int command_i2ctest(int argc, char **argv)
rand = get_time().val;
if (rand & 0x1) {
/* read */
- rv = i2c_s_test->i2c_read__7bf ?
- i2c_s_test->i2c_read__7bf(port, addr__7bf,
+ rv = i2c_s_test->i2c_read ?
+ i2c_s_test->i2c_read(port, addr_flags,
reg_s_info->read_reg, &data) :
i2c_s_test->i2c_read_dev(
reg_s_info->read_reg, &data);
@@ -1263,8 +1261,8 @@ static int command_i2ctest(int argc, char **argv)
*/
/* Read the write register */
- rv = i2c_s_test->i2c_read__7bf ?
- i2c_s_test->i2c_read__7bf(port, addr__7bf,
+ rv = i2c_s_test->i2c_read ?
+ i2c_s_test->i2c_read(port, addr_flags,
reg_s_info->read_reg, &data) :
i2c_s_test->i2c_read_dev(
reg_s_info->read_reg, &data);
@@ -1278,9 +1276,9 @@ static int command_i2ctest(int argc, char **argv)
j = I2C_STRESS_TEST_DATA_VERIFY_RETRY_COUNT;
do {
/* Write same value back */
- rv = i2c_s_test->i2c_write__7bf ?
- i2c_s_test->i2c_write__7bf(port,
- addr__7bf,
+ rv = i2c_s_test->i2c_write ?
+ i2c_s_test->i2c_write(port,
+ addr_flags,
reg_s_info->write_reg, data) :
i2c_s_test->i2c_write_dev(
reg_s_info->write_reg, data);
@@ -1293,9 +1291,9 @@ static int command_i2ctest(int argc, char **argv)
test_s_results->write_success++;
/* Read back to verify the data */
- rv = i2c_s_test->i2c_read__7bf ?
- i2c_s_test->i2c_read__7bf(port,
- addr__7bf,
+ rv = i2c_s_test->i2c_read ?
+ i2c_s_test->i2c_read(port,
+ addr_flags,
reg_s_info->read_reg, &data_verify) :
i2c_s_test->i2c_read_dev(
reg_s_info->read_reg, &data_verify);
diff --git a/common/i2c_trace.c b/common/i2c_trace.c
index ff237ed582..06990cfa4f 100644
--- a/common/i2c_trace.c
+++ b/common/i2c_trace.c
@@ -23,17 +23,17 @@ struct i2c_trace_range {
static struct i2c_trace_range trace_entries[8];
-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)
{
size_t i;
- uint16_t addr__7b = I2C_GET_ADDR__7b(slave_addr__7bf);
+ uint16_t addr = I2C_GET_ADDR(slave_addr_flags);
for (i = 0; i < ARRAY_SIZE(trace_entries); i++)
if (trace_entries[i].enabled
&& trace_entries[i].port == port
- && trace_entries[i].slave_addr_lo <= addr__7b
- && trace_entries[i].slave_addr_hi >= addr__7b)
+ && trace_entries[i].slave_addr_lo <= addr
+ && trace_entries[i].slave_addr_hi >= addr)
goto trace_enabled;
return;
@@ -41,7 +41,7 @@ trace_enabled:
CPRINTF("i2c: %s %d:0x%X ",
direction ? "read" : "write",
port,
- addr__7b);
+ addr);
for (i = 0; i < size; i++)
CPRINTF("%02X ", data[i]);
CPRINTF("\n");
diff --git a/common/lb_common.c b/common/lb_common.c
index 1e37245558..93f01389b4 100644
--- a/common/lb_common.c
+++ b/common/lb_common.c
@@ -111,7 +111,7 @@
/* Since there's absolutely nothing we can do about it if an I2C access
* isn't working, we're completely ignoring any failures. */
-static const uint16_t i2c_addr__7bf[] = { 0x2A, 0x2B };
+static const uint16_t i2c_addr_flags[] = { 0x2A, 0x2B };
static inline void controller_write(int ctrl_num, uint8_t reg, uint8_t val)
{
@@ -119,8 +119,8 @@ static inline void controller_write(int ctrl_num, uint8_t reg, uint8_t val)
buf[0] = reg;
buf[1] = val;
- ctrl_num = ctrl_num % ARRAY_SIZE(i2c_addr__7bf);
- i2c_xfer_unlocked__7bf(I2C_PORT_LIGHTBAR, i2c_addr__7bf[ctrl_num],
+ ctrl_num = ctrl_num % ARRAY_SIZE(i2c_addr_flags);
+ i2c_xfer_unlocked(I2C_PORT_LIGHTBAR, i2c_addr_flags[ctrl_num],
buf, 2, 0, 0,
I2C_XFER_SINGLE);
}
@@ -130,8 +130,8 @@ static inline uint8_t controller_read(int ctrl_num, uint8_t reg)
uint8_t buf[1];
int rv;
- ctrl_num = ctrl_num % ARRAY_SIZE(i2c_addr__7bf);
- rv = i2c_xfer_unlocked__7bf(I2C_PORT_LIGHTBAR, i2c_addr__7bf[ctrl_num],
+ ctrl_num = ctrl_num % ARRAY_SIZE(i2c_addr_flags);
+ rv = i2c_xfer_unlocked(I2C_PORT_LIGHTBAR, i2c_addr_flags[ctrl_num],
&reg, 1, buf, 1, I2C_XFER_SINGLE);
return rv ? 0 : buf[0];
}
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 033e490517..140f1a9aa7 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -2062,8 +2062,8 @@ static int command_display_accel_info(int argc, char **argv)
ccprintf("type: %d\n", motion_sensors[i].type);
ccprintf("location: %d\n", motion_sensors[i].location);
ccprintf("port: %d\n", motion_sensors[i].port);
- ccprintf("addr: %d\n", I2C_GET_ADDR__7b(motion_sensors[i]
- .i2c_spi_addr__7bf));
+ ccprintf("addr: %d\n", I2C_GET_ADDR(motion_sensors[i]
+ .i2c_spi_addr_flags));
ccprintf("range: %d\n", motion_sensors[i].default_range);
ccprintf("min_freq: %d\n", motion_sensors[i].min_frequency);
ccprintf("max_freq: %d\n", motion_sensors[i].max_frequency);
diff --git a/common/peripheral.c b/common/peripheral.c
index eafd5d6f49..f45a13ff19 100644
--- a/common/peripheral.c
+++ b/common/peripheral.c
@@ -22,7 +22,7 @@ static int hc_locate_chip(struct host_cmd_handler_args *args)
return EC_RES_OVERFLOW;
resp->bus_type = EC_BUS_TYPE_I2C;
resp->i2c_info.port = I2C_PORT_EEPROM;
- resp->i2c_info.addr__7bf = I2C_ADDR_EEPROM__7bf;
+ resp->i2c_info.addr_flags = I2C_ADDR_EEPROM_FLAGS;
#else
/* Lookup type is supported, but not present on system. */
return EC_RES_UNAVAILABLE;
@@ -36,8 +36,8 @@ static int hc_locate_chip(struct host_cmd_handler_args *args)
if (resp->bus_type == EC_BUS_TYPE_I2C) {
resp->i2c_info.port =
tcpc_config[params->index].i2c_info.port;
- resp->i2c_info.addr__7bf =
- tcpc_config[params->index].i2c_info.addr__7bf;
+ resp->i2c_info.addr_flags =
+ tcpc_config[params->index].i2c_info.addr_flags;
}
#ifdef CONFIG_INTEL_VIRTUAL_MUX
resp->reserved = tcpc_config[params->index].usb23;
diff --git a/common/usb_i2c.c b/common/usb_i2c.c
index 375419dfcc..ace2e7139c 100644
--- a/common/usb_i2c.c
+++ b/common/usb_i2c.c
@@ -106,7 +106,7 @@ static void usb_i2c_execute(struct usb_i2c_config const *config)
/* Payload is ready to execute. */
uint32_t count = usb_i2c_read_packet(config);
int portindex = (config->buffer[0] >> 0) & 0xf;
- uint16_t addr__7bf = (config->buffer[0] >> 8) & 0x7f;
+ uint16_t addr_flags = (config->buffer[0] >> 8) & 0x7f;
int write_count = ((config->buffer[0] << 4) & 0xf00) |
((config->buffer[1] >> 0) & 0xff);
int read_count = (config->buffer[1] >> 8) & 0xff;
@@ -133,7 +133,7 @@ static void usb_i2c_execute(struct usb_i2c_config const *config)
config->buffer[0] = USB_I2C_READ_COUNT_INVALID;
} else if (portindex >= i2c_ports_used) {
config->buffer[0] = USB_I2C_PORT_INVALID;
- } else if (addr__7bf == USB_I2C_CMD_ADDR__7bf) {
+ } else if (addr_flags == USB_I2C_CMD_ADDR_FLAGS) {
/*
* This is a non-i2c command, invoke the handler if it has
* been registered, if not - report the appropriate error.
@@ -154,11 +154,11 @@ static void usb_i2c_execute(struct usb_i2c_config const *config)
* knows about. It should behave closer to
* EC_CMD_I2C_PASSTHRU, which can protect ports and ranges.
*/
- ret = i2c_xfer__7bf(i2c_ports[portindex].port, addr__7bf,
- (uint8_t *)(config->buffer + 2) + offset,
- write_count,
- (uint8_t *)(config->buffer + 2),
- read_count);
+ ret = i2c_xfer(i2c_ports[portindex].port, addr_flags,
+ (uint8_t *)(config->buffer + 2) + offset,
+ write_count,
+ (uint8_t *)(config->buffer + 2),
+ read_count);
config->buffer[0] = usb_i2c_map_error(ret);
}
usb_i2c_write_packet(config, read_count + 4);
diff --git a/cts/i2c/dut.c b/cts/i2c/dut.c
index 033aca7ffc..c7a3f9fccf 100644
--- a/cts/i2c/dut.c
+++ b/cts/i2c/dut.c
@@ -13,11 +13,11 @@
#include "uart.h"
#include "watchdog.h"
-#define TH_ADDR__7bf 0x1e
+#define TH_ADDR_FLAGS 0x1e
enum cts_rc write8_test(void)
{
- if (i2c_write8__7bf(i2c_ports[0].port, TH_ADDR__7bf,
+ if (i2c_write8(i2c_ports[0].port, TH_ADDR_FLAGS,
WRITE8_OFF, WRITE8_DATA))
return CTS_RC_FAILURE;
return CTS_RC_SUCCESS;
@@ -25,7 +25,7 @@ enum cts_rc write8_test(void)
enum cts_rc write16_test(void)
{
- if (i2c_write16__7bf(i2c_ports[0].port, TH_ADDR__7bf,
+ if (i2c_write16(i2c_ports[0].port, TH_ADDR_FLAGS,
WRITE16_OFF, WRITE16_DATA))
return CTS_RC_FAILURE;
return CTS_RC_SUCCESS;
@@ -33,7 +33,7 @@ enum cts_rc write16_test(void)
enum cts_rc write32_test(void)
{
- if (i2c_write32__7bf(i2c_ports[0].port, TH_ADDR__7bf,
+ if (i2c_write32(i2c_ports[0].port, TH_ADDR_FLAGS,
WRITE32_OFF, WRITE32_DATA))
return CTS_RC_FAILURE;
return CTS_RC_SUCCESS;
@@ -43,7 +43,7 @@ enum cts_rc read8_test(void)
{
int data;
- if (i2c_read8__7bf(i2c_ports[0].port, TH_ADDR__7bf,
+ if (i2c_read8(i2c_ports[0].port, TH_ADDR_FLAGS,
READ8_OFF, &data))
return CTS_RC_FAILURE;
if (data != READ8_DATA) {
@@ -58,7 +58,7 @@ enum cts_rc read16_test(void)
{
int data;
- if (i2c_read16__7bf(i2c_ports[0].port, TH_ADDR__7bf,
+ if (i2c_read16(i2c_ports[0].port, TH_ADDR_FLAGS,
READ16_OFF, &data))
return CTS_RC_FAILURE;
if (data != READ16_DATA) {
@@ -73,7 +73,7 @@ enum cts_rc read32_test(void)
{
int data;
- if (i2c_read32__7bf(i2c_ports[0].port, TH_ADDR__7bf,
+ if (i2c_read32(i2c_ports[0].port, TH_ADDR_FLAGS,
READ32_OFF, &data))
return CTS_RC_FAILURE;
if (data != READ32_DATA) {
diff --git a/driver/accel_bma2x2.c b/driver/accel_bma2x2.c
index 5253783623..d828912232 100644
--- a/driver/accel_bma2x2.c
+++ b/driver/accel_bma2x2.c
@@ -28,19 +28,19 @@
/**
* Read register from accelerometer.
*/
-static inline int raw_read8__7bf(const int port, const uint16_t i2c_addr__7bf,
+static inline int raw_read8(const int port, const uint16_t i2c_addr_flags,
const int reg, int *data_ptr)
{
- return i2c_read8__7bf(port, i2c_addr__7bf, reg, data_ptr);
+ return i2c_read8(port, i2c_addr_flags, reg, data_ptr);
}
/**
* Write register from accelerometer.
*/
-static inline int raw_write8__7bf(const int port, const uint16_t i2c_addr__7bf,
+static inline int raw_write8(const int port, const uint16_t i2c_addr_flags,
const int reg, int data)
{
- return i2c_write8__7bf(port, i2c_addr__7bf, reg, data);
+ return i2c_write8(port, i2c_addr_flags, reg, data);
}
static int set_range(const struct motion_sensor_t *s, int range, int rnd)
@@ -55,14 +55,14 @@ static int set_range(const struct motion_sensor_t *s, int range, int rnd)
mutex_lock(s->mutex);
/* Determine the new value of control reg and attempt to write it. */
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMA2x2_RANGE_SELECT_ADDR, &range_reg_val);
if (ret != EC_SUCCESS) {
mutex_unlock(s->mutex);
return ret;
}
reg_val = (range_reg_val & ~BMA2x2_RANGE_SELECT_MSK) | range_val;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMA2x2_RANGE_SELECT_ADDR, reg_val);
/* If successfully written, then save the range. */
@@ -98,7 +98,7 @@ static int set_data_rate(const struct motion_sensor_t *s, int rate, int rnd)
mutex_lock(s->mutex);
/* Determine the new value of control reg and attempt to write it. */
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMA2x2_BW_SELECT_ADDR, &odr_reg_val);
if (ret != EC_SUCCESS) {
mutex_unlock(s->mutex);
@@ -106,7 +106,7 @@ static int set_data_rate(const struct motion_sensor_t *s, int rate, int rnd)
}
reg_val = (odr_reg_val & ~BMA2x2_BW_MSK) | odr_val;
/* Set output data rate. */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMA2x2_BW_SELECT_ADDR, reg_val);
/* If successfully written, then save the new data rate. */
@@ -132,7 +132,7 @@ static int set_offset(const struct motion_sensor_t *s, const int16_t *offset,
/* temperature is ignored */
/* Offset from host is in 1/1024g, 1/128g internally. */
for (i = X; i <= Z; i++) {
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMA2x2_OFFSET_X_AXIS_ADDR + i, offset[i] / 8);
if (ret)
return ret;
@@ -146,7 +146,7 @@ static int get_offset(const struct motion_sensor_t *s, int16_t *offset,
int i, val, ret;
for (i = X; i <= Z; i++) {
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMA2x2_OFFSET_X_AXIS_ADDR + i, &val);
if (ret)
return ret;
@@ -163,7 +163,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
/* Read 6 bytes starting at X_AXIS_LSB. */
mutex_lock(s->mutex);
- ret = i2c_read_block__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_read_block(s->port, s->i2c_spi_addr_flags,
BMA2x2_X_AXIS_LSB_ADDR, acc, 6);
mutex_unlock(s->mutex);
@@ -193,7 +193,7 @@ static int perform_calib(const struct motion_sensor_t *s)
int ret, val, status, rate, range, i;
timestamp_t deadline;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMA2x2_OFFSET_CTRL_ADDR, &val);
if (ret)
return ret;
@@ -218,12 +218,12 @@ static int perform_calib(const struct motion_sensor_t *s)
val = ((BMA2x2_OFC_TARGET_0G << BMA2x2_OFC_TARGET_AXIS(X)) |
(BMA2x2_OFC_TARGET_0G << BMA2x2_OFC_TARGET_AXIS(Y)) |
(val << BMA2x2_OFC_TARGET_AXIS(Z)));
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMA2x2_OFC_SETTING_ADDR, val);
for (i = X; i <= Z; i++) {
val = (i + 1) << BMA2x2_OFFSET_TRIGGER_OFF;
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMA2x2_OFFSET_CTRL_ADDR, val);
/*
* The sensor needs 16 samples. At 100Hz/10ms, it needs 160ms to
@@ -236,7 +236,7 @@ static int perform_calib(const struct motion_sensor_t *s)
goto end_perform_calib;
}
msleep(50);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMA2x2_OFFSET_CTRL_ADDR, &status);
if (ret != EC_SUCCESS)
goto end_perform_calib;
@@ -253,7 +253,7 @@ static int init(const struct motion_sensor_t *s)
{
int ret = 0, tries = 0, val, reg, reset_field;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMA2x2_CHIP_ID_ADDR, &val);
if (ret)
return EC_ERROR_UNKNOWN;
@@ -267,13 +267,13 @@ static int init(const struct motion_sensor_t *s)
mutex_lock(s->mutex);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, reg, &val);
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags, reg, &val);
if (ret != EC_SUCCESS) {
mutex_unlock(s->mutex);
return ret;
}
val |= reset_field;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf, reg, val);
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags, reg, val);
if (ret != EC_SUCCESS) {
mutex_unlock(s->mutex);
return ret;
@@ -281,7 +281,7 @@ static int init(const struct motion_sensor_t *s)
/* The SRST will be cleared when reset is complete. */
do {
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, reg, &val);
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags, reg, &val);
/* Reset complete. */
if ((ret == EC_SUCCESS) && !(val & reset_field))
diff --git a/driver/accel_bma2x2.h b/driver/accel_bma2x2.h
index ecd3deac23..4b86161dd2 100644
--- a/driver/accel_bma2x2.h
+++ b/driver/accel_bma2x2.h
@@ -22,16 +22,16 @@ extern const struct accelgyro_drv bma2x2_accel_drv;
* BMA250E
* BMA222E
*/
-#define BMA2x2_I2C_ADDR1__7bf 0x18
-#define BMA2x2_I2C_ADDR2__7bf 0x19
+#define BMA2x2_I2C_ADDR1_FLAGS 0x18
+#define BMA2x2_I2C_ADDR2_FLAGS 0x19
/* The following definition of I2C address is used for the following sensors
* BMC150
* BMC056
* BMC156
*/
-#define BMA2x2_I2C_ADDR3__7bf 0x10
-#define BMA2x2_I2C_ADDR4__7bf 0x11
+#define BMA2x2_I2C_ADDR3_FLAGS 0x10
+#define BMA2x2_I2C_ADDR4_FLAGS 0x11
/*** Chip-specific registers ***/
/* REGISTER ADDRESS DEFINITIONS */
diff --git a/driver/accel_kionix.c b/driver/accel_kionix.c
index 4e1f5bb4fc..ec7953551f 100644
--- a/driver/accel_kionix.c
+++ b/driver/accel_kionix.c
@@ -133,26 +133,26 @@ static int find_param_index(const int eng_val, const int round_up,
/**
* Read register from accelerometer.
*/
-static int raw_read8__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static int raw_read8(const int port,
+ const uint16_t i2c_spi_addr_flags,
const int reg, int *data_ptr)
{
int rv = EC_ERROR_INVAL;
- if (SLAVE_IS_SPI(i2c_spi_addr__7bf)) {
+ if (SLAVE_IS_SPI(i2c_spi_addr_flags)) {
#ifdef CONFIG_SPI_ACCEL_PORT
uint8_t val;
uint8_t cmd = 0x80 | reg;
rv = spi_transaction(
- &spi_devices[SLAVE_GET_SPI_ADDR__7b(i2c_spi_addr__7bf)],
+ &spi_devices[SLAVE_GET_SPI_ADDR(i2c_spi_addr_flags)],
&cmd, 1, &val, 1);
if (rv == EC_SUCCESS)
*data_ptr = val;
#endif
} else {
- rv = i2c_read8__7bf(port, i2c_spi_addr__7bf,
+ rv = i2c_read8(port, i2c_spi_addr_flags,
reg, data_ptr);
}
return rv;
@@ -161,42 +161,42 @@ static int raw_read8__7bf(const int port,
/**
* Write register from accelerometer.
*/
-static int raw_write8__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static int raw_write8(const int port,
+ const uint16_t i2c_spi_addr_flags,
const int reg, int data)
{
int rv = EC_ERROR_INVAL;
- if (SLAVE_IS_SPI(i2c_spi_addr__7bf)) {
+ if (SLAVE_IS_SPI(i2c_spi_addr_flags)) {
#ifdef CONFIG_SPI_ACCEL_PORT
uint8_t cmd[2] = { reg, data };
rv = spi_transaction(
- &spi_devices[SLAVE_GET_SPI_ADDR__7b(i2c_spi_addr__7bf)],
+ &spi_devices[SLAVE_GET_SPI_ADDR(i2c_spi_addr_flags)],
cmd, 2, NULL, 0);
#endif
} else {
- rv = i2c_write8__7bf(port, i2c_spi_addr__7bf,
+ rv = i2c_write8(port, i2c_spi_addr_flags,
reg, data);
}
return rv;
}
-static int raw_read_multi__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static int raw_read_multi(const int port,
+ const uint16_t i2c_spi_addr_flags,
uint8_t reg, uint8_t *rxdata, int rxlen)
{
int rv = EC_ERROR_INVAL;
- if (SLAVE_IS_SPI(i2c_spi_addr__7bf)) {
+ if (SLAVE_IS_SPI(i2c_spi_addr_flags)) {
#ifdef CONFIG_SPI_ACCEL_PORT
reg |= 0x80;
rv = spi_transaction(
- &spi_devices[SLAVE_GET_SPI_ADDR__7b(i2c_spi_addr__7bf)],
+ &spi_devices[SLAVE_GET_SPI_ADDR(i2c_spi_addr_flags)],
&reg, 1, rxdata, rxlen);
#endif
} else {
- rv = i2c_read_block__7bf(port, i2c_spi_addr__7bf,
+ rv = i2c_read_block(port, i2c_spi_addr_flags,
reg, rxdata, rxlen);
}
return rv;
@@ -225,14 +225,14 @@ static int disable_sensor(const struct motion_sensor_t *s, int *reg_val)
* so that we can restore it later.
*/
for (i = 0; i < SENSOR_ENABLE_ATTEMPTS; i++) {
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
reg, reg_val);
if (ret != EC_SUCCESS)
continue;
*reg_val &= ~pc1_field;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
reg, *reg_val);
if (ret == EC_SUCCESS)
return EC_SUCCESS;
@@ -258,7 +258,7 @@ static int enable_sensor(const struct motion_sensor_t *s, int reg_val)
pc1_field = KIONIX_PC1_FIELD(V(s));
for (i = 0; i < SENSOR_ENABLE_ATTEMPTS; i++) {
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
reg, &reg_val);
if (ret != EC_SUCCESS)
continue;
@@ -270,7 +270,7 @@ static int enable_sensor(const struct motion_sensor_t *s, int reg_val)
#endif
/* Enable accelerometer based on reg_val value. */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
reg, reg_val | pc1_field);
/* On first success, we are done. */
@@ -305,7 +305,7 @@ static int set_value(const struct motion_sensor_t *s, int reg, int val,
/* Determine new value of control reg and attempt to write it. */
reg_val_new = (reg_val & ~field) | val;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
reg, reg_val_new);
/* If successfully written, then save the range. */
@@ -447,7 +447,7 @@ static int check_orientation_locked(const struct motion_sensor_t *s)
int orientation, raw_orientation;
int ret;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
KX022_TSCP, &raw_orientation);
if (ret != EC_SUCCESS)
return ret;
@@ -473,7 +473,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
/* Read 6 bytes starting at XOUT_L. */
reg = KIONIX_XOUT_L(V(s));
mutex_lock(s->mutex);
- ret = raw_read_multi__7bf(s->port, s->i2c_spi_addr__7bf, reg, acc, 6);
+ ret = raw_read_multi(s->port, s->i2c_spi_addr_flags, reg, acc, 6);
#ifdef CONFIG_KX022_ORIENTATION_SENSOR
if ((s->location == MOTIONSENSE_LOC_LID) && (V(s) == 0) &&
(ret == EC_SUCCESS))
@@ -532,7 +532,7 @@ static int init(const struct motion_sensor_t *s)
do {
msleep(1);
/* Read WHO_AM_I to be sure the device has booted */
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
reg, &val);
if (ret == EC_SUCCESS)
break;
@@ -546,7 +546,7 @@ static int init(const struct motion_sensor_t *s)
} else {
/* Write 0x00 to the internal register for KX022 */
reg = KX022_INTERNAL;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
reg, 0x0);
if (ret != EC_SUCCESS) {
/*
@@ -554,13 +554,13 @@ static int init(const struct motion_sensor_t *s)
* from the first address, resend the command using
* the second address.
*/
- if (!SLAVE_IS_SPI(s->i2c_spi_addr__7bf)) {
- const uint16_t i2c_alt_addr__7bf =
- I2C_GET_ADDR__7b(
- s->i2c_spi_addr__7bf)
+ if (!SLAVE_IS_SPI(s->i2c_spi_addr_flags)) {
+ const uint16_t i2c_alt_addr_flags =
+ I2C_GET_ADDR(
+ s->i2c_spi_addr_flags)
& ~2;
- ret = raw_write8__7bf(s->port,
- i2c_alt_addr__7bf,
+ ret = raw_write8(s->port,
+ i2c_alt_addr_flags,
reg, 0x0);
}
}
@@ -578,21 +578,21 @@ static int init(const struct motion_sensor_t *s)
ret = disable_sensor(s, &val);
if (ret != EC_SUCCESS)
goto reset_failed;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, reg, &val);
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags, reg, &val);
if (ret != EC_SUCCESS)
goto reset_failed;
val |= reset_field;
} else {
/* Write 0 to CTRL2 for KX022 */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf, reg, 0x0);
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags, reg, 0x0);
if (ret != EC_SUCCESS)
goto reset_failed;
val = reset_field;
}
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf, reg, val);
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags, reg, val);
if (ret != EC_SUCCESS)
goto reset_failed;
@@ -602,7 +602,7 @@ static int init(const struct motion_sensor_t *s)
do {
msleep(1);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
reg, &val);
/* Reset complete. */
if ((ret == EC_SUCCESS) && !(val & reset_field))
@@ -618,7 +618,7 @@ static int init(const struct motion_sensor_t *s)
msleep(2);
reg = KX022_COTR;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, reg, &val);
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags, reg, &val);
if (val != KX022_COTR_VAL_DEFAULT) {
CPRINTF("[%s: the software reset failed]\n", s->name);
ret = EC_ERROR_HW_INTERNAL;
@@ -627,7 +627,7 @@ static int init(const struct motion_sensor_t *s)
}
reg = KIONIX_WHO_AM_I(V(s));
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, reg, &val);
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags, reg, &val);
if (ret != EC_SUCCESS || val != KIONIX_WHO_AM_I_VAL(V(s))) {
ret = EC_ERROR_HW_INTERNAL;
goto reset_failed;
@@ -670,7 +670,7 @@ struct i2c_stress_test_dev kionix_i2c_stress_test_dev = {
.read_val = KIONIX_WHO_AM_I_VAL(V(s)),
.write_reg = KIONIX_ODR_REG(V(s)),
},
- .i2c_read__7bf = &raw_read8__7bf,
- .i2c_write__7bf = &raw_write8__7bf,
+ .i2c_read = &raw_read8,
+ .i2c_write = &raw_write8,
};
#endif /* CONFIG_CMD_I2C_STRESS_TEST_ACCEL */
diff --git a/driver/accel_kx022.h b/driver/accel_kx022.h
index f47d077b39..a806568c59 100644
--- a/driver/accel_kx022.h
+++ b/driver/accel_kx022.h
@@ -12,8 +12,8 @@
* 7-bit address is 001111Xb. Where 'X' is determined
* by the voltage on the ADDR pin.
*/
-#define KX022_ADDR0__7bf (0x1e)
-#define KX022_ADDR1__7bf (0x1f)
+#define KX022_ADDR0_FLAGS 0x1e
+#define KX022_ADDR1_FLAGS 0x1f
#define KX022_WHO_AM_I_VAL 0x14
/* Chip-specific registers */
diff --git a/driver/accel_kxcj9.h b/driver/accel_kxcj9.h
index 4efad87682..f7488317f0 100644
--- a/driver/accel_kxcj9.h
+++ b/driver/accel_kxcj9.h
@@ -14,8 +14,8 @@
* 7-bit address is 000111Xb. Where 'X' is determined
* by the voltage on the ADDR pin.
*/
-#define KXCJ9_ADDR0__7bf 0x0E
-#define KXCJ9_ADDR1__7bf 0x0D
+#define KXCJ9_ADDR0_FLAGS 0x0E
+#define KXCJ9_ADDR1_FLAGS 0x0D
#define KXCJ9_WHO_AM_I_VAL 0x0A
/* Chip-specific registers */
diff --git a/driver/accel_lis2dh.c b/driver/accel_lis2dh.c
index 6ef840b291..d7307d46e3 100644
--- a/driver/accel_lis2dh.c
+++ b/driver/accel_lis2dh.c
@@ -122,7 +122,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready)
{
int ret, tmp;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LIS2DH_STATUS_REG, &tmp);
if (ret != EC_SUCCESS) {
CPRINTS("%s type:0x%X RS Error", s->name, s->type);
@@ -155,7 +155,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
}
/* Read output data bytes starting at LIS2DH_OUT_X_L_ADDR */
- ret = st_raw_read_n__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n(s->port, s->i2c_spi_addr_flags,
LIS2DH_OUT_X_L_ADDR, raw, OUT_XYZ_SIZE);
if (ret != EC_SUCCESS) {
CPRINTS("%s type:0x%X RD XYZ Error", s->name, s->type);
@@ -181,7 +181,7 @@ static int init(const struct motion_sensor_t *s)
* complete boot procedure.
*/
do {
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LIS2DH_WHO_AM_I_REG, &tmp);
if (ret != EC_SUCCESS) {
udelay(10);
@@ -203,33 +203,33 @@ static int init(const struct motion_sensor_t *s)
* register must be restored to it's default.
*/
/* Enable all accel axes data and clear old settings */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LIS2DH_CTRL1_ADDR, LIS2DH_ENABLE_ALL_AXES);
if (ret != EC_SUCCESS)
goto err_unlock;
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LIS2DH_CTRL2_ADDR, LIS2DH_CTRL2_RESET_VAL);
if (ret != EC_SUCCESS)
goto err_unlock;
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LIS2DH_CTRL3_ADDR, LIS2DH_CTRL3_RESET_VAL);
if (ret != EC_SUCCESS)
goto err_unlock;
/* Enable BDU */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LIS2DH_CTRL4_ADDR, LIS2DH_BDU_MASK);
if (ret != EC_SUCCESS)
goto err_unlock;
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LIS2DH_CTRL5_ADDR, LIS2DH_CTRL5_RESET_VAL);
if (ret != EC_SUCCESS)
goto err_unlock;
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LIS2DH_CTRL6_ADDR, LIS2DH_CTRL6_RESET_VAL);
if (ret != EC_SUCCESS)
goto err_unlock;
diff --git a/driver/accel_lis2dh.h b/driver/accel_lis2dh.h
index ac5193d388..2a3108aab8 100644
--- a/driver/accel_lis2dh.h
+++ b/driver/accel_lis2dh.h
@@ -13,11 +13,11 @@
/*
* LIS2DH/LIS2DE:
*
- * 8-bit address is 0011 00XW b. Where 'X' is determined
- * by the voltage on the ADDR pin, and 'W' is read write bit
+ * 7-bit address is 0011 00X b. Where 'X' is determined
+ * by the voltage on the ADDR pin
*/
-#define LIS2DH_ADDR0__7bf 0x18
-#define LIS2DH_ADDR1__7bf 0x19
+#define LIS2DH_ADDR0_FLAGS 0x18
+#define LIS2DH_ADDR1_FLAGS 0x19
/*
* LNG2DM:
@@ -25,8 +25,8 @@
* 8-bit address is 0101 00XW b. Where 'X' is determined
* by the voltage on the ADDR pin, and 'W' is read write bit
*/
-#define LNG2DM_ADDR0__7bf 0x28
-#define LNG2DM_ADDR1__7bf 0x29
+#define LNG2DM_ADDR0_FLAGS 0x28
+#define LNG2DM_ADDR1_FLAGS 0x29
/* Who Am I */
#define LIS2DH_WHO_AM_I_REG 0x0f
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index da9fe2c375..3be5f58a83 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -144,23 +144,23 @@ static inline int spi_raw_read(const int addr, const uint8_t reg,
/**
* Read 8bit register from accelerometer.
*/
-static int raw_read8__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static int raw_read8(const int port,
+ const uint16_t i2c_spi_addr_flags,
const int reg, int *data_ptr)
{
int rv = -EC_ERROR_PARAM1;
- if (SLAVE_IS_SPI(i2c_spi_addr__7bf)) {
+ if (SLAVE_IS_SPI(i2c_spi_addr_flags)) {
#ifdef CONFIG_SPI_ACCEL_PORT
uint8_t val;
- rv = spi_raw_read(SLAVE_GET_SPI_ADDR__7b(i2c_spi_addr__7bf),
+ rv = spi_raw_read(SLAVE_GET_SPI_ADDR(i2c_spi_addr_flags),
reg, &val, 1);
if (rv == EC_SUCCESS)
*data_ptr = val;
#endif
} else {
#ifdef I2C_PORT_ACCEL
- rv = i2c_read8__7bf(port, i2c_spi_addr__7bf,
+ rv = i2c_read8(port, i2c_spi_addr_flags,
reg, data_ptr);
#endif
}
@@ -170,22 +170,22 @@ static int raw_read8__7bf(const int port,
/**
* Write 8bit register from accelerometer.
*/
-static int raw_write8__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static int raw_write8(const int port,
+ const uint16_t i2c_spi_addr_flags,
const int reg, int data)
{
int rv = -EC_ERROR_PARAM1;
- if (SLAVE_IS_SPI(i2c_spi_addr__7bf)) {
+ if (SLAVE_IS_SPI(i2c_spi_addr_flags)) {
#ifdef CONFIG_SPI_ACCEL_PORT
uint8_t cmd[2] = { reg, data };
rv = spi_transaction(
- &spi_devices[SLAVE_GET_SPI_ADDR__7b(i2c_spi_addr__7bf)],
+ &spi_devices[SLAVE_GET_SPI_ADDR(i2c_spi_addr_flags)],
cmd, 2, NULL, 0);
#endif
} else {
#ifdef I2C_PORT_ACCEL
- rv = i2c_write8__7bf(port, i2c_spi_addr__7bf,
+ rv = i2c_write8(port, i2c_spi_addr_flags,
reg, data);
#endif
}
@@ -203,19 +203,19 @@ static int raw_write8__7bf(const int port,
/**
* Read 32bit register from accelerometer.
*/
-static int raw_read32__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static int raw_read32(const int port,
+ const uint16_t i2c_spi_addr_flags,
const uint8_t reg, int *data_ptr)
{
int rv = -EC_ERROR_PARAM1;
- if (SLAVE_IS_SPI(i2c_spi_addr__7bf)) {
+ if (SLAVE_IS_SPI(i2c_spi_addr_flags)) {
#ifdef CONFIG_SPI_ACCEL_PORT
- rv = spi_raw_read(SLAVE_GET_SPI_ADDR__7b(i2c_spi_addr__7bf),
+ rv = spi_raw_read(SLAVE_GET_SPI_ADDR(i2c_spi_addr_flags),
reg, (uint8_t *)data_ptr, 4);
#endif
} else {
#ifdef I2C_PORT_ACCEL
- rv = i2c_read32__7bf(port, i2c_spi_addr__7bf,
+ rv = i2c_read32(port, i2c_spi_addr_flags,
reg, data_ptr);
#endif
}
@@ -226,20 +226,20 @@ static int raw_read32__7bf(const int port,
/**
* Read n bytes from accelerometer.
*/
-static int raw_read_n__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static int raw_read_n(const int port,
+ const uint16_t i2c_spi_addr_flags,
const uint8_t reg, uint8_t *data_ptr, const int len)
{
int rv = -EC_ERROR_PARAM1;
- if (SLAVE_IS_SPI(i2c_spi_addr__7bf)) {
+ if (SLAVE_IS_SPI(i2c_spi_addr_flags)) {
#ifdef CONFIG_SPI_ACCEL_PORT
- rv = spi_raw_read(SLAVE_GET_SPI_ADDR__7b(i2c_spi_addr__7bf),
+ rv = spi_raw_read(SLAVE_GET_SPI_ADDR(i2c_spi_addr_flags),
reg, data_ptr, len);
#endif
} else {
#ifdef I2C_PORT_ACCEL
- rv = i2c_read_block__7bf(port, i2c_spi_addr__7bf,
+ rv = i2c_read_block(port, i2c_spi_addr_flags,
reg, data_ptr, len);
#endif
}
@@ -253,12 +253,12 @@ static int raw_read_n__7bf(const int port,
* 1: manual access, we can issue i2c to the compass
* 0: data access: BMI160 gather data periodically from the compass.
*/
-static int bmi160_sec_access_ctrl__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static int bmi160_sec_access_ctrl(const int port,
+ const uint16_t i2c_spi_addr_flags,
const int enable)
{
int mag_if_ctrl;
- raw_read8__7bf(port, i2c_spi_addr__7bf,
+ raw_read8(port, i2c_spi_addr_flags,
BMI160_MAG_IF_1, &mag_if_ctrl);
if (enable) {
mag_if_ctrl |= BMI160_MAG_MANUAL_EN;
@@ -269,7 +269,7 @@ static int bmi160_sec_access_ctrl__7bf(const int port,
mag_if_ctrl &= ~BMI160_MAG_READ_BURST_MASK;
mag_if_ctrl |= BMI160_MAG_READ_BURST_8;
}
- return raw_write8__7bf(port, i2c_spi_addr__7bf,
+ return raw_write8(port, i2c_spi_addr_flags,
BMI160_MAG_IF_1, mag_if_ctrl);
}
@@ -277,14 +277,14 @@ static int bmi160_sec_access_ctrl__7bf(const int port,
* Read register from compass.
* Assuming we are in manual access mode, read compass i2c register.
*/
-int bmi160_sec_raw_read8__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+int bmi160_sec_raw_read8(const int port,
+ const uint16_t i2c_spi_addr_flags,
const uint8_t reg, int *data_ptr)
{
/* Only read 1 bytes */
- raw_write8__7bf(port, i2c_spi_addr__7bf,
+ raw_write8(port, i2c_spi_addr_flags,
BMI160_MAG_I2C_READ_ADDR, reg);
- return raw_read8__7bf(port, i2c_spi_addr__7bf,
+ return raw_read8(port, i2c_spi_addr_flags,
BMI160_MAG_I2C_READ_DATA, data_ptr);
}
@@ -292,13 +292,13 @@ int bmi160_sec_raw_read8__7bf(const int port,
* Write register from compass.
* Assuming we are in manual access mode, write to compass i2c register.
*/
-int bmi160_sec_raw_write8__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+int bmi160_sec_raw_write8(const int port,
+ const uint16_t i2c_spi_addr_flags,
const uint8_t reg, int data)
{
- raw_write8__7bf(port, i2c_spi_addr__7bf,
+ raw_write8(port, i2c_spi_addr_flags,
BMI160_MAG_I2C_WRITE_DATA, data);
- return raw_write8__7bf(port, i2c_spi_addr__7bf,
+ return raw_write8(port, i2c_spi_addr_flags,
BMI160_MAG_I2C_WRITE_ADDR, reg);
}
#endif
@@ -311,20 +311,20 @@ static int enable_fifo(const struct motion_sensor_t *s, int enable)
if (enable) {
/* FIFO start collecting events */
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_CONFIG_1, &val);
val |= BMI160_FIFO_SENSOR_EN(s->type);
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_CONFIG_1, val);
if (ret == EC_SUCCESS)
data->flags |= 1 << (s->type + BMI160_FIFO_FLAG_OFFSET);
} else {
/* FIFO stop collecting events */
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_CONFIG_1, &val);
val &= ~BMI160_FIFO_SENSOR_EN(s->type);
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_CONFIG_1, val);
if (ret == EC_SUCCESS)
data->flags &=
@@ -352,7 +352,7 @@ static int set_range(const struct motion_sensor_t *s,
ranges = get_range_table(s->type, &range_tbl_size);
reg_val = get_reg_val(range, rnd, ranges, range_tbl_size);
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, reg_val);
/* Now that we have set the range, update the driver's value. */
if (ret == EC_SUCCESS)
@@ -390,7 +390,7 @@ static int set_data_rate(const struct motion_sensor_t *s,
enable_fifo(s, 0);
#endif
/* go to suspend mode */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG,
BMI160_CMD_MODE_SUSPEND(s->type));
msleep(3);
@@ -402,7 +402,7 @@ static int set_data_rate(const struct motion_sensor_t *s,
return ret;
} else if (data->odr == 0) {
/* back from suspend mode. */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG,
BMI160_CMD_MODE_NORMAL(s->type));
msleep(wakeup_time[s->type]);
@@ -444,12 +444,12 @@ static int set_data_rate(const struct motion_sensor_t *s,
*/
mutex_lock(s->mutex);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, ctrl_reg, &val);
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags, ctrl_reg, &val);
if (ret != EC_SUCCESS)
goto accel_cleanup;
val = (val & ~BMI160_ODR_MASK) | reg_val;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf, ctrl_reg, val);
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags, ctrl_reg, val);
if (ret != EC_SUCCESS)
goto accel_cleanup;
@@ -506,7 +506,7 @@ static int get_offset(const struct motion_sensor_t *s,
* range selected for the accelerometer.
*/
for (i = X; i <= Z; i++) {
- raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_ACC70 + i, &val);
if (val > 0x7f)
val = -256 + val;
@@ -516,7 +516,7 @@ static int get_offset(const struct motion_sensor_t *s,
break;
case MOTIONSENSE_TYPE_GYRO:
/* Read the MSB first */
- raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_EN_GYR98, &val98);
/*
* The offset of the gyroscope off_gyr_[xyz] is a 10 bit
@@ -525,7 +525,7 @@ static int get_offset(const struct motion_sensor_t *s,
* -31.25 °/s to +31.25 °/s
*/
for (i = X; i <= Z; i++) {
- raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_GYR70 + i, &val);
val |= ((val98 >> (2 * i)) & 0x3) << 8;
if (val > 0x1ff)
@@ -561,7 +561,7 @@ static int set_offset(const struct motion_sensor_t *s,
rotate_inv(v, *s->rot_standard_ref, v);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_EN_GYR98, &val98);
if (ret != 0)
return ret;
@@ -577,10 +577,10 @@ static int set_offset(const struct motion_sensor_t *s,
val = -128;
if (val < 0)
val = 256 + val;
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_ACC70 + i, val);
}
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_EN_GYR98,
val98 | BMI160_OFFSET_ACC_EN);
break;
@@ -594,12 +594,12 @@ static int set_offset(const struct motion_sensor_t *s,
val = -512;
if (val < 0)
val = 1024 + val;
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_GYR70 + i, val & 0xFF);
val98 &= ~(0x3 << (2 * i));
val98 |= (val >> 8) << (2 * i);
}
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_EN_GYR98,
val98 | BMI160_OFFSET_GYRO_EN);
break;
@@ -671,9 +671,9 @@ static int perform_calib(const struct motion_sensor_t *s)
ret = EC_RES_INVALID_PARAM;
goto end_perform_calib;
}
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_FOC_CONF, val);
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_START_FOC);
deadline.val = get_time().val + 400 * MSEC;
do {
@@ -682,16 +682,16 @@ static int perform_calib(const struct motion_sensor_t *s)
goto end_perform_calib;
}
msleep(50);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_STATUS, &status);
if (ret != EC_SUCCESS)
goto end_perform_calib;
} while ((status & BMI160_FOC_RDY) == 0);
/* Calibration is successful, and loaded, use the result */
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_EN_GYR98, &val);
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_OFFSET_EN_GYR98, val | en_flag);
end_perform_calib:
set_data_rate(s, rate, 0);
@@ -745,7 +745,7 @@ int manage_activity(const struct motion_sensor_t *s,
return ret;
if (enable) {
/* We should use parameters from caller */
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_MOTION_3,
BMI160_MOTION_PROOF_TIME(
CONFIG_GESTURE_SIGMO_PROOF_MS) <<
@@ -754,7 +754,7 @@ int manage_activity(const struct motion_sensor_t *s,
CONFIG_GESTURE_SIGMO_SKIP_MS) <<
BMI160_MOTION_SKIP_OFF |
BMI160_MOTION_SIG_MOT_SEL);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_MOTION_1,
BMI160_MOTION_TH(s,
CONFIG_GESTURE_SIGMO_THRES_MG));
@@ -766,7 +766,7 @@ int manage_activity(const struct motion_sensor_t *s,
BMI160_INT_ANYMO_Y_EN |
BMI160_INT_ANYMO_Z_EN);
}
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_EN_0, tmp);
if (ret)
ret = EC_RES_UNAVAILABLE;
@@ -777,7 +777,7 @@ int manage_activity(const struct motion_sensor_t *s,
case MOTIONSENSE_ACTIVITY_DOUBLE_TAP: {
int tmp;
/* Set double tap interrupt */
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_EN_0, &tmp);
if (ret)
return ret;
@@ -785,7 +785,7 @@ int manage_activity(const struct motion_sensor_t *s,
tmp |= BMI160_INT_D_TAP_EN;
else
tmp &= ~BMI160_INT_D_TAP_EN;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_EN_0, tmp);
if (ret)
ret = EC_RES_UNAVAILABLE;
@@ -923,12 +923,12 @@ static int load_fifo(struct motion_sensor_t *s, uint32_t last_ts)
* Flush potential left over:
* When sensor is resumed, we won't read old data.
*/
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_FIFO_FLUSH);
return EC_SUCCESS;
}
- raw_read_n__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read_n(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_LENGTH_0,
(uint8_t *)&length, sizeof(length));
length &= BMI160_FIFO_LENGTH_MASK;
@@ -950,7 +950,7 @@ static int load_fifo(struct motion_sensor_t *s, uint32_t last_ts)
length = MIN(length, sizeof(bmi160_buffer));
- raw_read_n__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read_n(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_DATA, bmi160_buffer, length);
beginning = *(uint32_t *)bmi160_buffer;
ep = bmi160_buffer + length;
@@ -995,7 +995,7 @@ static int load_fifo(struct motion_sensor_t *s, uint32_t last_ts)
default:
CPRINTS("Unknown header: 0x%02x @ %d",
hdr, bp - bmi160_buffer);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG,
BMI160_CMD_FIFO_FLUSH);
return EC_ERROR_NOT_HANDLED;
@@ -1059,43 +1059,43 @@ static int config_interrupt(const struct motion_sensor_t *s)
return EC_SUCCESS;
mutex_lock(s->mutex);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_FIFO_FLUSH);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_INT_RESET);
#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_TAP_0,
BMI160_TAP_DUR(s, CONFIG_GESTURE_TAP_MAX_INTERSTICE_T));
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_TAP_1,
BMI160_TAP_TH(s, CONFIG_GESTURE_TAP_THRES_MG));
#endif
#ifdef CONFIG_BMI160_ORIENTATION_SENSOR
/* only use orientation sensor on the lid sensor */
if (s->location == MOTIONSENSE_LOC_LID) {
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_ORIENT_0,
BMI160_INT_ORIENT_0_INIT_VAL);
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_ORIENT_1,
BMI160_INT_ORIENT_1_INIT_VAL);
}
#endif
#ifdef CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_LATCH, BMI160_LATCH_5MS);
#else
/* Also, configure int2 as an external input. */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_LATCH,
BMI160_INT2_INPUT_EN | BMI160_LATCH_5MS);
#endif
/* configure int1 as an interrupt */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_OUT_CTRL,
BMI160_INT_CTRL(1, OUTPUT_EN));
@@ -1112,35 +1112,35 @@ static int config_interrupt(const struct motion_sensor_t *s)
if (s->location == MOTIONSENSE_LOC_LID)
tmp |= BMI160_INT_ORIENT;
#endif
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_MAP_REG(1), tmp);
#ifdef CONFIG_ACCEL_FIFO
/* map fifo water mark to int 1 */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_FIFO_MAP,
BMI160_INT_MAP(1, FWM) |
BMI160_INT_MAP(1, FFULL));
/* configure fifo watermark to int whenever there's any data in there */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_CONFIG_0, 1);
#ifdef CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_CONFIG_1,
BMI160_FIFO_HEADER_EN);
#else
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_FIFO_CONFIG_1,
BMI160_FIFO_TAG_INT2_EN |
BMI160_FIFO_HEADER_EN);
#endif
/* Set fifo*/
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_EN_1, &tmp);
tmp |= BMI160_INT_FWM_EN | BMI160_INT_FFUL_EN;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_INT_EN_1, tmp);
#endif
mutex_unlock(s->mutex);
@@ -1200,7 +1200,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
return EC_ERROR_NOT_HANDLED;
do {
- rv = raw_read32__7bf(s->port, s->i2c_spi_addr__7bf,
+ rv = raw_read32(s->port, s->i2c_spi_addr_flags,
BMI160_INT_STATUS_0, &interrupt);
/*
* Bail out of this loop there was an error reading the register
@@ -1237,7 +1237,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
uint8_t data[6];
int ret, status = 0;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_STATUS, &status);
if (ret != EC_SUCCESS)
return ret;
@@ -1254,7 +1254,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
}
/* Read 6 bytes starting at xyz_reg */
- ret = raw_read_n__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read_n(s->port, s->i2c_spi_addr_flags,
get_xyz_reg(s->type), data, 6);
if (ret != EC_SUCCESS) {
@@ -1270,22 +1270,22 @@ static int init(const struct motion_sensor_t *s)
int ret = 0, tmp, i;
struct accelgyro_saved_data_t *saved_data = BMI160_GET_SAVED_DATA(s);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_CHIP_ID, &tmp);
if (ret)
return EC_ERROR_UNKNOWN;
if (tmp != BMI160_CHIP_ID_MAJOR && tmp != BMI168_CHIP_ID_MAJOR) {
/* The device may be lock on paging mode. Try to unlock it. */
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_EXT_MODE_EN_B0);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_EXT_MODE_EN_B1);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_EXT_MODE_EN_B2);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR, BMI160_CMD_PAGING_EN);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR, 0);
return EC_ERROR_ACCESS_DENIED;
}
@@ -1295,7 +1295,7 @@ static int init(const struct motion_sensor_t *s)
struct bmi160_drv_data_t *data = BMI160_GET_DATA(s);
/* Reset the chip to be in a good state */
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_SOFT_RESET);
msleep(1);
data->flags &= ~(BMI160_FLAG_SEC_I2C_ENABLED |
@@ -1314,7 +1314,7 @@ static int init(const struct motion_sensor_t *s)
#endif
#endif
/* To avoid gyro wakeup */
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_PMU_TRIGGER, 0);
}
@@ -1326,7 +1326,7 @@ static int init(const struct motion_sensor_t *s)
* To be able to configure the real magnetometer, we must set
* the BMI160 magnetometer part (a pass through) in normal mode.
*/
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_MODE_NORMAL(s->type));
msleep(wakeup_time[s->type]);
@@ -1340,49 +1340,49 @@ static int init(const struct motion_sensor_t *s)
*
* Magic command sequences
*/
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_EXT_MODE_EN_B0);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_EXT_MODE_EN_B1);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_EXT_MODE_EN_B2);
/*
* Change the register page to target mode, to change
* the internal pull ups of the secondary interface.
*/
- raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR, &ext_page_reg);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR,
ext_page_reg | BMI160_CMD_TARGET_PAGE);
- raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR, &ext_page_reg);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR,
ext_page_reg | BMI160_CMD_PAGING_EN);
- raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_COM_C_TRIM_ADDR, &pullup_reg);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_COM_C_TRIM_ADDR,
pullup_reg | BMI160_COM_C_TRIM);
- raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR, &ext_page_reg);
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR,
ext_page_reg & ~BMI160_CMD_TARGET_PAGE);
- raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_read8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_EXT_MODE_ADDR, &ext_page_reg);
/* Set the i2c address of the compass */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_MAG_IF_0,
- I2C_GET_ADDR__7b(
- CONFIG_ACCELGYRO_SEC_ADDR__7BF)
+ I2C_GET_ADDR(
+ CONFIG_ACCELGYRO_SEC_ADDR_FLAGS)
<< 1);
/* Enable the secondary interface as I2C */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_IF_CONF,
BMI160_IF_MODE_AUTO_I2C <<
BMI160_IF_MODE_OFF);
@@ -1390,7 +1390,7 @@ static int init(const struct motion_sensor_t *s)
}
- bmi160_sec_access_ctrl__7bf(s->port, s->i2c_spi_addr__7bf, 1);
+ bmi160_sec_access_ctrl(s->port, s->i2c_spi_addr_flags, 1);
ret = bmm150_init(s);
if (ret)
@@ -1398,13 +1398,13 @@ static int init(const struct motion_sensor_t *s)
return ret;
/* Leave the address for reading the data */
- raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_write8(s->port, s->i2c_spi_addr_flags,
BMI160_MAG_I2C_READ_ADDR, BMM150_BASE_DATA);
/*
* Put back the secondary interface in normal mode.
* BMI160 will poll based on the configure ODR.
*/
- bmi160_sec_access_ctrl__7bf(s->port, s->i2c_spi_addr__7bf, 0);
+ bmi160_sec_access_ctrl(s->port, s->i2c_spi_addr_flags, 0);
/*
* Clean interrupt event that may have occurred while the
@@ -1462,8 +1462,8 @@ struct i2c_stress_test_dev bmi160_i2c_stress_test_dev = {
.read_val = BMI160_CHIP_ID_MAJOR,
.write_reg = BMI160_PMU_TRIGGER,
},
- .i2c_read__7bf = &raw_read8__7bf,
- .i2c_write__7bf = &raw_write8__7bf,
+ .i2c_read = &raw_read8,
+ .i2c_write = &raw_write8,
};
#endif /* CONFIG_CMD_I2C_STRESS_TEST_ACCEL */
@@ -1473,7 +1473,7 @@ int bmi160_get_sensor_temp(int idx, int *temp_ptr)
int16_t temp;
int ret;
- ret = raw_read_n__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read_n(s->port, s->i2c_spi_addr_flags,
BMI160_TEMPERATURE_0,
(uint8_t *)&temp, sizeof(temp));
diff --git a/driver/accelgyro_bmi160.h b/driver/accelgyro_bmi160.h
index 4f9cc61b84..a5a152f471 100644
--- a/driver/accelgyro_bmi160.h
+++ b/driver/accelgyro_bmi160.h
@@ -13,19 +13,16 @@
/*
* The addr field of motion_sensor support both SPI and I2C:
- *
- * +-------------------------------+---+
- * | 7 bit i2c address | 0 |
- * +-------------------------------+---+
- * Or
- * +-------------------------------+---+
- * | SPI device ID | 1 |
- * +-------------------------------+---+
+ * This is defined in include/i2c.h and is no longer an 8bit
+ * address. The 7/10 bit address starts at bit 0 and leaves
+ * room for a 10 bit address, although we don't currently
+ * have any 10 bit slaves. I2C or SPI is indicated by a
+ * more significant bit
*/
/* I2C addresses */
-#define BMI160_ADDR0__7bf 0x68
-#define BMI160_ADDR1__7bf 0x69
+#define BMI160_ADDR0_FLAGS 0x68
+#define BMI160_ADDR1_FLAGS 0x69
#define BMI160_CHIP_ID 0x00
#define BMI160_CHIP_ID_MAJOR 0xd1
@@ -486,9 +483,9 @@ void bmi160_interrupt(enum gpio_signal signal);
#ifdef CONFIG_BMI160_SEC_I2C
/* Functions to access the secondary device through the accel/gyro. */
-int bmi160_sec_raw_read8__7bf(const int port, const uint16_t addr__7bf,
+int bmi160_sec_raw_read8(const int port, const uint16_t addr_flags,
const uint8_t reg, int *data_ptr);
-int bmi160_sec_raw_write8__7bf(const int port, const uint16_t addr__7bf,
+int bmi160_sec_raw_write8(const int port, const uint16_t addr_flags,
const uint8_t reg, int data);
#endif
diff --git a/driver/accelgyro_lsm6ds0.c b/driver/accelgyro_lsm6ds0.c
index 19ed4fa272..54ee1c77cc 100644
--- a/driver/accelgyro_lsm6ds0.c
+++ b/driver/accelgyro_lsm6ds0.c
@@ -151,19 +151,19 @@ static int get_engineering_val(const int reg_val,
/**
* Read register from accelerometer.
*/
-static inline int raw_read8__7bf(const int port, const uint16_t i2c_addr__7bf,
+static inline int raw_read8(const int port, const uint16_t i2c_addr_flags,
const int reg, int *data_ptr)
{
- return i2c_read8__7bf(port, i2c_addr__7bf, reg, data_ptr);
+ return i2c_read8(port, i2c_addr_flags, reg, data_ptr);
}
/**
* Write register from accelerometer.
*/
-static inline int raw_write8__7bf(const int port, const uint16_t i2c_addr__7bf,
+static inline int raw_write8(const int port, const uint16_t i2c_addr_flags,
const int reg, int data)
{
- return i2c_write8__7bf(port, i2c_addr__7bf, reg, data);
+ return i2c_write8(port, i2c_addr_flags, reg, data);
}
static int set_range(const struct motion_sensor_t *s,
@@ -186,13 +186,13 @@ static int set_range(const struct motion_sensor_t *s,
*/
mutex_lock(s->mutex);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, &ctrl_val);
if (ret != EC_SUCCESS)
goto accel_cleanup;
ctrl_val = (ctrl_val & ~LSM6DS0_RANGE_MASK) | reg_val;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, ctrl_val);
/* Now that we have set the range, update the driver's value. */
@@ -236,12 +236,12 @@ static int set_data_rate(const struct motion_sensor_t *s,
*/
mutex_lock(s->mutex);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, ctrl_reg, &val);
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags, ctrl_reg, &val);
if (ret != EC_SUCCESS)
goto accel_cleanup;
val = (val & ~LSM6DS0_ODR_MASK) | reg_val;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf, ctrl_reg, val);
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags, ctrl_reg, val);
/* Now that we have set the odr, update the driver's value. */
if (ret == EC_SUCCESS)
@@ -256,7 +256,7 @@ static int set_data_rate(const struct motion_sensor_t *s,
* Table 48 Gyroscope high-pass filter cutoff frequency
*/
if (MOTIONSENSE_TYPE_GYRO == s->type) {
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DS0_CTRL_REG3_G, &val);
if (ret != EC_SUCCESS)
goto accel_cleanup;
@@ -264,7 +264,7 @@ static int set_data_rate(const struct motion_sensor_t *s,
val = (rate > 119000) ?
(val | (1<<7)) /* set high-power mode */ :
(val & ~(1<<7)); /* set low-power mode */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DS0_CTRL_REG3_G, val);
}
@@ -308,7 +308,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready)
{
int ret, tmp;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DS0_STATUS_REG, &tmp);
if (ret != EC_SUCCESS) {
@@ -349,7 +349,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
xyz_reg = get_xyz_reg(s->type);
/* Read 6 bytes starting at xyz_reg */
- ret = i2c_read_block__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_read_block(s->port, s->i2c_spi_addr_flags,
xyz_reg, raw, 6);
if (ret != EC_SUCCESS) {
@@ -375,7 +375,7 @@ static int init(const struct motion_sensor_t *s)
{
int ret = 0, tmp;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DS0_WHO_AM_I_REG, &tmp);
if (ret)
return EC_ERROR_UNKNOWN;
@@ -398,14 +398,14 @@ static int init(const struct motion_sensor_t *s)
if (MOTIONSENSE_TYPE_ACCEL == s->type) {
mutex_lock(s->mutex);
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DS0_CTRL_REG8, &tmp);
if (ret) {
mutex_unlock(s->mutex);
return EC_ERROR_UNKNOWN;
}
tmp |= (1 | LSM6DS0_BDU_ENABLE);
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DS0_CTRL_REG8, tmp);
mutex_unlock(s->mutex);
@@ -413,7 +413,7 @@ static int init(const struct motion_sensor_t *s)
return ret;
/* Power Down Gyro */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DS0_CTRL_REG1_G, 0x0);
if (ret)
return ret;
diff --git a/driver/accelgyro_lsm6ds0.h b/driver/accelgyro_lsm6ds0.h
index 4724dac168..c6b0789c08 100644
--- a/driver/accelgyro_lsm6ds0.h
+++ b/driver/accelgyro_lsm6ds0.h
@@ -15,8 +15,8 @@
* 7-bit address is 110101Xb. Where 'X' is determined
* by the voltage on the ADDR pin.
*/
-#define LSM6DS0_ADDR0__7bf 0x6a
-#define LSM6DS0_ADDR1__7bf 0x6b
+#define LSM6DS0_ADDR0_FLAGS 0x6a
+#define LSM6DS0_ADDR1_FLAGS 0x6b
/* who am I */
#define LSM6DS0_WHO_AM_I 0x68
diff --git a/driver/accelgyro_lsm6dsm.c b/driver/accelgyro_lsm6dsm.c
index aa60013f33..e2bba975d6 100644
--- a/driver/accelgyro_lsm6dsm.c
+++ b/driver/accelgyro_lsm6dsm.c
@@ -106,14 +106,14 @@ static int config_interrupt(const struct motion_sensor_t *accel)
int ret = EC_SUCCESS;
int int1_ctrl_val;
- ret = st_raw_read8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ ret = st_raw_read8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_INT1_CTRL, &int1_ctrl_val);
if (ret != EC_SUCCESS)
return ret;
#ifdef CONFIG_ACCEL_FIFO
/* As soon as one sample is ready, trigger an interrupt. */
- ret = st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ ret = st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL1_ADDR,
OUT_XYZ_SIZE / sizeof(uint16_t));
if (ret != EC_SUCCESS)
@@ -122,7 +122,7 @@ static int config_interrupt(const struct motion_sensor_t *accel)
LSM6DSM_INT_FIFO_FULL;
#endif /* CONFIG_ACCEL_FIFO */
- return st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ return st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_INT1_CTRL, int1_ctrl_val);
}
@@ -135,7 +135,7 @@ static int config_interrupt(const struct motion_sensor_t *accel)
*/
static int fifo_disable(const struct motion_sensor_t *accel)
{
- return st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ return st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL5_ADDR, 0x00);
}
@@ -195,7 +195,7 @@ static int fifo_enable(const struct motion_sensor_t *accel)
/* FIFO ODR must be set before the decimation factors */
odr_reg_val = LSM6DSM_ODR_TO_REG(max_odr) <<
LSM6DSM_FIFO_CTRL5_ODR_OFF;
- err = st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ err = st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL5_ADDR, odr_reg_val);
/* Scan all sensors configuration to calculate FIFO decimator. */
@@ -213,12 +213,12 @@ static int fifo_enable(const struct motion_sensor_t *accel)
private->config.samples_in_pattern[i] = 0;
}
}
- st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL3_ADDR,
(decimators[FIFO_DEV_GYRO] << LSM6DSM_FIFO_DEC_G_OFF) |
(decimators[FIFO_DEV_ACCEL] << LSM6DSM_FIFO_DEC_XL_OFF));
#ifdef CONFIG_LSM6DSM_SEC_I2C
- st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL4_ADDR,
decimators[FIFO_DEV_MAG]);
@@ -255,7 +255,7 @@ static int fifo_enable(const struct motion_sensor_t *accel)
* After ODR and decimation values are set, continuous mode can be
* enabled
*/
- err = st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ err = st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL5_ADDR,
odr_reg_val | LSM6DSM_FIFO_MODE_CONTINUOUS_VAL);
if (err != EC_SUCCESS)
@@ -396,7 +396,7 @@ static int load_fifo(struct motion_sensor_t *s, const struct fstatus *fsts,
length = left;
/* Read data and copy in buffer. */
- err = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ err = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSM_FIFO_DATA_ADDR,
fifo, length);
*last_fifo_read_ts = __hw_clock_source_read();
@@ -427,7 +427,7 @@ static int is_fifo_empty(struct motion_sensor_t *s, struct fstatus *fsts)
if (s->flags & MOTIONSENSE_FLAG_INT_SIGNAL)
return gpio_get_level(s->int_signal);
CPRINTS("Interrupt signal not set for %s", s->name);
- res = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ res = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSM_FIFO_STS1_ADDR,
(int8_t *)fsts, sizeof(*fsts));
/* If we failed to read the FIFO size assume empty. */
@@ -475,7 +475,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
last_interrupt_timestamp;
/* Read how many data pattern on FIFO to read and pattern. */
- ret = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSM_FIFO_STS1_ADDR,
(uint8_t *)&fsts, sizeof(fsts));
if (ret != EC_SUCCESS)
@@ -655,7 +655,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready)
{
int ret, tmp;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_STATUS_REG, &tmp);
if (ret != EC_SUCCESS) {
CPRINTS("%s type:0x%X RS Error", s->name, s->type);
@@ -699,7 +699,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
xyz_reg = get_xyz_reg(s->type);
/* Read data bytes starting at xyz_reg. */
- ret = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
xyz_reg, raw, OUT_XYZ_SIZE);
if (ret != EC_SUCCESS)
return ret;
@@ -715,7 +715,7 @@ static int init(const struct motion_sensor_t *s)
struct stprivate_data *data = s->drv_data;
uint8_t ctrl_reg, reg_val = 0;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_WHO_AM_I_REG, &tmp);
if (ret != EC_SUCCESS)
return EC_ERROR_UNKNOWN;
@@ -741,19 +741,19 @@ static int init(const struct motion_sensor_t *s)
ctrl_reg = LSM6DSM_ODR_REG(MOTIONSENSE_TYPE_ACCEL);
/* Power OFF gyro. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL2_ADDR, 0);
if (ret != EC_SUCCESS)
goto err_unlock;
/* Power ON Accel. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, reg_val);
if (ret != EC_SUCCESS)
goto err_unlock;
/* Software reset. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL3_ADDR, LSM6DSM_SW_RESET);
if (ret != EC_SUCCESS)
goto err_unlock;
@@ -767,12 +767,12 @@ static int init(const struct motion_sensor_t *s)
*/
/* Power ON Accel. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, reg_val);
if (ret != EC_SUCCESS)
goto err_unlock;
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL3_ADDR, LSM6DSM_BOOT);
if (ret != EC_SUCCESS)
goto err_unlock;
@@ -784,7 +784,7 @@ static int init(const struct motion_sensor_t *s)
msleep(15);
/* Power OFF Accel. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, 0);
if (ret != EC_SUCCESS)
goto err_unlock;
@@ -794,11 +794,11 @@ static int init(const struct motion_sensor_t *s)
* Output data not updated until have been read.
* Prefer interrupt to be active low.
*/
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
- LSM6DSM_CTRL3_ADDR,
- LSM6DSM_BDU
- | LSM6DSM_H_L_ACTIVE
- | LSM6DSM_IF_INC);
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
+ LSM6DSM_CTRL3_ADDR,
+ LSM6DSM_BDU
+ | LSM6DSM_H_L_ACTIVE
+ | LSM6DSM_IF_INC);
if (ret != EC_SUCCESS)
goto err_unlock;
diff --git a/driver/accelgyro_lsm6dsm.h b/driver/accelgyro_lsm6dsm.h
index a23298f11b..3c4ba5d8bb 100644
--- a/driver/accelgyro_lsm6dsm.h
+++ b/driver/accelgyro_lsm6dsm.h
@@ -17,8 +17,8 @@
* 7-bit address is 110101xb. Where 'x' is determined
* by the voltage on the ADDR pin
*/
-#define LSM6DSM_ADDR0__7bf 0x6a
-#define LSM6DSM_ADDR1__7bf 0x6b
+#define LSM6DSM_ADDR0_FLAGS 0x6a
+#define LSM6DSM_ADDR1_FLAGS 0x6b
/* COMMON DEFINE FOR ACCEL-GYRO SENSORS */
#define LSM6DSM_EN_BIT 0x01
diff --git a/driver/accelgyro_lsm6dso.c b/driver/accelgyro_lsm6dso.c
index f7d44e0e93..c9ad09f740 100644
--- a/driver/accelgyro_lsm6dso.c
+++ b/driver/accelgyro_lsm6dso.c
@@ -55,7 +55,7 @@ static int config_interrupt(const struct motion_sensor_t *s)
#ifdef CONFIG_ACCEL_FIFO
int int1_ctrl_val;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_INT1_CTRL, &int1_ctrl_val);
if (ret != EC_SUCCESS)
return ret;
@@ -67,7 +67,7 @@ static int config_interrupt(const struct motion_sensor_t *s)
* number or samples still present in FIFO exceeds the configured
* threshold.
*/
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_FIFO_CTRL1_ADDR, 1);
if (ret != EC_SUCCESS)
return ret;
@@ -75,7 +75,7 @@ static int config_interrupt(const struct motion_sensor_t *s)
int1_ctrl_val |= LSM6DSO_INT_FIFO_TH | LSM6DSO_INT_FIFO_OVR |
LSM6DSO_INT_FIFO_FULL;
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_INT1_CTRL, int1_ctrl_val);
#endif /* CONFIG_ACCEL_FIFO */
@@ -89,7 +89,7 @@ static int config_interrupt(const struct motion_sensor_t *s)
*/
static int fifo_disable(const struct motion_sensor_t *s)
{
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_FIFO_CTRL4_ADDR,
LSM6DSO_FIFO_MODE_BYPASS_VAL);
}
@@ -102,7 +102,7 @@ static int fifo_disable(const struct motion_sensor_t *s)
*/
static int fifo_enable(const struct motion_sensor_t *s)
{
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_FIFO_CTRL4_ADDR,
LSM6DSO_FIFO_MODE_CONTINUOUS_VAL);
}
@@ -171,7 +171,7 @@ static inline int load_fifo(struct motion_sensor_t *s,
fifo_len = fifo_depth * LSM6DSO_FIFO_SAMPLE_SIZE;
while (read_len < fifo_len) {
word_len = GENERIC_MIN(fifo_len - read_len, sizeof(fifo));
- err = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ err = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSO_FIFO_DATA_ADDR_TAG,
fifo, word_len);
if (err != EC_SUCCESS)
@@ -247,7 +247,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
#ifdef CONFIG_ACCEL_FIFO
/* Read how many data patterns on FIFO to read. */
- ret = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSO_FIFO_STS1_ADDR,
(uint8_t *)&fsts, sizeof(fsts));
if (ret != EC_SUCCESS)
@@ -369,7 +369,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready)
{
int ret, tmp;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_STATUS_REG, &tmp);
if (ret != EC_SUCCESS) {
CPRINTS("%s type:0x%X RS Error", s->name, s->type);
@@ -415,7 +415,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
xyz_reg = get_xyz_reg(s->type);
/* Read data bytes starting at xyz_reg. */
- ret = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
xyz_reg, raw, OUT_XYZ_SIZE);
if (ret != EC_SUCCESS)
return ret;
@@ -431,7 +431,7 @@ static int init(const struct motion_sensor_t *s)
int ret = 0, tmp;
struct stprivate_data *data = LSM6DSO_GET_DATA(s);
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_WHO_AM_I_REG, &tmp);
if (ret != EC_SUCCESS)
return EC_ERROR_UNKNOWN;
@@ -450,7 +450,7 @@ static int init(const struct motion_sensor_t *s)
mutex_lock(s->mutex);
/* Software reset. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_CTRL3_ADDR, LSM6DSO_SW_RESET);
if (ret != EC_SUCCESS)
goto err_unlock;
@@ -459,7 +459,7 @@ static int init(const struct motion_sensor_t *s)
* Output data not updated until have been read.
* Prefer interrupt to be active low.
*/
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSO_CTRL3_ADDR,
LSM6DSO_BDU | LSM6DSO_IF_INC);
if (ret != EC_SUCCESS)
diff --git a/driver/accelgyro_lsm6dso.h b/driver/accelgyro_lsm6dso.h
index 4d59fd1a07..a823fe7e61 100644
--- a/driver/accelgyro_lsm6dso.h
+++ b/driver/accelgyro_lsm6dso.h
@@ -14,8 +14,8 @@
* 7-bit address is 110101xb. Where 'x' is determined
* by the voltage on the ADDR pin
*/
-#define LSM6DSO_ADDR0__7bf 0x6a
-#define LSM6DSO_ADDR1__7bf 0x6b
+#define LSM6DSO_ADDR0_FLAGS 0x6a
+#define LSM6DSO_ADDR1_FLAGS 0x6b
/* Access to embedded sensor hub register bank */
#define LSM6DSO_FUNC_CFG_ACC_ADDR 0x01
diff --git a/driver/als_al3010.h b/driver/als_al3010.h
index f4de75ed0e..288e255990 100644
--- a/driver/als_al3010.h
+++ b/driver/als_al3010.h
@@ -9,9 +9,9 @@
#define __CROS_EC_ALS_AL3010_H
/* I2C interface */
-#define AL3010_I2C_ADDR1__7bf (0x1C)
-#define AL3010_I2C_ADDR2__7bf (0x1D)
-#define AL3010_I2C_ADDR3__7bf (0x1E)
+#define AL3010_I2C_ADDR1_FLAGS 0x1C
+#define AL3010_I2C_ADDR2_FLAGS 0x1D
+#define AL3010_I2C_ADDR3_FLAGS 0x1E
/* AL3010 registers */
#define AL3010_REG_SYSTEM 0x00
diff --git a/driver/als_bh1730.c b/driver/als_bh1730.c
index 4b0b50e0a1..9480b4c5f0 100644
--- a/driver/als_bh1730.c
+++ b/driver/als_bh1730.c
@@ -62,7 +62,7 @@ static int bh1730_read_lux(const struct motion_sensor_t *s, intv3_t v)
int data0_1;
/* read data0 and data1 from sensor */
- ret = i2c_read32__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_read32(s->port, s->i2c_spi_addr_flags,
BH1730_DATA0LOW, &data0_1);
if (ret != EC_SUCCESS) {
CPRINTF("bh1730_read_lux - fail %d\n", ret);
@@ -137,7 +137,7 @@ static int bh1730_init(const struct motion_sensor_t *s)
int ret;
/* power and measurement bit high */
- ret = i2c_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_write8(s->port, s->i2c_spi_addr_flags,
BH1730_CONTROL,
BH1730_CONTROL_POWER_ENABLE
| BH1730_CONTROL_ADC_EN_ENABLE);
@@ -148,14 +148,14 @@ static int bh1730_init(const struct motion_sensor_t *s)
}
/* set timing */
- ret = i2c_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_write8(s->port, s->i2c_spi_addr_flags,
BH1730_TIMING, BH1730_CONF_ITIME);
if (ret != EC_SUCCESS) {
CPRINTF("bh1730_init_sensor - time fail %d\n", ret);
return ret;
}
/* set ADC gain */
- ret = i2c_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_write8(s->port, s->i2c_spi_addr_flags,
BH1730_GAIN, BH1730_CONF_GAIN);
if (ret != EC_SUCCESS) {
diff --git a/driver/als_bh1730.h b/driver/als_bh1730.h
index f729d3edaa..d0205033e4 100644
--- a/driver/als_bh1730.h
+++ b/driver/als_bh1730.h
@@ -9,7 +9,7 @@
#define __CROS_EC_ALS_BH1730_H
/* I2C interface */
-#define BH1730_I2C_ADDR__7bf 0x29
+#define BH1730_I2C_ADDR_FLAGS 0x29
/* BH1730 registers */
#define BH1730_CONTROL 0x80
diff --git a/driver/als_isl29035.c b/driver/als_isl29035.c
index 341489979f..db77a19f09 100644
--- a/driver/als_isl29035.c
+++ b/driver/als_isl29035.c
@@ -9,7 +9,7 @@
#include "i2c.h"
/* I2C interface */
-#define ILS29035_I2C_ADDR__7bf 0x44
+#define ILS29035_I2C_ADDR_FLAGS 0x44
#define ILS29035_REG_COMMAND_I 0
#define ILS29035_REG_COMMAND_II 1
#define ILS29035_REG_DATA_LSB 2
@@ -27,7 +27,7 @@ int isl29035_init(void)
* zero, but it makes the hook/update code cleaner (we don't want to
* wait 90ms to read on demand while processing hook callbacks).
*/
- return i2c_write8__7bf(I2C_PORT_ALS, ILS29035_I2C_ADDR__7bf,
+ return i2c_write8(I2C_PORT_ALS, ILS29035_I2C_ADDR_FLAGS,
ILS29035_REG_COMMAND_I, 0xa0);
}
@@ -43,13 +43,13 @@ int isl29035_read_lux(int *lux, int af)
*/
/* Read lsb */
- rv = i2c_read8__7bf(I2C_PORT_ALS, ILS29035_I2C_ADDR__7bf,
+ rv = i2c_read8(I2C_PORT_ALS, ILS29035_I2C_ADDR_FLAGS,
ILS29035_REG_DATA_LSB, &lsb);
if (rv)
return rv;
/* Read msb */
- rv = i2c_read8__7bf(I2C_PORT_ALS, ILS29035_I2C_ADDR__7bf,
+ rv = i2c_read8(I2C_PORT_ALS, ILS29035_I2C_ADDR_FLAGS,
ILS29035_REG_DATA_MSB, &msb);
if (rv)
return rv;
diff --git a/driver/als_opt3001.c b/driver/als_opt3001.c
index 42a06bfdcc..e6332184c0 100644
--- a/driver/als_opt3001.c
+++ b/driver/als_opt3001.c
@@ -17,7 +17,7 @@ static int opt3001_i2c_read(const int reg, int *data_ptr)
{
int ret;
- ret = i2c_read16__7bf(I2C_PORT_ALS, OPT3001_I2C_ADDR__7bf,
+ ret = i2c_read16(I2C_PORT_ALS, OPT3001_I2C_ADDR_FLAGS,
reg, data_ptr);
if (!ret)
*data_ptr = ((*data_ptr << 8) & 0xFF00) |
@@ -32,7 +32,7 @@ static int opt3001_i2c_read(const int reg, int *data_ptr)
static int opt3001_i2c_write(const int reg, int data)
{
data = ((data << 8) & 0xFF00) | ((data >> 8) & 0x00FF);
- return i2c_write16__7bf(I2C_PORT_ALS, OPT3001_I2C_ADDR__7bf,
+ return i2c_write16(I2C_PORT_ALS, OPT3001_I2C_ADDR_FLAGS,
reg, data);
}
@@ -110,13 +110,13 @@ struct i2c_stress_test_dev opt3001_i2c_stress_test_dev = {
/**
* Read register from OPT3001 light sensor.
*/
-static int opt3001_i2c_read__7bf(const int port,
- const uint16_t i2c_addr__7bf,
+static int opt3001_i2c_read(const int port,
+ const uint16_t i2c_addr_flags,
const int reg, int *data_ptr)
{
int ret;
- ret = i2c_read16__7bf(port, i2c_addr__7bf,
+ ret = i2c_read16(port, i2c_addr_flags,
reg, data_ptr);
if (!ret)
*data_ptr = ((*data_ptr << 8) & 0xFF00) |
@@ -128,13 +128,12 @@ static int opt3001_i2c_read__7bf(const int port,
/**
* Write register to OPT3001 light sensor.
*/
-static int opt3001_i2c_write__7bf(const int port,
- const uint16_t i2c_addr__7bf,
+static int opt3001_i2c_write(const int port,
+ const uint16_t i2c_addr_flags,
const int reg, int data)
{
data = ((data << 8) & 0xFF00) | ((data >> 8) & 0x00FF);
- return i2c_write16__7bf(port, i2c_addr__7bf,
- reg, data);
+ return i2c_write16(port, i2c_addr_flags, reg, data);
}
/**
@@ -146,7 +145,7 @@ int opt3001_read_lux(const struct motion_sensor_t *s, intv3_t v)
int ret;
int data;
- ret = opt3001_i2c_read__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags,
OPT3001_REG_RESULT, &data);
if (ret)
return ret;
@@ -218,12 +217,12 @@ static int opt3001_set_data_rate(const struct motion_sensor_t *s,
if (rate > 1000)
rate = 1000;
}
- rv = opt3001_i2c_read__7bf(s->port, s->i2c_spi_addr__7bf,
+ rv = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags,
OPT3001_REG_CONFIGURE, &reg);
if (rv)
return rv;
- rv = opt3001_i2c_write__7bf(s->port, s->i2c_spi_addr__7bf,
+ rv = opt3001_i2c_write(s->port, s->i2c_spi_addr_flags,
OPT3001_REG_CONFIGURE,
(reg & OPT3001_MODE_MASK) |
(mode << OPT3001_MODE_OFFSET));
@@ -271,14 +270,14 @@ static int opt3001_init(const struct motion_sensor_t *s)
int data;
int ret;
- ret = opt3001_i2c_read__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags,
OPT3001_REG_MAN_ID, &data);
if (ret)
return ret;
if (data != OPT3001_MANUFACTURER_ID)
return EC_ERROR_ACCESS_DENIED;
- ret = opt3001_i2c_read__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags,
OPT3001_REG_DEV_ID, &data);
if (ret)
return ret;
@@ -290,7 +289,7 @@ static int opt3001_init(const struct motion_sensor_t *s)
* [11] : 1b Conversion time 800ms
* [4] : 1b Latched window-style comparison operation
*/
- opt3001_i2c_write__7bf(s->port, s->i2c_spi_addr__7bf,
+ opt3001_i2c_write(s->port, s->i2c_spi_addr_flags,
OPT3001_REG_CONFIGURE, 0xC810);
opt3001_set_range(s, s->default_range, 0);
@@ -316,8 +315,8 @@ struct i2c_stress_test_dev opt3001_i2c_stress_test_dev = {
.read_val = OPT3001_DEVICE_ID,
.write_reg = OPT3001_REG_INT_LIMIT_LSB,
},
- .i2c_read__7bf = &opt3001_i2c_read__7bf,
- .i2c_write__7bf = &opt3001_i2c_write__7bf,
+ .i2c_read = &opt3001_i2c_read,
+ .i2c_write = &opt3001_i2c_write,
};
#endif /* CONFIG_CMD_I2C_STRESS_TEST_ALS */
#endif /* HAS_TASK_ALS */
diff --git a/driver/als_opt3001.h b/driver/als_opt3001.h
index 34d129b5a5..6706734870 100644
--- a/driver/als_opt3001.h
+++ b/driver/als_opt3001.h
@@ -9,10 +9,10 @@
#define __CROS_EC_ALS_OPT3001_H
/* I2C interface */
-#define OPT3001_I2C_ADDR1__7bf 0x44
-#define OPT3001_I2C_ADDR2__7bf 0x45
-#define OPT3001_I2C_ADDR3__7bf 0x46
-#define OPT3001_I2C_ADDR4__7bf 0x47
+#define OPT3001_I2C_ADDR1_FLAGS 0x44
+#define OPT3001_I2C_ADDR2_FLAGS 0x45
+#define OPT3001_I2C_ADDR3_FLAGS 0x46
+#define OPT3001_I2C_ADDR4_FLAGS 0x47
/* OPT3001 registers */
#define OPT3001_REG_RESULT 0x00
diff --git a/driver/als_si114x.c b/driver/als_si114x.c
index f0b3165e67..5cfc19c6a8 100644
--- a/driver/als_si114x.c
+++ b/driver/als_si114x.c
@@ -27,28 +27,28 @@ static int init(const struct motion_sensor_t *s);
/**
* Read 8bit register from device.
*/
-static inline int raw_read8__7bf(const int port, const uint16_t i2c_addr__7bf,
+static inline int raw_read8(const int port, const uint16_t i2c_addr_flags,
const int reg, int *data_ptr)
{
- return i2c_read8__7bf(port, i2c_addr__7bf, reg, data_ptr);
+ return i2c_read8(port, i2c_addr_flags, reg, data_ptr);
}
/**
* Write 8bit register from device.
*/
-static inline int raw_write8__7bf(const int port, const uint16_t i2c_addr__7bf,
+static inline int raw_write8(const int port, const uint16_t i2c_addr_flags,
const int reg, int data)
{
- return i2c_write8__7bf(port, i2c_addr__7bf, reg, data);
+ return i2c_write8(port, i2c_addr_flags, reg, data);
}
/**
* Read 16bit register from device.
*/
-static inline int raw_read16__7bf(const int port, const uint16_t i2c_addr__7bf,
+static inline int raw_read16(const int port, const uint16_t i2c_addr_flags,
const int reg, int *data_ptr)
{
- return i2c_read16__7bf(port, i2c_addr__7bf, reg, data_ptr);
+ return i2c_read16(port, i2c_addr_flags, reg, data_ptr);
}
/* helper function to operate on parameter values: op can be query/set/or/and */
@@ -62,18 +62,18 @@ static int si114x_param_op(const struct motion_sensor_t *s,
mutex_lock(s->mutex);
if (op != SI114X_CMD_PARAM_QUERY) {
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_PARAM_WR, *value);
if (ret != EC_SUCCESS)
goto error;
}
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_COMMAND, op | (param & 0x1F));
if (ret != EC_SUCCESS)
goto error;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_PARAM_RD, value);
if (ret != EC_SUCCESS)
goto error;
@@ -98,7 +98,7 @@ static int si114x_read_results(struct motion_sensor_t *s, int nb)
/* Read ALX result */
for (i = 0; i < nb; i++) {
- ret = raw_read16__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read16(s->port, s->i2c_spi_addr_flags,
type_data->base_data_reg + i * 2,
&val);
if (ret)
@@ -198,7 +198,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
if (!(*event & CONFIG_ALS_SI114X_INT_EVENT))
return EC_ERROR_NOT_HANDLED;
- ret = raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_read8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_IRQ_STATUS, &val);
if (ret)
return ret;
@@ -207,7 +207,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
return EC_ERROR_INVAL;
/* clearing IRQ */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_IRQ_STATUS,
val & type_data->irq_flags);
if (ret != EC_SUCCESS)
@@ -220,7 +220,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
ret = si114x_read_results(s, 1);
/* Fire pending requests */
if (data->state == SI114X_ALS_IN_PROGRESS_PS_PENDING) {
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_COMMAND,
SI114X_CMD_PS_FORCE);
data->state = SI114X_PS_IN_PROGRESS;
@@ -233,7 +233,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
/* Read PS results */
ret = si114x_read_results(s, SI114X_NUM_LEDS);
if (data->state == SI114X_PS_IN_PROGRESS_ALS_PENDING) {
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_COMMAND,
SI114X_CMD_ALS_FORCE);
data->state = SI114X_ALS_IN_PROGRESS;
@@ -288,7 +288,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
CPRINTS("Invalid sensor type");
return EC_ERROR_INVAL;
}
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_COMMAND, cmd);
#ifdef CONFIG_ALS_SI114X_POLLING
hook_call_deferred(&si114x_read_deferred_data,
@@ -377,27 +377,27 @@ static int si114x_initialize(const struct motion_sensor_t *s)
int ret, val;
/* send reset command */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_COMMAND, SI114X_CMD_RESET);
if (ret != EC_SUCCESS)
return ret;
msleep(20);
/* hardware key, magic value */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_HW_KEY, 0x17);
if (ret != EC_SUCCESS)
return ret;
msleep(20);
/* interrupt configuration, interrupt output enable */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_INT_CFG, SI114X_INT_CFG_OE);
if (ret != EC_SUCCESS)
return ret;
/* enable interrupt for certain activities */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_IRQ_ENABLE,
SI114X_PS3_IE | SI114X_PS2_IE | SI114X_PS1_IE |
SI114X_ALS_INT0_IE);
@@ -405,19 +405,19 @@ static int si114x_initialize(const struct motion_sensor_t *s)
return ret;
/* Only forced mode */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_MEAS_RATE, 0);
if (ret != EC_SUCCESS)
return ret;
/* measure ALS every time device wakes up */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_ALS_RATE, 0);
if (ret != EC_SUCCESS)
return ret;
/* measure proximity every time device wakes up */
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_PS_RATE, 0);
if (ret != EC_SUCCESS)
return ret;
@@ -425,19 +425,19 @@ static int si114x_initialize(const struct motion_sensor_t *s)
/* set LED currents to maximum */
switch (SI114X_NUM_LEDS) {
case 3:
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_PS_LED3, 0x0f);
if (ret != EC_SUCCESS)
return ret;
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_PS_LED21, 0xff);
break;
case 2:
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_PS_LED21, 0xff);
break;
case 1:
- ret = raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_write8(s->port, s->i2c_spi_addr_flags,
SI114X_REG_PS_LED21, 0x0f);
break;
}
diff --git a/driver/als_si114x.h b/driver/als_si114x.h
index 8f7f3530d4..dc5459e8db 100644
--- a/driver/als_si114x.h
+++ b/driver/als_si114x.h
@@ -22,7 +22,7 @@
#ifndef __CROS_EC_ALS_SI114X_H
#define __CROS_EC_ALS_SI114X_H
-#define SI114X_ADDR__7bf 0x5a
+#define SI114X_ADDR_FLAGS 0x5a
#define SI114X_REG_PART_ID 0x00
#define SI114X_SI1141_ID 0x41
diff --git a/driver/als_tcs3400.c b/driver/als_tcs3400.c
index 8544f51a4b..f8a715cd75 100644
--- a/driver/als_tcs3400.c
+++ b/driver/als_tcs3400.c
@@ -24,13 +24,13 @@ static volatile uint32_t last_interrupt_timestamp;
static inline int tcs3400_i2c_read8(const struct motion_sensor_t *s,
int reg, int *data)
{
- return i2c_read8__7bf(s->port, s->i2c_spi_addr__7bf, reg, data);
+ return i2c_read8(s->port, s->i2c_spi_addr_flags, reg, data);
}
static inline int tcs3400_i2c_write8(const struct motion_sensor_t *s,
int reg, int data)
{
- return i2c_write8__7bf(s->port, s->i2c_spi_addr__7bf, reg, data);
+ return i2c_write8(s->port, s->i2c_spi_addr_flags, reg, data);
}
static void tcs3400_read_deferred(void)
@@ -113,7 +113,7 @@ static int tcs3400_post_events(struct motion_sensor_t *s, uint32_t last_ts)
} while (!(data & TCS_I2C_STATUS_RGBC_VALID));
/* Read the light registers */
- ret = i2c_read_block__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_read_block(s->port, s->i2c_spi_addr_flags,
TCS_DATA_START_LOCATION,
light_data, sizeof(light_data));
if (ret)
diff --git a/driver/als_tcs3400.h b/driver/als_tcs3400.h
index bfe1f0e5ab..bad2ec5857 100644
--- a/driver/als_tcs3400.h
+++ b/driver/als_tcs3400.h
@@ -9,7 +9,7 @@
#define __CROS_EC_ALS_TCS3400_H
/* I2C Interface */
-#define TCS3400_I2C_ADDR__7bf 0x39
+#define TCS3400_I2C_ADDR_FLAGS 0x39
/* ID for TCS34001 and TCS34005 */
#define TCS340015_DEVICE_ID 0x90
diff --git a/driver/baro_bmp280.c b/driver/baro_bmp280.c
index 10d1c4b91a..56376c8aa1 100644
--- a/driver/baro_bmp280.c
+++ b/driver/baro_bmp280.c
@@ -98,7 +98,7 @@ static int bmp280_get_calib_param(const struct motion_sensor_t *s)
uint8_t a_data_u8[BMP280_CALIB_DATA_SIZE] = {0};
struct bmp280_drv_data_t *data = BMP280_GET_DATA(s);
- ret = i2c_read_block__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_read_block(s->port, s->i2c_spi_addr_flags,
BMP280_TEMPERATURE_CALIB_DIG_T1_LSB_REG,
a_data_u8, BMP280_CALIB_DATA_SIZE);
@@ -129,7 +129,7 @@ static int bmp280_read_uncomp_pressure(const struct motion_sensor_t *s,
int ret;
uint8_t a_data_u8[BMP280_PRESSURE_DATA_SIZE] = {0};
- ret = i2c_read_block__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_read_block(s->port, s->i2c_spi_addr_flags,
BMP280_PRESSURE_MSB_REG,
a_data_u8, BMP280_PRESSURE_DATA_SIZE);
@@ -218,13 +218,13 @@ static int bmp280_set_standby_durn(const struct motion_sensor_t *s,
{
int ret, val;
- ret = i2c_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_read8(s->port, s->i2c_spi_addr_flags,
BMP280_CONFIG_REG, &val);
if (ret == EC_SUCCESS) {
val = (val & 0xE0) | ((durn << 5) & 0xE0);
/* write the standby duration*/
- ret = i2c_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = i2c_write8(s->port, s->i2c_spi_addr_flags,
BMP280_CONFIG_REG, val);
}
@@ -239,7 +239,7 @@ static int bmp280_set_power_mode(const struct motion_sensor_t *s,
val = (BMP280_OVERSAMP_TEMP << 5) +
(BMP280_OVERSAMP_PRES << 2) + power_mode;
- return i2c_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ return i2c_write8(s->port, s->i2c_spi_addr_flags,
BMP280_CTRL_MEAS_REG, val);
}
@@ -278,8 +278,8 @@ static int bmp280_init(const struct motion_sensor_t *s)
return EC_ERROR_INVAL;
/* Read chip id */
- ret = i2c_read8__7bf(s->port, s->i2c_spi_addr__7bf,
- BMP280_CHIP_ID_REG, &val);
+ ret = i2c_read8(s->port, s->i2c_spi_addr_flags,
+ BMP280_CHIP_ID_REG, &val);
if (ret)
return ret;
@@ -384,7 +384,7 @@ struct i2c_stress_test_dev bmp280_i2c_stress_test_dev = {
.read_val = BMP280_CHIP_ID,
.write_reg = BMP280_CONFIG_REG,
},
- .i2c_read__7bf = &i2c_read8__7bf,
- .i2c_write__7bf = &i2c_write8__7bf,
+ .i2c_read = &i2c_read8,
+ .i2c_write = &i2c_write8,
};
#endif /* CONFIG_CMD_I2C_STRESS_TEST_ACCEL */
diff --git a/driver/baro_bmp280.h b/driver/baro_bmp280.h
index f5070bd71d..ee95bd886f 100644
--- a/driver/baro_bmp280.h
+++ b/driver/baro_bmp280.h
@@ -74,8 +74,8 @@
* Bit 1 of 7-bit address: 0 - If SDO is connected to GND
* Bit 1 of 7-bit address: 1 - If SDO is connected to Vddio
*/
-#define BMP280_I2C_ADDRESS1__7bf 0x76
-#define BMP280_I2C_ADDRESS2__7bf 0x77
+#define BMP280_I2C_ADDRESS1_FLAGS 0x76
+#define BMP280_I2C_ADDRESS2_FLAGS 0x77
/*
* CHIP ID
diff --git a/driver/battery/bq27541.c b/driver/battery/bq27541.c
index c41914f4e8..b9c80c3b24 100644
--- a/driver/battery/bq27541.c
+++ b/driver/battery/bq27541.c
@@ -12,7 +12,7 @@
#include "i2c.h"
#include "util.h"
-#define BQ27541_ADDR__7bf 0x55
+#define BQ27541_ADDR_FLAGS 0x55
#define BQ27541_TYPE_ID 0x0541
#define BQ27741_TYPE_ID 0x0741
#define BQ27742_TYPE_ID 0x0742
diff --git a/driver/battery/bq27621_g1.c b/driver/battery/bq27621_g1.c
index 76d020f6df..8445516600 100644
--- a/driver/battery/bq27621_g1.c
+++ b/driver/battery/bq27621_g1.c
@@ -13,7 +13,7 @@
#include "util.h"
#include "timer.h"
-#define BQ27621_ADDR__7bf 0x55
+#define BQ27621_ADDR_FLAGS 0x55
#define BQ27621_TYPE_ID 0x0621
#define REG_CTRL 0x00
diff --git a/driver/battery/max17055.c b/driver/battery/max17055.c
index 90ceb12214..35fd63b445 100644
--- a/driver/battery/max17055.c
+++ b/driver/battery/max17055.c
@@ -66,13 +66,13 @@ static int fake_state_of_charge = -1;
static int max17055_read(int offset, int *data)
{
- return i2c_read16__7bf(I2C_PORT_BATTERY, MAX17055_ADDR__7bf,
+ return i2c_read16(I2C_PORT_BATTERY, MAX17055_ADDR_FLAGS,
offset, data);
}
static int max17055_write(int offset, int data)
{
- return i2c_write16__7bf(I2C_PORT_BATTERY, MAX17055_ADDR__7bf,
+ return i2c_write16(I2C_PORT_BATTERY, MAX17055_ADDR_FLAGS,
offset, data);
}
diff --git a/driver/battery/max17055.h b/driver/battery/max17055.h
index ce10b8ebf0..0f97fb90f0 100644
--- a/driver/battery/max17055.h
+++ b/driver/battery/max17055.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_MAX17055_H
#define __CROS_EC_MAX17055_H
-#define MAX17055_ADDR__7bf 0x36
+#define MAX17055_ADDR_FLAGS 0x36
#define MAX17055_DEVICE_ID 0x4010
#define MAX17055_OCV_TABLE_SIZE 48
diff --git a/driver/battery/mm8013.c b/driver/battery/mm8013.c
index 87926553db..d7fba89076 100644
--- a/driver/battery/mm8013.c
+++ b/driver/battery/mm8013.c
@@ -23,7 +23,7 @@ static int mm8013_read16(int offset, int *data)
int rv;
*data = 0;
- rv = i2c_read16__7bf(I2C_PORT_BATTERY, MM8013_ADDR__7bf, offset, data);
+ rv = i2c_read16(I2C_PORT_BATTERY, MM8013_ADDR_FLAGS, offset, data);
usleep(I2C_WAIT_TIME);
if (rv)
return rv;
@@ -34,7 +34,7 @@ static int mm8013_read_block(int offset, uint8_t *data, int len)
{
int rv;
- rv = i2c_read_block__7bf(I2C_PORT_BATTERY, MM8013_ADDR__7bf,
+ rv = i2c_read_block(I2C_PORT_BATTERY, MM8013_ADDR_FLAGS,
offset, data, len);
usleep(I2C_WAIT_TIME);
if (rv)
diff --git a/driver/battery/mm8013.h b/driver/battery/mm8013.h
index 5acdcdff68..2ffaca7b5d 100644
--- a/driver/battery/mm8013.h
+++ b/driver/battery/mm8013.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_MM8013_H
#define __CROS_EC_MM8013_H
-#define MM8013_ADDR__7bf 0x55
+#define MM8013_ADDR_FLAGS 0x55
#define REG_TEMPERATURE 0x06
#define REG_VOLTAGE 0x08
diff --git a/driver/battery/smart.c b/driver/battery/smart.c
index ced1e7cfc3..50a29cfeff 100644
--- a/driver/battery/smart.c
+++ b/driver/battery/smart.c
@@ -31,7 +31,7 @@ test_mockable int sb_read(int cmd, int *param)
return EC_RES_ACCESS_DENIED;
#endif
- return i2c_read16__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ return i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
cmd, param);
}
@@ -45,7 +45,7 @@ test_mockable int sb_write(int cmd, int param)
return EC_RES_ACCESS_DENIED;
#endif
- return i2c_write16__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ return i2c_write16(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
cmd, param);
}
@@ -59,7 +59,7 @@ int sb_read_string(int offset, uint8_t *data, int len)
return EC_RES_ACCESS_DENIED;
#endif
- return i2c_read_string__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ return i2c_read_string(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
offset, data, len);
}
@@ -104,7 +104,7 @@ int sb_write_block(int reg, const uint8_t *val, int len)
#endif
/* TODO: implement smbus_write_block. */
- return i2c_write_block__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ return i2c_write_block(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
reg, val, len);
}
diff --git a/driver/bc12/pi3usb9201.c b/driver/bc12/pi3usb9201.c
index 2fdb9719a5..2ecc9e7419 100644
--- a/driver/bc12/pi3usb9201.c
+++ b/driver/bc12/pi3usb9201.c
@@ -62,15 +62,15 @@ static const struct bc12_status bc12_chg_limits[] = {
static inline int raw_read8(int port, int offset, int *value)
{
- return i2c_read8__7bf(pi3usb2901_bc12_chips[port].i2c_port,
- pi3usb2901_bc12_chips[port].i2c_addr__7bf,
+ return i2c_read8(pi3usb2901_bc12_chips[port].i2c_port,
+ pi3usb2901_bc12_chips[port].i2c_addr_flags,
offset, value);
}
static inline int raw_write8(int port, int offset, int value)
{
- return i2c_write8__7bf(pi3usb2901_bc12_chips[port].i2c_port,
- pi3usb2901_bc12_chips[port].i2c_addr__7bf,
+ return i2c_write8(pi3usb2901_bc12_chips[port].i2c_port,
+ pi3usb2901_bc12_chips[port].i2c_addr_flags,
offset, value);
}
diff --git a/driver/bc12/pi3usb9201.h b/driver/bc12/pi3usb9201.h
index ba379ffff3..3a94fdf5ad 100644
--- a/driver/bc12/pi3usb9201.h
+++ b/driver/bc12/pi3usb9201.h
@@ -6,10 +6,10 @@
/* PI3USB9201 USB BC 1.2 Charger Detector driver definitions */
/* I2C address */
-#define PI3USB9201_I2C_ADDR_0__7bf 0x5C
-#define PI3USB9201_I2C_ADDR_1__7bf 0x5D
-#define PI3USB9201_I2C_ADDR_2__7bf 0x5E
-#define PI3USB9201_I2C_ADDR_3__7bf 0x5F
+#define PI3USB9201_I2C_ADDR_0_FLAGS 0x5C
+#define PI3USB9201_I2C_ADDR_1_FLAGS 0x5D
+#define PI3USB9201_I2C_ADDR_2_FLAGS 0x5E
+#define PI3USB9201_I2C_ADDR_3_FLAGS 0x5F
#define PI3USB9201_REG_CTRL_1 0x0
#define PI3USB9201_REG_CTRL_2 0x1
@@ -33,7 +33,7 @@
struct pi3usb2901_config_t {
const int i2c_port;
- const int i2c_addr__7bf;
+ const int i2c_addr_flags;
};
enum pi3usb9201_mode {
diff --git a/driver/bc12/pi3usb9281.c b/driver/bc12/pi3usb9281.c
index 8d88d5a1e8..b0610f693b 100644
--- a/driver/bc12/pi3usb9281.c
+++ b/driver/bc12/pi3usb9281.c
@@ -24,7 +24,7 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
/* I2C address */
-#define PI3USB9281_I2C_ADDR__7bf (0x25)
+#define PI3USB9281_I2C_ADDR_FLAGS 0x25
/* Delay values */
#define PI3USB9281_SW_RESET_DELAY 20
@@ -69,7 +69,7 @@ static uint8_t pi3usb9281_do_read(int port, uint8_t reg, int with_lock)
if (with_lock)
select_chip(port);
- res = i2c_read8__7bf(chip->i2c_port, PI3USB9281_I2C_ADDR__7bf,
+ res = i2c_read8(chip->i2c_port, PI3USB9281_I2C_ADDR_FLAGS,
reg, &val);
if (with_lock)
@@ -100,7 +100,7 @@ static int pi3usb9281_do_write(
if (with_lock)
select_chip(port);
- res = i2c_write8__7bf(chip->i2c_port, PI3USB9281_I2C_ADDR__7bf,
+ res = i2c_write8(chip->i2c_port, PI3USB9281_I2C_ADDR_FLAGS,
reg, val);
if (with_lock)
diff --git a/driver/charger/bd9995x.c b/driver/charger/bd9995x.c
index e9d2e601a1..f121b858dd 100644
--- a/driver/charger/bd9995x.c
+++ b/driver/charger/bd9995x.c
@@ -131,7 +131,7 @@ static inline int ch_raw_read16(int cmd, int *param,
/* Map the Charge command code to appropriate region */
mutex_lock(&bd9995x_map_mutex);
if (charger_map_cmd != map_cmd) {
- rv = i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ rv = i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
BD9995X_CMD_MAP_SET, map_cmd);
if (rv) {
charger_map_cmd = BD9995X_INVALID_COMMAND;
@@ -141,7 +141,7 @@ static inline int ch_raw_read16(int cmd, int *param,
charger_map_cmd = map_cmd;
}
- rv = i2c_read16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ rv = i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
cmd, param);
bd9995x_read_cleanup:
@@ -158,8 +158,8 @@ static inline int ch_raw_write16(int cmd, int param,
/* Map the Charge command code to appropriate region */
mutex_lock(&bd9995x_map_mutex);
if (charger_map_cmd != map_cmd) {
- rv = i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
- BD9995X_CMD_MAP_SET, map_cmd);
+ rv = i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
+ BD9995X_CMD_MAP_SET, map_cmd);
if (rv) {
charger_map_cmd = BD9995X_INVALID_COMMAND;
goto bd9995x_write_cleanup;
@@ -168,7 +168,7 @@ static inline int ch_raw_write16(int cmd, int param,
charger_map_cmd = map_cmd;
}
- rv = i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ rv = i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
cmd, param);
bd9995x_write_cleanup:
diff --git a/driver/charger/bd9995x.h b/driver/charger/bd9995x.h
index 6a946835bc..491f4bdeac 100644
--- a/driver/charger/bd9995x.h
+++ b/driver/charger/bd9995x.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_BD9995X_H
#define __CROS_EC_BD9995X_H
-#define BD9995X_ADDR__7bf 0x09
-#define I2C_ADDR_CHARGER__7bf BD9995X_ADDR__7bf
+#define BD9995X_ADDR_FLAGS 0x09
+#define I2C_ADDR_CHARGER_FLAGS BD9995X_ADDR_FLAGS
#define BD9995X_CHARGER_NAME "bd9995x"
#define BD99955_CHIP_ID 0x221
diff --git a/driver/charger/bq24192.h b/driver/charger/bq24192.h
index 188cb24942..b82fe93a02 100644
--- a/driver/charger/bq24192.h
+++ b/driver/charger/bq24192.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_BQ24192_H
#define __CROS_EC_BQ24192_H
-#define BQ24192_ADDR__7bf 0x6b
+#define BQ24192_ADDR_FLAGS 0x6b
/* Registers */
#define BQ24192_REG_INPUT_CTRL 0x0
diff --git a/driver/charger/bq24715.c b/driver/charger/bq24715.c
index bd38ed5f95..8a8d9b894f 100644
--- a/driver/charger/bq24715.c
+++ b/driver/charger/bq24715.c
@@ -37,13 +37,13 @@ static const struct charger_info bq24725_charger_info = {
static inline int sbc_read(int cmd, int *param)
{
- return i2c_read16__7bf(I2C_PORT_CHARGER, CHARGER_ADDR__7bf,
+ return i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR_FLAGS,
cmd, param);
}
static inline int sbc_write(int cmd, int param)
{
- return i2c_write16__7bf(I2C_PORT_CHARGER, CHARGER_ADDR__7bf,
+ return i2c_write16(I2C_PORT_CHARGER, CHARGER_ADDR_FLAGS,
cmd, param);
}
diff --git a/driver/charger/bq24773.h b/driver/charger/bq24773.h
index 0191da9ac4..910ad8da25 100644
--- a/driver/charger/bq24773.h
+++ b/driver/charger/bq24773.h
@@ -12,8 +12,8 @@
#include "i2c.h"
/* I2C address */
-#define BQ24770_ADDR__7bf 0x09
-#define BQ24773_ADDR__7bf 0x6a
+#define BQ24770_ADDR_FLAGS 0x09
+#define BQ24773_ADDR_FLAGS 0x6a
/* Chip specific commands */
#define BQ24770_CHARGE_OPTION0 0x12
@@ -72,7 +72,7 @@
#ifdef CONFIG_CHARGER_BQ24770
#define CHARGER_NAME "bq24770"
- #define I2C_ADDR_CHARGER__7bf BQ24770_ADDR__7bf
+ #define I2C_ADDR_CHARGER_FLAGS BQ24770_ADDR_FLAGS
#define REG_CHARGE_OPTION0 BQ24770_CHARGE_OPTION0
#define REG_CHARGE_OPTION1 BQ24770_CHARGE_OPTION1
@@ -88,7 +88,7 @@
#elif defined(CONFIG_CHARGER_BQ24773)
#define CHARGER_NAME "bq24773"
- #define I2C_ADDR_CHARGER__7bf BQ24773_ADDR__7bf
+ #define I2C_ADDR_CHARGER_FLAGS BQ24773_ADDR_FLAGS
#define REG_CHARGE_OPTION0 BQ24773_CHARGE_OPTION0
#define REG_CHARGE_OPTION1 BQ24773_CHARGE_OPTION1
@@ -105,26 +105,26 @@
#ifdef CONFIG_CHARGER_BQ24773
static inline int raw_read8(int offset, int *value)
{
- return i2c_read8__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ return i2c_read8(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
offset, value);
}
static inline int raw_write8(int offset, int value)
{
- return i2c_write8__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ return i2c_write8(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
offset, value);
}
#endif
static inline int raw_read16(int offset, int *value)
{
- return i2c_read16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ return i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
offset, value);
}
static inline int raw_write16(int offset, int value)
{
- return i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ return i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
offset, value);
}
diff --git a/driver/charger/bq25703.h b/driver/charger/bq25703.h
index c568285e5c..f715824f63 100644
--- a/driver/charger/bq25703.h
+++ b/driver/charger/bq25703.h
@@ -9,7 +9,7 @@
#define __CROS_EC_BQ25703_H
/* I2C Interface */
-#define BQ25703_I2C_ADDR1__7bf 0x6B
+#define BQ25703_I2C_ADDR1_FLAGS 0x6B
/*
* BC1.2 minimum voltage threshold for BQ25703.
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c
index 3f9f03b805..e7bb4d3b66 100644
--- a/driver/charger/bq25710.c
+++ b/driver/charger/bq25710.c
@@ -62,13 +62,13 @@ static const struct charger_info bq25710_charger_info = {
static inline int raw_read16(int offset, int *value)
{
- return i2c_read16__7bf(I2C_PORT_CHARGER, BQ25710_SMBUS_ADDR1__7bf,
+ return i2c_read16(I2C_PORT_CHARGER, BQ25710_SMBUS_ADDR1_FLAGS,
offset, value);
}
static inline int raw_write16(int offset, int value)
{
- return i2c_write16__7bf(I2C_PORT_CHARGER, BQ25710_SMBUS_ADDR1__7bf,
+ return i2c_write16(I2C_PORT_CHARGER, BQ25710_SMBUS_ADDR1_FLAGS,
offset, value);
}
diff --git a/driver/charger/bq25710.h b/driver/charger/bq25710.h
index a4861e50ca..c3880be13c 100644
--- a/driver/charger/bq25710.h
+++ b/driver/charger/bq25710.h
@@ -9,7 +9,7 @@
#define __CROS_EC_BQ25710_H
/* SMBUS Interface */
-#define BQ25710_SMBUS_ADDR1__7bf 0x09
+#define BQ25710_SMBUS_ADDR1_FLAGS 0x09
#define BQ25710_BC12_MIN_VOLTAGE_MV 1408
diff --git a/driver/charger/bq2589x.h b/driver/charger/bq2589x.h
index 38dd944dd4..95bbf4c226 100644
--- a/driver/charger/bq2589x.h
+++ b/driver/charger/bq2589x.h
@@ -99,13 +99,13 @@
/* Variant-specific configuration */
#if defined(CONFIG_CHARGER_BQ25890)
#define BQ2589X_DEVICE_ID BQ25890_DEVICE_ID
-#define BQ2589X_ADDR__7bf (0x6A)
+#define BQ2589X_ADDR_FLAGS 0x6A
#elif defined(CONFIG_CHARGER_BQ25895)
#define BQ2589X_DEVICE_ID BQ25895_DEVICE_ID
-#define BQ2589X_ADDR__7bf (0x6A)
+#define BQ2589X_ADDR_FLAGS 0x6A
#elif defined(CONFIG_CHARGER_BQ25892)
#define BQ2589X_DEVICE_ID BQ25892_DEVICE_ID
-#define BQ2589X_ADDR__7bf (0x6B)
+#define BQ2589X_ADDR_FLAGS 0x6B
#else
#error BQ2589X unknown variant
#endif
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c
index a2d6e08977..f2bd51b927 100644
--- a/driver/charger/isl923x.c
+++ b/driver/charger/isl923x.c
@@ -56,19 +56,19 @@ static const struct charger_info isl9237_charger_info = {
static inline int raw_read8(int offset, int *value)
{
- return i2c_read8__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ return i2c_read8(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
offset, value);
}
static inline int raw_read16(int offset, int *value)
{
- return i2c_read16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ return i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
offset, value);
}
static inline int raw_write16(int offset, int value)
{
- return i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ return i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
offset, value);
}
@@ -575,7 +575,7 @@ static int print_amon_bmon(enum amon_bmon amon, int direction,
int adc, curr, reg, ret;
#ifdef CONFIG_CHARGER_ISL9238
- ret = i2c_read16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ ret = i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
ISL9238_REG_CONTROL3, &reg);
if (ret)
return ret;
@@ -585,7 +585,7 @@ static int print_amon_bmon(enum amon_bmon amon, int direction,
reg |= ISL9238_C3_AMON_BMON_DIRECTION;
else
reg &= ~ISL9238_C3_AMON_BMON_DIRECTION;
- ret = i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ ret = i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
ISL9238_REG_CONTROL3, reg);
if (ret)
return ret;
@@ -593,7 +593,7 @@ static int print_amon_bmon(enum amon_bmon amon, int direction,
mutex_lock(&control1_mutex);
- ret = i2c_read16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ ret = i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
ISL923X_REG_CONTROL1, &reg);
if (!ret) {
/* Switch between AMON/BMON */
@@ -604,7 +604,7 @@ static int print_amon_bmon(enum amon_bmon amon, int direction,
/* Enable monitor */
reg &= ~ISL923X_C1_DISABLE_MON;
- ret = i2c_write16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ ret = i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
ISL923X_REG_CONTROL1, reg);
}
@@ -689,7 +689,7 @@ static void dump_reg_range(int low, int high)
for (reg = low; reg <= high; reg++) {
CPRINTF("[%Xh] = ", reg);
- rv = i2c_read16__7bf(I2C_PORT_CHARGER, I2C_ADDR_CHARGER__7bf,
+ rv = i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
reg, &regval);
if (!rv)
CPRINTF("0x%04x\n", regval);
diff --git a/driver/charger/isl923x.h b/driver/charger/isl923x.h
index 09a627d251..6f76106157 100644
--- a/driver/charger/isl923x.h
+++ b/driver/charger/isl923x.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_ISL923X_H
#define __CROS_EC_ISL923X_H
-#define ISL923X_ADDR__7bf (0x09)
+#define ISL923X_ADDR_FLAGS (0x09)
/* Registers */
#define ISL923X_REG_CHG_CURRENT 0x14
@@ -304,7 +304,7 @@ enum isl9237_fsm_state {
#define INPUT_I_MIN 4
#define INPUT_I_STEP 4
-#define I2C_ADDR_CHARGER__7bf ISL923X_ADDR__7bf
+#define I2C_ADDR_CHARGER_FLAGS ISL923X_ADDR_FLAGS
#endif /* __CROS_EC_ISL923X_H */
/**
diff --git a/driver/charger/isl9241.h b/driver/charger/isl9241.h
index e145abc610..7fe3f5e579 100644
--- a/driver/charger/isl9241.h
+++ b/driver/charger/isl9241.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_ISL9241_H
#define __CROS_EC_ISL9241_H
-#define ISL9241_ADDR__7bf 0x09
-#define I2C_ADDR_CHARGER__7bf ISL9241_ADDR__7bf
+#define ISL9241_ADDR_FLAGS 0x09
+#define I2C_ADDR_CHARGER_FLAGS ISL9241_ADDR_FLAGS
#define CHARGER_NAME "ISL9241"
#define CHARGE_V_MAX 18304
diff --git a/driver/charger/rt946x.c b/driver/charger/rt946x.c
index 4b7b9d13c6..514829d6f6 100644
--- a/driver/charger/rt946x.c
+++ b/driver/charger/rt946x.c
@@ -145,17 +145,17 @@ static const uint16_t rt946x_boost_current[] = {
static int rt946x_read8(int reg, int *val)
{
- return i2c_read8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf, reg, val);
+ return i2c_read8(I2C_PORT_CHARGER, RT946X_ADDR_FLAGS, reg, val);
}
static int rt946x_write8(int reg, int val)
{
- return i2c_write8__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf, reg, val);
+ return i2c_write8(I2C_PORT_CHARGER, RT946X_ADDR_FLAGS, reg, val);
}
static int rt946x_block_write(int reg, const uint8_t *val, int len)
{
- return i2c_write_block__7bf(I2C_PORT_CHARGER, RT946X_ADDR__7bf,
+ return i2c_write_block(I2C_PORT_CHARGER, RT946X_ADDR_FLAGS,
reg, val, len);
}
diff --git a/driver/charger/rt946x.h b/driver/charger/rt946x.h
index c5132702be..b30721367a 100644
--- a/driver/charger/rt946x.h
+++ b/driver/charger/rt946x.h
@@ -583,15 +583,15 @@
#if defined(CONFIG_CHARGER_RT9466)
#define RT946X_CHARGER_NAME "rt9466"
#define RT946X_VENDOR_ID 0x80
- #define RT946X_ADDR__7bf 0x53
+ #define RT946X_ADDR_FLAGS 0x53
#elif defined(CONFIG_CHARGER_RT9467)
#define RT946X_CHARGER_NAME "rt9467"
#define RT946X_VENDOR_ID 0x90
- #define RT946X_ADDR__7bf 0x5B
+ #define RT946X_ADDR_FLAGS 0x5B
#elif defined(CONFIG_CHARGER_MT6370)
#define RT946X_CHARGER_NAME "mt6370"
#define RT946X_VENDOR_ID 0xE0
- #define RT946X_ADDR__7bf 0x34
+ #define RT946X_ADDR_FLAGS 0x34
#else
#error "No suitable charger option defined"
#endif
diff --git a/driver/charger/sy21612.c b/driver/charger/sy21612.c
index 0ec3a570e3..c8751ce208 100644
--- a/driver/charger/sy21612.c
+++ b/driver/charger/sy21612.c
@@ -22,7 +22,7 @@ static int sy21612_clear_set_reg(int reg, int clear, int set)
{
int val, old_val, rv;
- rv = i2c_read8__7bf(I2C_PORT_SY21612, SY21612_ADDR__7bf, reg, &old_val);
+ rv = i2c_read8(I2C_PORT_SY21612, SY21612_ADDR_FLAGS, reg, &old_val);
if (rv)
return rv;
@@ -31,7 +31,7 @@ static int sy21612_clear_set_reg(int reg, int clear, int set)
val |= set;
if (val != old_val || clear || set)
- rv = i2c_write8__7bf(I2C_PORT_SY21612, SY21612_ADDR__7bf,
+ rv = i2c_write8(I2C_PORT_SY21612, SY21612_ADDR_FLAGS,
reg, val);
return rv;
@@ -39,7 +39,7 @@ static int sy21612_clear_set_reg(int reg, int clear, int set)
static int sy21612_read(int reg, int *val)
{
- return i2c_read8__7bf(I2C_PORT_SY21612, SY21612_ADDR__7bf, reg, val);
+ return i2c_read8(I2C_PORT_SY21612, SY21612_ADDR_FLAGS, reg, val);
}
int sy21612_enable_regulator(int enable)
diff --git a/driver/charger/sy21612.h b/driver/charger/sy21612.h
index 8b72966223..befb8e6a35 100644
--- a/driver/charger/sy21612.h
+++ b/driver/charger/sy21612.h
@@ -10,8 +10,8 @@
#include "gpio.h"
-#ifndef SY21612_ADDR__7bf
-#define SY21612_ADDR__7bf 0x71
+#ifndef SY21612_ADDR_FLAGS
+#define SY21612_ADDR_FLAGS 0x71
#endif
enum sy21612_switching_freq {
diff --git a/driver/gyro_l3gd20h.h b/driver/gyro_l3gd20h.h
index e7684688d1..96c808b1a6 100644
--- a/driver/gyro_l3gd20h.h
+++ b/driver/gyro_l3gd20h.h
@@ -15,8 +15,8 @@
* 7-bit address is 110101Xb. Where 'X' is determined
* by the voltage on the ADDR pin.
*/
-#define L3GD20_ADDR0__7bf 0x6a
-#define L3GD20_ADDR1__7bf 0x6b
+#define L3GD20_ADDR0_FLAGS 0x6a
+#define L3GD20_ADDR1_FLAGS 0x6b
/* who am I */
#define L3GD20_WHO_AM_I 0xd7
diff --git a/driver/ina2xx.c b/driver/ina2xx.c
index a50d5f800e..2b0fca07e5 100644
--- a/driver/ina2xx.c
+++ b/driver/ina2xx.c
@@ -17,14 +17,14 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
/* I2C base address */
-#define INA2XX_I2C_ADDR__7bf 0x40
+#define INA2XX_I2C_ADDR_FLAGS 0x40
uint16_t ina2xx_read(uint8_t idx, uint8_t reg)
{
int res;
int val;
- res = i2c_read16__7bf(I2C_PORT_MASTER, INA2XX_I2C_ADDR__7bf | idx,
+ res = i2c_read16(I2C_PORT_MASTER, INA2XX_I2C_ADDR_FLAGS | idx,
reg, &val);
if (res) {
CPRINTS("INA2XX I2C read failed");
@@ -38,7 +38,7 @@ int ina2xx_write(uint8_t idx, uint8_t reg, uint16_t val)
int res;
uint16_t be_val = (val >> 8) | ((val & 0xff) << 8);
- res = i2c_write16__7bf(I2C_PORT_MASTER, INA2XX_I2C_ADDR__7bf | idx,
+ res = i2c_write16(I2C_PORT_MASTER, INA2XX_I2C_ADDR_FLAGS | idx,
reg, be_val);
if (res)
CPRINTS("INA2XX I2C write failed");
diff --git a/driver/ioexpander_pca9534.c b/driver/ioexpander_pca9534.c
index 4eddd5adab..44bf59e424 100644
--- a/driver/ioexpander_pca9534.c
+++ b/driver/ioexpander_pca9534.c
@@ -8,45 +8,45 @@
#include "i2c.h"
#include "ioexpander_pca9534.h"
-static int pca9534_pin_read__7bf(const int port, const uint16_t addr__7bf,
+static int pca9534_pin_read(const int port, const uint16_t addr_flags,
int reg, int pin, int *val)
{
int ret;
- ret = i2c_read8__7bf(port, addr__7bf, reg, val);
+ ret = i2c_read8(port, addr_flags, reg, val);
*val = (*val & BIT(pin)) ? 1 : 0;
return ret;
}
-static int pca9534_pin_write__7bf(const int port, const uint16_t addr__7bf,
+static int pca9534_pin_write(const int port, const uint16_t addr_flags,
int reg, int pin, int val)
{
int ret, v;
- ret = i2c_read8__7bf(port, addr__7bf, reg, &v);
+ ret = i2c_read8(port, addr_flags, reg, &v);
if (ret != EC_SUCCESS)
return ret;
v &= ~BIT(pin);
if (val)
v |= 1 << pin;
- return i2c_write8__7bf(port, addr__7bf, reg, v);
+ return i2c_write8(port, addr_flags, reg, v);
}
-int pca9534_get_level__7bf(const int port, const uint16_t addr__7bf,
+int pca9534_get_level(const int port, const uint16_t addr_flags,
int pin, int *level)
{
- return pca9534_pin_read__7bf(port, addr__7bf,
+ return pca9534_pin_read(port, addr_flags,
PCA9534_REG_INPUT, pin, level);
}
-int pca9534_set_level__7bf(const int port, const uint16_t addr__7bf,
+int pca9534_set_level(const int port, const uint16_t addr_flags,
int pin, int level)
{
- return pca9534_pin_write__7bf(port, addr__7bf,
+ return pca9534_pin_write(port, addr_flags,
PCA9534_REG_OUTPUT, pin, level);
}
-int pca9534_config_pin__7bf(const int port, const uint16_t addr__7bf,
+int pca9534_config_pin(const int port, const uint16_t addr_flags,
int pin, int is_input)
{
- return pca9534_pin_write__7bf(port, addr__7bf,
+ return pca9534_pin_write(port, addr_flags,
PCA9534_REG_CONFIG, pin, is_input);
}
diff --git a/driver/ioexpander_pca9534.h b/driver/ioexpander_pca9534.h
index 7e5ce79c8d..0fec577576 100644
--- a/driver/ioexpander_pca9534.h
+++ b/driver/ioexpander_pca9534.h
@@ -26,7 +26,7 @@
*
* @return EC_SUCCESS, or EC_ERROR_* on error.
*/
-int pca9534_get_level__7bf(const int port, const uint16_t addr__7bf,
+int pca9534_get_level(const int port, const uint16_t addr_flags,
int pin, int *level);
/*
@@ -40,7 +40,7 @@ int pca9534_get_level__7bf(const int port, const uint16_t addr__7bf,
*
* @return EC_SUCCESS, or EC_ERROR_* on error.
*/
-int pca9534_set_level__7bf(const int port, const uint16_t addr__7bf,
+int pca9534_set_level(const int port, const uint16_t addr_flags,
int pin, int level);
/*
@@ -53,7 +53,7 @@ int pca9534_set_level__7bf(const int port, const uint16_t addr__7bf,
*
* @return EC_SUCCESS, or EC_ERROR_* on error.
*/
-int pca9534_config_pin__7bf(const int port, const uint16_t addr__7bf,
+int pca9534_config_pin(const int port, const uint16_t addr_flags,
int pin, int is_input);
#endif /* __CROS_EC_IOEXPANDER_PCA9534_H */
diff --git a/driver/ioexpander_pca9555.h b/driver/ioexpander_pca9555.h
index 49a626d068..273f898821 100644
--- a/driver/ioexpander_pca9555.h
+++ b/driver/ioexpander_pca9555.h
@@ -28,18 +28,18 @@
#define PCA9555_IO_6 BIT(6)
#define PCA9555_IO_7 BIT(7)
-static inline int pca9555_read__7bf(const int port,
- const uint16_t i2c_addr__7bf,
+static inline int pca9555_read(const int port,
+ const uint16_t i2c_addr_flags,
int reg, int *data_ptr)
{
- return i2c_read8__7bf(port, i2c_addr__7bf, reg, data_ptr);
+ return i2c_read8(port, i2c_addr_flags, reg, data_ptr);
}
-static inline int pca9555_write__7bf(const int port,
- const uint16_t i2c_addr__7bf,
+static inline int pca9555_write(const int port,
+ const uint16_t i2c_addr_flags,
int reg, int data)
{
- return i2c_write8__7bf(port, i2c_addr__7bf, reg, data);
+ return i2c_write8(port, i2c_addr_flags, reg, data);
}
#endif /* __CROS_EC_IOEXPANDER_PCA9555_H */
diff --git a/driver/led/lm3509.c b/driver/led/lm3509.c
index c940dd69e2..7c20c43ac2 100644
--- a/driver/led/lm3509.c
+++ b/driver/led/lm3509.c
@@ -12,13 +12,13 @@
static inline int lm3509_write(uint8_t reg, uint8_t val)
{
- return i2c_write8__7bf(I2C_PORT_KBLIGHT, LM3509_I2C_ADDR__7bf,
+ return i2c_write8(I2C_PORT_KBLIGHT, LM3509_I2C_ADDR_FLAGS,
reg, val);
}
static inline int lm3509_read(uint8_t reg, int *val)
{
- return i2c_read8__7bf(I2C_PORT_KBLIGHT, LM3509_I2C_ADDR__7bf,
+ return i2c_read8(I2C_PORT_KBLIGHT, LM3509_I2C_ADDR_FLAGS,
reg, val);
}
diff --git a/driver/led/lm3509.h b/driver/led/lm3509.h
index fce0c993dc..a7defe1fb7 100644
--- a/driver/led/lm3509.h
+++ b/driver/led/lm3509.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_LM3509_H
#define __CROS_EC_LM3509_H
-#define LM3509_I2C_ADDR__7bf 0x36
+#define LM3509_I2C_ADDR_FLAGS 0x36
/*
* General purpose register
diff --git a/driver/led/lm3630a.c b/driver/led/lm3630a.c
index 10f850b09d..a2c4aaa74c 100644
--- a/driver/led/lm3630a.c
+++ b/driver/led/lm3630a.c
@@ -12,17 +12,17 @@
/* I2C address */
-#define LM3630A_I2C_ADDR__7bf 0x36
+#define LM3630A_I2C_ADDR_FLAGS 0x36
static inline int lm3630a_write(uint8_t reg, uint8_t val)
{
- return i2c_write8__7bf(I2C_PORT_KBLIGHT, LM3630A_I2C_ADDR__7bf,
+ return i2c_write8(I2C_PORT_KBLIGHT, LM3630A_I2C_ADDR_FLAGS,
reg, val);
}
static inline int lm3630a_read(uint8_t reg, int *val)
{
- return i2c_read8__7bf(I2C_PORT_KBLIGHT, LM3630A_I2C_ADDR__7bf,
+ return i2c_read8(I2C_PORT_KBLIGHT, LM3630A_I2C_ADDR_FLAGS,
reg, val);
}
diff --git a/driver/led/lp5562.c b/driver/led/lp5562.c
index 966aff5e58..e0758a8b91 100644
--- a/driver/led/lp5562.c
+++ b/driver/led/lp5562.c
@@ -12,16 +12,16 @@
#include "util.h"
/* I2C address */
-#define LP5562_I2C_ADDR__7bf (0x30)
+#define LP5562_I2C_ADDR_FLAGS 0x30
inline int lp5562_write(uint8_t reg, uint8_t val)
{
- return i2c_write8(I2C_PORT_MASTER, LP5562_I2C_ADDR, reg, val);
+ return i2c_write8(I2C_PORT_MASTER, LP5562_I2C_ADDR_FLAGS, reg, val);
}
inline int lp5562_read(uint8_t reg, int *val)
{
- return i2c_read8(I2C_PORT_MASTER, LP5562_I2C_ADDR, reg, val);
+ return i2c_read8(I2C_PORT_MASTER, LP5562_I2C_ADDR_FLAGS, reg, val);
}
int lp5562_set_color(uint32_t rgb)
diff --git a/driver/led/max695x.h b/driver/led/max695x.h
index 4bead04194..5ed5d91e2f 100644
--- a/driver/led/max695x.h
+++ b/driver/led/max695x.h
@@ -9,8 +9,8 @@
#define __CROS_EC_MAX656X_H
/* I2C interface */
-#define MAX695X_I2C_ADDR1__7bf (0x38)
-#define MAX695X_I2C_ADDR2__7bf (0x39)
+#define MAX695X_I2C_ADDR1_FLAGS 0x38
+#define MAX695X_I2C_ADDR2_FLAGS 0x39
/* Decode mode register */
#define MAX695X_REG_DECODE_MODE 0x01
diff --git a/driver/led/oz554.c b/driver/led/oz554.c
index 6369e064a3..fcbbee46ce 100644
--- a/driver/led/oz554.c
+++ b/driver/led/oz554.c
@@ -16,7 +16,7 @@
#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
-#define I2C_ADDR_OZ554__7bf 0x31
+#define I2C_ADDR_OZ554_FLAGS 0x31
struct oz554_value {
uint8_t offset;
@@ -80,8 +80,8 @@ static void set_oz554_reg(void)
int i;
for (i = 0; i < oz554_conf_size; ++i) {
- int rv = i2c_write8__7bf(I2C_PORT_BACKLIGHT,
- I2C_ADDR_OZ554__7bf,
+ int rv = i2c_write8(I2C_PORT_BACKLIGHT,
+ I2C_ADDR_OZ554_FLAGS,
oz554_conf[i].offset, oz554_conf[i].data);
if (rv) {
CPRINTS("Write OZ554 register %d failed rv=%d" , i, rv);
diff --git a/driver/mag_bmm150.c b/driver/mag_bmm150.c
index 30555cbe56..ae1c736540 100644
--- a/driver/mag_bmm150.c
+++ b/driver/mag_bmm150.c
@@ -19,8 +19,8 @@
#ifdef CONFIG_MAG_BMI160_BMM150
#include "driver/accelgyro_bmi160.h"
-#define raw_mag_read8__7bf bmi160_sec_raw_read8__7bf
-#define raw_mag_write8__7bf bmi160_sec_raw_write8__7bf
+#define raw_mag_read8 bmi160_sec_raw_read8
+#define raw_mag_write8 bmi160_sec_raw_write8
#else
#error "Not implemented"
#endif
@@ -73,9 +73,9 @@
#define BMI150_READ_16BIT_COM_REG(store_, addr_) do { \
int val; \
- raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf, (addr_), &val); \
+ raw_mag_read8(s->port, s->i2c_spi_addr_flags, (addr_), &val); \
store_ = val; \
- raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf, (addr_) + 1, &val); \
+ raw_mag_read8(s->port, s->i2c_spi_addr_flags, (addr_) + 1, &val); \
store_ |= (val << 8); \
} while (0)
@@ -88,11 +88,11 @@ int bmm150_init(const struct motion_sensor_t *s)
struct mag_cal_t *moc = BMM150_CAL(s);
/* Set the compass from Suspend to Sleep */
- ret = raw_mag_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_mag_write8(s->port, s->i2c_spi_addr_flags,
BMM150_PWR_CTRL, BMM150_PWR_ON);
msleep(4);
/* Now we can read the device id */
- ret = raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_CHIP_ID, &val);
if (ret)
return EC_ERROR_UNKNOWN;
@@ -101,26 +101,26 @@ int bmm150_init(const struct motion_sensor_t *s)
return EC_ERROR_ACCESS_DENIED;
/* Read the private registers for compensation */
- ret = raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_REGA_DIG_X1, &val);
if (ret)
return EC_ERROR_UNKNOWN;
regs->dig1[X] = val;
- raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_REGA_DIG_Y1, &val);
regs->dig1[Y] = val;
- raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_REGA_DIG_X2, &val);
regs->dig2[X] = val;
- raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_REGA_DIG_Y2, &val);
regs->dig2[Y] = val;
- raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_REGA_DIG_XY1, &val);
regs->dig_xy1 = val;
- raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_REGA_DIG_XY2, &val);
regs->dig_xy2 = val;
@@ -132,18 +132,18 @@ int bmm150_init(const struct motion_sensor_t *s)
/* Set the repetition in "Regular Preset" */
- raw_mag_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_mag_write8(s->port, s->i2c_spi_addr_flags,
BMM150_REPXY, BMM150_REP(SPECIAL, XY));
- raw_mag_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ raw_mag_write8(s->port, s->i2c_spi_addr_flags,
BMM150_REPZ, BMM150_REP(SPECIAL, Z));
- ret = raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_REPXY, &val);
- ret = raw_mag_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_mag_read8(s->port, s->i2c_spi_addr_flags,
BMM150_REPZ, &val);
/*
* Set the compass forced mode, to sleep after each measure.
*/
- ret = raw_mag_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = raw_mag_write8(s->port, s->i2c_spi_addr_flags,
BMM150_OP_CTRL,
BMM150_OP_MODE_FORCED << BMM150_OP_MODE_OFFSET);
diff --git a/driver/mag_bmm150.h b/driver/mag_bmm150.h
index e9b3ce660b..79c77e66d7 100644
--- a/driver/mag_bmm150.h
+++ b/driver/mag_bmm150.h
@@ -11,10 +11,10 @@
#include "accelgyro.h"
#include "mag_cal.h"
-#define BMM150_ADDR0__7bf 0x10
-#define BMM150_ADDR1__7bf 0x11
-#define BMM150_ADDR2__7bf 0x12
-#define BMM150_ADDR3__7bf 0x13
+#define BMM150_ADDR0_FLAGS 0x10
+#define BMM150_ADDR1_FLAGS 0x11
+#define BMM150_ADDR2_FLAGS 0x12
+#define BMM150_ADDR3_FLAGS 0x13
#define BMM150_CHIP_ID 0x40
#define BMM150_CHIP_ID_MAJOR 0x32
diff --git a/driver/mag_lis2mdl.c b/driver/mag_lis2mdl.c
index 348577adfd..c63cb7b971 100644
--- a/driver/mag_lis2mdl.c
+++ b/driver/mag_lis2mdl.c
@@ -146,25 +146,25 @@ int lis2mdl_thru_lsm6dsm_init(const struct motion_sensor_t *s)
mutex_lock(s->mutex);
/* Magnetometer in cascade mode */
- ret = sensorhub_check_and_rst__7bf(
+ ret = sensorhub_check_and_rst(
LSM6DSM_MAIN_SENSOR(s),
- CONFIG_ACCELGYRO_SEC_ADDR__7BF,
+ CONFIG_ACCELGYRO_SEC_ADDR_FLAGS,
LIS2MDL_WHO_AM_I_REG, LIS2MDL_WHO_AM_I,
LIS2MDL_CFG_REG_A_ADDR, LIS2MDL_FLAG_SW_RESET);
if (ret != EC_SUCCESS)
goto err_unlock;
- ret = sensorhub_config_ext_reg__7bf(
+ ret = sensorhub_config_ext_reg(
LSM6DSM_MAIN_SENSOR(s),
- CONFIG_ACCELGYRO_SEC_ADDR__7BF,
+ CONFIG_ACCELGYRO_SEC_ADDR_FLAGS,
LIS2MDL_CFG_REG_A_ADDR,
LIS2MDL_ODR_50HZ | LIS2MDL_MODE_CONT);
if (ret != EC_SUCCESS)
goto err_unlock;
- ret = sensorhub_config_slv0_read__7bf(
+ ret = sensorhub_config_slv0_read(
LSM6DSM_MAIN_SENSOR(s),
- CONFIG_ACCELGYRO_SEC_ADDR__7BF,
+ CONFIG_ACCELGYRO_SEC_ADDR_FLAGS,
LIS2MDL_OUT_REG, OUT_XYZ_SIZE);
if (ret != EC_SUCCESS)
goto err_unlock;
@@ -200,7 +200,7 @@ static int lis2mdl_is_data_ready(const struct motion_sensor_t *s, int *ready)
{
int ret, tmp;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LIS2MDL_STATUS_REG, &tmp);
if (ret != EC_SUCCESS) {
*ready = 0;
@@ -242,7 +242,7 @@ int lis2mdl_read(const struct motion_sensor_t *s, intv3_t v)
}
mutex_lock(s->mutex);
- ret = st_raw_read_n__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n(s->port, s->i2c_spi_addr_flags,
LIS2MDL_OUT_REG, raw, OUT_XYZ_SIZE);
mutex_unlock(s->mutex);
if (ret == EC_SUCCESS) {
@@ -263,7 +263,7 @@ int lis2mdl_init(const struct motion_sensor_t *s)
/* Check who am I value */
do {
- ret = st_raw_read8__7bf(s->port, LIS2MDL_ADDR__7bf,
+ ret = st_raw_read8(s->port, LIS2MDL_ADDR_FLAGS,
LIS2MDL_WHO_AM_I_REG, &who_am_i);
if (ret != EC_SUCCESS) {
/* Make sure we wait for the chip to start up. Sleep 1ms
@@ -283,7 +283,7 @@ int lis2mdl_init(const struct motion_sensor_t *s)
mutex_lock(s->mutex);
/* Reset the sensor */
- ret = st_raw_write8__7bf(s->port, LIS2MDL_ADDR__7bf,
+ ret = st_raw_write8(s->port, LIS2MDL_ADDR_FLAGS,
LIS2MDL_CFG_REG_A_ADDR,
LIS2MDL_FLAG_SW_RESET);
if (ret != EC_SUCCESS)
@@ -363,13 +363,13 @@ int lis2mdl_set_data_rate(const struct motion_sensor_t *s, int rate, int rnd)
mutex_lock(s->mutex);
if (rate <= 0) {
- ret = st_raw_write8__7bf(s->port, LIS2MDL_ADDR__7bf,
+ ret = st_raw_write8(s->port, LIS2MDL_ADDR_FLAGS,
LIS2MDL_CFG_REG_A_ADDR,
LIS2MDL_FLAG_SW_RESET);
} else {
/* Add continuous and temp compensation flags */
reg_val |= LIS2MDL_MODE_CONT | LIS2MDL_FLAG_TEMP_COMPENSATION;
- ret = st_raw_write8__7bf(s->port, LIS2MDL_ADDR__7bf,
+ ret = st_raw_write8(s->port, LIS2MDL_ADDR_FLAGS,
LIS2MDL_CFG_REG_A_ADDR, reg_val);
}
diff --git a/driver/mag_lis2mdl.h b/driver/mag_lis2mdl.h
index e0c2f1652d..6be0d70e54 100644
--- a/driver/mag_lis2mdl.h
+++ b/driver/mag_lis2mdl.h
@@ -16,7 +16,7 @@
* 8-bit address is 0011110Wb where the last bit represents whether the
* operation is a read or a write.
*/
-#define LIS2MDL_ADDR__7bf 0x1e
+#define LIS2MDL_ADDR_FLAGS 0x1e
#define LIS2MDL_STARTUP_MS 10
diff --git a/driver/pmic_tps650x30.h b/driver/pmic_tps650x30.h
index c3d3691385..f03bef5f05 100644
--- a/driver/pmic_tps650x30.h
+++ b/driver/pmic_tps650x30.h
@@ -9,9 +9,9 @@
#define __CROS_EC_PMIC_TPS650X30_H
/* I2C interface */
-#define TPS650X30_I2C_ADDR1__7bf 0x30
-#define TPS650X30_I2C_ADDR2__7bf 0x32
-#define TPS650X30_I2C_ADDR3__7bf 0x34
+#define TPS650X30_I2C_ADDR1_FLAGS 0x30
+#define TPS650X30_I2C_ADDR2_FLAGS 0x32
+#define TPS650X30_I2C_ADDR3_FLAGS 0x34
/* TPS650X30 registers */
#define TPS650X30_REG_VENDORID 0x00
diff --git a/driver/ppc/nx20p348x.c b/driver/ppc/nx20p348x.c
index fc234539de..e47f8e9a8a 100644
--- a/driver/ppc/nx20p348x.c
+++ b/driver/ppc/nx20p348x.c
@@ -32,16 +32,16 @@ static uint8_t flags[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);
}
diff --git a/driver/ppc/nx20p348x.h b/driver/ppc/nx20p348x.h
index a04868c732..6aad5c9881 100644
--- a/driver/ppc/nx20p348x.h
+++ b/driver/ppc/nx20p348x.h
@@ -8,15 +8,15 @@
#ifndef __CROS_EC_NX20P348X_H
#define __CROS_EC_NX20P348X_H
-#define NX20P3483_ADDR0__7bf (0x70)
-#define NX20P3483_ADDR1__7bf (0x71)
-#define NX20P3483_ADDR2__7bf (0x72)
-#define NX20P3483_ADDR3__7bf (0x73)
-
-#define NX20P3481_ADDR0__7bf (0x74)
-#define NX20P3481_ADDR1__7bf (0x75)
-#define NX20P3481_ADDR2__7bf (0x76)
-#define NX20P3481_ADDR3__7bf (0x77)
+#define NX20P3483_ADDR0_FLAGS 0x70
+#define NX20P3483_ADDR1_FLAGS 0x71
+#define NX20P3483_ADDR2_FLAGS 0x72
+#define NX20P3483_ADDR3_FLAGS 0x73
+
+#define NX20P3481_ADDR0_FLAGS 0x74
+#define NX20P3481_ADDR1_FLAGS 0x75
+#define NX20P3481_ADDR2_FLAGS 0x76
+#define NX20P3481_ADDR3_FLAGS 0x77
/*
* This PPC hard-codes the over voltage protect of Vbus at 6.8V in dead-battery
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c
index 5cfbace742..c532cace44 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. */
diff --git a/driver/ppc/sn5s330.h b/driver/ppc/sn5s330.h
index 95f8fb4ac7..cfb7bf7c96 100644
--- a/driver/ppc/sn5s330.h
+++ b/driver/ppc/sn5s330.h
@@ -12,7 +12,7 @@
struct sn5s330_config {
uint8_t i2c_port;
- uint8_t i2c_addr__7bf;
+ uint8_t i2c_addr_flags;
};
extern const struct sn5s330_config sn5s330_chips[];
@@ -25,10 +25,10 @@ enum sn5s330_pp_idx {
SN5S330_PP_COUNT,
};
-#define SN5S330_ADDR0__7bf (0x40)
-#define SN5S330_ADDR1__7bf (0x41)
-#define SN5S330_ADDR2__7bf (0x42)
-#define SN5S330_ADDR3__7bf (0x43)
+#define SN5S330_ADDR0_FLAGS 0x40
+#define SN5S330_ADDR1_FLAGS 0x41
+#define SN5S330_ADDR2_FLAGS 0x42
+#define SN5S330_ADDR3_FLAGS 0x43
#define SN5S330_FUNC_SET1 0x50
#define SN5S330_FUNC_SET2 0x51
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c
index a8f5c146bb..5f80dd3d90 100644
--- a/driver/ppc/syv682x.c
+++ b/driver/ppc/syv682x.c
@@ -23,16 +23,16 @@ static uint8_t flags[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);
}
@@ -258,11 +258,11 @@ static int syv682x_dump(int port)
int data;
int rv;
const int i2c_port = ppc_chips[port].i2c_port;
- const int i2c_addr__7bf = ppc_chips[port].i2c_addr__7bf;
+ const int i2c_addr_flags = ppc_chips[port].i2c_addr_flags;
for (reg_addr = SYV682X_STATUS_REG; reg_addr <= SYV682X_CONTROL_4_REG;
reg_addr++) {
- rv = i2c_read8__7bf(i2c_port, i2c_addr__7bf, reg_addr, &data);
+ rv = i2c_read8(i2c_port, i2c_addr_flags, reg_addr, &data);
if (rv)
ccprintf("ppc_syv682[p%d]: Failed to read reg 0x%02x\n",
port, reg_addr);
diff --git a/driver/ppc/syv682x.h b/driver/ppc/syv682x.h
index f355fe1cf9..4a76659f41 100644
--- a/driver/ppc/syv682x.h
+++ b/driver/ppc/syv682x.h
@@ -9,10 +9,10 @@
#define __CROS_EC_SYV682X_H
/* I2C addresses */
-#define SYV682X_ADDR0__7bf 0x40
-#define SYV682X_ADDR1__7bf 0x41
-#define SYV682X_ADDR2__7bf 0x42
-#define SYV682x_ADDR3__7bf 0x43
+#define SYV682X_ADDR0_FLAGS 0x40
+#define SYV682X_ADDR1_FLAGS 0x41
+#define SYV682X_ADDR2_FLAGS 0x42
+#define SYV682x_ADDR3_FLAGS 0x43
/* SYV682x register addresses */
#define SYV682X_STATUS_REG 0x00
diff --git a/driver/regulator_ir357x.c b/driver/regulator_ir357x.c
index 0e88eeaf37..4721146367 100644
--- a/driver/regulator_ir357x.c
+++ b/driver/regulator_ir357x.c
@@ -17,7 +17,7 @@
#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args)
/* I2C address */
-#define IR357x_I2C_ADDR__7bf (0x8)
+#define IR357x_I2C_ADDR_FLAGS 0x08
struct ir_setting {
uint8_t reg;
diff --git a/driver/sensorhub_lsm6dsm.c b/driver/sensorhub_lsm6dsm.c
index 711294fb98..37072d5970 100644
--- a/driver/sensorhub_lsm6dsm.c
+++ b/driver/sensorhub_lsm6dsm.c
@@ -21,12 +21,12 @@ static int set_reg_bit_field(const struct motion_sensor_t *s,
int tmp;
int ret;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, reg, &tmp);
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags, reg, &tmp);
if (ret != EC_SUCCESS)
return ret;
tmp |= bit_field;
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf, reg, tmp);
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags, reg, tmp);
}
static int clear_reg_bit_field(const struct motion_sensor_t *s,
@@ -35,12 +35,12 @@ static int clear_reg_bit_field(const struct motion_sensor_t *s,
int tmp;
int ret;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf, reg, &tmp);
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags, reg, &tmp);
if (ret != EC_SUCCESS)
return ret;
tmp &= ~(bit_field);
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf, reg, tmp);
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags, reg, tmp);
}
static inline int enable_sensorhub_func(const struct motion_sensor_t *s)
@@ -89,7 +89,7 @@ static inline int disable_aux_i2c_master(const struct motion_sensor_t *s)
static inline int restore_master_cfg(const struct motion_sensor_t *s,
int cache)
{
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_MASTER_CFG_ADDR, cache);
}
@@ -98,7 +98,7 @@ static int enable_i2c_pass_through(const struct motion_sensor_t *s,
{
int ret;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_MASTER_CFG_ADDR, cache);
if (ret != EC_SUCCESS) {
CPRINTF("%s: %s type:0x%x MCR error ret: %d\n",
@@ -111,7 +111,7 @@ static int enable_i2c_pass_through(const struct motion_sensor_t *s,
* Wait is for any pending bus activity(probably read) to settle down
* so that there is no bus contention.
*/
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_MASTER_CFG_ADDR,
*cache | LSM6DSM_EXT_TRIGGER_EN);
if (ret != EC_SUCCESS) {
@@ -121,7 +121,7 @@ static int enable_i2c_pass_through(const struct motion_sensor_t *s,
}
msleep(10);
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_MASTER_CFG_ADDR,
*cache & ~(LSM6DSM_EXT_TRIGGER_EN
| LSM6DSM_I2C_MASTER_ON));
@@ -132,7 +132,7 @@ static int enable_i2c_pass_through(const struct motion_sensor_t *s,
return ret;
}
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_MASTER_CFG_ADDR, LSM6DSM_I2C_PASS_THRU_MODE);
}
@@ -141,7 +141,7 @@ static inline int power_down_accel(const struct motion_sensor_t *s,
{
int ret;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL1_ADDR, cache);
if (ret != EC_SUCCESS) {
CPRINTF("%s: %s type:0x%x CTRL1R error ret: %d\n",
@@ -149,34 +149,34 @@ static inline int power_down_accel(const struct motion_sensor_t *s,
return ret;
}
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL1_ADDR,
*cache & ~LSM6DSM_XL_ODR_MASK);
}
static inline int restore_ctrl1(const struct motion_sensor_t *s, int cache)
{
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL1_ADDR, cache);
}
-static int config_slv0_read__7bf(const struct motion_sensor_t *s,
- const uint16_t slv_addr__7bf,
+static int config_slv0_read(const struct motion_sensor_t *s,
+ const uint16_t slv_addr_flags,
uint16_t reg, uint8_t len)
{
int ret;
- uint16_t addr__8b = I2C_GET_ADDR__7b(slv_addr__7bf) << 1;
+ uint16_t addr_8bit = I2C_GET_ADDR(slv_addr_flags) << 1;
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_SLV0_ADD_ADDR,
- (addr__8b | LSM6DSM_SLV0_RD_BIT));
+ (addr_8bit | LSM6DSM_SLV0_RD_BIT));
if (ret != EC_SUCCESS) {
CPRINTF("%s: %s type:0x%x SA error ret: %d\n",
__func__, s->name, s->type, ret);
return ret;
}
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_SLV0_SUBADD_ADDR, reg);
if (ret != EC_SUCCESS) {
CPRINTF("%s: %s type:0x%x RA error ret: %d\n",
@@ -188,7 +188,7 @@ static int config_slv0_read__7bf(const struct motion_sensor_t *s,
* No decimation for external sensor 0,
* Number of sensors connected to external sensor hub 1
*/
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_SLV0_CONFIG_ADDR,
(len & LSM6DSM_SLV0_NUM_OPS_MASK));
if (ret != EC_SUCCESS) {
@@ -200,8 +200,8 @@ static int config_slv0_read__7bf(const struct motion_sensor_t *s,
return EC_SUCCESS;
}
-int sensorhub_config_ext_reg__7bf(const struct motion_sensor_t *s,
- const uint16_t slv_addr__7bf,
+int sensorhub_config_ext_reg(const struct motion_sensor_t *s,
+ const uint16_t slv_addr_flags,
uint8_t reg, uint8_t val)
{
int ret;
@@ -214,13 +214,13 @@ int sensorhub_config_ext_reg__7bf(const struct motion_sensor_t *s,
return ret;
}
- ret = st_raw_write8__7bf(s->port, slv_addr__7bf, reg, val);
+ ret = st_raw_write8(s->port, slv_addr_flags, reg, val);
restore_master_cfg(s, tmp);
return ret;
}
-int sensorhub_config_slv0_read__7bf(const struct motion_sensor_t *s,
- uint16_t slv_addr__7bf, uint8_t reg, int len)
+int sensorhub_config_slv0_read(const struct motion_sensor_t *s,
+ uint16_t slv_addr_flags, uint8_t reg, int len)
{
int tmp_xl_cfg;
int ret;
@@ -245,7 +245,7 @@ int sensorhub_config_slv0_read__7bf(const struct motion_sensor_t *s,
goto out_restore_ctrl1;
}
- ret = config_slv0_read__7bf(s, slv_addr__7bf, reg, len);
+ ret = config_slv0_read(s, slv_addr_flags, reg, len);
disable_ereg_bank_acc(s);
if (ret != EC_SUCCESS) {
CPRINTF("%s: %s type:0x%x CS0R error ret: %d\n",
@@ -280,7 +280,7 @@ int sensorhub_slv0_data_read(const struct motion_sensor_t *s, uint8_t *raw)
* register as soon as the accel is in power-up mode. So return the
* contents of that register.
*/
- ret = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSM_SENSORHUB1_REG,
raw, OUT_XYZ_SIZE);
if (ret != EC_SUCCESS) {
@@ -291,8 +291,8 @@ int sensorhub_slv0_data_read(const struct motion_sensor_t *s, uint8_t *raw)
return EC_SUCCESS;
}
-int sensorhub_check_and_rst__7bf(const struct motion_sensor_t *s,
- const uint16_t slv_addr__7bf,
+int sensorhub_check_and_rst(const struct motion_sensor_t *s,
+ const uint16_t slv_addr_flags,
uint8_t whoami_reg, uint8_t whoami_val,
uint8_t rst_reg, uint8_t rst_val)
{
@@ -306,7 +306,7 @@ int sensorhub_check_and_rst__7bf(const struct motion_sensor_t *s,
return ret;
}
- ret = st_raw_read8__7bf(s->port, slv_addr__7bf, whoami_reg, &tmp);
+ ret = st_raw_read8(s->port, slv_addr_flags, whoami_reg, &tmp);
if (ret != EC_SUCCESS) {
CPRINTF("%s: %s type:0x%x WAIR error ret: %d\n",
__func__, s->name, s->type, ret);
@@ -320,7 +320,7 @@ int sensorhub_check_and_rst__7bf(const struct motion_sensor_t *s,
goto err_restore_master_cfg;
}
- ret = st_raw_write8__7bf(s->port, slv_addr__7bf, rst_reg, rst_val);
+ ret = st_raw_write8(s->port, slv_addr_flags, rst_reg, rst_val);
err_restore_master_cfg:
restore_master_cfg(s, tmp_master_cfg);
return ret;
diff --git a/driver/sensorhub_lsm6dsm.h b/driver/sensorhub_lsm6dsm.h
index 0eaef61c32..07b19046df 100644
--- a/driver/sensorhub_lsm6dsm.h
+++ b/driver/sensorhub_lsm6dsm.h
@@ -24,8 +24,8 @@
* @param val Value to be written into the external sensor register.
* @return EC_SUCCESS on success, EC error codes on failure.
*/
-int sensorhub_config_ext_reg__7bf(const struct motion_sensor_t *s,
- const uint16_t slv_addr__7bf,
+int sensorhub_config_ext_reg(const struct motion_sensor_t *s,
+ const uint16_t slv_addr_flags,
uint8_t reg, uint8_t val);
/**
@@ -38,8 +38,8 @@ int sensorhub_config_ext_reg__7bf(const struct motion_sensor_t *s,
* @param len Length of data to be read.
* @return EC_SUCCESS on success, EC error codes on failure.
*/
-int sensorhub_config_slv0_read__7bf(const struct motion_sensor_t *s,
- const uint16_t slv_addr__7bf,
+int sensorhub_config_slv0_read(const struct motion_sensor_t *s,
+ const uint16_t slv_addr_flags,
uint8_t reg, int len);
/**
@@ -64,8 +64,8 @@ int sensorhub_slv0_data_read(const struct motion_sensor_t *s, uint8_t *raw);
* @param rst_val Value to be written to the reset register.
* @return EC_SUCCESS on success, EC error codes on failure.
*/
-int sensorhub_check_and_rst__7bf(const struct motion_sensor_t *s,
- const uint16_t slv_addr__7bf,
+int sensorhub_check_and_rst(const struct motion_sensor_t *s,
+ const uint16_t slv_addr_flags,
uint8_t whoami_reg, uint8_t whoami_val,
uint8_t rst_reg, uint8_t rst_val);
#endif /* __CROS_EC_SENSORHUB_LSM6DSM_H */
diff --git a/driver/stm_mems_common.c b/driver/stm_mems_common.c
index 9341308fb5..6cee29977d 100644
--- a/driver/stm_mems_common.c
+++ b/driver/stm_mems_common.c
@@ -11,24 +11,24 @@
/**
* st_raw_read_n - Read n bytes for read
*/
-int st_raw_read_n__7bf(const int port,
- const uint16_t i2c_addr__7bf,
+int st_raw_read_n(const int port,
+ const uint16_t i2c_addr_flags,
const uint8_t reg, uint8_t *data_ptr, const int len)
{
/* TODO: Implement SPI interface support */
- return i2c_read_block__7bf(port, i2c_addr__7bf,
+ return i2c_read_block(port, i2c_addr_flags,
reg | 0x80, data_ptr, len);
}
/**
* st_raw_read_n_noinc - Read n bytes for read (no auto inc address)
*/
-int st_raw_read_n_noinc__7bf(const int port,
- const uint16_t i2c_addr__7bf,
+int st_raw_read_n_noinc(const int port,
+ const uint16_t i2c_addr_flags,
const uint8_t reg, uint8_t *data_ptr, const int len)
{
/* TODO: Implement SPI interface support */
- return i2c_read_block__7bf(port, i2c_addr__7bf,
+ return i2c_read_block(port, i2c_addr_flags,
reg, data_ptr, len);
}
@@ -45,7 +45,7 @@ int st_write_data_with_mask(const struct motion_sensor_t *s, int reg,
int err;
int new_data = 0x00, old_data = 0x00;
- err = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ err = st_raw_read8(s->port, s->i2c_spi_addr_flags,
reg, &old_data);
if (err != EC_SUCCESS)
return err;
@@ -56,7 +56,7 @@ int st_write_data_with_mask(const struct motion_sensor_t *s, int reg,
if (new_data == old_data)
return EC_SUCCESS;
- return st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ return st_raw_write8(s->port, s->i2c_spi_addr_flags,
reg, new_data);
}
diff --git a/driver/stm_mems_common.h b/driver/stm_mems_common.h
index 39d718cf1b..1984e5e070 100644
--- a/driver/stm_mems_common.h
+++ b/driver/stm_mems_common.h
@@ -34,37 +34,37 @@
/**
* Read single register
*/
-static inline int st_raw_read8__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static inline int st_raw_read8(const int port,
+ const uint16_t i2c_spi_addr_flags,
const int reg, int *data_ptr)
{
/* TODO: Implement SPI interface support */
- return i2c_read8__7bf(port, i2c_spi_addr__7bf, reg, data_ptr);
+ return i2c_read8(port, i2c_spi_addr_flags, reg, data_ptr);
}
/**
* Write single register
*/
-static inline int st_raw_write8__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+static inline int st_raw_write8(const int port,
+ const uint16_t i2c_spi_addr_flags,
const int reg, int data)
{
/* TODO: Implement SPI interface support */
- return i2c_write8__7bf(port, i2c_spi_addr__7bf, reg, data);
+ return i2c_write8(port, i2c_spi_addr_flags, reg, data);
}
/**
* st_raw_read_n - Read n bytes for read
*/
-int st_raw_read_n__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+int st_raw_read_n(const int port,
+ const uint16_t i2c_spi_addr_flags,
const uint8_t reg, uint8_t *data_ptr, const int len);
/**
* st_raw_read_n_noinc - Read n bytes for read (no auto inc address)
*/
-int st_raw_read_n_noinc__7bf(const int port,
- const uint16_t i2c_spi_addr__7bf,
+int st_raw_read_n_noinc(const int port,
+ const uint16_t i2c_spi_addr_flags,
const uint8_t reg, uint8_t *data_ptr, const int len);
/**
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index 7883f72717..d8c3cece6f 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -41,7 +41,7 @@
(((anx7447_get_vbus_voltage(port))) > vsafe0v_max)
struct anx_state {
- uint16_t i2c_slave_addr__7bf;
+ uint16_t i2c_slave_addr_flags;
};
struct anx_usb_mux {
@@ -64,17 +64,17 @@ static struct anx_usb_mux mux[CONFIG_USB_PD_PORT_COUNT];
* anx7447_reg_write() and anx7447_reg_read() are implemented here to access
* ANX7447 SPI slave address.
*/
-const struct anx7447_i2c_addr anx7447_i2c_addrs__7bf[] = {
- {AN7447_TCPC0_I2C_ADDR__7bf, AN7447_SPI0_I2C_ADDR__7bf},
- {AN7447_TCPC1_I2C_ADDR__7bf, AN7447_SPI1_I2C_ADDR__7bf},
- {AN7447_TCPC2_I2C_ADDR__7bf, AN7447_SPI2_I2C_ADDR__7bf},
- {AN7447_TCPC3_I2C_ADDR__7bf, AN7447_SPI3_I2C_ADDR__7bf}
+const struct anx7447_i2c_addr anx7447_i2c_addrs_flags[] = {
+ {AN7447_TCPC0_I2C_ADDR_FLAGS, AN7447_SPI0_I2C_ADDR_FLAGS},
+ {AN7447_TCPC1_I2C_ADDR_FLAGS, AN7447_SPI1_I2C_ADDR_FLAGS},
+ {AN7447_TCPC2_I2C_ADDR_FLAGS, AN7447_SPI2_I2C_ADDR_FLAGS},
+ {AN7447_TCPC3_I2C_ADDR_FLAGS, AN7447_SPI3_I2C_ADDR_FLAGS}
};
static inline int anx7447_reg_write(int port, int reg, int val)
{
- int rv = i2c_write8__7bf(tcpc_config[port].i2c_info.port,
- anx[port].i2c_slave_addr__7bf,
+ int rv = i2c_write8(tcpc_config[port].i2c_info.port,
+ anx[port].i2c_slave_addr_flags,
reg, val);
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
pd_device_accessed(port);
@@ -84,8 +84,8 @@ static inline int anx7447_reg_write(int port, int reg, int val)
static inline int anx7447_reg_read(int port, int reg, int *val)
{
- int rv = i2c_read8__7bf(tcpc_config[port].i2c_info.port,
- anx[port].i2c_slave_addr__7bf,
+ int rv = i2c_read8(tcpc_config[port].i2c_info.port,
+ anx[port].i2c_slave_addr_flags,
reg, val);
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
pd_device_accessed(port);
@@ -291,20 +291,19 @@ static int anx7447_init(int port)
* find corresponding anx7447 SPI slave address according to
* specified TCPC slave address
*/
- for (i = 0; i < ARRAY_SIZE(anx7447_i2c_addrs__7bf); i++) {
- if (I2C_GET_ADDR__7b(
- tcpc_config[port].i2c_info.addr__7bf) ==
- I2C_GET_ADDR__7b(
- anx7447_i2c_addrs__7bf[i].tcpc_slave_addr__7bf)) {
- anx[port].i2c_slave_addr__7bf =
- anx7447_i2c_addrs__7bf[i].spi_slave_addr__7bf;
+ for (i = 0; i < ARRAY_SIZE(anx7447_i2c_addrs_flags); i++) {
+ if (I2C_GET_ADDR(tcpc_config[port].i2c_info.addr_flags) ==
+ I2C_GET_ADDR(
+ anx7447_i2c_addrs_flags[i].tcpc_slave_addr_flags)) {
+ anx[port].i2c_slave_addr_flags =
+ anx7447_i2c_addrs_flags[i].spi_slave_addr_flags;
break;
}
}
- if (!I2C_GET_ADDR__7b(anx[port].i2c_slave_addr__7bf)) {
+ if (!I2C_GET_ADDR(anx[port].i2c_slave_addr_flags)) {
ccprintf("TCPC I2C slave addr 0x%x is invalid for ANX7447\n",
- I2C_GET_ADDR__7b(tcpc_config[port]
- .i2c_info.addr__7bf));
+ I2C_GET_ADDR(tcpc_config[port]
+ .i2c_info.addr_flags));
return EC_ERROR_UNKNOWN;
}
diff --git a/driver/tcpm/anx7447.h b/driver/tcpm/anx7447.h
index 32958f0007..f4827180da 100644
--- a/driver/tcpm/anx7447.h
+++ b/driver/tcpm/anx7447.h
@@ -91,19 +91,19 @@
/* End of defines used for CONFIG_USB_PD_TCPM_ANX7447_OCM_ERASE_COMMAND */
struct anx7447_i2c_addr {
- uint16_t tcpc_slave_addr__7bf;
- uint16_t spi_slave_addr__7bf;
+ uint16_t tcpc_slave_addr_flags;
+ uint16_t spi_slave_addr_flags;
};
-#define AN7447_TCPC0_I2C_ADDR__7bf (0x2C)
-#define AN7447_TCPC1_I2C_ADDR__7bf (0x2B)
-#define AN7447_TCPC2_I2C_ADDR__7bf (0x2A)
-#define AN7447_TCPC3_I2C_ADDR__7bf (0x29)
+#define AN7447_TCPC0_I2C_ADDR_FLAGS 0x2C
+#define AN7447_TCPC1_I2C_ADDR_FLAGS 0x2B
+#define AN7447_TCPC2_I2C_ADDR_FLAGS 0x2A
+#define AN7447_TCPC3_I2C_ADDR_FLAGS 0x29
-#define AN7447_SPI0_I2C_ADDR__7bf (0x3F)
-#define AN7447_SPI1_I2C_ADDR__7bf (0x37)
-#define AN7447_SPI2_I2C_ADDR__7bf (0x32)
-#define AN7447_SPI3_I2C_ADDR__7bf (0x31)
+#define AN7447_SPI0_I2C_ADDR_FLAGS 0x3F
+#define AN7447_SPI1_I2C_ADDR_FLAGS 0x37
+#define AN7447_SPI2_I2C_ADDR_FLAGS 0x32
+#define AN7447_SPI3_I2C_ADDR_FLAGS 0x31
/*
* Time TEST_R must be held high for a reset
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index bf75e21e07..47a7349f6a 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -1173,7 +1173,7 @@ struct i2c_stress_test_dev anx74xx_i2c_stress_test_dev = {
.read_val = ANX74XX_VENDOR_ID & 0xFF,
.write_reg = ANX74XX_REG_CC_SOFTWARE_CTRL,
},
- .i2c_read__7bf = &tcpc_i2c_read__7bf,
- .i2c_write__7bf = &tcpc_i2c_write__7bf,
+ .i2c_read = &tcpc_i2c_read,
+ .i2c_write = &tcpc_i2c_write,
};
#endif /* CONFIG_CMD_I2C_STRESS_TEST_TCPC */
diff --git a/driver/tcpm/anx74xx.h b/driver/tcpm/anx74xx.h
index 39762129a7..2648013abf 100644
--- a/driver/tcpm/anx74xx.h
+++ b/driver/tcpm/anx74xx.h
@@ -11,10 +11,10 @@
#define __CROS_EC_USB_PD_TCPM_ANX74XX_H
/* I2C interface */
-#define ANX74XX_I2C_ADDR1__7bf 0x28
-#define ANX74XX_I2C_ADDR2__7bf 0x39
-#define ANX74XX_I2C_ADDR3__7bf 0x3E
-#define ANX74XX_I2C_ADDR4__7bf 0x40
+#define ANX74XX_I2C_ADDR1_FLAGS 0x28
+#define ANX74XX_I2C_ADDR2_FLAGS 0x39
+#define ANX74XX_I2C_ADDR3_FLAGS 0x3E
+#define ANX74XX_I2C_ADDR4_FLAGS 0x40
#define ANX74XX_REG_IRQ_POL_LOW 0x00
#define ANX74XX_REG_IRQ_POL_HIGH 0x02
diff --git a/driver/tcpm/anx7688.c b/driver/tcpm/anx7688.c
index 4ea0602483..b450245a76 100644
--- a/driver/tcpm/anx7688.c
+++ b/driver/tcpm/anx7688.c
@@ -21,7 +21,7 @@
#define ANX7688_REG_HPD_IRQ BIT(1)
#define ANX7688_REG_HPD_ENABLE BIT(2)
-#define ANX7688_USBC_ADDR__7bf 0x28
+#define ANX7688_USBC_ADDR_FLAGS 0x28
#define ANX7688_REG_RAMCTRL 0xe7
#define ANX7688_REG_RAMCTRL_BOOT_DONE BIT(6)
@@ -39,7 +39,7 @@ static int anx7688_init(int port)
* 100ms to follow cts.
*/
while (1) {
- rv = i2c_read8__7bf(I2C_PORT_TCPC, ANX7688_USBC_ADDR__7bf,
+ rv = i2c_read8(I2C_PORT_TCPC, ANX7688_USBC_ADDR_FLAGS,
ANX7688_REG_RAMCTRL, &mask);
if (rv == EC_SUCCESS && (mask & ANX7688_REG_RAMCTRL_BOOT_DONE))
@@ -174,7 +174,7 @@ static int anx7688_tcpm_get_vbus_level(int port)
* Therefore, we use a proprietary register to read the unfiltered VBus
* value. See crosbug.com/p/55221 .
*/
- i2c_read8__7bf(I2C_PORT_TCPC, 0x28, 0x40, &reg);
+ i2c_read8(I2C_PORT_TCPC, 0x28, 0x40, &reg);
return ((reg & 0x10) ? 1 : 0);
}
#endif
diff --git a/driver/tcpm/fusb302.h b/driver/tcpm/fusb302.h
index edf1feb8dd..ec418407f7 100644
--- a/driver/tcpm/fusb302.h
+++ b/driver/tcpm/fusb302.h
@@ -16,13 +16,13 @@
/* I2C slave address varies by part number */
/* FUSB302BUCX / FUSB302BMPX */
-#define FUSB302_I2C_SLAVE_ADDR__7bf 0x22
+#define FUSB302_I2C_SLAVE_ADDR_FLAGS 0x22
/* FUSB302B01MPX */
-#define FUSB302_I2C_SLAVE_ADDR_B01__7bf 0x23
+#define FUSB302_I2C_SLAVE_ADDR_B01_FLAGS 0x23
/* FUSB302B10MPX */
-#define FUSB302_I2C_SLAVE_ADDR_B10__7bf 0x24
+#define FUSB302_I2C_SLAVE_ADDR_B10_FLAGS 0x24
/* FUSB302B11MPX */
-#define FUSB302_I2C_SLAVE_ADDR_B11__7bf 0x25
+#define FUSB302_I2C_SLAVE_ADDR_B11_FLAGS 0x25
/* Default retry count for transmitting */
#define PD_RETRY_COUNT 3
diff --git a/driver/tcpm/mt6370.c b/driver/tcpm/mt6370.c
index 473e2a1881..1d729f28e1 100644
--- a/driver/tcpm/mt6370.c
+++ b/driver/tcpm/mt6370.c
@@ -22,8 +22,8 @@
/* i2c_write function which won't wake TCPC from low power mode. */
static int mt6370_i2c_write8(int port, int reg, int val)
{
- return i2c_write8__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf, reg, val);
+ return i2c_write8(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags, reg, val);
}
static int mt6370_init(int port)
diff --git a/driver/tcpm/mt6370.h b/driver/tcpm/mt6370.h
index 166009d9a4..64ebd51a3d 100644
--- a/driver/tcpm/mt6370.h
+++ b/driver/tcpm/mt6370.h
@@ -48,7 +48,7 @@
#define MT6370_REG_UNLOCK_PW2 0xF0
#define MT6370_REG_UNLOCK_PW1 0xF1
-#define MT6370_TCPC_I2C_ADDR__7bf 0x4E
+#define MT6370_TCPC_I2C_ADDR_FLAGS 0x4E
/*
* MT6370_REG_PHY_CTRL1 0x80
diff --git a/driver/tcpm/nct38xx.h b/driver/tcpm/nct38xx.h
index 1357d47bab..e85860f2db 100644
--- a/driver/tcpm/nct38xx.h
+++ b/driver/tcpm/nct38xx.h
@@ -10,15 +10,15 @@
#define __CROS_EC_USB_PD_TCPM_NCT38XX_H
/* I2C interface */
-#define NCT38xx_I2C_ADDR1_1__7bf 0x70
-#define NCT38xx_I2C_ADDR1_2__7bf 0x71
-#define NCT38xx_I2C_ADDR1_3__7bf 0x72
-#define NCT38xx_I2C_ADDR1_4__7bf 0x73
-
-#define NCT38xx_I2C_ADDR2_1__7bf 0x74
-#define NCT38xx_I2C_ADDR2_2__7bf 0x75
-#define NCT38xx_I2C_ADDR2_3__7bf 0x76
-#define NCT38xx_I2C_ADDR2_4__7bf 0x77
+#define NCT38xx_I2C_ADDR1_1_FLAGS 0x70
+#define NCT38xx_I2C_ADDR1_2_FLAGS 0x71
+#define NCT38xx_I2C_ADDR1_3_FLAGS 0x72
+#define NCT38xx_I2C_ADDR1_4_FLAGS 0x73
+
+#define NCT38xx_I2C_ADDR2_1_FLAGS 0x74
+#define NCT38xx_I2C_ADDR2_2_FLAGS 0x75
+#define NCT38xx_I2C_ADDR2_3_FLAGS 0x76
+#define NCT38xx_I2C_ADDR2_4_FLAGS 0x77
#define NCT38XX_REG_VENDOR_ID_L 0x00
#define NCT38XX_REG_VENDOR_ID_H 0x01
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index db243621b8..e95a70191a 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -207,8 +207,8 @@ struct i2c_stress_test_dev ps8xxx_i2c_stress_test_dev = {
.read_val = PS8XXX_VENDOR_ID & 0xFF,
.write_reg = MUX_IN_HPD_ASSERTION_REG,
},
- .i2c_read__7bf = &tcpc_i2c_read__7bf,
- .i2c_write__7bf = &tcpc_i2c_write__7bf,
+ .i2c_read = &tcpc_i2c_read,
+ .i2c_write = &tcpc_i2c_write,
};
#endif /* CONFIG_CMD_I2C_STRESS_TEST_TCPC */
diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h
index 143ab67649..b94156652d 100644
--- a/driver/tcpm/ps8xxx.h
+++ b/driver/tcpm/ps8xxx.h
@@ -9,10 +9,10 @@
#define __CROS_EC_USB_PD_TCPM_PS8XXX_H
/* I2C interface */
-#define PS8751_I2C_ADDR1__7bf (0x0B)
-#define PS8751_I2C_ADDR2__7bf (0x1B)
-#define PS8751_I2C_ADDR3__7bf (0x2B)
-#define PS8751_I2C_ADDR4__7bf (0x4B)
+#define PS8751_I2C_ADDR1_FLAGS 0x0B
+#define PS8751_I2C_ADDR2_FLAGS 0x1B
+#define PS8751_I2C_ADDR3_FLAGS 0x2B
+#define PS8751_I2C_ADDR4_FLAGS 0x4B
/* Minimum Delay for reset assertion */
#define PS8XXX_RESET_DELAY_MS 1
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 129adf3da9..ab0b4f777c 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -40,8 +40,8 @@ int tcpc_write(int port, int reg, int val)
pd_wait_exit_low_power(port);
- rv = i2c_write8__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ rv = i2c_write8(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, val);
pd_device_accessed(port);
@@ -54,8 +54,8 @@ int tcpc_write16(int port, int reg, int val)
pd_wait_exit_low_power(port);
- rv = i2c_write16__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ rv = i2c_write16(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, val);
pd_device_accessed(port);
@@ -68,8 +68,8 @@ int tcpc_read(int port, int reg, int *val)
pd_wait_exit_low_power(port);
- rv = i2c_read8__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ rv = i2c_read8(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, val);
pd_device_accessed(port);
@@ -82,8 +82,8 @@ int tcpc_read16(int port, int reg, int *val)
pd_wait_exit_low_power(port);
- rv = i2c_read16__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ rv = i2c_read16(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, val);
pd_device_accessed(port);
@@ -96,8 +96,8 @@ int tcpc_read_block(int port, int reg, uint8_t *in, int size)
pd_wait_exit_low_power(port);
- rv = i2c_read_block__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ rv = i2c_read_block(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, in, size);
pd_device_accessed(port);
@@ -110,8 +110,8 @@ int tcpc_write_block(int port, int reg, const uint8_t *out, int size)
pd_wait_exit_low_power(port);
- rv = i2c_write_block__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ rv = i2c_write_block(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, out, size);
pd_device_accessed(port);
@@ -137,8 +137,8 @@ int tcpc_xfer_unlocked(int port, const uint8_t *out, int out_size,
pd_wait_exit_low_power(port);
- rv = i2c_xfer_unlocked__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ rv = i2c_xfer_unlocked(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
out, out_size, in, in_size, flags);
pd_device_accessed(port);
diff --git a/driver/tcpm/tcpm.h b/driver/tcpm/tcpm.h
index 9d03f52500..ca7d3cf7bd 100644
--- a/driver/tcpm/tcpm.h
+++ b/driver/tcpm/tcpm.h
@@ -27,60 +27,60 @@
#ifndef CONFIG_USB_PD_TCPC_LOW_POWER
static inline int tcpc_write(int port, int reg, int val)
{
- return i2c_write8__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ return i2c_write8(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, val);
}
static inline int tcpc_write16(int port, int reg, int val)
{
- return i2c_write16__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ return i2c_write16(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, val);
}
static inline int tcpc_read(int port, int reg, int *val)
{
- return i2c_read8__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ return i2c_read8(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, val);
}
static inline int tcpc_read16(int port, int reg, int *val)
{
- return i2c_read16__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ return i2c_read16(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, val);
}
static inline int tcpc_xfer(int port, const uint8_t *out, int out_size,
uint8_t *in, int in_size)
{
- return i2c_xfer__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ return i2c_xfer(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
out, out_size, in, in_size);
}
static inline int tcpc_xfer_unlocked(int port, const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
- return i2c_xfer_unlocked__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ return i2c_xfer_unlocked(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
out, out_size, in, in_size, flags);
}
static inline int tcpc_read_block(int port, int reg, uint8_t *in, int size)
{
- return i2c_read_block__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ return i2c_read_block(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, in, size);
}
static inline int tcpc_write_block(int port, int reg,
const uint8_t *out, int size)
{
- return i2c_write_block__7bf(tcpc_config[port].i2c_info.port,
- tcpc_config[port].i2c_info.addr__7bf,
+ return i2c_write_block(tcpc_config[port].i2c_info.port,
+ tcpc_config[port].i2c_info.addr_flags,
reg, out, size);
}
@@ -225,13 +225,13 @@ static inline int tcpm_enter_low_power_mode(int port)
#endif
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
-static inline int tcpc_i2c_read__7bf(const int port, const uint16_t addr__7bf,
+static inline int tcpc_i2c_read(const int port, const uint16_t addr_flags,
const int reg, int *data)
{
return tcpc_read(port, reg, data);
}
-static inline int tcpc_i2c_write__7bf(const int port, const uint16_t addr__7bf,
+static inline int tcpc_i2c_write(const int port, const uint16_t addr_flags,
const int reg, int data)
{
return tcpc_write(port, reg, data);
diff --git a/driver/tcpm/tusb422.h b/driver/tcpm/tusb422.h
index 524886801c..52d0a079d6 100644
--- a/driver/tcpm/tusb422.h
+++ b/driver/tcpm/tusb422.h
@@ -9,7 +9,7 @@
#define __CROS_EC_USB_PD_TCPM_TUSB422_H
/* I2C interface */
-#define TUSB422_I2C_ADDR__7bf 0x20
+#define TUSB422_I2C_ADDR_FLAGS 0x20
extern const struct tcpm_drv tusb422_tcpm_drv;
diff --git a/driver/temp_sensor/adt7481.c b/driver/temp_sensor/adt7481.c
index c724e958e1..df6ff4bb7c 100644
--- a/driver/temp_sensor/adt7481.c
+++ b/driver/temp_sensor/adt7481.c
@@ -34,13 +34,13 @@ static int has_power(void)
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8__7bf(I2C_PORT_THERMAL, ADT7481_I2C_ADDR__7bf,
+ return i2c_read8(I2C_PORT_THERMAL, ADT7481_I2C_ADDR_FLAGS,
offset, data_ptr);
}
static int raw_write8(const int offset, int data)
{
- return i2c_write8__7bf(I2C_PORT_THERMAL, ADT7481_I2C_ADDR__7bf,
+ return i2c_write8(I2C_PORT_THERMAL, ADT7481_I2C_ADDR_FLAGS,
offset, data);
}
diff --git a/driver/temp_sensor/adt7481.h b/driver/temp_sensor/adt7481.h
index 17f3c20056..78541a0a3b 100644
--- a/driver/temp_sensor/adt7481.h
+++ b/driver/temp_sensor/adt7481.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_ADT7481_H
#define __CROS_EC_ADT7481_H
-#define ADT7481_I2C_ADDR__7bf 0x4B
+#define ADT7481_I2C_ADDR_FLAGS 0x4B
#define ADT7481_IDX_LOCAL 0
#define ADT7481_IDX_REMOTE1 1
diff --git a/driver/temp_sensor/bd99992gw.c b/driver/temp_sensor/bd99992gw.c
index 9ccbde6d8e..0fc8f094b4 100644
--- a/driver/temp_sensor/bd99992gw.c
+++ b/driver/temp_sensor/bd99992gw.c
@@ -39,7 +39,7 @@ static enum bd99992gw_adc_channel
static int raw_read8(const int offset, int *data_ptr)
{
int ret;
- ret = i2c_read8__7bf(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR__7bf,
+ ret = i2c_read8(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR_FLAGS,
offset, data_ptr);
if (ret != EC_SUCCESS)
CPRINTS("bd99992gw read fail %d", ret);
@@ -49,7 +49,7 @@ static int raw_read8(const int offset, int *data_ptr)
static int raw_write8(const int offset, int data)
{
int ret;
- ret = i2c_write8__7bf(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR__7bf,
+ ret = i2c_write8(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR_FLAGS,
offset, data);
if (ret != EC_SUCCESS)
CPRINTS("bd99992gw write fail %d", ret);
diff --git a/driver/temp_sensor/bd99992gw.h b/driver/temp_sensor/bd99992gw.h
index 1d5aff7287..c461012c45 100644
--- a/driver/temp_sensor/bd99992gw.h
+++ b/driver/temp_sensor/bd99992gw.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_TEMP_SENSOR_BD99992GW_H
#define __CROS_EC_TEMP_SENSOR_BD99992GW_H
-#define BD99992GW_I2C_ADDR__7bf 0x30
+#define BD99992GW_I2C_ADDR_FLAGS 0x30
/* ADC channels */
enum bd99992gw_adc_channel {
diff --git a/driver/temp_sensor/f75303.c b/driver/temp_sensor/f75303.c
index 794d2e865a..6b8895a252 100644
--- a/driver/temp_sensor/f75303.c
+++ b/driver/temp_sensor/f75303.c
@@ -20,7 +20,7 @@ static int8_t fake_temp[F75303_IDX_COUNT] = {-1, -1, -1};
*/
static int raw_read8(const int offset, int *data)
{
- return i2c_read8__7bf(I2C_PORT_THERMAL, F75303_I2C_ADDR__7bf,
+ return i2c_read8(I2C_PORT_THERMAL, F75303_I2C_ADDR_FLAGS,
offset, data);
}
diff --git a/driver/temp_sensor/f75303.h b/driver/temp_sensor/f75303.h
index ea2dcdbd79..a4bdcbf872 100644
--- a/driver/temp_sensor/f75303.h
+++ b/driver/temp_sensor/f75303.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_F75303_H
#define __CROS_EC_F75303_H
-#define F75303_I2C_ADDR__7bf 0x4C
+#define F75303_I2C_ADDR_FLAGS 0x4C
enum f75303_index {
F75303_IDX_LOCAL = 0,
diff --git a/driver/temp_sensor/g78x.c b/driver/temp_sensor/g78x.c
index 0a71556b27..935586b8fa 100644
--- a/driver/temp_sensor/g78x.c
+++ b/driver/temp_sensor/g78x.c
@@ -35,14 +35,14 @@ static int has_power(void)
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8__7bf(I2C_PORT_THERMAL, G78X_I2C_ADDR__7bf,
+ return i2c_read8(I2C_PORT_THERMAL, G78X_I2C_ADDR_FLAGS,
offset, data_ptr);
}
#ifdef CONFIG_CMD_TEMP_SENSOR
static int raw_write8(const int offset, int data)
{
- return i2c_write8__7bf(I2C_PORT_THERMAL, G78X_I2C_ADDR__7bf,
+ return i2c_write8(I2C_PORT_THERMAL, G78X_I2C_ADDR_FLAGS,
offset, data);
}
#endif
diff --git a/driver/temp_sensor/g78x.h b/driver/temp_sensor/g78x.h
index 6d656610d9..fdd987fcbd 100644
--- a/driver/temp_sensor/g78x.h
+++ b/driver/temp_sensor/g78x.h
@@ -12,7 +12,7 @@
#error Cannot support both G781 and G782 together!
#endif
-#define G78X_I2C_ADDR__7bf 0x4C
+#define G78X_I2C_ADDR_FLAGS 0x4C
#define G78X_IDX_INTERNAL 0
#define G78X_IDX_EXTERNAL1 1
diff --git a/driver/temp_sensor/sb_tsi.c b/driver/temp_sensor/sb_tsi.c
index 3de816e1dc..a806ff395f 100644
--- a/driver/temp_sensor/sb_tsi.c
+++ b/driver/temp_sensor/sb_tsi.c
@@ -19,7 +19,7 @@
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8__7bf(I2C_PORT_THERMAL, SB_TSI_I2C_ADDR__7bf,
+ return i2c_read8(I2C_PORT_THERMAL, SB_TSI_I2C_ADDR_FLAGS,
offset, data_ptr);
}
diff --git a/driver/temp_sensor/sb_tsi.h b/driver/temp_sensor/sb_tsi.h
index afed1d206f..ae61e4e34d 100644
--- a/driver/temp_sensor/sb_tsi.h
+++ b/driver/temp_sensor/sb_tsi.h
@@ -11,7 +11,7 @@
#ifndef __CROS_EC_SB_TSI_H
#define __CROS_EC_SB_TSI_H
-#define SB_TSI_I2C_ADDR__7bf 0x4C
+#define SB_TSI_I2C_ADDR_FLAGS 0x4C
/* G781 register */
#define SB_TSI_TEMP_H 0x01
diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c
index b615dbd4cc..1b8f6eb746 100644
--- a/driver/temp_sensor/tmp006.c
+++ b/driver/temp_sensor/tmp006.c
@@ -86,7 +86,7 @@ static void tmp006_poll_sensor(int sensor_id)
{
struct tmp006_data_t *tdata = tmp006_data + sensor_id;
int t, v, rv;
- int addr__7bf = tmp006_sensors__7bf[sensor_id].addr__7bf;
+ int addr_flags = tmp006_sensors[sensor_id].addr_flags;
/* Invalidate the filter history if there is any error */
if (tdata->fail) {
@@ -104,8 +104,8 @@ static void tmp006_poll_sensor(int sensor_id)
* data ready; otherwise, we read garbage data.
*/
if (tdata->fail & (FAIL_POWER | FAIL_INIT)) {
- rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
- TMP006_REG__7bf(addr__7bf),
+ rv = i2c_read16(TMP006_PORT(addr_flags),
+ TMP006_REG(addr_flags),
TMP006_REG_CONFIG, &v);
if (rv) {
tdata->fail |= FAIL_I2C;
@@ -117,16 +117,16 @@ static void tmp006_poll_sensor(int sensor_id)
}
}
- rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
- TMP006_REG__7bf(addr__7bf),
+ rv = i2c_read16(TMP006_PORT(addr_flags),
+ TMP006_REG(addr_flags),
TMP006_REG_TDIE, &t);
if (rv) {
tdata->fail |= FAIL_I2C;
return;
}
- rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
- TMP006_REG__7bf(addr__7bf),
+ rv = i2c_read16(TMP006_PORT(addr_flags),
+ TMP006_REG(addr_flags),
TMP006_REG_VOBJ, &v);
if (rv) {
tdata->fail |= FAIL_I2C;
@@ -373,42 +373,42 @@ static int tmp006_print(int idx)
int traw, t;
int rv;
int d;
- int addr__7bf = tmp006_sensors__7bf[idx].addr__7bf;
+ int addr_flags = tmp006_sensors[idx].addr_flags;
- ccprintf("Debug data from %s:\n", tmp006_sensors__7bf[idx].name);
+ ccprintf("Debug data from %s:\n", tmp006_sensors[idx].name);
if (!tmp006_has_power(idx)) {
ccputs("Sensor powered off.\n");
return EC_ERROR_UNKNOWN;
}
- rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
- TMP006_REG__7bf(addr__7bf),
+ rv = i2c_read16(TMP006_PORT(addr_flags),
+ TMP006_REG(addr_flags),
TMP006_REG_MANUFACTURER_ID, &d);
if (rv)
return rv;
ccprintf(" Manufacturer ID: 0x%04x\n", d);
- rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
- TMP006_REG__7bf(addr__7bf),
+ rv = i2c_read16(TMP006_PORT(addr_flags),
+ TMP006_REG(addr_flags),
TMP006_REG_DEVICE_ID, &d);
ccprintf(" Device ID: 0x%04x\n", d);
- rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
- TMP006_REG__7bf(addr__7bf),
+ rv = i2c_read16(TMP006_PORT(addr_flags),
+ TMP006_REG(addr_flags),
TMP006_REG_CONFIG, &d);
ccprintf(" Config: 0x%04x\n", d);
- rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
- TMP006_REG__7bf(addr__7bf),
+ rv = i2c_read16(TMP006_PORT(addr_flags),
+ TMP006_REG(addr_flags),
TMP006_REG_VOBJ, &vraw);
v = ((int)vraw * 15625) / 100;
ccprintf(" Voltage: 0x%04x = %d nV\n", vraw, v);
- rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
- TMP006_REG__7bf(addr__7bf),
+ rv = i2c_read16(TMP006_PORT(addr_flags),
+ TMP006_REG(addr_flags),
TMP006_REG_TDIE, &traw);
t = (int)traw;
ccprintf(" Temperature: 0x%04x = %d.%02d C\n",
@@ -463,7 +463,7 @@ static int command_t6cal(int argc, char **argv)
tdata = tmp006_data + i;
ccprintf("%d %-11s"
"%7de-17 %7de-8 %7de-10 %7de-12\n",
- i, tmp006_sensors__7bf[i].name,
+ i, tmp006_sensors[i].name,
(int)(tdata->s0 * 1e17f),
(int)(tdata->b0 * 1e8f),
(int)(tdata->b1 * 1e10f),
diff --git a/driver/temp_sensor/tmp006.h b/driver/temp_sensor/tmp006.h
index 98f8e31ee0..594dbc711a 100644
--- a/driver/temp_sensor/tmp006.h
+++ b/driver/temp_sensor/tmp006.h
@@ -16,17 +16,17 @@
#define TMP006_REG_DEVICE_ID 0xff
/* I2C address components */
-#define TMP006_ADDR__7bf(PORT, REG) ((PORT << 16) + REG)
-#define TMP006_PORT(ADDR__7bf) (ADDR__7bf >> 16)
-#define TMP006_REG__7bf(ADDR__7bf) (ADDR__7bf & 0xffff)
+#define TMP006_ADDR(PORT, REG) ((PORT << 16) + REG)
+#define TMP006_PORT(ADDR) (ADDR >> 16)
+#define TMP006_REG(ADDR) (ADDR & 0xffff)
struct tmp006_t {
const char *name;
- int addr__7bf; /* I2C address formed by TMP006_ADDR macro. */
+ int addr_flags; /* I2C address formed by TMP006_ADDR macro. */
};
/* Names and addresses of the sensors we have */
-extern const struct tmp006_t tmp006_sensors__7bf[];
+extern const struct tmp006_t tmp006_sensors[];
/**
* Get the last polled value of a sensor.
diff --git a/driver/temp_sensor/tmp112.c b/driver/temp_sensor/tmp112.c
index b80fc4bb61..045aca8c9c 100644
--- a/driver/temp_sensor/tmp112.c
+++ b/driver/temp_sensor/tmp112.c
@@ -20,13 +20,13 @@ static int temp_val_local;
static int raw_read16(const int offset, int *data_ptr)
{
- return i2c_read16__7bf(I2C_PORT_THERMAL, TMP112_I2C_ADDR__7bf,
+ return i2c_read16(I2C_PORT_THERMAL, TMP112_I2C_ADDR_FLAGS,
offset, data_ptr);
}
static int raw_write16(const int offset, int data)
{
- return i2c_write16__7bf(I2C_PORT_THERMAL, TMP112_I2C_ADDR__7bf,
+ return i2c_write16(I2C_PORT_THERMAL, TMP112_I2C_ADDR_FLAGS,
offset, data);
}
diff --git a/driver/temp_sensor/tmp112.h b/driver/temp_sensor/tmp112.h
index f1c5725741..35f5909045 100644
--- a/driver/temp_sensor/tmp112.h
+++ b/driver/temp_sensor/tmp112.h
@@ -8,7 +8,7 @@
#include "i2c.h"
-#define TMP112_I2C_ADDR__7bf (0x48 | I2C_FLAG_BIG_ENDIAN)
+#define TMP112_I2C_ADDR_FLAGS (0x48 | I2C_FLAG_BIG_ENDIAN)
#define TMP112_REG_TEMP 0x00
#define TMP112_REG_CONF 0x01
diff --git a/driver/temp_sensor/tmp411.h b/driver/temp_sensor/tmp411.h
index 6e15f52c3e..ef1b23278c 100644
--- a/driver/temp_sensor/tmp411.h
+++ b/driver/temp_sensor/tmp411.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_TMP411_H
#define __CROS_EC_TMP411_H
-#define TMP411_I2C_ADDR__7bf 0x4C
+#define TMP411_I2C_ADDR_FLAGS 0x4C
#define TMP411_IDX_LOCAL 0
#define TMP411_IDX_REMOTE1 1
diff --git a/driver/temp_sensor/tmp432.c b/driver/temp_sensor/tmp432.c
index 6325547ace..1b95886c63 100644
--- a/driver/temp_sensor/tmp432.c
+++ b/driver/temp_sensor/tmp432.c
@@ -35,13 +35,13 @@ static int has_power(void)
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8__7bf(I2C_PORT_THERMAL, TMP432_I2C_ADDR__7bf,
+ return i2c_read8(I2C_PORT_THERMAL, TMP432_I2C_ADDR_FLAGS,
offset, data_ptr);
}
static int raw_write8(const int offset, int data)
{
- return i2c_write8__7bf(I2C_PORT_THERMAL, TMP432_I2C_ADDR__7bf,
+ return i2c_write8(I2C_PORT_THERMAL, TMP432_I2C_ADDR_FLAGS,
offset, data);
}
diff --git a/driver/temp_sensor/tmp432.h b/driver/temp_sensor/tmp432.h
index 638cde91e1..e58e39a4a0 100644
--- a/driver/temp_sensor/tmp432.h
+++ b/driver/temp_sensor/tmp432.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_TMP432_H
#define __CROS_EC_TMP432_H
-#define TMP432_I2C_ADDR__7bf 0x4C
+#define TMP432_I2C_ADDR_FLAGS 0x4C
#define TMP432_IDX_LOCAL 0
#define TMP432_IDX_REMOTE1 1
diff --git a/driver/temp_sensor/tmp468.c b/driver/temp_sensor/tmp468.c
index 444a1d5dc8..46e77ca696 100644
--- a/driver/temp_sensor/tmp468.c
+++ b/driver/temp_sensor/tmp468.c
@@ -27,13 +27,13 @@ static int has_power(void)
static int raw_read16(const int offset, int *data_ptr)
{
- return i2c_read16__7bf(I2C_PORT_THERMAL, TMP468_I2C_ADDR__7bf,
+ return i2c_read16(I2C_PORT_THERMAL, TMP468_I2C_ADDR_FLAGS,
offset, data_ptr);
}
static int raw_write16(const int offset, int data_ptr)
{
- return i2c_write16__7bf(I2C_PORT_THERMAL, TMP468_I2C_ADDR__7bf,
+ return i2c_write16(I2C_PORT_THERMAL, TMP468_I2C_ADDR_FLAGS,
offset, data_ptr);
}
diff --git a/driver/temp_sensor/tmp468.h b/driver/temp_sensor/tmp468.h
index f8f4337d8a..59fbd20477 100644
--- a/driver/temp_sensor/tmp468.h
+++ b/driver/temp_sensor/tmp468.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_TMP468_H
#define __CROS_EC_TMP468_H
-#define TMP468_I2C_ADDR__7bf (0x48 | I2C_FLAG_BIG_ENDIAN)
+#define TMP468_I2C_ADDR_FLAGS (0x48 | I2C_FLAG_BIG_ENDIAN)
#define TMP468_SHIFT1 7
#define TMP468_LOCAL 0x00
diff --git a/driver/touchpad_elan.c b/driver/touchpad_elan.c
index 247c85894f..a056f2ddff 100644
--- a/driver/touchpad_elan.c
+++ b/driver/touchpad_elan.c
@@ -115,8 +115,8 @@ static int elan_tp_read_cmd(uint16_t reg, uint16_t *val)
buf[0] = reg;
buf[1] = reg >> 8;
- return i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
- CONFIG_TOUCHPAD_I2C_ADDR__7BF,
+ return i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR_FLAGS,
buf, sizeof(buf), (uint8_t *)val, sizeof(*val));
}
@@ -129,8 +129,8 @@ static int elan_tp_write_cmd(uint16_t reg, uint16_t val)
buf[2] = val;
buf[3] = val >> 8;
- return i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
- CONFIG_TOUCHPAD_I2C_ADDR__7BF,
+ return i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR_FLAGS,
buf, sizeof(buf), NULL, 0);
}
@@ -191,8 +191,8 @@ static int elan_tp_read_report(void)
/* Compute and save timestamp early in case another interrupt comes. */
timestamp = irq_ts / USB_HID_TOUCHPAD_TIMESTAMP_UNIT;
- rv = i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
- CONFIG_TOUCHPAD_I2C_ADDR__7BF,
+ rv = i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR_FLAGS,
NULL, 0, tp_buf, ETP_I2C_REPORT_LEN);
if (rv) {
@@ -280,8 +280,8 @@ static void elan_tp_init(void)
elan_tp_write_cmd(ETP_I2C_STAND_CMD, ETP_I2C_RESET);
msleep(100);
- rv = i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
- CONFIG_TOUCHPAD_I2C_ADDR__7BF,
+ rv = i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR_FLAGS,
NULL, 0, val, sizeof(val));
CPRINTS("reset rv %d buf=%04x", rv, *((uint16_t *)val));
@@ -471,8 +471,8 @@ static int touchpad_update_page(const uint8_t *data)
page_store[FW_PAGE_SIZE + 2 + 0] = checksum & 0xff;
page_store[FW_PAGE_SIZE + 2 + 1] = (checksum >> 8) & 0xff;
- rv = i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
- CONFIG_TOUCHPAD_I2C_ADDR__7BF,
+ rv = i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR_FLAGS,
page_store, sizeof(page_store), NULL, 0);
if (rv)
return rv;
@@ -636,8 +636,8 @@ int touchpad_debug(const uint8_t *param, unsigned int param_size,
memset(buffer, 0, buffer_size);
}
- rv = i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
- CONFIG_TOUCHPAD_I2C_ADDR__7BF,
+ rv = i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR_FLAGS,
&param[offset], write_length,
buffer, read_length);
diff --git a/driver/usb_mux/it5205.c b/driver/usb_mux/it5205.c
index 745a341591..9a6f71dade 100644
--- a/driver/usb_mux/it5205.c
+++ b/driver/usb_mux/it5205.c
@@ -16,12 +16,12 @@
static int it5205_read(int port, uint8_t reg, int *val)
{
- return i2c_read8__7bf(I2C_PORT_USB_MUX, MUX_ADDR__7bf(port), reg, val);
+ return i2c_read8(I2C_PORT_USB_MUX, MUX_ADDR(port), reg, val);
}
static int it5205_write(int port, uint8_t reg, uint8_t val)
{
- return i2c_write8__7bf(I2C_PORT_USB_MUX, MUX_ADDR__7bf(port), reg, val);
+ return i2c_write8(I2C_PORT_USB_MUX, MUX_ADDR(port), reg, val);
}
struct mux_chip_id_t {
diff --git a/driver/usb_mux/it5205.h b/driver/usb_mux/it5205.h
index 02d389ad36..9e9c4ccfcc 100644
--- a/driver/usb_mux/it5205.h
+++ b/driver/usb_mux/it5205.h
@@ -9,8 +9,8 @@
#define __CROS_EC_IT5205_H
/* I2C interface */
-#define IT5205_I2C_ADDR1__7bf (0x48)
-#define IT5205_I2C_ADDR2__7bf (0x58)
+#define IT5205_I2C_ADDR1_FLAGS 0x48
+#define IT5205_I2C_ADDR2_FLAGS 0x58
/* Chip ID registers */
#define IT5205_REG_CHIP_ID3 0x4
diff --git a/driver/usb_mux/pi3usb30532.c b/driver/usb_mux/pi3usb30532.c
index 24f9cbd095..e5af1b90a6 100644
--- a/driver/usb_mux/pi3usb30532.c
+++ b/driver/usb_mux/pi3usb30532.c
@@ -20,8 +20,7 @@ static int pi3usb30532_read(int port, uint8_t reg, uint8_t *val)
* Second byte read will be vendor ID.
* Third byte read will be selection control.
*/
- res = i2c_read16__7bf(I2C_PORT_USB_MUX,
- MUX_ADDR__7bf(port),
+ res = i2c_read16(I2C_PORT_USB_MUX, MUX_ADDR(port),
0, &read);
if (res)
return res;
@@ -39,8 +38,7 @@ static int pi3usb30532_write(int port, uint8_t reg, uint8_t val)
if (reg != PI3USB30532_REG_CONTROL)
return EC_ERROR_UNKNOWN;
- return i2c_write8__7bf(I2C_PORT_USB_MUX,
- MUX_ADDR__7bf(port),
+ return i2c_write8(I2C_PORT_USB_MUX, MUX_ADDR(port),
0, val);
}
diff --git a/driver/usb_mux/ps874x.c b/driver/usb_mux/ps874x.c
index 73bb39bce5..db13180c1c 100644
--- a/driver/usb_mux/ps874x.c
+++ b/driver/usb_mux/ps874x.c
@@ -13,15 +13,13 @@
static inline int ps874x_read(int port, uint8_t reg, int *val)
{
- return i2c_read8__7bf(I2C_PORT_USB_MUX,
- MUX_ADDR__7bf(port),
+ return i2c_read8(I2C_PORT_USB_MUX, MUX_ADDR(port),
reg, val);
}
static inline int ps874x_write(int port, uint8_t reg, uint8_t val)
{
- return i2c_write8__7bf(I2C_PORT_USB_MUX,
- MUX_ADDR__7bf(port),
+ return i2c_write8(I2C_PORT_USB_MUX, MUX_ADDR(port),
reg, val);
}
diff --git a/driver/wpc/p9221.c b/driver/wpc/p9221.c
index 948734aba1..0225039c4d 100644
--- a/driver/wpc/p9221.c
+++ b/driver/wpc/p9221.c
@@ -98,37 +98,37 @@ static int p9221_reg_is_8_bit(uint16_t reg)
static int p9221_read8(uint16_t reg, int *val)
{
- return i2c_read_offset16__7bf(wpc->i2c_port, P9221_R7_ADDR__7bf,
+ return i2c_read_offset16(wpc->i2c_port, P9221_R7_ADDR_FLAGS,
reg, val, 1);
}
static int p9221_write8(uint16_t reg, int val)
{
- return i2c_write_offset16__7bf(wpc->i2c_port, P9221_R7_ADDR__7bf,
+ return i2c_write_offset16(wpc->i2c_port, P9221_R7_ADDR_FLAGS,
reg, val, 1);
}
static int p9221_read16(uint16_t reg, int *val)
{
- return i2c_read_offset16__7bf(wpc->i2c_port, P9221_R7_ADDR__7bf,
+ return i2c_read_offset16(wpc->i2c_port, P9221_R7_ADDR_FLAGS,
reg, val, 2);
}
static int p9221_write16(uint16_t reg, int val)
{
- return i2c_write_offset16__7bf(wpc->i2c_port, P9221_R7_ADDR__7bf,
+ return i2c_write_offset16(wpc->i2c_port, P9221_R7_ADDR_FLAGS,
reg, val, 2);
}
static int p9221_block_read(uint16_t reg, uint8_t *data, int len)
{
- return i2c_read_offset16_block__7bf(wpc->i2c_port, P9221_R7_ADDR__7bf,
+ return i2c_read_offset16_block(wpc->i2c_port, P9221_R7_ADDR_FLAGS,
reg, data, len);
}
static int p9221_block_write(uint16_t reg, uint8_t *data, int len)
{
- return i2c_write_offset16_block__7bf(wpc->i2c_port, P9221_R7_ADDR__7bf,
+ return i2c_write_offset16_block(wpc->i2c_port, P9221_R7_ADDR_FLAGS,
reg, data, len);
}
diff --git a/driver/wpc/p9221.h b/driver/wpc/p9221.h
index b590a5c1c7..0bb0571b38 100644
--- a/driver/wpc/p9221.h
+++ b/driver/wpc/p9221.h
@@ -19,7 +19,7 @@
/* ========== Variant-specific configuration ============ */
-#define P9221_R7_ADDR__7bf 0x61
+#define P9221_R7_ADDR_FLAGS 0x61
/*
* P9221 common registers
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
/**
diff --git a/test/battery_get_params_smart.c b/test/battery_get_params_smart.c
index 5ee62d3682..e2a3a81309 100644
--- a/test/battery_get_params_smart.c
+++ b/test/battery_get_params_smart.c
@@ -40,13 +40,13 @@ int sb_read(int cmd, int *param)
if (read_count >= fail_on_first && read_count <= fail_on_last)
return EC_ERROR_UNKNOWN;
- return i2c_read16__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ return i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
cmd, param);
}
int sb_write(int cmd, int param)
{
write_count++;
- return i2c_write16__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf,
+ return i2c_write16(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
cmd, param);
}
diff --git a/test/sbs_charging_v2.c b/test/sbs_charging_v2.c
index 7270173997..2e69beaf6e 100644
--- a/test/sbs_charging_v2.c
+++ b/test/sbs_charging_v2.c
@@ -180,7 +180,7 @@ static int test_charge_state(void)
/* Detach battery, charging error */
ccprintf("[CHARGING TEST] Detach battery\n");
- TEST_ASSERT(test_detach_i2c__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf) ==
+ TEST_ASSERT(test_detach_i2c(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS) ==
EC_SUCCESS);
msleep(BATTERY_DETACH_DELAY);
state = wait_charging_state();
@@ -188,7 +188,7 @@ static int test_charge_state(void)
/* Attach battery again, charging */
ccprintf("[CHARGING TEST] Attach battery\n");
- test_attach_i2c__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf);
+ test_attach_i2c(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS);
/* And changing full capacity should trigger a host event */
ev_clear(EC_HOST_EVENT_BATTERY);
sb_write(SB_FULL_CHARGE_CAPACITY, 0xeff0);