public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates
@ 2007-04-28 14:15 malattia
  2007-04-28 14:18 ` [patch 1/9 v2] sony-laptop: add camera enable/disable parameter, better handle possible infinite loop malattia
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:15 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop

[It seems vger doesn't like my batch mailings... so retrying also with
an updated patchset]

Hi Len,

first of all a thought about pushing all the latest sony-laptop stuff
for 2.6.22: many recent vaios are not supported anymore by sonypi wrt
its functionalities while they all seem to work with the acpi based
implementation present in sony-laptop in acpi-test. Thus I'd suggest
pushing all of it to Linus when the 2.6.22 window opens.
Agree?

Then a small explanation about this batch, patch description is in the
patch itself:

1. a fix for the motion eye camera support in old c1ve/c1vn series, the
   camera support is still incomplete in sony-laptop at this point but
   this change is needed to avoid bad things with the current code, and
   support will be complete with patch #6

2. add mutex locking to the ioport access in sony-laptop

3. add power on/off a new device present in some SZ laptops
   (edge/gprs modem)

4. suggest using sony-laptop to sonypi users both to try to have more
   feedback and to start moving away from it.

5. try to detect sony-laptop usage in sonypi by looking at the known
   ioports usage

6. complete motion eye camera support in sony-laptop

7. add sony-laptop.h header for meye usage

8. make meye use sony-laptop instead of sonypi

9. remove camera controls from the platform attributes and let the meye
   module do it based on real pci_ids.

The patches are based on acpi-test, please apply.
---
 drivers/char/sonypi.c       |   35 ++++
 drivers/media/video/meye.c  |   62 ++++----
 drivers/media/video/meye.h  |    4 
 drivers/misc/sony-laptop.c  |  314 +++++++++++++++++++++++++++++---------------
 include/linux/sony-laptop.h |   34 ++++
 5 files changed, 308 insertions(+), 141 deletions(-)
-- 
mattia
:wq!

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

* [patch 1/9 v2] sony-laptop: add camera enable/disable parameter, better handle possible infinite loop
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
@ 2007-04-28 14:18 ` malattia
  2007-04-28 14:19 ` [patch 2/9 v2] sony-laptop: add locking on accesses to the ioport and global vars malattia
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:18 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0006-add-SNY6001-platform-attributes-fix-camera-opts.patch --]
[-- Type: text/plain, Size: 3257 bytes --]

Use a parameter to enable/disable motion eye camera (for C1VE/C1VN models)
controls and avoid entering an infinite loop if the camera is not present
and the HW doesn't answer as we expect on io commands.

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/drivers/misc/sony-laptop.c
===================================================================
--- linux-2.6.orig/drivers/misc/sony-laptop.c	2007-04-23 00:20:19.586798352 +0900
+++ linux-2.6/drivers/misc/sony-laptop.c	2007-04-23 00:26:25.107628197 +0900
@@ -107,6 +107,12 @@ module_param(mask, ulong, 0644);
 MODULE_PARM_DESC(mask,
 		 "set this to the mask of event you want to enable (see doc)");
 
+static int camera;		/* = 0 */
+module_param(camera, int, 0444);
+MODULE_PARM_DESC(camera,
+		 "set this to 1 to enable Motion Eye camera controls "
+		 "(only use it if you have a C1VE or C1VN model)");
+
 #ifdef CONFIG_SONY_LAPTOP_OLD
 static int minor = -1;
 module_param(minor, int, 0);
@@ -1226,29 +1232,39 @@ static int sony_pic_camera_ready(void)
 	return (v != 0xff && (v & SONYPI_CAMERA_STATUS_READY));
 }
 
-static void sony_pic_camera_off(void)
+static int sony_pic_camera_off(void)
 {
+	if (!camera) {
+		printk(KERN_WARNING DRV_PFX "camera control not enabled\n");
+		return -ENODEV;
+	}
+
 	wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
 				SONYPI_CAMERA_MUTE_MASK),
 			ITERATIONS_SHORT);
 
-	if (!spic_dev.camera_power)
-		return;
-
-	sony_pic_call2(0x91, 0);
-	spic_dev.camera_power = 0;
+	if (spic_dev.camera_power) {
+		sony_pic_call2(0x91, 0);
+		spic_dev.camera_power = 0;
+	}
+	return 0;
 }
 
-static void sony_pic_camera_on(void)
+static int sony_pic_camera_on(void)
 {
-	int i, j;
+	int i, j, x;
+
+	if (!camera) {
+		printk(KERN_WARNING DRV_PFX "camera control not enabled\n");
+		return -ENODEV;
+	}
 
 	if (spic_dev.camera_power)
-		return;
+		return 0;
 
 	for (j = 5; j > 0; j--) {
 
-		while (sony_pic_call2(0x91, 0x1))
+		for (x = 0; x < 100 && sony_pic_call2(0x91, 0x1); x++)
 			msleep(10);
 		sony_pic_call1(0x93);
 
@@ -1262,8 +1278,8 @@ static void sony_pic_camera_on(void)
 	}
 
 	if (j == 0) {
-		printk(KERN_WARNING "sonypi: failed to power on camera\n");
-		return;
+		printk(KERN_WARNING DRV_PFX "failed to power on camera\n");
+		return -ENODEV;
 	}
 
 	wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
@@ -1271,6 +1287,7 @@ static void sony_pic_camera_on(void)
 			ITERATIONS_SHORT);
 
 	spic_dev.camera_power = 1;
+	return 0;
 }
 
 static ssize_t sony_pic_camerapower_store(struct device *dev,
@@ -1278,14 +1295,18 @@ static ssize_t sony_pic_camerapower_stor
 		const char *buffer, size_t count)
 {
 	unsigned long value;
+	int result;
 	if (count > 31)
 		return -EINVAL;
 
 	value = simple_strtoul(buffer, NULL, 10);
 	if (value)
-		sony_pic_camera_on();
+		result = sony_pic_camera_on();
 	else
-		sony_pic_camera_off();
+		result = sony_pic_camera_off();
+
+	if (result)
+		return result;
 
 	return count;
 }
@@ -1662,7 +1683,7 @@ static int sonypi_compat_init(void)
 		goto err_free_kfifo;
 	}
 	if (minor == -1)
-		printk(KERN_INFO "sonypi: device allocated minor is %d\n",
+		printk(KERN_INFO DRV_PFX "device allocated minor is %d\n",
 		       sonypi_misc_device.minor);
 
 	return 0;

--
mattia
:wq!

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

* [patch 2/9 v2] sony-laptop: add locking on accesses to the ioport and global vars
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
  2007-04-28 14:18 ` [patch 1/9 v2] sony-laptop: add camera enable/disable parameter, better handle possible infinite loop malattia
