I2C Read problem

Hello,
I’m trouble shooting driver for a camera, which is communicating with a camera via i2c.
During configuration I’m writing in to some registers and I’m reading from some registers (e.g. chip id).

I sniffed HW bus and I didn’t seen any read messages (only write).
I also used i2c tracing on linux to verify my measurements, and in deed linux wasn’t sending any i2c_read messages.
In dmesg I don’t see any error or warning.
For writng I uses regmap_write(s_data->regmap, addr, val); and for reading regmap_read(s_data->regmap, addr, &reg_val); (That is farthest I was able to get with name references).

What is strange is that both commands reruns 0 as successful transfer, and read value is CORRECT. But there wasn’t any read request from linux. (I printed value and return in to dmesg).

I wanted to check what is called when I call regmap_read, but I was unable to found it, I only got reference to regmap.h. By i2c reference in device tree i2c@546c0000. I would say it uses compatible = “nvidia,tegra210-i2c-vi”, which is in file tegra_vi_i2c.c.
So I add dev_info prints into tegra_i2c_read_data and tegra_i2c_write_data, and add file in to dynamic_debug/control. But I don’t see added prints in the dmesg. So I’m not sure if it is correct file (but then I don’t understand the device tree ).

Different devices, with different driver, on the the bus i2c-62 are able to send read messages. But my driver for camera is unable to send read on the bus i2c-60, which is same physical bus.

My questions are following:
Where I can found function which is called when I call regmap_read()?
Do you have any idea how it can be i2c_read possible without reading?
And how it can figure it out correct value? I don’t believe that there is some complex caching mechanism.

I’m using Jetson Nano with Kernel 4.9.

Using pr_info() instead of dev_info() to check.

Thanks

Thanks, for the advice.

I figure it out:
The reason why I didn’t seen prints, was that I only build kernel and not u-boot and tegra_vi_i2c.c is inside kernel/src/u-boot/drivers/i2c/tegra_vi_i2c.c.

I didn’t seen i2c communication because there is indeed i2c caching:
static const struct regmap_config my_camera_regmap_config = {
.reg_bits = 16,
.val_bits = 8,
.cache_type = REGCACHE_NONE,// originaly REGCACHE_RBTREE,
.use_single_rw = true,
};

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.