public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeffy Chen <jeffy.chen@rock-chips.com>
To: Amitkumar Karwar <akarwar@marvell.com>, linux-bluetooth@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ganapathi Bhat <gbhat@marvell.com>
Subject: Re: [v11, 1/3] Bluetooth: hci_uart: add prepare callbacks to hci_uart_proto structure.
Date: Fri, 24 Jun 2016 14:01:40 +0800	[thread overview]
Message-ID: <576CCCC4.9050509@rock-chips.com> (raw)
In-Reply-To: <1462548714-7971-1-git-send-email-akarwar@marvell.com>

On 2016-5-6 23:31, Amitkumar Karwar wrote:
> From: Ganapathi Bhat <gbhat@marvell.com>
>
> The new callback is used to prepare the device before HCI becomes
> ready. One can use this to download firmware if the download process
> doesn't use HCI commands. Also recv_for_prepare callback is
> introduced for receiving data from devices during prepare phase.
>
> Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
> ---
>   drivers/bluetooth/hci_ldisc.c | 11 ++++++++++-
>   drivers/bluetooth/hci_uart.h  |  3 +++
>   2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
> index 49b3e1e..b4ee682 100644
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -551,8 +551,11 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
>   	if (!hu || tty != hu->tty)
>   		return;
>   
> -	if (!test_bit(HCI_UART_PROTO_READY, &hu->flags))
> +	if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) {
> +		if (hu->proto->recv_for_prepare)
> +			hu->proto->recv_for_prepare(hu, data, count);
>   		return;
> +	}
>   
>   	/* It does not need a lock here as it is already protected by a mutex in
>   	 * tty caller
> @@ -639,6 +642,12 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id)
>   		return err;
>   
>   	hu->proto = p;
> +	if (p->prepare) {
> +		err = p->prepare(hu);
> +		if (err)
> +			return err;
> +	}
> +
>   	set_bit(HCI_UART_PROTO_READY, &hu->flags);
>   
>   	err = hci_uart_register_dev(hu);
> diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
> index 839bad1..17ba3b4 100644
> --- a/drivers/bluetooth/hci_uart.h
> +++ b/drivers/bluetooth/hci_uart.h
> @@ -67,8 +67,11 @@ struct hci_uart_proto {
>   	int (*close)(struct hci_uart *hu);
>   	int (*flush)(struct hci_uart *hu);
>   	int (*setup)(struct hci_uart *hu);
> +	int (*prepare)(struct hci_uart *hu);
>   	int (*set_baudrate)(struct hci_uart *hu, unsigned int speed);
>   	int (*recv)(struct hci_uart *hu, const void *data, int len);
> +	int (*recv_for_prepare)(struct hci_uart *hu, const void *data,
> +				int len);
>   	int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
>   	struct sk_buff *(*dequeue)(struct hci_uart *hu);
>   };
>
>
This serial of patches work well on my device...

Tested-by: Jeffy Chen <jeffy.chen@rock-chips.com>

      parent reply	other threads:[~2016-06-24  6:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 15:31 [PATCH v11 1/3] Bluetooth: hci_uart: add prepare callbacks to hci_uart_proto structure Amitkumar Karwar
2016-05-06 15:31 ` [PATCH v11 2/3] Bluetooth: hci_uart: check if hdev is present before using it Amitkumar Karwar
2016-06-24  6:01   ` [v11, " Jeffy Chen
2016-05-06 15:31 ` [PATCH v11 3/3] Bluetooth: hci_uart: Support firmware download for Marvell Amitkumar Karwar
2016-05-10 13:59   ` Amitkumar Karwar
2016-05-23  6:06   ` Amitkumar Karwar
2016-06-14  6:35   ` Amitkumar Karwar
2016-06-21  3:47   ` [v11,3/3] " Caesar Wang
2016-06-24  6:02   ` Jeffy Chen
2016-06-27  6:28     ` Amitkumar Karwar
2016-06-30 10:54       ` Loic Poulain
2016-08-09 16:18         ` Amitkumar Karwar
2016-06-24  6:01 ` Jeffy Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576CCCC4.9050509@rock-chips.com \
    --to=jeffy.chen@rock-chips.com \
    --cc=akarwar@marvell.com \
    --cc=gbhat@marvell.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox