diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/coachz/board.c | 19 | ||||
-rw-r--r-- | board/coachz/board.h | 5 | ||||
-rw-r--r-- | board/coachz/ec.tasklist | 1 | ||||
-rw-r--r-- | board/coachz/gpio.inc | 5 |
4 files changed, 28 insertions, 2 deletions
diff --git a/board/coachz/board.c b/board/coachz/board.c index 1191b4566a..27e5885d6b 100644 --- a/board/coachz/board.c +++ b/board/coachz/board.c @@ -9,6 +9,7 @@ #include "button.h" #include "charge_manager.h" #include "charge_state.h" +#include "common.h" #include "extpower.h" #include "driver/accel_bma2x2.h" #include "driver/accelgyro_bmi_common.h" @@ -20,11 +21,13 @@ #include "keyboard_mkbp.h" #include "keyboard_scan.h" #include "lid_switch.h" +#include "peripheral_charger.h" #include "pi3usb9201.h" #include "power.h" #include "power_button.h" #include "pwm.h" #include "pwm_chip.h" +#include "queue.h" #include "system.h" #include "shi_chip.h" #include "switch.h" @@ -47,6 +50,20 @@ static void ks_interrupt(enum gpio_signal s); #include "gpio_list.h" +extern struct pchg_drv ctn730_drv; + +struct pchg pchgs[] = { + [0] = { + .cfg = &(const struct pchg_config) { + .drv = &ctn730_drv, + .i2c_port = I2C_PORT_WLC, + .irq_pin = GPIO_WLC_IRQ_CONN, + }, + .events = QUEUE_NULL(PCHG_EVENT_QUEUE_SIZE, enum pchg_event), + }, +}; +const int pchg_count = ARRAY_SIZE(pchgs); + /* GPIO Interrupt Handlers */ static void tcpc_alert_event(enum gpio_signal signal) { @@ -167,7 +184,7 @@ const struct i2c_port_t i2c_ports[] = { GPIO_EC_I2C_USB_C0_PD_SDA}, {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL, GPIO_EC_I2C_USB_C1_PD_SDA}, - {"wlc", I2C_PORT_WLC, 1000, GPIO_EC_I2C_WLC_SCL, + {"wlc", I2C_PORT_WLC, 400, GPIO_EC_I2C_WLC_SCL, GPIO_EC_I2C_WLC_SDA}, {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL, GPIO_EC_I2C_EEPROM_SDA}, diff --git a/board/coachz/board.h b/board/coachz/board.h index 072ff42a04..10b72093cb 100644 --- a/board/coachz/board.h +++ b/board/coachz/board.h @@ -54,6 +54,11 @@ #define GPIO_KS_ATTACHED_L GPIO_LID_INT_N_HALL1 #define GPIO_KS_OPEN GPIO_LID_INT_N_HALL2 +/* WLC pins */ +#define GPIO_PCHG_P0 GPIO_WLC_IRQ_CONN +#define CONFIG_PERIPHERAL_CHARGER +#define CONFIG_CTN730 + #ifndef __ASSEMBLER__ #include "gpio_signal.h" diff --git a/board/coachz/ec.tasklist b/board/coachz/ec.tasklist index 49e7fb11c6..dc5b32b4cf 100644 --- a/board/coachz/ec.tasklist +++ b/board/coachz/ec.tasklist @@ -9,6 +9,7 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, ULTRA_TASK_STACK_SIZE) \ + TASK_ALWAYS(PCHG, pchg_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, ULTRA_TASK_STACK_SIZE) \ diff --git a/board/coachz/gpio.inc b/board/coachz/gpio.inc index ec406b4fea..dc8eacdb26 100644 --- a/board/coachz/gpio.inc +++ b/board/coachz/gpio.inc @@ -28,6 +28,10 @@ GPIO_INT(AP_RST_L, PIN(C, 1), GPIO_INT_BOTH | GPIO_SEL_1P8V, chipset_ap GPIO_INT(PS_HOLD, PIN(A, 4), GPIO_INT_BOTH | GPIO_PULL_DOWN, power_signal_interrupt) /* Indicate when AP triggers reset/shutdown */ GPIO_INT(AP_SUSPEND, PIN(5, 7), GPIO_INT_BOTH, power_signal_interrupt) /* Suspend signal from PMIC */ GPIO_INT(DEPRECATED_AP_RST_REQ, PIN(C, 2), GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL_1P8V, power_signal_interrupt) /* Deprecated AP initiated reset indicator */ + +/* WLC interrupt */ +GPIO_INT(WLC_IRQ_CONN, PIN(7, 4), GPIO_INT_RISING, pchg_irq) + /* * When switch-cap is off, the POWER_GOOD signal is floating. Need a pull-down * to make it low. Overload the interrupt function chipset_warm_reset_interrupt @@ -72,7 +76,6 @@ GPIO(CAM_LED, PIN(3, 0), GPIO_INPUT) /* Stylus */ /* TODO(b/168652326): Implement the WLC controls */ -GPIO(WLC_IRQ_CONN, PIN(7, 4), GPIO_INPUT) GPIO(WLC_NRST_CONN, PIN(C, 5), GPIO_INPUT) /* Base detection */ |