summaryrefslogtreecommitdiff
path: root/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/projects/trogdor/lazor/src/usb_pd_policy.c')
-rw-r--r--zephyr/projects/trogdor/lazor/src/usb_pd_policy.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c b/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c
index b94a65005a..8d046826f9 100644
--- a/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c
+++ b/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -24,10 +24,10 @@ int pd_check_vconn_swap(int port)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
#if CONFIG_USB_PD_PORT_MAX_COUNT == 1
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5 };
#else
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
#endif
static void board_vbus_update_source_current(int port)
@@ -108,11 +108,11 @@ __override int svdm_dp_config(int port, uint32_t *payload)
* (3) plug a monitor to the port-1 dongle.
*/
- payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
- CMD_DP_CONFIG | VDO_OPOS(opos));
- payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */
- 1, /* DPv1.3 signaling */
- 2); /* UFP connected */
+ payload[0] =
+ VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_CONFIG | VDO_OPOS(opos));
+ payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */
+ 1, /* DPv1.3 signaling */
+ 2); /* UFP connected */
return 2;
};
@@ -175,8 +175,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
* TODO(waihong): Better to move switching DP mux to
* the usb_mux abstraction.
*/
- gpio_pin_set_dt(
- GPIO_DT_FROM_NODELABEL(gpio_dp_mux_sel), port == 1);
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_dp_mux_sel),
+ port == 1);
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_dp_mux_oe_l), 0);
/* Connect the SBU lines in PPC chip. */
@@ -190,8 +190,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
* because of the board USB-C topology (limited to 2
* lanes DP).
*/
- usb_mux_set(port, USB_PD_MUX_DOCK,
- USB_SWITCH_CONNECT,
+ usb_mux_set(port, USB_PD_MUX_DOCK, USB_SWITCH_CONNECT,
polarity_rm_dts(pd_get_polarity(port)));
} else {
/* Disconnect the DP port selection mux. */
@@ -203,13 +202,11 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
ppc_set_sbu(port, 0);
/* Disconnect the DP but keep the USB SS lines in TCPC chip. */
- usb_mux_set(port, USB_PD_MUX_USB_ENABLED,
- USB_SWITCH_CONNECT,
+ usb_mux_set(port, USB_PD_MUX_USB_ENABLED, USB_SWITCH_CONNECT,
polarity_rm_dts(pd_get_polarity(port)));
}
- if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- (irq || lvl))
+ if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) && (irq || lvl))
/*
* Wake up the AP. IRQ or level high indicates a DP sink is now
* present.
@@ -234,8 +231,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
gpio_pin_set_dt(hpd, 1);
/* Set the minimum time delay (2ms) for the next HPD IRQ */
- svdm_hpd_deadline[port] = get_time().val +
- HPD_USTREAM_DEBOUNCE_LVL;
+ svdm_hpd_deadline[port] =
+ get_time().val + HPD_USTREAM_DEBOUNCE_LVL;
} else if (irq & !lvl) {
CPRINTF("ERR:HPD:IRQ&LOW\n");
return 0;
@@ -256,9 +253,9 @@ __override void svdm_exit_dp_mode(int port)
/* Signal AP for the HPD low event */
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
- gpio_pin_set_dt(
- GPIO_DT_FROM_NODELABEL(gpio_dp_hot_plug_det), 0);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_dp_hot_plug_det),
+ 0);
}
}
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */