From: Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>
To: sakari.ailus@linux.intel.com
Cc: tarang.raval@siliconsignals.io,
Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>,
Michael Riesch <michael.riesch@collabora.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: i2c: imx415: Drop redundant runtime PM callbacks
Date: Tue, 24 Mar 2026 18:15:24 +0530 [thread overview]
Message-ID: <20260324124524.135278-1-elgin.perumbilly@siliconsignals.io> (raw)
Replace runtime_suspend/resume wrappers by using power helpers
directly with DEFINE_RUNTIME_DEV_PM_OPS().
Signed-off-by: Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>
---
drivers/media/i2c/imx415.c | 44 +++++++++++++++-----------------------
1 file changed, 17 insertions(+), 27 deletions(-)
diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c
index 0b424c17e880..b7d44f3e165b 100644
--- a/drivers/media/i2c/imx415.c
+++ b/drivers/media/i2c/imx415.c
@@ -1129,8 +1129,12 @@ static void imx415_subdev_cleanup(struct imx415 *sensor)
v4l2_ctrl_handler_free(&sensor->ctrls);
}
-static int imx415_power_on(struct imx415 *sensor)
+static int imx415_power_on(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct v4l2_subdev *subdev = i2c_get_clientdata(client);
+ struct imx415 *sensor = to_imx415(subdev);
+
int ret;
ret = regulator_bulk_enable(ARRAY_SIZE(sensor->supplies),
@@ -1161,11 +1165,17 @@ static int imx415_power_on(struct imx415 *sensor)
return ret;
}
-static void imx415_power_off(struct imx415 *sensor)
+static int imx415_power_off(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct v4l2_subdev *subdev = i2c_get_clientdata(client);
+ struct imx415 *sensor = to_imx415(subdev);
+
clk_disable_unprepare(sensor->clk);
gpiod_set_value_cansleep(sensor->reset, 1);
regulator_bulk_disable(ARRAY_SIZE(sensor->supplies), sensor->supplies);
+
+ return 0;
}
static int imx415_identify_model(struct imx415 *sensor)
@@ -1371,7 +1381,7 @@ static int imx415_probe(struct i2c_client *client)
* work when runtime PM is disabled in the kernel. To that end, power
* the sensor on manually here, identify it, and fully initialize it.
*/
- ret = imx415_power_on(sensor);
+ ret = imx415_power_on(sensor->dev);
if (ret)
return ret;
@@ -1411,7 +1421,7 @@ static int imx415_probe(struct i2c_client *client)
pm_runtime_put_noidle(sensor->dev);
imx415_subdev_cleanup(sensor);
err_power:
- imx415_power_off(sensor);
+ imx415_power_off(sensor->dev);
return ret;
}
@@ -1430,32 +1440,12 @@ static void imx415_remove(struct i2c_client *client)
*/
pm_runtime_disable(sensor->dev);
if (!pm_runtime_status_suspended(sensor->dev))
- imx415_power_off(sensor);
+ imx415_power_off(sensor->dev);
pm_runtime_set_suspended(sensor->dev);
}
-static int imx415_runtime_resume(struct device *dev)
-{
- struct i2c_client *client = to_i2c_client(dev);
- struct v4l2_subdev *subdev = i2c_get_clientdata(client);
- struct imx415 *sensor = to_imx415(subdev);
-
- return imx415_power_on(sensor);
-}
-
-static int imx415_runtime_suspend(struct device *dev)
-{
- struct i2c_client *client = to_i2c_client(dev);
- struct v4l2_subdev *subdev = i2c_get_clientdata(client);
- struct imx415 *sensor = to_imx415(subdev);
-
- imx415_power_off(sensor);
-
- return 0;
-}
-
-static DEFINE_RUNTIME_DEV_PM_OPS(imx415_pm_ops, imx415_runtime_suspend,
- imx415_runtime_resume, NULL);
+static DEFINE_RUNTIME_DEV_PM_OPS(imx415_pm_ops, imx415_power_off,
+ imx415_power_on, NULL);
static const struct of_device_id imx415_of_match[] = {
{ .compatible = "sony,imx415" },
--
2.34.1
next reply other threads:[~2026-03-24 12:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 12:45 Elgin Perumbilly [this message]
2026-03-24 19:42 ` [PATCH] media: i2c: imx415: Drop redundant runtime PM callbacks Michael Riesch
2026-03-25 12:28 ` Sakari Ailus
2026-03-25 19:36 ` Michael Riesch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260324124524.135278-1-elgin.perumbilly@siliconsignals.io \
--to=elgin.perumbilly@siliconsignals.io \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=michael.riesch@collabora.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tarang.raval@siliconsignals.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox