yangxiaohua2009 / custom-kernel

21 stars 5 forks source link

Microphone #11

Open junocomp opened 2 years ago

junocomp commented 2 years ago

i tried to merge your 8316.c code with this https://github.com/plbossart/sound/commit/fdafca8aef9f86f6eed238b42311c15c67a45191?

To try to get the microphone working but it fails. I was wondering if you are able to get the mic detected on your device. Mine works when the headphone jack is plugged.

Katyo was able to get the mic working with this patch.

https://github.com/thesofproject/linux/issues/3800#issuecomment-1222359026

yangxiaohua2009 commented 2 years ago

What do you mean by mic not working?

  1. You cannnot see board mic in sound setting
  2. You are using the wrong mic: the headset mic when headset plugged in and the board mic when headset unplugged
junocomp commented 2 years ago

@yangxiaohua2009 Headset mic is detected right away when plugging it. The board mic is not detected, not even on alsa.

Screenshot from 2022-08-25 08-13-46

Screenshot from 2022-08-25 08-14-13

yangxiaohua2009 commented 2 years ago

This is a ucm issue which is hard to debug. Are you using the latest ucm? Please try the ucm I'm using. ucm.zip ?

junocomp commented 2 years ago

I will give it a try, just run ucm.sh?

junocomp commented 2 years ago

I went through all the dmic configs from your conf files and ran them manually. None of them seem to detect it.

mobian@mobian:~$ amixer -c 0 cset "name='Left Headphone Mixer Left DAC Switch' on"
Wrong control identifier: name='Left Headphone Mixer Left DAC Switch' on
mobian@mobian:~$ amixer -c 0 cset "name='Right Headphone Mixer Right DAC Switch' on"
Wrong control identifier: name='Right Headphone Mixer Right DAC Switch' on
mobian@mobian:~$ amixe -c 0 cset "name='Dmic0 Capture Volume' 70%"
-bash: amixe: command not found
mobian@mobian:~$ amixer -c 0 cset "name='Dmic0 Capture Volume' 70%"
Wrong control identifier: name='Dmic0 Capture Volume' 70%
mobian@mobian:~$ amixer -c 0 cset "name='ADC Capture Volume' 60%"
Wrong control identifier: name='ADC Capture Volume' 60%
yangxiaohua2009 commented 2 years ago

The ucm file should lie under /usr/share/alsa/ucm2/sof-essx8336 or /usr/share/alsa/ucm2/conf.d/sof-essx8336 or /usr/share/alsa/ucm/sof-essx8336.

What's the result after running the ucm.sh? Can you provide the ucm file you are using? Thanks.

junocomp commented 2 years ago

For some reason your ucm.sh script was not copying the folders, I had to do it manually.

Now I have all the sof-essx8336 on the right folders. Still, no mic.

I think the main issue is that Dmic0 Capture Volume does not exist.

Is there a way to show you a list of my alsa item names?

yangxiaohua2009 commented 2 years ago

See alsainfo

You should have things like this in you ucm HiFi.conf file which gives you DMIC device HiFi.conf

 If.dmic {

Condition { Type String Empty "${var:DeviceDmic}" } False.SectionDevice."${var:DeviceDmic}" { Comment "Digital Microphone"

    Value {
        CapturePriority 100
        CapturePCM "hw:${CardId},1"
        If.chn {
            Condition {
                Type RegexMatch
                Regex "cfg-dmics:[34]"
                String "${CardComponents}"
            }
            True {
                CaptureChannels 4
            }
        }
        CaptureMixerElem "Dmic0"
        CaptureVolume "Dmic0 Capture Volume"
        CaptureSwitch "Dmic0 Capture Switch"
    }
}

}

junocomp commented 2 years ago

@yangxiaohua2009 I have that. Still nothing.

junocomp commented 2 years ago

I am starting to think Debian may not be loading the UCM confs.

junocomp commented 2 years ago
sudo lshw -class multimedia
[sudo] password for mobian: 
  *-multimedia:0 UNCLAIMED  
       description: Multimedia controller
       product: JasperLake IPU
       vendor: Intel Corporation
       physical id: 5
       bus info: pci@0000:00:05.0
       version: 00
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm cap_list
       configuration: latency=0
       resources: iomemory:600-5ff memory:6000000000-6000ffffff
