AnsweredAssumed Answered

Using an OV5640 sensor with a external, fixed XVCLK

Question asked by Chris Watkin on Apr 2, 2019
Latest reply on Apr 3, 2019 by igorpadykov

We are using a Omnivision OV5640 sensor with a i.MX6 SOM running Debian Stretch. The camera module we would like to use provides its own XVCLK at 12 MHz, and does not use the 24 MHz provided by IMX6QDL_CLK_CKO2 / csi_mclk. We are using the ov5640_mipi.c camera driver & mxc_v4l2_capture.c driver for V4L / gstreamer.

 

What changes do we need to make to the sensor driver, device tree, or other parts of the kernel in order to use the 12 MHz clock? Which modules need to be aware of this change?

 

 

Sensor: OV5640

Processor: i.MX6Q

OS: Debian Stretch

Kernel: 4.9.88+

 

Device tree excerpt:

 

&i2c1

{

clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1_2>;
status = "okay";

ov564x_mipi: ov564x_mipi@3c

{
compatible = "ovti,ov564x_mipi";
reg = <0x3c>;
clocks = <&clks 200>;
clock-names = "csi_mclk"; // THIS IS THE 24 MHz ref clock on IMX6QDL_CLK_CKO2 
pwn-gpios = <&gpio3 13 1>;
rst-gpios = <&gpio4 10 0>;
csi_id = <1>;
mclk = <24000000>;
mclk_source = <0>;
};

};

 

From ov5640 driver:


ov5640_data.sensor_clk = devm_clk_get(dev, "csi_mclk");

...

retval = of_property_read_u32(dev->of_node, "mclk", &(ov5640_data.mclk));

...

clk_prepare_enable(ov5640_data.sensor_clk);

Outcomes