summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
Diffstat (limited to 'driver')
-rw-r--r--driver/accel_bma2x2.c2
-rw-r--r--driver/accel_bma4xx.c5
-rw-r--r--driver/accel_bma4xx.h7
-rw-r--r--driver/accel_kionix.c6
-rw-r--r--driver/accel_kionix.h2
-rw-r--r--driver/accel_lis2dh.c4
-rw-r--r--driver/accel_lis2dw12.c2
-rw-r--r--driver/accelgyro_bmi160.c6
-rw-r--r--driver/accelgyro_bmi260.c4
-rw-r--r--driver/accelgyro_bmi_common.c4
-rw-r--r--driver/accelgyro_icm42607.c2
-rw-r--r--driver/accelgyro_icm426xx.c2
-rw-r--r--driver/accelgyro_icm_common.c4
-rw-r--r--driver/accelgyro_icm_common.h6
-rw-r--r--driver/accelgyro_lsm6dsm.h4
-rw-r--r--driver/als_cm32183.c2
-rw-r--r--driver/als_tcs3400.c2
-rw-r--r--driver/amd_stt.c2
-rw-r--r--driver/battery/bq27621_g1.c2
-rw-r--r--driver/bc12/max14637.c2
-rw-r--r--driver/bc12/mt6360.c4
-rw-r--r--driver/bc12/pi3usb9201.c2
-rw-r--r--driver/charger/bd9995x.c13
-rw-r--r--driver/charger/bq24715.c6
-rw-r--r--driver/charger/bq24773.c2
-rw-r--r--driver/charger/bq25710.c6
-rw-r--r--driver/charger/isl923x.c8
-rw-r--r--driver/charger/isl9241.c8
-rw-r--r--driver/charger/rt946x.c4
-rw-r--r--driver/charger/rt9490.c10
-rw-r--r--driver/charger/rt9490.h7
-rw-r--r--driver/charger/sm5803.c4
-rw-r--r--driver/fingerprint/elan/elan_private.c16
-rw-r--r--driver/fingerprint/elan/elan_sensor_pal.c14
-rw-r--r--driver/fingerprint/fpc/bep/fpc_misc.c6
-rw-r--r--driver/fingerprint/fpc/bep/fpc_private.c7
-rw-r--r--driver/fingerprint/fpc/bep/fpc_private.h8
-rw-r--r--driver/fingerprint/fpc/bep/fpc_sensor_spi.c11
-rw-r--r--driver/fingerprint/fpc/bep/fpc_sensor_spi.h3
-rw-r--r--driver/fingerprint/fpc/bep/fpc_timebase.c4
-rw-r--r--driver/fingerprint/fpc/bep/fpc_timebase.h4
-rw-r--r--driver/fingerprint/fpc/fpc_sensor.c3
-rw-r--r--driver/fingerprint/fpc/libfp/fpc_bio_algorithm.h3
-rw-r--r--driver/fingerprint/fpc/libfp/fpc_private.c7
-rw-r--r--driver/fingerprint/fpc/libfp/fpc_private.h8
-rw-r--r--driver/fingerprint/fpc/libfp/fpc_sensor_pal.c2
-rw-r--r--driver/gl3590.c5
-rw-r--r--driver/ina2xx.c2
-rw-r--r--driver/ina3221.c2
-rw-r--r--driver/ioexpander/it8801.c8
-rw-r--r--driver/ioexpander/pcal6408.c2
-rw-r--r--driver/led/aw20198.c4
-rw-r--r--driver/led/is31fl3733b.c3
-rw-r--r--driver/led/is31fl3743b.c4
-rw-r--r--driver/led/lm3509.c11
-rw-r--r--driver/led/mp3385.h2
-rw-r--r--driver/led/oz554.h2
-rw-r--r--driver/led/tlc59116f.c4
-rw-r--r--driver/ln9310.c2
-rw-r--r--driver/mag_lis2mdl.c2
-rw-r--r--driver/mcdp28x0.c2
-rw-r--r--driver/nfc/ctn730.c8
-rw-r--r--driver/nfc/ctn730.h1
-rw-r--r--driver/nvidia_gpu.c4
-rw-r--r--driver/ppc/ktu1125.c4
-rw-r--r--driver/ppc/ktu1125.h1
-rw-r--r--driver/ppc/nx20p348x.c4
-rw-r--r--driver/ppc/sn5s330.c4
-rw-r--r--driver/ppc/sn5s330.h1
-rw-r--r--driver/ppc/syv682x.c4
-rw-r--r--driver/retimer/anx7483.c30
-rw-r--r--driver/retimer/anx7483.h3
-rw-r--r--driver/retimer/bb_retimer.c26
-rw-r--r--driver/retimer/nb7v904m.c3
-rw-r--r--driver/retimer/pi3dpx1207.c2
-rw-r--r--driver/sb_rmi.c2
-rw-r--r--driver/stm_mems_common.h4
-rw-r--r--driver/tcpm/anx7447.c2
-rw-r--r--driver/tcpm/anx7447.h2
-rw-r--r--driver/tcpm/anx74xx.c2
-rw-r--r--driver/tcpm/fusb302.c2
-rw-r--r--driver/tcpm/it83xx.c4
-rw-r--r--driver/tcpm/it83xx_pd.h4
-rw-r--r--driver/tcpm/it8xxx2.c4
-rw-r--r--driver/tcpm/nct38xx.c3
-rw-r--r--driver/tcpm/ps8xxx.h3
-rw-r--r--driver/tcpm/rt1718s.h2
-rw-r--r--driver/tcpm/stm32gx.c4
-rw-r--r--driver/tcpm/tcpci.c7
-rw-r--r--driver/tcpm/tusb422.c2
-rw-r--r--driver/temp_sensor/adt7481.c4
-rw-r--r--driver/temp_sensor/amd_r19me4070.c2
-rw-r--r--driver/temp_sensor/f75303.c4
-rw-r--r--driver/temp_sensor/g753.c2
-rw-r--r--driver/temp_sensor/g78x.c2
-rw-r--r--driver/temp_sensor/oti502.c4
-rw-r--r--driver/temp_sensor/pct2075.c15
-rw-r--r--driver/temp_sensor/tmp112.c15
-rw-r--r--driver/temp_sensor/tmp411.c4
-rw-r--r--driver/temp_sensor/tmp432.c4
-rw-r--r--driver/temp_sensor/tmp468.c7
-rw-r--r--driver/touchpad_elan.c6
-rw-r--r--driver/touchpad_gt7288.c4
-rw-r--r--driver/touchpad_st.c4
-rw-r--r--driver/touchpad_st.h4
-rw-r--r--driver/usb_mux/pi3usb3x532.h2
-rw-r--r--driver/usb_mux/tusb1064.h3
-rw-r--r--driver/usb_mux/usb_mux.c2
-rw-r--r--driver/wpc/p9221.h2
109 files changed, 223 insertions, 304 deletions
diff --git a/driver/accel_bma2x2.c b/driver/accel_bma2x2.c
index 772ae64696..08e818cb8d 100644
--- a/driver/accel_bma2x2.c
+++ b/driver/accel_bma2x2.c
@@ -9,11 +9,11 @@
* Supported: BMA255
*/
-#include "accel_bma2x2.h"
#include "accelgyro.h"
#include "builtin/assert.h"
#include "common.h"
#include "console.h"
+#include "accel_bma2x2.h"
#include "i2c.h"
#include "math_util.h"
#include "spi.h"
diff --git a/driver/accel_bma4xx.c b/driver/accel_bma4xx.c
index 29d05a35d8..b731bca422 100644
--- a/driver/accel_bma4xx.c
+++ b/driver/accel_bma4xx.c
@@ -9,18 +9,17 @@
* Supported: BMA422
*/
-#include "accel_bma422.h"
#include "accelgyro.h"
+#include "accel_bma422.h"
#include "builtin/assert.h"
#include "common.h"
#include "console.h"
-#include "hwtimer.h"
#include "i2c.h"
+#include "hwtimer.h"
#include "math_util.h"
#include "spi.h"
#include "task.h"
#include "util.h"
-
#include <motion_sense_fifo.h>
#ifdef CONFIG_ACCEL_BMA4XX_INT_EVENT
diff --git a/driver/accel_bma4xx.h b/driver/accel_bma4xx.h
index 778150e30a..afa0776a38 100644
--- a/driver/accel_bma4xx.h
+++ b/driver/accel_bma4xx.h
@@ -8,8 +8,6 @@
#ifndef __CROS_EC_ACCEL_BMA4XX_H
#define __CROS_EC_ACCEL_BMA4XX_H
-#include "config.h"
-
#define BMA4_I2C_ADDR_PRIMARY 0x18
#define BMA4_I2C_ADDR_SECONDARY 0x19
#define BMA4_I2C_BMM150_ADDR 0x10
@@ -196,8 +194,6 @@
extern const struct accelgyro_drv bma4_accel_drv;
#if defined(CONFIG_ZEPHYR)
-#include <zephyr/devicetree.h>
-
#if DT_NODE_EXISTS(DT_ALIAS(bma4xx_int))
/*
* Get the motion sensor ID of the BMA4xx sensor that generates the interrupt.
@@ -213,9 +209,6 @@ extern const struct accelgyro_drv bma4_accel_drv;
*/
#define CONFIG_ACCEL_BMA4XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(SENSOR_ID(DT_ALIAS(bma4xx_int)))
-
-#include "gpio_signal.h"
-void bma4xx_interrupt(enum gpio_signal signal);
#endif /* DT_NODE_EXISTS */
#endif /* CONFIG_ZEPHYR */
diff --git a/driver/accel_kionix.c b/driver/accel_kionix.c
index c04855c89d..cc12987f40 100644
--- a/driver/accel_kionix.c
+++ b/driver/accel_kionix.c
@@ -9,12 +9,12 @@
* Supported: KX022, KXCJ9
*/
-#include "accel_kionix.h"
-#include "accel_kx022.h"
-#include "accel_kxcj9.h"
#include "accelgyro.h"
#include "common.h"
#include "console.h"
+#include "accel_kionix.h"
+#include "accel_kx022.h"
+#include "accel_kxcj9.h"
#include "i2c.h"
#include "math_util.h"
#include "motion_orientation.h"
diff --git a/driver/accel_kionix.h b/driver/accel_kionix.h
index 4f5d02ee55..8777396e01 100644
--- a/driver/accel_kionix.h
+++ b/driver/accel_kionix.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_ACCEL_KIONIX_H
#define __CROS_EC_ACCEL_KIONIX_H
-#include "accelgyro.h"
#include "common.h"
+#include "accelgyro.h"
#include "driver/accel_kx022.h"
#include "driver/accel_kxcj9.h"
diff --git a/driver/accel_lis2dh.c b/driver/accel_lis2dh.c
index 26954f3c4b..eaedb216d7 100644
--- a/driver/accel_lis2dh.c
+++ b/driver/accel_lis2dh.c
@@ -11,14 +11,14 @@
#include "accelgyro.h"
#include "common.h"
#include "console.h"
-#include "driver/accel_lis2dh.h"
-#include "driver/stm_mems_common.h"
#include "hooks.h"
#include "hwtimer.h"
#include "i2c.h"
#include "math_util.h"
#include "task.h"
#include "util.h"
+#include "driver/accel_lis2dh.h"
+#include "driver/stm_mems_common.h"
#define CPUTS(outstr) cputs(CC_ACCEL, outstr)
#define CPRINTS(format, args...) cprints(CC_ACCEL, format, ##args)
diff --git a/driver/accel_lis2dw12.c b/driver/accel_lis2dw12.c
index 42d9381bda..3cf3e4b64a 100644
--- a/driver/accel_lis2dw12.c
+++ b/driver/accel_lis2dw12.c
@@ -7,10 +7,10 @@
* LIS2DW12 accelerometer module for Chrome EC 3D digital accelerometer.
* For more details on LIS2DW12 device please refers to www.st.com.
*/
-#include "accel_lis2dw12.h"
#include "accelgyro.h"
#include "common.h"
#include "console.h"
+#include "accel_lis2dw12.h"
#include "hooks.h"
#include "hwtimer.h"
#include "math_util.h"
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index 7a398e5f4b..0a736760d0 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -9,14 +9,14 @@
*/
#include "accelgyro.h"
-#include "accelgyro_bmi160.h"
-#include "accelgyro_bmi_common.h"
#include "builtin/assert.h"
#include "common.h"
#include "console.h"
+#include "accelgyro_bmi_common.h"
+#include "accelgyro_bmi160.h"
+#include "mag_bmm150.h"
#include "hwtimer.h"
#include "i2c.h"
-#include "mag_bmm150.h"
#include "math_util.h"
#include "motion_orientation.h"
#include "motion_sense_fifo.h"
diff --git a/driver/accelgyro_bmi260.c b/driver/accelgyro_bmi260.c
index 1b47983b80..f0b16be4d5 100644
--- a/driver/accelgyro_bmi260.c
+++ b/driver/accelgyro_bmi260.c
@@ -9,10 +9,10 @@
*/
#include "accelgyro.h"
-#include "accelgyro_bmi260.h"
-#include "accelgyro_bmi_common.h"
#include "builtin/assert.h"
#include "console.h"
+#include "accelgyro_bmi_common.h"
+#include "accelgyro_bmi260.h"
#include "hwtimer.h"
#include "i2c.h"
#include "init_rom.h"
diff --git a/driver/accelgyro_bmi_common.c b/driver/accelgyro_bmi_common.c
index 27aab34c3e..73131b0aae 100644
--- a/driver/accelgyro_bmi_common.c
+++ b/driver/accelgyro_bmi_common.c
@@ -9,11 +9,11 @@
*/
#include "accelgyro.h"
-#include "accelgyro_bmi_common.h"
#include "console.h"
-#include "i2c.h"
+#include "accelgyro_bmi_common.h"
#include "mag_bmm150.h"
#include "mag_lis2mdl.h"
+#include "i2c.h"
#include "math_util.h"
#include "motion_sense_fifo.h"
#include "spi.h"
diff --git a/driver/accelgyro_icm42607.c b/driver/accelgyro_icm42607.c
index f57f11fae2..28a131d33f 100644
--- a/driver/accelgyro_icm42607.c
+++ b/driver/accelgyro_icm42607.c
@@ -10,8 +10,8 @@
#include "accelgyro.h"
#include "console.h"
-#include "driver/accelgyro_icm42607.h"
#include "driver/accelgyro_icm_common.h"
+#include "driver/accelgyro_icm42607.h"
#include "hwtimer.h"
#include "i2c.h"
#include "math_util.h"
diff --git a/driver/accelgyro_icm426xx.c b/driver/accelgyro_icm426xx.c
index c3c9e2225f..0311ed8187 100644
--- a/driver/accelgyro_icm426xx.c
+++ b/driver/accelgyro_icm426xx.c
@@ -10,8 +10,8 @@
#include "accelgyro.h"
#include "console.h"
-#include "driver/accelgyro_icm426xx.h"
#include "driver/accelgyro_icm_common.h"
+#include "driver/accelgyro_icm426xx.h"
#include "hwtimer.h"
#include "i2c.h"
#include "math_util.h"
diff --git a/driver/accelgyro_icm_common.c b/driver/accelgyro_icm_common.c
index 44a3b61370..22a2b0820d 100644
--- a/driver/accelgyro_icm_common.c
+++ b/driver/accelgyro_icm_common.c
@@ -10,10 +10,10 @@
#include "accelgyro.h"
#include "console.h"
-#include "driver/accelgyro_icm426xx.h"
-#include "driver/accelgyro_icm_common.h"
#include "i2c.h"
#include "spi.h"
+#include "driver/accelgyro_icm_common.h"
+#include "driver/accelgyro_icm426xx.h"
#define CPUTS(outstr) cputs(CC_ACCEL, outstr)
#define CPRINTF(format, args...) cprintf(CC_ACCEL, format, ##args)
diff --git a/driver/accelgyro_icm_common.h b/driver/accelgyro_icm_common.h
index 32adf6f5ff..400c56ba6f 100644
--- a/driver/accelgyro_icm_common.h
+++ b/driver/accelgyro_icm_common.h
@@ -8,12 +8,12 @@
#ifndef __CROS_EC_ACCELGYRO_ICM_COMMON_H
#define __CROS_EC_ACCELGYRO_ICM_COMMON_H
+#include <sys/types.h>
+
#include "accelgyro.h"
-#include "builtin/stddef.h"
#include "hwtimer.h"
#include "timer.h"
-
-#include <sys/types.h>
+#include "builtin/stddef.h"
#if !defined(CONFIG_ACCELGYRO_ICM_COMM_SPI) && \
!defined(CONFIG_ACCELGYRO_ICM_COMM_I2C)
diff --git a/driver/accelgyro_lsm6dsm.h b/driver/accelgyro_lsm6dsm.h
index 8fa53c6a6d..51da2a42fb 100644
--- a/driver/accelgyro_lsm6dsm.h
+++ b/driver/accelgyro_lsm6dsm.h
@@ -8,10 +8,10 @@
#ifndef __CROS_EC_ACCELGYRO_LSM6DSM_H
#define __CROS_EC_ACCELGYRO_LSM6DSM_H
-#include "mag_bmm150.h"
+#include "stm_mems_common.h"
#include "mag_cal.h"
+#include "mag_bmm150.h"
#include "mag_lis2mdl.h"
-#include "stm_mems_common.h"
/*
* 7-bit address is 110101xb. Where 'x' is determined
diff --git a/driver/als_cm32183.c b/driver/als_cm32183.c
index a2ee9f365e..d97c179fe8 100644
--- a/driver/als_cm32183.c
+++ b/driver/als_cm32183.c
@@ -5,10 +5,10 @@
* CAPELLA CM32183 light sensor driver
*/
-#include "accelgyro.h"
#include "common.h"
#include "driver/als_cm32183.h"
#include "i2c.h"
+#include "accelgyro.h"
#include "math_util.h"
struct cm32183_drv_data {
diff --git a/driver/als_tcs3400.c b/driver/als_tcs3400.c
index 8874ce79d6..002e269ada 100644
--- a/driver/als_tcs3400.c
+++ b/driver/als_tcs3400.c
@@ -5,9 +5,9 @@
* AMS TCS3400 light sensor driver
*/
#include "accelgyro.h"
-#include "als_tcs3400.h"
#include "common.h"
#include "console.h"
+#include "als_tcs3400.h"
#include "hooks.h"
#include "hwtimer.h"
#include "i2c.h"
diff --git a/driver/amd_stt.c b/driver/amd_stt.c
index a80220033c..93da8cecb5 100644
--- a/driver/amd_stt.c
+++ b/driver/amd_stt.c
@@ -4,8 +4,8 @@
*/
#include "amd_stt.h"
-#include "chipset.h"
#include "common.h"
+#include "chipset.h"
#include "console.h"
#include "driver/sb_rmi.h"
#include "hooks.h"
diff --git a/driver/battery/bq27621_g1.c b/driver/battery/bq27621_g1.c
index 73ca8476b3..f29039f0c1 100644
--- a/driver/battery/bq27621_g1.c
+++ b/driver/battery/bq27621_g1.c
@@ -11,8 +11,8 @@
#include "extpower.h"
#include "hooks.h"
#include "i2c.h"
-#include "timer.h"
#include "util.h"
+#include "timer.h"
#define BQ27621_ADDR_FLAGS 0x55
#define BQ27621_TYPE_ID 0x0621
diff --git a/driver/bc12/max14637.c b/driver/bc12/max14637.c
index a2603c7973..09fa009c45 100644
--- a/driver/bc12/max14637.c
+++ b/driver/bc12/max14637.c
@@ -13,13 +13,13 @@
*/
#include "builtin/assert.h"
+#include "max14637.h"
#include "charge_manager.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
-#include "max14637.h"
#include "power.h"
#include "power/cannonlake.h"
#include "task.h"
diff --git a/driver/bc12/mt6360.c b/driver/bc12/mt6360.c
index ca4bf11794..49ec031e09 100644
--- a/driver/bc12/mt6360.c
+++ b/driver/bc12/mt6360.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "charge_manager.h"
#include "charger.h"
+#include "charge_manager.h"
#include "console.h"
#include "crc8.h"
+#include "mt6360.h"
#include "ec_commands.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
-#include "mt6360.h"
#include "task.h"
#include "timer.h"
#include "usb_charge.h"
diff --git a/driver/bc12/pi3usb9201.c b/driver/bc12/pi3usb9201.c
index 4e39933657..e892c34e8c 100644
--- a/driver/bc12/pi3usb9201.c
+++ b/driver/bc12/pi3usb9201.c
@@ -5,12 +5,12 @@
/* PI3USB9201 USB BC 1.2 Charger Detector driver. */
+#include "pi3usb9201.h"
#include "charge_manager.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
#include "gpio.h"
-#include "pi3usb9201.h"
#include "power.h"
#include "task.h"
#include "timer.h"
diff --git a/driver/charger/bd9995x.c b/driver/charger/bd9995x.c
index f8e426fdc3..aa37bf4e8a 100644
--- a/driver/charger/bd9995x.c
+++ b/driver/charger/bd9995x.c
@@ -18,9 +18,9 @@
#include "panic.h"
#include "task.h"
#include "time.h"
+#include "util.h"
#include "usb_charge.h"
#include "usb_pd.h"
-#include "util.h"
#define OTPROM_LOAD_WAIT_RETRY 3
@@ -904,8 +904,7 @@ static void bd9995x_battery_charging_profile_settings(int chgnum)
const struct battery_info *bi = battery_get_info();
/* Input Current Limit Setting */
- bd9995x_set_input_current_limit(chgnum,
- CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT);
+ bd9995x_set_input_current_limit(chgnum, CONFIG_CHARGER_INPUT_CURRENT);
/* Charge Termination Current Setting */
ch_raw_write16(chgnum, BD9995X_CMD_ITERM_SET, 0,
@@ -1005,10 +1004,10 @@ static void bd9995x_init(void)
* Disable the input current limit when VBAT is < VSYSREG_SET. This
* needs to be done before calling
* bd9995x_battery_charging_profile_settings() as in that function the
- * input current limit is set to CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT
- * which is 512 mA. In deeply discharged battery cases, setting the
- * input current limit this low can cause VSYS to collapse, which in
- * turn can cause the EC's brownout detector to reset the EC.
+ * input current limit is set to CONFIG_CHARGER_INPUT_CURRENT which is
+ * 512 mA. In deeply discharged battery cases, setting the input current
+ * limit this low can cause VSYS to collapse, which in turn can cause
+ * the EC's brownout detector to reset the EC.
*/
if (ch_raw_read16(CHARGER_SOLO, BD9995X_CMD_VIN_CTRL_SET, &reg,
BD9995X_EXTENDED_COMMAND))
diff --git a/driver/charger/bq24715.c b/driver/charger/bq24715.c
index 6855d6e334..8e8e0efd50 100644
--- a/driver/charger/bq24715.c
+++ b/driver/charger/bq24715.c
@@ -8,8 +8,8 @@
#include "battery_smart.h"
#include "bq24715.h"
#include "charger.h"
-#include "common.h"
#include "console.h"
+#include "common.h"
#include "i2c.h"
#include "util.h"
@@ -207,8 +207,8 @@ static enum ec_error_list bq24715_post_init(int chgnum)
if (rv)
return rv;
- rv = bq24715_set_input_current_limit(
- chgnum, CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT);
+ rv = bq24715_set_input_current_limit(chgnum,
+ CONFIG_CHARGER_INPUT_CURRENT);
return rv;
}
diff --git a/driver/charger/bq24773.c b/driver/charger/bq24773.c
index d678944ceb..bfa0aa36e7 100644
--- a/driver/charger/bq24773.c
+++ b/driver/charger/bq24773.c
@@ -8,8 +8,8 @@
#include "battery_smart.h"
#include "bq24773.h"
#include "charger.h"
-#include "common.h"
#include "console.h"
+#include "common.h"
#include "util.h"
/*
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c
index 222d2f58a4..831f7e110d 100644
--- a/driver/charger/bq25710.c
+++ b/driver/charger/bq25710.c
@@ -5,6 +5,8 @@
* TI bq25710 battery charger driver.
*/
+#include <stdbool.h>
+
#include "battery.h"
#include "battery_smart.h"
#include "bq257x0_regs.h"
@@ -15,13 +17,11 @@
#include "console.h"
#include "hooks.h"
#include "i2c.h"
-#include "system.h"
#include "task.h"
+#include "system.h"
#include "timer.h"
#include "util.h"
-#include <stdbool.h>
-
#if !defined(CONFIG_CHARGER_BQ25710) && !defined(CONFIG_CHARGER_BQ25720)
#error Only the BQ25720 and BQ25710 are supported by bq25710 driver.
#endif
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c
index dac1df69a2..2263c45b78 100644
--- a/driver/charger/isl923x.c
+++ b/driver/charger/isl923x.c
@@ -11,9 +11,9 @@
#include "builtin/assert.h"
#include "charge_state_v2.h"
#include "charger.h"
-#include "common.h"
#include "compile_time_macros.h"
#include "console.h"
+#include "common.h"
#include "hooks.h"
#include "i2c.h"
#include "isl923x.h"
@@ -772,7 +772,7 @@ static void isl923x_init(int chgnum)
* Initialize the input current limit to the board's default.
*/
if (isl923x_set_input_current_limit(
- chgnum, CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT))
+ chgnum, CONFIG_CHARGER_INPUT_CURRENT))
goto init_fail;
}
@@ -865,7 +865,7 @@ enum ec_error_list raa489000_is_acok(int chgnum, bool *acok)
{
int regval, rv;
- if ((chgnum < 0) || (chgnum >= board_get_charger_chip_count())) {
+ if ((chgnum < 0) || (chgnum > board_get_charger_chip_count())) {
CPRINTS("%s: Invalid chgnum! (%d)", __func__, chgnum);
return EC_ERROR_INVAL;
}
@@ -890,7 +890,7 @@ void raa489000_hibernate(int chgnum, bool disable_adc)
{
int rv, regval;
- if ((chgnum < 0) || (chgnum >= board_get_charger_chip_count())) {
+ if ((chgnum < 0) || (chgnum > board_get_charger_chip_count())) {
CPRINTS("%s: Invalid chgnum! (%d)", __func__, chgnum);
return;
}
diff --git a/driver/charger/isl9241.c b/driver/charger/isl9241.c
index 445d94734c..9ca2e9f3e0 100644
--- a/driver/charger/isl9241.c
+++ b/driver/charger/isl9241.c
@@ -11,11 +11,11 @@
#endif
#include "battery.h"
#include "battery_smart.h"
+#include "charger.h"
#include "charge_manager.h"
#include "charge_state.h"
-#include "charger.h"
-#include "common.h"
#include "console.h"
+#include "common.h"
#include "hooks.h"
#include "i2c.h"
#include "isl9241.h"
@@ -893,8 +893,8 @@ static void isl9241_init(int chgnum)
return;
/* Initialize the input current limit to the board's default. */
- if (isl9241_set_input_current_limit(
- chgnum, CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT))
+ if (isl9241_set_input_current_limit(chgnum,
+ CONFIG_CHARGER_INPUT_CURRENT))
goto init_fail;
return;
diff --git a/driver/charger/rt946x.c b/driver/charger/rt946x.c
index 0e52d8e3bb..58b5c1adb4 100644
--- a/driver/charger/rt946x.c
+++ b/driver/charger/rt946x.c
@@ -7,17 +7,17 @@
#include "battery.h"
#include "battery_smart.h"
-#include "charge_manager.h"
#include "charger.h"
+#include "charge_manager.h"
#include "common.h"
#include "compile_time_macros.h"
#include "config.h"
#include "console.h"
-#include "driver/wpc/p9221.h"
#include "extpower.h"
#include "hooks.h"
#include "i2c.h"
#include "printf.h"
+#include "driver/wpc/p9221.h"
#include "rt946x.h"
#include "task.h"
#include "tcpm/tcpm.h"
diff --git a/driver/charger/rt9490.c b/driver/charger/rt9490.c
index 016ef12d44..8bf418a065 100644
--- a/driver/charger/rt9490.c
+++ b/driver/charger/rt9490.c
@@ -9,8 +9,8 @@
#include "battery_smart.h"
#include "builtin/assert.h"
#include "builtin/endian.h"
-#include "charge_manager.h"
#include "charger.h"
+#include "charge_manager.h"
#include "common.h"
#include "config.h"
#include "console.h"
@@ -18,11 +18,11 @@
#include "i2c.h"
#include "rt9490.h"
#include "task.h"
-#include "temp_sensor/temp_sensor.h"
-#include "temp_sensor/thermistor.h"
#include "usb_charge.h"
#include "usb_pd.h"
#include "util.h"
+#include "temp_sensor/temp_sensor.h"
+#include "temp_sensor/thermistor.h"
/* Console output macros */
#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
@@ -359,10 +359,6 @@ static int rt9490_init_setting(int chgnum)
RT9490_EN_FON_PP_BAT_TRACK);
RETURN_ERROR(rt9490_enable_hidden_mode(chgnum, false));
- /* Disable non-standard TA detection */
- RETURN_ERROR(rt9490_clr_bit(chgnum, RT9490_REG_ADD_CTRL2,
- RT9490_SPEC_TA_EN));
-
return EC_SUCCESS;
}
diff --git a/driver/charger/rt9490.h b/driver/charger/rt9490.h
index 88f979ae5e..ea1d6cfcfb 100644
--- a/driver/charger/rt9490.h
+++ b/driver/charger/rt9490.h
@@ -4,10 +4,10 @@
*
* Richtek 5A 1-4 cell buck-boost switching battery charger driver.
*/
-#include "temp_sensor.h"
-
#include <stdbool.h>
+#include "temp_sensor.h"
+
#ifndef __CROS_EC_RT9490_H
#define __CROS_EC_RT9490_H
@@ -248,9 +248,6 @@ struct rt9490_init_setting {
/* ADD CTRL1 */
#define RT9490_PWM_1MHZ_EN BIT(4)
-/* ADD CTRL2 */
-#define RT9490_SPEC_TA_EN BIT(2)
-
/* HD_ADD_CTRL 2 */
#define RT9490_EN_FON_PP_BAT_TRACK BIT(5)
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c
index 57b1a0330f..f6d4e60eec 100644
--- a/driver/charger/sm5803.c
+++ b/driver/charger/sm5803.c
@@ -14,8 +14,8 @@
#include "hooks.h"
#include "i2c.h"
#include "sm5803.h"
-#include "stdbool.h"
#include "system.h"
+#include "stdbool.h"
#include "throttle_ap.h"
#include "timer.h"
#include "usb_charge.h"
@@ -712,7 +712,7 @@ static void sm5803_init(int chgnum)
rv |= chg_write8(chgnum, SM5803_REG_DPM_VL_SET_LSB, (reg & 0x7));
/* Set default input current */
- reg = SM5803_CURRENT_TO_REG(CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT) &
+ reg = SM5803_CURRENT_TO_REG(CONFIG_CHARGER_INPUT_CURRENT) &
SM5803_CHG_ILIM_RAW;
rv |= chg_write8(chgnum, SM5803_REG_CHG_ILIM, reg);
diff --git a/driver/fingerprint/elan/elan_private.c b/driver/fingerprint/elan/elan_private.c
index a176f29f0d..fc95ceb685 100644
--- a/driver/fingerprint/elan/elan_private.c
+++ b/driver/fingerprint/elan/elan_private.c
@@ -3,24 +3,24 @@
* found in the LICENSE file.
*/
+#include <stddef.h>
#include "common.h"
#include "console.h"
-#include "cryptoc/util.h"
-#include "elan_sensor.h"
-#include "elan_sensor_pal.h"
-#include "elan_setting.h"
#include "endian.h"
-#include "fpsensor.h"
#include "gpio.h"
#include "link_defs.h"
-#include "math_util.h"
-#include "shared_mem.h"
#include "spi.h"
#include "system.h"
#include "timer.h"
#include "util.h"
+#include "shared_mem.h"
+#include "math_util.h"
+#include "fpsensor.h"
+#include "cryptoc/util.h"
-#include <stddef.h>
+#include "elan_sensor.h"
+#include "elan_setting.h"
+#include "elan_sensor_pal.h"
static uint16_t errors;
diff --git a/driver/fingerprint/elan/elan_sensor_pal.c b/driver/fingerprint/elan/elan_sensor_pal.c
index 2a91fe176e..4056c52f38 100644
--- a/driver/fingerprint/elan/elan_sensor_pal.c
+++ b/driver/fingerprint/elan/elan_sensor_pal.c
@@ -4,24 +4,24 @@
*/
/* ELAN Platform Abstraction Layer callbacks */
+#include <stddef.h>
#include "common.h"
#include "console.h"
-#include "cryptoc/util.h"
-#include "elan_sensor.h"
-#include "elan_sensor_pal.h"
-#include "elan_setting.h"
#include "endian.h"
#include "fpsensor.h"
#include "gpio.h"
#include "link_defs.h"
-#include "math_util.h"
-#include "shared_mem.h"
#include "spi.h"
#include "system.h"
#include "timer.h"
#include "util.h"
+#include "shared_mem.h"
+#include "math_util.h"
+#include "cryptoc/util.h"
-#include <stddef.h>
+#include "elan_setting.h"
+#include "elan_sensor.h"
+#include "elan_sensor_pal.h"
static uint8_t tx_buf[CONFIG_SPI_TX_BUF_SIZE] __uncached;
static uint8_t rx_buf[CONFIG_SPI_RX_BUF_SIZE] __uncached;
diff --git a/driver/fingerprint/fpc/bep/fpc_misc.c b/driver/fingerprint/fpc/bep/fpc_misc.c
index 6b716e0524..f78a429233 100644
--- a/driver/fingerprint/fpc/bep/fpc_misc.c
+++ b/driver/fingerprint/fpc/bep/fpc_misc.c
@@ -5,12 +5,12 @@
/* FPC Platform Abstraction Layer */
+#include <stdint.h>
+#include <stddef.h>
+
#include "shared_mem.h"
#include "uart.h"
-#include <stddef.h>
-#include <stdint.h>
-
void __unused *fpc_malloc(uint32_t size)
{
char *data;
diff --git a/driver/fingerprint/fpc/bep/fpc_private.c b/driver/fingerprint/fpc/bep/fpc_private.c
index 70aa8fe8c5..ac20e10758 100644
--- a/driver/fingerprint/fpc/bep/fpc_private.c
+++ b/driver/fingerprint/fpc/bep/fpc_private.c
@@ -3,7 +3,9 @@
* found in the LICENSE file.
*/
-#include "driver/fingerprint/fpc/fpc_sensor.h"
+#include <stdint.h>
+#include <stddef.h>
+
#include "fpc_bio_algorithm.h"
#include "fpsensor.h"
#include "gpio.h"
@@ -11,8 +13,7 @@
#include "system.h"
#include "util.h"
-#include <stddef.h>
-#include <stdint.h>
+#include "driver/fingerprint/fpc/fpc_sensor.h"
/* Console output macros */
#define CPRINTF(format, args...) cprintf(CC_FP, format, ##args)
diff --git a/driver/fingerprint/fpc/bep/fpc_private.h b/driver/fingerprint/fpc/bep/fpc_private.h
index df8b8eeea6..ca5b98fa8e 100644
--- a/driver/fingerprint/fpc/bep/fpc_private.h
+++ b/driver/fingerprint/fpc/bep/fpc_private.h
@@ -8,10 +8,6 @@
#ifndef __CROS_EC_FPC_PRIVATE_H
#define __CROS_EC_FPC_PRIVATE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <stdint.h>
typedef struct {
@@ -50,8 +46,4 @@ int fp_sensor_maintenance(uint8_t *image_data,
*/
int fpc_get_hwid(uint16_t *id);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* __CROS_EC_FPC_PRIVATE_H */
diff --git a/driver/fingerprint/fpc/bep/fpc_sensor_spi.c b/driver/fingerprint/fpc/bep/fpc_sensor_spi.c
index 565b29c69d..752b9909bc 100644
--- a/driver/fingerprint/fpc/bep/fpc_sensor_spi.c
+++ b/driver/fingerprint/fpc/bep/fpc_sensor_spi.c
@@ -5,17 +5,18 @@
/* FPC Platform Abstraction Layer */
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+
#include "console.h"
-#include "driver/fingerprint/fpc/fpc_sensor.h"
-#include "fpc_sensor_spi.h"
#include "fpsensor.h"
+#include "fpc_sensor_spi.h"
#include "gpio.h"
#include "spi.h"
#include "util.h"
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
+#include "driver/fingerprint/fpc/fpc_sensor.h"
/* Console output macros */
#define CPRINTF(format, args...) cprintf(CC_FP, format, ##args)
diff --git a/driver/fingerprint/fpc/bep/fpc_sensor_spi.h b/driver/fingerprint/fpc/bep/fpc_sensor_spi.h
index 015bc03dae..ad7e5411d8 100644
--- a/driver/fingerprint/fpc/bep/fpc_sensor_spi.h
+++ b/driver/fingerprint/fpc/bep/fpc_sensor_spi.h
@@ -14,9 +14,8 @@
* fingerprint sensor.
*/
-#include <stdbool.h>
-#include <stddef.h>
#include <stdint.h>
+#include <stdbool.h>
typedef bool (*fpc_wfi_check_t)(void);
diff --git a/driver/fingerprint/fpc/bep/fpc_timebase.c b/driver/fingerprint/fpc/bep/fpc_timebase.c
index c34b9e27db..a63a4c3d6d 100644
--- a/driver/fingerprint/fpc/bep/fpc_timebase.c
+++ b/driver/fingerprint/fpc/bep/fpc_timebase.c
@@ -5,11 +5,11 @@
/* FPC Platform Abstraction Layer */
+#include <stdint.h>
+
#include "fpc_timebase.h"
#include "timer.h"
-#include <stdint.h>
-
uint32_t __unused fpc_timebase_get_tick(void)
{
clock_t time;
diff --git a/driver/fingerprint/fpc/bep/fpc_timebase.h b/driver/fingerprint/fpc/bep/fpc_timebase.h
index 35cf67fed2..ce9018461b 100644
--- a/driver/fingerprint/fpc/bep/fpc_timebase.h
+++ b/driver/fingerprint/fpc/bep/fpc_timebase.h
@@ -13,10 +13,10 @@
* Supplies tick counter and wait operation(s).
*/
-#include "common.h"
-
#include <stdint.h>
+#include "common.h"
+
/**
* @brief Reads the system tick counter.
*
diff --git a/driver/fingerprint/fpc/fpc_sensor.c b/driver/fingerprint/fpc/fpc_sensor.c
index 9cb97a9125..bbab729b12 100644
--- a/driver/fingerprint/fpc/fpc_sensor.c
+++ b/driver/fingerprint/fpc/fpc_sensor.c
@@ -4,10 +4,9 @@
*/
#include <stddef.h>
-
-#include <common/fpsensor/fpsensor_private.h>
#include <include/fpsensor.h>
#include <include/fpsensor_state.h>
+#include <common/fpsensor/fpsensor_private.h>
#if defined(CONFIG_FP_SENSOR_FPC1025) || defined(CONFIG_FP_SENSOR_FPC1035)
#include "bep/fpc_private.h"
#elif defined(CONFIG_FP_SENSOR_FPC1145)
diff --git a/driver/fingerprint/fpc/libfp/fpc_bio_algorithm.h b/driver/fingerprint/fpc/libfp/fpc_bio_algorithm.h
index 834f7394e4..7dda6d46de 100644
--- a/driver/fingerprint/fpc/libfp/fpc_bio_algorithm.h
+++ b/driver/fingerprint/fpc/libfp/fpc_bio_algorithm.h
@@ -5,11 +5,8 @@
#ifndef BIOD_BIO_ALGORITHM_H_
#define BIOD_BIO_ALGORITHM_H_
-#include <stddef.h>
#include <stdint.h>
-#include <sys/types.h>
-
enum bio_algorithm_type {
BIO_ALGORITHM_FINGERPRINT,
BIO_ALGORITHM_IRIS,
diff --git a/driver/fingerprint/fpc/libfp/fpc_private.c b/driver/fingerprint/fpc/libfp/fpc_private.c
index 8b1ceff405..fcc0180784 100644
--- a/driver/fingerprint/fpc/libfp/fpc_private.c
+++ b/driver/fingerprint/fpc/libfp/fpc_private.c
@@ -3,9 +3,10 @@
* found in the LICENSE file.
*/
+#include <stddef.h>
+#include <sys/types.h>
#include "common.h"
#include "console.h"
-#include "driver/fingerprint/fpc/fpc_sensor.h"
#include "fpc_bio_algorithm.h"
#include "fpc_private.h"
#include "fpsensor.h"
@@ -16,9 +17,7 @@
#include "timer.h"
#include "util.h"
-#include <stddef.h>
-
-#include <sys/types.h>
+#include "driver/fingerprint/fpc/fpc_sensor.h"
#define CPRINTF(format, args...) cprintf(CC_FP, format, ##args)
#define CPRINTS(format, args...) cprints(CC_FP, format, ##args)
diff --git a/driver/fingerprint/fpc/libfp/fpc_private.h b/driver/fingerprint/fpc/libfp/fpc_private.h
index a1fe0e47a2..19ac3b7a13 100644
--- a/driver/fingerprint/fpc/libfp/fpc_private.h
+++ b/driver/fingerprint/fpc/libfp/fpc_private.h
@@ -8,10 +8,6 @@
#ifndef __CROS_EC_FPC_PRIVATE_H
#define __CROS_EC_FPC_PRIVATE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* External error codes from FPC's sensor library */
enum fpc_error_code_external {
FPC_ERROR_NONE = 0,
@@ -161,8 +157,4 @@ int fp_sensor_maintenance(uint8_t *image_data,
*/
int fpc_get_hwid(uint16_t *id);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* __CROS_EC_FPC_PRIVATE_H */
diff --git a/driver/fingerprint/fpc/libfp/fpc_sensor_pal.c b/driver/fingerprint/fpc/libfp/fpc_sensor_pal.c
index a856e0afaf..c0578bc09b 100644
--- a/driver/fingerprint/fpc/libfp/fpc_sensor_pal.c
+++ b/driver/fingerprint/fpc/libfp/fpc_sensor_pal.c
@@ -6,8 +6,8 @@
#include "common.h"
#include "console.h"
-#include "fpc_sensor_pal.h"
#include "fpsensor.h"
+#include "fpc_sensor_pal.h"
#include "shared_mem.h"
#include "spi.h"
#include "timer.h"
diff --git a/driver/gl3590.c b/driver/gl3590.c
index 03af496293..da374fbc88 100644
--- a/driver/gl3590.c
+++ b/driver/gl3590.c
@@ -4,12 +4,13 @@
*/
#include "console.h"
-#include "gl3590.h"
#include "hooks.h"
#include "i2c.h"
-#include "pwr_defs.h"
#include "system.h"
#include "util.h"
+#include "pwr_defs.h"
+
+#include "gl3590.h"
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_I2C, format, ##args)
diff --git a/driver/ina2xx.c b/driver/ina2xx.c
index 64a2dadeed..e09c141f50 100644
--- a/driver/ina2xx.c
+++ b/driver/ina2xx.c
@@ -8,9 +8,9 @@
#include "console.h"
#include "hooks.h"
#include "i2c.h"
-#include "ina2xx.h"
#include "system.h"
#include "timer.h"
+#include "ina2xx.h"
#include "util.h"
/* Console output macros */
diff --git a/driver/ina3221.c b/driver/ina3221.c
index ec28ec3f26..4659552497 100644
--- a/driver/ina3221.c
+++ b/driver/ina3221.c
@@ -8,9 +8,9 @@
#include "console.h"
#include "hooks.h"
#include "i2c.h"
-#include "ina3221.h"
#include "system.h"
#include "timer.h"
+#include "ina3221.h"
#include "util.h"
/* Console output macros */
diff --git a/driver/ioexpander/it8801.c b/driver/ioexpander/it8801.c
index 932cbb2648..256b4c9654 100644
--- a/driver/ioexpander/it8801.c
+++ b/driver/ioexpander/it8801.c
@@ -10,12 +10,12 @@
#include "i2c.h"
#include "ioexpander.h"
#include "it8801.h"
-#include "keyboard_backlight.h"
#include "keyboard_raw.h"
#include "keyboard_scan.h"
#include "registers.h"
#include "task.h"
#include "util.h"
+#include "keyboard_backlight.h"
#define CPRINTS(format, args...) cprints(CC_KEYSCAN, format, ##args)
@@ -685,6 +685,11 @@ static int it8801_kblight_set_brightness(int percent)
return EC_SUCCESS;
}
+static int it8801_kblight_get_brightness(void)
+{
+ return it8801_pwm_get_duty(it8801_kblight_pwm_ch);
+}
+
static int it8801_kblight_init(void)
{
it8801_pwm_set_duty(it8801_kblight_pwm_ch, 0);
@@ -695,6 +700,7 @@ static int it8801_kblight_init(void)
const struct kblight_drv kblight_it8801 = {
.init = it8801_kblight_init,
.set = it8801_kblight_set_brightness,
+ .get = it8801_kblight_get_brightness,
.enable = it8801_kblight_enable,
.get_enabled = it8801_kblight_get_enabled,
};
diff --git a/driver/ioexpander/pcal6408.c b/driver/ioexpander/pcal6408.c
index cec5e5902e..1b746bffc3 100644
--- a/driver/ioexpander/pcal6408.c
+++ b/driver/ioexpander/pcal6408.c
@@ -6,10 +6,10 @@
*/
#include "common.h"
#include "console.h"
+#include "math_util.h"
#include "gpio.h"
#include "i2c.h"
#include "ioexpander.h"
-#include "math_util.h"
#include "pcal6408.h"
#define CPRINTF(format, args...) cprintf(CC_GPIO, format, ##args)
diff --git a/driver/led/aw20198.c b/driver/led/aw20198.c
index eca596d62e..e2eea69481 100644
--- a/driver/led/aw20198.c
+++ b/driver/led/aw20198.c
@@ -2,6 +2,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <string.h>
+
#include "aw20198.h"
#include "common.h"
#include "console.h"
@@ -11,8 +13,6 @@
#include "stddef.h"
#include "timer.h"
-#include <string.h>
-
#define CPRINTF(fmt, args...) cprintf(CC_RGBKBD, "AW20198: " fmt, ##args)
#define CPRINTS(fmt, args...) cprints(CC_RGBKBD, "AW20198: " fmt, ##args)
diff --git a/driver/led/is31fl3733b.c b/driver/led/is31fl3733b.c
index 3ff0c19655..33004d1cec 100644
--- a/driver/led/is31fl3733b.c
+++ b/driver/led/is31fl3733b.c
@@ -2,6 +2,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <string.h>
#include "common.h"
#include "console.h"
#include "gpio.h"
@@ -10,8 +11,6 @@
#include "stddef.h"
#include "timer.h"
-#include <string.h>
-
#define CPRINTF(fmt, args...) cprintf(CC_RGBKBD, "RGBKBD: " fmt, ##args)
#define CPRINTS(fmt, args...) cprints(CC_RGBKBD, "RGBKBD: " fmt, ##args)
diff --git a/driver/led/is31fl3743b.c b/driver/led/is31fl3743b.c
index 6725c1d406..5eef21c388 100644
--- a/driver/led/is31fl3743b.c
+++ b/driver/led/is31fl3743b.c
@@ -2,6 +2,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <string.h>
+
#include "common.h"
#include "console.h"
#include "gpio.h"
@@ -10,8 +12,6 @@
#include "stddef.h"
#include "timer.h"
-#include <string.h>
-
#define CPRINTF(fmt, args...) cprintf(CC_RGBKBD, "RGBKBD: " fmt, ##args)
#define CPRINTS(fmt, args...) cprints(CC_RGBKBD, "RGBKBD: " fmt, ##args)
diff --git a/driver/led/lm3509.c b/driver/led/lm3509.c
index 81dd940c4f..5df604bac6 100644
--- a/driver/led/lm3509.c
+++ b/driver/led/lm3509.c
@@ -70,6 +70,16 @@ static int lm3509_set_brightness(int percent)
return lm3509_write(LM3509_REG_BMAIN, brightness_to_bmain(percent));
}
+static int lm3509_get_brightness(void)
+{
+ int rv, val;
+ rv = lm3509_read(LM3509_REG_BMAIN, &val);
+ if (rv)
+ return -1;
+ val &= LM3509_BMAIN_MASK;
+ return lm3509_brightness[val] / 10;
+}
+
static int lm3509_init(void)
{
return EC_SUCCESS;
@@ -78,6 +88,7 @@ static int lm3509_init(void)
const struct kblight_drv kblight_lm3509 = {
.init = lm3509_init,
.set = lm3509_set_brightness,
+ .get = lm3509_get_brightness,
.enable = lm3509_power,
.get_enabled = lm3509_get_power,
};
diff --git a/driver/led/mp3385.h b/driver/led/mp3385.h
index 2f179666d8..733a8f76cd 100644
--- a/driver/led/mp3385.h
+++ b/driver/led/mp3385.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_MP3385_H
#define __CROS_EC_MP3385_H
-#include "common.h"
#include "gpio.h"
+#include "common.h"
/*
* Overridable board initialization. Should be overridden by a board
diff --git a/driver/led/oz554.h b/driver/led/oz554.h
index 27b43a1300..c735f9f3b9 100644
--- a/driver/led/oz554.h
+++ b/driver/led/oz554.h
@@ -8,8 +8,8 @@
#ifndef __CROS_EC_OZ554_H
#define __CROS_EC_OZ554_H
-#include "common.h"
#include "gpio.h"
+#include "common.h"
/*
* Overridable board initialization. Should be overridden by a board
diff --git a/driver/led/tlc59116f.c b/driver/led/tlc59116f.c
index 72e51e3fb8..1350602f6f 100644
--- a/driver/led/tlc59116f.c
+++ b/driver/led/tlc59116f.c
@@ -2,6 +2,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <string.h>
+
#include "common.h"
#include "console.h"
#include "i2c.h"
@@ -9,8 +11,6 @@
#include "stddef.h"
#include "tlc59116f.h"
-#include <string.h>
-
#define CPRINTF(fmt, args...) cprintf(CC_RGBKBD, "TLC59116F: " fmt, ##args)
#define CPRINTS(fmt, args...) cprints(CC_RGBKBD, "TLC59116F: " fmt, ##args)
diff --git a/driver/ln9310.c b/driver/ln9310.c
index f9dfedfc54..4a56568eb9 100644
--- a/driver/ln9310.c
+++ b/driver/ln9310.c
@@ -10,8 +10,8 @@
#include "driver/ln9310.h"
#include "hooks.h"
#include "i2c.h"
-#include "timer.h"
#include "util.h"
+#include "timer.h"
#define CPUTS(outstr) cputs(CC_I2C, outstr)
#define CPRINTF(format, args...) cprintf(CC_I2C, format, ##args)
diff --git a/driver/mag_lis2mdl.c b/driver/mag_lis2mdl.c
index a871f9e310..e8a8cb82ca 100644
--- a/driver/mag_lis2mdl.c
+++ b/driver/mag_lis2mdl.c
@@ -10,9 +10,9 @@
*/
#include "common.h"
-#include "driver/accelgyro_lsm6dsm.h"
#include "driver/mag_lis2mdl.h"
#include "driver/sensorhub_lsm6dsm.h"
+#include "driver/accelgyro_lsm6dsm.h"
#include "driver/stm_mems_common.h"
#include "hwtimer.h"
#include "mag_cal.h"
diff --git a/driver/mcdp28x0.c b/driver/mcdp28x0.c
index 791c3c519f..1b56e6d53f 100644
--- a/driver/mcdp28x0.c
+++ b/driver/mcdp28x0.c
@@ -5,9 +5,9 @@
* Megachips DisplayPort to HDMI protocol converter / level shifter driver.
*/
-#include "common.h"
#include "config.h"
#include "console.h"
+#include "common.h"
#include "ec_commands.h"
#include "mcdp28x0.h"
#include "queue.h"
diff --git a/driver/nfc/ctn730.c b/driver/nfc/ctn730.c
index c19b440824..e72f4459ad 100644
--- a/driver/nfc/ctn730.c
+++ b/driver/nfc/ctn730.c
@@ -4,9 +4,9 @@
*/
#include "chipset.h"
+#include "ctn730.h"
#include "common.h"
#include "console.h"
-#include "ctn730.h"
#include "gpio.h"
#include "i2c.h"
#include "peripheral_charger.h"
@@ -66,8 +66,6 @@ static const char *_text_instruction(uint8_t instruction)
return "CHARGING_STATE";
case WLC_CHG_CTRL_CHARGING_INFO:
return "CHARGING_INFO";
- case WLC_CHG_CTRL_OPTIONAL_NDEF:
- return "OPTIONAL_NDEF";
default:
return "UNDEF";
}
@@ -486,10 +484,6 @@ static int _process_payload_event(struct pchg *ctx, struct ctn730_msg *res)
ctx->event = PCHG_EVENT_CHARGE_UPDATE;
ctx->battery_percent = buf[0];
break;
- case WLC_CHG_CTRL_OPTIONAL_NDEF:
- if (len == 0)
- return EC_ERROR_INVAL;
- break;
default:
CPRINTS("Received unknown event (%d)", res->instruction);
break;
diff --git a/driver/nfc/ctn730.h b/driver/nfc/ctn730.h
index e1ae7ab754..45314428a9 100644
--- a/driver/nfc/ctn730.h
+++ b/driver/nfc/ctn730.h
@@ -32,7 +32,6 @@
#define WLC_CHG_CTRL_DEVICE_STATE 0b010010
#define WLC_CHG_CTRL_CHARGING_STATE 0b010100
#define WLC_CHG_CTRL_CHARGING_INFO 0b010101
-#define WLC_CHG_CTRL_OPTIONAL_NDEF 0b011111
/* WLC_HOST_CTRL_RESET constants */
#define WLC_HOST_CTRL_RESET_CMD_SIZE 1
diff --git a/driver/nvidia_gpu.c b/driver/nvidia_gpu.c
index b8a2195470..e9fbd156ac 100644
--- a/driver/nvidia_gpu.c
+++ b/driver/nvidia_gpu.c
@@ -5,6 +5,8 @@
* Nvidia GPU D-Notify driver
*/
+#include <stddef.h>
+
#include "charge_manager.h"
#include "charge_state.h"
#include "compile_time_macros.h"
@@ -17,8 +19,6 @@
#include "throttle_ap.h"
#include "timer.h"
-#include <stddef.h>
-
#define CPRINTS(fmt, args...) cprints(CC_GPU, "GPU: " fmt, ##args)
#define CPRINTF(fmt, args...) cprintf(CC_GPU, "GPU: " fmt, ##args)
diff --git a/driver/ppc/ktu1125.c b/driver/ppc/ktu1125.c
index f90168adef..047d011aac 100644
--- a/driver/ppc/ktu1125.c
+++ b/driver/ppc/ktu1125.c
@@ -7,14 +7,14 @@
#include "common.h"
#include "console.h"
+#include "ktu1125.h"
#include "hooks.h"
#include "i2c.h"
-#include "ktu1125.h"
#include "system.h"
#include "timer.h"
#include "usb_charge.h"
-#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include "usb_pd.h"
#include "usbc_ppc.h"
#include "util.h"
diff --git a/driver/ppc/ktu1125.h b/driver/ppc/ktu1125.h
index 9957ed80ec..229c894b8c 100644
--- a/driver/ppc/ktu1125.h
+++ b/driver/ppc/ktu1125.h
@@ -9,6 +9,7 @@
#define __CROS_EC_KTU1125_H
#include "common.h"
+
#include "driver/ppc/ktu1125_public.h"
#define KTU1125_ID 0x0
diff --git a/driver/ppc/nx20p348x.c b/driver/ppc/nx20p348x.c
index 14dfb88e02..d202898a85 100644
--- a/driver/ppc/nx20p348x.c
+++ b/driver/ppc/nx20p348x.c
@@ -7,15 +7,15 @@
#include "common.h"
#include "console.h"
+#include "nx20p348x.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
-#include "nx20p348x.h"
#include "system.h"
#include "tcpm/tcpm.h"
#include "usb_charge.h"
-#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include "usb_pd.h"
#include "usbc_ppc.h"
#include "util.h"
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c
index 9404c8df76..385f27fe52 100644
--- a/driver/ppc/sn5s330.c
+++ b/driver/ppc/sn5s330.c
@@ -12,14 +12,14 @@
#include "common.h"
#include "console.h"
+#include "sn5s330.h"
#include "hooks.h"
#include "i2c.h"
-#include "sn5s330.h"
#include "system.h"
#include "timer.h"
#include "usb_charge.h"
-#include "usb_pd.h"
#include "usb_pd_tcpm.h"
+#include "usb_pd.h"
#include "usbc_ppc.h"
#include "util.h"
diff --git a/driver/ppc/sn5s330.h b/driver/ppc/sn5s330.h
index 3748370007..70a46920ee 100644
--- a/driver/ppc/sn5s330.h
+++ b/driver/ppc/sn5s330.h
@@ -9,6 +9,7 @@
#define __CROS_EC_SN5S330_H
#include "common.h"
+
#include "driver/ppc/sn5s330_public.h"
struct sn5s330_config {
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c
index 42488a4a26..88c6443ad0 100644
--- a/driver/ppc/syv682x.c
+++ b/driver/ppc/syv682x.c
@@ -8,17 +8,17 @@
#include "common.h"
#include "config.h"
#include "console.h"
+#include "syv682x.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
#include "system.h"
-#include "syv682x.h"
#include "tcpm/tcpm.h"
#include "timer.h"
#include "usb_charge.h"
-#include "usb_pd.h"
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
+#include "usb_pd.h"
#include "util.h"
#define SYV682X_FLAGS_SOURCE_ENABLED BIT(0)
diff --git a/driver/retimer/anx7483.c b/driver/retimer/anx7483.c
index f8b11f0e85..3f4713fc85 100644
--- a/driver/retimer/anx7483.c
+++ b/driver/retimer/anx7483.c
@@ -6,11 +6,11 @@
*/
#include "anx7483.h"
+#include "retimer/anx7483_public.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
#include "i2c.h"
-#include "retimer/anx7483_public.h"
#include "timer.h"
#include "usb_mux.h"
#include "util.h"
@@ -346,34 +346,6 @@ enum ec_error_list anx7483_set_eq(const struct usb_mux *me,
return anx7483_write(me, reg, value);
}
-enum ec_error_list anx7483_set_fg(const struct usb_mux *me,
- enum anx7483_tune_pin pin,
- enum anx7483_fg_setting fg)
-{
- int reg, value;
-
- if (pin == ANX7483_PIN_UTX1)
- reg = ANX7483_UTX1_PORT_CFG2_REG;
- else if (pin == ANX7483_PIN_UTX2)
- reg = ANX7483_UTX2_PORT_CFG2_REG;
- else if (pin == ANX7483_PIN_URX1)
- reg = ANX7483_URX1_PORT_CFG2_REG;
- else if (pin == ANX7483_PIN_URX2)
- reg = ANX7483_URX2_PORT_CFG2_REG;
- else if (pin == ANX7483_PIN_DRX1)
- reg = ANX7483_DRX1_PORT_CFG2_REG;
- else if (pin == ANX7483_PIN_DRX2)
- reg = ANX7483_DRX2_PORT_CFG2_REG;
- else
- return EC_ERROR_INVAL;
-
- RETURN_ERROR(anx7483_read(me, reg, &value));
- value &= ~ANX7483_CFG2_FG_MASK;
- value |= fg << ANX7483_CFG2_FG_SHIFT;
-
- return anx7483_write(me, reg, value);
-}
-
const struct usb_mux_driver anx7483_usb_retimer_driver = {
.init = anx7483_init,
.set = anx7483_set,
diff --git a/driver/retimer/anx7483.h b/driver/retimer/anx7483.h
index c438a278b9..d489b3d8e6 100644
--- a/driver/retimer/anx7483.h
+++ b/driver/retimer/anx7483.h
@@ -72,9 +72,6 @@
#define ANX7483_DRX1_PORT_CFG2_REG 0x5E
#define ANX7483_DRX2_PORT_CFG2_REG 0x22
-#define ANX7483_CFG2_FG_SHIFT 4
-#define ANX7483_CFG2_FG_MASK GENMASK(5, 4)
-
/*
* Default CFG2 value to apply: 0.3 dB with optimized fine tuning
*/
diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c
index 3bee94bb56..f7a4ce6164 100644
--- a/driver/retimer/bb_retimer.c
+++ b/driver/retimer/bb_retimer.c
@@ -5,10 +5,10 @@
* Driver for Intel Burnside Bridge - Thunderbolt/USB/DisplayPort Retimer
*/
+#include "driver/retimer/bb_retimer.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
-#include "driver/retimer/bb_retimer.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
@@ -428,14 +428,7 @@ static int retimer_set_state(const struct usb_mux *me, mux_state_t mux_state,
set_retimer_con |= BB_RETIMER_USB_3_SPEED;
}
- /*
- * Bit 8: DP_CONNECTION
- * 0 ā€“ No DP connection
- * 1 ā€“ DP connected
- */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
- set_retimer_con |= BB_RETIMER_DP_CONNECTION;
-
/*
* Bit 11-10: DP_PIN_ASSIGNMENT (ignored if BIT8 = 0)
* 00 ā€“ Pin assignments E/Eā€™
@@ -552,15 +545,26 @@ void bb_retimer_hpd_update(const struct usb_mux *me, mux_state_t hpd_state,
retimer_con_reg &= ~BB_RETIMER_IRQ_HPD;
/*
+ * Bit 8: DP_CONNECTION
+ * 0 - No DP connection
+ * 1 - DP connected
+ *
* Bit 15: HPD_LVL (ignored if BIT8 = 0)
* 0 - HPD_State Low
* 1 - HPD_State High
+ *
+ * HDMI card connect to chromebook the DP_CONNECTION bit
+ * would be enable.
+ * It will increase BBR power consumption, so enable the DP bit
+ * only when the HPD bit is set so that the retimer stays in
+ * low power mode until the external monitor is connected.
*/
-
if (hpd_state & USB_PD_MUX_HPD_LVL)
- retimer_con_reg |= BB_RETIMER_HPD_LVL;
+ retimer_con_reg |=
+ (BB_RETIMER_HPD_LVL | BB_RETIMER_DP_CONNECTION);
else
- retimer_con_reg &= ~BB_RETIMER_HPD_LVL;
+ retimer_con_reg &=
+ ~(BB_RETIMER_HPD_LVL | BB_RETIMER_DP_CONNECTION);
/* Writing the register4 */
bb_retimer_write(me, BB_RETIMER_REG_CONNECTION_STATE, retimer_con_reg);
diff --git a/driver/retimer/nb7v904m.c b/driver/retimer/nb7v904m.c
index 2990a906b5..58c57e5c95 100644
--- a/driver/retimer/nb7v904m.c
+++ b/driver/retimer/nb7v904m.c
@@ -4,6 +4,7 @@
*
* ON Semiconductor NB7V904M USB Type-C DisplayPort Alt Mode Redriver
*/
+#include <stdbool.h>
#include "common.h"
#include "console.h"
#include "ec_commands.h"
@@ -11,8 +12,6 @@
#include "nb7v904m.h"
#include "usb_mux.h"
-#include <stdbool.h>
-
#define CPRINTS(format, args...) cprints(CC_USB, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
diff --git a/driver/retimer/pi3dpx1207.c b/driver/retimer/pi3dpx1207.c
index e40f269e3b..27ea474832 100644
--- a/driver/retimer/pi3dpx1207.c
+++ b/driver/retimer/pi3dpx1207.c
@@ -5,12 +5,12 @@
* PI3DPX1207 retimer.
*/
+#include "pi3dpx1207.h"
#include "common.h"
#include "console.h"
#include "gpio.h"
#include "i2c.h"
#include "ioexpander.h"
-#include "pi3dpx1207.h"
#include "usb_mux.h"
#define I2C_MAX_RETRIES 2
diff --git a/driver/sb_rmi.c b/driver/sb_rmi.c
index 62c105f6ff..420ef672ad 100644
--- a/driver/sb_rmi.c
+++ b/driver/sb_rmi.c
@@ -5,8 +5,8 @@
/* AMD SB-RMI (Side-band Remote Management Interface) Driver */
-#include "chipset.h"
#include "common.h"
+#include "chipset.h"
#include "console.h"
#include "i2c.h"
#include "sb_rmi.h"
diff --git a/driver/stm_mems_common.h b/driver/stm_mems_common.h
index 58e039bdd2..370ce10d9c 100644
--- a/driver/stm_mems_common.h
+++ b/driver/stm_mems_common.h
@@ -8,11 +8,11 @@
#ifndef __CROS_EC_ST_COMMONS_H
#define __CROS_EC_ST_COMMONS_H
-#include "accelgyro.h"
#include "common.h"
+#include "util.h"
+#include "accelgyro.h"
#include "console.h"
#include "i2c.h"
-#include "util.h"
/* X, Y, Z axis data len */
#define OUT_XYZ_SIZE 6
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index 4b8d82c034..8c21f77536 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -5,9 +5,9 @@
/* ANX7447 port manager */
-#include "anx7447.h"
#include "builtin/assert.h"
#include "common.h"
+#include "anx7447.h"
#include "console.h"
#include "hooks.h"
#include "tcpm/tcpci.h"
diff --git a/driver/tcpm/anx7447.h b/driver/tcpm/anx7447.h
index 56d810574d..42de7502f1 100644
--- a/driver/tcpm/anx7447.h
+++ b/driver/tcpm/anx7447.h
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/anx7447_public.h"
#include "usb_mux.h"
+#include "driver/tcpm/anx7447_public.h"
/* USB Power delivery port management */
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index e6ad23c25a..64a9271f1c 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -7,8 +7,8 @@
/* Type-C port manager for Analogix's anx74xx chips */
-#include "anx74xx.h"
#include "console.h"
+#include "anx74xx.h"
#include "task.h"
#include "tcpm/tcpci.h"
#include "tcpm/tcpm.h"
diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c
index 3f11e568d0..4b4a15c711 100644
--- a/driver/tcpm/fusb302.c
+++ b/driver/tcpm/fusb302.c
@@ -9,8 +9,8 @@
#include "console.h"
#include "fusb302.h"
-#include "hooks.h"
#include "task.h"
+#include "hooks.h"
#include "tcpm/tcpci.h"
#include "tcpm/tcpm.h"
#include "timer.h"
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c
index d04cb2f597..0b636e2e89 100644
--- a/driver/tcpm/it83xx.c
+++ b/driver/tcpm/it83xx.c
@@ -9,17 +9,17 @@
#include "common.h"
#include "config.h"
#include "console.h"
-#include "hooks.h"
#include "it83xx_pd.h"
#include "registers.h"
#include "system.h"
#include "task.h"
#include "tcpm/tcpci.h"
#include "timer.h"
+#include "util.h"
#include "usb_common.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#include "util.h"
+#include "hooks.h"
#ifdef CONFIG_USB_PD_TCPMV1
#if defined(CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE) || \
diff --git a/driver/tcpm/it83xx_pd.h b/driver/tcpm/it83xx_pd.h
index 2cb63aa22f..1ab76e2b79 100644
--- a/driver/tcpm/it83xx_pd.h
+++ b/driver/tcpm/it83xx_pd.h
@@ -7,10 +7,10 @@
#ifndef __CROS_EC_DRIVER_TCPM_IT83XX_H
#define __CROS_EC_DRIVER_TCPM_IT83XX_H
-#include "driver/tcpm/it8xxx2_pd_public.h"
-
#include <stdint.h>
+#include "driver/tcpm/it8xxx2_pd_public.h"
+
/* USBPD Controller */
#if defined(CONFIG_USB_PD_TCPM_DRIVER_IT83XX)
#define IT83XX_USBPD_BASE(port) (0x00F03700 + (0x100 * (port)))
diff --git a/driver/tcpm/it8xxx2.c b/driver/tcpm/it8xxx2.c
index 9bf50e1335..6782b528e5 100644
--- a/driver/tcpm/it8xxx2.c
+++ b/driver/tcpm/it8xxx2.c
@@ -9,17 +9,17 @@
#include "common.h"
#include "config.h"
#include "console.h"
-#include "hooks.h"
#include "it83xx_pd.h"
#include "ite_pd_intc.h"
#include "registers.h"
#include "system.h"
#include "task.h"
#include "timer.h"
+#include "util.h"
#include "usb_common.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#include "util.h"
+#include "hooks.h"
#ifdef CONFIG_USB_PD_TCPMV1
#if defined(CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE) || \
diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c
index 120749fb62..e3a9fc04a2 100644
--- a/driver/tcpm/nct38xx.c
+++ b/driver/tcpm/nct38xx.c
@@ -15,10 +15,9 @@
#include "usb_common.h"
#ifdef CONFIG_ZEPHYR
-#include "usbc/tcpc_nct38xx.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/gpio/gpio_nct38xx.h>
+#include "usbc/tcpc_nct38xx.h"
#endif
#if defined(CONFIG_ZEPHYR) && defined(CONFIG_IO_EXPANDER_NCT38XX)
diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h
index ed3197c822..7d873abc85 100644
--- a/driver/tcpm/ps8xxx.h
+++ b/driver/tcpm/ps8xxx.h
@@ -2,9 +2,10 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "driver/tcpm/ps8xxx_public.h"
#include "usb_mux.h"
+#include "driver/tcpm/ps8xxx_public.h"
+
/* Parade Tech Type-C port controller */
#ifndef __CROS_EC_USB_PD_TCPM_PS8XXX_H
diff --git a/driver/tcpm/rt1718s.h b/driver/tcpm/rt1718s.h
index 8ff977e26b..f7c821ba53 100644
--- a/driver/tcpm/rt1718s.h
+++ b/driver/tcpm/rt1718s.h
@@ -6,9 +6,9 @@
#define __CROS_EC_USB_PD_TCPM_RT1718S_H
#include "tcpm/rt1718s_public.h"
+#include "util.h"
#include "usb_charge.h"
#include "usb_pd_tcpm.h"
-#include "util.h"
/* RT1718S Private RegMap */
#define RT1718S_PHYCTRL1 0x80
diff --git a/driver/tcpm/stm32gx.c b/driver/tcpm/stm32gx.c
index 029570faca..77a436b2ac 100644
--- a/driver/tcpm/stm32gx.c
+++ b/driver/tcpm/stm32gx.c
@@ -9,16 +9,16 @@
#include "common.h"
#include "config.h"
#include "console.h"
-#include "hooks.h"
#include "registers.h"
#include "stm32gx.h"
#include "system.h"
#include "task.h"
#include "tcpm/tcpci.h"
#include "timer.h"
+#include "util.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#include "util.h"
+#include "hooks.h"
/*
* STM32G4 UCPD peripheral does not have the ability to detect VBUS, but
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 243ca94bd5..6e8a1feaf9 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -5,8 +5,8 @@
/* Type-C port manager */
-#include "anx74xx.h"
#include "atomic.h"
+#include "anx74xx.h"
#include "compile_time_macros.h"
#include "console.h"
#include "ec_commands.h"
@@ -1848,7 +1848,7 @@ static const struct tcpc_reg_dump_map tcpc_regs[] = {
/*
* Dump standard TCPC registers.
*/
-test_mockable void tcpc_dump_std_registers(int port)
+void tcpc_dump_std_registers(int port)
{
tcpc_dump_registers(port, tcpc_regs, ARRAY_SIZE(tcpc_regs));
}
@@ -1890,9 +1890,6 @@ const struct tcpm_drv tcpci_tcpm_drv = {
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
.enter_low_power_mode = &tcpci_enter_low_power_mode,
#endif
-#ifdef CONFIG_USB_PD_FRS_TCPC
- .set_frs_enable = &tcpci_tcpc_fast_role_swap_enable,
-#endif
.set_bist_test_mode = &tcpci_set_bist_test_mode,
.get_bist_test_mode = &tcpci_get_bist_test_mode,
#ifdef CONFIG_CMD_TCPC_DUMP
diff --git a/driver/tcpm/tusb422.c b/driver/tcpm/tusb422.c
index 79554bd0cf..6d12d1758b 100644
--- a/driver/tcpm/tusb422.c
+++ b/driver/tcpm/tusb422.c
@@ -6,10 +6,10 @@
/* Type-C port manager for TI TUSB422 Port Controller */
#include "common.h"
+#include "tusb422.h"
#include "tcpm/tcpci.h"
#include "tcpm/tcpm.h"
#include "timer.h"
-#include "tusb422.h"
#include "usb_pd.h"
#ifndef CONFIG_USB_PD_TCPM_TCPCI
diff --git a/driver/temp_sensor/adt7481.c b/driver/temp_sensor/adt7481.c
index f0aee1506f..0157d64b2d 100644
--- a/driver/temp_sensor/adt7481.c
+++ b/driver/temp_sensor/adt7481.c
@@ -5,12 +5,12 @@
/* ADT7481 temperature sensor module for Chrome EC */
-#include "adt7481.h"
#include "common.h"
#include "console.h"
+#include "adt7481.h"
#include "gpio.h"
-#include "hooks.h"
#include "i2c.h"
+#include "hooks.h"
#include "util.h"
static int temp_val_local;
diff --git a/driver/temp_sensor/amd_r19me4070.c b/driver/temp_sensor/amd_r19me4070.c
index 3ee230da09..97868b6945 100644
--- a/driver/temp_sensor/amd_r19me4070.c
+++ b/driver/temp_sensor/amd_r19me4070.c
@@ -5,12 +5,12 @@
/* R19ME4070 temperature sensor module for Chrome EC */
-#include "amd_r19me4070.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
#include "hooks.h"
#include "i2c.h"
+#include "amd_r19me4070.h"
#include "power.h"
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
diff --git a/driver/temp_sensor/f75303.c b/driver/temp_sensor/f75303.c
index d83f7bc4a6..e686537c31 100644
--- a/driver/temp_sensor/f75303.c
+++ b/driver/temp_sensor/f75303.c
@@ -6,11 +6,11 @@
/* F75303 temperature sensor module for Chrome EC */
#include "common.h"
-#include "console.h"
#include "f75303.h"
-#include "hooks.h"
#include "i2c.h"
+#include "hooks.h"
#include "util.h"
+#include "console.h"
static int temps[F75303_IDX_COUNT];
static int8_t fake_temp[F75303_IDX_COUNT] = { -1, -1, -1 };
diff --git a/driver/temp_sensor/g753.c b/driver/temp_sensor/g753.c
index f162cbf846..8d94cac4f8 100644
--- a/driver/temp_sensor/g753.c
+++ b/driver/temp_sensor/g753.c
@@ -9,8 +9,8 @@
#include "console.h"
#include "g753.h"
#include "gpio.h"
-#include "hooks.h"
#include "i2c.h"
+#include "hooks.h"
#include "util.h"
static int temp_val_local;
diff --git a/driver/temp_sensor/g78x.c b/driver/temp_sensor/g78x.c
index 413e2dda8a..82cb2d26e9 100644
--- a/driver/temp_sensor/g78x.c
+++ b/driver/temp_sensor/g78x.c
@@ -9,8 +9,8 @@
#include "console.h"
#include "g78x.h"
#include "gpio.h"
-#include "hooks.h"
#include "i2c.h"
+#include "hooks.h"
#include "util.h"
static int temp_val_local;
diff --git a/driver/temp_sensor/oti502.c b/driver/temp_sensor/oti502.c
index 4564ad9257..2051df89f6 100644
--- a/driver/temp_sensor/oti502.c
+++ b/driver/temp_sensor/oti502.c
@@ -7,9 +7,9 @@
#include "common.h"
#include "console.h"
-#include "hooks.h"
-#include "i2c.h"
#include "oti502.h"
+#include "i2c.h"
+#include "hooks.h"
#include "util.h"
static int temp_val_ambient; /* Ambient is chip temperature*/
diff --git a/driver/temp_sensor/pct2075.c b/driver/temp_sensor/pct2075.c
index 02150ad796..9c7b7190e9 100644
--- a/driver/temp_sensor/pct2075.c
+++ b/driver/temp_sensor/pct2075.c
@@ -7,8 +7,8 @@
#include "common.h"
#include "console.h"
-#include "hooks.h"
#include "i2c.h"
+#include "hooks.h"
#include "math_util.h"
#include "temp_sensor/pct2075.h"
#include "util.h"
@@ -76,7 +76,6 @@ int pct2075_get_val_mk(int idx, int *temp_mk_ptr)
return EC_SUCCESS;
}
-#ifndef CONFIG_ZEPHYR
static void pct2075_poll(void)
{
int s;
@@ -88,18 +87,6 @@ static void pct2075_poll(void)
}
}
DECLARE_HOOK(HOOK_SECOND, pct2075_poll, HOOK_PRIO_TEMP_SENSOR);
-#else
-void pct2075_update_temperature(int idx)
-{
- int temp_reg = 0;
-
- if (idx >= PCT2075_COUNT)
- return;
-
- if (get_reg_temp(idx, &temp_reg) == EC_SUCCESS)
- temp_mk_local[idx] = pct2075_reg_to_mk(temp_reg);
-}
-#endif /* CONFIG_ZEPHYR */
void pct2075_init(void)
{
diff --git a/driver/temp_sensor/tmp112.c b/driver/temp_sensor/tmp112.c
index 267227f6f3..f7f28159aa 100644
--- a/driver/temp_sensor/tmp112.c
+++ b/driver/temp_sensor/tmp112.c
@@ -7,8 +7,8 @@
#include "common.h"
#include "console.h"
-#include "hooks.h"
#include "i2c.h"
+#include "hooks.h"
#include "math_util.h"
#include "temp_sensor/tmp112.h"
#include "util.h"
@@ -92,7 +92,6 @@ int tmp112_get_val_mk(int idx, int *temp_mk_ptr)
return EC_SUCCESS;
}
-#ifndef CONFIG_ZEPHYR
static void tmp112_poll(void)
{
int s;
@@ -104,18 +103,6 @@ static void tmp112_poll(void)
}
}
DECLARE_HOOK(HOOK_SECOND, tmp112_poll, HOOK_PRIO_TEMP_SENSOR);
-#else
-static void tmp112_update_temperature(int idx)
-{
- int temp_reg = 0;
-
- if (idx >= TMP112_COUNT)
- return;
-
- if (get_reg_temp(idx, &temp_reg) == EC_SUCCESS)
- temp_mk_local[idx] = tmp112_reg_to_mk(temp_reg);
-}
-#endif /* CONFIG_ZEPHYR */
void tmp112_init(void)
{
diff --git a/driver/temp_sensor/tmp411.c b/driver/temp_sensor/tmp411.c
index 4f8a08a181..8a14440671 100644
--- a/driver/temp_sensor/tmp411.c
+++ b/driver/temp_sensor/tmp411.c
@@ -7,10 +7,10 @@
#include "common.h"
#include "console.h"
+#include "tmp411.h"
#include "gpio.h"
-#include "hooks.h"
#include "i2c.h"
-#include "tmp411.h"
+#include "hooks.h"
#include "util.h"
static int temp_val_local;
diff --git a/driver/temp_sensor/tmp432.c b/driver/temp_sensor/tmp432.c
index 581e33b979..fde6536536 100644
--- a/driver/temp_sensor/tmp432.c
+++ b/driver/temp_sensor/tmp432.c
@@ -7,10 +7,10 @@
#include "common.h"
#include "console.h"
+#include "tmp432.h"
#include "gpio.h"
-#include "hooks.h"
#include "i2c.h"
-#include "tmp432.h"
+#include "hooks.h"
#include "util.h"
static int temp_val_local;
diff --git a/driver/temp_sensor/tmp468.c b/driver/temp_sensor/tmp468.c
index 3bfaeeedbb..87eb040460 100644
--- a/driver/temp_sensor/tmp468.c
+++ b/driver/temp_sensor/tmp468.c
@@ -7,13 +7,14 @@
#include "common.h"
#include "console.h"
+#include "tmp432.h"
#include "gpio.h"
-#include "hooks.h"
#include "i2c.h"
-#include "tmp432.h"
-#include "tmp468.h"
+#include "hooks.h"
#include "util.h"
+#include "tmp468.h"
+
static int fake_temp[TMP468_CHANNEL_COUNT] = { -1, -1, -1, -1, -1,
-1, -1, -1, -1 };
static int temp_val[TMP468_CHANNEL_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
diff --git a/driver/touchpad_elan.c b/driver/touchpad_elan.c
index 7dacf9fdb1..05c081a84a 100644
--- a/driver/touchpad_elan.c
+++ b/driver/touchpad_elan.c
@@ -7,20 +7,20 @@
#include "common.h"
#include "console.h"
#include "gpio.h"
-#include "hooks.h"
#include "hwtimer.h"
+#include "hooks.h"
#include "i2c.h"
#include "math_util.h"
#include "sha256.h"
#include "shared_mem.h"
-#include "tablet_mode.h"
#include "task.h"
+#include "tablet_mode.h"
#include "timer.h"
#include "touchpad.h"
#include "update_fw.h"
+#include "util.h"
#include "usb_api.h"
#include "usb_hid_touchpad.h"
-#include "util.h"
#include "watchdog.h"
/* Console output macros */
diff --git a/driver/touchpad_gt7288.c b/driver/touchpad_gt7288.c
index f225c5b7eb..9d9b31a22b 100644
--- a/driver/touchpad_gt7288.c
+++ b/driver/touchpad_gt7288.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <stdbool.h>
+
#include "common.h"
#include "console.h"
#include "hooks.h"
@@ -11,8 +13,6 @@
#include "touchpad_gt7288.h"
#include "util.h"
-#include <stdbool.h>
-
/* Define this to enable various warning messages during report parsing. */
#undef DEBUG_CHECKS
diff --git a/driver/touchpad_st.c b/driver/touchpad_st.c
index f71b952f86..f66df6ab2a 100644
--- a/driver/touchpad_st.c
+++ b/driver/touchpad_st.c
@@ -8,14 +8,14 @@
#include "common.h"
#include "console.h"
#include "gpio.h"
-#include "hooks.h"
#include "hwtimer.h"
+#include "hooks.h"
#include "i2c.h"
#include "printf.h"
#include "registers.h"
#include "spi.h"
-#include "tablet_mode.h"
#include "task.h"
+#include "tablet_mode.h"
#include "timer.h"
#include "touchpad.h"
#include "touchpad_st.h"
diff --git a/driver/touchpad_st.h b/driver/touchpad_st.h
index 1dee7f0947..6ea3f6aeb0 100644
--- a/driver/touchpad_st.h
+++ b/driver/touchpad_st.h
@@ -6,10 +6,10 @@
#ifndef __CROS_EC_TOUCHPAD_ST_H
#define __CROS_EC_TOUCHPAD_ST_H
-#include "common.h"
-
#include <stdint.h>
+#include "common.h"
+
#define ST_VENDOR_ID 0x0483
#define ST_TP_EXTRA_BYTE 1
diff --git a/driver/usb_mux/pi3usb3x532.h b/driver/usb_mux/pi3usb3x532.h
index d0a7abaa89..9214d349f0 100644
--- a/driver/usb_mux/pi3usb3x532.h
+++ b/driver/usb_mux/pi3usb3x532.h
@@ -12,8 +12,8 @@
#ifndef __CROS_EC_PI3USB3X532_H
#define __CROS_EC_PI3USB3X532_H
-#include "usb_mux.h"
#include "usb_pd.h"
+#include "usb_mux.h"
/* I2C Addresses */
#define PI3USB3X532_I2C_ADDR0 0x54
diff --git a/driver/usb_mux/tusb1064.h b/driver/usb_mux/tusb1064.h
index 0e366f1bc9..1a38290174 100644
--- a/driver/usb_mux/tusb1064.h
+++ b/driver/usb_mux/tusb1064.h
@@ -6,9 +6,8 @@
#ifndef __CROS_EC_TUSB1064_H
#define __CROS_EC_TUSB1064_H
-#include "usb_mux.h"
-
#include <stdint.h>
+#include "usb_mux.h"
/*
* TUSB1064 Has 16 possible device addresses which are selected by A1|A0 lines
diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c
index 73c8a165bf..edc9da5778 100644
--- a/driver/usb_mux/usb_mux.c
+++ b/driver/usb_mux/usb_mux.c
@@ -7,9 +7,9 @@
#include "atomic.h"
#include "builtin/assert.h"
-#include "chipset.h"
#include "common.h"
#include "console.h"
+#include "chipset.h"
#include "ec_commands.h"
#include "hooks.h"
#include "host_command.h"
diff --git a/driver/wpc/p9221.h b/driver/wpc/p9221.h
index 1360c54ee7..53dcc57aa7 100644
--- a/driver/wpc/p9221.h
+++ b/driver/wpc/p9221.h
@@ -10,9 +10,9 @@
#ifndef __P9221_R7_H
#define __P9221_R7_H
-#include "charge_manager.h"
#include "common.h"
#include "gpio.h"
+#include "charge_manager.h"
#include "task.h"
/* ========== Variant-specific configuration ============ */