public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: malattia@linux.it
To: lenb@kernel.org
Cc: linux-acpi@vger.kernel.org, Stelian Pop <stelian@popies.net>,
	Mattia Dongili <malattia@linux.it>
Subject: [patch 3/9 v2] sony-laptop: add edge modem support (also called WWAN)
Date: Sat, 28 Apr 2007 23:21:42 +0900	[thread overview]
Message-ID: <20070428142142.GC5293@inferi.kami.home> (raw)
In-Reply-To: 20070428141557.GA4764@inferi.kami.home

[-- 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!

  parent reply	other threads:[~2007-04-28 14:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20070428142142.GC5293@inferi.kami.home \
    --to=malattia@linux.it \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=stelian@popies.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox