All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] eeepc-laptop updates
@ 2009-06-08  8:16 Corentin Chary
  2009-06-08  8:16 ` [PATCH 1/4] eeepc: fix kconfig selects Corentin Chary
  2009-06-16 19:25 ` [PATCH 0/4] eeepc-laptop updates Corentin Chary
  0 siblings, 2 replies; 7+ messages in thread
From: Corentin Chary @ 2009-06-08  8:16 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Corentin Chary

Hi Len,
Some updates for eeepc-laptop.
Patch 1/4 is needed for linux-next

Thanks,

Corentin Chary (1):
  eeepc-laptop: Fix cpufv

Joe Perches (1):
  eeepc-laptop.c: use pr_fmt and pr_<level>

Pekka Enberg (1):
  eeepc-laptop: enable camera by default

Randy Dunlap (1):
  eeepc: fix kconfig selects

 drivers/platform/x86/Kconfig        |    3 +-
 drivers/platform/x86/eeepc-laptop.c |  129 +++++++++++++++++++++++++----------
 2 files changed, 95 insertions(+), 37 deletions(-)


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

* [PATCH 1/4] eeepc: fix kconfig selects
  2009-06-08  8:16 [PATCH 0/4] eeepc-laptop updates Corentin Chary
@ 2009-06-08  8:16 ` Corentin Chary
  2009-06-08  8:16   ` [PATCH 2/4] eeepc-laptop: Fix cpufv Corentin Chary
  2009-06-16 19:25 ` [PATCH 0/4] eeepc-laptop updates Corentin Chary
  1 sibling, 1 reply; 7+ messages in thread
From: Corentin Chary @ 2009-06-08  8:16 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Randy Dunlap

From: Randy Dunlap <randy.dunlap@oracle.com>

EEEPC_LAPTOP selects HOTPLUG_PCI.  This causes failures (build error below)
when CONFIG_HOTPLUG is not enabled, so additionally select HOTPLUG since
kconfig 'select' doesn't follow its dependency chain.
Also, only select HOTPLUG_PCI if PCI is already enabled.

drivers/pci/hotplug/fakephp.c:55: error: implicit declaration of function 'pci_rescan_bus'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/Kconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index afbe441..db299e1 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -341,7 +341,8 @@ config EEEPC_LAPTOP
 	select BACKLIGHT_CLASS_DEVICE
 	select HWMON
 	select RFKILL
-	select HOTPLUG_PCI
+	select HOTPLUG
+	select HOTPLUG_PCI if PCI
 	---help---
 	  This driver supports the Fn-Fx keys on Eee PC laptops.
 	  It also adds the ability to switch camera/wlan on/off.
-- 
1.6.3.1


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

* [PATCH 2/4] eeepc-laptop: Fix cpufv
  2009-06-08  8:16 ` [PATCH 1/4] eeepc: fix kconfig selects Corentin Chary
@ 2009-06-08  8:16   ` Corentin Chary
  2009-06-08  8:16     ` [PATCH 3/4] eeepc-laptop.c: use pr_fmt and pr_<level> Corentin Chary
  2009-06-13  6:45     ` [PATCH 2/4] eeepc-laptop: Fix cpufv Corentin Chary
  0 siblings, 2 replies; 7+ messages in thread
From: Corentin Chary @ 2009-06-08  8:16 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Corentin Chary

Limit cpufv input to acceptable values.
Make cpufv output more readable.

According to the dsdt, the value returned by CFVG
is composed by the current setting in the first byte
and the number of settings (starting from 0) in the
second byte.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/eeepc-laptop.c |   58 ++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index a0845b2..ae1fb7b 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -395,7 +395,63 @@ static ssize_t show_sys_acpi(int cm, char *buf)
 EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA);
 EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER);
 EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH);
-EEEPC_CREATE_DEVICE_ATTR(cpufv, CM_ASL_CPUFV);
+
+struct eeepc_cpufv {
+	int num;
+	int cur;
+};
+
+static int get_cpufv(struct eeepc_cpufv *c)
+{
+	c->cur = get_acpi(CM_ASL_CPUFV);
+	c->num = (c->cur >> 8) & 0xff;
+	c->cur &= 0xff;
+	if (c->cur < 0 || c->num <= 0 || c->num > 12)
+		return -ENODEV;
+	return 0;
+}
+
+static ssize_t show_cpufv(struct device *dev,
+			  struct device_attribute *attr,
+			  char *buf)
+{
+	struct eeepc_cpufv c;
+	int i;
+	ssize_t len = 0;
+
+	if (get_cpufv(&c))
+		return sprintf(buf, "<unsupported>\n");
+	for (i = 0; i < c.num; i++)
+		len += sprintf(buf + len, i == c.cur ? "[%d] " : "%d ", i);
+	len += sprintf(buf + len, "\n");
+	return len;
+}
+
+static ssize_t store_cpufv(struct device *dev,
+			   struct device_attribute *attr,
+			   const char *buf, size_t count)
+{
+	struct eeepc_cpufv c;
+	int rv, value;
+
+	if (get_cpufv(&c))
+		return -ENODEV;
+	rv = parse_arg(buf, count, &value);
+	if (rv < 0)
+		return rv;
+	if (!rv || value < 0 || value >= c.num)
+		return -EINVAL;
+	set_acpi(CM_ASL_CPUFV, value);
+	return rv;
+}
+
+static struct device_attribute dev_attr_cpufv = {
+	.attr = {
+		.name = "cpufv",
+		.mode = 0644 },
+	.show   = show_cpufv,
+	.store  = store_cpufv
+};
 
 static struct attribute *platform_attributes[] = {
 	&dev_attr_camera.attr,
-- 
1.6.3.1


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

* [PATCH 3/4] eeepc-laptop.c: use pr_fmt and pr_<level>
  2009-06-08  8:16   ` [PATCH 2/4] eeepc-laptop: Fix cpufv Corentin Chary
