mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-bluetooth@vger.kernel.org,
	Douglas Anderson <dianders@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 3/4] Bluetooth: hci_bcm: Support pcm params in dts
Date: Thu, 14 Nov 2019 07:09:49 +0100	[thread overview]
Message-ID: <C6EE827D-4CE7-4A5F-B9FC-C10647B0B8C4@holtmann.org> (raw)
In-Reply-To: <CANFp7mUxBLGfDd+mR7R1RTK70PRhbHjV8whDJOucpap_qmgN3A@mail.gmail.com>

Hi Abhishek,

>>>>> BCM chips may require configuration of PCM to operate correctly and
>>>>> there is a vendor specific HCI command to do this. Add support in the
>>>>> hci_bcm driver to parse this from devicetree and configure the chip.
>>>>> 
>>>>> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
>>>>> ---
>>>>> 
>>>>> Changes in v4: None
>>>>> Changes in v3: None
>>>>> Changes in v2: None
>>>>> 
>>>>> drivers/bluetooth/hci_bcm.c | 32 ++++++++++++++++++++++++++++++++
>>>>> 1 file changed, 32 insertions(+)
>>>>> 
>>>>> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
>>>>> index 6134bff58748..4ee0b45be7e2 100644
>>>>> --- a/drivers/bluetooth/hci_bcm.c
>>>>> +++ b/drivers/bluetooth/hci_bcm.c
>>>>> @@ -88,6 +88,8 @@ struct bcm_device_data {
>>>>> *    used to disable flow control during runtime suspend and system sleep
>>>>> * @is_suspended: whether flow control is currently disabled
>>>>> * @disallow_set_baudrate: don't allow set_baudrate
>>>>> + * @has_pcm_params: whether PCM parameters need to be configured
>>>>> + * @pcm_params: PCM and routing parameters
>>>>> */
>>>>> struct bcm_device {
>>>>>     /* Must be the first member, hci_serdev.c expects this. */
>>>>> @@ -122,6 +124,9 @@ struct bcm_device {
>>>>>     bool                    is_suspended;
>>>>> #endif
>>>>>     bool                    disallow_set_baudrate;
>>>>> +
>>>>> +     bool                            has_pcm_params;
>>>>> +     struct bcm_set_pcm_int_params   pcm_params;
>>>>> };
>>>>> 
>>>>> /* generic bcm uart resources */
>>>>> @@ -596,6 +601,16 @@ static int bcm_setup(struct hci_uart *hu)
>>>>>                     host_set_baudrate(hu, speed);
>>>>>     }
>>>>> 
>>>>> +     /* PCM parameters if any*/
>>>>> +     if (bcm->dev && bcm->dev->has_pcm_params) {
>>>>> +             err = btbcm_set_pcm_int_params(hu->hdev, &bcm->dev->pcm_params);
>>>>> +
>>>>> +             if (err) {
>>>>> +                     bt_dev_info(hu->hdev, "BCM: Set pcm params failed (%d)",
>>>>> +                                 err);
>>>>> +             }
>>>>> +     }
>>>>> +
>>>>> finalize:
>>>>>     release_firmware(fw);
>>>>> 
>>>>> @@ -1132,7 +1147,24 @@ static int bcm_acpi_probe(struct bcm_device *dev)
>>>>> 
>>>>> static int bcm_of_probe(struct bcm_device *bdev)
>>>>> {
>>>>> +     int err;
>>>>> +
>>>>>     device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed);
>>>>> +
>>>>> +     err = device_property_read_u8(bdev->dev, "brcm,bt-sco-routing",
>>>>> +                                   &bdev->pcm_params.routing);
>>>>> +     if (!err)
>>>>> +             bdev->has_pcm_params = true;
>>>> 
>>>> I think in case of HCI as routing path, these should be using the default or zero values as defined by Broadcom.
>>> 
>>> I'm not sure what these default values should be. Wouldn't it be
>>> reasonable to expect the user/developer to set the various brcm
>>> parameters in device tree?
>>> If unset, it's just 0.
>> 
>> if that works with the hardware I am fine with that. The other option is to actually first read the current values. And then only change the ones that are supplied by the DT.
> 
> I don't know of a read pcm params command (this would be nice to have).
> 
> I think it might be prudent to default the frame_mode and clock_mode
> to master (0x1). I'll test how the hardware responds to 0x0 and update
> the default to 0x1 if things fail badly.

it is either one opcode down or one opcode up. Look at monitor/broadcom.c since we do actually decode some of these.

Regards

Marcel


  reply	other threads:[~2019-11-14  6:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 23:09 [PATCH v4 0/4] Bluetooth: hci_bcm: Additional changes for BCM4354 support Abhishek Pandit-Subedi
2019-11-12 23:09 ` [PATCH v4 1/4] Bluetooth: hci_bcm: Disallow set_baudrate for BCM4354 Abhishek Pandit-Subedi
2019-11-13  0:15   ` Marcel Holtmann
2019-11-12 23:09 ` [PATCH v4 2/4] Bluetooth: btbcm: Support pcm configuration Abhishek Pandit-Subedi
2019-11-12 23:09 ` [PATCH v4 3/4] Bluetooth: hci_bcm: Support pcm params in dts Abhishek Pandit-Subedi
2019-11-13  0:18   ` Marcel Holtmann
2019-11-13 21:22     ` Abhishek Pandit-Subedi
2019-11-14  5:29       ` Marcel Holtmann
2019-11-14  6:03         ` Abhishek Pandit-Subedi
2019-11-14  6:09           ` Marcel Holtmann [this message]
2019-11-12 23:09 ` [PATCH v4 4/4] dt-bindings: net: broadcom-bluetooth: Add pcm config Abhishek Pandit-Subedi
2019-11-13  0:21   ` Marcel Holtmann
2019-11-14 17:58     ` Matthias Kaehlcke
2019-11-14 19:21       ` Abhishek Pandit-Subedi
2019-11-14 17:29   ` Doug Anderson
2019-11-14 19:20     ` Abhishek Pandit-Subedi
2019-11-14 19:29       ` Doug Anderson

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=C6EE827D-4CE7-4A5F-B9FC-C10647B0B8C4@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=abhishekpandit@chromium.org \
    --cc=dianders@chromium.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.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

all inboxes | Powered by JetHome®