From nobody Mon Feb 9 01:45:36 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 8C2622E718F for ; Thu, 16 Oct 2025 23:59:15 +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=1760659157; cv=none; b=lnG5oTjPzso1fUUe8KRiOMKPXJqfQucD/LRf1WZzy4lqpPW22+59LsazvUz7QNKVDCtg64oEp13FQbgzmucFFzScWwfvdea7/lQu7b2vYCKncWkNm70iMGs8teQFxwwNL/NDp77NUWeAQ6uXe25PGK00f4Kw2/rPDYjenXOwP+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760659157; c=relaxed/simple; bh=y5EXC/RlVvoDBCIFu38lkbndAmXhZFWX+983xzQy9AQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=DA++AK+2mDWrzKd6AGx+bQVCRwyumBzrWUUnaNCKyOAOirtyEZN78mzeE2t9WXlPZeRgREhcx6eW9tpxk5E/XE7P5F1P5aimqlk1vbLh3X8Zv91pZL0vmUfLyCBYuDelj5RB9W5j2VPMtt2EVTQ3IckVOb2yRGVlhXztupkEouQ= 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=W5WfYls4; 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="W5WfYls4" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2681623f927so12572185ad.0 for ; Thu, 16 Oct 2025 16:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760659155; x=1761263955; 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=amhCjyCI8MmrcwuS+u9dzfqGhU0Q37AqcKDz74nSqyc=; b=W5WfYls41nKJ68TsW8ExbHQFqRYZABXvP4DQcIYUz1yLflXv4nHY960spUE1DLe78Y ABPJk5cZF+NPJltWLddq0p2ybbP0YL0/9RV4u2nmWmmvNFmEcqqABdeHe/SgZZFAZ8BX TerwQpC8Wzt/4rm9I+xbbJN49WhYVzZX84M9uIgLkxU4yPIAnb2HvpZ91ROiOQROKIos GPfd6UwqQ25OdZ5k/7YjDVWMXouBbiyU3zzpazlU+ezDhK6PRjNtTGBfnMmQXXz3e+Ua W4yZFFc1Y8Klm2lTKoN9TdfGzKcJPeySHD9e+i1oaqDIFyjYMaS5FXFQxvPd78KpdWhy s1WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760659155; x=1761263955; 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=amhCjyCI8MmrcwuS+u9dzfqGhU0Q37AqcKDz74nSqyc=; b=i//StzE4ZeAglcG653wzgq5jsvvWdkKluqbDpxFcqxSByJ3m/2c5SeuzlwfrWS+cem m3jGuX1QUJ/wAq8KQyzDf4LSoD6cdQlpEf9yZFl6NH4et4QamGhUaudkSC0uFjTzcqXC c4PAnh7sNvTTOJYnXZ1E7/vMEZat12Q1l9xFZCpM5exYMZuqHcgBz7tRf1rYfGUrxMw/ f+xsmH7AMSdph1gSsB2eecDj9eetl799C3ZEiRYAnEKSETeKwfmge5XWHSKifl4eofld pS+OY78MC3pj0f3KnYh68+DMdYdpbyRhrVhl1R4ojFEKvCgJmCtnlHRnLowIoRnlz4Cc Tssw== X-Forwarded-Encrypted: i=1; AJvYcCXp9P8wdQIGc+86IyHqM6BD2O/hq5HPlEPJpWGHaMguSZ9h/gqFM+0MV/B8tHIr3DX3CY4cnyen8Hzo87Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yy459GIAqV2A+E0y26VHOjjB1ekySoXPmu63h3IuNTcxpdSCBSo av3qXqyaMilTMg+3XHWrV/s0L0PeX4gf+hD8HOrtPX/FPU+3raPcpZcWxToiZtX9XfxLfdV6fdO 2Yr4X6A== X-Google-Smtp-Source: AGHT+IGnNvgCUQhrSpH6uovgpuM+LtzLmQViNt230iZuf1i1LHjt0isB6VwcYtPMlC/XIQJT1C89rlbyfok= X-Received: from pjrx10.prod.google.com ([2002:a17:90a:bc8a:b0:330:6c04:207]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2309:b0:262:79a:93fb with SMTP id d9443c01a7336-290ca121803mr21591325ad.32.1760659154882; Thu, 16 Oct 2025 16:59:14 -0700 (PDT) Date: Thu, 16 Oct 2025 23:59:07 +0000 In-Reply-To: <20251016235909.2092917-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251016235909.2092917-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.858.gf9c4a03a3a-goog Message-ID: <20251016235909.2092917-2-jthies@google.com> Subject: [PATCH v2 1/3] usb: typec: ucsi: psy: Add power supply status 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, Jameson Thies Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for power supply status. If a port is acting as a sink with the sink path enabled, report it is charging. If a port is source, report it is discharging. If there is no connection or the port hasn't enabled the sink path, report not charging. Signed-off-by: Jameson Thies Reviewed-by: Heikki Krogerus Reviewed-by: Benson Leung Tested-By: Kenneth R. Crudup --- drivers/usb/typec/ucsi/psy.c | 26 ++++++++++++++++++++++++++ drivers/usb/typec/ucsi/ucsi.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/drivers/usb/typec/ucsi/psy.c b/drivers/usb/typec/ucsi/psy.c index 62a9d68bb66d..2b0225821502 100644 --- a/drivers/usb/typec/ucsi/psy.c +++ b/drivers/usb/typec/ucsi/psy.c @@ -29,6 +29,7 @@ static enum power_supply_property ucsi_psy_props[] =3D { POWER_SUPPLY_PROP_CURRENT_MAX, POWER_SUPPLY_PROP_CURRENT_NOW, POWER_SUPPLY_PROP_SCOPE, + POWER_SUPPLY_PROP_STATUS, }; =20 static int ucsi_psy_get_scope(struct ucsi_connector *con, @@ -51,6 +52,29 @@ static int ucsi_psy_get_scope(struct ucsi_connector *con, return 0; } =20 +static int ucsi_psy_get_status(struct ucsi_connector *con, + union power_supply_propval *val) +{ + bool is_sink =3D UCSI_CONSTAT(con, PWR_DIR) =3D=3D TYPEC_SINK; + bool sink_path_enabled =3D true; + + val->intval =3D POWER_SUPPLY_STATUS_NOT_CHARGING; + + if (con->ucsi->version >=3D UCSI_VERSION_2_0) + sink_path_enabled =3D + UCSI_CONSTAT(con, SINK_PATH_STATUS_V2_0) =3D=3D + UCSI_CONSTAT_SINK_PATH_ENABLED; + + if (UCSI_CONSTAT(con, CONNECTED)) { + if (is_sink && sink_path_enabled) + val->intval =3D POWER_SUPPLY_STATUS_CHARGING; + else if (!is_sink) + val->intval =3D POWER_SUPPLY_STATUS_DISCHARGING; + } + + return 0; +} + static int ucsi_psy_get_online(struct ucsi_connector *con, union power_supply_propval *val) { @@ -245,6 +269,8 @@ static int ucsi_psy_get_prop(struct power_supply *psy, return ucsi_psy_get_current_now(con, val); case POWER_SUPPLY_PROP_SCOPE: return ucsi_psy_get_scope(con, val); + case POWER_SUPPLY_PROP_STATUS: + return ucsi_psy_get_status(con, val); default: return -EINVAL; } diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h index e301d9012936..cce93af7461b 100644 --- a/drivers/usb/typec/ucsi/ucsi.h +++ b/drivers/usb/typec/ucsi/ucsi.h @@ -360,6 +360,9 @@ struct ucsi_cable_property { #define UCSI_CONSTAT_BC_SLOW_CHARGING 2 #define UCSI_CONSTAT_BC_TRICKLE_CHARGING 3 #define UCSI_CONSTAT_PD_VERSION_V1_2 UCSI_DECLARE_BITFIELD_V1_2(70, 16) +#define UCSI_CONSTAT_SINK_PATH_STATUS_V2_0 UCSI_DECLARE_BITFIELD_V2_0(87, = 1) +#define UCSI_CONSTAT_SINK_PATH_DISABLED 0 +#define UCSI_CONSTAT_SINK_PATH_ENABLED 1 #define UCSI_CONSTAT_PWR_READING_READY_V2_1 UCSI_DECLARE_BITFIELD_V2_1(89,= 1) #define UCSI_CONSTAT_CURRENT_SCALE_V2_1 UCSI_DECLARE_BITFIELD_V2_1(90, 3) #define UCSI_CONSTAT_PEAK_CURRENT_V2_1 UCSI_DECLARE_BITFIELD_V2_1(93, 16) --=20 2.51.0.858.gf9c4a03a3a-goog From nobody Mon Feb 9 01:45:36 2026 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 00EBA2E88A1 for ; Thu, 16 Oct 2025 23:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760659158; cv=none; b=XVxEIqtry6h8O2vzYAoYLevVbAB3jKYVEIAyNrRQ+NkjURvp3IIGUNZaH9Bngqc+IqC3G3CdzBnDcyghMLi7OQISJB+c1W4nPycRRmx8pzkxBSKQLFD7nMuVRr+kAmLbnMGDPBcPtkafeHtU0/fcIDOyYhFAMMSvT98cciS/1gI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760659158; c=relaxed/simple; bh=cVcXBVu0k1e2ZRGGGJ4RUhqAr8gGPi6p8pLo82SXQ14=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=GxHwZuvOXBfEBuTMRfdv1DyY/9uB5tFykGpcW1BNBBSeb21Lv8h93sGVEuTZITg3pWsyYpyFsKlkS0EMwNw0rdFMy2B1+7bM3uPCnIO1C66dhZWd8dXjOIhbvwN4pU5kd6ZVThnxlVhYmo/O7dGGaMumW8NihECA2FkcNR2ESxw= 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=Ccep93lD; arc=none smtp.client-ip=209.85.216.74 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="Ccep93lD" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-33bb3b235ebso1962165a91.1 for ; Thu, 16 Oct 2025 16:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760659156; x=1761263956; 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=eqtzN3u7r+YLYm+sK/X2sT3wcYKU5XU4zGVHMnL2rk8=; b=Ccep93lDRJnQiFPpREkcH9twaXLS8KEc9q8O8s7cDLRqIFM78PXMo98tJISo/lqxwc M5+zGuMHgydwkEoqRQ2nKbfUC1C78Y/s4Le5YIxAixcrjkawsBKTsF2mK/f1kL6r5KOs 4OYKCPK9cN6fCSt3wGhYZisXNAqmeIWCQMoB6GkVSt/Jl9Ibg1/y3TKYNIO27tDWVmOG fBA4pY8SM9kz6wO5it0tabg4vgVjDvCpOYtSymQxnMlkfemhWMrLrkUoKD/OF6Z+zuWL ShoG8V9r/2avnv7AANwOitqZkVNLNXOhMgrng73rqoaV40bTDdSJpIQ+5dHg2Ppl2TZA s/5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760659156; x=1761263956; 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=eqtzN3u7r+YLYm+sK/X2sT3wcYKU5XU4zGVHMnL2rk8=; b=Md0fAkuC0B/GEa1I/haWeSnkrFxt+AA+n7DaOHM+3Yesu2JzBvRAmyKLxgpifn5KXW UXr6xYg15fhi5v3A2D709uFzNYJ+mgGp8eW0FPv04GtlBbF7/zwVbPeVEArsxMlJLsQX G51mzG8QcncRJ1/XJe19l2//+7GTNHcGSwAYO5lDHRkCvKX8Cr/nbmtsBtPnYjnnO436 KP9ODStMKesk7tgD506jFwyOU6MvfBvctWKpfz87y/PbihN5ktq0XrojjYdAz8pbnnZu oo22X2ph1osNJCwHNZb942v1Z6GPENJlfrg6mDQ2dIrzBVvQC9cI11Ue6dLWH53X/Nmo a+1Q== X-Forwarded-Encrypted: i=1; AJvYcCXK+FI4Y5OEP+1OSJcdcPfJhfzLFm6HGaAVYLhilWi6Q/Giu60E0C5w89cJy7sBj7l2pBwAXDWMitrELKk=@vger.kernel.org X-Gm-Message-State: AOJu0YwFEIYC2naPMgqVxmqZnbpy2pTDYpdLEDyPvMFB3TVxvido9S/1 +XqTOEDLwui0TqJPlpDMB+HDZseQFY1RSJ/rzEGOR0q2P2MIqTwXJ1LXKH4i6HRKadLlZ0D0rea lOvU45Q== X-Google-Smtp-Source: AGHT+IHtcbdwP9Wxf0JSNuqCWmvroXZg4RbHOg6ahPle404TYQoEdJxSL7fw+8XsYpRsjXT5w4FJSGoxoa4= X-Received: from pjbsc12.prod.google.com ([2002:a17:90b:510c:b0:33b:9db7:e905]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:55cf:b0:329:d8d2:3602 with SMTP id 98e67ed59e1d1-33bcf8f9c49mr2193375a91.17.1760659156328; Thu, 16 Oct 2025 16:59:16 -0700 (PDT) Date: Thu, 16 Oct 2025 23:59:08 +0000 In-Reply-To: <20251016235909.2092917-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251016235909.2092917-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.858.gf9c4a03a3a-goog Message-ID: <20251016235909.2092917-3-jthies@google.com> Subject: [PATCH v2 2/3] usb: typec: ucsi: Report power supply changes on power opmode changes 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, Jameson Thies Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Report opmode changes from the PPM to the power supply class by calling ucsi_port_psy_changed(). If the current opmode is USB PD, do not call ucsi_port_psy_changed(). The power supply class will be updated after requesting partner source PDOs. Signed-off-by: Jameson Thies Reviewed-by: Benson Leung Reviewed-by: Heikki Krogerus Tested-By: Kenneth R. Crudup --- drivers/usb/typec/ucsi/ucsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 3f568f790f39..7b718049d0d1 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1022,14 +1022,17 @@ static void ucsi_pwr_opmode_change(struct ucsi_conn= ector *con) case UCSI_CONSTAT_PWR_OPMODE_TYPEC1_5: con->rdo =3D 0; typec_set_pwr_opmode(con->port, TYPEC_PWR_MODE_1_5A); + ucsi_port_psy_changed(con); break; case UCSI_CONSTAT_PWR_OPMODE_TYPEC3_0: con->rdo =3D 0; typec_set_pwr_opmode(con->port, TYPEC_PWR_MODE_3_0A); + ucsi_port_psy_changed(con); break; default: con->rdo =3D 0; typec_set_pwr_opmode(con->port, TYPEC_PWR_MODE_USB); + ucsi_port_psy_changed(con); break; } } --=20 2.51.0.858.gf9c4a03a3a-goog From nobody Mon Feb 9 01:45:36 2026 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.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 B85E72E9756 for ; Thu, 16 Oct 2025 23:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760659160; cv=none; b=hcjzTij/AvDoyaHWODIsh97l5ew0wZV/DUoXw/Zn7oqjO1fEoxoRt9D4FF+iuQM6XgdYq8PS9QH7cVctKc/9lFMZjVYOUbfu3o/KNcp3tEzFaaonculYPLMVigzs8C/78q4c8wzyewh9oHbDDdiB+7xYEt6oUWaLFzVYwnZ0fJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760659160; c=relaxed/simple; bh=WE1Ux7Rt098ZLRDNgjhehsgJW8hPOrR/KgyCdv0Yg+4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rN+48WAKOCb/o2IGQxgbqhNGPuGOccvZ0mhtv6eb4JSd08S6ls0kNPjEsK3glkfS/1nVrxYnEfW+pim0JuntOmbwXpMNGXnMaKKRj2SPPnSUDSRJ3JQ6pdMUX9y8Begk2GnD2qrJr2s/8pevnyiPfLrnKUZGxrl4A4y2eGVWp6Y= 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=3k9xM5Ui; arc=none smtp.client-ip=209.85.215.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--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="3k9xM5Ui" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-b632471eda1so1227992a12.0 for ; Thu, 16 Oct 2025 16:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760659158; x=1761263958; 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=j4ZD2TO+dabREMxCZUv1sX5s7/hIQJuO7N3PFIef3ns=; b=3k9xM5Ui527/LG1tJnX7O+N2FjFrFXSjnRe4e1KVDLD3HSgRZRJ/wxaTdf/Fg38WgA c8LJpy5IEefnDg/YE9NYAktMI+F0x5Y0Lrb2OwML106Fp8cgN0aP70Ty4XP1th887y/R SdfYpGDw5TpZzrv9icNjGgTxg5Upwl0YSeaxvDzBPhtotH/3TCRvAyIyD9xDXFMRWRoI BMFhJhF8gqRubmcF2s9a8NTJfzV56k6OaO7zVtbSZt+lNjdZ75xdSO+KSi0ZHFNNlCef kIGxJEGa5PmF8ybOJlQK5IMgQeJPupuYT7/5Hdn5vZIaJn8xQO62BkuuVRUBDm6f69Mk vCng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760659158; x=1761263958; 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=j4ZD2TO+dabREMxCZUv1sX5s7/hIQJuO7N3PFIef3ns=; b=wJK2RsTZeqiJFl5jNqf9+vSguObJmfKNEj6hi/+qChsPNMALK2BlTZsUoPMRm7Qshh 56gwUSwBy2Wommd1L6+wW52yZRqWjc0ytHTJ4wJfJGJ5Kg3NLNBZFWRrQ+ZDyHItEY9O 4rWgCtov9n1SSFh1ic14lnLNGMs+9YK/hAphPuxMQobJ1Uwhwu6FaF/ZrQowI3pTj0wI TDepej+cAyewjVhE63Pb5c9byhBt/Cx6I97MEsbb5Bp5aGWzj/QkzVVgH3dryz7yBoaU TbadjSf6XXcBpTgQwnWw+nbmYN84HjnrYyV/AmPAHwbz+iIdy/bTv6ZkOzG+cVbAbmR7 6t3Q== X-Forwarded-Encrypted: i=1; AJvYcCWAiRFvAPlfBn4GVy2zHeCTOXe9RNnRxPYrRPwgRgkoqeQn54XHgDQpw0xo+38kFgB0TWxe3igOMcdkkTo=@vger.kernel.org X-Gm-Message-State: AOJu0YztD/Dprwye+2P+zax4yIVCp0/4XH1D03QYaHw8njaZt4BuCkTt s+4MpgaObA/M47atJMsk9Vkg1RUZji63RCegIo6VluKJPoq6OfsSOLZxUOoBWVnNPbAn8Fbrqe1 4oNVphA== X-Google-Smtp-Source: AGHT+IGIeuq5jBttQfOPZDegsqumWfJZ/LOWeQkhcn8gZ4JaojN86hrd1bFUOoF/UZUtJUupg3tr8KyZFtw= X-Received: from pjut11.prod.google.com ([2002:a17:90a:d50b:b0:33b:beb0:be7]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4c11:b0:32b:9774:d340 with SMTP id 98e67ed59e1d1-33bcf91909fmr2098196a91.33.1760659158090; Thu, 16 Oct 2025 16:59:18 -0700 (PDT) Date: Thu, 16 Oct 2025 23:59:09 +0000 In-Reply-To: <20251016235909.2092917-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251016235909.2092917-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.858.gf9c4a03a3a-goog Message-ID: <20251016235909.2092917-4-jthies@google.com> Subject: [PATCH v2 3/3] usb: typec: ucsi: Report power supply change on sink path change 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, Jameson Thies Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update the UCSI interface driver to report a power supply change when the PPM sets the Sink Path Change bit. Signed-off-by: Jameson Thies Reviewed-by: Benson Leung Tested-By: Kenneth R. Crudup --- drivers/usb/typec/ucsi/ucsi.c | 2 +- drivers/usb/typec/ucsi/ucsi.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 7b718049d0d1..cad3913bd7f9 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1293,7 +1293,7 @@ static void ucsi_handle_connector_change(struct work_= struct *work) if (change & UCSI_CONSTAT_CAM_CHANGE) ucsi_partner_task(con, ucsi_check_altmodes, 1, HZ); =20 - if (change & UCSI_CONSTAT_BC_CHANGE) + if (change & (UCSI_CONSTAT_BC_CHANGE | UCSI_CONSTAT_SINK_PATH_CHANGE)) ucsi_port_psy_changed(con); =20 if (con->ucsi->version >=3D UCSI_VERSION_2_1 && diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h index cce93af7461b..35993bc34d4d 100644 --- a/drivers/usb/typec/ucsi/ucsi.h +++ b/drivers/usb/typec/ucsi/ucsi.h @@ -382,6 +382,7 @@ struct ucsi_cable_property { #define UCSI_CONSTAT_BC_CHANGE BIT(9) #define UCSI_CONSTAT_PARTNER_CHANGE BIT(11) #define UCSI_CONSTAT_POWER_DIR_CHANGE BIT(12) +#define UCSI_CONSTAT_SINK_PATH_CHANGE BIT(13) #define UCSI_CONSTAT_CONNECT_CHANGE BIT(14) #define UCSI_CONSTAT_ERROR BIT(15) =20 --=20 2.51.0.858.gf9c4a03a3a-goog