From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B05F4336EC8; Wed, 3 Dec 2025 15:53:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764777207; cv=none; b=jO8rrQPuBTY0+hLSsG76g1UkC6W0OsV4StFEV+BJmdGM7XfAhLiPzfI/fEGWBl9dDx5CR4xbfgQkbpRYszhNTv0qmAOzAJXGjAfx9XMe/aUirj7yBVIDX86RY8jMddH7gG7LNRCe/+1s3xw+G2fR+pRGKxIBuXGf+m4Z/GeK9L8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764777207; c=relaxed/simple; bh=I4vTODuEx0useiqgnaOt/9tVivLBDBwgJ0i8xuJCH1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=StUhr6wDZoPPihj6hhQgeFw2rum8p0iCZh090LLh9zpsYfA/DYbs/fZKS+e5+f20cDZhWX6nV58bvxwIjVugbTCZdUmVRi4A3V4J/ievVc1ZTWtRxzD77mTvfUFpWRGaXwBiwAVPubP8dSSrScwZml0D/PwByvnniupX0BnpQ9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=u2YDqeLW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="u2YDqeLW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D69FC4CEF5; Wed, 3 Dec 2025 15:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764777207; bh=I4vTODuEx0useiqgnaOt/9tVivLBDBwgJ0i8xuJCH1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u2YDqeLWo1IBrHmyYPdiXPCen1P9pbmINt4wuCrxjBo+C3wgQ3cVufyWtNa2IQZ9L x/WFPls6d+7UQKSr7zSgeJhJK5fmIhwH5eryffeu/QvNfJjpJMB42dZsIp5XDRA9JP PHz2UCFw82Y/dQLmAck7tSC0XPyg3CiRUbI9FNqs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jameson Thies , Benson Leung , Heikki Krogerus , Sebastian Reichel , "Kenneth R. Crudup" Subject: [PATCH 6.17 116/146] usb: typec: ucsi: psy: Set max current to zero when disconnected Date: Wed, 3 Dec 2025 16:28:14 +0100 Message-ID: <20251203152350.710024028@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152346.456176474@linuxfoundation.org> References: <20251203152346.456176474@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jameson Thies commit 23379a17334fc24c4a9cbd9967d33dcd9323cc7c upstream. The ucsi_psy_get_current_max function defaults to 0.1A when it is not clear how much current the partner device can support. But this does not check the port is connected, and will report 0.1A max current when nothing is connected. Update ucsi_psy_get_current_max to report 0A when there is no connection. Fixes: af833e7f7db3 ("usb: typec: ucsi: psy: Set current max to 100mA for BC 1.2 and Default") Cc: stable@vger.kernel.org Signed-off-by: Jameson Thies Reviewed-by: Benson Leung Reviewed-by: Heikki Krogerus Reviewed-by: Sebastian Reichel Tested-by: Kenneth R. Crudup Rule: add Link: https://lore.kernel.org/stable/20251017000051.2094101-1-jthies%40google.com Link: https://patch.msgid.link/20251106011446.2052583-1-jthies@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/psy.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/usb/typec/ucsi/psy.c +++ b/drivers/usb/typec/ucsi/psy.c @@ -145,6 +145,11 @@ static int ucsi_psy_get_current_max(stru { u32 pdo; + if (!UCSI_CONSTAT(con, CONNECTED)) { + val->intval = 0; + return 0; + } + switch (UCSI_CONSTAT(con, PWR_OPMODE)) { case UCSI_CONSTAT_PWR_OPMODE_PD: if (con->num_pdos > 0) {