Skip to contentSkip to conversation

conf: SOF-Intel: map pcm device for sof driver

PATCH In review Hui Wang 2 participants 3 messages Dec 16, 2019 – Dec 20, 2019

lore
Share & tools
lore

Hui Wang

author
#0 lore raw

PATCH 1/1 conf: SOF-Intel: map pcm device for sof driver

On the machines with HDA codec, the sof driver will use the legacy hda codec driver, as a result, most mixer controls are same as before.

There are only 2 difference:
- HDMI pcm index is 3, 4 and 5 instead of 3, 7, 8...
- dmic is on device 6, 7 instead of 0

After applying this patch, we will get (aplay -L):
hdmi:CARD=sofsklhdacard,DEV=0
sof-skl_hda_card,
HDMI Audio Output
hdmi:CARD=sofsklhdacard,DEV=1
sof-skl_hda_card,
HDMI Audio Output
hdmi:CARD=sofsklhdacard,DEV=2
sof-skl_hda_card,
HDMI Audio Output

and (arecord -L):
dmic:CARD=sofsklhdacard,DEV=0
sof-skl_hda_card,
Digital Mic connected to the PCH directly
dmic:CARD=sofsklhdacard,DEV=1
sof-skl_hda_card,
Digital Mic connected to the PCH directly

Then we could add minor changes in the pulseaudio configuration, after that, all output and input devices will work under pulseaudio.

This is a supplement for ucm, the ucm for sof driver has higher priority than this conf, if there is no ucm for sof driver, this conf will take effect.

---
 src/conf/alsa.conf            |   4 +
 src/conf/cards/Makefile.am    |   3 +-
 src/conf/cards/SOF-Intel.conf | 345 ++++++++++++++++++++++++++++++++++
 src/conf/cards/aliases.conf   |   1 +
 src/conf/pcm/Makefile.am      |   2 +-
 src/conf/pcm/dmic.conf        |  54 ++++++
 6 files changed, 407 insertions(+), 2 deletions(-)
 create mode 100644 src/conf/cards/SOF-Intel.conf
 create mode 100644 src/conf/pcm/dmic.conf
src/conf/alsa.conf +4 -0
index 09980586..28c11c81 100644
@@ -101,6 +101,9 @@ defaults.pcm.iec958.card defaults.pcm.card
 defaults.pcm.iec958.device defaults.pcm.device
 defaults.pcm.modem.card defaults.pcm.card
 defaults.pcm.modem.device defaults.pcm.device
+defaults.pcm.dmic.card defaults.pcm.card
+defaults.pcm.dmic.device 6
+
 # truncate files via file or tee PCM
 defaults.pcm.file_format	"raw"
 defaults.pcm.file_truncate	true
@@ -141,6 +144,7 @@ pcm.dmix cards.pcm.dmix
 pcm.dsnoop cards.pcm.dsnoop
 pcm.modem cards.pcm.modem
 pcm.phoneline cards.pcm.phoneline
