media: i2c: hi846: 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:33:59 +02:00 committed by Hans Verkuil
parent 374e55cf08
commit 9c54f6a9ec

View file

@ -2052,12 +2052,11 @@ static int hi846_probe(struct i2c_client *client)
return ret;
}
hi846->clock = devm_clk_get(&client->dev, NULL);
if (IS_ERR(hi846->clock)) {
dev_err(&client->dev, "failed to get clock: %pe\n",
hi846->clock);
return PTR_ERR(hi846->clock);
}
hi846->clock = devm_v4l2_sensor_clk_get(&client->dev, NULL);
if (IS_ERR(hi846->clock))
return dev_err_probe(&client->dev, PTR_ERR(hi846->clock),
"failed to get clock: %pe\n",
hi846->clock);
mclk_freq = clk_get_rate(hi846->clock);
if (mclk_freq != 25000000)