aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sony-laptop.c
diff options
context:
space:
mode:
authormalattia@linux.it <malattia@linux.it>2007-04-28 10:21:42 -0400
committerLen Brown <len.brown@intel.com>2007-04-28 22:05:55 -0400
commit9476cdfae61a3c3fa61d06c18dd002b03671ca9f (patch)
tree1e6c02e7bb158f85ae297ffa61b6ccf67b4a94df /drivers/misc/sony-laptop.c
parent9f9f0761712928768198278c6cbc5cafe5502d38 (diff)
sony-laptop: add edge modem support (also called WWAN)
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> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/sony-laptop.c')
-rw-r--r--drivers/misc/sony-laptop.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 56413435c531..141284dee1a1 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -923,6 +923,7 @@ struct sony_pic_dev {
923 int model; 923 int model;
924 u8 camera_power; 924 u8 camera_power;
925 u8 bluetooth_power; 925 u8 bluetooth_power;
926 u8 wwan_power;
926 struct acpi_device *acpi_dev; 927 struct acpi_device *acpi_dev;
927 struct sony_pic_irq *cur_irq; 928 struct sony_pic_irq *cur_irq;
928 struct sony_pic_ioport *cur_ioport; 929 struct sony_pic_ioport *cur_ioport;
@@ -1330,6 +1331,44 @@ static ssize_t sony_pic_camerapower_show(struct device *dev,
1330 return count; 1331 return count;
1331} 1332}
1332 1333
1334/* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */
1335static void sony_pic_set_wwanpower(u8 state)
1336{
1337 state = !!state;
1338 mutex_lock(&spic_dev.lock);
1339 if (spic_dev.wwan_power == state) {
1340 mutex_unlock(&spic_dev.lock);
1341 return;
1342 }
1343 sony_pic_call2(0xB0, state);
1344 spic_dev.wwan_power = state;
1345 mutex_unlock(&spic_dev.lock);
1346}
1347
1348static ssize_t sony_pic_wwanpower_store(struct device *dev,
1349 struct device_attribute *attr,
1350 const char *buffer, size_t count)
1351{
1352 unsigned long value;
1353 if (count > 31)
1354 return -EINVAL;
1355
1356 value = simple_strtoul(buffer, NULL, 10);
1357 sony_pic_set_wwanpower(value);
1358
1359 return count;
1360}
1361
1362static ssize_t sony_pic_wwanpower_show(struct device *dev,
1363 struct device_attribute *attr, char *buffer)
1364{
1365 ssize_t count;
1366 mutex_lock(&spic_dev.lock);
1367 count = snprintf(buffer, PAGE_SIZE, "%d\n", spic_dev.wwan_power);
1368 mutex_unlock(&spic_dev.lock);
1369 return count;
1370}
1371
1333/* bluetooth subsystem power state */ 1372/* bluetooth subsystem power state */
1334static void __sony_pic_set_bluetoothpower(u8 state) 1373static void __sony_pic_set_bluetoothpower(u8 state)
1335{ 1374{
@@ -1412,11 +1451,13 @@ struct device_attribute spic_attr_##_name = __ATTR(_name, \
1412 1451
1413static SPIC_ATTR(camerapower, 0644); 1452static SPIC_ATTR(camerapower, 0644);
1414static SPIC_ATTR(bluetoothpower, 0644); 1453static SPIC_ATTR(bluetoothpower, 0644);
1454static SPIC_ATTR(wwanpower, 0644);
1415static SPIC_ATTR(fanspeed, 0644); 1455static SPIC_ATTR(fanspeed, 0644);
1416 1456
1417static struct attribute *spic_attributes[] = { 1457static struct attribute *spic_attributes[] = {
1418 &spic_attr_camerapower.attr, 1458 &spic_attr_camerapower.attr,
1419 &spic_attr_bluetoothpower.attr, 1459 &spic_attr_bluetoothpower.attr,
1460 &spic_attr_wwanpower.attr,
1420 &spic_attr_fanspeed.attr, 1461 &spic_attr_fanspeed.attr,
1421 NULL 1462 NULL
1422}; 1463};