Skip to contentSkip to conversation

media: i2c: ov13858: Enable clock frequency macro

PATCH In review Sunny Patel 2 participants 6 messages Apr 6, 2025 – Apr 25, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: i2c: ov13858: Enable clock frequency macro

Defines a macro OV13858_MCLK for the clock frequency (19200000 Hz). Replaces the hardcoded clock frequency value in the probe function.

---
 drivers/media/i2c/ov13858.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov13858.c +3 -1
index 7a3fc1d28514..a1242a90cdc9 100644
@@ -21,6 +21,8 @@
 #define OV13858_REG_SOFTWARE_RST	0x0103
 #define OV13858_SOFTWARE_RST		0x01
 
+#define OV13858_MCLK				19200000
+
 /* PLL1 generates PCLK and MIPI_PHY_CLK */
 #define OV13858_REG_PLL1_CTRL_0		0x0300
 #define OV13858_REG_PLL1_CTRL_1		0x0301
@@ -1664,7 +1666,7 @@ static int ov13858_probe(struct i2c_client *client)
 	u32 val = 0;
 
 	device_property_read_u32(&client->dev, "clock-frequency", &val);
-	if (val != 19200000)
+	if (val != OV13858_MCLK)
 		return -EINVAL;
 
 	ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL);
Signature · 1 line
2.43.0
maintainer
#1 lore raw

Hi Sunny,

Quoted 2 lines · Sunny Patel

Defines a macro OV13858_MCLK for the clock frequency (19200000 Hz). Replaces the hardcoded clock frequency value in the probe function.

Thanks for the patch.

While the patch seems fine, the subject and the commit message would benefit from some attention. For instance, don't use third person without a subject. Please see examples in existing commit messages, too.

The clock seems to be called "EXTCLK" in the datasheet, too.

Quoted 28 lines
---
 drivers/media/i2c/ov13858.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov13858.c +3 -1
index 7a3fc1d28514..a1242a90cdc9 100644
@@ -21,6 +21,8 @@
 #define OV13858_REG_SOFTWARE_RST	0x0103
 #define OV13858_SOFTWARE_RST		0x01
 
+#define OV13858_MCLK				19200000
+
 /* PLL1 generates PCLK and MIPI_PHY_CLK */
 #define OV13858_REG_PLL1_CTRL_0		0x0300
 #define OV13858_REG_PLL1_CTRL_1		0x0301
@@ -1664,7 +1666,7 @@ static int ov13858_probe(struct i2c_client *client)
 	u32 val = 0;
 
 	device_property_read_u32(&client->dev, "clock-frequency", &val);
-	if (val != 19200000)
+	if (val != OV13858_MCLK)
 		return -EINVAL;
 
 	ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL);
Signature · 3 lines
Kind regards,

Sakari Ailus
#2 lore raw

PATCH 1/1 media: i2c: ov13858: Enable clock frequency macro

Defines a macro OV13858_MCLK for the clock frequency (19200000 Hz). Replaces the hardcoded clock frequency value in the probe function.

Thanks for the feedback. I have revised the commit message to use correct terminology

---
 drivers/media/i2c/ov13858.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov13858.c +3 -1
index 7a3fc1d28514..a1242a90cdc9 100644
@@ -21,6 +21,8 @@
 #define OV13858_REG_SOFTWARE_RST	0x0103
 #define OV13858_SOFTWARE_RST		0x01
 
+#define OV13858_MCLK				19200000
+
 /* PLL1 generates PCLK and MIPI_PHY_CLK */
 #define OV13858_REG_PLL1_CTRL_0		0x0300
 #define OV13858_REG_PLL1_CTRL_1		0x0301
@@ -1664,7 +1666,7 @@ static int ov13858_probe(struct i2c_client *client)
 	u32 val = 0;
 
 	device_property_read_u32(&client->dev, "clock-frequency", &val);
