Skip to contentSkip to conversation

bluetooth: hci_bcm: enable IRQ capability from node

PATCH In review Guillaume La Roque 3 participants 8 messages Dec 13, 2019 – Jan 8, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 bluetooth: hci_bcm: enable IRQ capability from node

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 field in node and support it in driver.

---
 drivers/bluetooth/hci_bcm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/bluetooth/hci_bcm.c +2 -0
index f8f5c593a05c..aa194f8d703e 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>
@@ -1421,6 +1422,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	bcmdev->irq = of_irq_get(bcmdev->dev->of_node, 0);
 
 	/* Initialize routing field to an unused value */
 	bcmdev->pcm_int_params[0] = 0xff;
Signature · 1 line
2.17.1
#1 lore raw
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 field in node and support it in driver.

"node" is a bit vague, please refer to devicetree here and in the patch summary.

Quoted 18 lines
---
 drivers/bluetooth/hci_bcm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/bluetooth/hci_bcm.c +1 -0
index f8f5c593a05c..aa194f8d703e 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>

drivers/bluetooth/hci_bcm.c static int bcm_serdev_probe(struct serdev_device *serdev) · line 1425

Quoted 4 lines
drivers/bluetooth/hci_bcm.c +1 -0
@@ -1421,6 +1422,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	bcmdev->irq = of_irq_get(bcmdev->dev->of_node, 0);

And this clearly makes no sense for acpi, so you'd need to add it to bcm_of_probe().

Shouldn't you be used using of_irq_get_byname()?

And since you're extending the binding, I think you need a preparatory patch documenting this in:

Documentation/devicetree/bindings/net/broadcom-bluetooth.txt

drivers/bluetooth/hci_bcm.c static int bcm_serdev_probe(struct serdev_device *serdev) · line 1428

Quoted 2 lines
drivers/bluetooth/hci_bcm.c +0 -0
 	/* Initialize routing field to an unused value */
 	bcmdev->pcm_int_params[0] = 0xff;

Johan

#2 lore raw

Hi Johan,

Quoted 8 lines · Johan Hovold
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 field in node and support it in driver.

"node" is a bit vague, please refer to devicetree here and in the patch summary.

 i will

Quoted 25 lines
Quoted 18 lines
---
 drivers/bluetooth/hci_bcm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/bluetooth/hci_bcm.c +1 -0
index f8f5c593a05c..aa194f8d703e 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>

drivers/bluetooth/hci_bcm.c static int bcm_serdev_probe(struct serdev_device *serdev) · line 1425

Quoted 4 lines
drivers/bluetooth/hci_bcm.c +1 -0
@@ -1421,6 +1422,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	bcmdev->irq = of_irq_get(bcmdev->dev->of_node, 0);

And this clearly makes no sense for acpi, so you'd need to add it to bcm_of_probe().

Quoted 1 line

Shouldn't you be used using of_irq_get_byname()?

i can use it if you prefer but no other interrupt need to be defined

Quoted 5 lines

And since you're extending the binding, I think you need a preparatory patch documenting this in:

Documentation/devicetree/bindings/net/broadcom-bluetooth.txt

sorry i forgot this, i will do

Quoted 3 lines

drivers/bluetooth/hci_bcm.c static int bcm_serdev_probe(struct serdev_device *serdev) · line 1428

Quoted 2 lines
drivers/bluetooth/hci_bcm.c +0 -0
 	/* Initialize routing field to an unused value */
 	bcmdev->pcm_int_params[0] = 0xff;

Johan

thanks

Guillaume

#3 lore raw
Quoted 13 lines · guillaume La Roque

Hi Johan,

Quoted 9 lines · Johan Hovold

drivers/bluetooth/hci_bcm.c static int bcm_serdev_probe(struct serdev_device *serdev) · line 1425

Quoted 5 lines · Guillaume La Roque
drivers/bluetooth/hci_bcm.c +1 -0
@@ -1421,6 +1422,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	bcmdev->irq = of_irq_get(bcmdev->dev->of_node, 0);

Shouldn't you be used using of_irq_get_byname()?

Quoted 1 line

i can use it if you prefer but no other interrupt need to be defined

Maybe not needed then. Was just thinking it may make it more clear that you now have two ways to specify the "host-wakeup" interrupt (and in your proposed implementation the interrupts-property happens to take priority). Perhaps that can be sorted out when you submit the binding update for review.

Johan

#4 lore raw
Quoted 11 lines · Johan Hovold
Quoted 10 lines · guillaume La Roque

