I am working on some userspace validation tool. In which I need to validate i2c freq.
In my DT file, I set clock-frequency = <400000>;
, And I read it back from /proc/device-tree/i2c@XXXXX/clock-frequency
from userspace. But I am getting some garbage data.
Output:
root@mymachine:~# od -bc /proc/device-tree/i2c\@XXXXXX/clock-frequency
0000000 000 006 032 200
\0 006 032 200
0000004
Is it in compressed form? If yes, How can I decompress it?
Output of file
command:
root@nvidia:/proc/device-tree# file i2c\@7000*/clock-frequency
i2c@7000XXXX/clock-frequency: TTComp archive data
i2c@7000XXXX/clock-frequency: raw G3 data, byte-padded
i2c@7000XXXX/clock-frequency: TTComp archive data
i2c@7000XXXX/clock-frequency: raw G3 data, byte-padded
i2c@7000XXXX/clock-frequency: TTComp archive data
i2c@7000XXXX/clock-frequency: TTComp archive data
Try to display the output using the follow (note the parameters):
If your
clock-frequency
was set to 100kHz you should get something like this:And after swapping the endians, you should get
0x186a0
which is 100kHz in decimal.