Commit 9476cdfae61a3c3fa61d06c18dd002b03671ca9f

Authored by malattia@linux.it
Committed by Len Brown
1 parent 9f9f076171

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>

Showing 1 changed file with 41 additions and 0 deletions Side-by-side Diff

drivers/misc/sony-laptop.c
... ... @@ -923,6 +923,7 @@
923 923 int model;
924 924 u8 camera_power;
925 925 u8 bluetooth_power;
  926 + u8 wwan_power;
926 927 struct acpi_device *acpi_dev;
927 928 struct sony_pic_irq *cur_irq;
928 929 struct sony_pic_ioport *cur_ioport;
... ... @@ -1330,6 +1331,44 @@
1330 1331 return count;
1331 1332 }
1332 1333  
  1334 +/* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */
  1335 +static 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 +
  1348 +static 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 +
  1362 +static 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 1372 /* bluetooth subsystem power state */
1334 1373 static void __sony_pic_set_bluetoothpower(u8 state)
1335 1374 {
1336 1375  
... ... @@ -1412,11 +1451,13 @@
1412 1451  
1413 1452 static SPIC_ATTR(camerapower, 0644);
1414 1453 static SPIC_ATTR(bluetoothpower, 0644);
  1454 +static SPIC_ATTR(wwanpower, 0644);
1415 1455 static SPIC_ATTR(fanspeed, 0644);
1416 1456  
1417 1457 static struct attribute *spic_attributes[] = {
1418 1458 &spic_attr_camerapower.attr,
1419 1459 &spic_attr_bluetoothpower.attr,
  1460 + &spic_attr_wwanpower.attr,
1420 1461 &spic_attr_fanspeed.attr,
1421 1462 NULL
1422 1463 };