From patchwork Mon Jul 12 06:10:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 475667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5054C07E9E for ; Mon, 12 Jul 2021 07:20:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B068261402 for ; Mon, 12 Jul 2021 07:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242927AbhGLHXq (ORCPT ); Mon, 12 Jul 2021 03:23:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:32870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242446AbhGLHWR (ORCPT ); Mon, 12 Jul 2021 03:22:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 183B660C40; Mon, 12 Jul 2021 07:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074369; bh=+YGAxHpyvw/k/kJdOcc4VCHCnFA4RS2PxkSKHExu8cM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AP97KsHZSd1IwdGqLdV8T30k81BC5XOErrJJHF1ely25QhEIng5DW6qGC9rHUCemO +abPISbNLyBe6iFK+2wveL6nhMfeYtYMcPkiN1xLPp0KZHfOXmNKBvwTgumC+dh72O tPFHIQnxRQR0VmG17mIItBwoI0qRSvVIQ9Tjjs18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Heikki Krogerus , Badhri Jagan Sridharan , Sasha Levin Subject: [PATCH 5.12 557/700] usb: typec: tcpm: Fix up PR_SWAP when vsafe0v is signalled Date: Mon, 12 Jul 2021 08:10:40 +0200 Message-Id: <20210712061035.477249093@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Badhri Jagan Sridharan [ Upstream commit d112efbe6dbf7d4c482e2a3f381fa315aabfe63b ] During PR_SWAP, When TCPM is in PR_SWAP_SNK_SRC_SINK_OFF, vbus is expected to reach VSAFE0V when source turns off vbus. Do not move to SNK_UNATTACHED state when this happens. Fixes: 28b43d3d746b ("usb: typec: tcpm: Introduce vsafe0v for vbus") Reviewed-by: Guenter Roeck Acked-by: Heikki Krogerus Signed-off-by: Badhri Jagan Sridharan Link: https://lore.kernel.org/r/20210517192112.40934-1-badhri@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/tcpm/tcpm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index a57047d7fac8..07dee0118c27 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5187,6 +5187,9 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) tcpm_set_state(port, SNK_UNATTACHED, 0); } break; + case PR_SWAP_SNK_SRC_SINK_OFF: + /* Do nothing, vsafe0v is expected during transition */ + break; default: if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) tcpm_set_state(port, SNK_UNATTACHED, 0);