Trying to compile kernel 5.15 with [drivers\misc\khadas_mcu.c]

Which system do you use? Android, Ubuntu, OOWOW or others?

khadas kernel 5.15 \ coreelec kernel 5.15

Which version of system do you use? Please provide the version of the system here:

ubuntu\ce

Please describe your issue below:

I´m trying to compile kernel 5.15 (vendor) with the “older” khadas_mcu.c module to get fan control. In the kernel, there are two khadas_mcu modules that control the fan, the newer khadas_mcu_fan.c somehow does not work, the old one does:

the older one => linux/drivers/misc/khadas-mcu.c at khadas-vims-5.15.y · khadas/linux · GitHub

the newer one => linux/drivers/thermal/khadas_mcu_fan.c at khadas-vims-5.15.y · khadas/linux · GitHub

However, when enabling the “older” mcu I get a compile error

ERROR: modpost: “meson_get_temperature” [drivers/misc/khadas-mcu.ko] undefined!

“meson_get_temperature” is defined in

(kernel 4.9 vendor) linux/drivers/amlogic/thermal/meson_tsensor.c at khadas-vims-4.9.y · khadas/linux · GitHub

(kernel 5.4 vendor) linux/drivers/amlogic/thermal/meson_tsensor.c at khadas-vims-5.4.y · khadas/linux · GitHub

With kernel 5.15, the “amlogic” folder is missing. I (naively) tried to copy the amlogic folder bits to the kernel 5.15 source and recompile.

This does not work…

common_drivers/drivers/thermal/meson_tsensor.c:782:11: error: implicit declaration of function ‘meson_get_cooldev_type’ [-Werror,-Wimplicit-function-declaration]
common_drivers/drivers/thermal/meson_tsensor.c:783:8: error: use of undeclared identifier ‘COOL_DEV_TYPE_CPU_CORE’
common_drivers/drivers/thermal/meson_tsensor.c:787:8: error: use of undeclared identifier ‘COOL_DEV_TYPE_DDR’
common_drivers/drivers/thermal/meson_tsensor.c:789:28: error: no member named ‘last_state’ in ‘struct ddr_cooling_device’
common_drivers/drivers/thermal/meson_tsensor.c:791:8: error: use of undeclared identifier ‘COOL_DEV_TYPE_MEDIA’
common_drivers/drivers/thermal/meson_tsensor.c:1168:36: error: use of undeclared identifier ‘meson_cooldev_platdrv’
common_drivers/drivers/thermal/meson_tsensor.c:1173:30: error: use of undeclared identifier ‘meson_cooldev_platdrv’


Interestingly, with the Ubuntu vendor image (kernel 5.15) provided by Khadas, the kernel config found in /boot/ also uses the older khadas_mcu.c described by CONFIG_KHADAS_MCU=m - the kernel parameters controlling the newer implementation are missing => CONFIG_KHADAS_MCU_FAN_THERMAL=y and
CONFIG_MFD_KHADAS_MCU=y are not there

and the fan also works there…

What is missing? Where are the Amlogic bits?

Thanks! Happy New Year!

  1. We have restructured our directories; amlogic drivers in kernel 5.15 are now under common_drivers.
    meson_get_temperature is defined in common_drivers/drivers/thermal/meson_tsensor.c at khadas-vims-5.15.y · khadas/common_drivers · GitHub
  2. In kernel 5.15, we solely use linux/drivers/misc/khadas-mcu.c for fan control.
    Disable CONFIG_KHADAS_MCU_FAN_THERMAL and CONFIG_MFD_KHADAS_MCU.
2 Likes

Thanks!

So the repo linked must be “merged” into the kernel repo to get the Amlogic drivers working?