Message ID | 20230712085722.1414743-1-badhri@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1017833vqm; Wed, 12 Jul 2023 02:17:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlGs+4B3cqv5vGL3I6uo7PEhN34vKYsh9824kCPzwPDJw7fmlKaACQsppM5IQa++i0HXrWLF X-Received: by 2002:a05:6808:23d3:b0:399:8529:6726 with SMTP id bq19-20020a05680823d300b0039985296726mr19776297oib.51.1689153455824; Wed, 12 Jul 2023 02:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689153455; cv=none; d=google.com; s=arc-20160816; b=xEJtwkdX9yMi/Wpn8pnWsm6pB9btcK2+e06OG15OylhKn/Tm8lVBYfwTOKqYOgKY5h eggAEgSuyJLBanAUaa34fi2sZuRjhwxsms95V+acX30bnZm7LfBEmlieZw/C13QoWTMV n4RnwN+3DW7nuU4Zmdp6YFLlr+9MZiy4VPrufvTxrquX3SCe1hed+0ZvqwcOPodnX6YI nLHEj1a3BO8LFO5FZY3a524KweJZZJDlh4h62SgOF3/0cCPfaeiPfQSAlcyyK1L66oX7 E7BKyX+NadKQvoR3WkESncu8wo9e0SbB+do4ZfAIC2rtGorD8xTKzbafqCPWCvpKx+6f 1FhQ== 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:message-id:mime-version:date :dkim-signature; bh=o7IxMgsm10wM4UtHG5ILit3AGY4PCAIXBMJb8LPTjZE=; fh=ZFQ+3VQA2j9ujA0rxpgaHSRFqelJrXrFfQ0yYcV3AJE=; b=rnZxlTCN017yFHb1qyILxOAjoIJwBfiWLtYAMptv+6iyAcMx6v6j8K+6zV746gaVD5 CEQe3r355ezQ/lPuuLBsApVLGywqGexzcvfGQZiUjcCTJhMc4QBanO0Cq9d0QHIIqXA1 LfjgnE91x2+FcrxpqFigxdMRQH4FmoyrwPRjpRdZqPwLZlCyVywk1/n1/9FMvsgyB1wO FJiFeQZzxq262eMNtsnBn/rjEjZ32CmpxVNfUDbDyKr2NX/Lj0AygRBwMuW+irlxJUvV j/HIMKglLRBm+ssEbliUIPcX5RwRgcQBx+lwGGH02nKYxUCFBhGY9y2QR1k1pgzivxiU IFYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=5SdejOJp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c38-20020a631c26000000b0053fb7968569si2741086pgc.429.2023.07.12.02.17.22; Wed, 12 Jul 2023 02:17:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=5SdejOJp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230398AbjGLI7C (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Wed, 12 Jul 2023 04:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233104AbjGLI6l (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 12 Jul 2023 04:58:41 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE00E2D72 for <linux-kernel@vger.kernel.org>; Wed, 12 Jul 2023 01:57:27 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-55c19420827so5015401a12.0 for <linux-kernel@vger.kernel.org>; Wed, 12 Jul 2023 01:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689152247; x=1691744247; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=o7IxMgsm10wM4UtHG5ILit3AGY4PCAIXBMJb8LPTjZE=; b=5SdejOJp8VU3CbfzVdHrFiUZy9Sg2fjsaM+37a7NbRb4J1uX2H6b2OTG4pByTROd4n spndSk5E/mTZ4GyVd7gmmxlztHqqrkvhK8pdSQaLHrmF5OjkH1Gb9fBZ0FuPpZw7xju6 zsdil8YofrGOKzU+l/Bcu9XbmzATqHHwdkqiggXgwUd9hPnMsM3cg5pLs88E9okRVwcv U1Ml4d0AB4ZVhhKVe3ArL7v0tydYALwE5r9vaklttinSnPMQb/gsTCnw0jj+xGIpJvy8 2G+S+XvC89+gqJuVZRRF4GUjjtEjQt5JI+BHAC/uEb+DEMDIRp4vw9ttfXknF1G3wYSo QohQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689152247; x=1691744247; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=o7IxMgsm10wM4UtHG5ILit3AGY4PCAIXBMJb8LPTjZE=; b=YkNbR+20HpqvHvuUGrpuaQcZIUB1qOje5u74KRdseA2mhYJdWb0wyfD+YGBtSOWPbq MUteMNBxrElitjINMu4vefryerB88sL90/Y9+S9tKzFS+mY4rc3jeBE8ptSCEUhtQmM9 gUOX/ITpA4e0wPwg/Rmp5sDQ5BCJ5A8icVpDtwl52R5dJbzJoKNJTnpph1BJhQjNTgSG WDWGVuh0iCmpsQ3PAzRq8GSKdZtEFrZqcS6ZxzYwbkAIz0DNvbmvheD7L8AmeOEg0MDo YzcEbcxDlcVnvsjkPrf0LFNTYhTc0NuIcs2QZ3jePwCxIcGA8p2QsLg5W5D2it8fgJP0 7ezw== X-Gm-Message-State: ABy/qLafxmMbuWPSJot8XWnrlcRX0zYSbfLQ7t06A0N3qlT32tkHHPaG HStAGu8k/GDVe+z4ZmT2SOPTcyONQPw= X-Received: from badhri.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:6442]) (user=badhri job=sendgmr) by 2002:a65:6a84:0:b0:55a:e746:31ef with SMTP id q4-20020a656a84000000b0055ae74631efmr10155877pgu.1.1689152246932; Wed, 12 Jul 2023 01:57:26 -0700 (PDT) Date: Wed, 12 Jul 2023 08:57:22 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230712085722.1414743-1-badhri@google.com> Subject: [PATCH v1] usb: typec: tcpm: Fix response to vsafe0V event From: Badhri Jagan Sridharan <badhri@google.com> To: gregkh@linuxfoundation.org, linux@roeck-us.net, heikki.krogerus@linux.intel.com, kyletso@google.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Badhri Jagan Sridharan <badhri@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771205774169737255 X-GMAIL-MSGID: 1771205774169737255 |
Series |
[v1] usb: typec: tcpm: Fix response to vsafe0V event
|
|
Commit Message
Badhri Jagan Sridharan
July 12, 2023, 8:57 a.m. UTC
Do not transition to SNK_UNATTACHED state when receiving vsafe0v event
while in SNK_HARD_RESET_WAIT_VBUS. Ignore VBUS off events as well as
in some platforms VBUS off can be signalled more than once.
[143515.364753] Requesting mux state 1, usb-role 2, orientation 2
[143515.365520] pending state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_SINK_ON @ 650 ms [rev3 HARD_RESET]
[143515.632281] CC1: 0 -> 0, CC2: 3 -> 0 [state SNK_HARD_RESET_SINK_OFF, polarity 1, disconnected]
[143515.637214] VBUS on
[143515.664985] VBUS off
[143515.664992] state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_WAIT_VBUS [rev3 HARD_RESET]
[143515.665564] VBUS VSAFE0V
[143515.665566] state change SNK_HARD_RESET_WAIT_VBUS -> SNK_UNATTACHED [rev3 HARD_RESET]
Fixes: 28b43d3d746b ("usb: typec: tcpm: Introduce vsafe0v for vbus")
Cc: <stable@vger.kernel.org>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
---
drivers/usb/typec/tcpm/tcpm.c | 7 +++++++
1 file changed, 7 insertions(+)
base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
Comments
Hi, I'm sorry to keep you waiting. On Wed, Jul 12, 2023 at 08:57:22AM +0000, Badhri Jagan Sridharan wrote: > Do not transition to SNK_UNATTACHED state when receiving vsafe0v event > while in SNK_HARD_RESET_WAIT_VBUS. Ignore VBUS off events as well as > in some platforms VBUS off can be signalled more than once. > > [143515.364753] Requesting mux state 1, usb-role 2, orientation 2 > [143515.365520] pending state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_SINK_ON @ 650 ms [rev3 HARD_RESET] > [143515.632281] CC1: 0 -> 0, CC2: 3 -> 0 [state SNK_HARD_RESET_SINK_OFF, polarity 1, disconnected] > [143515.637214] VBUS on > [143515.664985] VBUS off > [143515.664992] state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_WAIT_VBUS [rev3 HARD_RESET] > [143515.665564] VBUS VSAFE0V > [143515.665566] state change SNK_HARD_RESET_WAIT_VBUS -> SNK_UNATTACHED [rev3 HARD_RESET] > > Fixes: 28b43d3d746b ("usb: typec: tcpm: Introduce vsafe0v for vbus") > Cc: <stable@vger.kernel.org> > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/tcpm/tcpm.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 829d75ebab42..cc1d83926497 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -5349,6 +5349,10 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) > /* Do nothing, vbus drop expected */ > break; > > + case SNK_HARD_RESET_WAIT_VBUS: > + /* Do nothing, its OK to receive vbus off events */ > + break; > + > default: > if (port->pwr_role == TYPEC_SINK && port->attached) > tcpm_set_state(port, SNK_UNATTACHED, tcpm_wait_for_discharge(port)); > @@ -5395,6 +5399,9 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) > case SNK_DEBOUNCED: > /*Do nothing, still waiting for VSAFE5V for connect */ > break; > + case SNK_HARD_RESET_WAIT_VBUS: > + /* Do nothing, its OK to receive vbus off events */ > + break; > default: > if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) > tcpm_set_state(port, SNK_UNATTACHED, 0); > > base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 > -- > 2.41.0.255.g8b1d071c50-goog
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 829d75ebab42..cc1d83926497 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5349,6 +5349,10 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) /* Do nothing, vbus drop expected */ break; + case SNK_HARD_RESET_WAIT_VBUS: + /* Do nothing, its OK to receive vbus off events */ + break; + default: if (port->pwr_role == TYPEC_SINK && port->attached) tcpm_set_state(port, SNK_UNATTACHED, tcpm_wait_for_discharge(port)); @@ -5395,6 +5399,9 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) case SNK_DEBOUNCED: /*Do nothing, still waiting for VSAFE5V for connect */ break; + case SNK_HARD_RESET_WAIT_VBUS: + /* Do nothing, its OK to receive vbus off events */ + break; default: if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) tcpm_set_state(port, SNK_UNATTACHED, 0);