From nobody Sat Feb 7 16:00:07 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.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 6FDB6354AE8 for ; Fri, 17 Oct 2025 22:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760740259; cv=none; b=MJASrtUCFO1diz4d/0Rb5Rtw/88/zh2rIhOYTcOaf7YZ0mlBUCpv+Ra/7C5A+uc6IBH5BLBdeMfn5zsrcDIoPy/78vzqzUL5yU5kqk4eovM7MFBvba49MIg+p3gu7+BhgmUCRfKCKvlPB3zTcXBPRAX8Y3tdT2QACE192pdWVU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760740259; c=relaxed/simple; bh=coMsoCZvoHbuI23XThH1BMIfJtV8x1r7cZz+hCzRR5I=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=PU3aHzxfJwTOnzDCy+xyI7rSEQGqQuB0vtXwZ7jE4m+BVYLNN7SBufAw00+d0qexpZCMP3Bl/G8JA1MheU0PjWnvGc8MnPfX+YwowUcQmfDhMidn9beKccrPaVIcxfjrKImE/TaWpr/mrjhNXZ2VgW+Yt91oR5gIX93/0xPFGWc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=is6msNhq; arc=none smtp.client-ip=209.85.214.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--jthies.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="is6msNhq" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-28bd8b3fa67so23091525ad.2 for ; Fri, 17 Oct 2025 15:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760740257; x=1761345057; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=1aGvnCfkCxuG7nRHD5qS3K0Ns2/mfOtufedzaaye1sE=; b=is6msNhqyFq7lsWi2gi9bkEIarskO6dC2FOUHkmGJcw4/fe+R2PL7Wht2cCSCDcw0S 6DXYysCHLmnENIQwYxuRAiKvtb7Qcj+2lQQYLapYocBCyyOTkPUw5F3bWIBOo6y32Fdj nKJx7G10osH3l7YdE5SV5MuIZJGsI3twYkUBkILz+MiZ2MU27SC5En72SHPLtUA3IbhM 8PR6aOVILGRNk8iLORtzIXd52X2CJSt7VQMJ8X5BiDFbpKbEoZxMGSO/+j2rz5g3BR2N 9CktZnTvI5hQ+rasVFPGEFODcsTMBf/HnCwEr3jZTI5NGZiPMrgUGs0wYcb7luRjH+11 TY6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760740257; x=1761345057; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1aGvnCfkCxuG7nRHD5qS3K0Ns2/mfOtufedzaaye1sE=; b=TW6ztcQPQ8lCM8+LV4oK/a3i1RUHtZfMHVri1aX0Sk9BJocgGEGy1HbAz2F+wuNjAF QvknNqtA9AAd1FGr7Io5MpGr+v8TCeCpodL3iYFdYfTPnaosbZHrSkFIkh8y/MpIu6nh N8DCaSVJ9ztebwcoAR6HnjMbhhtjfbDBEPRGXElr/+64IVTZEUA6EhEgcWMzfbHmu/Bu DnU/e7Wf5V7CjdDAjt5g9atogdXJwhsWMten95WuCXx21o1yO85s7YS81WmzmNywgY1s /o6XOcCylYjMXI1KFkFJ8yW/2Wl6aRAQ/BZ7wyyir5NnxZZIS/HKKJ76wKN6Kavt0E88 EjOA== X-Forwarded-Encrypted: i=1; AJvYcCWmzKr6hkH8C7OMmmSk6IXS39SkW4m9F7xGGDz87afE5ItSYQh2dyTOFPudNdJarn+dW63FbYxqCylsxLw=@vger.kernel.org X-Gm-Message-State: AOJu0YwTlaN/RQEMuY+Ik9NE+lcJ5qSylG0c9zGcZwRv0NtbBy9WRkL3 u2HGet1HzKijdHTH3j8kAugY/iXf40UTjwq4RwCbK2jvH/ZP/eQp0d8RzgOAEYpPIh8Yxb1AVGc LDW5Pcg== X-Google-Smtp-Source: AGHT+IHuhlr6TeDMM+a8D4kE0RCHmOBllgF8IF7LrOLrHYShECDzzqQ+4s+GJlaM19IdbjQW26f4OH4XTqk= X-Received: from plho8.prod.google.com ([2002:a17:903:23c8:b0:290:d4c5:90ad]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:d485:b0:28e:c75e:61d9 with SMTP id d9443c01a7336-290caf83210mr63165865ad.38.1760740256772; Fri, 17 Oct 2025 15:30:56 -0700 (PDT) Date: Fri, 17 Oct 2025 22:30:53 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.51.0.858.gf9c4a03a3a-goog Message-ID: <20251017223053.2415243-1-jthies@google.com> Subject: [PATCH v2] usb: typec: ucsi: psy: Set max current to zero when disconnected From: Jameson Thies To: heikki.krogerus@linux.intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dmitry.baryshkov@oss.qualcomm.com, bleung@chromium.org, gregkh@linuxfoundation.org, akuchynski@chromium.org, abhishekpandit@chromium.org, sebastian.reichel@collabora.com, kenny@panix.com, linux-pm@vger.kernel.org, stable@vger.kernel.org, Jameson Thies Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. v2 changes: - added cc stable tag to commit message Fixes: af833e7f7db3 ("usb: typec: ucsi: psy: Set current max to 100mA for B= C 1.2 and Default") Cc: stable@vger.kernel.org Signed-off-by: Jameson Thies Reviewed-by: Benson Leung Reviewed-by: Heikki Krogerus Tested-by: Kenneth R. Crudup Reviewed-by: Sebastian Reichel --- drivers/usb/typec/ucsi/psy.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/typec/ucsi/psy.c b/drivers/usb/typec/ucsi/psy.c index 62a9d68bb66d..8ae900c8c132 100644 --- 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(struct ucsi_connec= tor *con, { u32 pdo; =20 + if (!UCSI_CONSTAT(con, CONNECTED)) { + val->intval =3D 0; + return 0; + } + switch (UCSI_CONSTAT(con, PWR_OPMODE)) { case UCSI_CONSTAT_PWR_OPMODE_PD: if (con->num_pdos > 0) { base-commit: e40b984b6c4ce3f80814f39f86f87b2a48f2e662 --=20 2.51.0.858.gf9c4a03a3a-goog