+pcm.dmic cards.pcm.dmic
 
 pcm.hw {
 	@args [ CARD DEV SUBDEV ]
src/conf/cards/Makefile.am +2 -1
index 00999f01..b22386a0 100644
@@ -58,7 +58,8 @@ cfg_files = aliases.conf \
 	VIA8237.conf \
 	VX222.conf \
 	VXPocket.conf \
-	VXPocket440.conf
+	VXPocket440.conf \
+	SOF-Intel.conf
 
 if BUILD_ALISP
 cfg_files += aliases.alisp
src/conf/cards/SOF-Intel.conf new file +345 -0

345 lines not on this page · raw message

src/conf/cards/aliases.conf +1 -0
index 18a920f4..0c44c1aa 100644
@@ -57,6 +57,7 @@ CMI8786 cards.CMI8788
 CMI8787 cards.CMI8788
 pistachio cards.pistachio-card
 VC4-HDMI cards.vc4-hdmi
+sof-skl_hda_car cards.SOF-Intel
 
 <confdir:pcm/default.conf>
 <confdir:pcm/dmix.conf>
src/conf/pcm/Makefile.am +1 -1
index c548660d..20da0448 100644
@@ -3,7 +3,7 @@ cfg_files = default.conf front.conf rear.conf center_lfe.conf side.conf\
 	    surround50.conf surround51.conf \
 	    surround71.conf iec958.conf hdmi.conf modem.conf \
 	    dmix.conf dsnoop.conf \
-	    dpl.conf
+	    dpl.conf dmic.conf
 
 EXTRA_DIST = $(cfg_files)
 
src/conf/pcm/dmic.conf new file +54 -0

54 lines not on this page · raw message

Signature · 6 lines
2.17.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#1 lore raw

Dne 16. 12. 19 v 13:51 Hui Wang napsal(a):

Quoted 26 lines

On the machines with HDA codec, the sof driver will use the legacy hda codec driver, as a result, most mixer controls are same as before.

There are only 2 difference:
- HDMI pcm index is 3, 4 and 5 instead of 3, 7, 8...
- dmic is on device 6, 7 instead of 0

After applying this patch, we will get (aplay -L):
hdmi:CARD=sofsklhdacard,DEV=0
sof-skl_hda_card,
HDMI Audio Output
hdmi:CARD=sofsklhdacard,DEV=1
sof-skl_hda_card,
HDMI Audio Output
hdmi:CARD=sofsklhdacard,DEV=2
sof-skl_hda_card,
HDMI Audio Output

and (arecord -L):
dmic:CARD=sofsklhdacard,DEV=0
sof-skl_hda_card,
Digital Mic connected to the PCH directly
dmic:CARD=sofsklhdacard,DEV=1
sof-skl_hda_card,
Digital Mic connected to the PCH directly

Quoted 6 lines

Then we could add minor changes in the pulseaudio configuration, after that, all output and input devices will work under pulseaudio.

This is a supplement for ucm, the ucm for sof driver has higher priority than this conf, if there is no ucm for sof driver, this conf will take effect.

Exactly. The dmic definitions should not be a standard in my eyes. I would not like to accept this. I can accept the standard definitions for the playback devices for this driver, but UCM will replace everything. It's better to define the special PA config for now until we resolve all the UCM issues like:

http://people.redhat.com/~jkysela/sof/carbon-x1-pulse.tar.gz2

The 2nd PA UCM patchset which is working with the current UCM in ALSA's repos for this hardware:

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/217

But it is just a start. There are plenty unresolved abstraction issues with this.

Jaroslav

Signature · 6 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
author
#2 lore raw
Quoted 36 lines · Jaroslav Kysela

Dne 16. 12. 19 v 13:51 Hui Wang napsal(a):

Quoted 26 lines

On the machines with HDA codec, the sof driver will use the legacy hda codec driver, as a result, most mixer controls are same as before.

There are only 2 difference:
  - HDMI pcm index is 3, 4 and 5 instead of 3, 7, 8...
  - dmic is on device 6, 7 instead of 0

After applying this patch, we will get (aplay -L):
hdmi:CARD=sofsklhdacard,DEV=0 sof-skl_hda_card,
     HDMI Audio Output hdmi:CARD=sofsklhdacard,DEV=1 sof-skl_hda_card,
     HDMI Audio Output hdmi:CARD=sofsklhdacard,DEV=2 sof-skl_hda_card,
     HDMI Audio Output

and (arecord -L):
dmic:CARD=sofsklhdacard,DEV=0
     sof-skl_hda_card,
     Digital Mic connected to the PCH directly
dmic:CARD=sofsklhdacard,DEV=1
     sof-skl_hda_card,
     Digital Mic connected to the PCH directly

Quoted 6 lines

Then we could add minor changes in the pulseaudio configuration, after that, all output and input devices will work under pulseaudio.

This is a supplement for ucm, the ucm for sof driver has higher priority than this conf, if there is no ucm for sof driver, this conf will take effect.

Exactly. The dmic definitions should not be a standard in my eyes. I would not like to accept this. I can accept the standard definitions for the playback devices for this driver, but UCM will replace everything. It's better to define the special PA config for now until we resolve all the UCM issues like:

Quoted 7 lines

http://people.redhat.com/~jkysela/sof/carbon-x1-pulse.tar.gz2

The 2nd PA UCM patchset which is working with the current UCM in ALSA's repos for this hardware:

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/217

But it is just a start. There are plenty unresolved abstraction issues with this.

Yes, ucm is more powerful and should be the default choice for users with sof driver+hda codec. But there are 2 issues:

   1.  too complicated, not easy to backport all patches to old version linux distribution, like ubuntu 18.04 LTS (with alsa-lib 1.1.3 and PA v11.1)

   2. no generic ucm confs for most machines, need to write ucm confs machine by machine (existing PA can runtime decide/build  a machine's conf, no need to write conf machine by machine)

After we have sth like below: (if the name dmic is not good, we could change it to be a more reasonable name)

dmic:CARD=sofsklhdacard,DEV=0
     sof-skl_hda_card,
     Digital Mic connected to the PCH directly
dmic:CARD=sofsklhdacard,DEV=1
     sof-skl_hda_card,
     Digital Mic connected to the PCH directly

We just need to do a simple change in the PA's conf, the audio basically could work (include the audio-device-selection-popup-dialogue and mic-mute led on Lenovo machine). Of course it doesn't work perfectly so far, because dmic is not connected to the codec, so it is in a standalone source in the PA, we need to write some code to handle it.

This is the simple change in the PA's conf: https://pastebin.ubuntu.com/p/Tnmkr6D2Kv/

Thanks,

Hui.

Quoted 3 lines

                        Jaroslav

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel