linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: hci_qca: Enable WBS support for wcn3991
@ 2020-05-14 20:14 Abhishek Pandit-Subedi
  2020-05-14 21:07 ` Matthias Kaehlcke
  2020-05-18  8:03 ` Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-05-14 20:14 UTC (permalink / raw)
  To: linux-bluetooth, bgodavar
  Cc: alainm, marcel, mka, chromeos-bluetooth-upstreaming,
	Abhishek Pandit-Subedi, Johan Hedberg, linux-kernel

WCN3991 supports transparent WBS (host encoded mSBC). Add a flag to the
device match data to show WBS is supported.

This requires the matching firmware for WCN3991 in linux-firmware:
        1a8b0dc00f77 (qca: Enable transparent WBS for WCN3991)

Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
---

Changes in v2:
- Rename struct to qca_capabilities and fix enum naming

 drivers/bluetooth/hci_qca.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index b3fd07a6f8127..96799644f0933 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -75,6 +75,9 @@ enum qca_flags {
 	QCA_HW_ERROR_EVENT
 };
 
+enum qca_capabilities {
+	QCA_CAP_WIDEBAND_SPEECH_SUPPORTED = BIT(0),
+};
 
 /* HCI_IBS transmit side sleep protocol states */
 enum tx_ibs_states {
@@ -187,10 +190,11 @@ struct qca_vreg {
 	unsigned int load_uA;
 };
 
-struct qca_vreg_data {
+struct qca_device_data {
 	enum qca_btsoc_type soc_type;
 	struct qca_vreg *vregs;
 	size_t num_vregs;
+	uint32_t capabilities;
 };
 
 /*
@@ -1691,7 +1695,7 @@ static const struct hci_uart_proto qca_proto = {
 	.dequeue	= qca_dequeue,
 };
 
-static const struct qca_vreg_data qca_soc_data_wcn3990 = {
+static const struct qca_device_data qca_soc_data_wcn3990 = {
 	.soc_type = QCA_WCN3990,
 	.vregs = (struct qca_vreg []) {
 		{ "vddio", 15000  },
@@ -1702,7 +1706,7 @@ static const struct qca_vreg_data qca_soc_data_wcn3990 = {
 	.num_vregs = 4,
 };
 
-static const struct qca_vreg_data qca_soc_data_wcn3991 = {
+static const struct qca_device_data qca_soc_data_wcn3991 = {
 	.soc_type = QCA_WCN3991,
 	.vregs = (struct qca_vreg []) {
 		{ "vddio", 15000  },
@@ -1711,9 +1715,10 @@ static const struct qca_vreg_data qca_soc_data_wcn3991 = {
 		{ "vddch0", 450000 },
 	},
 	.num_vregs = 4,
+	.capabilities = QCA_CAP_WIDEBAND_SPEECH_SUPPORTED,
 };
 
-static const struct qca_vreg_data qca_soc_data_wcn3998 = {
+static const struct qca_device_data qca_soc_data_wcn3998 = {
 	.soc_type = QCA_WCN3998,
 	.vregs = (struct qca_vreg []) {
 		{ "vddio", 10000  },
@@ -1724,7 +1729,7 @@ static const struct qca_vreg_data qca_soc_data_wcn3998 = {
 	.num_vregs = 4,
 };
 
-static const struct qca_vreg_data qca_soc_data_qca6390 = {
+static const struct qca_device_data qca_soc_data_qca6390 = {
 	.soc_type = QCA_QCA6390,
 	.num_vregs = 0,
 };
@@ -1860,7 +1865,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 {
 	struct qca_serdev *qcadev;
 	struct hci_dev *hdev;
-	const struct qca_vreg_data *data;
+	const struct qca_device_data *data;
 	int err;
 	bool power_ctrl_enabled = true;
 
@@ -1948,6 +1953,12 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 		hdev->shutdown = qca_power_off;
 	}
 
+	/* Wideband speech support must be set per driver since it can't be
+	 * queried via hci.
+	 */
+	if (data && (data->capabilities & QCA_CAP_WIDEBAND_SPEECH_SUPPORTED))
+		set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
+
 	return 0;
 }
 
-- 
2.26.2.761.g0e0b3e54be-goog


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

* Re: [PATCH v2] Bluetooth: hci_qca: Enable WBS support for wcn3991
  2020-05-14 20:14 [PATCH v2] Bluetooth: hci_qca: Enable WBS support for wcn3991 Abhishek Pandit-Subedi
@ 2020-05-14 21:07 ` Matthias Kaehlcke
  2020-05-18  8:03 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Matthias Kaehlcke @ 2020-05-14 21:07 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: linux-bluetooth, bgodavar, alainm, marcel,
	chromeos-bluetooth-upstreaming, Johan Hedberg, linux-kernel

Hi Abhishek,

On Thu, May 14, 2020 at 01:14:04PM -0700, Abhishek Pandit-Subedi wrote:
> WCN3991 supports transparent WBS (host encoded mSBC). Add a flag to the
> device match data to show WBS is supported.
> 
> This requires the matching firmware for WCN3991 in linux-firmware:
>         1a8b0dc00f77 (qca: Enable transparent WBS for WCN3991)
> 
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> 
> Changes in v2:
> - Rename struct to qca_capabilities and fix enum naming
> 
>  drivers/bluetooth/hci_qca.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index b3fd07a6f8127..96799644f0933 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -75,6 +75,9 @@ enum qca_flags {
>  	QCA_HW_ERROR_EVENT
>  };
>  
> +enum qca_capabilities {
> +	QCA_CAP_WIDEBAND_SPEECH_SUPPORTED = BIT(0),

nit: the '_SUPPORTED' suffix seems somewhat redundant, given that this
is a capability (as 'CAP' indicates). Up to you if you want to keep it.

> +};
>  
>  /* HCI_IBS transmit side sleep protocol states */
>  enum tx_ibs_states {
> @@ -187,10 +190,11 @@ struct qca_vreg {
>  	unsigned int load_uA;
>  };
>  
> -struct qca_vreg_data {
> +struct qca_device_data {
>  	enum qca_btsoc_type soc_type;
>  	struct qca_vreg *vregs;
>  	size_t num_vregs;
> +	uint32_t capabilities;
>  };
>  
>  /*
> @@ -1691,7 +1695,7 @@ static const struct hci_uart_proto qca_proto = {
>  	.dequeue	= qca_dequeue,
>  };
>  
> -static const struct qca_vreg_data qca_soc_data_wcn3990 = {
> +static const struct qca_device_data qca_soc_data_wcn3990 = {
>  	.soc_type = QCA_WCN3990,
>  	.vregs = (struct qca_vreg []) {
>  		{ "vddio", 15000  },
> @@ -1702,7 +1706,7 @@ static const struct qca_vreg_data qca_soc_data_wcn3990 = {
>  	.num_vregs = 4,
>  };
>  
> -static const struct qca_vreg_data qca_soc_data_wcn3991 = {
> +static const struct qca_device_data qca_soc_data_wcn3991 = {
>  	.soc_type = QCA_WCN3991,
>  	.vregs = (struct qca_vreg []) {
>  		{ "vddio", 15000  },
> @@ -1711,9 +1715,10 @@ static const struct qca_vreg_data qca_soc_data_wcn3991 = {
>  		{ "vddch0", 450000 },
>  	},
>  	.num_vregs = 4,
> +	.capabilities = QCA_CAP_WIDEBAND_SPEECH_SUPPORTED,
>  };
>  
> -static const struct qca_vreg_data qca_soc_data_wcn3998 = {
> +static const struct qca_device_data qca_soc_data_wcn3998 = {
>  	.soc_type = QCA_WCN3998,
>  	.vregs = (struct qca_vreg []) {
>  		{ "vddio", 10000  },
> @@ -1724,7 +1729,7 @@ static const struct qca_vreg_data qca_soc_data_wcn3998 = {
>  	.num_vregs = 4,
>  };
>  
> -static const struct qca_vreg_data qca_soc_data_qca6390 = {
> +static const struct qca_device_data qca_soc_data_qca6390 = {
>  	.soc_type = QCA_QCA6390,
>  	.num_vregs = 0,
>  };
> @@ -1860,7 +1865,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>  {
>  	struct qca_serdev *qcadev;
>  	struct hci_dev *hdev;
> -	const struct qca_vreg_data *data;
> +	const struct qca_device_data *data;
>  	int err;
>  	bool power_ctrl_enabled = true;
>  
> @@ -1948,6 +1953,12 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>  		hdev->shutdown = qca_power_off;
>  	}
>  
> +	/* Wideband speech support must be set per driver since it can't be
> +	 * queried via hci.
> +	 */
> +	if (data && (data->capabilities & QCA_CAP_WIDEBAND_SPEECH_SUPPORTED))
> +		set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
> +
>  	return 0;
>  }

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>

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

* Re: [PATCH v2] Bluetooth: hci_qca: Enable WBS support for wcn3991
  2020-05-14 20:14 [PATCH v2] Bluetooth: hci_qca: Enable WBS support for wcn3991 Abhishek Pandit-Subedi
  2020-05-14 21:07 ` Matthias Kaehlcke
@ 2020-05-18  8:03 ` Marcel Holtmann
  2020-05-18 18:12   ` Abhishek Pandit-Subedi
  1 sibling, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2020-05-18  8:03 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: BlueZ, bgodavar, alainm, mka, chromeos-bluetooth-upstreaming,
	Johan Hedberg, linux-kernel

Hi Abhishek,

> WCN3991 supports transparent WBS (host encoded mSBC). Add a flag to the
> device match data to show WBS is supported.
> 
> This requires the matching firmware for WCN3991 in linux-firmware:
>        1a8b0dc00f77 (qca: Enable transparent WBS for WCN3991)
> 
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> 
> Changes in v2:
> - Rename struct to qca_capabilities and fix enum naming
> 
> drivers/bluetooth/hci_qca.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH v2] Bluetooth: hci_qca: Enable WBS support for wcn3991
  2020-05-18  8:03 ` Marcel Holtmann
@ 2020-05-18 18:12   ` Abhishek Pandit-Subedi
  0 siblings, 0 replies; 4+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-05-18 18:12 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: BlueZ, bgodavar, Alain Michaud, Matthias Kaehlcke,
	ChromeOS Bluetooth Upstreaming, Johan Hedberg, LKML

Thanks Marcel.

On Mon, May 18, 2020 at 1:03 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Abhishek,
>
> > WCN3991 supports transparent WBS (host encoded mSBC). Add a flag to the
> > device match data to show WBS is supported.
> >
> > This requires the matching firmware for WCN3991 in linux-firmware:
> >        1a8b0dc00f77 (qca: Enable transparent WBS for WCN3991)
> >
> > Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> > ---
> >
> > Changes in v2:
> > - Rename struct to qca_capabilities and fix enum naming
> >
> > drivers/bluetooth/hci_qca.c | 23 +++++++++++++++++------
> > 1 file changed, 17 insertions(+), 6 deletions(-)
>
> patch has been applied to bluetooth-next tree.
>
> Regards
>
> Marcel
>

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

end of thread, other threads:[~2020-05-18 18:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 20:14 [PATCH v2] Bluetooth: hci_qca: Enable WBS support for wcn3991 Abhishek Pandit-Subedi
2020-05-14 21:07 ` Matthias Kaehlcke
2020-05-18  8:03 ` Marcel Holtmann
2020-05-18 18:12   ` Abhishek Pandit-Subedi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).