DHowett / framework-laptop-kmod

Kernel module to expose more Framework Laptop stuff
Other
68 stars 10 forks source link

Laptop 16, kernel 6.6.38 w/ v3 patchset fails to load framework_laptop driver: `failed to find EC cros-ec-dev.` #19

Open whitslack opened 1 month ago

whitslack commented 1 month ago
$ uname -a
Linux Destructor 6.6.38-gentoo #4 SMP Fri Jul 12 04:38:25 EDT 2024 x86_64 AMD Ryzen 9 7940HS w/ Radeon 780M Graphics AuthenticAMD GNU/Linux

$ zgrep '^[^#].*_CROS_EC' /proc/config.gz 
CONFIG_MFD_CROS_EC_DEV=y
CONFIG_CROS_EC=y
CONFIG_CROS_EC_LPC=y
CONFIG_CROS_EC_PROTO=y

$ dmesg | grep -F -e cros_ec -e framework
[    2.129146] framework_laptop framework_laptop: framework_laptop: failed to find EC cros-ec-dev.
[    2.129377] framework_laptop: probe of framework_laptop failed with error -22
[    2.130883] cros_ec_lpcs cros_ec_lpcs.0: loaded with quirks 00000001
[    2.223334] cros_ec_lpcs cros_ec_lpcs.0: Chrome EC device registered

Is it okay for framework_laptop to be loading before cros_ec_lpcs? (My kernel doesn't support loadable modules, so I integrated your framework_laptop.c into my kernel tree in drivers/platform/x86/.)

Maybe there is a missing dependency specification somehow, or maybe I need to enable another piece of CrOS support that you didn't mention in your README? (I initially didn't have MFD_CROS_EC_DEV enabled, but I tried enabling it to see if it would solve my issue. It didn't.)

whitslack commented 1 month ago

I got it working by changing the return -EINVAL in framework_probe(…) to return -EPROBE_DEFER so that the kernel will try probing the device again later if it fails initially because the CrOS EC device has not yet been registered. I don't know if this is the Right Way™, but it works for me, although I still get the error message in the kernel log.