media: i2c: mt9t112: Use the v4l2 helper for obtaining the clock

devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.

Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.

Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Mehdi Djait 2025-06-26 15:34:13 +02:00 committed by Hans Verkuil
parent d1360982c3
commit e49ee5d80b

View File

@ -1078,13 +1078,12 @@ static int mt9t112_probe(struct i2c_client *client)
v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops);
priv->clk = devm_clk_get(&client->dev, "extclk");
if (PTR_ERR(priv->clk) == -ENOENT) {
priv->clk = devm_v4l2_sensor_clk_get(&client->dev, "extclk");
if (PTR_ERR(priv->clk) == -ENOENT)
priv->clk = NULL;
} else if (IS_ERR(priv->clk)) {
dev_err(&client->dev, "Unable to get clock \"extclk\"\n");
return PTR_ERR(priv->clk);
}
else if (IS_ERR(priv->clk))
return dev_err_probe(&client->dev, PTR_ERR(priv->clk),
"Unable to get clock \"extclk\"\n");
priv->standby_gpio = devm_gpiod_get_optional(&client->dev, "standby",
GPIOD_OUT_HIGH);