@ 2007-04-28 14:19 ` malattia
  2007-04-28 14:21 ` [patch 3/9 v2] sony-laptop: add edge modem support (also called WWAN) malattia
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:19 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0009-add-locking-to-ioport-code-paths.patch --]
[-- Type: text/plain, Size: 4761 bytes --]

Better avoid having ioport commands mixing and global variables reading/writing.

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/drivers/misc/sony-laptop.c
===================================================================
--- linux-2.6.orig/drivers/misc/sony-laptop.c	2007-04-25 18:50:52.347740466 +0900
+++ linux-2.6/drivers/misc/sony-laptop.c	2007-04-25 22:21:24.067581156 +0900
@@ -928,6 +928,7 @@ struct sony_pic_dev {
 	struct sony_pic_ioport	*cur_ioport;
 	struct list_head	interrupts;
 	struct list_head	ioports;
+	struct mutex		lock;
 };
 
 static struct sony_pic_dev spic_dev = {
@@ -1224,7 +1225,7 @@ static u8 sony_pic_call3(u8 dev, u8 fn, 
 #define SONYPI_CAMERA_STATUS_READY 	0x2
 #define SONYPI_CAMERA_STATUS_POSITION	0x4
 
-static int sony_pic_camera_ready(void)
+static int __sony_pic_camera_ready(void)
 {
 	u8 v;
 
@@ -1239,6 +1240,7 @@ static int sony_pic_camera_off(void)
 		return -ENODEV;
 	}
 
+	mutex_lock(&spic_dev.lock);
 	wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
 				SONYPI_CAMERA_MUTE_MASK),
 			ITERATIONS_SHORT);
@@ -1247,20 +1249,23 @@ static int sony_pic_camera_off(void)
 		sony_pic_call2(0x91, 0);
 		spic_dev.camera_power = 0;
 	}
+	mutex_unlock(&spic_dev.lock);
 	return 0;
 }
 
 static int sony_pic_camera_on(void)
 {
 	int i, j, x;
+	int result = 0;
 
 	if (!camera) {
 		printk(KERN_WARNING DRV_PFX "camera control not enabled\n");
 		return -ENODEV;
 	}
 
+	mutex_lock(&spic_dev.lock);
 	if (spic_dev.camera_power)
-		return 0;
+		goto out_unlock;
 
 	for (j = 5; j > 0; j--) {
 
@@ -1269,7 +1274,7 @@ static int sony_pic_camera_on(void)
 		sony_pic_call1(0x93);
 
 		for (i = 400; i > 0; i--) {
-			if (sony_pic_camera_ready())
+			if (__sony_pic_camera_ready())
 				break;
 			msleep(10);
 		}
@@ -1279,7 +1284,8 @@ static int sony_pic_camera_on(void)
 
 	if (j == 0) {
 		printk(KERN_WARNING DRV_PFX "failed to power on camera\n");
-		return -ENODEV;
+		result = -ENODEV;
+		goto out_unlock;
 	}
 
 	wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
@@ -1287,6 +1293,9 @@ static int sony_pic_camera_on(void)
 			ITERATIONS_SHORT);
 
 	spic_dev.camera_power = 1;
+
+out_unlock:
+	mutex_unlock(&spic_dev.lock);
 	return 0;
 }
 
@@ -1314,11 +1323,15 @@ static ssize_t sony_pic_camerapower_stor
 static ssize_t sony_pic_camerapower_show(struct device *dev,
 		struct device_attribute *attr, char *buffer)
 {
-	return snprintf(buffer, PAGE_SIZE, "%d\n", spic_dev.camera_power);
+	ssize_t count;
+	mutex_lock(&spic_dev.lock);
+	count = snprintf(buffer, PAGE_SIZE, "%d\n", spic_dev.camera_power);
+	mutex_unlock(&spic_dev.lock);
+	return count;
 }
 
 /* bluetooth subsystem power state */
-static void sony_pic_set_bluetoothpower(u8 state)
+static void __sony_pic_set_bluetoothpower(u8 state)
 {
 	state = !!state;
 	if (spic_dev.bluetooth_power == state)
@@ -1337,7 +1350,9 @@ static ssize_t sony_pic_bluetoothpower_s
 		return -EINVAL;
 
 	value = simple_strtoul(buffer, NULL, 10);
-	sony_pic_set_bluetoothpower(value);
+	mutex_lock(&spic_dev.lock);
+	__sony_pic_set_bluetoothpower(value);
+	mutex_unlock(&spic_dev.lock);
 
 	return count;
 }
@@ -1345,7 +1360,11 @@ static ssize_t sony_pic_bluetoothpower_s
 static ssize_t sony_pic_bluetoothpower_show(struct device *dev,
 		struct device_attribute *attr, char *buffer)
 {
-	return snprintf(buffer, PAGE_SIZE, "%d\n", spic_dev.bluetooth_power);
+	ssize_t count = 0;
+	mutex_lock(&spic_dev.lock);
+	count = snprintf(buffer, PAGE_SIZE, "%d\n", spic_dev.bluetooth_power);
+	mutex_unlock(&spic_dev.lock);
+	return count;
 }
 
 /* fan speed */
