From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA374D116F9 for ; Mon, 1 Dec 2025 12:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YC6FU3llCYxXh4VP04XbK7i9763mHcc9u/o//Iu96T4=; b=t2FNrcVi+AfpSSrR4HVYq2Ghf4 4ukLG30e9eUrNGx2D5y6fXgAtBP1WsB5YjQNGHpXP68BZxKzOTA0PZhL07UM0t/bv2mYUQJwL5cN2 I2H9UlU2hBfBpIgQ0SPAXZRW7m5gNjWzOFn1gJ8HUjqnKaEPcNfLMBG4AfJGPdTL9JEoHNj3uEuoP XTtpplMUr3OnHTyhzoJBEhGnuOuJhka3nF8jbnguesOc5mw+4qpR9wqWtcujFYQKeIz/LfeFZZwVt KAv4mXCx1damMkagfcvG7ihAoPXMBsrRs6vETtlwCovRavrYQRZBMnmzRyjgaYl9SIJ3XHTR4a1f4 Jo9+tspA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vQ3Fh-00000003ZuK-2VYi; Mon, 01 Dec 2025 12:43:37 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vQ3Fe-00000003ZsM-2zeH for ath11k@lists.infradead.org; Mon, 01 Dec 2025 12:43:36 +0000 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B1CG7kK060524 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-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4asavh82e9-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-f70.google.com with SMTP id 98e67ed59e1d1-343806688cbso7928066a91.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=lists.infradead.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=D06vFa+vJSlZ+wZZa/WKU9cDZNaA7gpb3CnUmFR5/cXUBBsIy4ZpUajYnOG1RkY3Zf R0pkNRnzarVIQcKwrCe7zwxoC0mvaQH+Y4YGrA//BqxRa+zpgi8/9j+ZMlnFBJWICcs/ wl99u3YdvhzwLAkiLHZvFcSkGynwUh2ysEbQQx5xZpRlGBH8Sr8xrzEyLJbnuwmQFf69 /bsrTghwSc2yC3HNM96/Ro4z77A91jLYU6y5ChidEkg7ZDXAaCdH7EFvROEuoj/DcmTe ZE3c8uhFkM3yJuw82A/XkNqurWFhD4gzHLnCFq7ZBweBH1RkTSOi0yE23c9A1imjHrbN EoUg== 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=NDIXoGZi6Gj+xdebM/L2YSoBaP68WgUKmrntucaK+VCQK8Jt5alr7C3904o3eUMArZ Z/BzVwoFF3fbeI2jyhbWWSrsqiYwtHbQ0+00xry1vQlFxxS7+j5iRmpJjn2jDHfrVWYz 7QmOcmdsQiClwbNNk0eco/m41BB1hCbq7nnWn2gsiwZSgrTHBiW7m7PrlYN8BaT5PFF1 xrlpP3ucPGzap8QqEP1AHFC36R5OT8DN09J2lR4UhawjJvvyr4Om28QvFHD0eJ4t9jPR frcAFQ6LS+wTZhJnPnJ131X6oDKIfO/YhtX+T/RnWVD9DaT0eJ37FtpwkHUPpvRfu93r nGOw== X-Forwarded-Encrypted: i=1; AJvYcCVm+JLCXnuvp9i/gXbsnQH39rOWpG8C/Muu4PiEiLjLTS3sDWZsuKtD3CdIo6aCy6+hqDdyd+A=@lists.infradead.org X-Gm-Message-State: AOJu0YyLWkCUqX0awq/coL2KJZPPm+b2+Po7xwui3gUXyLBRWJxJytvG SLpTO+jBUHXFCRkzn6JkghShcdMWbEtEhOYlI9VjRsp1HkGlAw6Bv70qop2rzqW+RaxiYQLhROP XOxq3fc8CKmNESWQZczumd0PaPL+P8zoCIgWeGdoXHqqfAh49HcIEeylYW6CG1hB1 X-Gm-Gg: ASbGncs6NwEQUJsOFPWgAm7uFhznmSgzbYiKNFcoDV5jEbiWYnxjxjKrK0Je0XbiwAA u1CCKOsaZRDmhTBeSJjdBRJI9oOFrHky6NYwG2BsSkjf+y4V+8YvISfriwb4Kj+OSYGrS8yBoh6 nzsf+rYcl/OtNRuEfoUti3ddCcA4aXjRwJWFcj+0L/nfULPck1CP5id0g3/CjKlqn/iz0FBBlD6 Fxb3aiCPfjPqtqxAklVXrc4+ZaHjPCJ4+Djx12A3fPxQCW5FrO+aI+6C9dEDz+swmH+dCEQgDSR Z4/3HN7CV3EZe0GELU3QsNz3u+fT57LHtiDRHolpP7FXbfuVOWxpsapcMyRSb2UwZbfQFBZltUr 2KYXJu/iiRjtb00YslFDC1/vlLRydhq6AFwh4+pzxEjZs X-Received: by 2002:a17:90b:57cf:b0:340:5c27:a096 with SMTP id 98e67ed59e1d1-34733e55262mr35347996a91.6.1764593013364; 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 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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-Proofpoint-ORIG-GUID: fGsJJdUIBYBXbEfXSJW4VA--e6W8i7OI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAxMDEwMyBTYWx0ZWRfXzQhsKze//P3c dk7sL4qTk0juHQZAn/geSl4zqkxnyniR76z2cLpQkKHU3QwAi1VjPCw5d1AYNC7p7F2IZtngKMy FMyUPbk3v98pJe5epVPHNaapkzu5nx/xx9f4ioCWvjRpb6w+I3kXwFvmAABoS2evY0f2YgLHAAl eleFKiScgZFfvhoc9fiQMYUgI8oWXQxELoY3S1pWamoBF8VxcVSCNCGn/0xncNwESxEm0jThcz9 SJ0OAjitqFGb9t6krnNsQPCQ+isl4ZLbn51Q5RVDU5xQvdHMcbvzsqBrqnCPiZ4yOeahh8+c0jk YyOxZE1WTxP6As7Knflz1N/RagkN1PHJtv3stNz311u4NA4rRutfoMrXJ+zt2zoAwj/H1wfxLS7 TAYe3mjSvv4j0lYjDT+hIdl7vRtmwg== X-Authority-Analysis: v=2.4 cv=QutTHFyd c=1 sm=1 tr=0 ts=692d8d76 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==: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=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-GUID: fGsJJdUIBYBXbEfXSJW4VA--e6W8i7OI 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 bulkscore=0 adultscore=0 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512010103 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251201_044334_765549_7E9A18D0 X-CRM114-Status: GOOD ( 15.12 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath11k" Errors-To: ath11k-bounces+ath11k=archiver.kernel.org@lists.infradead.org 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..5b22808fd543f9febcaa9ea623101d2d5d05b040 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; 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/internal.h index 7937bb1f742ca8033c17a01f5cffbf103330f51f..61e03298e898e6dd02d2a977cddc4c87b21e3a6c 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 +#include + #include "../common.h" 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); } /* Register access methods */ diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index 8615512743199a59a58c3756d9cc3407079cee7e..7ac1162a0a81ae11245a2bbd9bf6fd6c0f86fbc1 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 == 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); } /* @@ -1155,7 +1156,7 @@ static int mhi_queue(struct mhi_device *mhi_dev, struct 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); /* 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, struct mhi_buf_info *buf_info, if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) mhi_ring_chan_db(mhi_cntrl, mhi_chan); - if (dir == DMA_FROM_DEVICE) - mhi_cntrl->runtime_put(mhi_cntrl); + if (dir == DMA_FROM_DEVICE) { + pm_runtime_mark_last_busy(mhi_cntrl->cntrl_dev); + pm_runtime_put(mhi_cntrl->cntrl_dev); + } read_unlock_irqrestore(&mhi_cntrl->pm_lock, flags); @@ -1374,7 +1377,7 @@ static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl, ret = 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); reinit_completion(&mhi_chan->completion); ret = mhi_send_cmd(mhi_cntrl, mhi_chan, cmd); @@ -1405,7 +1408,8 @@ static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl, 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); return ret; @@ -1591,7 +1595,8 @@ static void mhi_reset_data_chan(struct mhi_controller *mhi_cntrl, if (mhi_chan->dir == 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); } if (!buf_info->pre_mapped) -- 2.34.1