[alsa-devel] [PATCH v2] ASoC: bt-sco: support wide band speech

Lars-Peter Clausen lars at metafoo.de
Wed Nov 26 12:30:45 CET 2014


On 11/26/2014 06:08 AM, Barry Song wrote:
> From: Yibo Cai <Yibo.Cai at csr.com>
>
> HFP1.6 requires support for wide band speech(16KHz) over Bluetooth.
>
> Signed-off-by: Yibo Cai <Yibo.Cai at csr.com>
> Signed-off-by: Barry Song <Baohua.Song at csr.com>
> ---
>   sound/soc/codecs/bt-sco.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/sound/soc/codecs/bt-sco.c b/sound/soc/codecs/bt-sco.c
> index c4cf069..3878491 100644
> --- a/sound/soc/codecs/bt-sco.c
> +++ b/sound/soc/codecs/bt-sco.c
> @@ -52,6 +52,14 @@ static struct snd_soc_codec_driver soc_codec_dev_bt_sco = {
>
>   static int bt_sco_probe(struct platform_device *pdev)
>   {
> +	const struct platform_device_id *id = platform_get_device_id(pdev);
> +
> +	/* Check wide band SCO(16KHz) support */
> +	if (id && (strcmp(id->name, "bt-sco-wb") == 0)) {

Use id->driver_data instead of strcmp.

> +		bt_sco_dai.playback.rates |= SNDRV_PCM_RATE_16000;
> +		bt_sco_dai.capture.rates |= SNDRV_PCM_RATE_16000;

This is modifying a driver global struct with device local data. This is a 
no-go. Either add second snd_soc_dai_driver with the new rates or add a 
startup callback and add the constraints using snd_pcm_hw_constraint_list().



More information about the Alsa-devel mailing list