diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2017-08-07 13:35:49 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2017-08-07 13:42:07 -0400 |
commit | c7ab7330f040a6f792e384c381629072ceb82766 (patch) | |
tree | ada89db7b2bb5507dba04bbbdc6dec13d2fb812f | |
parent | 859d2351172482c5bf5b727b1fe10d98ba334fd6 (diff) |
Bluetooth: bluecard: blink LED during continuous activity
Currently the activity LED is solid on during continuous activity.
Blink the LED during continuous activity to match Windows driver
behavior.
Cards with activity LED:
power LED = solid on when up, off when down
activity LED = blinking during activity, off when idle
Cards without activity LED:
power LED = solid on when up, off when down, blinking during activity
(don't have such a card so I don't know if Windows driver does the same
thing)
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 61ac48e1aa55..b07ca9565291 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -93,6 +93,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev); | |||
93 | 93 | ||
94 | /* Hardware states */ | 94 | /* Hardware states */ |
95 | #define CARD_READY 1 | 95 | #define CARD_READY 1 |
96 | #define CARD_ACTIVITY 2 | ||
96 | #define CARD_HAS_PCCARD_ID 4 | 97 | #define CARD_HAS_PCCARD_ID 4 |
97 | #define CARD_HAS_POWER_LED 5 | 98 | #define CARD_HAS_POWER_LED 5 |
98 | #define CARD_HAS_ACTIVITY_LED 6 | 99 | #define CARD_HAS_ACTIVITY_LED 6 |
@@ -160,13 +161,14 @@ static void bluecard_activity_led_timeout(u_long arg) | |||
160 | struct bluecard_info *info = (struct bluecard_info *)arg; | 161 | struct bluecard_info *info = (struct bluecard_info *)arg; |
161 | unsigned int iobase = info->p_dev->resource[0]->start; | 162 | unsigned int iobase = info->p_dev->resource[0]->start; |
162 | 163 | ||
163 | if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) { | 164 | if (test_bit(CARD_ACTIVITY, &(info->hw_state))) { |
164 | /* Disable activity LED, keep power LED enabled */ | 165 | /* leave LED in inactive state for HZ/10 for blink effect */ |
165 | outb(0x08 | 0x20, iobase + 0x30); | 166 | clear_bit(CARD_ACTIVITY, &(info->hw_state)); |
166 | } else { | 167 | mod_timer(&(info->timer), jiffies + HZ / 10); |
167 | /* Disable power LED */ | ||
168 | outb(0x00, iobase + 0x30); | ||
169 | } | 168 | } |
169 | |||
170 | /* Disable activity LED, enable power LED */ | ||
171 | outb(0x08 | 0x20, iobase + 0x30); | ||
170 | } | 172 | } |
171 | 173 | ||
172 | 174 | ||
@@ -174,19 +176,22 @@ static void bluecard_enable_activity_led(struct bluecard_info *info) | |||
174 | { | 176 | { |
175 | unsigned int iobase = info->p_dev->resource[0]->start; | 177 | unsigned int iobase = info->p_dev->resource[0]->start; |
176 | 178 | ||
179 | /* don't disturb running blink timer */ | ||
180 | if (timer_pending(&(info->timer))) | ||
181 | return; | ||
182 | |||
183 | set_bit(CARD_ACTIVITY, &(info->hw_state)); | ||
184 | |||
177 | if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) { | 185 | if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) { |
178 | /* Enable activity LED, keep power LED enabled */ | 186 | /* Enable activity LED, keep power LED enabled */ |
179 | outb(0x18 | 0x60, iobase + 0x30); | 187 | outb(0x18 | 0x60, iobase + 0x30); |
180 | |||
181 | /* Stop the LED after HZ/4 */ | ||
182 | mod_timer(&(info->timer), jiffies + HZ / 4); | ||
183 | } else { | 188 | } else { |
184 | /* Enable power LED */ | 189 | /* Disable power LED */ |
185 | outb(0x08 | 0x20, iobase + 0x30); | 190 | outb(0x00, iobase + 0x30); |
186 | |||
187 | /* Stop the LED after HZ/2 */ | ||
188 | mod_timer(&(info->timer), jiffies + HZ / 2); | ||
189 | } | 191 | } |
192 | |||
193 | /* Stop the LED after HZ/10 */ | ||
194 | mod_timer(&(info->timer), jiffies + HZ / 10); | ||
190 | } | 195 | } |
191 | 196 | ||
192 | 197 | ||