@@ -1518,7 +1537,7 @@ static int sonypi_misc_ioctl(struct inod
 	u16 val16;
 	int value;
 
-	/*down(&sonypi_device.lock);*/
+	mutex_lock(&spic_dev.lock);
 	switch (cmd) {
 	case SONYPI_IOCGBRT:
 		if (sony_backlight_device == NULL) {
@@ -1602,7 +1621,7 @@ static int sonypi_misc_ioctl(struct inod
 			ret = -EFAULT;
 			break;
 		}
-		sony_pic_set_bluetoothpower(val8);
+		__sony_pic_set_bluetoothpower(val8);
 		break;
 	/* FAN Controls */
 	case SONYPI_IOCGFAN:
@@ -1633,7 +1652,7 @@ static int sonypi_misc_ioctl(struct inod
 	default:
 		ret = -EINVAL;
 	}
-	/*up(&sonypi_device.lock);*/
+	mutex_unlock(&spic_dev.lock);
 	return ret;
 }
 
@@ -1673,7 +1692,6 @@ static int sonypi_compat_init(void)
 	}
 
 	init_waitqueue_head(&sonypi_compat.fifo_proc_list);
-	/*init_MUTEX(&sonypi_device.lock);*/
 
 	if (minor != -1)
 		sonypi_misc_device.minor = minor;
@@ -2004,6 +2022,7 @@ static int sony_pic_add(struct acpi_devi
 	spic_dev.acpi_dev = device;
 	strcpy(acpi_device_class(device), "sony/hotkey");
 	spic_dev.model = sony_pic_detect_device_type();
+	mutex_init(&spic_dev.lock);
 
 	/* read _PRS resources */
 	result = sony_pic_possible_resources(device);

-- 
mattia
:wq!

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

* [patch 3/9 v2] sony-laptop: add edge modem support (also called WWAN)
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
  2007-04-28 14:18 ` [patch 1/9 v2] sony-laptop: add camera enable/disable parameter, better handle possible infinite loop malattia
  2007-04-28 14:19 ` [patch 2/9 v2] sony-laptop: add locking on accesses to the ioport and global vars malattia
@ 2007-04-28 14:21 ` malattia
  2007-04-28 14:22 ` [patch 4/9 v2] sonypi: suggest sonypi users to try sony-laptop instead malattia
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:21 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0010-add-edge-modem-support.patch --]
[-- Type: text/plain, Size: 2187 bytes --]

Some SZ Vaios have a gsm built-in modem. Allow powering on/off this device.
Thanks to Joshua Wise for the base code.

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/drivers/misc/sony-laptop.c
===================================================================
--- linux-2.6.orig/drivers/misc/sony-laptop.c	2007-04-25 18:52:14.852442141 +0900
+++ linux-2.6/drivers/misc/sony-laptop.c	2007-04-25 18:52:28.853240001 +0900
@@ -923,6 +923,7 @@ struct sony_pic_dev {
 	int			model;
 	u8			camera_power;
 	u8			bluetooth_power;
+	u8			wwan_power;
 	struct acpi_device	*acpi_dev;
 	struct sony_pic_irq	*cur_irq;
 	struct sony_pic_ioport	*cur_ioport;
@@ -1330,6 +1331,44 @@ static ssize_t sony_pic_camerapower_show
 	return count;
 }
 
+/* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */
+static void sony_pic_set_wwanpower(u8 state)
+{
+	state = !!state;
+	mutex_lock(&spic_dev.lock);
+	if (spic_dev.wwan_power == state) {
+		mutex_unlock(&spic_dev.lock);
+		return;
+	}
+	sony_pic_call2(0xB0, state);
+	spic_dev.wwan_power = state;
+	mutex_unlock(&spic_dev.lock);
+}
+
+static ssize_t sony_pic_wwanpower_store(struct device *dev,
+		struct device_attribute *attr,
+		const char *buffer, size_t count)
+{
+	unsigned long value;
+	if (count > 31)
+		return -EINVAL;
+
+	value = simple_strtoul(buffer, NULL, 10);
+	sony_pic_set_wwanpower(value);
+
+	return count;
+}
+
+static ssize_t sony_pic_wwanpower_show(struct device *dev,
+		struct device_attribute *attr, char *buffer)
+{
+	ssize_t count;
+	mutex_lock(&spic_dev.lock);
+	count = snprintf(buffer, PAGE_SIZE, "%d\n", spic_dev.wwan_power);
+	mutex_unlock(&spic_dev.lock);
+	return count;
+}
+
 /* bluetooth subsystem power state */
 static void __sony_pic_set_bluetoothpower(u8 state)
 {
@@ -1412,11 +1451,13 @@ struct device_attribute spic_attr_##_nam
 
 static SPIC_ATTR(camerapower, 0644);
 static SPIC_ATTR(bluetoothpower, 0644);
+static SPIC_ATTR(wwanpower, 0644);
 static SPIC_ATTR(fanspeed, 0644);
 
 static struct attribute *spic_attributes[] = {
 	&spic_attr_camerapower.attr,
 	&spic_attr_bluetoothpower.attr,
+	&spic_attr_wwanpower.attr,
 	&spic_attr_fanspeed.attr,
 	NULL
 };

--
mattia
:wq!

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

* [patch 4/9 v2] sonypi: suggest sonypi users to try sony-laptop instead
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
                   ` (2 preceding siblings ...)
  2007-04-28 14:21 ` [patch 3/9 v2] sony-laptop: add edge modem support (also called WWAN) malattia
@ 2007-04-28 14:22 ` malattia
  2007-04-28 14:34 ` [patch 5/9 v2] sonypi: try to detect if sony-laptop has already taken one of the known ioports malattia
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:22 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0011-sonypi-suggest-using-sony-laptop-instead.patch --]
[-- Type: text/plain, Size: 1075 bytes --]

Try to migrate sonypi users to sony-laptop gracefully.

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/drivers/char/sonypi.c
===================================================================
--- linux-2.6.orig/drivers/char/sonypi.c	2007-04-25 13:08:11.676054561 +0900
+++ linux-2.6/drivers/char/sonypi.c	2007-04-25 16:19:38.830670196 +0900
@@ -1,6 +1,8 @@
 /*
  * Sony Programmable I/O Control Device driver for VAIO
  *
+ * Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
+ *
  * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
  *
  * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
@@ -1321,6 +1323,10 @@ static int __devinit sonypi_probe(struct
 	struct pci_dev *pcidev;
 	int error;
 
+	printk(KERN_WARNING "sonypi: please try the sony-laptop module instead "
+			"and report failures, see also "
+			"http://www.linux.it/~malattia/wiki/index.php/Sony_drivers\n");
+
 	spin_lock_init(&sonypi_device.fifo_lock);
 	sonypi_device.fifo = kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL,
 					 &sonypi_device.fifo_lock);

--
mattia
:wq!

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

* [patch 5/9 v2] sonypi: try to detect if sony-laptop has already taken one of the known ioports
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
                   ` (3 preceding siblings ...)
  2007-04-28 14:22 ` [patch 4/9 v2] sonypi: suggest sonypi users to try sony-laptop instead malattia
@ 2007-04-28 14:34 ` malattia
  2007-04-28 14:34 ` [patch 6/9 v2] sony-laptop: complete the motion eye camera support in sony-laptop malattia
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:34 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0012-sonypi-try-to-avoid-clashing-with-sony-laptop.patch --]
[-- Type: text/plain, Size: 3036 bytes --]

Get the IO resources list in sony-laptop in the same order as listed
in sonypi and make sonypi check if one of those is already busy.
The sonypi check can be disabled by a module parameter in case the user
thinks we are plainly wrong (check_ioport=0).

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/drivers/char/sonypi.c
===================================================================
--- linux-2.6.orig/drivers/char/sonypi.c	2007-04-25 18:52:32.853467961 +0900
+++ linux-2.6/drivers/char/sonypi.c	2007-04-25 19:26:22.969157661 +0900
@@ -97,6 +97,11 @@ module_param(useinput, int, 0444);
 MODULE_PARM_DESC(useinput,
 		 "set this if you would like sonypi to feed events to the input subsystem");
 
+static int check_ioport = 1;
+module_param(check_ioport, int, 0444);
+MODULE_PARM_DESC(check_ioport,
+		 "set this to 0 if you think the automatic ioport check for sony-laptop is wrong");
+
 #define SONYPI_DEVICE_MODEL_TYPE1	1
 #define SONYPI_DEVICE_MODEL_TYPE2	2
 #define SONYPI_DEVICE_MODEL_TYPE3	3
@@ -1262,6 +1267,28 @@ static int __devinit sonypi_create_input
 static int __devinit sonypi_setup_ioports(struct sonypi_device *dev,
 				const struct sonypi_ioport_list *ioport_list)
 {
+	/* try to detect if sony-laptop is being used and thus
+	 * has already requested one of the known ioports.
+	 * As in the deprecated check_region this is racy has we have
+	 * multiple ioports available and one of them can be requested
+	 * between this check and the subsequent request. Anyway, as an
+	 * attempt to be some more user-friendly as we currently are,
+	 * this is enough.
+	 */
+	const struct sonypi_ioport_list *check = ioport_list;
+	while (check_ioport && check->port1) {
+		if (!request_region(check->port1,
+				   sonypi_device.region_size,
+				   "Sony Programable I/O Device Check")) {
+			printk(KERN_ERR "sonypi: ioport 0x%.4x busy, using sony-laptop? "
+					"if not use check_ioport=0\n",
+					check->port1);
+			return -EBUSY;
+		}
+		release_region(check->port1, sonypi_device.region_size);
+		check++;
+	}
+
 	while (ioport_list->port1) {
 
 		if (request_region(ioport_list->port1,
Index: linux-2.6/drivers/misc/sony-laptop.c
===================================================================
--- linux-2.6.orig/drivers/misc/sony-laptop.c	2007-04-25 18:52:28.853240001 +0900
+++ linux-2.6/drivers/misc/sony-laptop.c	2007-04-25 19:26:07.468274316 +0900
@@ -1801,7 +1801,7 @@ sony_pic_read_possible_resource(struct a
 				if (!interrupt)
 					return AE_ERROR;
 
-				list_add(&interrupt->list, &dev->interrupts);
+				list_add_tail(&interrupt->list, &dev->interrupts);
 				interrupt->irq.triggering = p->triggering;
 				interrupt->irq.polarity = p->polarity;
 				interrupt->irq.sharable = p->sharable;
@@ -1823,7 +1823,7 @@ sony_pic_read_possible_resource(struct a
 			if (!ioport)
 				return AE_ERROR;
 
-			list_add(&ioport->list, &dev->ioports);
+			list_add_tail(&ioport->list, &dev->ioports);
 			memcpy(&ioport->io, io, sizeof(*io));
 			return AE_OK;
 		}

--
mattia
:wq!

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

* [patch 6/9 v2] sony-laptop: complete the motion eye camera support in sony-laptop
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
                   ` (4 preceding siblings ...)
  2007-04-28 14:34 ` [patch 5/9 v2] sonypi: try to detect if sony-laptop has already taken one of the known ioports malattia
@ 2007-04-28 14:34 ` malattia
  2007-04-28 14:34 ` [patch 7/9 v2] sony-laptop: add a meye-usable include file for camera ops malattia
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:34 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0013-complete-motion-eye-camera-support-from-sonypi.patch --]
[-- Type: text/plain, Size: 5205 bytes --]

Add the exported sony_pic_camera_command() function to make the MEYE
driver happy.

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/drivers/misc/sony-laptop.c
===================================================================
--- linux-2.6.orig/drivers/misc/sony-laptop.c	2007-04-25 18:52:34.353553446 +0900
+++ linux-2.6/drivers/misc/sony-laptop.c	2007-04-25 18:52:37.353724416 +0900
@@ -1220,11 +1220,35 @@ static u8 sony_pic_call3(u8 dev, u8 fn, 
 
 /* camera tests and poweron/poweroff */
 #define SONYPI_CAMERA_PICTURE		5
-#define SONYPI_CAMERA_MUTE_MASK		0x40
 #define SONYPI_CAMERA_CONTROL		0x10
-#define SONYPI_CAMERA_STATUS 		7
-#define SONYPI_CAMERA_STATUS_READY 	0x2
-#define SONYPI_CAMERA_STATUS_POSITION	0x4
+
+#define SONYPI_CAMERA_BRIGHTNESS		0
+#define SONYPI_CAMERA_CONTRAST			1
+#define SONYPI_CAMERA_HUE			2
+#define SONYPI_CAMERA_COLOR			3
+#define SONYPI_CAMERA_SHARPNESS			4
+
+#define SONYPI_CAMERA_EXPOSURE_MASK		0xC
+#define SONYPI_CAMERA_WHITE_BALANCE_MASK	0x3
+#define SONYPI_CAMERA_PICTURE_MODE_MASK		0x30
+#define SONYPI_CAMERA_MUTE_MASK			0x40
+
+/* the rest don't need a loop until not 0xff */
+#define SONYPI_CAMERA_AGC			6
+#define SONYPI_CAMERA_AGC_MASK			0x30
+#define SONYPI_CAMERA_SHUTTER_MASK 		0x7
+
+#define SONYPI_CAMERA_SHUTDOWN_REQUEST		7
+#define SONYPI_CAMERA_CONTROL			0x10
+
+#define SONYPI_CAMERA_STATUS 			7
+#define SONYPI_CAMERA_STATUS_READY 		0x2
+#define SONYPI_CAMERA_STATUS_POSITION		0x4
+
+#define SONYPI_DIRECTION_BACKWARDS 		0x4
+
+#define SONYPI_CAMERA_REVISION 			8
+#define SONYPI_CAMERA_ROMVERSION 		9
 
 static int __sony_pic_camera_ready(void)
 {
@@ -1234,14 +1258,13 @@ static int __sony_pic_camera_ready(void)
 	return (v != 0xff && (v & SONYPI_CAMERA_STATUS_READY));
 }
 
-static int sony_pic_camera_off(void)
+static int __sony_pic_camera_off(void)
 {
 	if (!camera) {
 		printk(KERN_WARNING DRV_PFX "camera control not enabled\n");
 		return -ENODEV;
 	}
 
-	mutex_lock(&spic_dev.lock);
 	wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE,
 				SONYPI_CAMERA_MUTE_MASK),
 			ITERATIONS_SHORT);
@@ -1250,23 +1273,20 @@ static int sony_pic_camera_off(void)
 		sony_pic_call2(0x91, 0);
 		spic_dev.camera_power = 0;
 	}
-	mutex_unlock(&spic_dev.lock);
 	return 0;
 }
 
-static int sony_pic_camera_on(void)
+static int __sony_pic_camera_on(void)
 {
 	int i, j, x;
-	int result = 0;
 
 	if (!camera) {
 		printk(KERN_WARNING DRV_PFX "camera control not enabled\n");
 		return -ENODEV;
 	}
 
-	mutex_lock(&spic_dev.lock);
 	if (spic_dev.camera_power)
-		goto out_unlock;
+		return 0;
 
 	for (j = 5; j > 0; j--) {
 
@@ -1285,8 +1305,7 @@ static int sony_pic_camera_on(void)
 
 	if (j == 0) {
 		printk(KERN_WARNING DRV_PFX "failed to power on camera\n");
-		result = -ENODEV;
-		goto out_unlock;
+		return -ENODEV;
 	}
 
 	wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTROL,
@@ -1294,9 +1313,6 @@ static int sony_pic_camera_on(void)
 			ITERATIONS_SHORT);
 
 	spic_dev.camera_power = 1;
-
-out_unlock:
-	mutex_unlock(&spic_dev.lock);
 	return 0;
 }
 
@@ -1310,10 +1326,13 @@ static ssize_t sony_pic_camerapower_stor
 		return -EINVAL;
 
 	value = simple_strtoul(buffer, NULL, 10);
+
+	mutex_lock(&spic_dev.lock);
 	if (value)
-		result = sony_pic_camera_on();
+		result = __sony_pic_camera_on();
 	else
-		result = sony_pic_camera_off();
+		result = __sony_pic_camera_off();
+	mutex_unlock(&spic_dev.lock);
 
 	if (result)
 		return result;
@@ -1331,6 +1350,59 @@ static ssize_t sony_pic_camerapower_show
 	return count;
 }
 
+/* External camera command (exported to the motion eye v4l driver) */
+int sony_pic_camera_command(int command, u8 value)
+{
+	if (!camera)
+		return -EIO;
+
+	mutex_lock(&spic_dev.lock);
+
+	switch (command) {
+	case SONYPI_COMMAND_SETCAMERA:
+		if (value)
+			__sony_pic_camera_on();
+		else
+			__sony_pic_camera_off();
+		break;
+	case SONYPI_COMMAND_SETCAMERABRIGHTNESS:
+		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_BRIGHTNESS, value),
+				ITERATIONS_SHORT);
+		break;
+	case SONYPI_COMMAND_SETCAMERACONTRAST:
+		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTRAST, value),
+				ITERATIONS_SHORT);
+		break;
+	case SONYPI_COMMAND_SETCAMERAHUE:
+		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_HUE, value),
+				ITERATIONS_SHORT);
+		break;
+	case SONYPI_COMMAND_SETCAMERACOLOR:
+		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_COLOR, value),
+				ITERATIONS_SHORT);
+		break;
+	case SONYPI_COMMAND_SETCAMERASHARPNESS:
+		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_SHARPNESS, value),
+				ITERATIONS_SHORT);
+		break;
+	case SONYPI_COMMAND_SETCAMERAPICTURE:
+		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE, value),
+				ITERATIONS_SHORT);
+		break;
+	case SONYPI_COMMAND_SETCAMERAAGC:
+		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_AGC, value),
+				ITERATIONS_SHORT);
+		break;
+	default:
+		printk(KERN_ERR DRV_PFX "sony_pic_camera_command invalid: %d\n",
+		       command);
+		break;
+	}
+	mutex_unlock(&spic_dev.lock);
+	return 0;
+}
+EXPORT_SYMBOL(sony_pic_camera_command);
+
 /* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */
 static void sony_pic_set_wwanpower(u8 state)
 {

--
mattia
:wq!

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

* [patch 7/9 v2] sony-laptop: add a meye-usable include file for camera ops
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
                   ` (5 preceding siblings ...)
  2007-04-28 14:34 ` [patch 6/9 v2] sony-laptop: complete the motion eye camera support in sony-laptop malattia
@ 2007-04-28 14:34 ` malattia
  2007-04-28 14:36 ` [patch 8/9 v2] meye: make meye use sony-laptop instead of sonypi malattia
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:34 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0014-sony-laptop-add-meye-interface.patch --]
[-- Type: text/plain, Size: 3774 bytes --]

