ASoC: bt-sco: support wide band speech
PATCH v2 1/1 ASoC: bt-sco: support wide band speech
From: Yibo Cai <[email protected]>
HFP1.6 requires support for wide band speech(16KHz) over Bluetooth.
--- sound/soc/codecs/bt-sco.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/codecs/bt-sco.c +11 -0
@@ -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 )) { + bt_sco_dai.playback.rates |=SNDRV_PCM_RATE_16000 ; + bt_sco_dai.capture.rates |=SNDRV_PCM_RATE_16000 ; + } +return snd_soc_register_codec (&pdev->dev, &soc_codec_dev_bt_sco, &bt_sco_dai,1 ); }
@@ -70,6 +78,9 @@ static struct platform_device_id bt_sco_driver_ids[] = { { .name = "bt-sco", }, + { + .name = "bt-sco-wb", + }, {}, };MODULE_DEVICE_TABLE (platform, bt_sco_driver_ids);
Signature · 1 line
2.1.3
Quoted 15 lines · Barry Song
From: Yibo Cai <[email protected]>
HFP1.6 requires support for wide band speech(16KHz) over Bluetooth.
Signed-off-by Yibo Cai <[email protected]>Signed-off-by Barry Song <[email protected]>--- sound/soc/codecs/bt-sco.c | 11 +++++++++++ 1 file changed, 11 insertions(+)sound/soc/codecs/bt-sco.c +0
-0
sound/soc/codecs/bt-sco.c static struct snd_soc_codec_driver soc_codec_dev_bt_sco = { · line 58
Quoted 7 lines
sound/soc/codecs/bt-sco.c +4
-0@@ -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.
sound/soc/codecs/bt-sco.c static struct snd_soc_codec_driver soc_codec_dev_bt_sco = { · line 60
Quoted 2 lines
sound/soc/codecs/bt-sco.c +2
-0+ 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().
Mark Brown
maintainerQuoted 3 lines · Lars-Peter Clausen
This is modifying a driver global struct with device local data. This is a no-go. Either add second
snd_soc_dai_driverwith the new rates or add a startup callback and add the constraints usingsnd_pcm_hw_constraint_list().
Or copy into per-device data before modifying and registering. Probably the second snd_soc_dai_driver is the best option though.