From 99ab4a3b1f98f9335656f708e5ab6208553e7611 Mon Sep 17 00:00:00 2001 From: Ting Shen Date: Tue, 14 Feb 2023 15:56:57 +0800 Subject: geralt: disable bc1.2 Remove CONFIG_USB_CHARGER and hide related driver code inside #ifdef. BUG=b:267989266 TEST=no USB_CHG task in `kernel thread` BRANCH=none LOW_COVERAGE_REASON=early bringup Change-Id: Iebd80267f64149fde148a436212c9998824c6564 Signed-off-by: Ting Shen Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4248932 Tested-by: Ting Shen Reviewed-by: Eric Yilun Lin Commit-Queue: Ting Shen --- driver/charger/rt9490.c | 2 ++ driver/ppc/rt1739.c | 6 ++++++ zephyr/program/geralt/i2c.dtsi | 1 - zephyr/program/geralt/interrupts.dtsi | 5 ----- zephyr/program/geralt/program.conf | 2 +- zephyr/program/geralt/src/usb_pd_policy.c | 2 +- zephyr/program/geralt/usbc.dtsi | 2 -- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/driver/charger/rt9490.c b/driver/charger/rt9490.c index 016ef12d44..e37c65dc1c 100644 --- a/driver/charger/rt9490.c +++ b/driver/charger/rt9490.c @@ -635,6 +635,7 @@ const struct charger_drv rt9490_drv = { #endif }; +#ifdef CONFIG_USB_CHARGER /* BC1.2 */ static int rt9490_get_bc12_ilim(enum charge_supplier supplier) { @@ -790,6 +791,7 @@ struct bc12_config bc12_ports[CHARGE_PORT_COUNT] = { }, }; #endif /* CONFIG_BC12_SINGLE_DRIVER */ +#endif /* CONFIG_USB_CHARGER */ int rt9490_get_thermistor_val(const struct temp_sensor_t *sensor, int *temp_ptr) { diff --git a/driver/ppc/rt1739.c b/driver/ppc/rt1739.c index c660320b9b..e85f4f6202 100644 --- a/driver/ppc/rt1739.c +++ b/driver/ppc/rt1739.c @@ -316,6 +316,7 @@ static int rt1739_init(int port) return EC_SUCCESS; } +#ifdef CONFIG_USB_CHARGER static int rt1739_get_bc12_ilim(int charge_supplier) { switch (charge_supplier) { @@ -413,6 +414,7 @@ static void rt1739_usb_charger_task_event(const int port, uint32_t evt) rt1739_enable_bc12_detection(port, false); } } +#endif /* CONFIG_USB_CHARGER */ static atomic_t pending_events; @@ -434,8 +436,10 @@ void rt1739_deferred_interrupt(void) if (read_reg(port, RT1739_REG_INT_EVENT5, &event5)) continue; +#ifdef CONFIG_USB_CHARGER if (event5 & RT1739_BC12_SNK_DONE_INT) usb_charger_task_set_event(port, USB_CHG_EVENT_BC12); +#endif /* CONFIG_USB_CHARGER */ /* write to clear EVENT4 since FRS interrupt has been handled */ write_reg(port, RT1739_REG_INT_EVENT4, event4); @@ -476,6 +480,7 @@ const struct ppc_drv rt1739_ppc_drv = { .interrupt = &rt1739_interrupt, }; +#ifdef CONFIG_USB_CHARGER const struct bc12_drv rt1739_bc12_drv = { .usb_charger_task_init = rt1739_usb_charger_task_init, .usb_charger_task_event = rt1739_usb_charger_task_event, @@ -489,3 +494,4 @@ struct bc12_config bc12_ports[CHARGE_PORT_COUNT] = { }, }; #endif /* CONFIG_BC12_SINGLE_DRIVER */ +#endif /* CONFIG_USB_CHARGER */ diff --git a/zephyr/program/geralt/i2c.dtsi b/zephyr/program/geralt/i2c.dtsi index cc2e6f6bdf..cf36d68ef9 100644 --- a/zephyr/program/geralt/i2c.dtsi +++ b/zephyr/program/geralt/i2c.dtsi @@ -64,7 +64,6 @@ compatible = "richtek,rt9490"; status = "okay"; reg = <0x53>; - irq = <&int_usb_c1_bc12_charger>; }; }; diff --git a/zephyr/program/geralt/interrupts.dtsi b/zephyr/program/geralt/interrupts.dtsi index d808020e5c..308a707b52 100644 --- a/zephyr/program/geralt/interrupts.dtsi +++ b/zephyr/program/geralt/interrupts.dtsi @@ -51,11 +51,6 @@ flags = ; handler = "extpower_interrupt"; }; - int_usb_c1_bc12_charger: usb-c1-bc12-charger { - irq-pin = <&usb_c1_bc12_charger_int_odl>; - flags = ; - handler = "rt9490_bc12_dt_interrupt"; - }; int_lid_open: lid-open { irq-pin = <&lid_open>; flags = ; diff --git a/zephyr/program/geralt/program.conf b/zephyr/program/geralt/program.conf index f9e2b8c1fd..3394f85b82 100644 --- a/zephyr/program/geralt/program.conf +++ b/zephyr/program/geralt/program.conf @@ -145,7 +145,7 @@ CONFIG_TASK_MOTIONSENSE_STACK_SIZE=1024 CONFIG_TASK_PD_STACK_SIZE=1280 # USB-C -CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER=n +CONFIG_PLATFORM_EC_USB_CHARGER=n CONFIG_PLATFORM_EC_USBC_PPC_SYV682C=y CONFIG_PLATFORM_EC_USB_MUX_TUSB546=y CONFIG_PLATFORM_EC_USB_PD_DISCHARGE_PPC=y diff --git a/zephyr/program/geralt/src/usb_pd_policy.c b/zephyr/program/geralt/src/usb_pd_policy.c index c445fc0e22..72558b50d6 100644 --- a/zephyr/program/geralt/src/usb_pd_policy.c +++ b/zephyr/program/geralt/src/usb_pd_policy.c @@ -18,7 +18,7 @@ int pd_check_vconn_swap(int port) int pd_snk_is_vbus_provided(int port) { - static atomic_t vbus_prev[CONFIG_USB_PD_PORT_MAX_COUNT]; + __maybe_unused static atomic_t vbus_prev[CONFIG_USB_PD_PORT_MAX_COUNT]; int vbus; /* diff --git a/zephyr/program/geralt/usbc.dtsi b/zephyr/program/geralt/usbc.dtsi index 88e29a6b27..fd26638873 100644 --- a/zephyr/program/geralt/usbc.dtsi +++ b/zephyr/program/geralt/usbc.dtsi @@ -11,7 +11,6 @@ port0@0 { compatible = "named-usbc-port"; reg = <0>; - bc12 = <&bc12_ppc_port0>; ppc = <&bc12_ppc_port0>; tcpc = <&usbpd0>; chg = <&charger_bc12_port1>; @@ -29,7 +28,6 @@ port1@1 { compatible = "named-usbc-port"; reg = <1>; - bc12 = <&charger_bc12_port1>; ppc = <&ppc_port1>; tcpc = <&usbpd1>; usb-mux-chain-1 { -- cgit v1.2.1