All of lore.kernel.org
 help / color / mirror / Atom feed
* How to close bluetooth? Using rfkill?
@ 2011-01-21  5:51 zhangfei gao
  2011-01-21 14:38 ` zhangfei gao
  0 siblings, 1 reply; 2+ messages in thread
From: zhangfei gao @ 2011-01-21  5:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Johan Hedberg

Hi Johan,

Is there any general method to open/close bluetooth, using rfkill or
pm_runtime_get/put_* API.

Currently we use rfkill to close bluetooth, however we met dead lock
issue, for mutex_lock(&rfkill_global_mutex).
So we use workaround to rmmod bt.ko first, or revert the rfkill patch
in hci_core.c.

BT/WIFI device have chip select pin, we register one rfkill with
sd8x_set_block, and control chip select pin to open/close bt/wifi/fm.
for example:
rfkill unblock bluetooth to open bt
rfkill block bluetooth to close bt

When "rfkill block bluetooth",
rfkill_fop_write->mutex_lock(&rfkill_global_mutex)->rfkill_set_block->sd8x_set_block->waiting
for card is freed.
BT driver will call
hci_unregister_dev->rfkill_unregister->mutex_lock(&rfkill_global_mutex);
So mutex_lock(&rfkill_global_mutex) will be dead locked.

If so, do we have to use other method to control chip select pin to
control bt power, such as pm_runtime_get/put_* API.

Thanks in advance.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to close bluetooth? Using rfkill?
  2011-01-21  5:51 How to close bluetooth? Using rfkill? zhangfei gao
@ 2011-01-21 14:38 ` zhangfei gao
  0 siblings, 0 replies; 2+ messages in thread
From: zhangfei gao @ 2011-01-21 14:38 UTC (permalink / raw)
  To: linux-bluetooth, Marcel Holtmann; +Cc: Johan Hedberg

On Fri, Jan 21, 2011 at 12:51 AM, zhangfei gao <zhangfei.gao@gmail.com> wrote:
> Hi Johan,
>
> Is there any general method to open/close bluetooth, using rfkill or
> pm_runtime_get/put_* API.
>
> Currently we use rfkill to close bluetooth, however we met dead lock
> issue, for mutex_lock(&rfkill_global_mutex).
> So we use workaround to rmmod bt.ko first, or revert the rfkill patch
> in hci_core.c.
>
> BT/WIFI device have chip select pin, we register one rfkill with
> sd8x_set_block, and control chip select pin to open/close bt/wifi/fm.
> for example:
> rfkill unblock bluetooth to open bt
> rfkill block bluetooth to close bt
>
> When "rfkill block bluetooth",
> rfkill_fop_write->mutex_lock(&rfkill_global_mutex)->rfkill_set_block->sd8x_set_block->waiting
> for card is freed.
> BT driver will call
> hci_unregister_dev->rfkill_unregister->mutex_lock(&rfkill_global_mutex);
> So mutex_lock(&rfkill_global_mutex) will be dead locked.
>
> If so, do we have to use other method to control chip select pin to
> control bt power, such as pm_runtime_get/put_* API.
>
> Thanks in advance.
>

Hi, Marcel

Do you have some suggestion?
When we use "rfkill block bluetooth" to disable bt, bt driver call
hci_unregister_dev to free driver.
The dead lock happens for acquiring mutex_lock(&rfkill_global_mutex).
One in rfkill_unregister from hci_unregister_dev, the other in
rfkill_fop_write from "rfkill block bluetooth" .
Is this the correct method to open/close bluetooth.

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-21 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-21  5:51 How to close bluetooth? Using rfkill? zhangfei gao
2011-01-21 14:38 ` zhangfei gao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.