diff mbox

[v5,7/9] ASoC: bt-sco: extend rate and add a general compatible string

Message ID 1466149440-23889-8-git-send-email-garlic.tseng@mediatek.com (mailing list archive)
State New, archived
Headers show

Commit Message

Garlic Tseng June 17, 2016, 7:43 a.m. UTC
Add supports for 16k (wideband BT) and add a general compatible
string "linux,bt-sco"

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
---
 Documentation/devicetree/bindings/sound/bt-sco.txt | 2 +-
 sound/soc/codecs/bt-sco.c                          | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Mark Brown June 29, 2016, 7:15 p.m. UTC | #1
On Fri, Jun 17, 2016 at 03:43:58PM +0800, Garlic Tseng wrote:
> Add supports for 16k (wideband BT) and add a general compatible
> string "linux,bt-sco"

This will claim that we support 16k on existing systems which we clearly
don't.  It also seems unwise to advertise multiple rates when we've no
way to configure the rates...  how does the BT controller figure out
what the sample rate is?
Garlic Tseng June 30, 2016, 12:55 p.m. UTC | #2
On Wed, 2016-06-29 at 20:15 +0100, Mark Brown wrote:
> On Fri, Jun 17, 2016 at 03:43:58PM +0800, Garlic Tseng wrote:
> > Add supports for 16k (wideband BT) and add a general compatible
> > string "linux,bt-sco"
> 
> This will claim that we support 16k on existing systems which we clearly
> don't.  It also seems unwise to advertise multiple rates when we've no
> way to configure the rates...  how does the BT controller figure out
> what the sample rate is?

The codec driver is a dummy driver for bt device and actually do
nothing. The user-space will control both bt part and alsa part (at
least in mt2701 platform). Yes the sound/soc/codecs/bt-sco.c was only
support 8k and was already there before the patch, but I think it might
be ok to extend it to 16k without any side effect.

If you worry about some potential risk (I don't see any) maybe we have
to develop another dummy bt-sco codec driver which support both 8k and
16k?
Garlic Tseng July 1, 2016, 2:49 a.m. UTC | #3
On Thu, 2016-06-30 at 20:55 +0800, Garlic Tseng wrote:
> On Wed, 2016-06-29 at 20:15 +0100, Mark Brown wrote:
> > On Fri, Jun 17, 2016 at 03:43:58PM +0800, Garlic Tseng wrote:
> > > Add supports for 16k (wideband BT) and add a general compatible
> > > string "linux,bt-sco"
> > 
> > This will claim that we support 16k on existing systems which we clearly
> > don't.  It also seems unwise to advertise multiple rates when we've no
> > way to configure the rates...  how does the BT controller figure out
> > what the sample rate is?
> 
> The codec driver is a dummy driver for bt device and actually do
> nothing. The user-space will control both bt part and alsa part (at
> least in mt2701 platform). Yes the sound/soc/codecs/bt-sco.c was only
> support 8k and was already there before the patch, but I think it might
> be ok to extend it to 16k without any side effect.
> 
> If you worry about some potential risk (I don't see any) maybe we have
> to develop another dummy bt-sco codec driver which support both 8k and
> 16k?

Ah! If someone whose bluetooth modules only support 8k use the driver,
they might be broken, right? Maybe we can add another snd_soc_dai_driver
which can support both 8k and 16k.
(Actually I found the issue is discussed before
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-November/084687.html )
Mark Brown July 1, 2016, 4:11 p.m. UTC | #4
On Fri, Jul 01, 2016 at 10:49:46AM +0800, Garlic Tseng wrote:
> On Thu, 2016-06-30 at 20:55 +0800, Garlic Tseng wrote:

> > If you worry about some potential risk (I don't see any) maybe we have
> > to develop another dummy bt-sco codec driver which support both 8k and
> > 16k?

> Ah! If someone whose bluetooth modules only support 8k use the driver,
> they might be broken, right? Maybe we can add another snd_soc_dai_driver
> which can support both 8k and 16k.
> (Actually I found the issue is discussed before
> http://mailman.alsa-project.org/pipermail/alsa-devel/2014-November/084687.html )

Yes, that'd be fine - it could be the same driver and register different
parameters depending on config/compatible.
Chen-Yu Tsai July 2, 2016, 9:05 a.m. UTC | #5
Hi,

On Sat, Jul 2, 2016 at 12:11 AM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Jul 01, 2016 at 10:49:46AM +0800, Garlic Tseng wrote:
>> On Thu, 2016-06-30 at 20:55 +0800, Garlic Tseng wrote:
>
>> > If you worry about some potential risk (I don't see any) maybe we have
>> > to develop another dummy bt-sco codec driver which support both 8k and
>> > 16k?
>
>> Ah! If someone whose bluetooth modules only support 8k use the driver,
>> they might be broken, right? Maybe we can add another snd_soc_dai_driver
>> which can support both 8k and 16k.
>> (Actually I found the issue is discussed before
>> http://mailman.alsa-project.org/pipermail/alsa-devel/2014-November/084687.html )
>
> Yes, that'd be fine - it could be the same driver and register different
> parameters depending on config/compatible.

Could we also make this driver directly configurable from Kconfig,
and not just selected by platforms (currently Samsung) or by building
all coddecs?

Thanks
ChenYu
Garlic Tseng July 4, 2016, 1:59 a.m. UTC | #6
On Sat, 2016-07-02 at 17:05 +0800, Chen-Yu Tsai wrote:

Hi,

> Could we also make this driver directly configurable from Kconfig,
> and not just selected by platforms (currently Samsung) or by building
> all coddecs?
> 
> Thanks
> ChenYu

I'll add configure prompt for SND_SOC_BT_SCO in next patchset.
Thanks for comment.

Garlic
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/sound/bt-sco.txt b/Documentation/devicetree/bindings/sound/bt-sco.txt
index 29b8e5d..641edf7 100644
--- a/Documentation/devicetree/bindings/sound/bt-sco.txt
+++ b/Documentation/devicetree/bindings/sound/bt-sco.txt
@@ -4,7 +4,7 @@  This device support generic Bluetooth SCO link.
 
 Required properties:
 
-  - compatible : "delta,dfbmcs320"
+  - compatible : "delta,dfbmcs320" or "linux,bt-sco"
 
 Example:
 
diff --git a/sound/soc/codecs/bt-sco.c b/sound/soc/codecs/bt-sco.c
index b084ad1..101b384 100644
--- a/sound/soc/codecs/bt-sco.c
+++ b/sound/soc/codecs/bt-sco.c
@@ -31,14 +31,14 @@  static struct snd_soc_dai_driver bt_sco_dai = {
 		.stream_name = "Playback",
 		.channels_min = 1,
 		.channels_max = 1,
-		.rates = SNDRV_PCM_RATE_8000,
+		.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
 		.formats = SNDRV_PCM_FMTBIT_S16_LE,
 	},
 	.capture = {
 		 .stream_name = "Capture",
 		.channels_min = 1,
 		.channels_max = 1,
-		.rates = SNDRV_PCM_RATE_8000,
+		.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
 		.formats = SNDRV_PCM_FMTBIT_S16_LE,
 	},
 };
@@ -77,6 +77,7 @@  MODULE_DEVICE_TABLE(platform, bt_sco_driver_ids);
 #if defined(CONFIG_OF)
 static const struct of_device_id bt_sco_codec_of_match[] = {
 	{ .compatible = "delta,dfbmcs320", },
+	{ .compatible = "linux,bt-sco", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, bt_sco_codec_of_match);