Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UCM files for avs driver #418

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

amadeuszslawinski-intel

Present in this pull request are UCM files for some of the devices available on market that we were able to test.
They are meant to be used with avs driver and relevant topology files.

@perexg
Copy link
Member

perexg commented May 26, 2024

Move the configurations to ucm2/Intel/avs subtree, please. Also, try to merge the identical device configurations to simplify the configuration maintenance.

@amadeuszslawinski-intel
Copy link
Author

I don't mind moving them, but on systems I've tested pulseaudio looked into /usr/share/alsa/ucm2/conf.d, not /usr/share/alsa/ucm2/Intel/avs. Am I missing something, either on driver or ucm side?

@perexg
Copy link
Member

perexg commented May 28, 2024

The conf.d is just for symlinks for the toplevel config file to keep configurations organized more logically. I would suggest to follow other configs. Also, the ucm2/Intel/ subtree may be restructured more logically (I mean grouping older SST and new AVS configs to separate subdirs).

@amadeuszslawinski-intel
Copy link
Author

Ah, I've missed that, I've moved the files. I also updated topologies to reuse DMIC and HDMI configuration where possible, as those are fairly generic. I've left codec ones separated, as even though there is some reuse possible between models, there also seem to be different expectations between some of them.

Copy link
Member

@perexg perexg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to merge or symlink the similar files. Like:

$ diff -u Google-Atlas-1.0-HiFi.conf Google-Coral-rev2-HiFi.conf
$ echo $?
0

For this given example, you can just create one file for all avs_da7219 devices avs_da7219.conf and avs_da7219-HiFi.conf. If new devices will differ a bit, we can use condition configuration blocks to handle them.

ucm2/Intel/avs/avs_da7219/Google-Atlas-1.0-HiFi.conf Outdated Show resolved Hide resolved
ucm2/Intel/avs/avs_da7219/Google-Atlas-1.0-HiFi.conf Outdated Show resolved Hide resolved
ucm2/Intel/avs/avs_da7219/Google-Atlas-1.0-HiFi.conf Outdated Show resolved Hide resolved
ucm2/Intel/avs/hdaudioB0D2/HDMI-3pb-HiFi.conf Outdated Show resolved Hide resolved
@amadeuszslawinski-intel
Copy link
Author

I've adjusted UCMs is there anything else I need to do?

Copy link
Member

@perexg perexg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for the delay (vacation time). Please, fix JackDev lines.

PlaybackPCM "hw:${CardId},1"
PlaybackChannels 2
PlaybackMixerElem "Headphone"
JackDev "avs_da7219 Headset Jack"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be JackControl?

 *   - JackControl
 *      - jack control identificator
 *      - can be parsed using snd_use_case_parse_ctl_elem_id()
 *      - UCM configuration files should contain both JackControl and JackDev
 *        when possible, because applications are likely to support only one
 *        or the other
 *   - JackDev
 *      - the input device id of the jack (if the full input device path is
 *        /dev/input/by-id/foo, the JackDev value should be "foo")
 *      - UCM configuration files should contain both JackControl and JackDev
 *        when possible, because applications are likely to support only one
 *        or the other

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe? I've used string outputted by lsinput, but maybe I should've used something else?

root@ATLAS:/home/test# lsinput
(...)
/dev/input/event7
   bustype : (null)
   vendor  : 0x0
   product : 0x0
   version : 0
   name    : "avs_da7219 Headset Jack"
   phys    : "ALSA"
   bits ev : (null) (null) (null)

root@ATLAS:/home/test# amixer -c2 controls | grep Jack
numid=65,iface=CARD,name='Headphone Jack'
numid=66,iface=CARD,name='Headset Mic Jack'
numid=67,iface=CARD,name='Line Out Jack'
numid=68,iface=MIXER,name='Headphone Jack Switch'

It's set in:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/intel/avs/boards/da7219.c#n124

Copy link
Member

@perexg perexg Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be JackControl "Headphone Jack" then based on the source (SND_JACK_HEADPHONE -> "Headphone Jack" control mapping). Note that pulseaudio nor pipewire handles JackDev. It's ChromeOS thing.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. However what do you mean by second part of sentence:
"then based on the source (SND_JACK_HEADPHONE -> "Headphone Jack" control mapping)."
?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant pin / ALSA jack control mapping - see struct snd_soc_jack_pin card_headset_pins[] array in the mentioned code.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, I think I just got confused by English, you are referencing that based on the mapping that is done in the kernel code, I should be using Headphone Jack. Will do.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in this and all other files

# While NHLT only has entry for 4 channel DMIC, only 2 channels
# record anything reasonable, so for Front End to work properly
# remap two working channels onto 2 broken ones.
CaptureChannel0 0
Copy link
Member

@perexg perexg Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the audio servers have not implemented this yet. It's preferable to use ucm2/common/pcm/split.conf macros to use alsa-lib's route plugin.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, that's weird, if I remember right, it worked, but yes, I don't see it used anywhere in code for alsa-lib, pulseaudio or pipewire :/ Will check it again then.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed Atlas to link to base 4 channel DMIC variant.


Value {
PlaybackPCM "hw:${CardId},1"
PlaybackMixerElem "DSP"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to combine Left / Right volume controls to one stereo using alsa-lib's configuration (see ucm2/codecs/wsa883x/init.conf) and add this control here. But it may be changed later.

Amadeusz Sławiński added 10 commits August 13, 2024 13:09
Add configs for devices using DMIC codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using da7219 codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using max98357a codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using max98373 codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using max98927 codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using nau8825 codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using rt5514 codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using rt5663 codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using ssm4567 codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Add configs for devices using HDMI codec.

Signed-off-by: Amadeusz Sławiński <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants