Linux bluetooth development
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@intel.com>
To: Ian Molton <ian@mnementh.co.uk>
Cc: linux-bluetooth@vger.kernel.org, marcel@holtmann.org
Subject: Re: BCM43430 BT driver almost working...
Date: Fri, 30 Jun 2017 19:59:45 +0200	[thread overview]
Message-ID: <5ab11044-dd06-9aef-b355-86e5b58a7a6e@intel.com> (raw)
In-Reply-To: <d0c4a580-82ac-d710-8678-f147ce81a9ce@mnementh.co.uk>

Hi Ian,

On 30/06/2017 18:35, Ian Molton wrote:

>> 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

  parent reply	other threads:[~2017-06-30 17:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 18:06 BCM43430 BT driver almost working Ian Molton
2017-06-30 15:41 ` Loic Poulain
2017-06-30 16:35   ` Ian Molton
2017-06-30 17:02     ` Marcel Holtmann
2017-06-30 17:14       ` Ian Molton
2017-06-30 20:53         ` Ian Molton
2017-06-30 21:17           ` Ian Molton
2017-06-30 21:27           ` Marcel Holtmann
2017-06-30 21:37             ` Ian Molton
2017-06-30 21:46             ` Ian Molton
2017-06-30 17:59     ` Loic Poulain [this message]
2017-06-30 21:13       ` Ian Molton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ab11044-dd06-9aef-b355-86e5b58a7a6e@intel.com \
    --to=loic.poulain@intel.com \
    --cc=ian@mnementh.co.uk \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox