diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2016-01-08 13:28:58 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2016-02-23 14:29:35 -0500 |
commit | 6d5d2ee63cee7025badda3b74ae2ef7ab097acfa (patch) | |
tree | 84d89e34753cdd8e2a00dabb73eb6c6e3d1896d6 /net/bluetooth/hci_core.c | |
parent | a30a9ea6e21b495372aff549f3dfd63198bd1f45 (diff) |
Bluetooth: add LED trigger for indicating HCI is powered up
Add support for LED triggers to the Bluetooth subsystem and add kernel
config symbol BT_LEDS for it.
For now one trigger for indicating "HCI is powered up" is supported.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r-- | net/bluetooth/hci_core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 883c821a9e78..88f1ef3589d8 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "hci_request.h" | 40 | #include "hci_request.h" |
41 | #include "hci_debugfs.h" | 41 | #include "hci_debugfs.h" |
42 | #include "smp.h" | 42 | #include "smp.h" |
43 | #include "leds.h" | ||
43 | 44 | ||
44 | static void hci_rx_work(struct work_struct *work); | 45 | static void hci_rx_work(struct work_struct *work); |
45 | static void hci_cmd_work(struct work_struct *work); | 46 | static void hci_cmd_work(struct work_struct *work); |
@@ -1395,6 +1396,7 @@ static int hci_dev_do_open(struct hci_dev *hdev) | |||
1395 | hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); | 1396 | hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); |
1396 | set_bit(HCI_UP, &hdev->flags); | 1397 | set_bit(HCI_UP, &hdev->flags); |
1397 | hci_sock_dev_event(hdev, HCI_DEV_UP); | 1398 | hci_sock_dev_event(hdev, HCI_DEV_UP); |
1399 | hci_leds_update_powered(hdev, true); | ||
1398 | if (!hci_dev_test_flag(hdev, HCI_SETUP) && | 1400 | if (!hci_dev_test_flag(hdev, HCI_SETUP) && |
1399 | !hci_dev_test_flag(hdev, HCI_CONFIG) && | 1401 | !hci_dev_test_flag(hdev, HCI_CONFIG) && |
1400 | !hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && | 1402 | !hci_dev_test_flag(hdev, HCI_UNCONFIGURED) && |
@@ -1532,6 +1534,8 @@ int hci_dev_do_close(struct hci_dev *hdev) | |||
1532 | return 0; | 1534 | return 0; |
1533 | } | 1535 | } |
1534 | 1536 | ||
1537 | hci_leds_update_powered(hdev, false); | ||
1538 | |||
1535 | /* Flush RX and TX works */ | 1539 | /* Flush RX and TX works */ |
1536 | flush_work(&hdev->tx_work); | 1540 | flush_work(&hdev->tx_work); |
1537 | flush_work(&hdev->rx_work); | 1541 | flush_work(&hdev->rx_work); |
@@ -3067,6 +3071,8 @@ int hci_register_dev(struct hci_dev *hdev) | |||
3067 | if (error < 0) | 3071 | if (error < 0) |
3068 | goto err_wqueue; | 3072 | goto err_wqueue; |
3069 | 3073 | ||
3074 | hci_leds_init(hdev); | ||
3075 | |||
3070 | hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev, | 3076 | hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev, |
3071 | RFKILL_TYPE_BLUETOOTH, &hci_rfkill_ops, | 3077 | RFKILL_TYPE_BLUETOOTH, &hci_rfkill_ops, |
3072 | hdev); | 3078 | hdev); |
@@ -3128,6 +3134,8 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
3128 | 3134 | ||
3129 | id = hdev->id; | 3135 | id = hdev->id; |
3130 | 3136 | ||
3137 | hci_leds_exit(hdev); | ||
3138 | |||
3131 | write_lock(&hci_dev_list_lock); | 3139 | write_lock(&hci_dev_list_lock); |
3132 | list_del(&hdev->list); | 3140 | list_del(&hdev->list); |
3133 | write_unlock(&hci_dev_list_lock); | 3141 | write_unlock(&hci_dev_list_lock); |