From: Marcel Holtmann <marcel@holtmann.org>
To: "Hegde, Raghuram" <raghuram.hegde@intel.com>
Cc: "linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>,
"Tumkur Narayan, Chethan" <chethan.tumkur.narayan@intel.com>,
"Ghorai, Sukumar" <sukumar.ghorai@intel.com>,
"Bag, Amit K" <amit.k.bag@intel.com>,
chethan tn <chethantn@gmail.com>
Subject: Re: [PATCH 1/2] Bluetooth: btintel: Add platform device for rfkill signal
Date: Thu, 27 Sep 2018 12:44:27 +0200 [thread overview]
Message-ID: <426A4301-8777-4781-9AEE-32A800BD9C33@holtmann.org> (raw)
In-Reply-To: <E5FA71999F8E8845A748D0B68F0A4BDF966495@BGSMSX103.gar.corp.intel.com>
Hi Raghuram,
>>>>>> Driver to add INTL6205 platform ACPI device to enable out of band
>>>>>> GPIO signalling to handle rfkill and reset the bluetooth
>>>>> controller. Expose an interface in kernel to assert GPIO signal.
>>>>>>
>>>>>> Signed-off-by: Chethan T N <chethan.tumkur.narayan@intel.com>
>>>>>> Signed-off-by: Sukumar Ghorai <sukumar.ghorai@intel.com>
>>>>>> Signed-off-by: Raghuram Hegde <raghuram.hegde@intel.com>
>>>>>> ---
>>>>>> drivers/bluetooth/btintel.c | 68
>>>>>> +++++++++++++++++++++++++++++++++++++++++++++
>>>>>> drivers/bluetooth/btintel.h | 6 ++++
>>>>>> 2 files changed, 74 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/bluetooth/btintel.c
>>>>>> b/drivers/bluetooth/btintel.c index 5270d5513201..538cd6b6c524
>>>>>> 100644
>>>>>> --- a/drivers/bluetooth/btintel.c
>>>>>> +++ b/drivers/bluetooth/btintel.c
>>>>>> @@ -24,6 +24,9 @@
>>>>>> #include <linux/module.h>
>>>>>> #include <linux/firmware.h>
>>>>>> #include <linux/regmap.h>
>>>>>> +#include <linux/acpi.h>
>>>>>> +#include <linux/platform_device.h> #include
>>>>>> +<linux/gpio/consumer.h>
>>>>>> #include <asm/unaligned.h>
>>>>>>
>>>>>> #include <net/bluetooth/bluetooth.h> @@ -375,6 +378,71 @@ int
>>>>>> btintel_read_version(struct hci_dev *hdev, struct intel_version
>>>>>> *ver) } EXPORT_SYMBOL_GPL(btintel_read_version);
>>>>>>
>>>>>> +static struct gpio_desc *reset_gpio_handler;
>>>>>
>>>>> this thing is so inherent broken. Please never ever do that. If there are two reset handlers or two Intel USB devices connected things will go horrible wrong.
>>>> Is it fine to keep list of the descriptors handlers for all the
>>>> Intel devices connected?
>>>>>
>>>>>> +void btintel_reset_bt(struct hci_dev *hdev, unsigned char code) {
>>>>>> + if (!reset_gpio_handler)
>>>>>> + return;
>>>>>> +
>>>>>> + gpiod_set_value(reset_gpio_handler, 0);
>>>>>> + mdelay(100);
>>>>>> + gpiod_set_value(reset_gpio_handler, 1); }
>>>>>> +EXPORT_SYMBOL_GPL(btintel_reset_bt);
>>>>>
>>>>> What happens here when you do this? Does the Bluetooth USB device disconnect from the USB bus and gets re-enumerated and the btusb_probe() routine gets called again?
>>>> Yes, USB re-enumeration will be done and btusb_proble() function will be called.
>>>
>>> As I said, in that case it is fine to implement this an RFKILL switch. It is platform RFKILL switch. The USB device actually gets virtually disconnected.
>>>
>>>>>
>>>>> If this is the case, then I have no idea how many times I have to explain. It is a platfrom reset switch and using RFKILL for this is acceptable.
>>>> Thought of make this platform independent by exposing ACPI object
>>>> "INTL6205", by doing so in case different platforms if the ACPI
>>>> object is exposed by the platform then this driver would be loaded.
>>>> Kindly please do suggest.
>>>
>>> See above. I really don't know what else to say. You can not handle this inside hci_dev since the hci_dev will be actually destroyed if you pull the GPIO.
>> Please note that the implementation is similar to the RF kill switch, just that its implemented in btintel.c. Our understanding is hci_dev does exist when GPIO toggle has to be done, only after that will be destroyed.
>> Later again hci_dev would be created and the hdev->hw_reset shall be re-assigned.
>> As you suggest if its not to be included in hci_dev, could you please let us know how to invoke the GPIO toggle without registering the callback(hdev->hw_reset).
>>
> We have explored registering the 'INTL6205' ACPI object through Rfkill driver and implementing GPIO toggle in the '.set_block' function of Rfkill. But, we are stuck in how to invoke the '.set_block' function from hci_core,
> whenever there is a HCI command timeout. Could you please provide some pointers on how to implement this.
As I said multiple times before, this needs to be a separate driver since it is really an RFKILL driver. It is a RFKILL platform driver like with the old Lenovo/IBM laptops that take the Bluetooth device off the USB bus.
If you additionally want to go the hammer approach and causes the RFKILL to be trigger from hdev->bt_error, then that is another story, but first get an RFKILL driver written and send here for review. Or as proposed, fix the firmware to not crash in the first place ;)
Regards
Marcel
next prev parent reply other threads:[~2018-09-27 10:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-21 9:34 [PATCH 1/2] Bluetooth: btintel: Add platform device for rfkill signal Raghuram Hegde
2018-08-21 9:34 ` [PATCH 2/2] Bluletooth: Add hardware reset callback to reset intel bluetooth chip Raghuram Hegde
2018-08-21 14:14 ` Marcel Holtmann
2018-08-21 14:42 ` chethan tn
2018-08-21 14:13 ` [PATCH 1/2] Bluetooth: btintel: Add platform device for rfkill signal Marcel Holtmann
2018-08-21 14:58 ` chethan tn
2018-08-21 15:09 ` Marcel Holtmann
2018-09-11 4:45 ` chethan tn
2018-09-11 5:13 ` Hegde, Raghuram
2018-09-27 10:44 ` Marcel Holtmann [this message]
2018-08-21 14:54 ` kbuild test robot
2018-08-21 16:55 ` kbuild test robot
2018-08-21 16:55 ` [PATCH] Bluetooth: btintel: fix ptr_ret.cocci warnings kbuild test robot
2018-08-21 20:20 ` Marcel Holtmann
2018-08-22 1:52 ` [kbuild-all] " Li, Philip
2018-08-22 2:00 ` Fengguang Wu
2018-08-22 1:59 ` Fengguang Wu
2018-08-22 6:08 ` Marcel Holtmann
2018-08-22 6:35 ` Fengguang Wu
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=426A4301-8777-4781-9AEE-32A800BD9C33@holtmann.org \
--to=marcel@holtmann.org \
--cc=amit.k.bag@intel.com \
--cc=chethan.tumkur.narayan@intel.com \
--cc=chethantn@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=raghuram.hegde@intel.com \
--cc=sukumar.ghorai@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).