radxa-build / radxa-cm3-io

Radxa ROCK 3 Compute Module IO Board
https://wiki.radxa.com/Rock3/CM3/radxacm3io
4 stars 0 forks source link

Alsamixer for rockchip rk817 audio device do not contains any volume settings #7

Open Sfinx opened 4 months ago

Sfinx commented 4 months ago

According to rk817 documentation there are present as DAC as ADC volume settings. How to enable them in alsamixer ?

Sfinx commented 4 months ago

Image used: debian b27 xfce

RadxaYuntian commented 4 months ago

Can you screenshot the relative pages? I don't quite understand what you are talking about here.

Sfinx commented 4 months ago

dac_vol adc_vol

The 5.10.x rk817 driver do not have these settings. Moreover - it do not enable the MICBIAS at MIC input pin which makes the noise while recording through CM3 I/O 3.5mm jack. The 6.6.x rk817 driver definitely has as volume settings as MICBIAS:

#define RK817_CODEC_DADC_VOLL           0x1a
#define RK817_CODEC_DADC_VOLR           0x1b
#define RK817_CODEC_DDAC_VOLL           0x31
#define RK817_CODEC_DDAC_VOLR           0x32

static const struct snd_kcontrol_new rk817_volume_controls[] = {
        SOC_DOUBLE_R_RANGE_TLV("Master Playback Volume", RK817_CODEC_DDAC_VOLL,
                RK817_CODEC_DDAC_VOLR, 0, 0x00, 0xff, 1, rk817_vol_tlv),
        SOC_DOUBLE_R_RANGE_TLV("Master Capture Volume", RK817_CODEC_DADC_VOLL,
                RK817_CODEC_DADC_VOLR, 0, 0x00, 0xff, 1, rk817_vol_tlv),
        SOC_DOUBLE_TLV("Mic Capture Gain", RK817_CODEC_DMIC_PGA_GAIN, 4, 0, 0xf, 0,
                rk817_gain_tlv),
};

But the 6.6.x kernel is unsupported which means that CM3 audio is unusable with any kernel. Currently I'm evaluating CM3 for VoIP project.

Sfinx commented 4 months ago

I've managed to add playback/capture volume settings to 5.10.x rk817 driver but seems like there no MICBIAS circuit present inside rk817. This means that CM3 I/O audio is unusable for MIC recording from its design.

vamrs-feng commented 4 months ago

image This is the circuit diagram for the RK817 codec, the MIC pin There is a headphone cradle connected to the baseboard, and the recording function can be verified using our published mirror.

vamrs-feng commented 4 months ago

image

Sfinx commented 4 months ago

It is not clear what you mean under "recording function can be verified using our published mirror". The only way to verify the recording function is to insert MIC into CM3 and check the result WAV file. So try this by yourself first. You will have something like this:

cm3-mic.wav.gz

vamrs-feng commented 4 months ago

What hardware version of CM3 and CM3IO are you using? Also are you recording your operations from the command line, can you provide the recording commands you entered?

vamrs-feng commented 4 months ago

Our test engineers have verified this feature, so it could be some other factor. Can you provide more information so we can troubleshoot?

Sfinx commented 4 months ago

Radxa CM3 module revision is v1.32A 20221103 Radxa CM3 I/O board revision is v1.32

Gembird MIC-211 mic inserted in CM3 I/O 3.5mm audio jack, record command used:

arecord -D plughw:CARD=rockchiprk817,DEV=0 -r 16000 -f S16_LE -V mono cm3-mic.wav
Sfinx commented 4 months ago

re-opening

Sfinx commented 4 months ago

I guess the problem is in too low MIC bias voltage (R34/C36 at CM3 I/O board) - it is wired to 1.8V but must be wired to 3.3V.