-
在kernel 内 make menuconfig 加入相关选项
Device Drivers --->
<*> Hardware Monitoring support --->
<*> National Semiconductor LM75 and compatibles
-
设备树里面加入
493 &i2c2 {
494 pinctrl-names = "default";
495 pinctrl-0 = <&i2c2_pins>;
496
497 status = "okay";
498 clock-frequency = <100000>;
499
500 tmpx75@4c {
501 compatible = "tmp75";
502 reg = <0x4c>;
503 status = "okay";
504 };
505
506 };
-
编译 kernel,上文件系统,如下操作读取数据
// 开机的时候将 tmpx75模块插入 I2C2 接口中。
// 在文件系统中能看到
/sys/bus/i2c/devices/2-004c/hwmon/hwmon0/temp1_input
-
读取数据
cat /sys/bus/i2c/devices/2-004c/hwmon/hwmon0/temp1_input