Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp120321rdb; Mon, 4 Dec 2023 23:48:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IElnX33RiXi1kQ4mCVbfyZG82P1W9jry5Jq0XRciyyHTCFvxzVxkUXttlTqgGkfyDlKA/Gq X-Received: by 2002:a17:90b:e97:b0:286:6cc1:2cc2 with SMTP id fv23-20020a17090b0e9700b002866cc12cc2mr623685pjb.76.1701762489693; Mon, 04 Dec 2023 23:48:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701762489; cv=none; d=google.com; s=arc-20160816; b=vu2n3yBZZeEumuoXqAi8ZydPBz94Kn3CYob5wMmOkiJUt4U7jEK7KaOaFpmpUUc1n2 yWY8xlnibQCOY7KKpplXgUhj0vLZrwj5xEpqTGC4RV95Qi1Kv5jnQRB6D35lWMEzJHqA 8n/MQX8YaHkVRiwsvjdWOn50TKxVoVqbjZbtVqh/ActFBccDSoldlgGhyx7LsVaHu7JW fUZrpBCaltQJ77To9v6DX0lD6WzWg6BbJJYLkok+tpaJ66zuaGkIzD1HeGa5QqIP+QJY EpsalMHAwBolv53psF3MBW2AvDfY+5fME3B8CntCXqv4ZEKIq6LAak30Lfz8oUffERp+ AcXg== 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=INmJtN8JS6E2KqYHMrd6XJhzfWKSoCLZVNWKsSG3lEY=; fh=8GafQcX5dTx/eJfV3mD7urzUyShLTWRHiElcPao+1Wo=; b=hZgluD0v+TZjnKAUxyx/Y584+eUJZUiGQv2SCcOlsBLsE7qelhfPD27QvmypSxnRDl QrrQELBIXloIDHq85OJpQeyHfOzurpPwTBrtRUSWCkwNfR6u6z94D/4ITfHM6fdGlF5n X+Ae60S+Z+UBL0KovxqpGJ6d5kriQBfMKq4QzKd1eQfDcXY/5yYgrIaRNABE6Kw/857N MLdpUyRnwyi4YGLmvcUhfEXR8NcAK40QsrSeMFYAq6Y3V38PMzxZcNcTmOEVXp/3zWLh bbTIwrySZ767NgvNiFsG6MPLHOpPDUf2lsDN/y39rn5oi52Hst2j6XkpJgdM9Lg29Do3 w5AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OWniOsrS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id pq2-20020a17090b3d8200b00286bf822f9bsi2475937pjb.179.2023.12.04.23.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 23:48:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OWniOsrS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 717CB803D5B6; Mon, 4 Dec 2023 23:48:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344655AbjLEHrt (ORCPT + 99 others); Tue, 5 Dec 2023 02:47:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjLEHrr (ORCPT ); Tue, 5 Dec 2023 02:47:47 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1A7CCA for ; Mon, 4 Dec 2023 23:47:53 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5d7e7e10231so17538027b3.1 for ; Mon, 04 Dec 2023 23:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701762473; x=1702367273; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=INmJtN8JS6E2KqYHMrd6XJhzfWKSoCLZVNWKsSG3lEY=; b=OWniOsrSMKVMYXAk8BCgzDxnombhAt6q8Mxh2L/xIrYRy4SXYzSCjZq7+dvhz8H/Su twZpePhjB6/JtlEZ3M1j98DsG6o1UJOAOINA0QiiHrLO79hJA3ozLTGD7qF2xExeiNG4 UYBCG3+0KzBzAft4wJyl6yZz5DS2mMpFfcRKjC7ZgmKBOPxuM5tygr3eh7SQLWtFDUTP oekyFlyL5qZp1x1tJAHWbsHYsq55+uzuMxhNtXu9JaFXBm0/oycc2ZfZQiUY7VvY0G7N EJz+pjuFLNDm1IzpDeTcQgjNs3QNVvoX/lcOI9W7DDaXpAv+mbYe5vlVY3d8Dt156E3N t7Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701762473; x=1702367273; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=INmJtN8JS6E2KqYHMrd6XJhzfWKSoCLZVNWKsSG3lEY=; b=SRuLHlGerjrsTcyC3SuADktR7ShZqBTJ0qf7mol4Gm5jA0f01a/5dnnsmi23NN6x5a +dxJoXK/PPXMbHvFLKwFVcCWQBqQg+wmFDhC6rZ1tYl5KCHbW4L2+d2rNvmLlJcJogW2 ym0WpvA+rZBnAZILd1coQNLaD6rkearJjYSFyMK/E2A+tb3KUn2R1h/BoV7Immx+XGUj GH/zEFiWqxgOGxbcGxTkfahTkbREYzmDNYw8sbSUH0c9Pyi+nKvBJgz6hCvO0o4B6gQY MiLFITIOA1NjgPb+dNtUWJJHG7MByihtYfkpqzprrJE9ISHwAcYFvsSsMwy9dnWBd1lQ ssbw== X-Gm-Message-State: AOJu0YzDe9fSVIERxLGPezV3cvkFxRrCY7yUj3vWrIiMS/RD80Wv1sNK pcx+qbJIJRAgVO3Hr60Mt5MyL+wW4DQb X-Received: from kyletso-p620lin01.ntc.corp.google.com ([2401:fa00:fc:202:8ac9:92f2:1a10:4e1c]) (user=kyletso job=sendgmr) by 2002:a05:690c:842:b0:5d3:e8b8:e1fd with SMTP id bz2-20020a05690c084200b005d3e8b8e1fdmr47271ywb.3.1701762472940; Mon, 04 Dec 2023 23:47:52 -0800 (PST) Date: Tue, 5 Dec 2023 15:47:46 +0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Message-ID: <20231205074747.1821297-1-kyletso@google.com> Subject: [PATCH v1] usb: typec: tcpm: Query Source partner for FRS capability only if it is DRP From: Kyle Tso To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org Cc: badhri@google.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Kyle Tso Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 04 Dec 2023 23:48:07 -0800 (PST) Source-only port partner will always respond NOT_SUPPORTED to GET_SINK_CAP. Avoid this redundant AMS by bailing out querying the FRS capability if the Source port partner is not DRP. Signed-off-by: Kyle Tso --- drivers/usb/typec/tcpm/tcpm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 50cbc52386b3..192c103e0d10 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -4401,7 +4401,8 @@ static void run_state_machine(struct tcpm_port *port) tcpm_set_current_limit(port, tcpm_get_current_limit(port), 5000); tcpm_swap_complete(port, 0); tcpm_typec_connect(port); - mod_enable_frs_delayed_work(port, 0); + if (port->pd_capable && port->source_caps[0] & PDO_FIXED_DUAL_ROLE) + mod_enable_frs_delayed_work(port, 0); tcpm_pps_complete(port, port->pps_status); if (port->ams != NONE_AMS) -- 2.43.0.472.g3155946c3a-goog