From nobody Mon Dec 1 22:05:49 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 E2A3430FC2C for ; Mon, 1 Dec 2025 12:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764593016; cv=none; b=acmsEe2IBaBipGdhy4s1wSdZNYmDvcoCEx9YrLmewn+UjrHkJRTQ/Dl88AwX31PSs6fqHk09gfKKBIq1HrFbt+5AOAyzPL/qLIzItr6RyWAW4l9Ob4HJ7ri79hMpT7kJ98CgeYk6fTJ5erpw5VpcMdR6qoctFRZsVCy6kfbpVaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764593016; c=relaxed/simple; bh=O1bfb49f81nWjSwl16Z6OQyKyPquLUwL1wCzDbmKlZQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k/Gbyp6mD6MOpprCXhUSliLJ6hZjuz0CE+n9vHr261wzSMf45wpysAy0+hXzGGqHxElBpPjitts3fGHFH7i58kBhKYsA4GNIo7IwpxXRNUXX1Rt6cGS4GoIT+6PEWZN1kwGvhD4tyinmeky88DhsKtMS5VTqYvQKxg5scPpJ5s8= 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=jmGcLuQj; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=bLlraItj; arc=none smtp.client-ip=205.220.168.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="jmGcLuQj"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="bLlraItj" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B19MEHU3362428 for ; Mon, 1 Dec 2025 12:43:34 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= YC6FU3llCYxXh4VP04XbK7i9763mHcc9u/o//Iu96T4=; b=jmGcLuQjx1kSOQH8 znVK1DJ4FY7Ci3owB8HJ6D2/pr8V281Yz1rCRbBrV2Wwk8ACe/Dc0ecc1XTa/yfQ qym6y+ByyrSi6k26VkLVYCp5FiHut7QKKR/Gi8xqmnubfwpuX86qUuoaZbhrS6t+ +qmG6VfiIMvR8cFDX2EN6GSLIut0wO105sE12uxhad+lQKSRQABpBYPb4ZFa0GlT C4tFosIk3SsU7ljWUXllkYcKmvpSUd6CXq476tsEg2z0hsY2IjTSYmalJD+VllcX EpExd0XSH8AJzeKCvRP07ilxzjB7XGfYlwxcJXvTVLApdMUx2hXnrlDp0fazZyuP LCSW0g== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4as8b00j6v-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 01 Dec 2025 12:43:34 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-343806688cbso7928055a91.3 for ; Mon, 01 Dec 2025 04:43:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764593013; x=1765197813; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YC6FU3llCYxXh4VP04XbK7i9763mHcc9u/o//Iu96T4=; b=bLlraItj2P55/yiHytR5LwtMF06M5dAxheMLxJhESbzm1jtJX1wleBt/TqWkOGA0lB AFes89kdare6we/B/Bb+z/y6XWH7At1khP+v2xGMm9+K6Yom1eRNaHzSdzWQVu/T+QAm HJRdZP3fyK/33QmpN0z23rfnBh5Uakv3QfsuHJBoR1afL3k+c3NA8e1r24u5oOqqnHe/ SrmocA+0szUwhjqTSZyp0KBGq7eAqgb5xQNc3clHMWKT3gU9kboc0qJABEfosx6YFEZr pMNLCSs2NGS+bvcwXdSuTICGVCBT2gfglgQLarAqRZWG4G5689EU4YMYWsWRLd4el3g8 1dGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764593013; x=1765197813; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=YC6FU3llCYxXh4VP04XbK7i9763mHcc9u/o//Iu96T4=; b=s4zlJwXFdIEXz8V60/issypd2ipDT0DsJKFoDhLg5YvzWLp+k5ID56Y1al3/x15qUz LY/UNY/fU/vnWE5OAGZ5bdWgLn6r9kf46Pl5XBA6rtFNYNTtLQMaQoeDuVlRb/lY4d8p i+hWr/7s0Zb3HexvmQeKpgOIRfpM4G9ICcZM1mcqIt/x+IQwG5uO84IM/uk79z5ati0Z m5FSO5P9+NcH07YAlYPOxD1G2+X4hNpS/pgRDlxgRofB6V6zfJvSpex68/NNhnImqrGl W1eXkMyAb9ccPT3SUYBkYj9ETSbCl2R3DkCLFm73N1s5U4PBB+I/iOzQUTdVVWdaFboW dPXQ== X-Forwarded-Encrypted: i=1; AJvYcCXiAXNprejA6rKryLaJ+g67erCzfuKI5hZbEEvZd9nmFKOfd3ir6Ww5d7OSEpNNdeE4w6IEh6v+zwKUhxg=@vger.kernel.org X-Gm-Message-State: AOJu0YwcW+wVLwUdxvr9uiTnUXHWIoozPM0wqQQXdBbEKW0VXP6ie55p Ki4GFzTJR5d+CSGnHn5aClWJO6DwJ+O3RWTm+0GQxup1MJHPUez5mbi/fYWxtfKYccTg7KYrmhO eQvzIi3CFvBG1sqmg7x6+zX+UNZCBzcmKwcIJAxyW+VZ3dMnE65ay0NhofdD68LWkvy4= X-Gm-Gg: ASbGncsT1AMtQrUr/PCcwSFl6XW1RJgWJBQklmlQdn6UAK0DEAQSGwCernzrBJwnvP6 uXwzkWpumFjqXi5pTYL+68Jm7Ti3KPC7VMENW2wnkAJzGVeZJvmcAP6fXtcACRl3AN3XU3zWALZ mQ7s28tUdmCw7lkWV6/hdp4P4sbgl0zIcHFR6R5UwAOuN2y4G+VPwd8vfMbY8J9z6n3DMX6KDYd dX9ei3C3pj6lu+wsJHD0iwaHyy0C8Vbo6eQY6WzKaGOakbeJJjURmv3QgRYARAcKGnl+FAXvQpR Dx6TZ47dXLTCLRbo+hm84bMBRJqKF3r3G6NrQ+5OQ9tAAQ5d6NJuJqIL0mm8JYhAl5tAOOy6/2c MsEErmmrBNQA7SZtmWbMqSSXcJrvdwjs7O6ZYiAe8i1hb X-Received: by 2002:a17:90b:57cf:b0:340:5c27:a096 with SMTP id 98e67ed59e1d1-34733e55262mr35348007a91.6.1764593013380; Mon, 01 Dec 2025 04:43:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IElgDjDJHW2YDf+PAwc9iRI3ntCUsGwfUffpxrfbB3ePkiBM/khpNTD20UCrGFmP3x4X6p7TA== X-Received: by 2002:a17:90b:57cf:b0:340:5c27:a096 with SMTP id 98e67ed59e1d1-34733e55262mr35347954a91.6.1764593012680; Mon, 01 Dec 2025 04:43:32 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3477b733381sm13146374a91.12.2025.12.01.04.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 04:43:32 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 01 Dec 2025 18:13:17 +0530 Subject: [PATCH 1/4] bus: mhi: Replace controller runtime_get/put callbacks with direct PM runtime APIs 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: quoted-printable Message-Id: <20251201-mhi_runtimepm-v1-1-fab94399ca75@oss.qualcomm.com> References: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> In-Reply-To: <20251201-mhi_runtimepm-v1-0-fab94399ca75@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Carl Vanderlip , Oded Gabbay , Jeff Johnson , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, netdev@vger.kernel.org, mayank.rana@oss.qualcomm.com, quic_vbadigan@quicinc.com, vivek.pernamitta@oss.qualcomm.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1764593001; l=4834; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=O1bfb49f81nWjSwl16Z6OQyKyPquLUwL1wCzDbmKlZQ=; b=yLM+3VZeO3i0vzTYNib15uacoRstISgcmAjNZBsE2uImwB5USfI0sbF6aT/yYbSsn9pqrY/4E WgFlDNvcU6+DI+bVnaoIPTkVXI/EG9ShgxobuhrFdniiGsg71jFlRYz X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=TcKbdBQh c=1 sm=1 tr=0 ts=692d8d76 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=-vyvwYMTLgQEoxk1dJgA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-ORIG-GUID: EmBhdlwN2QC4DpXsioiT5o7vuRJTo3HN X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAxMDEwMyBTYWx0ZWRfX4JgKK9QY9RWU ddYOG6q3pWh6A2/WnUGH4HkoVMkE7uQ3brv6k1r3yq/6slkDinsSyKvhp1qAKgNri9hZ+8hk+L5 Vy/xecpyEHIR27EnFH038C98r8f95pFO7nDoc1jbRQA85mFvOsn15DE8T/Yosd9Gm4dXUz/FTQB h4oGGsPU0Xpi0I6d7sXIzfC74KmMdaepOZQiFdtvILPSGb3E+m7zwP9RX1pg9kYPRAkdNwnF4S8 m28QNX+Rts+b7j8OH5HF5uEq9pNJNN9blEZuTPMMdXJwBqbfFRJbzXT0TjSdR7qW9jORW59mz2Q bEak6qq43CEFm+oZ1p7dmmEBl1P8cui6WldF3dN07aWFtoYaltz71snpKwLFZnq/8N8oqsIK2bU do1yXzlpW63ivvFpxFY/1EJtGW961g== X-Proofpoint-GUID: EmBhdlwN2QC4DpXsioiT5o7vuRJTo3HN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-28_08,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 malwarescore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512010103 Replace usage of runtime_get() and runtime_put() function pointers in the MHI core with direct calls to the pm_runtime APIs. As the controller drivers were not doing more than calling the PM runtime APIs in these callbacks. This refactoring simplifies the runtime PM handling and removes the need for drivers to provide no-op or duplicate implementations of these ops. Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/init.c | 1 - drivers/bus/mhi/host/internal.h | 7 +++++-- drivers/bus/mhi/host/main.c | 19 ++++++++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c index 099be8dd190078af4ca12cd7a1de739572feca9d..5b22808fd543f9febcaa9ea6231= 01d2d5d05b040 100644 --- a/drivers/bus/mhi/host/init.c +++ b/drivers/bus/mhi/host/init.c @@ -938,7 +938,6 @@ int mhi_register_controller(struct mhi_controller *mhi_= cntrl, int ret, i; =20 if (!mhi_cntrl || !mhi_cntrl->cntrl_dev || !mhi_cntrl->regs || - !mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put || !mhi_cntrl->status_cb || !mhi_cntrl->read_reg || !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs || !mhi_cntrl->irq || !mhi_cntrl->reg_len) diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/interna= l.h index 7937bb1f742ca8033c17a01f5cffbf103330f51f..61e03298e898e6dd02d2a977cdd= c4c87b21e3a6c 100644 --- a/drivers/bus/mhi/host/internal.h +++ b/drivers/bus/mhi/host/internal.h @@ -7,6 +7,8 @@ #ifndef _MHI_INT_H #define _MHI_INT_H =20 +#include + #include "../common.h" =20 extern const struct bus_type mhi_bus_type; @@ -353,8 +355,9 @@ static inline bool mhi_is_active(struct mhi_controller = *mhi_cntrl) static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl) { pm_wakeup_event(&mhi_cntrl->mhi_dev->dev, 0); - mhi_cntrl->runtime_get(mhi_cntrl); - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_get(mhi_cntrl->cntrl_dev); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); } =20 /* Register access methods */ diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index 8615512743199a59a58c3756d9cc3407079cee7e..7ac1162a0a81ae11245a2bbd9bf= 6fd6c0f86fbc1 100644 --- a/drivers/bus/mhi/host/main.c +++ b/drivers/bus/mhi/host/main.c @@ -661,7 +661,8 @@ static int parse_xfer_event(struct mhi_controller *mhi_= cntrl, if (mhi_chan->dir =3D=3D DMA_TO_DEVICE) { atomic_dec(&mhi_cntrl->pending_pkts); /* Release the reference got from mhi_queue() */ - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); } =20 /* @@ -1155,7 +1156,7 @@ static int mhi_queue(struct mhi_device *mhi_dev, stru= ct mhi_buf_info *buf_info, * for host->device buffer, balanced put is done on buffer completion * for device->host buffer, balanced put is after ringing the DB */ - mhi_cntrl->runtime_get(mhi_cntrl); + pm_runtime_get(mhi_cntrl->cntrl_dev); =20 /* Assert dev_wake (to exit/prevent M1/M2)*/ mhi_cntrl->wake_toggle(mhi_cntrl); @@ -1166,8 +1167,10 @@ static int mhi_queue(struct mhi_device *mhi_dev, str= uct mhi_buf_info *buf_info, if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) mhi_ring_chan_db(mhi_cntrl, mhi_chan); =20 - if (dir =3D=3D DMA_FROM_DEVICE) - mhi_cntrl->runtime_put(mhi_cntrl); + if (dir =3D=3D DMA_FROM_DEVICE) { + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); + } =20 read_unlock_irqrestore(&mhi_cntrl->pm_lock, flags); =20 @@ -1374,7 +1377,7 @@ static int mhi_update_channel_state(struct mhi_contro= ller *mhi_cntrl, ret =3D mhi_device_get_sync(mhi_cntrl->mhi_dev); if (ret) return ret; - mhi_cntrl->runtime_get(mhi_cntrl); + pm_runtime_get(mhi_cntrl->cntrl_dev); =20 reinit_completion(&mhi_chan->completion); ret =3D mhi_send_cmd(mhi_cntrl, mhi_chan, cmd); @@ -1405,7 +1408,8 @@ static int mhi_update_channel_state(struct mhi_contro= ller *mhi_cntrl, =20 trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, TPS("Updated= ")); exit_channel_update: - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); mhi_device_put(mhi_cntrl->mhi_dev); =20 return ret; @@ -1591,7 +1595,8 @@ static void mhi_reset_data_chan(struct mhi_controller= *mhi_cntrl, if (mhi_chan->dir =3D=3D DMA_TO_DEVICE) { atomic_dec(&mhi_cntrl->pending_pkts); /* Release the reference got from mhi_queue() */ - mhi_cntrl->runtime_put(mhi_cntrl); + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); } =20 if (!buf_info->pre_mapped) --=20 2.34.1