Using the debugfs to read/write registers

Hi all!
Following the Tegra Linux Driver Package Developer Guide , we created a driver based on the ov5693 driver.
Doing this, we implemented camera_common_sensor_ops { .write_reg, .read_reg}, which both are used by
camera_common_debugfs_write in camera_common.c

How do I access these functions? For better debugging, I would like to read and write my sensors registers while running.

He have a node at /sys/kernel/debug/sensor_name/d, but the file is empty. Do I need a tool to access these functions?

Best regards!

As you say the camera_common.c create the debugfs and the fops as below. The .read, .llseek, .release are link to system API that should not match your request. However the .write is link to camera_common_debugfs_write, you can trigger it by echo “0x4d00 0x9” > ov5693_a/d it will show as below message if you enable the dev_dbg() in the camera_common.c, BTW you can modify it .read to your i2c_read function that you just need cat ov5693_a/d to get the reg value.

[ 426.993670] ov5693 30-0036: camera_common_debugfs_open: ++
[ 426.994092] ov5693 30-0036: camera_common_debugfs_write: ++
[ 426.994163] ov5693 30-0036: new address = 4d00, data = 9
[ 426.997421] ov5693 30-0036: wrote to address 0x4d00 with value 0x9

static const struct file_operations camera_common_debugfs_fops = {
.open = camera_common_debugfs_open,
.read = seq_read,
.write = camera_common_debugfs_write,
.llseek = seq_lseek,
.release = single_release,
};

Thank you very much!