All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: sean.wang@mediatek.com
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	devicetree <devicetree@vger.kernel.org>,
	BlueZ development <linux-bluetooth@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/7] Bluetooth: Add new quirk for non-persistent setup settings
Date: Tue, 22 May 2018 09:21:23 +0200	[thread overview]
Message-ID: <920B3BE9-3FE8-4AC6-8C5F-63B0E00182AC@holtmann.org> (raw)
In-Reply-To: <1d6097f538b3182b2876ad48225ecd6e2d1b128c.1526374087.git.sean.wang@mediatek.com>

Hi Sean,

> Add a new quirk HCI_QUIRK_NON_PERSISTENT_SETUP allowing that a quirk that
> runs setup() after every open() and not just after the first open().
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> include/net/bluetooth/hci.h | 9 +++++++++
> net/bluetooth/hci_core.c    | 3 ++-
> 2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 1668211..b37d973 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -183,6 +183,15 @@ enum {
> 	 * during the hdev->setup vendor callback.
> 	 */
> 	HCI_QUIRK_NON_PERSISTENT_DIAG,
> +
> +	/* When this quirk is set, setup() would be run after every
> +	 * open() and not just after the first open().
> +	 *
> +	 * This quirk can be set before hci_register_dev is called or
> +	 * during the hdev->setup vendor callback.
> +	 *
> +	 */
> +	HCI_QUIRK_NON_PERSISTENT_SETUP,
> };
> 
> /* HCI device flags */
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 40d260f..7de712e2 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1377,7 +1377,8 @@ static int hci_dev_do_open(struct hci_dev *hdev)
> 	atomic_set(&hdev->cmd_cnt, 1);
> 	set_bit(HCI_INIT, &hdev->flags);
> 
> -	if (hci_dev_test_flag(hdev, HCI_SETUP)) {
> +	if (hci_dev_test_flag(hdev, HCI_SETUP) ||
> +	    test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) {
> 		hci_sock_dev_event(hdev, HCI_DEV_SETUP);

I am not 100% sure that we want to send the HCI_DEV_SETUP event also multiple times. That is a userspace change that I would need to think about. We need to check create_monitor_event() and see what the btmon trace for this looks like. Can you send me a btmon -w trace.log when this change is active.

Regards

Marcel

WARNING: multiple messages have this Message-ID (diff)
From: marcel@holtmann.org (Marcel Holtmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/7] Bluetooth: Add new quirk for non-persistent setup settings
Date: Tue, 22 May 2018 09:21:23 +0200	[thread overview]
Message-ID: <920B3BE9-3FE8-4AC6-8C5F-63B0E00182AC@holtmann.org> (raw)
In-Reply-To: <1d6097f538b3182b2876ad48225ecd6e2d1b128c.1526374087.git.sean.wang@mediatek.com>

Hi Sean,

> Add a new quirk HCI_QUIRK_NON_PERSISTENT_SETUP allowing that a quirk that
> runs setup() after every open() and not just after the first open().
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> include/net/bluetooth/hci.h | 9 +++++++++
> net/bluetooth/hci_core.c    | 3 ++-
> 2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 1668211..b37d973 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -183,6 +183,15 @@ enum {
> 	 * during the hdev->setup vendor callback.
> 	 */
> 	HCI_QUIRK_NON_PERSISTENT_DIAG,
> +
> +	/* When this quirk is set, setup() would be run after every
> +	 * open() and not just after the first open().
> +	 *
> +	 * This quirk can be set before hci_register_dev is called or
> +	 * during the hdev->setup vendor callback.
> +	 *
> +	 */
> +	HCI_QUIRK_NON_PERSISTENT_SETUP,
> };
> 
> /* HCI device flags */
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 40d260f..7de712e2 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1377,7 +1377,8 @@ static int hci_dev_do_open(struct hci_dev *hdev)
> 	atomic_set(&hdev->cmd_cnt, 1);
> 	set_bit(HCI_INIT, &hdev->flags);
> 
> -	if (hci_dev_test_flag(hdev, HCI_SETUP)) {
> +	if (hci_dev_test_flag(hdev, HCI_SETUP) ||
> +	    test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) {
> 		hci_sock_dev_event(hdev, HCI_DEV_SETUP);

I am not 100% sure that we want to send the HCI_DEV_SETUP event also multiple times. That is a userspace change that I would need to think about. We need to check create_monitor_event() and see what the btmon trace for this looks like. Can you send me a btmon -w trace.log when this change is active.

Regards

Marcel

  reply	other threads:[~2018-05-22  7:21 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15  8:52 [PATCH v2 0/7] add support for Bluetooth on MT7622 SoC sean.wang
2018-05-15  8:52 ` sean.wang at mediatek.com
2018-05-15  8:52 ` sean.wang
2018-05-15  8:52 ` [PATCH v2 1/7] dt-bindings: net: bluetooth: Add mediatek-bluetooth sean.wang
2018-05-15  8:52   ` sean.wang at mediatek.com
2018-05-15  8:52   ` sean.wang-NuS5LvNUpcJWk0Htik3J/w
2018-05-15  8:52 ` [PATCH v2 2/7] serdev: add dev_pm_domain_attach|detach() sean.wang
2018-05-15  8:52   ` sean.wang at mediatek.com
2018-05-15  8:52   ` sean.wang
2018-05-15  8:52 ` [PATCH v2 3/7] Bluetooth: Add new serdev based driver for UART attached controllers sean.wang
2018-05-15  8:52   ` sean.wang at mediatek.com
2018-05-15  8:52   ` sean.wang
2018-05-15  8:52 ` [PATCH v2 4/7] Bluetooth: Add new quirk for non-persistent setup settings sean.wang
2018-05-15  8:52   ` sean.wang at mediatek.com
2018-05-15  8:52   ` sean.wang
2018-05-22  7:21   ` Marcel Holtmann [this message]
2018-05-22  7:21     ` Marcel Holtmann
2018-05-22  8:05     ` Sean Wang
2018-05-22  8:05       ` Sean Wang
2018-05-22  8:05       ` Sean Wang
2018-05-23  6:37       ` [SPAM]Re: " Sean Wang
2018-05-23  6:37         ` Sean Wang
2018-05-23  6:37         ` Sean Wang
2018-05-23 12:31         ` Marcel Holtmann
2018-05-23 12:31           ` Marcel Holtmann
2018-05-23 14:09           ` Sean Wang
2018-05-23 14:09             ` Sean Wang
2018-05-23 14:09             ` Sean Wang
2018-05-24  7:47             ` Marcel Holtmann
2018-05-24  7:47               ` Marcel Holtmann
2018-05-24 15:30               ` Sean Wang
2018-05-24 15:30                 ` Sean Wang
2018-05-24 15:30                 ` Sean Wang
2018-05-30  6:26                 ` Marcel Holtmann
2018-05-30  6:26                   ` Marcel Holtmann
2018-06-12  9:58                   ` Sean Wang
2018-06-12  9:58                     ` Sean Wang
2018-06-12  9:58                     ` Sean Wang
2018-06-14  3:10                     ` Sean Wang
2018-06-14  3:10                       ` Sean Wang
2018-05-15  8:52 ` [PATCH v2 5/7] Bluetooth: Extend btuart driver for join more vendor devices sean.wang
2018-05-15  8:52   ` sean.wang at mediatek.com
2018-05-15  8:52   ` sean.wang
2018-05-15  8:52 ` [PATCH v2 6/7] Bluetooth: mediatek: Add protocol support for MediaTek serial devices sean.wang
2018-05-15  8:52   ` sean.wang at mediatek.com
2018-05-15  8:52   ` sean.wang
2018-05-15  8:52 ` [PATCH v2 7/7] MAINTAINERS: add an entry for MediaTek Bluetooth driver sean.wang
2018-05-15  8:52   ` sean.wang at mediatek.com
2018-05-15  8:52   ` sean.wang

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=920B3BE9-3FE8-4AC6-8C5F-63B0E00182AC@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=devicetree@vger.kernel.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sean.wang@mediatek.com \
    /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 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.