All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattia Dongili <malattia@linux.it>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, Sergey Yanovich <ynvich@gmail.com>,
	Mattia Dongili <malattia@linux.it>
Subject: [PATCH 6/7] [sony-laptop] add control over wifi power in Sony laptops
Date: Mon,  3 Nov 2008 18:41:19 +0900	[thread overview]
Message-ID: <1225705280-12775-7-git-send-email-malattia@linux.it> (raw)
In-Reply-To: <1225705280-12775-6-git-send-email-malattia@linux.it>

From: Sergey Yanovich <ynvich@gmail.com>

Sony laptops have a single hardware rfkill switch, which controls
several wireless devices: wifi, bluetooth, wwan. The code to
selectively control bluetooth and wwan is already present. This
patch adds handling of wifi.

Signed-off-by: Sergey Yanovich <ynvich@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
 drivers/misc/sony-laptop.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 31f84ce..77fe584 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -1241,6 +1241,7 @@ struct sony_pic_dev {
 	u8			camera_power;
 	u8			bluetooth_power;
 	u8			wwan_power;
+	u8			wifi_power;
 };
 
 static struct sony_pic_dev spic_dev = {
@@ -1806,6 +1807,44 @@ static ssize_t sony_pic_wwanpower_show(struct device *dev,
 	return count;
 }
 
+/* wifi power (TX series) */
+static void sony_pic_set_wifipower(u8 state)
+{
+	state = !!state;
+	mutex_lock(&spic_dev.lock);
+	if (spic_dev.wifi_power == state) {
+		mutex_unlock(&spic_dev.lock);
+		return;
+	}
+	sony_pic_call2(0x98, -state);
+	sony_pic_call1(0x82);
+	spic_dev.wifi_power = state;
+	mutex_unlock(&spic_dev.lock);
+}
+
+static ssize_t sony_pic_wifipower_store(struct device *dev,
+		struct device_attribute *attr,
+		const char *buffer, size_t count)
+{
+	unsigned long value;
+	if (strict_strtoul(buffer, 10, &value))
+		return -EINVAL;
+
+	sony_pic_set_wifipower(value);
+
+	return count;
+}
+
+static ssize_t sony_pic_wifipower_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.wifi_power);
+	mutex_unlock(&spic_dev.lock);
+	return count;
+}
+
 /* bluetooth subsystem power state */
 static void __sony_pic_set_bluetoothpower(u8 state)
 {
@@ -1888,11 +1927,13 @@ struct device_attribute spic_attr_##_name = __ATTR(_name,	\
 
 static SPIC_ATTR(bluetoothpower, 0644);
 static SPIC_ATTR(wwanpower, 0644);
+static SPIC_ATTR(wifipower, 0644);
 static SPIC_ATTR(fanspeed, 0644);
 
 static struct attribute *spic_attributes[] = {
 	&spic_attr_bluetoothpower.attr,
 	&spic_attr_wwanpower.attr,
+	&spic_attr_wifipower.attr,
 	&spic_attr_fanspeed.attr,
 	NULL
 };
-- 
1.5.6.5


  reply	other threads:[~2008-11-03  9:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03  9:41 [PATCH 0/7] sony-laptop for acpi-test Mattia Dongili
2008-11-03  9:41 ` [PATCH 1/7] [sony-laptop] merge Type4 into Type3 Mattia Dongili
2008-11-03  9:41   ` [PATCH 2/7] [sony-laptop] VGN-A317M hotkey support Mattia Dongili
2008-11-03  9:41     ` [PATCH 3/7] [sony-laptop] Eliminate BKL in ioctls Mattia Dongili
2008-11-03  9:41       ` [PATCH 4/7] [sony-laptop] detect the ICH9 chipset as Type3 Mattia Dongili
2008-11-03  9:41         ` [PATCH 5/7] [sony-laptop] call the extra enable function for SNC on Vaio Z Mattia Dongili
2008-11-03  9:41           ` Mattia Dongili [this message]
2008-11-03  9:41             ` [PATCH 7/7] [sony-laptop] notify the hardware of a state change in wwanpower Mattia Dongili
2008-11-03 10:32             ` [PATCH 6/7] [sony-laptop] add control over wifi power in Sony laptops Matthew Garrett
2008-11-03 10:55               ` Sergey Yanovich
2008-11-03 10:57                 ` Matthew Garrett
2008-11-04  8:22         ` [PATCH 4/7] [sony-laptop] detect the ICH9 chipset as Type3 ISHIKAWA Mutsumi
2008-11-04 13:21           ` Mattia Dongili
2008-11-03 11:17 ` [PATCH 0/7] sony-laptop for acpi-test Norbert Preining
2008-11-03 12:48   ` Mattia Dongili
2008-11-03 13:02     ` Norbert Preining

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=1225705280-12775-7-git-send-email-malattia@linux.it \
    --to=malattia@linux.it \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=ynvich@gmail.com \
    /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.