Remove __7b, __8b and __7bf

The extentions were added to make the compiler perform most
of the verification that the conversion was being done correctly
to remove 8bit addressing as the standard I2C/SPI address type.

Now that the compiler has verified the code, the extra
extentions are being removed

BUG=chromium:971296
BRANCH=none
TEST=make buildall -j
TEST=verify sensor functionality on arcada_ish

Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
This commit is contained in:
Denis Brockus 2019-07-16 15:10:11 -06:00 committed by Commit Bot
parent 053491b560
commit 473bd883b6
251 changed files with 1689 additions and 1714 deletions

View File

@ -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,
},
};

View File

@ -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__

View File

@ -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,

View File

@ -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
},
};

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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

View File

@ -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
},
};

View File

@ -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,
},
};

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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__

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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;
}

View File

@ -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,

View File

@ -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 */

View File

@ -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,
},

View File

@ -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,

View File

@ -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 */

View File

@ -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,

View File

@ -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__

View File

@ -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)
{

View File

@ -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

View File

@ -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) ||

View File

@ -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,

View File

@ -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) */

View File

@ -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,

View File

@ -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);
}

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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__

View File

@ -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

View File

@ -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[] = {

View File

@ -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,
},

View File

@ -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 */

View File

@ -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);

View File

@ -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

View File

@ -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,
},

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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)
{

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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) */

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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");
}

View File

@ -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__

View File

@ -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();

View File

@ -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__

View File

@ -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

View File

@ -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)

View File

@ -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,
},

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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,
},

View File

@ -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,

View File

@ -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);
}

View File

@ -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,

View File

@ -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__

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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);

View File

@ -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_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__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)
#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__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},
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,

View File

@ -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;

View File

@ -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;

View File

@ -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__

View File

@ -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,

View File

@ -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) */

View File

@ -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;

View File

@ -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();

View File

@ -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,

View File

@ -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);

View File

@ -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,

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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();

View File

@ -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;

View File

@ -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;

Some files were not shown because too many files have changed in this diff Show More