Hi Paul,
I have managed to get the headset detection work with lewtux-5.12 by modifying the DTS [1]:
root@letux:~# evtest /dev/input/event2
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "Alpha 400 Headphones"
Supported events:
Event type 0 (EV_SYN)
Event type 5 (EV_SW)
Event code 2 (SW_HEADPHONE_INSERT)
Properties:
Testing ... (interrupt to exit)
Event: time 6397.560368, type 5 (EV_SW), code 2 (SW_HEADPHONE_INSERT), value 1
Event: time 6397.560368, -------------- EV_SYN ------------
Event: time 6401.050375, type 5 (EV_SW), code 2 (SW_HEADPHONE_INSERT), value 0
Event: time 6401.050375, -------------- EV_SYN ------------
^C
root@letux:~#
Still no success with I2S/Codec/DMA/aplay/arecord:
root@letux:~# aplay /usr/share/sounds/alsa/Front_Center.wav
[ 7637.981286] jz4740_i2s_startup
[ 7637.984612] ak4642_dai_startup: play=1
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
[ 7638.024581] ak4642_dai_hw_params mcko=12000000
[ 7638.029615] ak4642_set_mcko: freq=12000000
[ 7638.033961] jz4740_i2s_hw_params
[ 7638.039801] jz4780_dma_config
[ 7638.054218] jz4780_dma_prep_dma_cyclic
[ 7638.058211] jz4780_dma_desc_alloc
[ 7638.061724] jz4780_dma_setup_hwdesc
[ 7638.065403] jz4780_dma_transfer_size
[ 7638.069167] jz4780_dma_setup_hwdesc
[ 7638.072841] jz4780_dma_transfer_size
[ 7638.076603] jz4780_dma_setup_hwdesc
[ 7638.080277] jz4780_dma_transfer_size
[ 7638.084038] jz4780_dma_setup_hwdesc
[ 7638.087713] jz4780_dma_transfer_size
[ 7638.091482] jz4780_dma_begin
[ 7638.094547] jz4780_dma_chan_enable
[ 7638.098145] jz4740_i2s_trigger
[ 7638.106437] jz4780_dma_tx_status
^CAborted by signal Interrupt...
[ 7641.548540] jz4740_i2s_trigger
[ 7641.553011] jz4780_dma_terminate_all
[ 7641.556778] jz4780_dma_chan_disable
[ 7641.560456] jz4780_dma_desc_free
aplay: pcm_write:1939: write error: Inte[ 7641.567445] jz4740_i2s_shutdown
rrupted system c[ 7641.571680] ak4642_dai_shutdown: play=1
all
[ 7641.577012] jz4780_dma_synchronize
[ 7641.583599] jz4780_dma_chan_disable
root@letux:~#
Most likely the clocks of the I2S interface are not enabled properly or the pinctrl
function / direction is wrong. The fact that aplay gets stuck indicates that the
jz4730 I2S is in slave mode (waiting for external clock) which is not provided by
the codec (master). If it were the other way round, sound data would be emitted
independently of the codec listening or not.
For the microphone/line in I am not sure if it is supported by the ak4642 driver
at all. There is no SND_SOC_DAPM_INPUT definition and I had to comment out
the routing.
We have the old 2.6 driver in sound/oss/ak4642en.c but that is too far away
from modern Sound architecture...
BR,
Nikolaus
[1]:
https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-jz4730-sound