linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/2] add support of interrupt for host wakeup from devicetree in BCM HCI driver
@ 2019-12-13 15:06 Guillaume La Roque
  2019-12-13 15:06 ` [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties Guillaume La Roque
  2019-12-13 15:06 ` [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree Guillaume La Roque
  0 siblings, 2 replies; 7+ messages in thread
From: Guillaume La Roque @ 2019-12-13 15:06 UTC (permalink / raw)
  To: marcel, johan.hedberg, linux-bluetooth, devicetree
  Cc: netdev, nsaenzjulienne, linux-kernel, khilman

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/20191213105521.4290-1-glaroque@baylibre.com/

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties
  2019-12-13 15:06 [PATCH v5 0/2] add support of interrupt for host wakeup from devicetree in BCM HCI driver Guillaume La Roque
@ 2019-12-13 15:06 ` Guillaume La Roque
  2019-12-13 16:19   ` Johan Hovold
  2019-12-13 15:06 ` [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree Guillaume La Roque
  1 sibling, 1 reply; 7+ messages in thread
From: Guillaume La Roque @ 2019-12-13 15:06 UTC (permalink / raw)
  To: marcel, johan.hedberg, linux-bluetooth, devicetree
  Cc: netdev, nsaenzjulienne, linux-kernel, khilman

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 <glaroque@baylibre.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree
  2019-12-13 15:06 [PATCH v5 0/2] add support of interrupt for host wakeup from devicetree in BCM HCI driver Guillaume La Roque
  2019-12-13 15:06 ` [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties Guillaume La Roque
@ 2019-12-13 15:06 ` Guillaume La Roque
  2019-12-13 17:14   ` Kevin Hilman
  1 sibling, 1 reply; 7+ messages in thread
From: Guillaume La Roque @ 2019-12-13 15:06 UTC (permalink / raw)
  To: marcel, johan.hedberg, linux-bluetooth, devicetree
  Cc: netdev, nsaenzjulienne, linux-kernel, khilman

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 <glaroque@baylibre.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties
  2019-12-13 15:06 ` [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties Guillaume La Roque
@ 2019-12-13 16:19   ` Johan Hovold
  2019-12-18 20:38     ` Rob Herring
  0 siblings, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2019-12-13 16:19 UTC (permalink / raw)
  To: Guillaume La Roque
  Cc: marcel, johan.hedberg, linux-bluetooth, devicetree, netdev,
	nsaenzjulienne, linux-kernel, khilman, Rob Herring

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 <glaroque@baylibre.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree
  2019-12-13 15:06 ` [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree Guillaume La Roque
@ 2019-12-13 17:14   ` Kevin Hilman
  2019-12-17  7:43     ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Hilman @ 2019-12-13 17:14 UTC (permalink / raw)
  To: Guillaume La Roque, marcel, johan.hedberg, linux-bluetooth, devicetree
  Cc: netdev, nsaenzjulienne, linux-kernel

Guillaume La Roque <glaroque@baylibre.com> 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 <khilman@baylibre.com>

Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree
  2019-12-13 17:14   ` Kevin Hilman
@ 2019-12-17  7:43     ` Marcel Holtmann
  0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2019-12-17  7:43 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Guillaume La Roque, Johan Hedberg, linux-bluetooth, devicetree,
	netdev, nsaenzjulienne, linux-kernel

Hi Guillaume,

>> 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 <khilman@baylibre.com>

I reverted the broken patch and now I am waiting for v6 with proper reviewed-by or acked-by tags.

Regards

Marcel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties
  2019-12-13 16:19   ` Johan Hovold
@ 2019-12-18 20:38     ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2019-12-18 20:38 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Guillaume La Roque, marcel, johan.hedberg, linux-bluetooth,
	devicetree, netdev, nsaenzjulienne, linux-kernel, khilman

On Fri, Dec 13, 2019 at 05:19:01PM +0100, Johan Hovold wrote:
> 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 <glaroque@baylibre.com>
> > ---
> >  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.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-18 20:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13 15:06 [PATCH v5 0/2] add support of interrupt for host wakeup from devicetree in BCM HCI driver Guillaume La Roque
2019-12-13 15:06 ` [PATCH v5 1/2] dt-bindings: net: bluetooth: add interrupts properties Guillaume La Roque
2019-12-13 16:19   ` Johan Hovold
2019-12-18 20:38     ` Rob Herring
2019-12-13 15:06 ` [PATCH v5 2/2] bluetooth: hci_bcm: enable IRQ capability from devicetree Guillaume La Roque
2019-12-13 17:14   ` Kevin Hilman
2019-12-17  7:43     ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).