2020-01-15 10:13:21

by Guillaume LA ROQUE

[permalink] [raw]
Subject: [PATCH v7 0/2] add support of interrupt for host wakeup from devicetree in BCM HCI driver

add interrupts and interrupt-names properties to set host wakeup IRQ.
actually driver find this IRQ from host-wakeup-gpios propety
but some platforms are not supported gpiod_to_irq function.
so to have possibility to use interrupt mode we need to add interrupts
field in devicetree and support it in driver.

change sinve v6:
- depracate host-wakeup-gpios

change sinve v5:
- add tags

change sinve v4 [1]:
- add patch to update Documentation
- use of_irq_get_byname to be more clear and move call in bcm_of_probe
- update commit message

change since v3:
- move on of_irq instead of platform_get_irq

change since v2:
- fix commit message

change since v1:
- rebase patch

[1] https://lore.kernel.org/linux-bluetooth/[email protected]/

Guillaume La Roque (2):
dt-bindings: net: bluetooth: add interrupts properties
bluetooth: hci_bcm: enable IRQ capability from devicetree

.../devicetree/bindings/net/broadcom-bluetooth.txt | 7 +++++--
drivers/bluetooth/hci_bcm.c | 3 +++
2 files changed, 8 insertions(+), 2 deletions(-)

--
2.17.1


2020-01-15 10:13:33

by Guillaume LA ROQUE

[permalink] [raw]
Subject: [PATCH v7 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree

Add support for getting IRQ directly from DT instead of relying on
converting a GPIO to IRQ. This is needed for platforms with GPIO
controllers that that do not support gpiod_to_irq().

Reviewed-by: Kevin Hilman <[email protected]>
Signed-off-by: Guillaume La Roque <[email protected]>
---
drivers/bluetooth/hci_bcm.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index 769bb4404bd1..b236cb11c0dc 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/of.h>
+#include <linux/of_irq.h>
#include <linux/property.h>
#include <linux/platform_data/x86/apple.h>
#include <linux/platform_device.h>
@@ -1151,6 +1152,8 @@ static int bcm_of_probe(struct bcm_device *bdev)
device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed);
device_property_read_u8_array(bdev->dev, "brcm,bt-pcm-int-params",
bdev->pcm_int_params, 5);
+ bdev->irq = of_irq_get_byname(bdev->dev->of_node, "host-wakeup");
+
return 0;
}

--
2.17.1

2020-01-15 10:13:37

by Guillaume LA ROQUE

[permalink] [raw]
Subject: [PATCH v7 1/2] dt-bindings: net: bluetooth: add interrupts properties

add interrupts and interrupt-names as optional properties
to support host-wakeup by interrupt properties instead of
host-wakeup-gpios.

Signed-off-by: Guillaume La Roque <[email protected]>
---
.../devicetree/bindings/net/broadcom-bluetooth.txt | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
index c44a30dbe43d..dd258674633c 100644
--- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
@@ -23,7 +23,9 @@ Optional properties:
- max-speed: see Documentation/devicetree/bindings/serial/slave-device.txt
- shutdown-gpios: GPIO specifier, used to enable the BT module
- device-wakeup-gpios: GPIO specifier, used to wakeup the controller
- - host-wakeup-gpios: GPIO specifier, used to wakeup the host processor
+ - host-wakeup-gpios: GPIO specifier, used to wakeup the host processor.
+ deprecated, replaced by interrupts and
+ "host-wakeup" interrupt-names
- clocks: 1 or 2 clocks as defined in clock-names below, in that order
- clock-names: names for clock inputs, matching the clocks given
- "extclk": deprecated, replaced by "txco"
@@ -37,7 +39,8 @@ Optional properties:
- pcm-frame-type: short, long
- pcm-sync-mode: slave, master
- pcm-clock-mode: slave, master
-
+ - interrupts: must be one, used to wakeup the host processor
+ - interrupt-names: must be "host-wakeup"

Example:

--
2.17.1

2020-01-15 20:17:41

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v7 1/2] dt-bindings: net: bluetooth: add interrupts properties

On Wed, 15 Jan 2020 11:12:42 +0100, Guillaume La Roque wrote:
> add interrupts and interrupt-names as optional properties
> to support host-wakeup by interrupt properties instead of
> host-wakeup-gpios.
>
> Signed-off-by: Guillaume La Roque <[email protected]>
> ---
> .../devicetree/bindings/net/broadcom-bluetooth.txt | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>

Reviewed-by: Rob Herring <[email protected]>

2020-01-15 21:39:36

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH v7 0/2] add support of interrupt for host wakeup from devicetree in BCM HCI driver

Hi Guillaume,

> add interrupts and interrupt-names properties to set host wakeup IRQ.
> actually driver find this IRQ from host-wakeup-gpios propety
> but some platforms are not supported gpiod_to_irq function.
> so to have possibility to use interrupt mode we need to add interrupts
> field in devicetree and support it in driver.
>
> change sinve v6:
> - depracate host-wakeup-gpios
>
> change sinve v5:
> - add tags
>
> change sinve v4 [1]:
> - add patch to update Documentation
> - use of_irq_get_byname to be more clear and move call in bcm_of_probe
> - update commit message
>
> change since v3:
> - move on of_irq instead of platform_get_irq
>
> change since v2:
> - fix commit message
>
> change since v1:
> - rebase patch
>
> [1] https://lore.kernel.org/linux-bluetooth/[email protected]/
>
> Guillaume La Roque (2):
> dt-bindings: net: bluetooth: add interrupts properties
> bluetooth: hci_bcm: enable IRQ capability from devicetree
>
> .../devicetree/bindings/net/broadcom-bluetooth.txt | 7 +++++--
> drivers/bluetooth/hci_bcm.c | 3 +++
> 2 files changed, 8 insertions(+), 2 deletions(-)

both patches have been applied to bluetooth-next tree.

Regards

Marcel