From nobody Mon Sep 28 10:01:07 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 631743176EE; Mon, 24 Aug 2026 03:55:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787543747; cv=none; b=RFFf01S/G0FgxUGhnYVnOl4nnI2A7nfV+nqUV4Sfp59EYXqKPR+t2yo4PBswklwei+TK4opCkig5rC/QKwrgSbrUacWRYg2at1H9AqwJCXed2ev1M4GVyPm4mRO767M3ZJGpjMwm2xrqCVZE88jLGTNipXOeSDsLithqZJwIEHA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787543747; c=relaxed/simple; bh=OaIdKja4JLE/Prwwg0w8Yzo5vXyXMgl7pumKIc+t6oU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TA6RFSOWEholdqAibVg8Qm/XtwpUQkXfoLGrOEylHcHVcXrhOIh5I44w2f8FxU5tcf2v4RIcO5Gk2LU0nXcqWIKTJyPMNWq1v9iQuq6hnrWy4H0NCsVuZ0azUJ0FqGBc/7PH3GFdiQuMiQMERDlmkMjDsjx/gw5E84iG2TQJEBc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: aa55a4a49f6f11f19a56ed5b684f684d-20260824 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.19,REQID:bb7486bd-34bc-48f2-b348-bc9b8aa0b76a,IP:0,U RL:0,TC:0,Content:-5,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:20 X-CID-META: VersionHash:7db8b62,CLOUDID:920bc81f8664f2d09a03a1f4d859d5b0,BulkI D:nil,BulkQuantity:0,SF:81|82|102|136|850|865|898,TC:nil,Content:0|15|50,E DM:5|-100,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0 ,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: aa55a4a49f6f11f19a56ed5b684f684d-20260824 X-User: lilinmao@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1169046848; Mon, 24 Aug 2026 11:55:37 +0800 From: Linmao Li To: Jonathan Cameron Cc: Andy Shevchenko , Chris Morgan , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Linmao Li Subject: [PATCH togreg v4 1/2] iio: imu: inv_icm42607: propagate runtime suspend errors Date: Mon, 24 Aug 2026 11:55:30 +0800 Message-Id: <20260824035531.141429-2-lilinmao@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260824035531.141429-1-lilinmao@kylinos.cn> References: <20260824035531.141429-1-lilinmao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The runtime suspend callback returns success when updating PWR_MGMT0 fails. The PM core then marks the device suspended even though the shutdown outcome is unknown. If the write did not reach the sensor, the sensors remain running and draw power while the device is idle. The condition need not persist. If the bus error clears, a later sensor access either reads the current PWR_MGMT0 value from hardware or retries programming the requested enabled mode, allowing normal operation to resume. Return the underlying errno to the PM core. -EAGAIN and -EBUSY retain their transient-error semantics; other errors put runtime PM into an error state and cause later PM acquires to fail until the status is explicitly reset. In the normal idle case, a successful system suspend can perform that reset. This leaves the transient-versus-fatal classification to the PM core and matches the sibling ICM-42600 driver. Keep a void wrapper for the managed teardown action, where errors can only be logged. Fixes: 3007c1530f96 ("iio: imu: inv_icm42607: Add PM support for icm42607") Signed-off-by: Linmao Li Tested-by: Kanak Shilledar --- Changes since v3: - Expand the commit message with the practical effect and the recovery behaviour, as requested. No code change. This was found by code inspection. No ICM-42607 hardware or fault-injection setup was available. drivers/iio/imu/inv_icm42607/inv_icm42607_core.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c b/drivers/iio= /imu/inv_icm42607/inv_icm42607_core.c index 190e998f7b8ef..0da362967f63b 100644 --- a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c @@ -537,9 +537,8 @@ static int inv_icm42607_enable_vddio_reg(struct inv_icm= 42607_state *st) return 0; } =20 -static void inv_icm42607_sensors_off(void *_data) +static int inv_icm42607_sensors_off(struct inv_icm42607_state *st) { - struct inv_icm42607_state *st =3D _data; const struct device *dev =3D regmap_get_device(st->map); int ret; =20 @@ -552,6 +551,13 @@ static void inv_icm42607_sensors_off(void *_data) st->conf.accel.mode); if (ret) dev_err(dev, "Unable to turn off sensors\n"); + + return ret; +} + +static void inv_icm42607_sensors_off_action(void *data) +{ + inv_icm42607_sensors_off(data); } =20 static void inv_icm42607_disable_vddio_reg(void *_data) @@ -619,7 +625,7 @@ int inv_icm42607_core_probe(struct regmap *regmap, * Ensure if sensors get turned on at some point, they're turned off * as part of teardown. */ - ret =3D devm_add_action_or_reset(dev, inv_icm42607_sensors_off, st); + ret =3D devm_add_action_or_reset(dev, inv_icm42607_sensors_off_action, st= ); if (ret) return ret; =20 @@ -688,8 +694,7 @@ static int inv_icm42607_runtime_suspend(struct device *= dev) * however the tradeoff is that an unused sensor won't be * turned off until the entire chip is no longer in use. */ - inv_icm42607_sensors_off(st); - return 0; + return inv_icm42607_sensors_off(st); } =20 EXPORT_NS_GPL_DEV_PM_OPS(inv_icm42607_pm_ops, IIO_ICM42607) =3D { --=20 2.25.1 From nobody Mon Sep 28 10:01:07 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 72CBA2D0C94; Mon, 24 Aug 2026 03:55:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787543748; cv=none; b=fOf3GIyQgODNRDONtbkTxEOhpZ/wO/4GqHZHVwvq9RPr5SjIiOM/HA13ZHa8wCddBf62I9Pfd/B4FK4nogb4B58n84ITgRd2dDYuQmmSGkRO0IfOBhiBoTN2570oz73tsav57UOgVqXpFoWCzC6GaM4hw/0cOjd2G9/FC+QsTJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787543748; c=relaxed/simple; bh=1iENJhbpG5MvHzF945gJgShLpNBxgiVIsYOE/gnOzJM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tUJ2ng8L7u/fz3auJHrK8nf8/uLu9YPRqrRdxBpubHJhJ20bB5+pi48LCCArogxgUbp9NbrEghLta4VpUGXzDRSUk8ShQGUf1ZjsqQgT39JPIVbrsvOYcI57QUFBC/gvVTSQxPYPakZet5gWT7gQU96QOnuGwcexkoxGpBsZ8yY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: ab44522a9f6f11f19a56ed5b684f684d-20260824 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.19,REQID:db6883d2-0ee6-4357-99f5-8f589c641f4c,IP:0,U RL:0,TC:0,Content:-25,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:7db8b62,CLOUDID:fe9fc01c64acc551ba6ed3efc7afe70a,BulkI D:nil,BulkQuantity:0,SF:81|82|102|136|850|865|898,TC:nil,Content:0|15|50,E DM:5|-100,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0 ,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: ab44522a9f6f11f19a56ed5b684f684d-20260824 X-User: lilinmao@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1307589699; Mon, 24 Aug 2026 11:55:38 +0800 From: Linmao Li To: Jonathan Cameron Cc: Andy Shevchenko , Chris Morgan , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Linmao Li Subject: [PATCH togreg v4 2/2] iio: imu: inv_icm42607: restore runtime PM on system resume errors Date: Mon, 24 Aug 2026 11:55:31 +0800 Message-Id: <20260824035531.141429-3-lilinmao@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260824035531.141429-1-lilinmao@kylinos.cn> References: <20260824035531.141429-1-lilinmao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pm_runtime_force_suspend() leaves runtime PM disabled after it succeeds and expects pm_runtime_force_resume() to restore runtime PM management during system resume. The resume callback returns early if enabling the vddio regulator or synchronizing the register cache fails, skipping the matching pm_runtime_force_resume() call. Runtime PM consequently remains disabled after the system has resumed, so runtime autosuspend can no longer turn off sensors enabled afterward. Call pm_runtime_force_resume() on both error paths. Keep the first error as the return value and report a runtime PM restore failure separately. Fixes: 3007c1530f96 ("iio: imu: inv_icm42607: Add PM support for icm42607") Signed-off-by: Linmao Li Tested-by: Kanak Shilledar --- Unchanged since v3. This was found by code inspection. No ICM-42607 hardware or fault-injection setup was available. .../iio/imu/inv_icm42607/inv_icm42607_core.c | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c b/drivers/iio= /imu/inv_icm42607/inv_icm42607_core.c index 0da362967f63b..f4ef75da22c76 100644 --- a/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_core.c @@ -664,9 +664,8 @@ static int inv_icm42607_suspend(struct device *dev) return 0; } =20 -static int inv_icm42607_resume(struct device *dev) +static int inv_icm42607_resume_core(struct inv_icm42607_state *st) { - struct inv_icm42607_state *st =3D dev_get_drvdata(dev); int ret; =20 ret =3D inv_icm42607_enable_vddio_reg(st); @@ -675,9 +674,25 @@ static int inv_icm42607_resume(struct device *dev) =20 /* Sync the regcache again after regulator shutdown. */ regcache_mark_dirty(st->map); - ret =3D regcache_sync(st->map); - if (ret) + + return regcache_sync(st->map); +} + +static int inv_icm42607_resume(struct device *dev) +{ + struct inv_icm42607_state *st =3D dev_get_drvdata(dev); + int ret; + + ret =3D inv_icm42607_resume_core(st); + if (ret) { + int rc; + + rc =3D pm_runtime_force_resume(dev); + if (rc) + dev_warn(dev, "Failed to restore runtime PM state: %d\n", rc); + return ret; + } =20 return pm_runtime_force_resume(dev); } --=20 2.25.1