sgjava Posted May 30, 2018 Posted May 30, 2018 I tried poking around /sys/class/thermal/cooling_device*. The old way was /sys/class/thermal/thermal_zone*/temp, but now cat sys/class/thermal/thermal_zone0/temp returns Invalid argument.
sgjava Posted May 31, 2018 Author Posted May 31, 2018 Did a little more digging and /sys/class/thermal/thermal_zone*/mode shows disabled. Maybe this is disabled in the kernel @Igor
sgjava Posted May 31, 2018 Author Posted May 31, 2018 Something like this? http://lkml.iu.edu/hypermail/linux/kernel/1511.2/02815.html
@lex Posted May 31, 2018 Posted May 31, 2018 Yes, but this patch seems to do a lot more, you can apply the SUN8I THS.
chwe Posted May 31, 2018 Posted May 31, 2018 I think it's one of the 'safe-need-more-inspection' fraction, and just from a quick overview, it should be this one: https://github.com/armbian/build/blob/master/patch/kernel/sunxi-dev/safe-need-more-inspection/23-sun4i-gpadc-iio-add-H3-thermal-sensor-DT.patch Edit: and patches related/based on it.
@lex Posted May 31, 2018 Posted May 31, 2018 just for reference, I've based on 4.17.0.rc7 and this seems to work: ths: ths@1c25000 { #thermal-sensor-cells = <0>; compatible = "allwinner,sun8i-h3-ths"; reg = <0x01c25000 0x400>, <0x01c14234 0x4>; reg-names = "ths", "calibration"; interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; resets = <&ccu RST_BUS_THS>; reset-names = "ahb"; clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>; clock-names = "ahb", "ths"; };
sgjava Posted May 31, 2018 Author Posted May 31, 2018 Is there a way to patch the current kernel or do you have to patch source and build it?
chwe Posted May 31, 2018 Posted May 31, 2018 wouldn't it make sense to check and/or rework this one: https://github.com/armbian/build/blob/master/patch/kernel/sunxi-dev/safe-need-more-inspection/23-sun4i-gpadc-iio-add-H3-thermal-sensor-DT.patch#L15-L22 which is basically what you do. The patch: + iio-hwmon { + compatible = "iio-hwmon"; + io-channels = <&ths>; + }; + + soc { + ths: thermal-sensor@1c25000 { + compatible = "allwinner,sun8i-h3-ths"; + reg = <0x01c25000 0x100>; + clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_THS>; + #thermal-sensor-cells = <0>; + #io-channel-cells = <0>; + }; + }; + but despite having thermals working for your build, armbians dev branch would be a step closer in case we switch to >4.14 for next?
sgjava Posted June 10, 2018 Author Posted June 10, 2018 Woo hoo, this is working in latest dev release: cat /sys/class/thermal/thermal_zone0/temp 34727 uname -a Linux nanopiduo 4.17.0-sunxi #130 SMP Sat Jun 9 00:26:00 UTC 2018 armv7l armv7l armv7l GNU/Linux
sgjava Posted June 13, 2018 Author Posted June 13, 2018 Actually it was my bad. I was using the FriendlyElec dtb to access the USB OTG not supported yet by Armbian. I'm going to revisit this and see if I can make the changes to the Armbian dtb to get both temp and OTG.
raschid Posted June 13, 2018 Posted June 13, 2018 Thermals should work with dev for H2+/H3: see https://github.com/armbian/build/pull/992
sgjava Posted June 13, 2018 Author Posted June 13, 2018 @raschid temp does work fine, but OTG doesn't work with the Armbian DTB. I'm working on getting the OTG port to work with the Armbian DTB since it does work with the FriendlyElec DTB, but breaks temp. NanoPi Duo v1.1 supports OTG (you power off VIN instead of the single USB port). This allows you to attach USB devices without the NanoPi shield.
raschid Posted June 13, 2018 Posted June 13, 2018 @sgjava the current device tree (dev) contains ... &usb_otg { dr_mode = "peripheral"; status = "okay"; }; can you check what the FriendlyElec version says here?
sgjava Posted June 13, 2018 Author Posted June 13, 2018 @raschid Yes, I've already started comparing the DTS files a few days ago but got side tracked. I'll look at it tonight and report back here.
sgjava Posted June 15, 2018 Author Posted June 15, 2018 The FriendlyElec dtb has: usb@1c19000 { compatible = "allwinner,sun8i-h3-musb"; reg = <0x1c19000 0x400>; clocks = <0x3 0x20>; resets = <0x3 0x11>; interrupts = <0x0 0x47 0x4>; interrupt-names = "mc"; phys = <0x10 0x0>; phy-names = "usb"; extcon = <0x10 0x0>; status = "okay"; dr_mode = "otg"; phandle = <0x49>; }; Armbian dtb: usb@1c19000 { compatible = "allwinner,sun8i-h3-musb"; reg = <0x1c19000 0x400>; clocks = <0x3 0x20>; resets = <0x3 0x11>; interrupts = <0x0 0x47 0x4>; interrupt-names = "mc"; phys = <0x11 0x0>; phy-names = "usb"; extcon = <0x11 0x0>; status = "okay"; dr_mode = "peripheral"; phandle = <0x3a>; }; Some of the addresses are different like phys, extcon and phandle and dr_mode is set to "otg" of course. I think when I was playing around with it I just tried the FriendlyElec section and it still doesn't work. There may be other sections of the device tree that need to be changed as well. It's a monster to diff. sun8i-h2-plus-nanopi-duo.friendlyelec.dts sun8i-h2-plus-nanopi-duo.dts
chwe Posted June 15, 2018 Posted June 15, 2018 1 hour ago, sgjava said: I just tried the FriendlyElec section and it still doesn't work. See phandle section here: https://elinux.org/Device_Tree_Mysteries#Phandle 'mixing DT' will most likely end in a mess.. If you look into the devicetree documentation for the sun8i-h3-musb: https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/usb/allwinner%2Csun4i-a10-musb.txt It looks like a change to: usb@1c19000 { compatible = "allwinner,sun8i-h3-musb"; reg = <0x1c19000 0x400>; clocks = <0x3 0x20>; resets = <0x3 0x11>; interrupts = <0x0 0x47 0x4>; interrupt-names = "mc"; phys = <0x11 0x0>; phy-names = "usb"; extcon = <0x11 0x0>; status = "okay"; dr_mode = "otg"; phandle = <0x3a>; }; 'should' work. I've neither a otg device nor the board to test it and neither am I a DT expert to be sure it works... As soon as you patch a DT (and for sunxi, there are a bunch of DT patches) addresses can change fast (I compared once two decompiled dtb files for the tinker board, once from RKs Linaro once from Armbian even when the 'big picture' looked 'more or less' the same - diff would show ~80% difference ). I think the reason armbian uses "peripheral" mode is due to g_serial: https://github.com/armbian/build/blob/ebd89c9b73a73bada602d7905a5072f5334e8428/config/boards/nanopiduo.conf#L6 https://github.com/armbian/build/commit/446295ee282c4ff064c78ef5ff31be963222c82c so g_serial might not work anymore when you change to otg mode.
sgjava Posted June 15, 2018 Author Posted June 15, 2018 That's basically just changing only the dr_mode to otg which was the first thing I did. I'll run the FriendlyElec dtb for now since I need the OTG more than temp. I have to force compile to generate a dtb: sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /soc/pinctrl@1c20800/wifi_wake@0 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@240000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@480000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@648000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@816000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@912000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@960000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@1008000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@1104000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@1200000000 has a unit name, but no reg property sun8i-h2-plus-nanopi-duo.dtb: Warning (unit_address_vs_reg): Node /opp_table/opp@1296000000 has a unit name, but no reg property
Recommended Posts