Hi Johan,

Quoted 7 lines · Johan Hovold

drivers/bluetooth/hci_bcm.c static int bcm_serdev_probe(struct serdev_device *serdev) · line 1425

Quoted 5 lines · Guillaume La Roque
drivers/bluetooth/hci_bcm.c +1 -0
@@ -1421,6 +1422,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	bcmdev->irq = of_irq_get(bcmdev->dev->of_node, 0);

Shouldn't you be used using of_irq_get_byname()?

Quoted 6 lines
Quoted 1 line

i can use it if you prefer but no other interrupt need to be defined

Maybe not needed then. Was just thinking it may make it more clear that you now have two ways to specify the "host-wakeup" interrupt (and in your proposed implementation the interrupts-property happens to take priority). Perhaps that can be sorted out when you submit the binding update for review.

no problem i add a "host-wakeup" interrupt-name.
you are right it will be more clear with name and we know why this interrupt is needed.

Quoted 1 line

Johan

thanks

Guillaume

maintainer
#5 lore raw

Hi Guillaume,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

drivers/bluetooth/hci_bcm.c static int bcm_serdev_probe(struct serdev_device *serdev) · line 1425

Quoted 5 lines
drivers/bluetooth/hci_bcm.c +1 -0
@@ -1421,6 +1422,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	bcmdev->irq = of_irq_get(bcmdev->dev->of_node, 0);

Shouldn't you be used using of_irq_get_byname()?

i can use it if you prefer but no other interrupt need to be defined

Quoted 8 lines
Quoted 5 lines

Maybe not needed then. Was just thinking it may make it more clear that you now have two ways to specify the "host-wakeup" interrupt (and in your proposed implementation the interrupts-property happens to take priority). Perhaps that can be sorted out when you submit the binding update for review.

no problem i add a "host-wakeup" interrupt-name.
you are right it will be more clear with name and we know why this interrupt is needed.

have I missed the v5 or are still sending it?

Regards

Marcel

#6 lore raw

Hi Marcel,

Quoted 9 lines · Marcel Holtmann

Hi Guillaume,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

drivers/bluetooth/hci_bcm.c static int bcm_serdev_probe(struct serdev_device *serdev) · line 1425

Quoted 5 lines
drivers/bluetooth/hci_bcm.c +1 -0
@@ -1421,6 +1422,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	bcmdev->irq = of_irq_get(bcmdev->dev->of_node, 0);

Shouldn't you be used using of_irq_get_byname()?

i can use it if you prefer but no other interrupt need to be defined

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Maybe not needed then. Was just thinking it may make it more clear that you now have two ways to specify the "host-wakeup" interrupt (and in your proposed implementation the interrupts-property happens to take priority). Perhaps that can be sorted out when you submit the binding update for review.

no problem i add a "host-wakeup" interrupt-name.
you are right it will be more clear with name and we know why this interrupt is needed.

have I missed the v5 or are still sending it?

sorry i was in chrismas holidays .

v5 was sent before holiday and you comment it [1] ;) , on v5 you ask me to send v6 with tag.

Regards

Guillaume

Quoted 5 lines

Regards

Marcel

[1] : https://www.spinics.net/lists/linux-bluetooth/msg82424.html

maintainer
#7 lore raw

Hi Guillaume,

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 7 lines
Quoted 6 lines

Review static int bcm_serdev_probe(struct serdev_device *serdev) · line 1425

Quoted 5 lines
(quoted diff) +1 -0
@@ -1421,6 +1422,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 #endif
 	bcmdev->serdev_hu.serdev = serdev;
 	serdev_device_set_drvdata(serdev, bcmdev);
+	bcmdev->irq = of_irq_get(bcmdev->dev->of_node, 0);

Shouldn't you be used using of_irq_get_byname()?

i can use it if you prefer but no other interrupt need to be defined

Maybe not needed then. Was just thinking it may make it more clear that you now have two ways to specify the "host-wakeup" interrupt (and in your proposed implementation the interrupts-property happens to take priority). Perhaps that can be sorted out when you submit the binding update for review.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

no problem i add a "host-wakeup" interrupt-name.
you are right it will be more clear with name and we know why this interrupt is needed.

have I missed the v5 or are still sending it?

sorry i was in chrismas holidays .

v5 was sent before holiday and you comment it [1] ;) , on v5 you ask me to send v6 with tag.

ok, then I am waiting for v6.

Regards

Marcel