Hello everyone,
I'm currently working on a wandbord dl and i'm trying to use the audio codec SGTL5000 for some applications.
I'm looking for a way to modify the SGTL5000 registers from user side and didn't modify the driver sgtl5000.c
Is it possible to have access to the registers by using some structure defined in the driver sgtl5000.c in user or the only way is via i2c control?
i tried with i2c but i have some issues :
I can make a dump and read the registers with a dump like it's explained in this topic :
Can you get a dump of the SGTL5000 codec registers?
root@freescale /$ cat /sys/kernel/debug/regmap/1-000a/registers | |
000: a011 | |
002: 0060 | |
004: 0008 |
i can find my i2c devices by using the package i2c-tools:
root@debian-armhf:/# i2cdetect -l
i2c-0 i2c 21a0000.i2c I2C adapter
i2c-1 i2c 21a4000.i2c I2C adapter
sgtl5000 is present at the address x0a :
root@debian-armhf:/# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- UU -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
But when i read and tried to set some values i always have zero :
root@debian-armhf:/# i2cdump -f -y -r 0-0xff 1 0x0a
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
does anyone know why I do not ais access to these registers by i2c?
and what is the best way to change them?
Thanks a lot,
Alex
Solved! Go to Solution.
For your application, we don't have ready-made source code for you, but I have some suggestions for you as reference.
According to Linux ALSA driver architecture, we can read/write some codec registers that you are intrested in through Kcontrol interface, you can find the device at sound card path, but we have to modify sgtl5000 driver , to add some Kcontrols related to those registers.
For application level, I suggest you had better refter to amixer source code to check how it loads Kcontrol interfaces, even some source code in it can directly be copied to your application.
see the link : AlsaProject , and download : alsa-utils-1.0.29, you will get amixer source code.
Hope above suggestions can help you !
Regards,
Weidong
Sorry to add to this old thread, but I have the same issue. Actually I think modifying the driver to add the DAP MIXER to allow both I2S and Mic/ADC to be fed to the DAC (and set the DAC to DAP) Not 100% sure I can figure that one out on my own. Looked over the control interface (didn't see or grep any Kcontrols? so I could try and reset it myself. As the original post I'm locked out and even if I force I get garbage data back.
Any ideas on this? BTW, using the Fe-Pi board on a Raspberry Pi. (3+, Zero W)
For your application, we don't have ready-made source code for you, but I have some suggestions for you as reference.
According to Linux ALSA driver architecture, we can read/write some codec registers that you are intrested in through Kcontrol interface, you can find the device at sound card path, but we have to modify sgtl5000 driver , to add some Kcontrols related to those registers.
For application level, I suggest you had better refter to amixer source code to check how it loads Kcontrol interfaces, even some source code in it can directly be copied to your application.
see the link : AlsaProject , and download : alsa-utils-1.0.29, you will get amixer source code.
Hope above suggestions can help you !
Regards,
Weidong