Copy and rename (for easier co-existence) the MEYE-wise exported interface.

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/include/linux/sony-laptop.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6/include/linux/sony-laptop.h	2007-04-25 21:34:50.408379591 +0900
@@ -0,0 +1,34 @@
+#ifndef _SONYLAPTOP_H_
+#define _SONYLAPTOP_H_
+
+#include <linux/types.h>
+
+#ifdef __KERNEL__
+
+/* used only for communication between v4l and sony-laptop */
+
+#define SONY_PIC_COMMAND_GETCAMERA		 1	/* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERA		 2
+#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS	 3	/* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS	 4
+#define SONY_PIC_COMMAND_GETCAMERACONTRAST	 5	/* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERACONTRAST	 6
+#define SONY_PIC_COMMAND_GETCAMERAHUE		 7	/* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERAHUE		 8
+#define SONY_PIC_COMMAND_GETCAMERACOLOR		 9	/* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERACOLOR		10
+#define SONY_PIC_COMMAND_GETCAMERASHARPNESS	11	/* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERASHARPNESS	12
+#define SONY_PIC_COMMAND_GETCAMERAPICTURE	13	/* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERAPICTURE	14
+#define SONY_PIC_COMMAND_GETCAMERAAGC		15	/* obsolete */
+#define SONY_PIC_COMMAND_SETCAMERAAGC		16
+#define SONY_PIC_COMMAND_GETCAMERADIRECTION	17	/* obsolete */
+#define SONY_PIC_COMMAND_GETCAMERAROMVERSION	18	/* obsolete */
+#define SONY_PIC_COMMAND_GETCAMERAREVISION	19	/* obsolete */
+
+int sony_pic_camera_command(int command, u8 value);
+
+#endif	/* __KERNEL__ */
+
+#endif /* _SONYLAPTOP_H_ */
Index: linux-2.6/drivers/misc/sony-laptop.c
===================================================================
--- linux-2.6.orig/drivers/misc/sony-laptop.c	2007-04-25 21:49:18.957875406 +0900
+++ linux-2.6/drivers/misc/sony-laptop.c	2007-04-25 21:50:20.961408786 +0900
@@ -62,6 +62,7 @@
 #include <acpi/acpi_bus.h>
 #include <asm/uaccess.h>
 #include <linux/sonypi.h>
