Skip to contentSkip to conversation

add support of interrupt for host wakeup from devicetree in BCM HCI driver

PATCH In review Guillaume La Roque 3 participants 5 messages Jan 15, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v7 cover 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(-)
Signature · 1 line
2.17.1
#1 lore raw

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.

---
 .../devicetree/bindings/net/broadcom-bluetooth.txt         | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +5 -2
index c44a30dbe43d..dd258674633c 100644
@@ -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:
 
Signature · 1 line
2.17.1
maintainer Reviewed-by on v7 1/2
#2 lore raw

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

Quoted 9 lines · Guillaume La Roque

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

---
 .../devicetree/bindings/net/broadcom-bluetooth.txt         | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
#3 lore raw

PATCH v7 2/2 bluetooth: hci_bcm: enable IRQ capability from devicetree

In reply to Guillaume La Roque

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().

---
 drivers/bluetooth/hci_bcm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/bluetooth/hci_bcm.c +3 -0
index 769bb4404bd1..b236cb11c0dc 100644
@@ -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;
 }
 
Signature · 1 line
2.17.1
maintainer
#4 lore raw
In reply to Guillaume La Roque

Hi Guillaume,

Quoted 28 lines

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]/

Quoted 7 lines

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