@ 2009-06-08  8:16     ` Corentin Chary
  2009-06-08  8:16       ` [PATCH 4/4] eeepc-laptop: enable camera by default Corentin Chary
  2009-06-13  6:45     ` [PATCH 2/4] eeepc-laptop: Fix cpufv Corentin Chary
  1 sibling, 1 reply; 7+ messages in thread
From: Corentin Chary @ 2009-06-08  8:16 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Joe Perches, Corentin Chary

From: Joe Perches <joe@perches.com>

Convert the unusual printk(EEEPC_<level> uses to
the more standard pr_fmt and pr_<level>(.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/eeepc-laptop.c |   59 ++++++++++++++--------------------
 1 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index ae1fb7b..dfda948 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -16,6 +16,8 @@
  *  GNU General Public License for more details.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -41,11 +43,6 @@
 #define EEEPC_HOTK_DEVICE_NAME	"Hotkey"
 #define EEEPC_HOTK_HID		"ASUS010"
 
-#define EEEPC_LOG	EEEPC_HOTK_FILE ": "
-#define EEEPC_ERR	KERN_ERR	EEEPC_LOG
-#define EEEPC_WARNING	KERN_WARNING	EEEPC_LOG
-#define EEEPC_NOTICE	KERN_NOTICE	EEEPC_LOG
-#define EEEPC_INFO	KERN_INFO	EEEPC_LOG
 
 /*
  * Definitions for Asus EeePC
@@ -269,7 +266,7 @@ static int set_acpi(int cm, int value)
 		if (method == NULL)
 			return -ENODEV;
 		if (write_acpi_int(ehotk->handle, method, value, NULL))
-			printk(EEEPC_WARNING "Error writing %s\n", method);
+			pr_warning("Error writing %s\n", method);
 	}
 	return 0;
 }
@@ -282,7 +279,7 @@ static int get_acpi(int cm)
 		if (method == NULL)
 			return -ENODEV;
 		if (read_acpi_int(ehotk->handle, method, &value))
-			printk(EEEPC_WARNING "Error reading %s\n", method);
+			pr_warning("Error reading %s\n", method);
 	}
 	return value;
 }
@@ -535,26 +532,23 @@ static int eeepc_hotk_check(void)
 	if (ehotk->device->status.present) {
 		if (write_acpi_int(ehotk->handle, "INIT", ehotk->init_flag,
 				    &buffer)) {
-			printk(EEEPC_ERR "Hotkey initialization failed\n");
+			pr_err("Hotkey initialization failed\n");
 			return -ENODEV;
 		} else {
-			printk(EEEPC_NOTICE "Hotkey init flags 0x%x\n",
-			       ehotk->init_flag);
+			pr_notice("Hotkey init flags 0x%x\n", ehotk->init_flag);
 		}
 		/* get control methods supported */
 		if (read_acpi_int(ehotk->handle, "CMSG"
 				   , &ehotk->cm_supported)) {
-			printk(EEEPC_ERR
-			       "Get control methods supported failed\n");
+			pr_err("Get control methods supported failed\n");
 			return -ENODEV;
 		} else {
-			printk(EEEPC_INFO
-			       "Get control methods supported: 0x%x\n",
-			       ehotk->cm_supported);
+			pr_info("Get control methods supported: 0x%x\n",
+				ehotk->cm_supported);
 		}
 		ehotk->inputdev = input_allocate_device();
 		if (!ehotk->inputdev) {
-			printk(EEEPC_INFO "Unable to allocate input device\n");
+			pr_info("Unable to allocate input device\n");
 			return 0;
 		}
 		ehotk->inputdev->name = "Asus EeePC extra buttons";
@@ -573,12 +567,12 @@ static int eeepc_hotk_check(void)
 		}
 		result = input_register_device(ehotk->inputdev);
 		if (result) {
-			printk(EEEPC_INFO "Unable to register input device\n");
+			pr_info("Unable to register input device\n");
 			input_free_device(ehotk->inputdev);
 			return 0;
 		}
 	} else {
-		printk(EEEPC_ERR "Hotkey device not present, aborting\n");
+		pr_err("Hotkey device not present, aborting\n");
 		return -EINVAL;
 	}
 	return 0;
@@ -619,7 +613,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
 		return;
 
 	if (!bus) {
-		printk(EEEPC_WARNING "Unable to find PCI bus 1?\n");
+		pr_warning("Unable to find PCI bus 1?\n");
 		return;
 	}
 
@@ -636,7 +630,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
 		if (dev) {
 			pci_bus_assign_resources(bus);
 			if (pci_bus_add_device(dev))
-				printk(EEEPC_ERR "Unable to hotplug wifi\n");
+				pr_err("Unable to hotplug wifi\n");
 		}
 	} else {
 		dev = pci_get_slot(bus, 0);
@@ -709,8 +703,7 @@ static int eeepc_register_rfkill_notifier(char *node)
 						     eeepc_rfkill_notify,
 						     NULL);
 		if (ACPI_FAILURE(status))
-			printk(EEEPC_WARNING
-			       "Failed to register notify on %s\n", node);
+			pr_warning("Failed to register notify on %s\n", node);
 	} else
 		return -ENODEV;
 
@@ -729,8 +722,7 @@ static void eeepc_unregister_rfkill_notifier(char *node)
 						     ACPI_SYSTEM_NOTIFY,
 						     eeepc_rfkill_notify);
 		if (ACPI_FAILURE(status))
-			printk(EEEPC_ERR
-			       "Error removing rfkill notify handler %s\n",
+			pr_err("Error removing rfkill notify handler %s\n",
 				node);
 	}
 }
@@ -747,7 +739,7 @@ static int eeepc_setup_pci_hotplug(void)
 	struct pci_bus *bus = pci_find_bus(0, 1);
 
 	if (!bus) {
-		printk(EEEPC_ERR "Unable to find wifi PCI bus\n");
+		pr_err("Unable to find wifi PCI bus\n");
 		return -ENODEV;
 	}
 
@@ -768,7 +760,7 @@ static int eeepc_setup_pci_hotplug(void)
 
 	ret = pci_hp_register(ehotk->hotplug_slot, bus, 0, "eeepc-wifi");
 	if (ret) {
-		printk(EEEPC_ERR "Unable to register hotplug slot - %d\n", ret);
+		pr_err("Unable to register hotplug slot - %d\n", ret);
 		goto error_register;
 	}
 
@@ -790,7 +782,7 @@ static int eeepc_hotk_add(struct acpi_device *device)
 
 	if (!device)
 		 return -EINVAL;
-	printk(EEEPC_NOTICE EEEPC_HOTK_NAME "\n");
+	pr_notice(EEEPC_HOTK_NAME "\n");
 	ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL);
 	if (!ehotk)
 		return -ENOMEM;
@@ -806,7 +798,7 @@ static int eeepc_hotk_add(struct acpi_device *device)
 	status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
 					     eeepc_hotk_notify, ehotk);
 	if (ACPI_FAILURE(status))
-		printk(EEEPC_ERR "Error installing notify handler\n");
+		pr_err("Error installing notify handler\n");
 
 	eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
 	eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
@@ -907,7 +899,7 @@ static int eeepc_hotk_remove(struct acpi_device *device, int type)
 	status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
 					    eeepc_hotk_notify);
 	if (ACPI_FAILURE(status))
-		printk(EEEPC_ERR "Error removing notify handler\n");
+		pr_err("Error removing notify handler\n");
 
 	eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
 	eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
@@ -1079,8 +1071,7 @@ static int eeepc_backlight_init(struct device *dev)
 	bd = backlight_device_register(EEEPC_HOTK_FILE, dev,
 				       NULL, &eeepcbl_ops);
 	if (IS_ERR(bd)) {
-		printk(EEEPC_ERR
-		       "Could not register eeepc backlight device\n");
+		pr_err("Could not register eeepc backlight device\n");
 		eeepc_backlight_device = NULL;
 		return PTR_ERR(bd);
 	}
@@ -1099,8 +1090,7 @@ static int eeepc_hwmon_init(struct device *dev)
 
 	hwmon = hwmon_device_register(dev);
 	if (IS_ERR(hwmon)) {
-		printk(EEEPC_ERR
-		       "Could not register eeepc hwmon device\n");
+		pr_err("Could not register eeepc hwmon device\n");
 		eeepc_hwmon_device = NULL;
 		return PTR_ERR(hwmon);
 	}
@@ -1133,8 +1123,7 @@ static int __init eeepc_laptop_init(void)
 		if (result)
 			goto fail_backlight;
 	} else
-		printk(EEEPC_INFO "Backlight controlled by ACPI video "
-		       "driver\n");
+		pr_info("Backlight controlled by ACPI video driver\n");
 
 	result = eeepc_hwmon_init(dev);
 	if (result)
-- 
1.6.3.1


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

* [PATCH 4/4] eeepc-laptop: enable camera by default
  2009-06-08  8:16     ` [PATCH 3/4] eeepc-laptop.c: use pr_fmt and pr_<level> Corentin Chary
