All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: bt-sco: support wide band speech
@ 2014-11-26  5:08 Barry Song
  2014-11-26 11:30 ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: Barry Song @ 2014-11-26  5:08 UTC (permalink / raw)
  To: broonie, lgirdwood, alsa-devel; +Cc: Yibo Cai, workgroup.linux, Barry Song

From: Yibo Cai <Yibo.Cai@csr.com>

HFP1.6 requires support for wide band speech(16KHz) over Bluetooth.

Signed-off-by: Yibo Cai <Yibo.Cai@csr.com>
Signed-off-by: Barry Song <Baohua.Song@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)) {
+		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);
-- 
2.1.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ASoC: bt-sco: support wide band speech
  2014-11-26  5:08 [PATCH v2] ASoC: bt-sco: support wide band speech Barry Song
@ 2014-11-26 11:30 ` Lars-Peter Clausen
  2014-11-26 16:38   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-11-26 11:30 UTC (permalink / raw)
  To: Barry Song, broonie, lgirdwood, alsa-devel
  Cc: Yibo Cai, workgroup.linux, Barry Song

On 11/26/2014 06:08 AM, Barry Song wrote:
> From: Yibo Cai <Yibo.Cai@csr.com>
>
> HFP1.6 requires support for wide band speech(16KHz) over Bluetooth.
>
> Signed-off-by: Yibo Cai <Yibo.Cai@csr.com>
> Signed-off-by: Barry Song <Baohua.Song@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().

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ASoC: bt-sco: support wide band speech
  2014-11-26 11:30 ` Lars-Peter Clausen
@ 2014-11-26 16:38   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-11-26 16:38 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: alsa-devel, Yibo Cai, Barry Song, lgirdwood, workgroup.linux, Barry Song


[-- Attachment #1.1: Type: text/plain, Size: 430 bytes --]

On Wed, Nov 26, 2014 at 12:30:45PM +0100, Lars-Peter Clausen wrote:

> 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().

Or copy into per-device data before modifying and registering.  Probably
the second snd_soc_dai_driver is the best option though.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-26 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26  5:08 [PATCH v2] ASoC: bt-sco: support wide band speech Barry Song
2014-11-26 11:30 ` Lars-Peter Clausen
2014-11-26 16:38   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.