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

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

Merge "usb: pd: Don't wait to send outgoing requests in PE_SRC/SNK_READY"

parents 6423979a a3bfa489
Loading
Loading
Loading
Loading
+24 −4
Original line number Original line Diff line number Diff line
@@ -2722,15 +2722,19 @@ static void usbpd_sm(struct work_struct *w)
		if (IS_CTRL(rx_msg, MSG_GET_SOURCE_CAP)) {
		if (IS_CTRL(rx_msg, MSG_GET_SOURCE_CAP)) {
			pd->current_state = PE_SRC_SEND_CAPABILITIES;
			pd->current_state = PE_SRC_SEND_CAPABILITIES;
			kick_sm(pd, 0);
			kick_sm(pd, 0);
			break;
		} else if (IS_CTRL(rx_msg, MSG_GET_SINK_CAP)) {
		} else if (IS_CTRL(rx_msg, MSG_GET_SINK_CAP)) {
			ret = pd_send_msg(pd, MSG_SINK_CAPABILITIES,
			ret = pd_send_msg(pd, MSG_SINK_CAPABILITIES,
					pd->sink_caps, pd->num_sink_caps,
					pd->sink_caps, pd->num_sink_caps,
					SOP_MSG);
					SOP_MSG);
			if (ret)
			if (ret) {
				usbpd_set_state(pd, PE_SEND_SOFT_RESET);
				usbpd_set_state(pd, PE_SEND_SOFT_RESET);
				break;
			}
		} else if (IS_DATA(rx_msg, MSG_REQUEST)) {
		} else if (IS_DATA(rx_msg, MSG_REQUEST)) {
			pd->rdo = *(u32 *)rx_msg->payload;
			pd->rdo = *(u32 *)rx_msg->payload;
			usbpd_set_state(pd, PE_SRC_NEGOTIATE_CAPABILITY);
			usbpd_set_state(pd, PE_SRC_NEGOTIATE_CAPABILITY);
			break;
		} else if (IS_CTRL(rx_msg, MSG_DR_SWAP)) {
		} else if (IS_CTRL(rx_msg, MSG_DR_SWAP)) {
			if (pd->vdm_state == MODE_ENTERED) {
			if (pd->vdm_state == MODE_ENTERED) {
				usbpd_set_state(pd, PE_SRC_HARD_RESET);
				usbpd_set_state(pd, PE_SRC_HARD_RESET);
@@ -2764,6 +2768,8 @@ static void usbpd_sm(struct work_struct *w)
			vconn_swap(pd);
			vconn_swap(pd);
		} else if (IS_DATA(rx_msg, MSG_VDM)) {
		} else if (IS_DATA(rx_msg, MSG_VDM)) {
			handle_vdm_rx(pd, rx_msg);
			handle_vdm_rx(pd, rx_msg);
			if (pd->vdm_tx) /* response sent after delay */
				break;
		} else if (IS_CTRL(rx_msg, MSG_GET_SOURCE_CAP_EXTENDED)) {
		} else if (IS_CTRL(rx_msg, MSG_GET_SOURCE_CAP_EXTENDED)) {
			handle_get_src_cap_extended(pd);
			handle_get_src_cap_extended(pd);
		} else if (IS_EXT(rx_msg, MSG_GET_BATTERY_CAP)) {
		} else if (IS_EXT(rx_msg, MSG_GET_BATTERY_CAP)) {
@@ -2784,7 +2790,13 @@ static void usbpd_sm(struct work_struct *w)
			if (ret)
			if (ret)
				usbpd_set_state(pd, PE_SEND_SOFT_RESET);
				usbpd_set_state(pd, PE_SEND_SOFT_RESET);
			break;
			break;
		} else if (pd->send_pr_swap) {
		}

		if (pd->current_state != PE_SRC_READY)
			break;

		/* handle outgoing requests */
		if (pd->send_pr_swap) {
			pd->send_pr_swap = false;
			pd->send_pr_swap = false;
			ret = pd_send_msg(pd, MSG_PR_SWAP, NULL, 0, SOP_MSG);
			ret = pd_send_msg(pd, MSG_PR_SWAP, NULL, 0, SOP_MSG);
			if (ret) {
			if (ret) {
@@ -2809,6 +2821,7 @@ static void usbpd_sm(struct work_struct *w)
		} else {
		} else {
			start_src_ams(pd, false);
			start_src_ams(pd, false);
		}
		}

		break;
		break;


	case PE_SRC_TRANSITION_TO_DEFAULT:
	case PE_SRC_TRANSITION_TO_DEFAULT:
@@ -3053,6 +3066,7 @@ static void usbpd_sm(struct work_struct *w)
			break;
			break;
		} else if (IS_DATA(rx_msg, MSG_VDM)) {
		} else if (IS_DATA(rx_msg, MSG_VDM)) {
			handle_vdm_rx(pd, rx_msg);
			handle_vdm_rx(pd, rx_msg);
			if (pd->vdm_tx) /* response sent after delay */
				break;
				break;
		} else if (IS_DATA(rx_msg, MSG_ALERT)) {
		} else if (IS_DATA(rx_msg, MSG_ALERT)) {
			u32 ado;
			u32 ado;
@@ -3188,7 +3202,13 @@ static void usbpd_sm(struct work_struct *w)
			} else if (pd->send_request) {
			} else if (pd->send_request) {
				pd->send_request = false;
				pd->send_request = false;
				usbpd_set_state(pd, PE_SNK_SELECT_CAPABILITY);
				usbpd_set_state(pd, PE_SNK_SELECT_CAPABILITY);
			} else if (pd->send_pr_swap) {
			}

			if (pd->current_state != PE_SNK_READY)
				break;

			/* handle outgoing requests */
			if (pd->send_pr_swap) {
				pd->send_pr_swap = false;
				pd->send_pr_swap = false;
				ret = pd_send_msg(pd, MSG_PR_SWAP, NULL, 0,
				ret = pd_send_msg(pd, MSG_PR_SWAP, NULL, 0,
						SOP_MSG);
						SOP_MSG);