summaryrefslogtreecommitdiff
path: root/board/madoo
diff options
context:
space:
mode:
Diffstat (limited to 'board/madoo')
-rw-r--r--board/madoo/board.c89
-rw-r--r--board/madoo/board.h11
-rw-r--r--board/madoo/gpio.inc6
-rw-r--r--board/madoo/usb_pd_policy.c2
4 files changed, 15 insertions, 93 deletions
diff --git a/board/madoo/board.c b/board/madoo/board.c
index 43fbb9335d..e53c7e10d4 100644
--- a/board/madoo/board.c
+++ b/board/madoo/board.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* Waddledoo board-specific configuration */
+/* Madoo board-specific configuration */
#include "adc_chip.h"
#include "button.h"
@@ -74,13 +74,6 @@ static void sub_usb_c1_interrupt(enum gpio_signal s)
task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12, 0);
}
-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);
-
- gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, !hdmi_hpd_odl);
-}
-
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
{
cprints(CC_USBPD, "C0: CC OVP, SBU OVP, or thermal event");
@@ -127,34 +120,9 @@ void board_init(void)
int on;
gpio_enable_interrupt(GPIO_USB_C0_INT_ODL);
+ gpio_enable_interrupt(GPIO_SUB_USB_C1_INT_ODL);
gpio_enable_interrupt(GPIO_USB_C0_CCSBU_OVP_ODL);
- if (get_cbi_fw_config_db() == DB_1A_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_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);
- } else {
- /* Set SDA as an input */
- gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
- GPIO_INPUT);
-
- /* Enable C1 interrupts */
- gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL);
- }
/* Enable gpio interrupt for base accelgyro sensor */
gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
@@ -164,27 +132,13 @@ void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-/* Enable HDMI any time the SoC is on */
-static void hdmi_enable(void)
-{
- 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)
-{
- 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)
{
/*
* Both charger ICs need to be put into their "low power mode" before
* entering the Z-state.
*/
- if (board_get_charger_chip_count() > 1)
- raa489000_hibernate(1);
+ raa489000_hibernate(1);
raa489000_hibernate(0);
}
@@ -237,35 +191,13 @@ __override void board_power_5v_enable(int enable)
/*
* Port 0 simply has a GPIO to turn on the 5V regulator, however, 5V is
* generated locally on the sub board and we need to set the comparator
- * polarity on the sub board charger IC, or send enable signal to HDMI
- * DB.
+ * polarity on the sub board charger IC.
*/
set_5v_gpio(!!enable);
- if (get_cbi_fw_config_db() == DB_1A_HDMI) {
- gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable);
- } else {
- if (isl923x_set_comparator_inversion(1, !!enable))
- CPRINTS("Failed to %sable sub rails!", enable ?
+ if (isl923x_set_comparator_inversion(1, !!enable))
+ CPRINTS("Failed to %sable sub rails!", enable ?
"en" : "dis");
- }
-
-}
-
-__override uint8_t board_get_usb_pd_port_count(void)
-{
- if (get_cbi_fw_config_db() == DB_1A_HDMI)
- return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
- else
- return CONFIG_USB_PD_PORT_MAX_COUNT;
-}
-
-__override uint8_t board_get_charger_chip_count(void)
-{
- if (get_cbi_fw_config_db() == DB_1A_HDMI)
- return CHARGER_NUM - 1;
- else
- return CHARGER_NUM;
}
int board_is_sourcing_vbus(int port)
@@ -280,7 +212,7 @@ int board_is_sourcing_vbus(int port)
int board_set_active_charge_port(int port)
{
int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int old_port;
@@ -293,7 +225,7 @@ int board_set_active_charge_port(int port)
/* Disable all ports. */
if (port == CHARGE_PORT_NONE) {
- for (i = 0; i < board_get_usb_pd_port_count(); i++)
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++)
tcpc_write(i, TCPC_REG_COMMAND,
TCPC_REG_COMMAND_SNK_CTRL_LOW);
@@ -310,7 +242,7 @@ int board_set_active_charge_port(int port)
* Turn off the other ports' sink path FETs, before enabling the
* requested charge port.
*/
- for (i = 0; i < board_get_usb_pd_port_count(); i++) {
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
if (i == port)
continue;
@@ -594,8 +526,7 @@ uint16_t tcpc_get_alert_status(void)
}
}
- if (board_get_usb_pd_port_count() > 1 &&
- !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
+ if (!gpio_get_level(GPIO_SUB_USB_C1_INT_ODL)) {
if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
/* TCPCI spec Rev 1.0 says to ignore bits 14:12. */
if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0))
diff --git a/board/madoo/board.h b/board/madoo/board.h
index b815a9f951..21558fdc3a 100644
--- a/board/madoo/board.h
+++ b/board/madoo/board.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* Waddledoo board configuration */
+/* Madoo board configuration */
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
@@ -72,15 +72,6 @@
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
-/*
- * I2C pin names for baseboard
- *
- * 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
-
/* Sensors */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
diff --git a/board/madoo/gpio.inc b/board/madoo/gpio.inc
index 6bdb111ebf..8fdf49f0ac 100644
--- a/board/madoo/gpio.inc
+++ b/board/madoo/gpio.inc
@@ -26,8 +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(SUB_C1_INT_EN_RAILS_ODL, PIN(F, 5), GPIO_INT_FALLING | GPIO_PULL_UP, sub_usb_c1_interrupt) /* C1 interrupt OR 5V power en */
-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 */
+GPIO_INT(SUB_USB_C1_INT_ODL, PIN(F, 5), GPIO_INT_FALLING | GPIO_PULL_UP, sub_usb_c1_interrupt) /* C1 interrupt OR 5V power en */
GPIO_INT(USB_C0_CCSBU_OVP_ODL, PIN(A, 2), GPIO_INT_FALLING | GPIO_PULL_UP, c0_ccsbu_ovp_interrupt) /* Fault protection */
/* Button interrupts */
@@ -51,7 +50,8 @@ 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 */
+GPIO(EC_I2C_SUB_USB_C1_SCL, PIN(9, 2), GPIO_INPUT)
+GPIO(EC_I2C_SUB_USB_C1_SDA, PIN(9, 1), GPIO_INPUT)
/* Extra Sub-board I/O pins */
GPIO(EC_SUB_IO_1, PIN(3, 7), GPIO_OUT_LOW)
diff --git a/board/madoo/usb_pd_policy.c b/board/madoo/usb_pd_policy.c
index 905e049937..bcdf8300c5 100644
--- a/board/madoo/usb_pd_policy.c
+++ b/board/madoo/usb_pd_policy.c
@@ -37,7 +37,7 @@ int pd_set_power_supply_ready(int port)
{
int rv;
- if (port >= board_get_usb_pd_port_count())
+ if (port >= CONFIG_USB_PD_PORT_MAX_COUNT)
return EC_ERROR_INVAL;
/* Disable charging. */