Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp433921rwr; Thu, 20 Apr 2023 01:14:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZJwVGqpGNqh8JRB4W61/UkY8KRFwmIkwdp+khZGouP4pdejDnYMQQ8XqiMYNEr3ONnm+3q X-Received: by 2002:a17:903:40cc:b0:1a0:6bd4:ea78 with SMTP id t12-20020a17090340cc00b001a06bd4ea78mr705896pld.31.1681978476004; Thu, 20 Apr 2023 01:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681978475; cv=none; d=google.com; s=arc-20160816; b=mLtB9q8Yc1NouqYhsRvcRzMqWG+z6w+Jx5XNcGyPmcw73s7fAOcBaTHa72DijApKV7 vUXWhQYRpUapAG1T882RPdEZL9ZYxJfUbCmQ9uiVu0KzcjcnX7wlBjMtlGj/flrnh64j Td3dBhFbq5jaikaNSIZhVfxdft4hIdljtIzwlyHvFvU7ngY7/Gtkv3Yyhq93R4Fm+wu2 oY4Gy1GPbFwhPjHNVO52wiK3f7pOUH2stjYz/Fb7YdVSTg+CMBHvmwRsCXwQDxSIG/L4 rZYIflOSIZBFkwwg8At1gbewJ6HdnKq/9zuN3erbUzFwiIyDkAKz4jDmaZlqNn4sFzrc 975w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eQVO+Et94yj9fiWJgBqqQRTtjvX18QQqzOAik8wlIhk=; b=Zvd5LVGJL+eqAHb200VBmRBpOTZnnHsYcj7h2slTSo3ykiG4eSyEke/+PdlzHNHlOL v4FrRE8XK03RRdA/LC8C/cEjcnd00g4beDIiidtlYTx6CQCb+3BwvShRTe4bdeaNhg2M NYAj6W/KSsYTsivtePH80OPh2OyMcLgMhdJ3Jryngnl8vTTLI70kKPZeeXOfIVnFlbfS TNu0IJv4gqWxsa0lJ4fj8RhpxkMs598LndGzE+pMf9ZtgeFR8oMLeqTUclwSH3IexeI3 c9LiN9TSFKrhLDOzvmC/6hNE9mOVytkUuK5FwlrGqA6Mytgp43eIrzFNcNZtf5DCCjS2 zC+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gm2KDvef; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j6-20020a170903028600b00194967b7badsi1260192plr.591.2023.04.20.01.14.23; Thu, 20 Apr 2023 01:14: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=@linuxfoundation.org header.s=korg header.b=Gm2KDvef; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234341AbjDTIJQ (ORCPT + 99 others); Thu, 20 Apr 2023 04:09:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbjDTIJN (ORCPT ); Thu, 20 Apr 2023 04:09:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1DF9FC; Thu, 20 Apr 2023 01:09:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2746C645AB; Thu, 20 Apr 2023 08:09:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 911D1C433EF; Thu, 20 Apr 2023 08:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681978147; bh=ImzOYmQ4yUAimeoREYTG/Ic4X9E0mCDibkc7vPhya5g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Gm2KDvefKPiwYxUSqqIQl5ioJOzO0AcVRlCaKwSP1rY1ZyadRI8dF/Ce3WkKJQRSs Sc5BXlTLKFHYQwrzFGZOKgV2aR12u/kZ4Dw9hUXt8WZ8IAZh+a33VypEYXIwETMJT4 RtiSofNBctrEcmE2qu2FroRvVRTLpqw8hK4BzQmQ= Date: Thu, 20 Apr 2023 10:08:59 +0200 From: Greg KH To: Heikki Krogerus Cc: Frank Wang , linux@roeck-us.net, heiko@sntech.de, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, huangtao@rock-chips.com, william.wu@rock-chips.com, jianwei.zheng@rock-chips.com, yubing.zhang@rock-chips.com, wmc@rock-chips.com Subject: Re: [PATCH v2] usb: typec: tcpm: fix multiple times discover svids error Message-ID: References: <20230316081149.24519-1-frank.wang@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 17, 2023 at 01:27:13PM +0200, Heikki Krogerus wrote: > On Thu, Mar 16, 2023 at 04:11:49PM +0800, Frank Wang wrote: > > PD3.0 Spec 6.4.4.3.2 say that only Responder supports 12 or more SVIDs, > > the Discover SVIDs Command Shall be executed multiple times until a > > Discover SVIDs VDO is returned ending either with a SVID value of > > 0x0000 in the last part of the last VDO or with a VDO containing two > > SVIDs with values of 0x0000. > > > > In the current implementation, if the last VDO does not find that the > > Discover SVIDs Command would be executed multiple times even if the > > Responder SVIDs are less than 12, and we found some odd dockers just > > meet this case. So fix it. > > > > Signed-off-by: Frank Wang > > --- > > drivers/usb/typec/tcpm/tcpm.c | 16 +++++++++++++++- > > 1 file changed, 15 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > > index 66de02a56f512..a3ae2c79f3540 100644 > > --- a/drivers/usb/typec/tcpm/tcpm.c > > +++ b/drivers/usb/typec/tcpm/tcpm.c > > @@ -1515,7 +1515,21 @@ static bool svdm_consume_svids(struct tcpm_port *port, const u32 *p, int cnt) > > pmdata->svids[pmdata->nsvids++] = svid; > > tcpm_log(port, "SVID %d: 0x%x", pmdata->nsvids, svid); > > } > > - return true; > > + > > + /* > > + * PD3.0 Spec 6.4.4.3.2: The SVIDs are returned 2 per VDO (see Table > > + * 6-43), and can be returned maximum 6 VDOs per response (see Figure > > + * 6-19). If the Respondersupports 12 or more SVID then the Discover > > + * SVIDs Command Shall be executed multiple times until a Discover > > + * SVIDs VDO is returned ending either with a SVID value of 0x0000 in > > + * the last part of the last VDO or with a VDO containing two SVIDs > > + * with values of 0x0000. > > + * > > + * However, some odd dockers support SVIDs less than 12 but without > > + * 0x0000 in the last VDO, so we need to break the Discover SVIDs > > + * request and return false here. > > + */ > > + return cnt == 7; > > abort: > > tcpm_log(port, "SVID_DISCOVERY_MAX(%d) too low!", SVID_DISCOVERY_MAX); > > return false; > > This is OK by men, but let's wait for Guenter. What ever happened to this patch? thanks, greg k-h