@ 2009-06-08  8:16       ` Corentin Chary
  0 siblings, 0 replies; 7+ messages in thread
From: Corentin Chary @ 2009-06-08  8:16 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Pekka Enberg, Andrew Morton, Corentin Chary

From: Pekka Enberg <penberg@cs.helsinki.fi>

If we leave the camera disabled by default, userspace programs (e.g.
Skype, Cheese) leave the user out in the cold saying that the machine
"has no camera." Therefore, it's better to enable camera by default and
let people who really don't want it just disable the thing.

To reduce power usage you should enable USB autosuspend:
echo -n auto > /sys/bus/usb/drivers/uvcvideo/*:*/../power/level

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/eeepc-laptop.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index dfda948..2c58641 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -341,6 +341,15 @@ static int eeepc_bluetooth_rfkill_state(void *data, enum rfkill_state *state)
 	return 0;
 }
 
+static void __init eeepc_enable_camera(void)
+{
+	/*
+	 * If the following call to set_acpi() fails, it's because there's no
+	 * camera so we can ignore the error.
+	 */
+	set_acpi(CM_ASL_CAMERA, 1);
+}
+
 /*
  * Sys helpers
  */
@@ -1128,6 +1137,9 @@ static int __init eeepc_laptop_init(void)
 	result = eeepc_hwmon_init(dev);
 	if (result)
 		goto fail_hwmon;
+
+	eeepc_enable_camera();
+
 	/* Register platform stuff */
 	result = platform_driver_register(&platform_driver);
 	if (result)
-- 
1.6.3.1


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

* Re: [PATCH 2/4] eeepc-laptop: Fix cpufv
  2009-06-08  8:16   ` [PATCH 2/4] eeepc-laptop: Fix cpufv Corentin Chary
  2009-06-08  8:16     ` [PATCH 3/4] eeepc-laptop.c: use pr_fmt and pr_<level> Corentin Chary
@ 2009-06-13  6:45     ` Corentin Chary
  1 sibling, 0 replies; 7+ messages in thread
