From 816e97ebc9aa0e6604898586c01762e61f6aaf16 Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Wed, 13 Feb 2019 09:40:39 +0100 Subject: intel-minnow: fixes the bluetooth SCO with a optional mic. This commit introduces several things. The original need was to fix the bluetooth SCO that was not working on the minnow board. The reason was that this board only has audio output through HDMI, but no input, thus the "talk to bluetooth" stream could not be created. So: 1) Introduces support for an optional USB mono microphone When the mic is not detected, only the "listen" stream is created (so that it is possible for the user to listen to his/her audio messages). So in the "capture" section, a new boolean "optional" parameter is added. 2) mono to stereo conversion is not something straightforward It requires the usage of a dedicated zone, so that mono channel is duplicated to both the right and left channel. This is why a 'front-seats-mono' zone is added to the json file. 3) CPU load and write 'quirk' After having faced problems of heavy CPU load and write errors on the playback device, the way sound output is done in the softmixer has been reworked, to conform to ALSA examples. It relies on a classic "'poll" followed by a call to "snd_pcm_poll_descriptors_revents" that demangles the events. On the minnow board, that does not work. Spurious null events, that should be ignored, -must- be taken in account on the minnow PCH device, else next writes often issue an EPIPE error, leading to clipped sound. Thus here a quirk section is added to the json file, and the only quirk is QUIRK_BOGUS_POLL_REVENTS_DEMANGLING. In the softmixer, when that quirk is set on a device, null events are no longer ignored. This commit must be taken together with: - The fix for PCM ioplug in bluez-alsa - The needed changes in softmixer Change-Id: Ide1605e5480d773e2681ff762e3ecf4c84718fde Signed-off-by: Thierry Bultel --- reference-boards/hal-4a-intel-minnow.json | 39 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/reference-boards/hal-4a-intel-minnow.json b/reference-boards/hal-4a-intel-minnow.json index f4f716f..dc8ce89 100644 --- a/reference-boards/hal-4a-intel-minnow.json +++ b/reference-boards/hal-4a-intel-minnow.json @@ -15,9 +15,9 @@ "info": "Bluealsa hal plugin", "params": { "sco": { - "mic": "INTEL-MINNOW", - "zone": "full-stereo", - "delayms": 800 + "mic": "USB-MIC", + "zone": "front-seats-mono", + "delayms": 500 }, "a2dp": { "zone": "full-stereo", @@ -84,8 +84,9 @@ "cardid": "hw:PCH", "device": 3, "params": { - "rate": 48000 + "rate": 44100 }, + "quirks": [ "QUIRK_BOGUS_POLL_REVENTS_DEMANGLING" ], "sink": { "channels": [ { @@ -100,20 +101,17 @@ } }, "captures": { - "uid": "INTEL-MINNOW", - "path": "/dev/snd/by-path/pci-0000:00:1b.0", + "uid": "USB-MIC", + "cardid": "hw:Microphone", "params": { - "rate": 48000 + "rate": 8000 }, + "optional" : true, "source": { "channels": [ { - "uid": "mic-right", + "uid": "mic-mono", "port": 0 - }, - { - "uid": "mic-left", - "port": 1 } ] } @@ -144,7 +142,22 @@ "channel": 1 } ] - } + }, + { + "uid": "front-seats-mono", + "sink": [ + { + "target": "front-right", + "channel": 0, + "volume": 1.0 + }, + { + "target": "front-left", + "channel": 0, + "volume": 1.0 + } + ] + }, ], "streams": [ { -- cgit 1.2.3-korg