From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382922; b=O0uE68whgQFzMElzMZEBzaeNghFfJs/Y6VWUgoBCqBFk2ux+Q9BjR9z4w7r4Knvk0dVg 23Hekxm2wbyAfwhvY1m893c2bNMK1sqItf1prDpP3xN4CHJmQp+/s9MWiDFk011Zg30iK JVeZS86Yl9EUmr9Su/sQbf2qUlPGtIrVnZlg+kt/VVEn0zGie8wBX/tYkQrO7tzoK3SmL EjdTZCxvNfhACmH4VUWaD/B+pPolt6Z8mUdLl8LeGAWsELN6Jbxndt1SrE3+DfXsCIujY HMLxjGnrfSi/MTnVjH75DZKudTF5kboKAMNtleR8xPk+cC5wCH3/8TFprtkyra9fsAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382922; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=wdXG4toZ8N3a3v/47J37v4McvLw5W///qUMofHs1LWc=; b=EVD5UhUcyaQisOLuGY1bkUzZtoNJ/INO6vh6PJhZzv+DNi5YtEVquYw+CAW0Lmzl8Ea6 dVfvcApeo/3daRvRM6g5DlO3F8KSbKJ4F3mWSsEbsoRtzM5NON9wpGD4VmPM9f4tZAGY5 A8Kpgl2YXdJIiiZOU00CmKpYiTqFhSkw2YESRbgdqzlVzmTgHlr8kd/u+Bzw9rBMNhAOY +fQO0PRcxEzNpX2Tn2fcOHajsctRwkV/x+YVSgP/qIw9tOj9+CSTZ85mq5z0L63h1O04B 0rvvTW6q6rtgIPYpvbokO0j1RRaynRjC3kRVf8Y/b+cB37sijGUOi1OgdNBQBIOxogg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O6RZ1413; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 036AD606A338 for ; Fri, 4 Dec 2026 11:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O6RZ1413 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4672E1F00933; Fri, 4 Dec 2026 11:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796382921; bh=wdXG4toZ8N3a3v/47J37v4McvLw5W///qUMofHs1LWc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=O6RZ1413o8LrBrjYeV3AVBUzL7VAPe/hZ3bhpW/UscSOrvp1aMCJy3frzvRgEcycJ uRKjx6IvquYaXN6vWlGPQ9RetGJgE7v/19kj8c/lVCsdSP/0Vo1iM25C4o2rRyAcZc FaUBV/jg8x9khYD8snW7ssrlzm5W3hMeOsQ5tdd69go2eRwrg3cmQbINfpq+w214Nk lcjGv74l+WJM2MQEt2WmQ8bYgThY9bJsZ37/q5msKW02xpEKf38UKC1y/8Oiet/KQ+ 94a8W8Xv/RPvOm758LIGRc57eGdyiHFzep2J5cpobGwRcWzAO8/Qyn2FxFlTKlkTjJ vMGtWGkVWtckQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] usb: typec: tcpm/tcpci_maxim: report BC1.2 current limit Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?QW5kcsOpIERyYXN6aWs=?= Cc: linux-usb@vger.kernel.org In-Reply-To: <20261204-tcpci-maxim-bc12-v2-1-3c8ccacc9bdd@linaro.org> References: <20261204-tcpci-maxim-bc12-v2-1-3c8ccacc9bdd@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 11:15:19 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] usb: typec: tcpci_maxim: BC1.2 race can permanently latch 0 mA limit -- commit b1be9133e1f16e25c6fc3ce85af91dbc2bae9bd1 Author: Andr=C3=A9 Draszik usb: typec: tcpm/tcpci_maxim: report BC1.2 current limit This commit replaces the hardcoded 500 mA return in max_tcpci_get_current_limit() with a read of TCPC_VENDOR_BC_STATUS1 to report 500 mA for SDP, 1500 mA for CDP/DCP, and 0 mA otherwise. > diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/type= c/tcpm/tcpci_maxim_core.c > index d6a4fce3c80df..6d966a6fc3cf6 100644 > --- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c > +++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c [ ... ] > @@ -485,18 +486,31 @@ static bool max_tcpci_attempt_vconn_swap_discovery(= struct tcpci *tcpci, struct t > return true; > } > =20 > -/* > - * This callback is used by the TCPM to determine the current limit to s= et when > - * Rp-def is advertised on the CC pins. The actual current limit comes f= rom > - * other subsystems such as the USB gadget/host stack (USB 2.0/USB 3.2) = and > - * BC1.2. As a workaround, report the USB 2.0 current limit of 500 mA to= enable > - * charging when the device is connected to a non-PD source advertising = Rp-def. > - * This can be removed once a mechanism for the USB core to communicate = the > - * current limit to this driver is implemented. > - */ > -static int max_tcpci_get_current_limit(struct tcpci *tcpci, struct tcpci= _data *tdata) > +static int max_tcpci_get_current_limit(struct tcpci *tcpci, > + struct tcpci_data *tdata) > { > - return 500; > + struct max_tcpci_chip *chip =3D tdata_to_max_tcpci(tdata); > + u8 status; > + int ret; > + > + /* Returns 0 if BC1.2 detection is disabled or has not finished yet. */ > + ret =3D max_tcpci_read8(chip, TCPC_VENDOR_BC_STATUS1, &status); > + if (ret < 0) > + return 0; > + > + switch (FIELD_GET(CHGTYP, status)) { > + case CHGTYP_SDP: > + /* > + * Assume a configured USB 2.0 device until the USB stack can > + * report enumerated SDP limits to TCPM. > + */ > + return 500; > + case CHGTYP_CDP: > + case CHGTYP_DCP: > + return 1500; > + default: > + return 0; > + } > } [Severity: Medium] Can this single read of TCPC_VENDOR_BC_STATUS1 permanently latch a 0 mA current limit when BC1.2 detection is still in progress? gs101-pixel-common.dtsi omits sink-bc12-completion-time-ms (defaulting to 0 ms, while the maxim,max33359 binding budgets 500 ms) and sets pd-disable. TCPM then queries get_current_limit() in SNK_DISCOVERY and SNK_READY right after the 200 ms CC debounce. Once in SNK_READY, TCPM never re-queries get_current_limit() unless CC changes, and max_tcpci_init_regs() does not unmask vendor BC1.2 alerts. If BC1.2 finishes after that read, TCPM latches 0 mA for the whole attach session. max77759_charger's psy_work_item() then sees a 0 mA limit and sets MAX77759_CHGR_MODE_OFF, leaving charging disabled until unplug and replug. This is a regression from the 500 mA return in 9d44cf247e7d ("usb: typec: tcpci_maxim: implement get_current_limit"). Could max_tcpci_get_current_limit() poll TCPC_VENDOR_BC_STATUS1 with a timeout until detection completes, as tcpm_get_current_limit() in fusb302.c does? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-tcpci-maxi= m-bc12-v2-1-3c8ccacc9bdd@linaro.org?part=3D1