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(-)
--
2.17.1
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.
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 f8f5c593a05c..99dee878b092 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>
@@ -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;
}
--
2.17.1
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(-)
diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
index b5eadee4a9a7..95912d979239 100644
--- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
+++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
@@ -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:
--
2.17.1
On Fri, Dec 13, 2019 at 04:06:21PM +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]>
> ---
> Documentation/devicetree/bindings/net/broadcom-bluetooth.txt | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> index b5eadee4a9a7..95912d979239 100644
> --- a/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> +++ b/Documentation/devicetree/bindings/net/broadcom-bluetooth.txt
> @@ -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.
> + - interrupt-names: must be "host-wakeup"
>
> Example:
Oh, and please keep people commenting on your patches on CC when you
submit new versions.
Johan
Guillaume La Roque <[email protected]> writes:
> 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.
Reviewed-by: Kevin Hilman <[email protected]>
Kevin