Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3cb11ed authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: pd: Only enable SOP' reception when acting as VCONN source"

parents 2cd0964f fa06d2c8
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -1201,7 +1201,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state)
		.msg_rx_cb		= phy_msg_received,
		.shutdown_cb		= phy_shutdown,
		.frame_filter_val	= FRAME_FILTER_EN_SOP |
					  FRAME_FILTER_EN_SOPI |
					  FRAME_FILTER_EN_HARD_RESET,
	};
	union power_supply_propval val = {0};
@@ -1263,6 +1262,10 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state)
			phy_params.data_role = pd->current_dr;
			phy_params.power_role = pd->current_pr;

			if (pd->vconn_enabled)
				phy_params.frame_filter_val |=
					FRAME_FILTER_EN_SOPI;

			ret = pd_phy_open(&phy_params);
			if (ret) {
				WARN_ON_ONCE(1);
@@ -1450,6 +1453,10 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state)
			phy_params.data_role = pd->current_dr;
			phy_params.power_role = pd->current_pr;

			if (pd->vconn_enabled)
				phy_params.frame_filter_val |=
					FRAME_FILTER_EN_SOPI;

			ret = pd_phy_open(&phy_params);
			if (ret) {
				WARN_ON_ONCE(1);
@@ -2008,6 +2015,9 @@ static void vconn_swap(struct usbpd *pd)
	int ret;

	if (pd->vconn_enabled) {
		pd_phy_update_frame_filter(FRAME_FILTER_EN_SOP |
					   FRAME_FILTER_EN_HARD_RESET);

		pd->current_state = PE_VCS_WAIT_FOR_VCONN;
		kick_sm(pd, VCONN_ON_TIME);
	} else {
@@ -2026,6 +2036,10 @@ static void vconn_swap(struct usbpd *pd)

		pd->vconn_enabled = true;

		pd_phy_update_frame_filter(FRAME_FILTER_EN_SOP |
					   FRAME_FILTER_EN_SOPI |
					   FRAME_FILTER_EN_HARD_RESET);

		/*
		 * Small delay to ensure Vconn has ramped up. This is well
		 * below tVCONNSourceOn (100ms) so we still send PS_RDY within
+8 −0
Original line number Diff line number Diff line
@@ -347,6 +347,14 @@ int pd_phy_update_roles(enum data_role dr, enum power_role pr)
}
EXPORT_SYMBOL(pd_phy_update_roles);

int pd_phy_update_frame_filter(u8 frame_filter_val)
{
	struct usb_pdphy *pdphy = __pdphy;

	return pdphy_reg_write(pdphy, USB_PDPHY_FRAME_FILTER, frame_filter_val);
}
EXPORT_SYMBOL(pd_phy_update_frame_filter);

int pd_phy_open(struct pd_phy_params *params)
{
	int ret;
+6 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ int pd_phy_signal(enum pd_sig_type sig);
int pd_phy_write(u16 hdr, const u8 *data, size_t data_len,
		enum pd_sop_type sop);
int pd_phy_update_roles(enum data_role dr, enum power_role pr);
int pd_phy_update_frame_filter(u8 frame_filter_val);
void pd_phy_close(void);
#else
static inline int pd_phy_open(struct pd_phy_params *params)
@@ -100,6 +101,11 @@ static inline int pd_phy_update_roles(enum data_role dr, enum power_role pr)
	return -ENODEV;
}

static inline int pd_phy_update_frame_filter(u8 frame_filter_val)
{
	return -ENODEV;
}

static inline void pd_phy_close(void)
{
}