Hi everybody, I’m trying to add ntc thermistor as hwmon in linux. Firts I tried to add hwmon manually, but I simple dont know how. Now I’m trying to create device tree overlay, but I have no luck.
I compiled ntc_thermistor module out-of-tree and loaded to kernel. I think this is ok.
modinfo ntc_thermistor.ko
filename: /root/ntc_thermistor/ntc_thermistor.ko
alias: platform:ntc-thermistor
license: GPL
author: MyungJoo Ham myungjoo.ham@samsung.com
description: NTC Thermistor Driver
srcversion: DBAD01E8C409F3A3514FAD2
depends:
vermagic: 3.8.13-35-ARCH SMP mod_unload modversions ARMv7 p2v8
lsmod
Module Size Used by
ntc_thermistor 4075 0
omap_rng 4599 0
autofs4 21976 2
My .dts file looks like this
/dts-v1/;
/plugin/;
/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”;
/* identification */
part-number = “BB-NTC”;
version = “00A0”;
/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
“P9.39”, /* AIN0 */
“P9.40”, /* AIN1 */
“P9.37”, /* AIN2 */
“P9.38”, /* AIN3 */
“P9.33”, /* AIN4 */
“P9.36”, /* AIN5 */
“P9.35”, /* AIN6 */
/* the hardware IP uses */
“tscadc”;
fragment@0 {
target = <&ocp>;
overlay {
/* avoid stupid warning */
#address-cells = <1>;
#size-cells = <1>;
tscadc {
compatible = “ti,ti-tscadc”;
reg = <0x44e0d000 0x1000>;
interrupt-parent = <&intc>;
interrupts = <16>;
ti,hwmods = “adc_tsc”;
status = “okay”;
adc {
ti,adc-channels = <0 1 2 3 4 5 6 7>;
};
};
ntc@0 {
compatible = “ntc,ncp15wb473”;
pullup-uv = <1800000>;
pullup-ohm = <0>;
pulldown-ohm = <12000>;
io-channels = <&tscadc 0>;
};
test_helper: helper {
compatible = “bone-iio-helper”;
vsense-name = “AIN0”, “AIN1”, “AIN2”, “AIN3”, “AIN4”, “AIN5”, “AIN6”, “AIN7”;
vsense-scale = <100 100 100 100 100 100 100 100>;
status = “okay”;
};
};
};
};
After I add .dtbo to capemgr it looks like everything is ok.
#dmesg
[ 102.513840] bone-capemgr bone_capemgr.9: part_number ‘BB-NTC’, version ‘N/A’
[ 102.514030] bone-capemgr bone_capemgr.9: slot #10: generic override
[ 102.514081] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 10
[ 102.514134] bone-capemgr bone_capemgr.9: slot #10: ‘Override Board Name,00A0,Override Manuf,BB-NTC’
[ 102.514409] bone-capemgr bone_capemgr.9: slot #10: Requesting part number/version based 'BB-NTC-00A0.dtbo
[ 102.514463] bone-capemgr bone_capemgr.9: slot #10: Requesting firmware ‘BB-NTC-00A0.dtbo’ for board-name ‘Override Board Name’, version ‘00A0’
[ 102.521859] bone-capemgr bone_capemgr.9: slot #10: dtbo ‘BB-NTC-00A0.dtbo’ loaded; converting to live tree
[ 102.525143] bone-capemgr bone_capemgr.9: slot #10: #1 overlays
[ 102.551219] bone-iio-helper helper.16: ready
[ 102.551443] bone-capemgr bone_capemgr.9: slot #10: Applied #1 overlays.
I’m expecting to see hwmon1 in /sys/class/hwmon/, but there is still only hwmon0 from am33xx internal temp sensor.
I would really appreciate any help.
PS: I still not added compensation table for my NTC to module, but this is test only.