diff options
author | Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> | 2021-03-23 15:10:38 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-24 03:57:40 +0000 |
commit | 66858ecb376e55aa6194b3ba77e50623e9bd16e7 (patch) | |
tree | 2582a6a9597ae4e149654470ebbd30cc76e7a250 /board/metaknight | |
parent | 597035d35fe4ee1ae1b89644bb009919e0287066 (diff) | |
download | chrome-ec-66858ecb376e55aa6194b3ba77e50623e9bd16e7.tar.gz |
Metaknight: Organize source code
Move GPIO00,GPIO40,GPIO73,GPIO80,GPIO92,GPIOE0 to NC pin.
Rename EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL to HDMI_HPD_SUB_ODL.
Add "HDMI plug-in/out" message in ec console.
Remove hdmi_enable/disable function due to GPIO92 not used.
Add "SSFC" tag in init g-sensor console message.
BUG=None
BRANCH=dedede
TEST=check DUT can boot, HDMI log correct
Signed-off-by: yu-an.chen@quanta.corp-partner.google.com
Change-Id: I0d600408171de68dfa025065845dd55e59e8a6dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2780863
Tested-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Auto-Submit: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/metaknight')
-rw-r--r-- | board/metaknight/board.c | 58 | ||||
-rw-r--r-- | board/metaknight/board.h | 4 | ||||
-rw-r--r-- | board/metaknight/gpio.inc | 11 |
3 files changed, 30 insertions, 43 deletions
diff --git a/board/metaknight/board.c b/board/metaknight/board.c index 47dfcbff1f..9f307af8b2 100644 --- a/board/metaknight/board.c +++ b/board/metaknight/board.c @@ -104,9 +104,11 @@ static void usb_c0_interrupt(enum gpio_signal s) static void sub_hdmi_hpd_interrupt(enum gpio_signal s) { - int hdmi_hpd_odl = gpio_get_level(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL); + int hdmi_hpd_odl = gpio_get_level(GPIO_HDMI_HPD_SUB_ODL); gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, !hdmi_hpd_odl); + + cprints(CC_SYSTEM, "HDMI plug-%s", !hdmi_hpd_odl ? "in" : "out"); } /** @@ -114,7 +116,7 @@ static void sub_hdmi_hpd_interrupt(enum gpio_signal s) */ static void pen_input_deferred(void) { - int pen_charge_enable = !gpio_get_level(GPIO_PEN_DET_ODL) && + int pen_charge_enable = !gpio_get_level(GPIO_PEN_DET_ODL) && !chipset_in_state(CHIPSET_STATE_ANY_OFF); if (pen_charge_enable) @@ -181,12 +183,14 @@ const struct temp_sensor_t temp_sensors[] = { .name = "Memory", .type = TEMP_SENSOR_TYPE_BOARD, .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_1}, + .idx = ADC_TEMP_SENSOR_1 + }, [TEMP_SENSOR_CPU] = { .name = "CPU", .type = TEMP_SENSOR_TYPE_BOARD, .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_2}, + .idx = ADC_TEMP_SENSOR_2 + }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); @@ -224,23 +228,6 @@ static void setup_thermal(void) thermal_params[TEMP_SENSOR_CPU] = thermal_cpu; } -/* Enable HDMI any time the SoC is on */ -static void hdmi_enable(void) -{ - if (get_cbi_fw_config_db() == DB_1A_HDMI || - get_cbi_fw_config_db() == DB_LTE_HDMI) - gpio_set_level(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0); -} -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, hdmi_enable, HOOK_PRIO_DEFAULT); - -static void hdmi_disable(void) -{ - if (get_cbi_fw_config_db() == DB_1A_HDMI || - get_cbi_fw_config_db() == DB_LTE_HDMI) - gpio_set_level(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 1); -} -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, hdmi_disable, HOOK_PRIO_DEFAULT); - void board_hibernate(void) { /* @@ -608,52 +595,47 @@ void board_init(void) if (get_cbi_fw_config_db() == DB_1A_HDMI || get_cbi_fw_config_db() == DB_LTE_HDMI) { /* Disable i2c on HDMI pins */ - gpio_config_pin(MODULE_I2C, - GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, 0); - gpio_config_pin(MODULE_I2C, - GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0); - - /* Set HDMI and sub-rail enables to output */ - gpio_set_flags(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, - chipset_in_state(CHIPSET_STATE_ON) ? - GPIO_ODR_LOW : GPIO_ODR_HIGH); + gpio_config_pin(MODULE_I2C, GPIO_HDMI_HPD_SUB_ODL, 0); + gpio_config_pin(MODULE_I2C, GPIO_GPIO92_NC, 0); + gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH); /* Select HDMI option */ gpio_set_level(GPIO_HDMI_SEL_L, 0); /* Enable interrupt for passing through HPD */ - gpio_enable_interrupt(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL); + gpio_enable_interrupt(GPIO_HDMI_HPD_SUB_ODL); } else { /* Set SDA as an input */ - gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, + gpio_set_flags(GPIO_HDMI_HPD_SUB_ODL, GPIO_INPUT); } /* Enable gpio interrupt for base accelgyro sensor */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); + /* Enable gpio interrupt for pen detect */ + gpio_enable_interrupt(GPIO_PEN_DET_ODL); + /* Turn on 5V if the system is on, otherwise turn it off. */ on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND | CHIPSET_STATE_SOFT_OFF); board_power_5v_enable(on); - gpio_enable_interrupt(GPIO_PEN_DET_ODL); - /* Initialize g-sensor */ base_gyro_config = get_cbi_ssfc_base_sensor(); if (base_gyro_config == SSFC_SENSOR_LSM6DSM) { motion_sensors[BASE_ACCEL] = lsm6dsm_base_accel; motion_sensors[BASE_GYRO] = lsm6dsm_base_gyro; - ccprints("BASE GYRO is LSM6DSM"); + cprints(CC_SYSTEM, "SSFC: BASE GYRO is LSM6DSM"); } else - ccprints("BASE GYRO is BMI160"); + cprints(CC_SYSTEM, "SSFC: BASE GYRO is BMI160"); if (get_cbi_ssfc_lid_sensor() == SSFC_SENSOR_KX022) { motion_sensors[LID_ACCEL] = kx022_lid_accel; - ccprints("LID_ACCEL is KX022"); + cprints(CC_SYSTEM, "SSFC: LID ACCEL is KX022"); } else - ccprints("LID_ACCEL is BMA253"); + cprints(CC_SYSTEM, "SSFC: LID ACCEL is BMA253"); /* Initial thermal */ setup_thermal(); diff --git a/board/metaknight/board.h b/board/metaknight/board.h index ec3f8ae54a..eb80251fbb 100644 --- a/board/metaknight/board.h +++ b/board/metaknight/board.h @@ -93,8 +93,8 @@ * Note: these lines will be set as i2c on start-up, but this should be * okay since they're ODL. */ -#define GPIO_EC_I2C_SUB_USB_C1_SCL GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL -#define GPIO_EC_I2C_SUB_USB_C1_SDA GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL +#define GPIO_EC_I2C_SUB_USB_C1_SCL GPIO_GPIO92_NC +#define GPIO_EC_I2C_SUB_USB_C1_SDA GPIO_HDMI_HPD_SUB_ODL /* Sensors */ #define CONFIG_CMD_ACCELS diff --git a/board/metaknight/gpio.inc b/board/metaknight/gpio.inc index 7c84aa982f..6b88bf8f16 100644 --- a/board/metaknight/gpio.inc +++ b/board/metaknight/gpio.inc @@ -26,7 +26,7 @@ GPIO_INT(PG_PP1050_ST_OD, PIN(4, 2), GPIO_INT_BOTH, power_signal_interrupt) /* USB-C interrupts */ GPIO_INT(USB_C0_INT_ODL, PIN(6, 2), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c0_interrupt) -GPIO_INT(EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, PIN(9, 1), GPIO_INT_BOTH, sub_hdmi_hpd_interrupt) /* C1 I2C SDA OR HDMI_HPD */ + /* Button interrupts */ GPIO_INT(H1_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) @@ -37,6 +37,7 @@ GPIO_INT(EC_WP_OD, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, motion_interrupt) GPIO_INT(LID_360_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr) GPIO_INT(PEN_DET_ODL, PIN(5, 0), GPIO_INT_BOTH, pen_input_interrupt) +GPIO_INT(HDMI_HPD_SUB_ODL, PIN(9, 1), GPIO_INT_BOTH, sub_hdmi_hpd_interrupt) /* HDMI_HPD */ /* I2C Ports */ GPIO(EC_I2C_EEPROM_SCL, PIN(B, 3), GPIO_INPUT) @@ -47,7 +48,6 @@ GPIO(EC_I2C_SENSOR_SCL, PIN(B, 5), GPIO_INPUT) GPIO(EC_I2C_SENSOR_SDA, PIN(B, 4), GPIO_INPUT) GPIO(EC_I2C_USB_C0_SCL, PIN(9, 0), GPIO_INPUT) GPIO(EC_I2C_USB_C0_SDA, PIN(8, 7), GPIO_INPUT) -GPIO(EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, PIN(9, 2), GPIO_INPUT) /* C1 I2C SCL OR HDMI en */ /* Extra Sub-board I/O pins */ GPIO(EC_SUB_IO_2, PIN(3, 4), GPIO_OUT_LOW) @@ -61,7 +61,6 @@ GPIO(EN_PP3300_A, PIN(0, 3), GPIO_OUT_LOW) GPIO(EN_PP5000_U, PIN(A, 4), GPIO_OUT_LOW) GPIO(EN_SLP_Z, PIN(8, 3), GPIO_OUT_LOW) GPIO(EN_BL_OD, PIN(D, 3), GPIO_ODR_LOW) -GPIO(IMVP9_PE, PIN(E, 0), GPIO_OUT_LOW) GPIO(ECH1_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW) GPIO(SUB_C1_INT_EN_RAILS_ODL, PIN(F, 5), GPIO_ODR_LOW)/* 5V power en */ @@ -134,14 +133,20 @@ ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* I2C2, I2C1 SCL */ ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* I2C1 SDA */ /* NC pins, enable internal pull-up to avoid floating state. */ +GPIO(GPIO00_NC, PIN(0, 0), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIO32_NC, PIN(3, 2), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIO35_NC, PIN(3, 5), GPIO_INPUT | GPIO_PULL_UP) +GPIO(GPIO40_NC, PIN(4, 0), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIO57_NC, PIN(5, 7), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIO60_NC, PIN(6, 0), GPIO_INPUT | GPIO_PULL_UP) +GPIO(GPIO73_NC, PIN(7, 3), GPIO_INPUT | GPIO_PULL_UP) +GPIO(GPIO80_NC, PIN(8, 0), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIO81_NC, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIO86_NC, PIN(8, 6), GPIO_INPUT | GPIO_PULL_UP) +GPIO(GPIO92_NC, PIN(9, 2), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIOC0_NC, PIN(C, 0), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIOC2_NC, PIN(C, 2), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIOD0_NC, PIN(D, 0), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIOD1_NC, PIN(D, 1), GPIO_INPUT | GPIO_PULL_UP) GPIO(GPIOD6_NC, PIN(D, 6), GPIO_INPUT | GPIO_PULL_UP) +GPIO(GPIOE0_NC, PIN(E, 0), GPIO_INPUT | GPIO_PULL_UP) |