All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karol Kozimor <sziwan@hell.org.pl>
To: "Brown, Len" <len.brown@intel.com>
Cc: linux-acpi@vger.kernel.org
Subject: [PATCH 6/9] handle internal Bluetooth / support W5A
Date: Wed, 18 Jan 2006 22:48:59 +0100	[thread overview]
Message-ID: <20060118214859.GG7199@hell.org.pl> (raw)
In-Reply-To: <20060118212110.GA7199@hell.org.pl>

This patch creates a new file named "bluetooth" under /proc/acpi/asus/.
This file controls both the internal Bluetooth adapter's presence on the
USB bus and the associated LED.

echo 1 > /proc/acpi/asus/bluetooth to enable, 0 to disable.

Additionally, the patch add support for Asus W5A, the first model that uses
this feature.

Patch originally by Fernando A. P. Gomes.

Signed-off-by: Karol Kozimor <sziwan@hell.org.pl>

--- a/drivers/acpi/asus_acpi.c	2006-01-18 17:44:03.000000000 +0100
+++ b/drivers/acpi/asus_acpi.c	2006-01-18 17:56:16.000000000 +0100
@@ -49,6 +49,7 @@
 #define PROC_MLED       "mled"
 #define PROC_WLED       "wled"
 #define PROC_TLED       "tled"
+#define PROC_BT         "bluetooth"
 #define PROC_LEDD       "ledd"
 #define PROC_INFO       "info"
 #define PROC_LCD        "lcd"
@@ -69,9 +70,10 @@
 /*
  * Flags for hotk status
  */
-#define MLED_ON     0x01	//is MLED ON ?
-#define WLED_ON     0x02
-#define TLED_ON     0x04
+#define MLED_ON     0x01	//mail LED
+#define WLED_ON     0x02	//wireless LED
+#define TLED_ON     0x04	//touchpad LED
+#define BT_ON       0x08	//internal Bluetooth
 
 MODULE_AUTHOR("Julien Lerouge, Karol Kozimor");
 MODULE_DESCRIPTION(ACPI_HOTK_NAME);
@@ -95,7 +97,9 @@ struct model_data {
 	char *mt_tled;		//method to handle tled_____________R
 	char *tled_status;	//node to handle tled reading_______A
 	char *mt_ledd;		//method to handle LED display______R
-	char *mt_lcd_switch;	//method to turn LCD ON/OFF_________A
+	char *mt_bt_switch;	//method to switch Bluetooth on/off_R
+	char *bt_status;	//no model currently supports this__?
+	char *mt_lcd_switch;	//method to turn LCD on/off_________A
 	char *lcd_status;	//node to read LCD panel state______A
 	char *brightness_up;	//method to set brightness up_______A
 	char *brightness_down;	//guess what ?______________________A
@@ -137,6 +141,7 @@ struct asus_hotk {
 		S1x,		//S1300A, but also L1400B and M2400A (L84F)
 		S2x,		//S200 (J1 reported), Victor MP-XP7210
 		W1N,		//W1000N
+		W5A,		//W5A
 		xxN,		//M2400N, M3700N, M5200N, M6800N, S1300N, S5200N
 		//(Centrino)
 		END_MODEL
@@ -373,6 +378,16 @@ static struct model_data model_conf[END_
 	 .display_get = "\\ADVG"},
 
 	{
+	 .name = "W5A",
+	 .mt_bt_switch = "BLED",
+	 .mt_wled = "WLED",
+	 .mt_lcd_switch = xxN_PREFIX "_Q10",
+	 .brightness_set = "SPLV",
+	 .brightness_get = "GPLV",
+	 .display_set = "SDSP",
+	 .display_get = "\\ADVG"},
+
+	{
 	 .name = "xxN",
 	 .mt_mled = "MLED",
 /* WLED present, but not controlled by ACPI */
@@ -639,6 +654,25 @@ proc_write_wled(struct file *file, const
 }
 
 /*
+ * Proc handlers for Bluetooth
+ */
+static int
+proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof,
+		    void *data)
+{
+	return sprintf(page, "%d\n", read_led(hotk->methods->bt_status, BT_ON));
+}
+
+static int
+proc_write_bluetooth(struct file *file, const char __user * buffer,
+		     unsigned long count, void *data)
+{
+	/* Note: mt_bt_switch controls both internal Bluetooth adapter's 
+	   presence and its LED */
+	return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0);
+}
+
+/*
  * Proc handlers for TLED
  */
 static int
@@ -949,6 +983,11 @@ static int __init asus_hotk_add_fs(struc
 			      mode, device);
 	}
 
