Re: [PATCH v3 RESEND] media: i2c: Add OV05C10 camera sensor driver

From: Nirujogi, Pratap
Date: Mon Jun 23 2025 - 17:52:23 EST


Hi Laurent,

On 6/16/2025 6:49 PM, Nirujogi, Pratap wrote:
+static int ov05c10_probe(struct i2c_client *client)
+{
+     struct ov05c10 *ov05c10;
+     u32 clkfreq;
+     int ret;
+
+     ov05c10 = devm_kzalloc(&client->dev, sizeof(*ov05c10), GFP_KERNEL);
+     if (!ov05c10)
+             return -ENOMEM;
+
+     struct fwnode_handle *fwnode = dev_fwnode(&client->dev);
+
+     ret = fwnode_property_read_u32(fwnode, "clock-frequency", &clkfreq);
+     if (ret)
+             return  dev_err_probe(&client->dev, -EINVAL,
+                                   "fail to get clock freq\n");

Let's try to land
https://lore.kernel.org/linux-media/20250521104115.176950-1- mehdi.djait@xxxxxxxxxxxxxxx/
and replace the code above with devm_v4l2_sensor_clk_get().

Ok, we will verify on our side.

We tried using devm_v4l2_sensor_clk_get() and found its required to add support for software_node to make it work with this driver. Please refer the changes below and let us know if these should be submitted as a separate patch.

---
@@ -645,16 +645,16 @@ struct clk *devm_v4l2_sensor_clk_get(struct device *dev, const char *id)
const char *clk_id __free(kfree) = NULL;
struct clk_hw *clk_hw;
struct clk *clk;
- bool acpi_node;
+ bool is_node;
u32 rate;
int ret;

clk = devm_clk_get_optional(dev, id);
ret = device_property_read_u32(dev, "clock-frequency", &rate);
- acpi_node = is_acpi_node(dev_fwnode(dev));
+ is_node = is_acpi_node(dev_fwnode(dev)) || is_software_node(dev_fwnode(dev));

if (clk) {
- if (!ret && acpi_node) {
+ if (!ret && is_node) {
ret = clk_set_rate(clk, rate);
if (ret) {
dev_err(dev, "Failed to set clock rate: %u\n",
@@ -668,7 +668,7 @@ struct clk *devm_v4l2_sensor_clk_get(struct device *dev, const char *id)
if (ret)
return ERR_PTR(ret);

- if (!IS_ENABLED(CONFIG_COMMON_CLK) || !acpi_node)
+ if (!IS_ENABLED(CONFIG_COMMON_CLK) || !is_node)
return ERR_PTR(-ENOENT);

if (!id) {
----

Thanks,
Pratap