From: Corentin Chary @ 2009-06-13  6:45 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Corentin Chary

Hi Len,
2.6.30 is out, please don't merge this patch, it'll break userspace API.
Other patch are still ok.
Thanks,


-- 
Corentin Chary
http://xf.iksaif.net - http://uffs.org

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

* Re: [PATCH 0/4] eeepc-laptop updates
  2009-06-08  8:16 [PATCH 0/4] eeepc-laptop updates Corentin Chary
  2009-06-08  8:16 ` [PATCH 1/4] eeepc: fix kconfig selects Corentin Chary
@ 2009-06-16 19:25 ` Corentin Chary
  1 sibling, 0 replies; 7+ messages in thread
From: Corentin Chary @ 2009-06-16 19:25 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Corentin Chary

On Mon, Jun 8, 2009 at 10:16 AM, Corentin Chary<corentincj@iksaif.net> wrote:
> Hi Len,
> Some updates for eeepc-laptop.
> Patch 1/4 is needed for linux-next

Forget this series, a new one is comming. I'll update patchwork.

-- 
Corentin Chary
http://xf.iksaif.net - http://uffs.org

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

end of thread, other threads:[~2009-06-16 19:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-08  8:16 [PATCH 0/4] eeepc-laptop updates Corentin Chary
2009-06-08  8:16 ` [PATCH 1/4] eeepc: fix kconfig selects Corentin Chary
2009-06-08  8:16   ` [PATCH 2/4] eeepc-laptop: Fix cpufv Corentin Chary
2009-06-08  8:16     ` [PATCH 3/4] eeepc-laptop.c: use pr_fmt and pr_<level> Corentin Chary
2009-06-08  8:16       ` [PATCH 4/4] eeepc-laptop: enable camera by default Corentin Chary
2009-06-13  6:45     ` [PATCH 2/4] eeepc-laptop: Fix cpufv Corentin Chary
2009-06-16 19:25 ` [PATCH 0/4] eeepc-laptop updates Corentin Chary

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.