+#include <linux/sony-laptop.h>
 #ifdef CONFIG_SONY_LAPTOP_OLD
 #include <linux/poll.h>
 #include <linux/miscdevice.h>
@@ -1359,37 +1360,37 @@ int sony_pic_camera_command(int command,
 	mutex_lock(&spic_dev.lock);
 
 	switch (command) {
-	case SONYPI_COMMAND_SETCAMERA:
+	case SONY_PIC_COMMAND_SETCAMERA:
 		if (value)
 			__sony_pic_camera_on();
 		else
 			__sony_pic_camera_off();
 		break;
-	case SONYPI_COMMAND_SETCAMERABRIGHTNESS:
+	case SONY_PIC_COMMAND_SETCAMERABRIGHTNESS:
 		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_BRIGHTNESS, value),
 				ITERATIONS_SHORT);
 		break;
-	case SONYPI_COMMAND_SETCAMERACONTRAST:
+	case SONY_PIC_COMMAND_SETCAMERACONTRAST:
 		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_CONTRAST, value),
 				ITERATIONS_SHORT);
 		break;
-	case SONYPI_COMMAND_SETCAMERAHUE:
+	case SONY_PIC_COMMAND_SETCAMERAHUE:
 		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_HUE, value),
 				ITERATIONS_SHORT);
 		break;
