From nobody Tue Oct 7 13:23:02 2025 Received: from mail-43171.protonmail.ch (mail-43171.protonmail.ch [185.70.43.171]) (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 86CA62D9796 for ; Wed, 9 Jul 2025 12:35:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064533; cv=none; b=nNytQzKk/7LNCKqNsEqI7fabBghetcoWjv9cpMZJft/RdJ10G1XyEn1F2w0Mrp4qCDKplyhqH+GGhmscRrjz1IFQ4eNNEd8huQFC4YtPYF9AVVb2lJZ8NgmtKM8Q76iahsql14jQDBy6/UcEsfRbo0yrOqTg676tfMqJNt2rWAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064533; c=relaxed/simple; bh=WjBv+IqC825TXVG2xRcp0WQob+tWH9klHN01U9Jgx2c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mk0+8sZByejlQSB0tvkOoXkwTctunqsvbQSvnvoxD9lU+x1v4WbY1GtuSxVecoLUbv5/QX8PxRKSBiwfr14dXpXtY7ASE7mhOSBGMTH5juWwxMPZSDSXf0aYo4ka4xtrE67sjC5EzkvgkxYLV679Gi1wZDyo71xDgRRheTPgBIg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=iiyrDiIu; arc=none smtp.client-ip=185.70.43.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="iiyrDiIu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail; t=1752064522; x=1752323722; bh=/KotKrvzSuZ1fCGQuYNoDiGuvp6Ejyo5IuM8cm1J9bY=; h=From:Date:Subject:Message-Id:References:In-Reply-To:To:Cc:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=iiyrDiIuCApiV4JDS6itxddo6T0/8ob/xUEmMt/f9eb8OZ/Qa90FsyFHlPZXjIcVo JAgCCJcGcIpFJIJu8KWuunkpWwPMn7miRj+9KyVZl6+jOa2nEhisk6OHHJuocqYqkr 1Oq93mY/JV65scOYWPA12LoWIuv2iFnbkkhpUwueqaqHZQawn3nhUH7mHj1Pb0tNuE zJp/SQrJt95izW15GzqYNEQEa3XNTFNm9iGvQCfUG2J6c4o0VfZPUF5F9o9AENqsgj Ill8ZJg3ulPseMDz1fwQUE9fv3LgGEC0QaKJKpJBYs9pUb5ohNdDhqRn55f31v/tqM d4n7kVcEX9q4g== X-Pm-Submission-Id: 4bccrT0sZYz1DDrV From: Sean Nyekjaer Date: Wed, 09 Jul 2025 14:35:09 +0200 Subject: [PATCH 1/6] iio: imu: inv_icm42600: Use inv_icm42600_disable_vddio_reg() 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: <20250709-icm42pmreg-v1-1-3d0e793c99b2@geanix.com> References: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> In-Reply-To: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> To: Jean-Baptiste Maneyrol , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 Replace direct calls to regulator_disable() with the existing inv_icm42600_disable_vddio_reg() helper. This improves consistency and ensures any future changes to the disable logic are centralized. Signed-off-by: Sean Nyekjaer --- drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio= /imu/inv_icm42600/inv_icm42600_core.c index a4d42e7e21807f7954def431e9cf03dffaa5bd5e..69496d1c1ff73132f5e7bd076d1= 8a62c293285a2 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -892,7 +892,7 @@ static int inv_icm42600_suspend(struct device *dev) =20 /* disable vddio regulator if chip is sleeping */ if (!wakeup) - regulator_disable(st->vddio_supply); + inv_icm42600_disable_vddio_reg(st); =20 out_unlock: mutex_unlock(&st->lock); @@ -973,7 +973,7 @@ static int inv_icm42600_runtime_suspend(struct device *= dev) if (ret) goto error_unlock; =20 - regulator_disable(st->vddio_supply); + inv_icm42600_disable_vddio_reg(st); =20 error_unlock: mutex_unlock(&st->lock); --=20 2.50.0 From nobody Tue Oct 7 13:23:02 2025 Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) (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 513D32D8372 for ; Wed, 9 Jul 2025 12:35:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.165.51.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064541; cv=none; b=r2dfg1n3jzR5MOTfSfCwiBRd5wcoBzhZToieUK4IG93aNTgCmYnaMX3d/+8OxtYtrhCwPradyw1K+g0zakAsek+itqMXvYctKklYqIaBHQtYIAtLNrxRGQ/jhARN2EPLyXaxwzGgzdzH1SIe4x9uDAoOKZCua5xm5jonx4GyrrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064541; c=relaxed/simple; bh=z0pEcaFdX1yd9IHupt7wmviVD2op/A2i/iHGuBD69Vk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gdyt2mEOK80KJaoUGMxd1qOJcsscHyKZydSC2jJ/XjEDErbYa5SBo6wq1I2nBvrkTLd7sGJB4+icjqU5aoB3WXlsfR7Hb80+2DMBWE9v/JGirDtmAXvaxZBCmUWLVmlu+jV7oHo1G1k9m+uqkbSFJXhj3njGZdjxBi469zNpDmI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=fOBEATeX; arc=none smtp.client-ip=188.165.51.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="fOBEATeX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail; t=1752064523; x=1752323723; bh=QFLdHZPsiVDuudhP2SAE0d2N2Vdy6GOZKJjRx5dgUhA=; h=From:Date:Subject:Message-Id:References:In-Reply-To:To:Cc:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=fOBEATeXFfuKhBnt5G0HpABcM1ohZziLrHCy5EelR+VwwbJZKTrI08fX/PfpFlV+T TCs8rs2NpEBtcViaIM4sq1fM/spBaVqeMaJMzmGik+oXQwH5LYMA0sK8phBPxvd/kI NlBfMrKlVvL6sS30hyhecXLNE7l8I3GjFbKpjlKIb4tv+tF6yrwm08Cwg6dyr34kdj NisG68WY6SRMOKqMB3DgcLh0rG2KAO0sIsZqwn+YuXKUXgFNK1du0zvnM3DmO+XNPy NRYU/qrZTOY9kXgJkBzuQQ1m4sct/aX3h6gmFWf+MlTm0r9BEE6hjsKqegrUF5Vw/6 vBYEAxsAj7HIw== X-Pm-Submission-Id: 4bccrT6J61z1DDrW From: Sean Nyekjaer Date: Wed, 09 Jul 2025 14:35:10 +0200 Subject: [PATCH 2/6] iio: imu: inv_icm42600: Use devm_regulator_get_enable() for vdd regulator 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: <20250709-icm42pmreg-v1-2-3d0e793c99b2@geanix.com> References: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> In-Reply-To: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> To: Jean-Baptiste Maneyrol , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 The vdd regulator is not used for runtime power management, so it does not need explicit enable/disable handling. Use devm_regulator_get_enable() to let the regulator be managed automatically by devm. This simplifies the code by removing the manual enable and cleanup logic. Signed-off-by: Sean Nyekjaer --- drivers/iio/imu/inv_icm42600/inv_icm42600.h | 1 - drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 25 ++++----------------= ---- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600.h b/drivers/iio/imu/= inv_icm42600/inv_icm42600.h index 1430ab4f1dea5d5ba6277d74275fc44a6cd30eb8..c8b48a5c5ed0677bb35201d3293= 4936faaf7a1a6 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h @@ -167,7 +167,6 @@ struct inv_icm42600_state { enum inv_icm42600_chip chip; const char *name; struct regmap *map; - struct regulator *vdd_supply; struct regulator *vddio_supply; int irq; struct iio_mount_matrix orientation; diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio= /imu/inv_icm42600/inv_icm42600_core.c index 69496d1c1ff73132f5e7bd076d18a62c293285a2..35f7c66d77790829a739d2c54ba= 77e53903a9297 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -697,17 +697,6 @@ static int inv_icm42600_enable_regulator_vddio(struct = inv_icm42600_state *st) return 0; } =20 -static void inv_icm42600_disable_vdd_reg(void *_data) -{ - struct inv_icm42600_state *st =3D _data; - const struct device *dev =3D regmap_get_device(st->map); - int ret; - - ret =3D regulator_disable(st->vdd_supply); - if (ret) - dev_err(dev, "failed to disable vdd error %d\n", ret); -} - static void inv_icm42600_disable_vddio_reg(void *_data) { struct inv_icm42600_state *st =3D _data; @@ -773,23 +762,17 @@ int inv_icm42600_core_probe(struct regmap *regmap, in= t chip, return ret; } =20 - st->vdd_supply =3D devm_regulator_get(dev, "vdd"); - if (IS_ERR(st->vdd_supply)) - return PTR_ERR(st->vdd_supply); + ret =3D devm_regulator_get_enable(dev, "vdd"); + if (ret) + return dev_err_probe(dev, ret, + "Failed to get vdd regulator\n"); =20 st->vddio_supply =3D devm_regulator_get(dev, "vddio"); if (IS_ERR(st->vddio_supply)) return PTR_ERR(st->vddio_supply); =20 - ret =3D regulator_enable(st->vdd_supply); - if (ret) - return ret; msleep(INV_ICM42600_POWER_UP_TIME_MS); =20 - ret =3D devm_add_action_or_reset(dev, inv_icm42600_disable_vdd_reg, st); - if (ret) - return ret; - ret =3D inv_icm42600_enable_regulator_vddio(st); if (ret) return ret; --=20 2.50.0 From nobody Tue Oct 7 13:23:02 2025 Received: from mail-43171.protonmail.ch (mail-43171.protonmail.ch [185.70.43.171]) (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 259872D97BD; Wed, 9 Jul 2025 12:35:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064533; cv=none; b=OotuKiTw6HWA0FQKyoGr50eEW5T/wHCekUIpks7WDSiXcKVS4i95gosul9HPDcifOAJp/aW+UZt+AZgLZML96kF8qMqViiaARNAEtkh7C7tDm/TcXU50uy4g2WAV/ORUQdNH4XZHlc6bgcH7y1jRF1BT9BKIf82npjM006qCsOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064533; c=relaxed/simple; bh=BPy698GcrpPtoDCbVGGWNB9EVLtqnrd3EWTkrQRFADQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qxBgEc+nbDaLCImFASJuBlY/48Xrbm/nViYcM7WLEDOf3R3my1wKaKExvGB04pWyzE7OQG3EPfDYlciZMww/F5M/WuSIpiAnMSg/I7uE0KbJR7x2hs0dmlffGcx4rhc25cmDyRLVmYIQU3ISc27gZCf4ZSa5HXE4AKVgzbYvdkU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=EHqmVv1z; arc=none smtp.client-ip=185.70.43.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="EHqmVv1z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail; t=1752064524; x=1752323724; bh=dE7y/rO3sn7Fy0B0lT1j9SUVem01cPsz49Vvy/A3twI=; h=From:Date:Subject:Message-Id:References:In-Reply-To:To:Cc:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=EHqmVv1z/MzXmRI0oWyQmaCXiPqF52iS+QNyU8PBK032ppWAXaDibaulqYCYMkquA o5yWq6X4LqQq8Pg95eIHUe370/xZCD4x9EmnRHT3YCh6rrX9swLQvEl1i3ErQwT72w xHunN/jzkuLFSsIjiorfDUUC2CV70RVbt/oETb301Y1GUcaRXcf7BZeYra2b1koeu7 rHQKAGSetM1GmeQ+9qJvESojpab3faSE6H/bKhMe5xDcRlf+gzg/zxBOjeehWYXBV7 CgMty9v9Z4KTfXd9ddjWKclwbRKWGlLdwGl91Edefr4+LRDcQ9oif9uDgok7+e66LM zNywarHbZ77rA== X-Pm-Submission-Id: 4bccrW0nVXz1DDrT From: Sean Nyekjaer Date: Wed, 09 Jul 2025 14:35:11 +0200 Subject: [PATCH 3/6] iio: imu: inv_icm42600: Remove redundant error msg on regulator_disable() 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: <20250709-icm42pmreg-v1-3-3d0e793c99b2@geanix.com> References: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> In-Reply-To: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> To: Jean-Baptiste Maneyrol , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 The regulator framework already emits an error message when regulator_disable() fails, making the local dev_err() redundant. Remove the duplicate message to avoid cluttering the kernel log with the same error twice. Signed-off-by: Sean Nyekjaer --- drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio= /imu/inv_icm42600/inv_icm42600_core.c index 35f7c66d77790829a739d2c54ba77e53903a9297..55a29b1e2b11355598b0ede7af2= 2857aed3ae134 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -700,12 +700,8 @@ static int inv_icm42600_enable_regulator_vddio(struct = inv_icm42600_state *st) static void inv_icm42600_disable_vddio_reg(void *_data) { struct inv_icm42600_state *st =3D _data; - const struct device *dev =3D regmap_get_device(st->map); - int ret; =20 - ret =3D regulator_disable(st->vddio_supply); - if (ret) - dev_err(dev, "failed to disable vddio error %d\n", ret); + regulator_disable(st->vddio_supply); } =20 static void inv_icm42600_disable_pm(void *_data) --=20 2.50.0 From nobody Tue Oct 7 13:23:02 2025 Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) (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 4D1C12DA75A; Wed, 9 Jul 2025 12:35:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.165.51.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064541; cv=none; b=p1nje7lkNi0tRs0QLp50mDYwEvW4VsMXqvnlEXpwoOt2r8fCB7HWAU6P045nC/1CuTxWhZ/ys9tq7WLQUeHQ2Kybx0Q4DsCdSqg5TqrkCnQGJFCX0cvD3UnjNuEeuan9GaVpmbZqFwO9Ug81MFUOnx9QeLtUuJehX9DG5zPRUG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064541; c=relaxed/simple; bh=90nZHr68OpVkdlPt2h1quO+Nu1erql/5QFWfMFY2vgE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N1NMMpj7q54c40NTuSJvIqgQR+hgRLL2q76PgCwIRf8Le3Lk7HrfmqWya9UInmWmPwmryDB8a2PFyyysEWh5ueNzd68x6qF39zzj9wHi8ez5EsNbyepcNHGlPYYO4qLI6inScugStm7JFxbl4TyCfzkYCDmGNx7sxrNFGh7RTY0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=BjRfsRYh; arc=none smtp.client-ip=188.165.51.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="BjRfsRYh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail; t=1752064524; x=1752323724; bh=qrCWuverZXRvjlPMM/+qLCn8I0Wqrro+j6nIJoVg+Yk=; h=From:Date:Subject:Message-Id:References:In-Reply-To:To:Cc:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=BjRfsRYhQ1g1AYHz066B3VE6PNEb7w/Jch8sfftGlPR3gLddQzJ85tAvwn88C5V7u E3OStfZ+YCSfnXiydTS4W4aUiOpJ4TxSPvNGrNbk1dnQ20dvF81oNfV+iYP1WmyO7J hXVfv3Vvy59ACip3nyk8Wt4XhHZae/g8BHsVCC2lY7irnnBEMrBr0Hg/i3JOpfnjn4 0fxxpn0VcPrgPp7U+q+2FuLQ8i8JA91wB9SR6/FdQ+DZct8EaEpVHCPajKeCPzvUon gaegpY/h7opPZESRF82vdQ1G2qEzdlV6wzwgehbRRrBER0+2wvvE5ho2Das2XraXky s6hp5hrnJJamg== X-Pm-Submission-Id: 4bccrX07mCz1DDrY From: Sean Nyekjaer Date: Wed, 09 Jul 2025 14:35:12 +0200 Subject: [PATCH 4/6] iio: imu: inv_icm42600: Simplify pm_runtime setup 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: <20250709-icm42pmreg-v1-4-3d0e793c99b2@geanix.com> References: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> In-Reply-To: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> To: Jean-Baptiste Maneyrol , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 Remove unnecessary pm_runtime_get_noresume() and pm_runtime_put() calls during probe. These are not required when the device is marked active via pm_runtime_set_active() before enabling pm_runtime with pm_runtime_enable(). Also remove the redundant pm_runtime_put_sync() call from the cleanup path, since the core is not incrementing the usage count beforehand. This simplifies the PM setup and avoids manipulating the usage counter unnecessarily. Fixes: 31c24c1e93c3 ("iio: imu: inv_icm42600: add core of new inv_icm42600 = driver") Signed-off-by: Sean Nyekjaer --- drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio= /imu/inv_icm42600/inv_icm42600_core.c index 55a29b1e2b11355598b0ede7af22857aed3ae134..1072bea11c73d09a9a0e6ea9d4a= 5c7a72248dca7 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -708,7 +708,6 @@ static void inv_icm42600_disable_pm(void *_data) { struct device *dev =3D _data; =20 - pm_runtime_put_sync(dev); pm_runtime_disable(dev); } =20 @@ -806,11 +805,10 @@ int inv_icm42600_core_probe(struct regmap *regmap, in= t chip, ret =3D pm_runtime_set_active(dev); if (ret) return ret; - pm_runtime_get_noresume(dev); + pm_runtime_enable(dev); pm_runtime_set_autosuspend_delay(dev, INV_ICM42600_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(dev); - pm_runtime_put(dev); =20 return devm_add_action_or_reset(dev, inv_icm42600_disable_pm, dev); } --=20 2.50.0 From nobody Tue Oct 7 13:23:02 2025 Received: from mail-0201.mail-europe.com (mail-0201.mail-europe.com [51.77.79.158]) (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 81C192DFF04 for ; Wed, 9 Jul 2025 12:35:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.77.79.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064546; cv=none; b=aV9cZseJrrzSIIKLfdn6OKay23jOXRI2OkF9Ayv0KHsD74ZSPaeqdtdvTbFnwRa+Ju7sVsLntTn2muroG08Fc2VQGSmbeWfLwYiIkRr5B7EfmOz3Wb0fjGUTF0n7m0Xq4z1dx5hnv7prOrZysbOq2d7PSfl4dporWtMZm/rGW38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064546; c=relaxed/simple; bh=dX8aDAQus10+ARfQJcvwjNcEfHz5PxQHBqUri8THBws=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UXVfhVmyQbIHC35S0/feGl1rLYsX24zDrqJ6sM7ZX+RXrsiTmzqcT4on6T9n4oxZaQG562utJ8N0ShmlI5g/y1mAB/P0wIVfBZTSbpsivZkGfbMTscYP5TAedecnjLCo4YMRzX/xGu+Q4+UhJ+Y0vqsf1oFKR1UVGEfOvyOhcUE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=S4a+aTEW; arc=none smtp.client-ip=51.77.79.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="S4a+aTEW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail; t=1752064525; x=1752323725; bh=cv9a+2twXQl1jbhyzihfbl+qMqFqefRQSxIXNMTNAZU=; h=From:Date:Subject:Message-Id:References:In-Reply-To:To:Cc:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=S4a+aTEWZXqdSxasu9i3Q+ySNFKsGE6HU7UxVyUC6GEoGsTpR0KltvRQsJTDgGh5a 350dBTTlFeQAAzFqSSzDFlFOYHI3zGr/Z7tEYcQJDWK1rqWna38kO+yjYX/epLPSxK VazVxsefzojxYJ13aMqb9pfErLLF7c/g2htlvs+3jTtq4dIf6gTAW6dii0Y5vekOxZ A/hSIJWLlM4wFee/P0tJ+sWiPmh/kVYKz5GMtBH232hMHYMviptdNho49wQ+rH2De1 dz2YyjnbV2QHebzrjMx3c7IuEWan88jH3R7FRF0XHhyzltsgRtpGiE3mKzJJbKUlpN YQqIIr5CP74kQ== X-Pm-Submission-Id: 4bccrX5QDzz1DDrW From: Sean Nyekjaer Date: Wed, 09 Jul 2025 14:35:13 +0200 Subject: [PATCH 5/6] iio: imu: inv_icm42600: Drop redundant pm_runtime reinitialization in resume 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: <20250709-icm42pmreg-v1-5-3d0e793c99b2@geanix.com> References: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> In-Reply-To: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> To: Jean-Baptiste Maneyrol , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 Remove unnecessary calls to pm_runtime_disable(), pm_runtime_set_active(), and pm_runtime_enable() from the resume path. These operations are not required here and can interfere with proper pm_runtime state handling, especially when resuming from a pm_runtime suspended state. Fixes: 31c24c1e93c3 ("iio: imu: inv_icm42600: add core of new inv_icm42600 = driver") Signed-off-by: Sean Nyekjaer --- drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio= /imu/inv_icm42600/inv_icm42600_core.c index 1072bea11c73d09a9a0e6ea9d4a5c7a72248dca7..37b3a7754da1c4e381e38c9871e= 55a941e19cef4 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -904,10 +904,6 @@ static int inv_icm42600_resume(struct device *dev) goto out_unlock; } =20 - pm_runtime_disable(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - /* restore sensors state */ ret =3D inv_icm42600_set_pwr_mgmt0(st, st->suspended.gyro, st->suspended.accel, --=20 2.50.0 From nobody Tue Oct 7 13:23:02 2025 Received: from mail-0201.mail-europe.com (mail-0201.mail-europe.com [51.77.79.158]) (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 81BA92DFA4D for ; Wed, 9 Jul 2025 12:35:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.77.79.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064546; cv=none; b=pASobYKS5jYOM5w7Yrk3e/CMa1812yaEvt/txWHFYnkap4Hll0UF3tITRD7wwIT/ESmwkgjjBwuicNwwYA4XYaaOWjjzsrtYc6eIxdQLGvF6vUOtfdTM7m5ZxBYdWKk2aapoXE/xatJe8QILV9H+gSXKC1Oo6mOhN+GgGOb3v6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752064546; c=relaxed/simple; bh=yjCOvDJQo8WbrkYg41mWfGQdp4nrnuuGCCQs5k4wunU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MO8CAUJajRJsVcS+oxoAb2bgm9sN96+QjwoRbt7x57vRgjOV4WqFNlLMH/vozRt1vv+oUA/BHiNujZgmmcelzJuOxTMjMJJ37EBMe5ltoFmAGBXD97hKp36W+g1RQX8V4f5uQ5244ZUrAj2EJds5fRDkBTE89xxmMqW+kQ1zViI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=UVdy09uv; arc=none smtp.client-ip=51.77.79.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="UVdy09uv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=geanix.com; s=protonmail; t=1752064526; x=1752323726; bh=YD/ZORwhNcjOZSC41mRBp8SECC2d7/ep8mRwBEd2PP4=; h=From:Date:Subject:Message-Id:References:In-Reply-To:To:Cc:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=UVdy09uvthYUQlJDAP3S7+JWMfBXbtZSheVvHyd1lxzdNUcBE1SMUgAWBlGi8Sogb uhwwovaqS7vRNs0F62iSdTOGFy5/TaC4IaZkOdRwUj4vlaOQQlUBpm3dkbnZ6iCuLf EvLl82uEiWn5KYgewhmtR6vjSNg57QFl/++4NesoZL00hm/e2gy69RKgksA9rHBD/8 vlDeoKqWgVQHjdU+pKEI8tH7C3ioFMWMVhzzerPe64GG5phWRVVx9bTTMgWbdTtDxk IsjDDENHgx04T9y38mEbwo4YfyQKmbijkEyufhtjHeYPeTldoSd50/UIB4AJ4dbUrC gYpm5xOJedqWA== X-Pm-Submission-Id: 4bccrY3dxpz1DDrZ From: Sean Nyekjaer Date: Wed, 09 Jul 2025 14:35:14 +0200 Subject: [PATCH 6/6] iio: imu: inv_icm42600: Avoid configuring if already pm_runtime suspended 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: <20250709-icm42pmreg-v1-6-3d0e793c99b2@geanix.com> References: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> In-Reply-To: <20250709-icm42pmreg-v1-0-3d0e793c99b2@geanix.com> To: Jean-Baptiste Maneyrol , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Nyekjaer X-Mailer: b4 0.14.2 Do as in suspend, skip resume configuration steps if the device is already pm_runtime suspended. This avoids reconfiguring a device that is already in the correct low-power state and ensures that pm_runtimeM handles the power state transitions properly. Fixes: 31c24c1e93c3 ("iio: imu: inv_icm42600: add core of new inv_icm42600 = driver") Signed-off-by: Sean Nyekjaer --- drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio= /imu/inv_icm42600/inv_icm42600_core.c index 37b3a7754da1c4e381e38c9871e55a941e19cef4..d745a40b042e1c86b232aaae082= 0942d11d51c79 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -824,17 +824,15 @@ static int inv_icm42600_suspend(struct device *dev) struct device *accel_dev; bool wakeup; int accel_conf; - int ret; + int ret =3D 0; =20 mutex_lock(&st->lock); =20 st->suspended.gyro =3D st->conf.gyro.mode; st->suspended.accel =3D st->conf.accel.mode; st->suspended.temp =3D st->conf.temp_en; - if (pm_runtime_suspended(dev)) { - ret =3D 0; + if (pm_runtime_suspended(dev)) goto out_unlock; - } =20 /* disable FIFO data streaming */ if (st->fifo.on) { @@ -887,10 +885,13 @@ static int inv_icm42600_resume(struct device *dev) struct inv_icm42600_sensor_state *accel_st =3D iio_priv(st->indio_accel); struct device *accel_dev; bool wakeup; - int ret; + int ret =3D 0; =20 mutex_lock(&st->lock); =20 + if (pm_runtime_suspended(dev)) + goto out_unlock; + /* check wakeup capability */ accel_dev =3D &st->indio_accel->dev; wakeup =3D st->apex.on && device_may_wakeup(accel_dev); --=20 2.50.0