We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Omega2 I2C devices SGTL5000



  • Hello, I have an I²C Device with address of 0x0a attached to I2C0. i2cdetect finds about 20 devices at 0x30-0x37 and 0x50-0x5f but not at 0x0a. Does anyone know why? Can someone run i2cdetect -y 0 and post the output here?
    I thought i2c may be disabled by pinmuxing but omega2-ctrl doesn't work on the current build because /dev/mem doesn't exist.

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    

    00: -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: 30 31 32 33 34 35 36 37 -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --

    thanks for reading.



  • i2cdetect doesn't work right on the Omega2, but the devices are still accessible, if you know their addresses. Since you already know the address of your device, just ignore i2cdetect.



  • Ok, thank you. The problem is solved. My device didn't answer because it had no clock.
    The device is a SGTL5000 audio codec from nxp. Sadly I figured out there is no driver for this codec on the omega2.
    I just cloned your repo on github to be able to cross compile but now I'm strandet. I don't know how to get this codec to work. Any hints to go ahead?



  • @Christopher-Bormann When you started talking about codecs I googled the specsheet and......you're talking about an I2S-device, not I2C! It's a completely different thing! Also, the driver for it is compiled via the kernel-config option CONFIG_SND_SOC_SGTL5000.



  • @WereCatf Oh, sorry for confusing you. It is both. The audio data is transferred by I²S but the controlling information is using I²C. I cloned https://github.com/WereCatf/source and ran first_time_setup.sh, which, I assume, calls make menuconfig. I did not find an option for SGTL5000 😞
    I'm really sorry for bothering you, but it's the first time for me to dig into SBCs that deeply.



  • @Christopher-Bormann Well, okay, I looked into this a bit more and yes, it's not quite plug-and-play to get your device working. There does not seem to be support for it in the official firmware, which means you'd have to compile your own, custom firmware. Modifying package/kernel/linux/modules/sound.mk in my LEDE-sources and adding the following lines should give you a menu-option for the SGTL5000 in the kernel-modules section:

    define KernelPackage/sound-soc-sgtl5000
      TITLE:=Support for SGTL5000
      KCONFIG:=CONFIG_SND_SOC_SGTL5000
      FILES:=\
    	$(LINUX_DIR)/sound/soc/codecs/snd-soc-sgtl5000.ko
      AUTOLOAD:=$(call AutoLoad,57,snd-soc-sgtl5000)
      DEPENDS:=
      $(call AddDepends/sound)
    endef
    
    define KernelPackage/sound-soc-sgtl5000/description
     Support for the SGTL5000 codec
    endef
    
    $(eval $(call KernelPackage,sound-soc-sgtl5000))
    

    Alas, I haven't tested if it actually compiles cleanly.

    The bigger problem is that the kernel-module seems to require specifying VDDA-supply and VDDIO-supply for it in the DTS-file, but there is no regulator on the Omega2 at all. Getting it to work might require modifying the kernel-module itself, I don't know.



  • @WereCatf Ok, I modified sound.mk and eventually I could select the option in menuconfig. But compiling fails because snd-soc-sgtl5000.ko was not found

    ERROR: module '/sound/soc/codecs/snd-soc-sgtl5000.ko' is missing.
    

    The source is available

    ls build_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl/linux-4.4.52/sound/soc/codecs/ |grep sgtl
    sgtl5000.c
    sgtl5000.h
    

    Edit: it was just a Typo
    Now I think it was compiled, at least I got linux-ramips_mt7688/linux-4.4.52/sound/soc/codecs/snd-soc-sgtl5000.ko
    but

    Package kmod-sound-soc-sgtl5000 is missing dependencies for the following libraries:
    i2c-core.ko
    regmap-core.ko
    regmap-i2c.ko
    snd-soc-core.ko
    modules/sound.mk:537: recipe for target '/home/chrimbo/workspace/omega/bin/targets/ramips/mt7688/packages/kmod-sound-soc-sgtl5000_4.4.52-1_mipsel_24kc.ipk' failed
    

    Espacially i2c-core.komakes me headache, why is the i2c-core kernel module missing?

    Again thanks for your help and patience



  • I made some progress of that. I'll post it the next days.



  • Hello together,

    this is how I fixed it to get compiled. Many thanks to @WereCatf

    git diff package/kernel/linux/modules/sound.mkdiff --git a/package/kernel/linux/modules/sound.mk b/package/kernel/linux/modules/sound.mk
    index de5d8fc..042cdc4 100644
    --- a/package/kernel/linux/modules/sound.mk
    +++ b/package/kernel/linux/modules/sound.mk
    @@ -519,3 +519,19 @@ define KernelPackage/sound-hda-intel/description
     endef
     
     $(eval $(call KernelPackage,sound-hda-intel))
    +
    +define KernelPackage/sound-soc-sgtl5000
    +  TITLE:=Support for SGTL5000
    +  KCONFIG:=CONFIG_SND_SOC_SGTL5000
    +  FILES:=\
    +       $(LINUX_DIR)/sound/soc/codecs/snd-soc-sgtl5000.ko
    +  AUTOLOAD:=$(call AutoLoad,57,snd-soc-sgtl5000)
    +  DEPENDS:=+kmod-i2c-core +kmod-regmap +kmod-sound-soc-core
    +  $(call AddDepends/sound)
    +endef
    +
    +define KernelPackage/sound-soc-sgtl5000/description
    +  Support for the SGTL5000 codec
    +endef
    +
    +$(eval $(call KernelPackage,sound-soc-sgtl5000))
    

    Now I have some new problems using wifi. After solving that I'll focus again on the audio part.
    Here is the follow up thread



  • Okay now I can compile the firmware with the Codec for SGTL5000 I'm hanging again.
    The kernel module is loaded but a cat /proc/asound/cards lists still --- so soundcards --- I'm not really sure but I think I just have a codec installed but no "card". Am I right if I think I need a card driver in build_dir/target-mipsel_24kc_musl/linux-ramips_mt7688/linux-4.4.52/sound/soc/mediatek which 'uses' the codec?
    Does anyone know how to get this thing up and running? It's so exhausting...
    regards, Christopher



  • @Christopher I am trying to get this codec working too. Did this work eventually?



Looks like your connection to Community was lost, please wait while we try to reconnect.