All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] bluecard_cs: Always enable LEDs (fix for Anycom CF-300)
@ 2017-08-05 19:34 Ondrej Zary
  2017-08-05 19:34 ` [PATCH 2/2] bluecard_cs: fix LED behavior Ondrej Zary
  2017-08-07  6:37 ` [PATCH 1/2] bluecard_cs: Always enable LEDs (fix for Anycom CF-300) Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Ondrej Zary @ 2017-08-05 19:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Marcel Holtmann

Anycom CF-300 (HP C8249A) has both power and activity LEDs.
However the id read in bluecard_open() is 0x73 so the driver does not
enable the LEDs.
Remove the CARD_HAS_PCCARD_ID check to enable LEDs.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
 drivers/bluetooth/bluecard_cs.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index d4b0b655dde6..5cd1e164fde0 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -160,9 +160,6 @@ static void bluecard_activity_led_timeout(u_long arg)
 	struct bluecard_info *info = (struct bluecard_info *)arg;
 	unsigned int iobase = info->p_dev->resource[0]->start;
 
-	if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
-		return;
-
 	if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) {
 		/* Disable activity LED */
 		outb(0x08 | 0x20, iobase + 0x30);
@@ -177,9 +174,6 @@ static void bluecard_enable_activity_led(struct bluecard_info *info)
 {
 	unsigned int iobase = info->p_dev->resource[0]->start;
 
-	if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
-		return;
-
 	if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) {
 		/* Enable activity LED */
 		outb(0x10 | 0x40, iobase + 0x30);
@@ -625,16 +619,13 @@ static int bluecard_hci_flush(struct hci_dev *hdev)
 static int bluecard_hci_open(struct hci_dev *hdev)
 {
 	struct bluecard_info *info = hci_get_drvdata(hdev);
+	unsigned int iobase = info->p_dev->resource[0]->start;
 
 	if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
 		bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
 
-	if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
-		unsigned int iobase = info->p_dev->resource[0]->start;
-
-		/* Enable LED */
-		outb(0x08 | 0x20, iobase + 0x30);
-	}
+	/* Enable LED */
+	outb(0x08 | 0x20, iobase + 0x30);
 
 	return 0;
 }
@@ -643,15 +634,12 @@ static int bluecard_hci_open(struct hci_dev *hdev)
 static int bluecard_hci_close(struct hci_dev *hdev)
 {
 	struct bluecard_info *info = hci_get_drvdata(hdev);
+	unsigned int iobase = info->p_dev->resource[0]->start;
 
 	bluecard_hci_flush(hdev);
 
-	if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
-		unsigned int iobase = info->p_dev->resource[0]->start;
-
-		/* Disable LED */
-		outb(0x00, iobase + 0x30);
-	}
+	/* Disable LED */
+	outb(0x00, iobase + 0x30);
 
 	return 0;
 }
-- 
Ondrej Zary

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

* [PATCH 2/2] bluecard_cs: fix LED behavior
  2017-08-05 19:34 [PATCH 1/2] bluecard_cs: Always enable LEDs (fix for Anycom CF-300) Ondrej Zary