-	if (val != 19200000)
+	if (val != OV13858_MCLK)
 		return -EINVAL;
 
 	ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL);
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 1/1 media: i2c: ov13858: Define macro for EXTCLK frequency

In reply to Sakari Ailus

Defines a macro OV13858_EXTCLK for the clock frequency (19.2 MHz) and use it instead of the hardcoded value in the probe function.

Thanks for the feedback. I have revised the commit message to use correct terminology

---
 drivers/media/i2c/ov13858.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov13858.c +3 -1
index 7a3fc1d28514..a1242a90cdc9 100644
@@ -21,6 +21,8 @@
 #define OV13858_REG_SOFTWARE_RST	0x0103
 #define OV13858_SOFTWARE_RST		0x01
 
+#define OV13858_MCLK				19200000
+
 /* PLL1 generates PCLK and MIPI_PHY_CLK */
 #define OV13858_REG_PLL1_CTRL_0		0x0300
 #define OV13858_REG_PLL1_CTRL_1		0x0301
@@ -1664,7 +1666,7 @@ static int ov13858_probe(struct i2c_client *client)
 	u32 val = 0;
 
 	device_property_read_u32(&client->dev, "clock-frequency", &val);
-	if (val != 19200000)
+	if (val != OV13858_MCLK)
 		return -EINVAL;
 
 	ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL);
Signature · 1 line
2.43.0
#4 lore raw

PATCH 1/1 media: i2c: ov13858: Enable clock frequency macro

In reply to Sakari Ailus

Define a macro OV13858_EXTCLK for the clock frequency (19.2 MHz) and use it instead of the hardcoded value in the probe function.

Thanks for the feedback. I have revised the commit message to use correct terminology. And please discard the privious mail as it doesn't have correct patch file.

---
 drivers/media/i2c/ov13858.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov13858.c +3 -1
index 7a3fc1d28514..a1242a90cdc9 100644
@@ -21,6 +21,8 @@
 #define OV13858_REG_SOFTWARE_RST	0x0103
 #define OV13858_SOFTWARE_RST		0x01
 
+#define OV13858_MCLK				19200000
+
 /* PLL1 generates PCLK and MIPI_PHY_CLK */
 #define OV13858_REG_PLL1_CTRL_0		0x0300
 #define OV13858_REG_PLL1_CTRL_1		0x0301
@@ -1664,7 +1666,7 @@ static int ov13858_probe(struct i2c_client *client)
 	u32 val = 0;
 
 	device_property_read_u32(&client->dev, "clock-frequency", &val);
-	if (val != 19200000)
+	if (val != OV13858_MCLK)
 		return -EINVAL;
 
 	ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL);
Signature · 1 line
2.43.0
#5 lore raw

PATCH 1/1 media: i2c: ov13858: Enable clock frequency macro

In reply to Sakari Ailus

Define a macro OV13858_EXTCLK for the clock frequency (19.2 MHz) and use it instead of the hardcoded value in the probe function.

---
 drivers/media/i2c/ov13858.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov13858.c +3 -1
index 7a3fc1d28514..a1242a90cdc9 100644
@@ -21,6 +21,8 @@
 #define OV13858_REG_SOFTWARE_RST	0x0103
 #define OV13858_SOFTWARE_RST		0x01
 
+#define OV13858_MCLK				19200000
+
 /* PLL1 generates PCLK and MIPI_PHY_CLK */
 #define OV13858_REG_PLL1_CTRL_0		0x0300
 #define OV13858_REG_PLL1_CTRL_1		0x0301
@@ -1664,7 +1666,7 @@ static int ov13858_probe(struct i2c_client *client)
 	u32 val = 0;
 
 	device_property_read_u32(&client->dev, "clock-frequency", &val);
-	if (val != 19200000)
+	if (val != OV13858_MCLK)
 		return -EINVAL;
 
 	ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL);
Signature · 1 line
2.43.0