-	case SONYPI_COMMAND_SETCAMERACOLOR:
+	case SONY_PIC_COMMAND_SETCAMERACOLOR:
 		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_COLOR, value),
 				ITERATIONS_SHORT);
 		break;
-	case SONYPI_COMMAND_SETCAMERASHARPNESS:
+	case SONY_PIC_COMMAND_SETCAMERASHARPNESS:
 		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_SHARPNESS, value),
 				ITERATIONS_SHORT);
 		break;
-	case SONYPI_COMMAND_SETCAMERAPICTURE:
+	case SONY_PIC_COMMAND_SETCAMERAPICTURE:
 		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_PICTURE, value),
 				ITERATIONS_SHORT);
 		break;
-	case SONYPI_COMMAND_SETCAMERAAGC:
+	case SONY_PIC_COMMAND_SETCAMERAAGC:
 		wait_on_command(sony_pic_call3(0x90, SONYPI_CAMERA_AGC, value),
 				ITERATIONS_SHORT);
 		break;

--
mattia
:wq!

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

* [patch 8/9 v2] meye: make meye use sony-laptop instead of sonypi
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
                   ` (6 preceding siblings ...)
  2007-04-28 14:34 ` [patch 7/9 v2] sony-laptop: add a meye-usable include file for camera ops malattia
