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 17:41:45 +0200	[thread overview]
Message-ID: <d65a5225-84f5-11ae-d9ab-2175480552d8@intel.com> (raw)
In-Reply-To: <c4cf0689-d28e-492d-399e-968a70488e22@mnementh.co.uk>


Hi Ian,

On 29/06/2017 20:06, Ian Molton wrote:


> I've created a dt entry that looks like:
>
> bt_brcm {
>                 compatible = "brcm,b43430a1";
>                 wakeup-gpios = <&gpio5 4 GPIO_ACTIVE_HIGH>;
>                 ttydev = <&uart2>;
>                 status = "ok";
>         };
> };
>
> This allows me to get the code to correlate the UART and the GPIOs,
> thus: (forgive the very messy patch - this is my WIP, for illustration
> only...)
>
> The code below *works* - toggles the power GPIO, loads firmware, and
> attaches fine.

Be careful here, you add only one gpio in our DT entry, the wakeup one.

Typically (bcm43xx) you need 2 gpios + 1 irq:
power (gpio): toggle the chip off/on
wakeup (gpio): wakeup the chip, allowing send/recv data over UART
host-wakeup (gpio): Request attention, data to send


In suspended mode, if you have wakeup gpio but no host-wakeup,
the controller will be unable to inform the host about data readiness,
So the host will not allow the controller to send its data (via wakeup).

The only 3 working conditions are:
1 - you don't have any resource, chip is powered on by default (hw
pull-up or firmware config), the driver operate without power mgmt.
2 - you have the power gpio, controller is power on/off on
attach/detach. No low-power mode except if condition 3.
3- you have the wakeup and host-wakeup resources, so the host is
able to manage the low-power mode (suspend/resume)


>
> However, if I uncomment the line containing:
>
>     err = bcm_setup_sleep(hu);
>
> The driver dies, with timeouts, thus:
>
> Bluetooth: hci0: BCM: chip id 94
> Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000
> Bluetooth: hci0: BCM: failed to write clock (-56)
> Bluetooth: hci0: BCM (001.002.009) build 0182
> Bluetooth: hci0 command 0x0c56 tx timeout
> Bluetooth: hci0 command 0x0c7a tx timeout
> Bluetooth: hci0 command 0x0c6d tx timeout
> Bluetooth: hci0 command 0x2008 tx timeout
> Bluetooth: hci0 command 0x2009 tx timeout

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.
-> Without host-wakeup gpio, you are not able to get controller events.

>  static struct platform_driver bcm_driver = {
>         .probe = bcm_probe,
>         .remove = bcm_remove,
>         .driver = {
>                 .name = "hci_bcm",
>                 .acpi_match_table = ACPI_PTR(bcm_acpi_match),
> +               .of_match_table = bcm_of_match,
>                 .pm = &bcm_pm_ops,
>         },
>  };
>                                                               13
>

I think you should look at the serial device driver solution
(e.g nokia.c), This is the preferable way now.

Regards,
Loic

  reply	other threads:[~2017-06-30 15:41 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 [this message]
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
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=d65a5225-84f5-11ae-d9ab-2175480552d8@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