Re: [PATCH 3/3] Bluetooth: hci_qca: Add serdev support
From: Loic Poulain
Date: Tue Mar 13 2018 - 14:19:45 EST
On 13 March 2018 at 17:03, Thierry Escande <thierry.escande@xxxxxxxxxx> wrote:
> From: Thierry Escande <thierry.escande@xxxxxxxxxxxxx>
>
> Add support for Qualcomm serial slave devices. Probe the serial device,
> retrieve its maximum speed and register a new hci uart device.
>
> Signed-off-by: Thierry Escande <thierry.escande@xxxxxxxxxx>
> ---
> drivers/bluetooth/Kconfig | 2 +-
> drivers/bluetooth/hci_qca.c | 102 +++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 101 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index 07e55cd8f8c8..c2a6a7ebd14b 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -195,7 +195,7 @@ config BT_HCIUART_BCM
>
> config BT_HCIUART_QCA
> bool "Qualcomm Atheros protocol support"
> - depends on BT_HCIUART
> + depends on BT_HCIUART_SERDEV
Driver depends on both BT_HCIUART and BT_HCIUART_SERDEV.
> @@ -386,6 +399,7 @@ static void hci_ibs_wake_retrans_timeout(struct timer_list *t)
> /* Initialize protocol */
> static int qca_open(struct hci_uart *hu)
> {
> + struct qca_serdev *qcadev;
> struct qca_data *qca;
>
> BT_DBG("hu %p qca_open", hu);
> @@ -444,6 +458,13 @@ static int qca_open(struct hci_uart *hu)
> timer_setup(&qca->tx_idle_timer, hci_ibs_tx_idle_timeout, 0);
> qca->tx_idle_delay = IBS_TX_IDLE_TIMEOUT_MS;
>
> + if (hu->serdev) {
> + serdev_device_open(hu->serdev);
> +
> + qcadev = serdev_device_get_drvdata(hu->serdev);
> + gpiod_set_value(qcadev->bt_en, 1);
I suggest to replace gpiod_set_value calls with the _cansleep version.
You always set gpio value from sleepable context and this should avoid
any further issue with different gpio controller.
Regards,
Loic