Open aep opened 3 years ago
made a new dts, this works for me
/dts-v1/;
/plugin/;
/ {
fragment@2 {
target = <&i2c1>;
__overlay__ {
status = "okay";
fanctrl: emc2301@2f {
reg = <0x2f>;
compatible = "microchip,emc2301";
#cooling-cells = <0x02>;
fan@0 {
min-rpm = /bits/ 16 <3500>;
max-rpm = /bits/ 16 <5500>;
};
};
};
};
};
The invalid syntax is just the #include
, which I imagine isn't supported in 5.4. If you get rid of that line (and replacing THERMAL_NO_LIMIT
with 4294967295
), you can get it to compile, with warnings, however:
$ dtc -O dtb -o emc2301.dtbo overlays/cm4io-fan-overlay.dts
overlays/cm4io-fan-overlay.dts:22.17-30: Warning (reg_format): /fragment@1/__overlay__/emc2301@2f:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
overlays/cm4io-fan-overlay.dts:26.29-29.19: Warning (unit_address_vs_reg): /fragment@1/__overlay__/emc2301@2f/fan@0: node has a unit name, but no reg property
emc2301.dtbo: Warning (pci_device_reg): Failed prerequisite 'reg_format'
emc2301.dtbo: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
emc2301.dtbo: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
emc2301.dtbo: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
emc2301.dtbo: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
overlays/cm4io-fan-overlay.dts:21.33-30.15: Warning (avoid_default_addr_size): /fragment@1/__overlay__/emc2301@2f: Relying on default #address-cells value
overlays/cm4io-fan-overlay.dts:21.33-30.15: Warning (avoid_default_addr_size): /fragment@1/__overlay__/emc2301@2f: Relying on default #size-cells value
emc2301.dtbo: Warning (avoid_unnecessary_addr_size): Failed prerequisite 'avoid_default_addr_size'
emc2301.dtbo: Warning (unique_unit_address): Failed prerequisite 'avoid_default_addr_size'
We can make those warnings go away with this patch (I think I got the addressing right, but admittedly I have very little idea of what I'm doing):
diff --git a/overlays/cm4io-fan-overlay.dts b/overlays/cm4io-fan-overlay.dts
index 64856b1..bf053d2 100644
--- a/overlays/cm4io-fan-overlay.dts
+++ b/overlays/cm4io-fan-overlay.dts
@@ -18,12 +18,14 @@
fragment@1 {
target = <&i2c_csi_dsi>;
__overlay__ {
+ #address-cells = <0x01>;
+ #size-cells = <0x00>;
fanctrl: emc2301@2f {
reg = <0x2f>;
compatible = "microchip,emc2301";
#cooling-cells = <0x02>;
- fan0: fan@0 {
+ fan0: fan {
min-rpm = /bits/ 16 <3500>;
max-rpm = /bits/ 16 <5500>;
};
That doesn't fix things though, as the build still outputs cp: cannot stat '/var/lib/dkms/cm4io-fan/0.1.1/build/overlays/cm4io-fan.dtbo': No such file or directory
. The overlay
folder doesn't even exist, and I'm not really sure how to debug the DKMS build system to figure out why it seems as though the dtc
compile fails, but the build happily carries on.
There are a lot of changes between 5.4 and 5.10-and-up kernels that made implementing this driver a lot simpler and easier, and I don't have the necessary knowhow to backport this to 5.4, unfortunately.
5.4 support for the CM4 is rather lacking in general, to be honest. I'd recommend upgrading to 21.10 as @sdwilsh has suggested. I've not used Ubuntu on a Pi at all myself - I stick to more lightweight OSes - but if Ubuntu on the Pi offers HWE kernels like it does on x86_64, you should be able to bring yourself up to 5.11 that way (assuming you don't need to stay on 5.4 for some reason or another).
The dtoverlay issue is going to come down to the older device tree bindings (and possibly older base device tree) in the older Ubuntu build. As for why dtc
can fail but the dkms build still succeeds, that's a very good question because it definitely shouldn't... will investigate when I have time :)
Hi,
i couldnt figure out yet how to get it working on ubuntu 20.04
the latest kernel there is 5.4.0-1042-raspi the module compiles fine but it requires changing the regex in dkms.conf
the bigger challange is getting the dtb to compile. right now it just doesnt... and i dont understand how its supposed to work
none of the makefiles contain any call to dtc, so i'm not sure how this works in the first place
calling dtc directly wont work either, since the dts is not valid syntax.