yangxiaohua2009 commented 2 years ago

try alsaucm reload and see what you get

junocomp commented 2 years ago

@yangxiaohua2009 it doesnt say anything.

I noticed this

$ sudo systemctl status alsa-restore
● alsa-restore.service - Save/Restore Sound Card State
     Loaded: loaded (/lib/systemd/system/alsa-restore.service; static)
     Active: active (exited) since Tue 2022-09-06 13:14:28 EDT; 1min 1s ago
       Docs: man:alsactl(1)
    Process: 630 ExecStart=/usr/sbin/alsactl -E HOME=/run/alsa -E XDG_RUNTIME_DIR=/run/alsa/runtime restore (code=exited, status=0/SUCCESS)
   Main PID: 630 (code=exited, status=0/SUCCESS)
        CPU: 9ms

Sep 06 13:14:28 gnome systemd[1]: Starting Save/Restore Sound Card State...
Sep 06 13:14:28 gnome alsactl[630]: /usr/sbin/alsactl: set_control:1475: Cannot write control '2:0:0:ALC Capture Target Volume:0' : Invalid argument
Sep 06 13:14:28 gnome systemd[1]: Finished Save/Restore Sound Card State.
yangxiaohua2009 commented 2 years ago

The error is not a problem. You may want to use a simpler (older) ucm syntax for you mic

SectionDevice."Dmic" { Comment "Digital Microphone"

ConflictingDevice [
    "Headset Microphone"
    "Headphone Microphone"
]

EnableSequence [
    cdev "hw:sofsklhdacard"
]

DisableSequence [
    cdev "hw:sofsklhdacard"
]

Value {
    CapturePCM "hw:sofsklhdacard,6"
    CaptureVolume "Dmic0 Capture Volume"
    CaptureSwitch "Dmic0 Capture Switch"
    CaptureChannels "2"
}

}

Replace sofsklhdacard and 6 with the hw number of your dmic when using arecord -l and you can get a device for your dmic.

Mics.zip

junocomp commented 2 years ago

I tweaked and added the file to /usr/share/alsa/ucm2/conf.d/sof-essx8336 and it still not loading. I am not sure whats the deal with ucm not loading on debian and manjaro.

Currently I execute my own script on autostart to get sound working

https://justpaste.it/restore-alsa

The last script you sent me seems like it might work, is there anyway for me to add it to my own start up script and see if it will kickstart the mic?

junocomp commented 1 year ago

I dont think this is an issue with UCM, I think it has to do with the actual es8336 driver is not able to pick up my microphone. I read somewhere that it could be related to the gpio.

junocomp commented 1 year ago

@yangxiaohua2009 anyway I can contact you by email?

yangxiaohua2009 commented 1 year ago

@junocomp Which Debian Version are you using? Please provide your alsainfo https://wiki.ubuntu.com/Audio/AlsaInfo So that I can know if you are using a Dmic or amic.

Or you can try arecord -l to see if you have a Dmic.

If you have a dmic, change the ucm and you can have your mic. If you don't have a dmic, plug in a headset and change the Differential Mux by amixer cset name='Differential Mux' lin1-rin1 or amixer cset name='Differential Mux' lin2-rin2 and see if you can have your on board mic work. Finally you need to change your ucm to get your onboard amic work.

junocomp commented 1 year ago

Im using Mobian bookworm/sid

My alsa-info

http://alsa-project.org/db/?f=76ee9dacd01d5323b4b8404df2a739fe7f707455

$ arecord -l 
**** List of CAPTURE Hardware Devices ****
card 0: sofessx8336 [sof-essx8336], device 0: ES8336 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I tried both lin1-rin1 and lin2-rin2 and still nothing. I can get the microphone from my headset to work. Thats about it.

Overall the board mic is not detected by Gnome Settings

Also, no matter how much I try, every time I try to reload alsaucm it never works. I have opened an issue with alsa-ucm

https://github.com/alsa-project/alsa-ucm-conf/issues/231

Lastly, if you mind contacting me. I want to ask you something in private - usa@junocomputers.com