diff mbox

[0/8,Resend] ideapad: using EC command to control rf/camera power

Message ID 20100830181954.GE31068@darkside.kls.lan (mailing list archive)
State New, archived
Headers show

Commit Message

Mario 'BitKoenig' Holbe Aug. 30, 2010, 6:19 p.m. UTC
None
diff mbox

Patch

--- ideapad_laptop.c.orig	2010-08-18 13:35:36.087735426 +0200
+++ ideapad_laptop.c	2010-08-30 19:05:53.116031145 +0200
@@ -170,6 +170,18 @@  static ssize_t show_ideapad_cam(struct d
 	struct ideapad_private *priv = dev_get_drvdata(dev);
 	acpi_handle handle = priv->handle;
 	unsigned long result;
+	acpi_status res;
+	u64 res64;
+
+	res = acpi_evaluate_integer(handle, "\\_SB.BTST", NULL, &res64);
+	if(!ACPI_FAILURE(res))
+		printk(KERN_INFO "BTST: 0x%llx\n", res64);
+	res = acpi_evaluate_integer(handle, "\\_SB.BTPS", NULL, &res64);
+	if(!ACPI_FAILURE(res))
+		printk(KERN_INFO "BTPS: 0x%llx\n", res64);
+	res = acpi_evaluate_integer(handle, "\\_SB.PCI0.PIB.EC0.BTEN", NULL, &res64);
+	if(!ACPI_FAILURE(res))
+		printk(KERN_INFO "BTEN: 0x%llx\n", res64);
 
 	if (read_ec_data(handle, 0x1D, &result))
 		return sprintf(buf, "-1\n");
@@ -279,11 +291,19 @@  static int ideapad_acpi_add(struct acpi_
 	if (read_method_int(adevice->handle, "_CFG", &cfg))
 		return -ENODEV;
 
+	printk(KERN_INFO "ideapad_acpi_add(): cfg=0x%x\n", cfg);
+
 	for (i = IDEAPAD_DEV_CAMERA; i < IDEAPAD_DEV_KILLSW; i++) {
-		if (test_bit(ideapad_rfk_data[i].cfgbit, (unsigned long *)&cfg))
+		if (test_bit(ideapad_rfk_data[i].cfgbit, (unsigned long *)&cfg)) {
 			devs_present[i] = 1;
-		else
-			devs_present[i] = 0;
+			printk(KERN_INFO "ideapad_acpi_add(): found: %s\n", ideapad_rfk_data[i].name);
+		} else {
+			if(ideapad_rfk_data[i].type == RFKILL_TYPE_BLUETOOTH) {
+				devs_present[i] = 1;
+				printk(KERN_INFO "ideapad_acpi_add(): forced: %s\n", ideapad_rfk_data[i].name);
+			} else
+				devs_present[i] = 0;
+		}
 	}
 
 	/* The hardware switch is always present */