A20, Mainline kernel: how to get sound on headphone output?

109 views
Skip to first unread message

Thomas Gahr

unread,
Oct 18, 2016, 5:48:18 AM10/18/16
to linux-sunxi
Hello,

I've been trying to figure out how to get sound on the headphone outputs. AFAICT, A20 supports I2S and S/PDIF but these are for external audio components, while I only need the internal headphone amp.
I've seen that the audio codec has been added in 4.4 but it is disabled in the .dts file used in my kernel. I've enabled it and re-compiled the dtb, and after reboot I loaded the sun4i-codec module but still I have no success.

The problem: alsa does not show the device, also in /dev/snd there's only the USB audio card I've been using so far (which I'd love to get rid of). dmesg also does not mention anything about the audio-codec.
I'm sure there's something simple I'm missing, the question is just: what?

Some information:

root@alarmaster /boot # uname -a
Linux alarmaster 4.8.1-2-ARCH #1 SMP Sat Oct 8 15:03:46 MDT 2016 armv7l GNU/Linux

root@alarmaster /boot # lsmod|grep snd
snd_soc_pcm             5489  0
snd_soc_s3c_dma         1531  1 snd_soc_pcm
snd_soc_core          151946  3 sun4i_codec,snd_soc_pcm,snd_soc_s3c_dma
snd_pcm_dmaengine       5600  1 snd_soc_core
ac97_bus                1838  1 snd_soc_core
snd_usb_audio         141947  0
snd_usbmidi_lib        20465  1 snd_usb_audio
snd_hwdep               6292  1 snd_usb_audio
snd_rawmidi            23170  1 snd_usbmidi_lib
snd_seq_device          4852  1 snd_rawmidi
snd_pcm                95325  4 snd_soc_pcm,snd_usb_audio,snd_pcm_dmaengine,snd_soc_core
snd_timer              22629  1 snd_pcm



root@alarmaster /boot # lsmod
Module                  Size  Used by
snd_soc_pcm             5489  0
snd_soc_s3c_dma         1531  1 snd_soc_pcm
sun4i_codec            12356  0
snd_soc_core          151946  3 sun4i_codec,snd_soc_pcm,snd_soc_s3c_dma
snd_pcm_dmaengine       5600  1 snd_soc_core
ac97_bus                1838  1 snd_soc_core
ccm                     7895  3
usb_f_ecm               6613  2
usb_f_rndis            15906  2
u_ether                12644  2 usb_f_ecm,usb_f_rndis
ipt_MASQUERADE          1223  1
nf_nat_masquerade_ipv4     2957  1 ipt_MASQUERADE
iptable_nat             1924  1
nf_nat_ipv4             5381  1 iptable_nat
nf_nat                 17482  2 nf_nat_masquerade_ipv4,nf_nat_ipv4
xt_tcpudp               2322  8
nf_conntrack_ipv4      14210  2
nf_defrag_ipv4          1620  1 nf_conntrack_ipv4
xt_conntrack            3007  1
nf_conntrack          103452  5 nf_conntrack_ipv4,nf_nat_masquerade_ipv4,xt_conntrack,nf_nat_ipv4,nf_nat
iptable_filter          1929  1
arc4                    1943  2
ath9k_htc              56999  0
snd_usb_audio         141947  0
ath9k_common           28242  1 ath9k_htc
snd_usbmidi_lib        20465  1 snd_usb_audio
ath9k_hw              438363  2 ath9k_htc,ath9k_common
snd_hwdep               6292  1 snd_usb_audio
snd_rawmidi            23170  1 snd_usbmidi_lib
evdev                  12539  0
snd_seq_device          4852  1 snd_rawmidi
snd_pcm                95325  4 snd_soc_pcm,snd_usb_audio,snd_pcm_dmaengine,snd_soc_core
snd_timer              22629  1 snd_pcm
ath                    21859  3 ath9k_htc,ath9k_hw,ath9k_common
mac80211              417547  1 ath9k_htc
axp20x_pek              3651  0
dwmac_sunxi             2638  0
stmmac_platform         5932  1 dwmac_sunxi
cfg80211              254986  4 ath9k_htc,mac80211,ath,ath9k_common
stmmac                 82035  3 stmmac_platform,dwmac_sunxi
rfkill                 19399  3 cfg80211
sun4i_ts                4456  0
sun4i_ss               16538  0
sun4i_lradc_keys        3478  0
spi_sun4i               4571  0
sunxi_wdt               3769  0
uio_pdrv_genirq         3591  0
uio                     9341  1 uio_pdrv_genirq
sch_fq_codel            9160  8
libcomposite           44779  16 usb_f_ecm,usb_f_rndis
ip_tables              12937  2 iptable_filter,iptable_nat
x_tables               18965  5 ip_tables,iptable_filter,xt_tcpudp,ipt_MASQUERADE,xt_conntrack




Thanks,


Thomas

Code Kipper

unread,
Oct 18, 2016, 5:56:08 AM10/18/16
to dag...@gmail.com, linux-sunxi
Hi Thomas,
have you played with the alsamixer settings? you may have to do some
unmuting https://groups.google.com/forum/#!topic/linux-sunxi/rJDiF8qSnLc
BR,
CK
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Thomas Gahr

unread,
Oct 18, 2016, 6:13:22 AM10/18/16
to linux-sunxi, dag...@gmail.com
Hi Thomas,
have you played with the alsamixer settings? you may have to do some
unmuting https://groups.google.com/forum/#!topic/linux-sunxi/rJDiF8qSnLc

Hi CodeKipper,
thanks for your answer!

I'm afraid playing with alsa(mixer) settings is no help for me, since alsa does not even recognize the card, so there's nothing I can unmute.
I *did* try to play with the settings (like the suggestion from https://linux-sunxi.org/Audio_Codec) but, no surprise here, this did not work, it only lead to I/O error message from alsamixer.
The hardware is not even showing up in /sys/class/sound so I think the error is "below" alsa, i.e. something wrong with my kernel config / modules loaded or missing 

Code Kipper

unread,
Oct 18, 2016, 6:57:42 AM10/18/16
to dag...@gmail.com, linux-sunxi
can you run dmesg | grep codec and also show a diff of all your
changes. To get the codec working should only be one line added to
your dts.
CK

Thomas Gahr

unread,
Oct 18, 2016, 7:40:16 AM10/18/16
to linux-sunxi, dag...@gmail.com
can you run dmesg | grep codec and also show a diff of all your
changes. To get the codec working should only be one line added to
your dts.

D'oh! You got me thinking here for a while. Turns out, I made the wrong kind of change to the dts.
I generated the .dts from the .dtb in /boot/dtbs with dtc -I dtb -O dts and then changed codec's status from "disabled" to "enabled". (I'm coming from 3.4.X & .fex land so I need to get used to dts).
I now added the following entry to sun7i-a20-olinuxino-micro.dts and went the whole preprocess-then-dtc route and it works fine now.

&codec {
  status
="okay";
}



Sorry for the noise and thanks for the help/inspiration :)

Thomas
Reply all
Reply to author
Forward
0 new messages