How to disable MCLK ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to disable MCLK ?

1,575 Views
khang_letruong
Senior Contributor III

Dear Community,

To rule out the impact of MCLK frequency to other high speed interfaces on our custom PCB based on iMX8MP, we have a need to enable/disable the MIPI-CSI2 camera driver in order to enable /disable the MCLK clock:

I re-built the ov5640_mipi_v2.c as loadable kernel module :

diff --git a/arch/arm64/configs/imx_v8_defconfig b/arch/arm64/configs/imx_v8_defconfig
index a8a46508482d..a096230294d3 100644
--- a/arch/arm64/configs/imx_v8_defconfig
+++ b/arch/arm64/configs/imx_v8_defconfig
@@ -528,7 +528,7 @@ CONFIG_VIDEO_MXC_CAPTURE=y
 CONFIG_VIDEO_MX8_CAPTURE=y
 CONFIG_VIDEO_MXC_CSI_CAMERA=y
 CONFIG_MXC_MIPI_CSI=y
-CONFIG_MXC_CAMERA_OV5640_MIPI_V2=y
+CONFIG_MXC_CAMERA_OV5640_MIPI_V2=m
 CONFIG_V4L_MEM2MEM_DRIVERS=y
 CONFIG_SDR_PLATFORM_DRIVERS=y
 CONFIG_VIDEO_IMX219=m

 

I saw the in remove() function, clk_disable_unprepare(sensor->sensor_clk) is called. But the 24-MHz MCLK  still persists after rmmod.

static int ov5640_remove(struct i2c_client *client)
{
        struct v4l2_subdev *sd = i2c_get_clientdata(client);
        struct ov5640 *sensor = to_ov5640(client);

        v4l2_async_unregister_subdev(sd);

        clk_disable_unprepare(sensor->sensor_clk);

        ov5640_power_down(sensor, 1);

        ov5640_regualtor_disable();

        return 0;
}

 

I would like to know how to disable it completely during the removing of the module, please?

Thanks in advance and best regards,
Khang

0 Kudos
Reply
4 Replies

1,533 Views
joanxie
NXP TechSupport
NXP TechSupport

refer to the schematic

joanxie_0-1687146571020.png

the dts file set this already,

pinctrl_csi_mclk: csi_mclk_grp {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO15__CCM_CLKO2 0x50
>;
};

0 Kudos
Reply

1,513 Views
khang_letruong
Senior Contributor III

Hi @joanxie ,

Sorry that I did not catch what you meant.Did you mean that MCLK was enabled permanently by the relevant lines in dts file ?

I would like to know if there's any way to disable the MCLK  in runtime, please ?

Best Regards,

Khang

 

0 Kudos
Reply

1,494 Views
joanxie
NXP TechSupport
NXP TechSupport

the HW and dts I shared with you, just reminder you checking if you disable it correctly, how did you disable this

0 Kudos
Reply

1,495 Views
joanxie
NXP TechSupport
NXP TechSupport

how did you set in the dts file? did you disable this camera in the dts? if yes, did you still measure the mclk 24M from this pin?

0 Kudos
Reply