Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1100838pxj; Sat, 15 May 2021 04:01:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKeYDW/F7YeiiVxVHkrnBAM47nIvLxtMrugmKB1qRlwOvCeSaQgoROT4rEsysfsIYiKxZh X-Received: by 2002:a05:6638:3bc:: with SMTP id z28mr46553493jap.133.1621076472835; Sat, 15 May 2021 04:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621076472; cv=none; d=google.com; s=arc-20160816; b=f7hbnwdgZzaue0/x3VawjKiXvekOwi3+d1NLnsz4lMwwDf86RxXvFy/I4xGkLOLVOv IN4LEPsDJZWPGC56ajX7bxs2G8FuIOtWoDIM65vOmTpgaOTFbShjzvhp/0NVcgt4nGrN k/HLXHmghy4ENzwaVy1kIdcpTDV5q6J18O/eb4wXFYJuP4aAq79cb4Un8P1+E+3JXdjM kEda44p/GVwKDANt3Mnn3BFaS0rg7sLZPgUtnqdpZRYEW5JyiKHXJI0y0FSUKYhS0RNV E8zEA608XCojRqHm3vHJI+6sr9phvTMLFRcqcKV+J4rREf4Uf/VnK45cEtbO4mukyJNN EdEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=sNHIuQYVsWA/7a4mAAkQImBcT2qMojEQX5dVrrYWLcM=; b=1JJuBdgzCITBDNl+EMtwJ67ZcZ4vH0SGksYvG5IkwnDV0IrPnwk0p6OQRZCk1OYxwP RSZ0Rdol1FO6GPfBf+3IZiPdU7VF4cAAZgXHylpHErfC3xqPpT/U94+6HAfGQ2JTyYwR QLdCeLXAJSgWgCGxR9JjvZ6jfN6SfYQek9p3JzbLDjozq4ozxOjkxtqirCvJCJGd8D8E sbCNxjpCyeXSIKYIvY7WGrbrHzz7oP42YkA2jCyodrkrHRBKK1nFRoD8zu5Q2eq91pam /42Nlla2VhvAIqHyF1NEypA77UwjJmoZr+TzQl46utv0vuFdG3DS/9ZHkNfY/tiQvAVg WKnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oMGbgtK3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si11434793jal.41.2021.05.15.04.01.00; Sat, 15 May 2021 04:01:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oMGbgtK3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233959AbhEOF1c (ORCPT + 99 others); Sat, 15 May 2021 01:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbhEOF1a (ORCPT ); Sat, 15 May 2021 01:27:30 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E218C061756 for ; Fri, 14 May 2021 22:26:18 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id e75-20020a25d34e0000b02904f982184581so1922288ybf.4 for ; Fri, 14 May 2021 22:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=sNHIuQYVsWA/7a4mAAkQImBcT2qMojEQX5dVrrYWLcM=; b=oMGbgtK3hrH/5fPQWLdrW3KsbCwX3axogu6RA7twsgK5yjdE+4mL5hNjbVbEKnkBjT mPcgm4zODQ18yFDxmT5Vp3ZE1vdkEetuj1Y+D3itJtG8QwZ5Rufa1kuztrtCRWv57gxz C7TfWeSmBTZy9f9weM0S3xUSONdocKJUBwY3tp63YWWAjKipKzovYikfyX3rvzfkCUbs GZJh8jStGvIKLqDvCncenDCQfVskSZqvR0kxghS6cWM2++iD+gc633rap5yBDFpuBZJF q5QsTI1zSkl5lcoSbhjlAnYGuP4N7yQH5e6/glIh7kt3N11KIjeinMgWFvJ4Fj+ysMhc lpZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=sNHIuQYVsWA/7a4mAAkQImBcT2qMojEQX5dVrrYWLcM=; b=O3/aoLgVTOWgCHfnB7n0qxQfk0cMAxE76W7UOZWgRbJ7cp+kN2KMbMMXi3XvGd2x+j LYsTzdzDJ1q9Vo/BU3TnUTGnbcWJ125f4DHC0dsiAww55ebkctMKcqdQZJPESZJrAX/s zpBZcxtufQxwNBGItrj8143llaRJAsxHsLxlB5P7WH2uoboHHnfMoM9cKBI9oSQTOTWF tFjFtULWInxsNoQzIN+fxNi5b6T4SJOFFgVobEz5PoYXX1am9euSVJJArVYVn0rWe2ef 2GQLiLpSVL6er/LV3eWIBDptstsSKAjQx6m7hHRu6tUF/T5Kp/5QnUTH1WJOkq8O09fb c3Wg== X-Gm-Message-State: AOAM533cyyWZI+8rS+mUmSVWNpfzvipb5qXvVmfVfaOJVpuZhiChCjxQ MtfrujKRCu9N1Qk2DLBw4s8E+7x6RVQ= X-Received: from badhri.mtv.corp.google.com ([2620:15c:211:201:6bd1:251e:e226:7071]) (user=badhri job=sendgmr) by 2002:a25:9942:: with SMTP id n2mr70156951ybo.230.1621056377552; Fri, 14 May 2021 22:26:17 -0700 (PDT) Date: Fri, 14 May 2021 22:26:10 -0700 Message-Id: <20210515052613.3261340-1-badhri@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v1 1/4] usb: typec: tcpm: Fix up PR_SWAP when vsafe0v is signalled From: Badhri Jagan Sridharan To: Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kyle Tso , stable@vger.kernel.org, Badhri Jagan Sridharan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org During PR_SWAP, When TCPM is in PR_SWAP_SNK_SRC_SINK_OFF, vbus is expected to reach VSAFE0V when source turns of vbus. Do not move to SNK_UNATTACHED state when this happens. Fixes: 28b43d3d746b ("usb: typec: tcpm: Introduce vsafe0v for vbus") Signed-off-by: Badhri Jagan Sridharan --- 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 c4fdc00a3bc8..b93c4c8d7b15 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5114,6 +5114,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); -- 2.31.1.751.gd2f1c929bd-goog