@ 2007-04-28 14:36 ` malattia
  2007-04-28 14:36 ` [patch 9/9 v2] sony-laptop: remove user visible camera controls as platform attributes malattia
  2007-04-29  4:42 ` [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates Len Brown
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:36 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0015-meye-use-sony-laptop.patch --]
[-- Type: text/plain, Size: 8450 bytes --]

Change sonypi_camera_command() calls to sony_pic_camera_command() and use
the renamed macros.

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/drivers/media/video/meye.c
===================================================================
--- linux-2.6.orig/drivers/media/video/meye.c	2007-04-25 22:21:20.067353196 +0900
+++ linux-2.6/drivers/media/video/meye.c	2007-04-25 22:35:21.115281786 +0900
@@ -925,13 +925,13 @@ static int meye_do_ioctl(struct inode *i
 		if (p->palette != VIDEO_PALETTE_YUV422 && p->palette != VIDEO_PALETTE_YUYV)
 			return -EINVAL;
 		mutex_lock(&meye.lock);
-		sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS,
+		sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERABRIGHTNESS,
 				      p->brightness >> 10);
-		sonypi_camera_command(SONYPI_COMMAND_SETCAMERAHUE,
+		sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAHUE,
 				      p->hue >> 10);
-		sonypi_camera_command(SONYPI_COMMAND_SETCAMERACOLOR,
+		sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERACOLOR,
 				      p->colour >> 10);
-		sonypi_camera_command(SONYPI_COMMAND_SETCAMERACONTRAST,
+		sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERACONTRAST,
 				      p->contrast >> 10);
 		meye.picture = *p;
 		mutex_unlock(&meye.lock);
@@ -1043,11 +1043,11 @@ static int meye_do_ioctl(struct inode *i
 		    meye.params.quality != jp->quality)
 			mchip_hic_stop();	/* need restart */
 		meye.params = *jp;
-		sonypi_camera_command(SONYPI_COMMAND_SETCAMERASHARPNESS,
+		sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERASHARPNESS,
 				      meye.params.sharpness);
-		sonypi_camera_command(SONYPI_COMMAND_SETCAMERAAGC,
+		sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC,
 				      meye.params.agc);
-		sonypi_camera_command(SONYPI_COMMAND_SETCAMERAPICTURE,
+		sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE,
 				      meye.params.picture);
 		mutex_unlock(&meye.lock);
 		break;
@@ -1287,38 +1287,38 @@ static int meye_do_ioctl(struct inode *i
 		mutex_lock(&meye.lock);
 		switch (c->id) {
 		case V4L2_CID_BRIGHTNESS:
-			sonypi_camera_command(
-				SONYPI_COMMAND_SETCAMERABRIGHTNESS, c->value);
+			sony_pic_camera_command(
+				SONY_PIC_COMMAND_SETCAMERABRIGHTNESS, c->value);
 			meye.picture.brightness = c->value << 10;
 			break;
 		case V4L2_CID_HUE:
-			sonypi_camera_command(
-				SONYPI_COMMAND_SETCAMERAHUE, c->value);
+			sony_pic_camera_command(
+				SONY_PIC_COMMAND_SETCAMERAHUE, c->value);
 			meye.picture.hue = c->value << 10;
 			break;
 		case V4L2_CID_CONTRAST:
-			sonypi_camera_command(
-				SONYPI_COMMAND_SETCAMERACONTRAST, c->value);
+			sony_pic_camera_command(
+				SONY_PIC_COMMAND_SETCAMERACONTRAST, c->value);
 			meye.picture.contrast = c->value << 10;
 			break;
 		case V4L2_CID_SATURATION:
-			sonypi_camera_command(
-				SONYPI_COMMAND_SETCAMERACOLOR, c->value);
+			sony_pic_camera_command(
+				SONY_PIC_COMMAND_SETCAMERACOLOR, c->value);
 			meye.picture.colour = c->value << 10;
 			break;
 		case V4L2_CID_AGC:
-			sonypi_camera_command(
-				SONYPI_COMMAND_SETCAMERAAGC, c->value);
+			sony_pic_camera_command(
+				SONY_PIC_COMMAND_SETCAMERAAGC, c->value);
 			meye.params.agc = c->value;
 			break;
 		case V4L2_CID_SHARPNESS:
-			sonypi_camera_command(
-				SONYPI_COMMAND_SETCAMERASHARPNESS, c->value);
+			sony_pic_camera_command(
+				SONY_PIC_COMMAND_SETCAMERASHARPNESS, c->value);
 			meye.params.sharpness = c->value;
 			break;
 		case V4L2_CID_PICTURE:
-			sonypi_camera_command(
-				SONYPI_COMMAND_SETCAMERAPICTURE, c->value);
+			sony_pic_camera_command(
+				SONY_PIC_COMMAND_SETCAMERAPICTURE, c->value);
 			meye.params.picture = c->value;
 			break;
 		case V4L2_CID_JPEGQUAL:
@@ -1848,7 +1848,7 @@ static int __devinit meye_probe(struct p
 	memcpy(meye.video_dev, &meye_template, sizeof(meye_template));
 	meye.video_dev->dev = &meye.mchip_dev->dev;
 
-	if ((ret = sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 1))) {
+	if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) {
 		printk(KERN_ERR "meye: unable to power on the camera\n");
 		printk(KERN_ERR "meye: did you enable the camera in "
 				"sonypi using the module options ?\n");
@@ -1928,13 +1928,13 @@ static int __devinit meye_probe(struct p
 	meye.params.picture = 0;
 	meye.params.framerate = 0;
 
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS, 32);
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERAHUE, 32);
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERACOLOR, 32);
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERACONTRAST, 32);
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERASHARPNESS, 32);
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERAPICTURE, 0);
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERAAGC, 48);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERABRIGHTNESS, 32);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAHUE, 32);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERACOLOR, 32);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERACONTRAST, 32);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERASHARPNESS, 32);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, 0);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, 48);
 
 	printk(KERN_INFO "meye: Motion Eye Camera Driver v%s.\n",
 	       MEYE_DRIVER_VERSION);
@@ -1953,7 +1953,7 @@ outremap:
 outregions:
 	pci_disable_device(meye.mchip_dev);
 outenabledev:
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 0);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0);
 outsonypienable:
 	kfifo_free(meye.doneq);
 outkfifoalloc2:
@@ -1986,7 +1986,7 @@ static void __devexit meye_remove(struct
 
 	pci_disable_device(meye.mchip_dev);
 
-	sonypi_camera_command(SONYPI_COMMAND_SETCAMERA, 0);
+	sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0);
 
 	kfifo_free(meye.doneq);
 	kfifo_free(meye.grabq);
Index: linux-2.6/drivers/media/video/meye.h
===================================================================
--- linux-2.6.orig/drivers/media/video/meye.h	2007-04-25 22:21:20.067353196 +0900
+++ linux-2.6/drivers/media/video/meye.h	2007-04-25 22:35:21.115281786 +0900
@@ -255,7 +255,7 @@
 /****************************************************************************/
 
 /* Sony Programmable I/O Controller for accessing the camera commands */
-#include <linux/sonypi.h>
+#include <linux/sony-laptop.h>
 
 /* private API definitions */
 #include <linux/meye.h>
Index: linux-2.6/drivers/media/video/Kconfig
===================================================================
--- linux-2.6.orig/drivers/media/video/Kconfig	2007-04-27 23:11:42.404111919 +0900
+++ linux-2.6/drivers/media/video/Kconfig	2007-04-27 23:12:35.907160884 +0900
@@ -577,14 +577,14 @@ config VIDEO_ZORAN_AVS6EYES
 
 config VIDEO_MEYE
 	tristate "Sony Vaio Picturebook Motion Eye Video For Linux"
-	depends on PCI && SONYPI && VIDEO_V4L1
+	depends on PCI && SONY_LAPTOP && VIDEO_V4L1
 	---help---
 	  This is the video4linux driver for the Motion Eye camera found
 	  in the Vaio Picturebook laptops. Please read the material in
 	  <file:Documentation/video4linux/meye.txt> for more information.
 
-	  If you say Y or M here, you need to say Y or M to "Sony Programmable
-	  I/O Control Device" in the character device section.
+	  If you say Y or M here, you need to say Y or M to "Sony Laptop
+	  Extras" in the misc device section.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called meye.
Index: linux-2.6/Documentation/video4linux/meye.txt
===================================================================
--- linux-2.6.orig/Documentation/video4linux/meye.txt	2007-04-27 23:15:28.917020154 +0900
+++ linux-2.6/Documentation/video4linux/meye.txt	2007-04-27 23:15:44.417903499 +0900
@@ -5,10 +5,9 @@ Vaio Picturebook Motion Eye Camera Drive
 	Copyright (C) 2000 Andrew Tridgell <tridge@samba.org>
 
 This driver enable the use of video4linux compatible applications with the
-Motion Eye camera. This driver requires the "Sony Vaio Programmable I/O
-Control Device" driver (which can be found in the "Character drivers"
-section of the kernel configuration utility) to be compiled and installed
-(using its "camera=1" parameter).
+Motion Eye camera. This driver requires the "Sony Laptop Extras" driver (which
+can be found in the "Misc devices" section of the kernel configuration utility)
+to be compiled and installed (using its "camera=1" parameter).
 
 It can do at maximum 30 fps @ 320x240 or 15 fps @ 640x480.
 

--
mattia
:wq!

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

* [patch 9/9 v2] sony-laptop: remove user visible camera controls as platform attributes
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
                   ` (7 preceding siblings ...)
  2007-04-28 14:36 ` [patch 8/9 v2] meye: make meye use sony-laptop instead of sonypi malattia
@ 2007-04-28 14:36 ` malattia
  2007-04-29  4:42 ` [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates Len Brown
  9 siblings, 0 replies; 11+ messages in thread
From: malattia @ 2007-04-28 14:36 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Stelian Pop, Mattia Dongili

[-- Attachment #1: 0016-remove-camera-platform-attributes.patch --]
[-- Type: text/plain, Size: 1894 bytes --]

Avoid giving the user the possibility to shoot his own foot and let
the meye driver enable/disable the camera wisely (PCI_ID based).

Signed-off-by: Mattia Dongili <malattia@linux.it>
---
Index: linux-2.6/drivers/misc/sony-laptop.c
===================================================================
--- linux-2.6.orig/drivers/misc/sony-laptop.c	2007-04-25 22:35:50.616962991 +0900
+++ linux-2.6/drivers/misc/sony-laptop.c	2007-04-25 22:36:37.119613026 +0900
@@ -1317,40 +1317,6 @@ static int __sony_pic_camera_on(void)
 	return 0;
 }
 
-static ssize_t sony_pic_camerapower_store(struct device *dev,
-		struct device_attribute *attr,
-		const char *buffer, size_t count)
-{
-	unsigned long value;
-	int result;
-	if (count > 31)
-		return -EINVAL;
-
-	value = simple_strtoul(buffer, NULL, 10);
-
-	mutex_lock(&spic_dev.lock);
-	if (value)
-		result = __sony_pic_camera_on();
-	else
-		result = __sony_pic_camera_off();
-	mutex_unlock(&spic_dev.lock);
-
-	if (result)
-		return result;
-
-	return count;
-}
-
-static ssize_t sony_pic_camerapower_show(struct device *dev,
-		struct device_attribute *attr, char *buffer)
-{
-	ssize_t count;
-	mutex_lock(&spic_dev.lock);
-	count = snprintf(buffer, PAGE_SIZE, "%d\n", spic_dev.camera_power);
-	mutex_unlock(&spic_dev.lock);
-	return count;
-}
-
 /* External camera command (exported to the motion eye v4l driver) */
 int sony_pic_camera_command(int command, u8 value)
 {
@@ -1522,13 +1488,11 @@ struct device_attribute spic_attr_##_nam
 		_mode, sony_pic_## _name ##_show,		\
 		sony_pic_## _name ##_store)
 
-static SPIC_ATTR(camerapower, 0644);
 static SPIC_ATTR(bluetoothpower, 0644);
 static SPIC_ATTR(wwanpower, 0644);
 static SPIC_ATTR(fanspeed, 0644);
 
 static struct attribute *spic_attributes[] = {
-	&spic_attr_camerapower.attr,
 	&spic_attr_bluetoothpower.attr,
 	&spic_attr_wwanpower.attr,
 	&spic_attr_fanspeed.attr,

-- 
mattia
:wq!

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

* Re: [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates
  2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
                   ` (8 preceding siblings ...)
  2007-04-28 14:36 ` [patch 9/9 v2] sony-laptop: remove user visible camera controls as platform attributes malattia
@ 2007-04-29  4:42 ` Len Brown
  9 siblings, 0 replies; 11+ messages in thread
