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 31B4B31CA4E for ; Mon, 1 Dec 2025 12:43:47 +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=1764593028; cv=none; b=OlgyHnAmdu6e89YOGnUPyz+3V7RMtfLH1ZSWNiqjmlRXUHaKVvxJy7uKPek0J1HxwnLPFmqZ8r9+NKW0echpIyBDem1ge23CMRMbKIfCElxTC4AOzSsO3MVB+I3LpgK8uHOkSKL9WSYcqLM3u3OHBLuHJraLFFrC+TnGLyK/qks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764593028; c=relaxed/simple; bh=rbqwP2YI4CzGHgLkC6DPKf/HhJhVBMMGwEXYBUIoF6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OjrGtB0lzne677vbUkNsZwEYnbcXVNXfc5GcT1LFc1T7A2WuYHPr8DCp3KmH5QfgoXOv0XpHXc+BlMmqEHvRu9IIGh3qErcfh3/3dC8XpDx2VZoo15nLwuhT+gP79vsfW94gdw+9Ld7fyjGBC3d9GhGkPemeQOdy+Q5NYjEWkWA= 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=XR1PcdKX; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ePDStvoo; 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="XR1PcdKX"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ePDStvoo" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B19rE73211732 for ; Mon, 1 Dec 2025 12:43:46 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= fpnTx2DCpn5NW+7UCBeMn/SqdtMDI0Y8uRPDmg+UDbk=; b=XR1PcdKXJkx1y7lP 1hl+9CzAqtSL+e2kFxF9sah35MGnmVSLivazrLvPrWo8zhkg7+7F3Yc0qBvAdw0D 0Rcx9XHoC33Q8YGhzsSr2ctUULz9VLVFpwG90cz3XFjuC08JTXw8+X8F//dQ6yUO EUI8HizI6XGSjaSydbEGKq/bfDn3etKvt+Y+kjdW42c124s11HPFXwt3c/iPxi9v LpGNA6GsTRNY+gUhwKKygIq+XJRpipG6W8++QY32QNS9U9UR5SeZ5Mud0gWSY+9U 3IzOsDms4kTgtONn4rgbYXruSqffW5sCfJeh2IzcdSiUw+glechcoP9Yr8sdEhnz gkzUyQ== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4as8sj0e4q-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 01 Dec 2025 12:43:46 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-297dfae179bso85189555ad.1 for ; Mon, 01 Dec 2025 04:43:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764593025; x=1765197825; 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=fpnTx2DCpn5NW+7UCBeMn/SqdtMDI0Y8uRPDmg+UDbk=; b=ePDStvoogr9MtFo9amofY1dpQK+AMd5pUnt5aMUtWbOYYlKpu8HwcZtKUOZOtAt+aF GtQVWLa5IOKjhY53Do5WPieDxbqwWgtiozb5/jC2WQnX/RAwj1JtvuveFY5K+OVdRfff 2IchMF/RdeT9aPtLrL/3cIyFL2C33fjgjPwlZVUX7C/eWcCFWrgz4kkfC5BwIaWStn/J Xu8yFz/VwaYK9euJFNhaS+xzXkTwrDYDbVSk4ffL0bsQBy+3+zWp4PMY/DMMshxqpRvA aLEH/8Ss6qZEtWmkTonmiPuQlKeN3WqJMo26BLuT4G6WqPKXQlBm84gf6BcE2gvaDAX9 cEVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764593025; x=1765197825; 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=fpnTx2DCpn5NW+7UCBeMn/SqdtMDI0Y8uRPDmg+UDbk=; b=MhUydqUWvGKuwbtadOWnM/Ybq/1e7r/772OfBM5Wt2sNqrkCo70DOQSdbfhsc6EHn0 9DyN7jBSdzEXZ3V9m+v6RibANG9OY69K2d43KmqYhkY+xrwnNqLHg4Q699qsEQ2LO0LT CnVT41VBv9e7jGGslYzN+CDFFaUfI+icTsIjQekvQrXbH0rBIBSWSFryY8xtm3r2Mu29 ZluvZ0LMKbKZ6Hrmr2Fh5d4Tf15eg2dxmmNL+zff6r/aiddXWCEVEK+WrZLB+R0Rd6lt 966+S0L0mAHRueigRy5VZaFe5UioA8645boTlRQVTCZ15rLDdBn21lInhxqFzPJ6MKpL FB5g== X-Forwarded-Encrypted: i=1; AJvYcCXpj1sxJLxm/dCps7X3ilc0wzh+j4p9K8GzT23+g7vuP0Bg4vKbviaPVqOr9OjA4YoufiVf9pdpyQT2ERGA@vger.kernel.org X-Gm-Message-State: AOJu0YwKdGaB4m9UTREFGzWXS7omAFlqFXPe092ODWKlbnAY4+7M988l 0zWHEb+GqjqDMlAO0nUMeFRP8Y1RE+sdY55mq14BhX3wS+n1AhXVyKXAYt8/CHtaDV3nt2o24L/ WnBTLTqqU8C+GBg0FW2hhcQiYifyTzVUouwdwQ4Kutz18unFNdFrbuUDzYuYAUx6d6P07 X-Gm-Gg: ASbGncuamm88RQLJGeD9eN7fhTT4rl446ShHHVEv6cbW5lJi98GfiLoCDqlFKwu8GCE cEwVQMbF1FvS1ZgY68DXEJgLsb71yo1JLeA4mM74URahiX7WmEAIL9UKjlMENOgJGRS7UAbmyrs LBpl3QwuWx6U8CSGfmKQIVt3BFwxGeiH3kkssDpKFqhlphp5HTTb5qqcAZ5ITyPIMmnCgeYdHXt ufr4Wza4sdC9pT96uHPADtCKohe1kpMmeAOwvSD4BynU0CCxShvZJ37HzHcsV3fuVmRZlIc1ch5 pipfh6BK8XUPo3GYrBR10UwSp6wYijNkVCcbyV6T7RVNQMGAMJFtzFJ0rCjB1ic9nh90Ba2ct5N jf3kxXncS9htZLsL0mOSI1wWR8hwx3yFZWAicE0Gx1E5o X-Received: by 2002:a17:902:f712:b0:295:82c6:dac0 with SMTP id d9443c01a7336-29b6bf3b620mr427701375ad.36.1764593025054; Mon, 01 Dec 2025 04:43:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQRyQeaORqv6EIcBnGlMaq26A/hMlADJNn0YXR98fYBetj3iI8jUv1Ui+5YteXsBVLZPjwlA== X-Received: by 2002:a17:902:f712:b0:295:82c6:dac0 with SMTP id d9443c01a7336-29b6bf3b620mr427701135ad.36.1764593024474; Mon, 01 Dec 2025 04:43:44 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 04:43:44 -0800 (PST) From: Krishna Chaitanya Chundru Date: Mon, 01 Dec 2025 18:13:19 +0530 Subject: [PATCH 3/4] net: mhi_net: Implement runtime PM support Precedence: bulk X-Mailing-List: linux-arm-msm@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: <20251201-mhi_runtimepm-v1-3-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=3344; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=rbqwP2YI4CzGHgLkC6DPKf/HhJhVBMMGwEXYBUIoF6k=; b=/Y2lIbKnoetk66YeT7B0yhq+Lp6V/NhqVD5b7G9I3ctKq/8126e4MtAa3KtI53yQh650IoAtH yDP4z6ZpJW+BDRVzLPVbyhcZhAeBx2UtPa+G7f/CG+yfkSzgm82tWqi X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: T_PbNZ6weW_qFnYQbnlAwYCL25IEcY0y X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAxMDEwMyBTYWx0ZWRfX6SdTdzIT5s6L Sz2ZcGSPO8vTQNR/mq1j6JXM1Yg9KrczaPka4qSpWDndeD/jzyx0jDwwZDw7R+LbfAjAEAaMVni 2/lqEqsGN8IyUPa/FcV9KdU14NeREKhPomcw+m4iXsf3k8z7ZDGkhH1rLcDwDjQcMlQsM4FlliL +i2lOuXLKyV7MrfCph7JSzlWRqnXjzvxmF7VZ0MWN+4No/B/t2og+gnxQ13tz0aKejn9CGPn9e5 RcRNBQvy8fVarMfB6zvYtHMLuYDwfr67YPHXDbtwQrmFSFizypLvl2mN2330FehnJxDO9aji7QT IwD2ClLunjhxSBdZ/F56JfCfLvOpars/kF1s0Vpav3X8TLafk+jGFrN7JR3F7g46D/e7fD+VV5h Dj6oDxdR571QJCGrHUSnsuSzFjI+nA== X-Authority-Analysis: v=2.4 cv=Lr+fC3dc c=1 sm=1 tr=0 ts=692d8d82 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=FGecwo-O3dF_YbjdleMA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-ORIG-GUID: T_PbNZ6weW_qFnYQbnlAwYCL25IEcY0y 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 adultscore=0 malwarescore=0 priorityscore=1501 phishscore=0 spamscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512010103 Add runtime power management support to the mhi_net driver to align with the updated MHI framework, which expects runtime PM to be enabled by client drivers. This ensures the controller remains active during data transfers and can autosuspend when idle. The driver now uses pm_runtime_get() and pm_runtime_put() around transmit, receive, and buffer refill operations. Runtime PM is initialized during probe with autosuspend enabled and a 100ms delay. The device is marked with pm_runtime_no_callbacks() to notify PM framework that there are no callbacks for this driver. Signed-off-by: Krishna Chaitanya Chundru --- drivers/net/mhi_net.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c index ae169929a9d8e449b5a427993abf68e8d032fae2..c5c697f29e69e9bc874b6cfff4699de12a4af114 100644 --- a/drivers/net/mhi_net.c +++ b/drivers/net/mhi_net.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,7 @@ static netdev_tx_t mhi_ndo_xmit(struct sk_buff *skb, struct net_device *ndev) struct mhi_device *mdev = mhi_netdev->mdev; int err; + pm_runtime_get(&mdev->dev); err = mhi_queue_skb(mdev, DMA_TO_DEVICE, skb, skb->len, MHI_EOT); if (unlikely(err)) { net_err_ratelimited("%s: Failed to queue TX buf (%d)\n", @@ -94,6 +96,7 @@ static netdev_tx_t mhi_ndo_xmit(struct sk_buff *skb, struct net_device *ndev) u64_stats_inc(&mhi_netdev->stats.tx_dropped); u64_stats_update_end(&mhi_netdev->stats.tx_syncp); + pm_runtime_put_autosuspend(&mdev->dev); return NETDEV_TX_OK; } @@ -261,6 +264,7 @@ static void mhi_net_ul_callback(struct mhi_device *mhi_dev, } u64_stats_update_end(&mhi_netdev->stats.tx_syncp); + pm_runtime_put_autosuspend(&mdev->dev); if (netif_queue_stopped(ndev) && !mhi_queue_is_full(mdev, DMA_TO_DEVICE)) netif_wake_queue(ndev); } @@ -277,6 +281,7 @@ static void mhi_net_rx_refill_work(struct work_struct *work) size = mhi_netdev->mru ? mhi_netdev->mru : READ_ONCE(ndev->mtu); + pm_runtime_get_sync(&mdev->dev); while (!mhi_queue_is_full(mdev, DMA_FROM_DEVICE)) { skb = netdev_alloc_skb(ndev, size); if (unlikely(!skb)) @@ -296,6 +301,7 @@ static void mhi_net_rx_refill_work(struct work_struct *work) cond_resched(); } + pm_runtime_put_autosuspend(&mdev->dev); /* If we're still starved of rx buffers, reschedule later */ if (mhi_get_free_desc_count(mdev, DMA_FROM_DEVICE) == mhi_netdev->rx_queue_sz) schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2); @@ -362,12 +368,19 @@ static int mhi_net_probe(struct mhi_device *mhi_dev, SET_NETDEV_DEV(ndev, &mhi_dev->dev); + pm_runtime_no_callbacks(&mhi_dev->dev); + devm_pm_runtime_set_active_enabled(&mhi_dev->dev); + pm_runtime_set_autosuspend_delay(&mhi_dev->dev, 100); + pm_runtime_use_autosuspend(&mhi_dev->dev); + pm_runtime_get(&mhi_dev->dev); err = mhi_net_newlink(mhi_dev, ndev); if (err) { free_netdev(ndev); + pm_runtime_put_autosuspend(&mhi_dev->dev); return err; } + pm_runtime_put_autosuspend(&mhi_dev->dev); return 0; } -- 2.34.1