From nobody Sun Nov 24 18:41:12 2024 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 9F0BD6F099 for ; Sun, 3 Nov 2024 03:46:44 +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=1730605608; cv=none; b=YxVzD6Igcw3caBi0cuaYJl4vNSJjmvDjfpny8YSqswnXq/S2u20XgFTVEkCKFstX3KQbDoDT/HPSSptieKSyz1gG0//QuvjkxZC2vA3eBLvDClOBT+0xLKz3CcjfIxF+LF+n5k9+C2ol8YDRHz0zY8mvjigNNU7thICy0YYPaNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730605608; c=relaxed/simple; bh=UD37Q3kv+0zSTiaCDIGf4tHsYG947h5UUXOysx/iLUs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=EoOUmjlFhcsjNPNCnws8MHZHb93ATQYOr0A2AjfvPHj5tviYrLQKTZOltSBR4BToVpVNBwixfv1KnQ6VG/uZOxaC2iBXLa/pGCtBgSHy9/omI8hJOijfRErKhSUYpEp0RA3XDLbTfA8IwTzbWhhpRLkGImyZGRyK8CgkheJtHg8= 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=IRvEtCSZ; 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="IRvEtCSZ" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e292dbfd834so5544069276.3 for ; Sat, 02 Nov 2024 20:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730605604; x=1731210404; 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=V3/D4cNuA+god4pAH3Cm6vq8553sgmtxzLl09CBk8Y8=; b=IRvEtCSZlyKmRP8Q70/LVVeaQBCbNANOqVbM1CqPi2ssRr4HkB6bl7q0sTWJmR5+5x yHAA4ybC7RLtL5W79YCVe4Ehx7x7YZU2JUBD1eVybuyeio4+X+1JisAohwmz1BQvagjG 52s822bAgO0k/XNZgyQp9hzDRHRrVmoAxHoksFMpfSdT+HH28jyS2rPRjaj1LWTYD5aN ktUcp/NYTEjIivcVeIV04J4sAqG+zPD2aC6V4poAX+92qpMlkqAc+SOocz4wFw7zS674 kfY4TMghiE94F6wK72cFAPiBlr2vm/o65FObN9cwd0bQUNvXDrNppq7YVCpKURknRYys 77hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730605604; x=1731210404; 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=V3/D4cNuA+god4pAH3Cm6vq8553sgmtxzLl09CBk8Y8=; b=ErDrDq4SEsBBLM4B7aFh3LlTC3z/a614QbeZlIdmaEjJy6O6gB7gZK+doBhSHbYtXP 8pbO2gXyHXEuvNitwDLb8Wk8YEeSw4VV+oM742WqijReMByPhYRl7fKkIBqS0fFBXQ+x n0pK+tAPZGla8VUWEzB5IR4nff5IfKhKThQBpwJDMhY6+wY1TVOvxw3B7Vi1gzEuMyqm 2dBhT62P0asfoFf3PwjLqt7DruTqeo+nAXP9oCkxFAIbLUoI3m2VpxrkEusEpfBbVTI7 MvYxYusW3tz6Df9EoP6E65PqtONNi3U1pwz/en0TXIXe0h45VPib//igxVA8nPmpMdH/ j35w== X-Forwarded-Encrypted: i=1; AJvYcCVd+WSCZe0Wn93hM/mlTrFlH/Zc2ECoCaD6eQ8vKeYnRpZ6OsHBxCibj/5gYqYYJTsuR/hhcAoJroesM+k=@vger.kernel.org X-Gm-Message-State: AOJu0YxngG8CiU8LIopIgRxee3yyYLof50MQttzuEPyKMKB0DuyvbGJb fUpmUp1kAA0YIpT39blMEb1jpaH0ZdCQ8A2LNZOZbLr1po6C3XlJ7FE9P3VYcUawfUpbXHFX27u ehA== X-Google-Smtp-Source: AGHT+IHzb0iRIstFF5hN4PGd2zA1+ThWNXNbtoz4ikdltRmzRF3u92SdPOFeBkTUGKp0h2hZRT1/GG15QsI= X-Received: from amitsd-gti.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:827]) (user=amitsd job=sendgmr) by 2002:a25:a045:0:b0:e30:da65:7240 with SMTP id 3f1490d57ef6-e33025536damr8488276.3.1730605603649; Sat, 02 Nov 2024 20:46:43 -0700 (PDT) Date: Sat, 2 Nov 2024 20:43:28 -0700 In-Reply-To: <20241103034402.2460252-1-amitsd@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241103034402.2460252-1-amitsd@google.com> X-Mailer: git-send-email 2.47.0.199.ga7371fff76-goog Message-ID: <20241103034402.2460252-2-amitsd@google.com> Subject: [PATCH v2 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 , Krzysztof Kozlowski Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Krzysztof Kozlowski --- .../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 =20 + sink-bc12-completion-time-ms: + description: Represents the max time in ms that a port in sink role ta= kes + 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 "poten= tial + 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 de= lay + 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 =3D <465>; ps-source-off-time-ms =3D <835>; cc-debounce-time-ms =3D <101>; + sink-bc12-completion-time-ms =3D <500>; }; }; =20 --=20 2.47.0.199.ga7371fff76-goog From nobody Sun Nov 24 18:41:12 2024 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 249238614E for ; Sun, 3 Nov 2024 03:46:45 +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=1730605607; cv=none; b=OKu9v5i6zQvwQ1YMWYFhs10+3VTCtYpNGIiBYpmk74gw2j2uFlQtnumgrZaEha4+NZOuRWsuBOiTXRfrUXPKcbCo2T1CRtSPxQli2xdzlNTtIDwqpyRurbo/OmO2yLXJilOiwii2H+pBk5UxGsat5cr3b3fjbP/L1jGhVhMp1bY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730605607; c=relaxed/simple; bh=nodndSIWpNnYMRyxXjDdCYJsYRoIq1lmpYJn50Ochxk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=jBvsBrloOgcXuxHZMZM8zUgrj7kR+/5SvtfB+60F4o1hDyROw9UtQ+64az5snv/s8ccmWanTsGcfC0Ucdn9talvkMDNIBi5tvVp4YSOnOQ/9IiFc4Q+DqBL78/pTWRGFl3e6zUOE4PXbyTIlBQsa02cEJmKolBuvqqLh6pgyl7w= 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=Fys2VPE6; 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="Fys2VPE6" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6ea258fe4b6so67777387b3.1 for ; Sat, 02 Nov 2024 20:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730605605; x=1731210405; 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=cz24K1evmI78I2+NJg1IxStwGuEObzk+Xurvv5EPuVo=; b=Fys2VPE6Qab9wzngasVwMLk09jChIOT2UO/L6vgTl4RKyJZRXTt8eoxlZ/34hx3ynC kXebfkVIS5pUR14qDhVLerPqjfZDyNJQpODwDFxnETM1bEBgiYzCHtuMO/wxl3vZ5YEP DxmMiEBH1gpioFksFuUDfZ3FTf3/+B8yOznMDZd0s8mmjvqPPq0MJr/PjsnxdacQOti3 5l7O53YZMxCoxa5xPbvQEDcuuqzWWTXU/1z3RTzDR26NAkEUaNVUK+/fkxY9pE/+8+IK ELoMh2nMSQKtSjpHdEUDNoXUlvy+Z1D7+SVp576xHsJwuf9nOI3pvcFWYWAo7RxPrPu0 cLnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730605605; x=1731210405; 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=cz24K1evmI78I2+NJg1IxStwGuEObzk+Xurvv5EPuVo=; b=oucJHA5e4p39FWhBT2f4aasSUjyGxqW60jB+DFxPedkz5rxMoewmoTxK9gAcch2dW9 VjwZa0w5i8rt/WxC5s/75nxfrf9UKMUCQnznrtR3/BpGRjZVIQzJNaSRqLFV6EpVGeAd 8xiFoUMu5XXLnfYNqxa0p245gwz+e3AH7gLoHYYYwjHqm2Sbbu89q7TfxWpqVbc9IDxF 4sRf9GWaAoBNayIApxdm6rUCD4quJQLpWjDlodWRZbWIpg/Aco+/LeUnreWmbMniP7lU 8ftktg8ETyW8qYpIjprbUIFF5lh+kxKqtF2YNFsBYZ/mnLIZPl2GyPXxbjYXDmksHddF KOZg== X-Forwarded-Encrypted: i=1; AJvYcCXzjm64O2gAju3PqLCtOG7Jaii7trbIOX55kt0CJgTAzwQ+YLPCrk4+3dfvGUpWXw50UQ2OgiqJLwmSMmg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1SoeymSXMfuggC76HyQJQrBlm0VwMRTH2j8JoYVf9DwnUjW0e IADrQzmHqgdtnVoEft0SWqKvkfKzFwlp2Ufixdubb7QDaRgQDOwRzF9owNp+6nKEPhtDOhqdId2 IAw== X-Google-Smtp-Source: AGHT+IE0WVlEdrG2GsvwLl5rNgi0hg5nY6f8ceJOB9AAUS82QrY7EXjnMk1ez03Plg1ISqeq7HIQNBHaDb8= X-Received: from amitsd-gti.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:827]) (user=amitsd job=sendgmr) by 2002:a05:690c:6f12:b0:6ea:8754:628a with SMTP id 00721157ae682-6ea875466e4mr485267b3.5.1730605605204; Sat, 02 Nov 2024 20:46:45 -0700 (PDT) Date: Sat, 2 Nov 2024 20:43:29 -0700 In-Reply-To: <20241103034402.2460252-1-amitsd@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241103034402.2460252-1-amitsd@google.com> X-Mailer: git-send-email 2.47.0.199.ga7371fff76-goog Message-ID: <20241103034402.2460252-3-amitsd@google.com> Subject: [PATCH v2 2/3] dt-bindings: usb: maxim,max33359: 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 , Krzysztof Kozlowski Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/usb/maxim,max33359.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/usb/maxim,max33359.yaml b/Do= cumentation/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 =3D <500>; }; }; }; --=20 2.47.0.199.ga7371fff76-goog From nobody Sun Nov 24 18:41:12 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.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 75FA3136E37 for ; Sun, 3 Nov 2024 03:46:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730605609; cv=none; b=E3MXjyV1fbwf0y3JgOQz4sY7AP1VNUfkTA74JwBfOV+rK6dNvIfGkROE3uhi7FCt/z72xTJam4zNCAtW1aaNhIRdh6w7zMEt2J0DZd2aDVBtIV0mRE9h5tcdybmTNwSRTrJRViJcHvMRf3oBmQql6EpObIT43dgiXcxEKJoEcR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730605609; c=relaxed/simple; bh=/DV8HzPWj9MRXa5IjLFG3GwszeHV8alTweaJrPIHLIk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Pdv5THDWknAUxe9So9Po2uUX1fQG/8ek8Vd9JbWVD4jxCMj5d9/0QddIRg6QPzdGNfGT/1OSuvTEQ9cET9jMDN7yX87azhOz9HRvsHGEwSypVCRYhfXS/hGpd/JRCEhicG4T+OSFeqL2S9/bq/jEtvJOWHK6dsLlCHxob8GNesA= 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=JTQNWXAR; arc=none smtp.client-ip=209.85.128.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="JTQNWXAR" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6ea33aad097so51816497b3.0 for ; Sat, 02 Nov 2024 20:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730605606; x=1731210406; 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=TowRVRNLRnA95PP1YhuZFO986FuoFxFM7Ex1kZPLyXQ=; b=JTQNWXARHYTtS4uI3fKUElUZ6G2ypCpZWDN2QYUgV5bTgU5Ua2LaogxborBiGS1LDV a00t3iP197MRu+eKPflUEjhLyFusWaDfjqgtRsnjdSPs4jJlx60bvfxoDcXV9yRlKppJ wKKE/GnTWwGOE0/1QCWT8p4onChyLMEgxiEsiQOi6qRujPUyM6bbc2FgIUDZsR8GyRGo niDpB2nds7NrGZnduGVKzehWjn+Yg82rtvMYJ6XP6E76aFg2aOpVwIEeiShj8y8qhcyW 7MD7DsmojB6+QRQC+tqhvXNwG2h0qe5QNT89v0Ujl0Lcqe2WRegwbzUjJt9VSkHosv7x iD8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730605606; x=1731210406; 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=TowRVRNLRnA95PP1YhuZFO986FuoFxFM7Ex1kZPLyXQ=; b=KgMRdlaNkW2agdTB38oX0fUGgEZTdpYzmvO/4cxS4kBAQs8zMcQxZPYrmDPH43V24K 2GvQdDkqK+G993ygRvkvXgAJF+A0I/oariY0qNtZB4mtK9QsnNWu/busOnBGMTt7Ch5P oVbX6ND/1u6aWLnzDpqca7KHokpYCXA0QBDzw2uK0gDqg30bLa2tehtQfqvr3mUeszYe sQOGyS/7hvoZadM3X6QZSM/3E/rRaVQHIzylXHXvyl4VOkmzTmSjDva5I2ZeuvxII6Z9 52W8hGVAI1EfSyUieJqN52dBPl5QZFoA1IBhMDWYpwiUABvAtol0Jrwv7O1I5tyGU0jC fjTg== X-Forwarded-Encrypted: i=1; AJvYcCWklVtjEY6M6ChT4t+VnDHO1NoK7N+aXcKPqb+F5TOGF1nLiLqBQRPw/f9/WWWwC22HKz12mOZME7cN0vE=@vger.kernel.org X-Gm-Message-State: AOJu0YwPWookEJCon1AXiI9mV783vsJaZNHVtxa7XeX5WKK8GSD1TML3 sWqAFUkbzAGkkQehInugIWmcMeFRKqXtWs+3LTwtrsGZLXA0FlfSeJ9mDcgDhCudVpgbyW1H2aI h+A== X-Google-Smtp-Source: AGHT+IHmE/kRn11bYNZn6cr3lE/xj6nOQF+TDhhrTDBqem535PO/7FKEx7RglgarpoJtTeWMpgmie/77OUc= X-Received: from amitsd-gti.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:827]) (user=amitsd job=sendgmr) by 2002:a05:690c:630c:b0:6ea:881b:b545 with SMTP id 00721157ae682-6ea881bb908mr434707b3.4.1730605606556; Sat, 02 Nov 2024 20:46:46 -0700 (PDT) Date: Sat, 2 Nov 2024 20:43:30 -0700 In-Reply-To: <20241103034402.2460252-1-amitsd@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241103034402.2460252-1-amitsd@google.com> X-Mailer: git-send-email 2.47.0.199.ga7371fff76-goog Message-ID: <20241103034402.2460252-4-amitsd@google.com> Subject: [PATCH v2 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 controllers (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 Reviewed-by: Heikki Krogerus --- 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; }; =20 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 =3D tcpm_get_pwr_opmode(port->polarity ? @@ -7090,6 +7100,10 @@ static void tcpm_fw_get_timings(struct tcpm_port *po= rt, struct fwnode_handle *fw port->timings.cc_debounce_time =3D val; else port->timings.cc_debounce_time =3D PD_T_CC_DEBOUNCE; + + ret =3D fwnode_property_read_u32(fwnode, "sink-bc12-completion-time-ms", = &val); + if (!ret) + port->timings.snk_bc12_cmpletion_time =3D val; } =20 static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *= fwnode) --=20 2.47.0.199.ga7371fff76-goog