+	if (hotk->methods->mt_bt_switch) {
+		asus_proc_add(PROC_BT, &proc_write_bluetooth,
+			      &proc_read_bluetooth, mode, device);
+	}
+
 	/* 
 	 * We need both read node and write method as LCD switch is also accessible
 	 * from keyboard 
@@ -984,6 +1023,8 @@ static int asus_hotk_remove_fs(struct ac
 			remove_proc_entry(PROC_TLED, acpi_device_dir(device));
 		if (hotk->methods->mt_ledd)
 			remove_proc_entry(PROC_LEDD, acpi_device_dir(device));
+		if (hotk->methods->mt_bt_switch)
+			remove_proc_entry(PROC_BT, acpi_device_dir(device));
 		if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status)
 			remove_proc_entry(PROC_LCD, acpi_device_dir(device));
 		if ((hotk->methods->brightness_up
@@ -1137,6 +1178,8 @@ static int __init asus_hotk_get_info(voi
 		hotk->model = A4G;
 	else if (strncmp(model->string.pointer, "W1N", 3) == 0)
 		hotk->model = W1N;
+	else if (strncmp(model->string.pointer, "W5A", 3) == 0)
+		hotk->model = W5A;
 
 	if (hotk->model == END_MODEL) {
 		printk("unsupported, trying default values, supply the "

  parent reply	other threads:[~2006-01-18 21:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-18 21:21 [PATCH 0/9] drivers/acpi/asus_acpi.c updates Karol Kozimor
2006-01-18 21:26 ` [PATCH 1/9] misc cleanups Karol Kozimor
2006-01-18 21:28 ` [PATCH 2/9] support A3G Karol Kozimor
2006-01-18 21:36 ` [PATCH 3/9] LED display support Karol Kozimor
2006-01-18 21:38 ` [PATCH 4/9] support W3400N Karol Kozimor
2006-01-18 21:41 ` [PATCH 5/9] support A4G Karol Kozimor
2006-01-18 21:48 ` Karol Kozimor [this message]
2006-01-18 21:52 ` [PATCH 7/9] support L5D Karol Kozimor
2006-01-18 22:02 ` [PATCH 8/9] rework model detection Karol Kozimor
2006-01-18 22:04 ` [PATCH 9/9] add S1N WLED control Karol Kozimor
2006-06-30 22:59 ` [PATCH 0/10] drivers/acpi/asus_acpi.c updates [RESEND] Karol Kozimor
2006-06-30 23:02   ` [PATCH 1/10] misc cleanups Karol Kozimor
2006-06-30 23:03   ` [PATCH 2/10] support A3G Karol Kozimor
2006-06-30 23:04   ` [PATCH 3/10] LED display support Karol Kozimor
2006-06-30 23:05   ` [PATCH 4/10] support W3400N Karol Kozimor
2006-06-30 23:05   ` [PATCH 5/10] support A4G Karol Kozimor
2006-06-30 23:07   ` [PATCH 6/10] handle internal Bluetooth / support W5A Karol Kozimor
2006-06-30 23:08   ` [PATCH 7/10] support L5D Karol Kozimor
2006-06-30 23:11   ` [PATCH 8/10] rework model detection Karol Kozimor
2006-06-30 23:12   ` [PATCH 9/10] add S1N WLED control Karol Kozimor
2006-06-30 23:14   ` [PATCH 10/10] " Karol Kozimor

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=20060118214859.GG7199@hell.org.pl \
    --to=sziwan@hell.org.pl \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@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.