All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhangfei gao <zhangfei.gao@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Subject: How to close bluetooth? Using rfkill?
Date: Fri, 21 Jan 2011 00:51:34 -0500	[thread overview]
Message-ID: <AANLkTi=z1DPguiO7B39CRoj-wqi5r3nXLixCe3Yo34aV@mail.gmail.com> (raw)

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.

             reply	other threads:[~2011-01-21  5:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21  5:51 zhangfei gao [this message]
2011-01-21 14:38 ` How to close bluetooth? Using rfkill? zhangfei gao

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='AANLkTi=z1DPguiO7B39CRoj-wqi5r3nXLixCe3Yo34aV@mail.gmail.com' \
    --to=zhangfei.gao@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.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 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.