From: Len Brown @ 2007-04-29  4:42 UTC (permalink / raw)
  To: malattia; +Cc: linux-acpi, Stelian Pop

On Saturday 28 April 2007 10:15, malattia@linux.it wrote:
> [It seems vger doesn't like my batch mailings... so retrying also with
> an updated patchset]
> 
> Hi Len,
> 
> first of all a thought about pushing all the latest sony-laptop stuff
> for 2.6.22: many recent vaios are not supported anymore by sonypi wrt
> its functionalities while they all seem to work with the acpi based
> implementation present in sony-laptop in acpi-test. Thus I'd suggest
> pushing all of it to Linus when the 2.6.22 window opens.
> Agree?

Yes.

Applied.
thanks,
-Len

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

end of thread, other threads:[~2007-04-29  4:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-28 14:15 [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates malattia
2007-04-28 14:18 ` [patch 1/9 v2] sony-laptop: add camera enable/disable parameter, better handle possible infinite loop malattia
2007-04-28 14:19 ` [patch 2/9 v2] sony-laptop: add locking on accesses to the ioport and global vars malattia
2007-04-28 14:21 ` [patch 3/9 v2] sony-laptop: add edge modem support (also called WWAN) malattia
2007-04-28 14:22 ` [patch 4/9 v2] sonypi: suggest sonypi users to try sony-laptop instead malattia
2007-04-28 14:34 ` [patch 5/9 v2] sonypi: try to detect if sony-laptop has already taken one of the known ioports malattia
2007-04-28 14:34 ` [patch 6/9 v2] sony-laptop: complete the motion eye camera support in sony-laptop malattia
2007-04-28 14:34 ` [patch 7/9 v2] sony-laptop: add a meye-usable include file for camera ops malattia
2007-04-28 14:36 ` [patch 8/9 v2] meye: make meye use sony-laptop instead of sonypi malattia
2007-04-28 14:36 ` [patch 9/9 v2] sony-laptop: remove user visible camera controls as platform attributes malattia
2007-04-29  4:42 ` [patch 0/9 v2] sony drivers: finish rewriting sonypi and updates Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox