sof icon indicating copy to clipboard operation
sof copied to clipboard

topology2: Add rt5682+max98357a support

Open yongzhi1 opened this issue 2 years ago • 8 comments

make topology2_sof-mtl-max98357a-rt5682

localhost ~ # aplay -l **** List of PLAYBACK Hardware Devices **** card 0: sofrt5682 [sof-rt5682], device 0: Headset () [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 1: dummy-spk () [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 5: HDMI1 () [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 6: HDMI2 () [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 7: HDMI3 () [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 8: HDMI4 () [] Subdevices: 1/1 Subdevice #0: subdevice #0 localhost ~ # arecord -l **** List of CAPTURE Hardware Devices **** card 0: sofrt5682 [sof-rt5682], device 0: Headset (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0

Signed-off-by: Yong Zhi [email protected]

yongzhi1 avatar Jul 19 '22 21:07 yongzhi1

@yongzhi1 any update ?

lgirdwood avatar Aug 01 '22 10:08 lgirdwood

V2:

  • updated PCM.1 name from "dummy-spk" to "Speakers"
  • updated NHLT_BIN name to nhlt-ace-mtl-rt5682.bin
  • removed quote around pipeline_id "N"
  • added DMIC pipelines
  • *change SSP1's direction to duplex instead of playback

For the last change, not sure if this is a bug, without the change, capture on SSP0 will fail for:

[ 255.224147] sof-audio-pci-intel-mtl 0000:00:1f.3: no matching blob for sample rate: 48000 sample width: 32 channels: 2 [ 255.236138] sof-audio-pci-intel-mtl 0000:00:1f.3: failed to prepare widget copier.SSP.8.1 [ 255.245289] sof-audio-pci-intel-mtl 0000:00:1f.3: Failed to prepare connected widgets [ 255.254045] sof-audio-pci-intel-mtl 0000:00:1f.3: error: failed widget list set up for pcm 0 dir 1 [ 255.264093] sof-audio-pci-intel-mtl 0000:00:1f.3: ASoC: error at snd_soc_pcm_component_hw_params on 0000:00:1f.3: -22 [ 255.276045] Headset: ASoC: __soc_pcm_hw_params() failed (-22) [ 255.282591] Headset: ASoC: dpcm_fe_dai_hw_params failed (-22)

yongzhi1 avatar Aug 02 '22 16:08 yongzhi1

  • *change SSP1's direction to duplex instead of playback

For the last change, not sure if this is a bug, without the change, capture on SSP0 will fail for:

[ 255.224147] sof-audio-pci-intel-mtl 0000:00:1f.3: no matching blob for sample rate: 48000 sample width: 32 channels: 2 [ 255.236138] sof-audio-pci-intel-mtl 0000:00:1f.3: failed to prepare widget copier.SSP.8.1 [ 255.245289] sof-audio-pci-intel-mtl 0000:00:1f.3: Failed to prepare connected widgets [ 255.254045] sof-audio-pci-intel-mtl 0000:00:1f.3: error: failed widget list set up for pcm 0 dir 1 [ 255.264093] sof-audio-pci-intel-mtl 0000:00:1f.3: ASoC: error at snd_soc_pcm_component_hw_params on 0000:00:1f.3: -22 [ 255.276045] Headset: ASoC: __soc_pcm_hw_params() failed (-22) [ 255.282591] Headset: ASoC: dpcm_fe_dai_hw_params failed (-22)

@juimonen Could you take a look? It seems that NHLT will be generated according to the last SSP definition.

bardliao avatar Aug 03 '22 01:08 bardliao

V3

  • changed SSP1 direction back from "duplex" to "playback" (tplg build and tested with https://github.com/juimonen/alsa-utils/tree/dai_index_fix)

yongzhi1 avatar Aug 05 '22 17:08 yongzhi1

@yongzhi1 does this pend on any recent unmerged fixes from @juimonen ?

lgirdwood avatar Aug 05 '22 18:08 lgirdwood

@yongzhi1 does this pend on any recent unmerged fixes from @juimonen ?

Yes, that's correct - it depends on the dai_index fix to generate the working tplg for headset recording, but the conf itself should be OK :)

yongzhi1 avatar Aug 05 '22 19:08 yongzhi1

Can one of the admins verify this patch?

gkbldcig avatar Oct 15 '22 12:10 gkbldcig

V4 update:

  • Rename NHLT bin file.
  • Use volume/mixer for SSP playback.

Just try to bring the code closer to its final form even thought the maturity of mixer is not ready.

yongzhi1 avatar Oct 17 '22 19:10 yongzhi1

@plbossart @juimonen @bardliao any comments on the updates ?

lgirdwood avatar Oct 19 '22 16:10 lgirdwood

V5:

Cosmetic updates.

yongzhi1 avatar Nov 02 '22 17:11 yongzhi1

@yongzhi1 can you confirm the version of alsatplg you are using. It looks like the CI could be using an older version ?

[2/709] Generating sof-mtl-max98357a-rt5682.tplg
find_modes(): fs not set
alsatplg: malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted (core dumped)

lgirdwood avatar Nov 03 '22 21:11 lgirdwood

@yongzhi1 can you confirm the version of alsatplg you are using. It looks like the CI could be using an older version ?

[2/709] Generating sof-mtl-max98357a-rt5682.tplg
find_modes(): fs not set
alsatplg: malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted (core dumped)

Hi, @lgirdwood , thank you for noticing, how to get https://github.com/alsa-project/alsa-utils/pull/162 merged?

yongzhi1 avatar Nov 04 '22 00:11 yongzhi1

@yongzhi1 can you confirm the version of alsatplg you are using. It looks like the CI could be using an older version ?

[2/709] Generating sof-mtl-max98357a-rt5682.tplg
find_modes(): fs not set
alsatplg: malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted (core dumped)

Hi, @lgirdwood , thank you for noticing, how to get alsa-project/alsa-utils#162 merged?

@ranj063 @juimonen should we send this patch to the mailing list instead ?

lgirdwood avatar Nov 04 '22 15:11 lgirdwood

@ranj063 @juimonen should we send this patch to the mailing list instead ?

@lgirdwood alsaproject PR's always generate an email to the mailing list as well. In the past we've always pinged @perexg on the PR's to get his attention and looks like Yong has already done it.

The more important thing though would be to update our CI docker with the change in alsautils

ranj063 avatar Nov 04 '22 20:11 ranj063

Thank you @ranj063 for the hint, the alsa-utils patch got merged :)

yongzhi1 avatar Nov 04 '22 22:11 yongzhi1

Thank you @ranj063 for the hint, the alsa-utils patch got merged :)

@marc-hb can you update the container with latest alsa-utils git when convenient. Thanks !

lgirdwood avatar Nov 08 '22 13:11 lgirdwood

v6:

Added default value for USE_CHAIN_DMA to fix build err.

yongzhi1 avatar Nov 09 '22 20:11 yongzhi1

v7:

Rebase due to topology dir structure changes.

yongzhi1 avatar Dec 01 '22 21:12 yongzhi1