add support of interrupt for host wakeup from devicetree in BCM HCI driver
Subsystems (4)
v5 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 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
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt | 4 +++- drivers/bluetooth/hci_bcm.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
PATCH v5 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.
--- Documentation/devicetree/bindings/net/broadcom-bluetooth.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +3 -1
@@ -36,7 +36,9 @@ 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 if + gpiod_to_irq function not supported + - interrupt-names: must be "host-wakeup" Example:
Signature · 1 line
2.17.1
Re: [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties
Quoted 14 lines · Guillaume La Roque
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]>--- Documentation/devicetree/bindings/net/broadcom-bluetooth.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +0
-0
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt Optional properties: · line 40
Quoted 6 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +2
-1@@ -36,7 +36,9 @@ 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 if + gpiod_to_irq function not supported
This is a Linux implementation detail which therefore doesn't belong in the binding.
I think the general rule is to prefer interrupts over gpios where we have a choice, but here the current binding already has a host-wakeup-gpios.
Not sure how best to handle that, maybe Rob knows.
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt Optional properties: · line 43
Quoted 3 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +1
-0+ - interrupt-names: must be "host-wakeup" Example:
Oh, and please keep people commenting on your patches on CC when you submit new versions.
Johan
Rob Herring
maintainerRe: [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties
Quoted 25 lines · Johan Hovold
Quoted 14 lines · Guillaume La Roque
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]>--- Documentation/devicetree/bindings/net/broadcom-bluetooth.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +0
-0Documentation/devicetree/bindings/net/broadcom-bluetooth.txt Optional properties: · line 40
Quoted 6 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +2
-1@@ -36,7 +36,9 @@ 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 if + gpiod_to_irq function not supportedThis is a Linux implementation detail which therefore doesn't belong in the binding.
Quoted 5 lines
I think the general rule is to prefer interrupts over gpios where we have a choice, but here the current binding already has a host-wakeup-gpios.
Not sure how best to handle that, maybe Rob knows.
Use gpiod_to_irqd().
You can also deprecate the gpio prop, but you have to keep driver support for it. And updating dts files would break old kernels with new dtbs.
Rob
PATCH v5 2/2 bluetooth: hci_bcm: enable IRQ capability from devicetree
In reply to Guillaume La RoqueActually IRQ can be found from GPIO but all platforms don't support gpiod_to_irq, it's the case on amlogic chip.
so to have possibility to use interrupt mode we need to add interrupts property in devicetree and support it in driver.
--- drivers/bluetooth/hci_bcm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/hci_bcm.c +3 -0
@@ -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>
@@ -1144,6 +1145,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
Re: [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree
Quoted 4 lines · Guillaume La Roque
Actually IRQ can be found from GPIO but all platforms don't support
gpiod_to_irq, it's the case on amlogic chip.
so to have possibility to use interrupt mode we need to add interrupts property in devicetree and support it in driver.
I would reword this slightly (leaving out the amlogic specifics):
"""
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(). """
Other than that, this looks good to me and now it's clear that it only affects the DT path.
Kevin
Marcel Holtmann
maintainerRe: [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree
Hi Guillaume,
Quoted 13 lines
Quoted 4 lines
Actually IRQ can be found from GPIO but all platforms don't support
gpiod_to_irq, it's the case on amlogic chip.
so to have possibility to use interrupt mode we need to add interrupts property in devicetree and support it in driver.I would reword this slightly (leaving out the amlogic specifics):
"""
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 supportgpiod_to_irq(). """
Quoted 4 lines
Other than that, this looks good to me and now it's clear that it only affects the DT path.
Reviewed-by Kevin Hilman <[email protected]>
I reverted the broken patch and now I am waiting for v6 with proper reviewed-by or acked-by tags.
Regards
Marcel