From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 E955F37C904 for ; Thu, 16 Jul 2026 16:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784218716; cv=none; b=hKObLYARzNFcC50VHYV/lMjzo15Bk29rb4V49MqiBPDr7NLRVXMtIxEbr0mGCGbnXT82Mk5mLGpWjt7xTeoZ7D3IQQOZUbHsKnREFZCmvQDaQyQ1XJ/bvfCSDiRNa+eOr2n+EFMgYOIc+TMynY3uxofy2eKW2IKUVD/8om2gfr0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784218716; c=relaxed/simple; bh=OvZGQdRrKQ1cKCtBZ2vJJlctMXShVHIPX/EnnD1FRmQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zt3Lydpr/Hyk3kskqL16WfQPq3SmSoc41f5cOtjq9yR8s0d7PQlo2ElObDunKOMH0PJL+b7+OA6rz7OqKlN94TYf8UBwebO6Vwhh1sL307jBtxWTtJgoFkJLMSrgyS7Ae2fdPE9xYwZVzFtGDzXqhIBmJNlMB4wSuA6XzJw63Kw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=CnSn1BRp; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=SB7Fjzz1; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="CnSn1BRp"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="SB7Fjzz1" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66GDKMh72857816 for ; Thu, 16 Jul 2026 16:18:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rBvoXcE6fyfh67dFVJmu8Fy0oBNY0thH0kUQWM4o/d4=; b=CnSn1BRpTHnJbFGf +T/6tewwxH6wTIdT0lXcjtg3atp9yuC5+r1BGMEx/6ME8clCZqHN5QYZY29MyPRV vjlbCxinuqm/0qULVrWZt7GEfSOr5TGDUFPLIgPEq3x+wPwJ/vvFoC9s2MTLjTa2 n7Xkzy4O8QTcG0fYsJGuuxylsYuPutVCSEdlPlRUhHIuAB2DPnTr1GlbTYSaDXI7 3NfO/kFdk/q7jZTftR/lKDXGmMHcx5UQb0Neym0uUucX3JvFftGrEOaShPJxc5ub 3vb06u/V/pAEh+j0BF1E7neqB1N6Bre5F7nSOnCYaDFShH5CtThMyq5xm+mu6/Ju nJZp8w== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4feuex25xh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Jul 2026 16:18:30 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-51c1c7f135bso65089341cf.0 for ; Thu, 16 Jul 2026 09:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784218709; x=1784823509; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rBvoXcE6fyfh67dFVJmu8Fy0oBNY0thH0kUQWM4o/d4=; b=SB7Fjzz1UP3Kj0yNGAWVrg+afazPamEP+b6hNp/KUuXGp6bh2gOTflYM48fqAKat5B KE+gEwE0VKaX9x3/TIy0Fuzbo7rRvrvm4kImaQxxAYYG/4nmakT1VztBMA/YPLg9Yi9A D+vw4xLdK6LnSxwPXtcwPZVOjFqaGNVXiNXHIc/iGxqnJVwslsAntAm8uZNC3/TreK0C Y30OuFTBIkEMeIUkgA0oB+QdXuWEzLuIA7lzblsjHPitbFYOUszYPBRL5dYvGhTEOVq5 BGuyxm1gYsfxApPrCJs62etTdquQ3zwVDyg2m5dyauP/hpTKBjlliDCB833c1sB5hvBi 2QjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784218709; x=1784823509; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rBvoXcE6fyfh67dFVJmu8Fy0oBNY0thH0kUQWM4o/d4=; b=MfzFc0qrOfvYJusm7lmP5QdGL4YOI8P1zg03B+Np6EHUAUnUB826UBsIneS44dWCGF jq/nVKrDLF+A1QeOub2xvp44rlgwj0dwWitc/staxt1ws7fNoP37QnY+FbBPVedRTfT1 T06I2S2ChBQK7VGiJm9UkqcIrcWjkk1fJqlXSBxtRMkMkhuWywXbySzh0qf+KDF/R0nt Q/Qj1/XbR3S0E19VhqAMLZHUfjwHEb/kkOdV3WtdwouUgP6g1277iEjxUTeIAiElDx8L tm5yK54arZ27LsdGdLaPccpDotLa00NjpvGj2Hgh3j1JhbCDxEcqsT9SE8IPEmjZfdhO H4ug== X-Forwarded-Encrypted: i=1; AHgh+Rq0FFyGrfuZLJ6JL45kXUeq4vxBHYFKwZ5uKT0MhsEKIw5JRujj2G2lacrn//Pv9Q0U+U/LgGfGF7Foc+A=@vger.kernel.org X-Gm-Message-State: AOJu0YwBVoRt9HDZKYkymxElNPYRmgEhr7VkueLsKNCECMiKpqVz8TBM Ou9dj+sRBpyeY8dqwnWBGjXv7cRtd6L3kbIqQAXuRnGeh8t+sKV7PEchXe6cODN4yuIt5Ki7f50 7JW8Eq043RTOxZsZt2/jVPHwGtrA8LUpG/k5KD8CLCnOk4JxKtOr8FLtKlN3h2IczZrU= X-Gm-Gg: AfdE7clndNsRo58m9tnmLTqNUwN/BO/o2tn/Cg7ecKr/6/yCY+crO9FCkQBCiDuxCBl odEFDQywvtJPtsRMsOgDhzZ6ExqciM+x1lTGiy8DXhQ0sP3vWyHtbpS27P57Tyd2FqA5hbgJkMR +dlDtjBmNmkUJgR1CKr77y93J7s6KrzILm9h8dA1KZAuWMZli8vVsjAy4DTxkI0gxllq5wB3BfC Es6kNq49kYLYy496KkdUe8COWL4bXenfTz7noFt2gOpEqJdJhk8H8X9GkYSprMaCFPBR9QZn01n IVaCZMdtJdpx3laxLgan/5V0OpvEX4mTgp8lBKlDRHrn4qhftMeZU1Q1qpMNEczHLudFgA9802F OMVSNQmH3X8MGOtRC2KN6YX9vUdkUw7YmVNxHyPHEy5YCVm3LYrr0YVddD9T09XZYqBt2Qeb0AK vfm5TubvG3cwThmvHkjIO+x+rmmU2FiJwLHNmmix+6qGKSe70b6Ao= X-Received: by 2002:a05:622a:112:b0:51b:f40b:2fac with SMTP id d75a77b69052e-520be692394mr2840861cf.50.1784218709376; Thu, 16 Jul 2026 09:18:29 -0700 (PDT) X-Received: by 2002:a05:622a:112:b0:51b:f40b:2fac with SMTP id d75a77b69052e-520be692394mr2840331cf.50.1784218708837; Thu, 16 Jul 2026 09:18:28 -0700 (PDT) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:751c:d61c:c91:60dd]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c168744bdddsm257262866b.48.2026.07.16.09.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 09:18:27 -0700 (PDT) From: Loic Poulain Date: Thu, 16 Jul 2026 18:18:20 +0200 Subject: [PATCH v4 03/11] power: sequencing: Add pwrseq_is_controllable() API Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260716-monza-wireless-v4-3-9b02e6f549d7@oss.qualcomm.com> References: <20260716-monza-wireless-v4-0-9b02e6f549d7@oss.qualcomm.com> In-Reply-To: <20260716-monza-wireless-v4-0-9b02e6f549d7@oss.qualcomm.com> To: Manivannan Sadhasivam , Bartosz Golaszewski , Marcel Holtmann , Luiz Augusto von Dentz , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-bluetooth@vger.kernel.org, devicetree@vger.kernel.org, Manivannan Sadhasivam , Loic Poulain X-Mailer: b4 0.14.2 X-Authority-Analysis: v=2.4 cv=JeeMa0KV c=1 sm=1 tr=0 ts=6a590456 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=4a-8Ivk512-2hps7UIkA:9 a=QEXdDO2ut3YA:10 a=a_PwQJl-kcHnX1M80qC6:22 X-Proofpoint-ORIG-GUID: liMyVhjWDzu6Db7IouAhlYNYzK0HE3qw X-Proofpoint-GUID: liMyVhjWDzu6Db7IouAhlYNYzK0HE3qw X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE2MDE2NiBTYWx0ZWRfX+cIZN3jqPVtf WM2gj9xT80/WmsHbQEaqgyeUkIvWDp/hW+0SAFAbQaFUNVFO8DViTAbvTDocQTE0lp5Te0IrWgM XHUsy2+0OBWft7TjzpNqd7JCWOEKC1U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE2MDE2NiBTYWx0ZWRfXxoT6VFP0wqtz Kxnm9bDuu0ubU4NAIZndH260b+S82c7GfksJzHPMUoxGeMxiixlLnYKo/ASdqPjt4XCoNq1FWfv /GP+kYV4SmKTBVxTbFDpnN9LaeZb44/w4aLanQD75LuBWlaNgF6/BK27Y0BWPbH/Rn9y3tUh4/5 ZMHH6u/HPft6qyN+XggLWLs/aTWiF6Kx9sgfVCiS/9hNeQuqMzvQvOfV0j6588uvfewobxU9VsX NKHMzyDwxA8JoJGJQv+WVJVJkZKBKUsEGnKr0MiQz4ZqIhV0XIJ4/inXbTvyMxUpcDAwaalmyhc v3X0C5KuSOmgqCzI92eypE1eF7VqoSsB7hf95X84LZxcR631yqXzp+auDKvaBGV6e1sKRwAT935 VU3LBSAfejXjPI2LTtsARo10ZFu6G7sYUzb8NkW5t2Uzh1cWnfhyVE4CXeVsmv2qSin4Ru3BvOs SV36iGOAHZ3Ob3WerPQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-16_05,2026-07-15_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607160166 On some boards a power sequencing target has no host-controllable enable for its function, for instance when the enable line is not wired up to a GPIO and is hardwired to an always-on level. The pcie-m2 "uart" target is one such example: when the M.2 connector does not route the W_DISABLE2# signal to a host GPIO, its enable/disable are no-ops and the consumer cannot gate the Bluetooth function at all or exclusively. Add a generic pwrseq_is_controllable() helper. It reports whether the target's final unit provides a host-controllable dedicated power actuator. The target can implement a new optional is_controllable() callback, reporting whether that actuator is effective on this target (for example depending on GPIO presence). If the target does not provide the callback, it is assumed to be controllable. Note this only describes the target's own enable actuator. It does not imply that a power-off reaches an electrical OFF state, since a target may have multiple consumers. It also does not mean that power is uncontrolled for the target's dependencies: those may still be gated on their own. And it does not restrict consumers from calling pwrseq_power_off() either, which remains valid to drop this consumer's vote on the (possibly shared) resources and dependencies of the target. Signed-off-by: Loic Poulain --- drivers/power/sequencing/core.c | 49 +++++++++++++++++++++++++++++++++++++++++ include/linux/pwrseq/consumer.h | 7 ++++++ include/linux/pwrseq/provider.h | 8 +++++++ 3 files changed, 64 insertions(+) diff --git a/drivers/power/sequencing/core.c b/drivers/power/sequencing/core.c index 02f42da915985339d3de507fc36dd158b0035a99..cabb3d0885f94d9d70e0631861ed6905d91ad3bc 100644 --- a/drivers/power/sequencing/core.c +++ b/drivers/power/sequencing/core.c @@ -182,12 +182,15 @@ static void pwrseq_unit_release(struct kref *ref) * the state lock has been released. It's useful for implementing * boot-up delays without blocking other users from powering up * using the same power sequencer. + * @is_controllable: Optional callback reporting whether enabling/disabling + * this target actually controls power. */ struct pwrseq_target { struct list_head list; const char *name; struct pwrseq_unit *unit; pwrseq_power_state_func post_enable; + pwrseq_is_controllable_func is_controllable; }; static struct pwrseq_target * @@ -206,6 +209,7 @@ pwrseq_target_new(const struct pwrseq_target_data *data) } target->post_enable = data->post_enable; + target->is_controllable = data->is_controllable; return target; } @@ -991,6 +995,51 @@ struct device *pwrseq_to_device(struct pwrseq_desc *desc) } EXPORT_SYMBOL_GPL(pwrseq_to_device); +/** + * pwrseq_is_controllable() - Check whether the target provides a + * host-controllable power actuator. + * @desc: Descriptor referencing the power sequencer. + * + * Some power sequencing targets provide no host-controllable enable for their + * function on a given board, for instance when the enable line is not wired up + * and is instead hardwired to an always-on level. For such targets a call to + * pwrseq_power_off() is still allowed, so that the consumer can drop its vote + * on the (possibly shared) resources, but the host cannot gate the function + * on its own. + * + * Returns: + * True if the target provides a host-controllable power actuator, false + * otherwise. Also returns false if @desc is NULL. + */ +bool pwrseq_is_controllable(struct pwrseq_desc *desc) +{ + struct pwrseq_device *pwrseq; + struct pwrseq_target *target; + struct pwrseq_unit *unit; + + might_sleep(); + + if (!desc) + return false; + + pwrseq = desc->pwrseq; + target = desc->target; + unit = target->unit; + + guard(rwsem_read)(&pwrseq->rw_lock); + if (!device_is_registered(&pwrseq->dev)) + return false; + + if (!unit->enable && !unit->disable) + return false; + + if (!target->is_controllable) + return true; + + return target->is_controllable(pwrseq); +} +EXPORT_SYMBOL_GPL(pwrseq_is_controllable); + #if IS_ENABLED(CONFIG_DEBUG_FS) struct pwrseq_debugfs_count_ctx { diff --git a/include/linux/pwrseq/consumer.h b/include/linux/pwrseq/consumer.h index 3c907c9e1885dc2958043a9a733fbe20bdf95f6e..f70f694c19ab73f70ccf775aa24902bfcc982a42 100644 --- a/include/linux/pwrseq/consumer.h +++ b/include/linux/pwrseq/consumer.h @@ -25,6 +25,8 @@ int pwrseq_power_off(struct pwrseq_desc *desc); struct device *pwrseq_to_device(struct pwrseq_desc *desc); +bool pwrseq_is_controllable(struct pwrseq_desc *desc); + #else /* CONFIG_POWER_SEQUENCING */ static inline struct pwrseq_desc * __must_check @@ -58,6 +60,11 @@ static inline struct device *pwrseq_to_device(struct pwrseq_desc *desc) return NULL; } +static inline bool pwrseq_is_controllable(struct pwrseq_desc *desc) +{ + return false; +} + #endif /* CONFIG_POWER_SEQUENCING */ #endif /* __POWER_SEQUENCING_CONSUMER_H__ */ diff --git a/include/linux/pwrseq/provider.h b/include/linux/pwrseq/provider.h index 33b3d2c2e39decafac6c6fca9254ad4329d90e94..7285ad94a2214070a1c27f25c783f51105705b36 100644 --- a/include/linux/pwrseq/provider.h +++ b/include/linux/pwrseq/provider.h @@ -6,12 +6,15 @@ #ifndef __POWER_SEQUENCING_PROVIDER_H__ #define __POWER_SEQUENCING_PROVIDER_H__ +#include + struct device; struct module; struct pwrseq_device; typedef int (*pwrseq_power_state_func)(struct pwrseq_device *); typedef int (*pwrseq_match_func)(struct pwrseq_device *, struct device *); +typedef bool (*pwrseq_is_controllable_func)(struct pwrseq_device *); #define PWRSEQ_NO_MATCH 0 #define PWRSEQ_MATCH_OK 1 @@ -43,11 +46,16 @@ struct pwrseq_unit_data { * the state lock has been released. It's useful for implementing * boot-up delays without blocking other users from powering up * using the same power sequencer. + * @is_controllable: Optional callback checking whether enabling/disabling this + * target actually controls power (for example when the + * controlling GPIO is wired up). If not provided, the + * target's power is assumed to be always controllable. */ struct pwrseq_target_data { const char *name; const struct pwrseq_unit_data *unit; pwrseq_power_state_func post_enable; + pwrseq_is_controllable_func is_controllable; }; /** -- 2.34.1