Can not set CSI camera MCLK value

Hello all,

I’m trying to develop IMX415 sensor driver on TX2.
I need use camera with 37.125MHZ INCK freq.

My device tree parameters:
mclk_khz = “37125”;
pix_clk_hz = “74250000”;

Code part for enable clock in “camera_common.c” :

int camera_common_mclk_enable(struct camera_common_data *s_data)
	int err;
	struct camera_common_power_rail *pw = s_data->power;
	unsigned long mclk_init_rate = s_data->def_clk_freq;
	if (!pw) {
		dev_err(s_data->dev, "%s: no device power rail\n",
		return -ENODEV;
	dev_dbg(s_data->dev, "%s: enable MCLK with %lu Hz\n",
		__func__, mclk_init_rate);
	err = clk_set_rate(pw->mclk, mclk_init_rate);
	if (!err)
		err = clk_prepare_enable(pw->mclk);
	return err;

Dmesg output of “dev_dbg(s_data->dev, “%s: enable MCLK with %lu Hz\n”,func, mclk_init_rate);

imx415 2-001a: camera_common_mclk_enable: enable MCLK with 27000000 Hz

I setted different values MCLK but somethings override on my value.
How can I set “s_data->def_clk_freq” ?

Looks like the max value is 37090909, have a try this frequency.

There is 3 value available for clock register provided from sensor company.
27MHz, 37.125MHz and 74.25MHz.

The mclk parent clock is 408000000 and the divider scale was 0.5 so can’t get 37.125.
Suggest to use external clock for your case if this sensor is clock sensitive.

How can I disable internal clock?

Just have HW to use external clock.