FATAL: Module aml_i2c not found in directory /lib/modules/5.19.17-meson64

Creating a bug report/issue

Required Information

  • DietPi version | 8.11RC2 ?
  • Distro version | Bullseye
  • Kernel version | 5.19.17
  • SBC model | Odroid C2
  • Power supply used | Original 5V 2A
  • SD card used | 32GB emmc

Additional Information (if applicable)

  • Software title | Odroid Hifishield 2 ( same issue with Hifishield+
  • Was the software title installed freshly or updated/migrated? Fresh
  • Can this issue be replicated on a fresh installation of DietPi? Yes, I think so.
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
  • Bug report ID | f0c11c21-70f8-81c6-649aca9a2b05

Steps to reproduce

<
Install HifiShield2 card

Expected behaviour


  • Exeuting the “modprobe aml_i2c snd-soc-pcm512x snd-soc-pcm512x-i2c snd-soc-odroid-dac2” command

Actual behaviour

“FATAL: Module aml_i2c not found in directory /lib/modules/5.19.17-meson64”

Extra details

hiii, @Videopac

I found this on GitHub, maybe a start of solution…
DietPi-Config | Odroid C2: Support for HiFi Shields with mainline kernel · Issue #5235 · MichaIng/DietPi · GitHub,

…until someone more experienced comes along.

Have a good day :call_me_hand:

1 Like

maybe @MichaIng could have a look

Ah, it shouldn’t have been offered in the first place, but dietpi-config checks for snd-soc-pcm512x-i2c, which does exist on mainline kernel (in the meantime), so it should better check for snd-soc-odroid-dac2. However, probably we can get it to work.

First of all, let’s check whether a first I2C adapter is enabled OOTB:

ls -l /sys/class/i2c-adapter/i2c-1

Otherwise there are two device tree overlays to enable.

Those two kernel modules are available:

modprobe snd-soc-pcm512x snd-soc-pcm512x-i2c

With much luck, if the right I2C device is enabled already, and the snd-soc-odroid-dac2 module is not mandatory, it might show up already:

aplay -l

Thank you.

When I do:
ls -l /sys/class/i2c-adapter/i2c-1
I get:
lrwxrwxrwx 1 root root 0 Jan 1 1970 /sys/class/i2c-adapter/i2c-1 -> ../../devices/platform/soc/c883a000.hdmi-tx/i2c-1
I’ve no idea if this is good or bad.
aplay -l
gives:

  Subdevices: 0/1
  Subdevice #0: subdevice #0

Addition: further reaction on the Github-link stated above.

1 Like

Okay so I2C is enabled, which eliminates the need for the first kernel module. Does this work?

modprobe snd-soc-pcm512x snd-soc-pcm512x-i2c
echo pcm5242 0x4c > /sys/class/i2c-adapter/i2c-1/new_device
amixer -c 1 set Analogue 0
amixer -c 1 set Digital 201
amixer -c 1 set Deemphasis on
aplay -l
amixer -c 1 controls

After the first amixer command I get “invalid card number”
I assume the echo-command above is supposed to write “pcm5242 0x4c” to a (new) file called “new_device”, so I checked it and it was empty. As I (root) did not have rights to edit and write it I tried to change it with chmod to rwx. Still not able to edit it (vim). Also not able with sudo.

Note: I am a novice Linux user.

Okay, so the shield is not there yet.

Everything in /sys are kernel/system tunables, so writing to those files is more like executing a command. And often those files are one-way, i.e. for getting information only or for sending a command. new_device is for creating a new I2C device attached to I2C1, but probably it works differently on this kernel. The file is however meant to be empty when reading from it and cannot be edited with a text editor. Can you show the output of these commands:

ls -l /dev/i2c-1 /sys/class/i2c-adapter/i2c-1/
echo pcm5242 0x4c | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
ls -l /dev/i2c-1 /sys/class/i2c-adapter/i2c-1/
aplay -l
ls -l /dev/i2c-1 /sys/class/i2c-adapter/i2c-1/

result:

crw------- 1 root root 89, 1 Jan  1 17:17 /dev/i2c-1

/sys/class/i2c-adapter/i2c-1/:
total 0
--w------- 1 root root 4096 Jan  2 11:32 delete_device
lrwxrwxrwx 1 root root    0 Jan  2 11:32 device -> ../../c883a000.hdmi-tx
drwxr-xr-x 3 root root    0 Jan  1  1970 i2c-dev
-r--r--r-- 1 root root 4096 Jan  1 17:17 name
--w------- 1 root root 4096 Jan  2 11:32 new_device
drwxr-xr-x 2 root root    0 Jan  2 11:32 power
lrwxrwxrwx 1 root root    0 Jan  1  1970 subsystem -> ../../../../../bus/i2c
-rw-r--r-- 1 root root 4096 Jan  1  1970 uevent
echo pcm5242 0x4c | sudo tee /sys/class/i2c-adapter/i2c-1/new_device

results:
pcm5242 0x4c

ls -l /dev/i2c-1 /sys/class/i2c-adapter/i2c-1/

results in:

crw------- 1 root root 89, 1 Jan  1 17:17 /dev/i2c-1

/sys/class/i2c-adapter/i2c-1/:
total 0
drwxr-xr-x 3 root root    0 Jan  2 11:34 1-004c
--w------- 1 root root 4096 Jan  2 11:32 delete_device
lrwxrwxrwx 1 root root    0 Jan  2 11:32 device -> ../../c883a000.hdmi-tx
drwxr-xr-x 3 root root    0 Jan  1  1970 i2c-dev
-r--r--r-- 1 root root 4096 Jan  1 17:17 name
--w------- 1 root root 4096 Jan  2 11:34 new_device
drwxr-xr-x 2 root root    0 Jan  2 11:32 power
lrwxrwxrwx 1 root root    0 Jan  1  1970 subsystem -> ../../../../../bus/i2c
-rw-r--r-- 1 root root 4096 Jan  1  1970 uevent

aplay -l
results:

card 0: ODROIDC2 [ODROID-C2], device 0: fe.dai-link-0 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I see just now that I2C1 seems to be hardcoded for the c883a000.hdmi-tx device by the device tree, at least we are in its device path by the symlink. Are there other I2C busses/devices?

ls -l /sys/class/i2c-adapter/

I also checked Linux I2C sysfs docs: Linux I2C Sysfs — The Linux Kernel documentation
Can you show also the output of:

ls -l /sys/bus/i2c/devices/

Ah

drwxr-xr-x 3 root root    0 Jan  2 11:34 1-004c

So the device has been created, but this alone does not seem to work. Probably the missing last kernel module sadly is required, or for mainline kernel a device tree overlay which sets everything up.