From patchwork Thu Oct 31 23:59:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Sunil Dhamne X-Patchwork-Id: 13858512 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D38F55896 for ; Fri, 1 Nov 2024 00:00:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730419212; cv=none; b=lRm5iscshiSzvpdF732bmnWcSQbs/uMOhZGoQq9dHCaLfhnT+ia5q/YNGVhd2bFNnm9ed5m1MK2sgebhWLAJR3yorzKUF4rBjJry3U9ChImCTXCuQ6DDYJwAuhdkeqQ7VOdKwRmdW7nRVxOnKi7VY9+WI19sM+82iLy8QBvPgMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730419212; c=relaxed/simple; bh=UipML7Yg8hvmCAePJ+oaJ+qpyo3ZhUAnZLJXkXrCSsc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NhDmTjP79izjU9MOqGsMatTgy0xKpypt2rXeOQaDghVQXLjk15Gho/PKpmvwNZA30wwZbFFNDMCqg72t65GZjQ/CHbCqS29fUu2NByFlRqWb4gLK1FGq6QYXvJkrloshvCWh89hz13Pb246qdXc5c9o32vOk4nIEkuQTxvSWgKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--amitsd.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jg/9eRn/; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--amitsd.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jg/9eRn/" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e30cf121024so2820032276.1 for ; Thu, 31 Oct 2024 17:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730419206; x=1731024006; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=bHYzIMl6GMa9fGC8SIOmNYUS+e+ogp8fvmmhcUikr/U=; b=jg/9eRn/NvXNvnOX8kUK52c7pCyB0jvQ4MazRBMUl7EbOqjq7RXKtZBSQ1EPAcd8RH omWxsraMMWO6Mzkgs2qw1KalCoYkx/Pdtjb4i8LVnA+OyCWR93Arpo5AxtFfcyMukw26 OM2sYMAy/8a4s1znUO2m1lVt3e+0vcfAGSFdoZh1x4ts5NJMym77L881wDR+iNf+oXUX RCbPmFPXix+f+fmKIhrzr8pGWHzmiOOh81amTl0JOmQ6pCaRZLj0hQ25Qvhee9EMoPwn tbyVbSh0sHuHIlAR6eVEtu7nbjCfsl1tJmJLwTFbltSzDoB9TJ+8uqadS9lSuyRySlZG lz3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730419206; x=1731024006; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bHYzIMl6GMa9fGC8SIOmNYUS+e+ogp8fvmmhcUikr/U=; b=Od0rYNCBXC+h4vEUOKx/21buCn1lF59EfyOXkUv/6oOhsxrzLzcgErAeTlc4THGHHM HX0UBro4vOiSgAsytBbgtZGfUbTNhsnN6D5HqyZKjOsNGy0+g46+85rsU6/s6fbDwIht CgMPEfNuk4QNttyATnXn/HqmBqLdAOE9UvKBzOHWS1dlHShwcO5nwNBWmvgP2BCy/8CJ suYbmd+YuA0YlxUMrrzWLwSZwPWAUCMONeOOCgf6pl/NhagECeMYRHDvl6TPnwC24FDC 5u2zY5OqWmFTzt8cNjP/UdSPcEtSeLFG2kK06pz6RykQiVCiHdQ8jtPEBY2HfIYsJk0F +iXw== X-Forwarded-Encrypted: i=1; AJvYcCWiLi6lmAKDm9wUqka6PhO/NpJCBAJggJXhiUmlzR67AGKsIYVDfb2PbBV5dZpo8eH+OVKUKFOpSaQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzkfO5Lk+cpJor07Rr5a4lvRsXNrnwVMhTGU9npDGqcz5UrP60O 43+3o+0qJrpcNEH7wNAmqFQA7MNSOWuaKHU1P50bymNxCdYfEBOryvGpXOIPuKB7t0u27QFTYT8 +cQ== X-Google-Smtp-Source: AGHT+IFtsw1CqjzV/sSzOx+52KMljtEulrqPxf+Kx+05Kx6SAXpGeTLFotSa7WrdF+OVatsVoVJKlZNHePc= X-Received: from amitsd-gti.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:827]) (user=amitsd job=sendgmr) by 2002:a25:83c3:0:b0:e30:c79e:16bc with SMTP id 3f1490d57ef6-e30c79e1861mr11704276.8.1730419206198; Thu, 31 Oct 2024 17:00:06 -0700 (PDT) Date: Thu, 31 Oct 2024 16:59:52 -0700 In-Reply-To: <20241031235957.1261244-1-amitsd@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241031235957.1261244-1-amitsd@google.com> X-Mailer: git-send-email 2.47.0.199.ga7371fff76-goog Message-ID: <20241031235957.1261244-2-amitsd@google.com> Subject: [PATCH v1 1/3] dt-bindings: connector: Add time property for Sink BC12 detection completion From: Amit Sunil Dhamne To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com Cc: dmitry.baryshkov@linaro.org, kyletso@google.com, rdbabiera@google.com, badhri@google.com, linux@roeck-us.net, xu.yang_2@nxp.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Amit Sunil Dhamne This commit adds a new time property for Battery charger (BC1.2) type detection completion process (based on BCv1.2 detection spec) when typec port connects in a potential sink role. BC1.2 detection is used by some Type C port controllers implementations (such as "maxim,max33359") to detect the type of charger port. Signed-off-by: Amit Sunil Dhamne --- .../devicetree/bindings/connector/usb-connector.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml index 21a0c58c65cd..67700440e23b 100644 --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml @@ -283,6 +283,16 @@ properties: maximum: 200 default: 200 + sink-bc12-completion-time-ms: + description: Represents the max time in ms that a port in sink role takes + to complete Battery Charger (BC1.2) Detection. BC1.2 detection is a + hardware mechanism, which in some TCPC implementations, can run in + parallel once the Type-C connection state machine reaches the "potential + connect as sink" state. In TCPCs where this causes delays to respond to + the incoming PD messages, sink-bc12-completion-time-ms is used to delay + PD negotiation till BC1.2 detection completes. + default: 0 + dependencies: sink-vdos-v1: [ sink-vdos ] sink-vdos: [ sink-vdos-v1 ] @@ -426,6 +436,7 @@ examples: sink-wait-cap-time-ms = <465>; ps-source-off-time-ms = <835>; cc-debounce-time-ms = <101>; + sink-bc12-completion-time-ms = <500>; }; }; From patchwork Thu Oct 31 23:59:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Sunil Dhamne X-Patchwork-Id: 13858513 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B21A2745C for ; Fri, 1 Nov 2024 00:00:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730419216; cv=none; b=HPYCw5cO5A8L8nTFUFH285MLNyqDsC+z4Q7ZQSO5rWTlXLQl6efb2WJTYwVt5PeI/QuFAsH7zkcyLMvxDRgw+YMc/wvIHOu7uonBDWYIpkw062pfSI7ZTcw5x2AzRtFdv+lPjsPfVwWLxrO/tiOcDdj7I35gXD5cWxiXHgm+Hvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730419216; c=relaxed/simple; bh=A4bq0N4uNagV3ukMVWP0KMHLucV+wRSRyhiufTLh9OY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=d0+RWICjTaqQ0N1jLC1F0BX90hO3av1rQkgbXAuTub2UbZGn+c4sVFMTszMCM1VATijDG6O7X9FkIVMI4VUSF3Igbed3tIX0Zkqnl/R3AqiWUVm1374+HTUdoj2zNTt72SX2tsGh9l9MpkeQZ1VTVnRmK/xrMgXEu2yTHnETMaI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--amitsd.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=mC0UdA0R; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--amitsd.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mC0UdA0R" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e30df8dbfd4so3332750276.0 for ; Thu, 31 Oct 2024 17:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730419209; x=1731024009; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=bngmyXciCTbSjbg+6G3G0oMv+8YkE4Dj8JEhavO/K3I=; b=mC0UdA0Rk59J4YogjBUE4PfLnqf398/JrkcNthFriXtuJt1ozINivHlt0oUKigTpnF /u9ieQ5/R80p6uHobgW1J9QaCdtdXDMDrT86OaWXzuxD9mbsrl/K8m9+gD0e65VfU2Cv WaJmKpTYbwCJ7HvR/WH8TDQacBUxxO9VuFjdy52+s7RrTqvane+U62rmbcsbuzhqVPVW FgpyDtBCvqk/q9KOk9A+reYn3bLuFV7k38DWfnEnSrLD8CS075GPyqs0sitGeqHSbz8/ hSo62dtllCqO4/YM/YOESxJfCan5sDW2jeUW6GgjhHlD/7a703SQHlGROLMBXjGRvgez gsZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730419209; x=1731024009; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bngmyXciCTbSjbg+6G3G0oMv+8YkE4Dj8JEhavO/K3I=; b=cS21uoajAD9xtEbNI63/pCWI0BJ0vDpdPw09sZ33xSvSpgJT7ooRXZbiK7DRUfmf25 23NM9hA3gZEVQ6gHi/9C66Sfg9pm9zIVxVz+auKaAx2F6NL7jAlX2ETeSdE2ODJ/23h3 fYSZf2/nYv8UoUacL95NQP52Xa7hJbgecIc93fhqhQi2h0xo8QUfVpL1LVJ/yJdDOpZc 3pMDkzu5qSSWCyDTqQudJDqM9/ZpxQeT/67uFsdDPpAzmRq1AsokunoVkpRM/6Tkadjm UUGl/nDPYVbXu1H2sAw/xue7BGUFYaV73nEYzlilQhCtjd2CG38hyFyg0BooOD+5VvYZ ncaQ== X-Forwarded-Encrypted: i=1; AJvYcCX95yF/1y5sGDLZXRzU7Z4In/EsuHGD7btDtsobdw8A54VvHo5Ykke+N96Cycg61VGTVwroRtxo5+U=@vger.kernel.org X-Gm-Message-State: AOJu0YzsDX0o+1PCI0vTHpZt2fCG9Dq5E7HqV59e2fPW5qwIjLXb4uMo l4qbW0p3h7WUdCXn2PM/+pdJXWw2+a4cFnzWfy9Q5wzza7D42aT0JzeKpgg6/uGwYftdmAmFOqn /4Q== X-Google-Smtp-Source: AGHT+IHQfGP03Xo4Z1kmpAjYxnkeLA3AW7J7tuHBqRtNeq1/nshG4E/KrtXeW5RUm6duPvVgst5xbFme0YY= X-Received: from amitsd-gti.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:827]) (user=amitsd job=sendgmr) by 2002:a25:b321:0:b0:e30:d518:30f1 with SMTP id 3f1490d57ef6-e3302522da1mr1359276.1.1730419209485; Thu, 31 Oct 2024 17:00:09 -0700 (PDT) Date: Thu, 31 Oct 2024 16:59:53 -0700 In-Reply-To: <20241031235957.1261244-1-amitsd@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241031235957.1261244-1-amitsd@google.com> X-Mailer: git-send-email 2.47.0.199.ga7371fff76-goog Message-ID: <20241031235957.1261244-3-amitsd@google.com> Subject: [PATCH v1 2/3] dt-bindings: usb: maxim,max33359.yaml: add usage of sink bc12 time property From: Amit Sunil Dhamne To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com Cc: dmitry.baryshkov@linaro.org, kyletso@google.com, rdbabiera@google.com, badhri@google.com, linux@roeck-us.net, xu.yang_2@nxp.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Amit Sunil Dhamne Add usage of "sink-bc12-completion-time-ms" connector property to max33359 controller for delaying PD negotiation till BC1.2 detection completes. This overcomes the occasional delays observed while receiving PD messages where BC1.2 detection runs in parallel. Signed-off-by: Amit Sunil Dhamne Reviewed-by: Badhri Jagan Sridharan --- Documentation/devicetree/bindings/usb/maxim,max33359.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/usb/maxim,max33359.yaml b/Documentation/devicetree/bindings/usb/maxim,max33359.yaml index 276bf7554215..20b62228371b 100644 --- a/Documentation/devicetree/bindings/usb/maxim,max33359.yaml +++ b/Documentation/devicetree/bindings/usb/maxim,max33359.yaml @@ -69,6 +69,7 @@ examples: PDO_FIXED_DATA_SWAP | PDO_FIXED_DUAL_ROLE) PDO_FIXED(9000, 2000, 0)>; + sink-bc12-completion-time-ms = <500>; }; }; }; From patchwork Thu Oct 31 23:59:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Sunil Dhamne X-Patchwork-Id: 13858514 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17D9149620 for ; Fri, 1 Nov 2024 00:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730419220; cv=none; b=u3m+uqjRG10hdU8vFx5goz9at9KmyDEg6bDw8kW4yd0a44bDCaJD1lT03vvJgfv9s8hOTmgApz6XQXaC4NocDpz3n0NJQaMvwdpTKwXHB5y+dWfvBpfnrNvKaKH4X1ACAhPq/dSKrguSmDJqR61qlSH+pmasO+W5OYhgUNzo700= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730419220; c=relaxed/simple; bh=GcFamxwRDGPO3itT2MjcU3zPO7i7GG6u7AIRa1Q7oFg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qaUS3ZkQ7XK3F/VaZsTyRxHX1gCq9V+Lk1W3rNPhz00J1JJ13osHpSN18vp3ixCwNduJ9SIv62voALy6YMx45l2bsgDVJDCyvOfltpDf4ByAia9MpjfhMJuxyaHlSwuAd2Xfar+sZZOpooS23EUGiIiaNCBUnqIA3EG8+YHZeto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--amitsd.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Yu24/i3q; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--amitsd.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Yu24/i3q" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e3705b2883so32794937b3.3 for ; Thu, 31 Oct 2024 17:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730419212; x=1731024012; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=dQqXD8GGG81ZKLR68lhIbs8UaEvihWRfJOeJXcvzgOs=; b=Yu24/i3q5aG87jJNVFOLjAvr9E/GVFHnfn6/TF7u/pE76/AgiMniNJUL2i5ISehmsB Y0kHnmu/Z7eRdKr2/TkiHmwv9hoO/MWlaoKCZN1dj2EEe0Y81JXwl1aRyOiU1jfeUQjN k7+Ep9Gt3ru1e2C1BeAeMKRa1u93JwaKB2btQgNxTdFAvhDyrB9xv0kdjzEZzY1IM8tj Sd0Fs/q08Efin4rt6VZ6QftLp1xlRxnThdUaOVyH6b3y5RdyRL22h47HW8YzhNtwPBQz 5IUS87z314a/4/LxJrgKQpXm6EJpQPPWs5t9w77I+spAKAzY7qxlg6ZMq5J8zIKowgsy /MdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730419212; x=1731024012; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dQqXD8GGG81ZKLR68lhIbs8UaEvihWRfJOeJXcvzgOs=; b=a9aJuuVYnuEBTybpZ0n1qJIxc2J7syKgK5mNX+tY6/0rqF4AtGyRAB8cHep0l2Z+EG ATl/RM01sDi5SBETJDo5s3HnV66mAoWq35sPJ+y03kn+Rs1azjwF4qysjsidPjNLRkjr 28Yii2b+nJkjZH+L7g2N/djkL2HKfO/4cSafuMPSqGNH6G9HqVHr1srVqFwoK4MM6nRG mgjON7vTaQG0Fd/r5OtGYqOK1vpt3dRnf4ldlVnGMw546bKmWyBsS34JpnLYc6P12k4f Z0CrjAVslVaLHay7EdgpuyEDmHuzTGa/4aD9pEL2SZWUph12d+nTv3VjiEC8jbSiqp5B iVPQ== X-Forwarded-Encrypted: i=1; AJvYcCXZOUjZ4Ey3rqEhAEj4PxFmVKSyZMvc7O60z7BBYg1wIgqQlp2g9y13ub/Uox9szRD8Q5pJoiiiPE0=@vger.kernel.org X-Gm-Message-State: AOJu0YxcJjTrHmwUa5kjBmVSf/VX1gicjJzW55l4zt0AF1POym3rGry3 EI76k8r7aOLc7shvoguvCrl0Ixgxy8Z0YrMMhYRMrxG5uA1Q/70JVxYnor87QIH77N4Iy+pG27n rVA== X-Google-Smtp-Source: AGHT+IF3kA3CN/HGj+QhxHeBH2gUZC8UXb3P2uSWUlJKoBcrreHMjjN4zZ3Ex75VcC0umN5SfVTmaiZ0oxw= X-Received: from amitsd-gti.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:827]) (user=amitsd job=sendgmr) by 2002:a05:690c:2e8f:b0:6ea:fa4:a365 with SMTP id 00721157ae682-6ea64c11f97mr45177b3.8.1730419212131; Thu, 31 Oct 2024 17:00:12 -0700 (PDT) Date: Thu, 31 Oct 2024 16:59:54 -0700 In-Reply-To: <20241031235957.1261244-1-amitsd@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241031235957.1261244-1-amitsd@google.com> X-Mailer: git-send-email 2.47.0.199.ga7371fff76-goog Message-ID: <20241031235957.1261244-4-amitsd@google.com> Subject: [PATCH v1 3/3] usb: typec: tcpm: Add support for sink-bc12-completion-time-ms DT property From: Amit Sunil Dhamne To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com Cc: dmitry.baryshkov@linaro.org, kyletso@google.com, rdbabiera@google.com, badhri@google.com, linux@roeck-us.net, xu.yang_2@nxp.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Amit Sunil Dhamne Add support for parsing DT time property "sink-bc12-completion-time-ms". This timer is used to relax the PD state machine during Sink attach to allow completion of Battery Charging (BC1.2) charger type detection in TCPC before PD negotiations. BC1.2 detection is a hardware mechanism to detect charger port type that is run by some conrollers (such as "maxim,max33359") in parallel to Type-C connection state machines. This is to ensure that BC1.2 completes before PD is enabled as running BC1.2 in parallel with PD negotiation results in delays violating timer constraints in PD spec. This is an optional timer and will not add any delay unless explicitly set. Signed-off-by: Amit Sunil Dhamne Reviewed-by: Badhri Jagan Sridharan --- 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 b3d5d1d48937..8b325b93b5a9 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -319,6 +319,7 @@ struct pd_timings { u32 sink_wait_cap_time; u32 ps_src_off_time; u32 cc_debounce_time; + u32 snk_bc12_cmpletion_time; }; struct tcpm_port { @@ -4978,7 +4979,16 @@ static void run_state_machine(struct tcpm_port *port) if (ret < 0) tcpm_set_state(port, SNK_UNATTACHED, 0); else - tcpm_set_state(port, SNK_STARTUP, 0); + /* + * For Type C port controllers that use Battery Charging + * Detection (based on BCv1.2 spec) to detect USB + * charger type, add a delay of "snk_bc12_cmpletion_time" + * before transitioning to SNK_STARTUP to allow BC1.2 + * detection to complete before PD is eventually enabled + * in later states. + */ + tcpm_set_state(port, SNK_STARTUP, + port->timings.snk_bc12_cmpletion_time); break; case SNK_STARTUP: opmode = tcpm_get_pwr_opmode(port->polarity ? @@ -7090,6 +7100,10 @@ static void tcpm_fw_get_timings(struct tcpm_port *port, struct fwnode_handle *fw port->timings.cc_debounce_time = val; else port->timings.cc_debounce_time = PD_T_CC_DEBOUNCE; + + ret = fwnode_property_read_u32(fwnode, "sink-bc12-completion-time-ms", &val); + if (!ret) + port->timings.snk_bc12_cmpletion_time = val; } static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode)