Thread (12 messages) flat view 12 messages, 3 authors, 2017-06-30

Re: BCM43430 BT driver almost working...

From: Loic Poulain <hidden>
Date: 2017-06-30 17:59:45
Subsystem: bluetooth drivers, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

Hi Ian,

On 30/06/2017 18:35, Ian Molton wrote:
quoted
bcm_setup_sleep enable low power mode, so I think problem is
that the wakeup gpio is not correctly drove.
-> Are you sure that you don't toggle the power gpio instead of the
wakeup one.
Possibly not - AFAIK, I only have one GPIO on this board, so I *assume*
its the power one. I'll see if I can find out if wakeup/irq are connected.

*HOWEVER* the code checks for success of bcm_request_irq() when deciding
to execute bcm_setup_sleep(). This makes sense to me, as I'd expect the
hardware to want to interrupt the host when it wakes up.
Yes, but there is no IRQ assigned to your bcm_device.
Actually seems you find an other "issue", the bcm_request_irq() returns
an error only on request_irq failure. However in your case, you never
assigned the bcm->irq, so bcm_request_irq does not even try to request
the irq and returns success.

You should try the following:
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index be53238..586f3d0 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -185,22 +185,24 @@ static int bcm_request_irq(struct bcm_data *bcm)
  		goto unlock;
  	}

-	if (bdev->irq > 0) {
-		err = devm_request_irq(&bdev->pdev->dev, bdev->irq,
-				       bcm_host_wake, IRQF_TRIGGER_RISING,
-				       "host_wake", bdev);
-		if (err)
-			goto unlock;
-
-		device_init_wakeup(&bdev->pdev->dev, true);
-
-		pm_runtime_set_autosuspend_delay(&bdev->pdev->dev,
-						 BCM_AUTOSUSPEND_DELAY);
-		pm_runtime_use_autosuspend(&bdev->pdev->dev);
-		pm_runtime_set_active(&bdev->pdev->dev);
-		pm_runtime_enable(&bdev->pdev->dev);
+	if (bdev->irq <= 0) {
+		err = -EOPNOTSUPP;
+		goto unlock;
  	}

+	err = devm_request_irq(&bdev->pdev->dev, bdev->irq, bcm_host_wake,
+			       IRQF_TRIGGER_RISING, "host_wake", bdev);
+	if (err)
+		goto unlock;
+
+	device_init_wakeup(&bdev->pdev->dev, true);
+
+	pm_runtime_set_autosuspend_delay(&bdev->pdev->dev,
+					 BCM_AUTOSUSPEND_DELAY);
+	pm_runtime_use_autosuspend(&bdev->pdev->dev);
+	pm_runtime_set_active(&bdev->pdev->dev);
+	pm_runtime_enable(&bdev->pdev->dev);
+
  unlock:
  	mutex_unlock(&bcm_device_lock);

Regards,
Loic
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help