@ 2017-08-05 19:34 ` Ondrej Zary
  2017-08-07  6:37   ` Marcel Holtmann
  2017-08-07  6:37 ` [PATCH 1/2] bluecard_cs: Always enable LEDs (fix for Anycom CF-300) Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: Ondrej Zary @ 2017-08-05 19:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Marcel Holtmann

Keep power LED on during activity.

LED timer races with power LED disabling in hci_close(), resulting in
power LED left on after closing.
Stop LED timer before disabling power LED.

BTW. On cards without an activity LED, the behavior is a bit weird:
The LED is on after hci_open() but only until the first data transfer.
Then it's off in idle and on during activity.
It could be improved by keeping the LED on in idle and flashing during
activity.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
 drivers/bluetooth/bluecard_cs.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 5cd1e164fde0..61ac48e1aa55 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -161,7 +161,7 @@ static void bluecard_activity_led_timeout(u_long arg)
 	unsigned int iobase = info->p_dev->resource[0]->start;
 
 	if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) {
-		/* Disable activity LED */
+		/* Disable activity LED, keep power LED enabled */
 		outb(0x08 | 0x20, iobase + 0x30);
 	} else {
 		/* Disable power LED */
@@ -175,8 +175,8 @@ static void bluecard_enable_activity_led(struct bluecard_info *info)
 	unsigned int iobase = info->p_dev->resource[0]->start;
 
 	if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) {
-		/* Enable activity LED */
-		outb(0x10 | 0x40, iobase + 0x30);
+		/* Enable activity LED, keep power LED enabled */
+		outb(0x18 | 0x60, iobase + 0x30);
 
 		/* Stop the LED after HZ/4 */
 		mod_timer(&(info->timer), jiffies + HZ / 4);
@@ -624,7 +624,7 @@ static int bluecard_hci_open(struct hci_dev *hdev)
 	if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
 		bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);
 
-	/* Enable LED */
+	/* Enable power LED */
 	outb(0x08 | 0x20, iobase + 0x30);
 
 	return 0;
@@ -638,7 +638,10 @@ static int bluecard_hci_close(struct hci_dev *hdev)
 
 	bluecard_hci_flush(hdev);
 
-	/* Disable LED */
+	/* Stop LED timer */
+	del_timer_sync(&(info->timer));
+
+	/* Disable power LED */
 	outb(0x00, iobase + 0x30);
 
 	return 0;
-- 
Ondrej Zary

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

* Re: [PATCH 2/2] bluecard_cs: fix LED behavior
  2017-08-05 19:34 ` [PATCH 2/2] bluecard_cs: fix LED behavior Ondrej Zary
@ 2017-08-07  6:37   ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2017-08-07  6:37 UTC (permalink / raw)
  To: Ondrej Zary; +Cc: linux-bluetooth

Hi Ondrej,

> Keep power LED on during activity.
> 
> LED timer races with power LED disabling in hci_close(), resulting in
> power LED left on after closing.
> Stop LED timer before disabling power LED.
> 
> BTW. On cards without an activity LED, the behavior is a bit weird:
> The LED is on after hci_open() but only until the first data transfer.
> Then it's off in idle and on during activity.
> It could be improved by keeping the LED on in idle and flashing during
> activity.
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> ---
> drivers/bluetooth/bluecard_cs.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH 1/2] bluecard_cs: Always enable LEDs (fix for Anycom CF-300)
  2017-08-05 19:34 [PATCH 1/2] bluecard_cs: Always enable LEDs (fix for Anycom CF-300) Ondrej Zary
  2017-08-05 19:34 ` [PATCH 2/2] bluecard_cs: fix LED behavior Ondrej Zary
@ 2017-08-07  6:37 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2017-08-07  6:37 UTC (permalink / raw)
  To: Ondrej Zary; +Cc: linux-bluetooth

Hi Ondrej,

> Anycom CF-300 (HP C8249A) has both power and activity LEDs.
> However the id read in bluecard_open() is 0x73 so the driver does not
> enable the LEDs.
> Remove the CARD_HAS_PCCARD_ID check to enable LEDs.
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> ---
> drivers/bluetooth/bluecard_cs.c | 24 ++++++------------------
> 1 file changed, 6 insertions(+), 18 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2017-08-07  6:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-05 19:34 [PATCH 1/2] bluecard_cs: Always enable LEDs (fix for Anycom CF-300) Ondrej Zary
2017-08-05 19:34 ` [PATCH 2/2] bluecard_cs: fix LED behavior Ondrej Zary
2017-08-07  6:37   ` Marcel Holtmann
2017-08-07  6:37 ` [PATCH 1/2] bluecard_cs: Always enable LEDs (fix for Anycom CF-300) Marcel Holtmann

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.