diff options
author | Marco Chiappero <marco@absence.it> | 2012-05-19 09:35:57 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2012-05-31 14:34:42 -0400 |
commit | a1e73632408334f619cf94a69b560b74d0a2fadb (patch) | |
tree | db5e2ff42b4b120f517d97978af3307b8461c261 /drivers/platform/x86/sony-laptop.c | |
parent | aa33924f35842cc7544865fd13713d1bb88aee65 (diff) |
sony-laptop: add support for more WWAN modems
Also make the initialization function return a value for consistency
with all the other setup functions.
Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/sony-laptop.c')
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index e0bc418bd22d..6c1cdc39d028 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -170,7 +170,8 @@ enum sony_nc_rfkill { | |||
170 | static int sony_rfkill_handle; | 170 | static int sony_rfkill_handle; |
171 | static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL]; | 171 | static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL]; |
172 | static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900}; | 172 | static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900}; |
173 | static void sony_nc_rfkill_setup(struct acpi_device *device); | 173 | static int sony_nc_rfkill_setup(struct acpi_device *device, |
174 | unsigned int handle); | ||
174 | static void sony_nc_rfkill_cleanup(void); | 175 | static void sony_nc_rfkill_cleanup(void); |
175 | static void sony_nc_rfkill_update(void); | 176 | static void sony_nc_rfkill_update(void); |
176 | 177 | ||
@@ -1313,7 +1314,10 @@ static void sony_nc_function_setup(struct acpi_device *device, | |||
1313 | break; | 1314 | break; |
1314 | case 0x0124: | 1315 | case 0x0124: |
1315 | case 0x0135: | 1316 | case 0x0135: |
1316 | sony_nc_rfkill_setup(device); | 1317 | result = sony_nc_rfkill_setup(device, handle); |
1318 | if (result) | ||
1319 | pr_err("couldn't set up rfkill support (%d)\n", | ||
1320 | result); | ||
1317 | break; | 1321 | break; |
1318 | case 0x0137: | 1322 | case 0x0137: |
1319 | case 0x0143: | 1323 | case 0x0143: |
@@ -1577,37 +1581,46 @@ static void sony_nc_rfkill_update(void) | |||
1577 | } | 1581 | } |
1578 | } | 1582 | } |
1579 | 1583 | ||
1580 | static void sony_nc_rfkill_setup(struct acpi_device *device) | 1584 | static int sony_nc_rfkill_setup(struct acpi_device *device, |
1585 | unsigned int handle) | ||
1581 | { | 1586 | { |
1582 | u64 offset; | 1587 | u64 offset; |
1583 | int i; | 1588 | int i; |
1584 | unsigned char buffer[32] = { 0 }; | 1589 | unsigned char buffer[32] = { 0 }; |
1585 | 1590 | ||
1586 | offset = sony_find_snc_handle(0x124); | 1591 | offset = sony_find_snc_handle(handle); |
1587 | if (offset == -1) { | 1592 | sony_rfkill_handle = handle; |
1588 | offset = sony_find_snc_handle(0x135); | ||
1589 | if (offset == -1) | ||
1590 | return; | ||
1591 | else | ||
1592 | sony_rfkill_handle = 0x135; | ||
1593 | } else | ||
1594 | sony_rfkill_handle = 0x124; | ||
1595 | dprintk("Found rkfill handle: 0x%.4x\n", sony_rfkill_handle); | ||
1596 | 1593 | ||
1597 | i = sony_nc_buffer_call(sony_nc_acpi_handle, "SN06", &offset, buffer, | 1594 | i = sony_nc_buffer_call(sony_nc_acpi_handle, "SN06", &offset, buffer, |
1598 | 32); | 1595 | 32); |
1599 | if (i < 0) | 1596 | if (i < 0) |
1600 | return; | 1597 | return i; |
1601 | 1598 | ||
1602 | /* the buffer is filled with magic numbers describing the devices | 1599 | /* The buffer is filled with magic numbers describing the devices |
1603 | * available, 0xff terminates the enumeration | 1600 | * available, 0xff terminates the enumeration. |
1601 | * Known codes: | ||
1602 | * 0x00 WLAN | ||
1603 | * 0x10 BLUETOOTH | ||
1604 | * 0x20 WWAN GPRS-EDGE | ||
1605 | * 0x21 WWAN HSDPA | ||
1606 | * 0x22 WWAN EV-DO | ||
1607 | * 0x23 WWAN GPS | ||
1608 | * 0x25 Gobi WWAN no GPS | ||
1609 | * 0x26 Gobi WWAN + GPS | ||
1610 | * 0x28 Gobi WWAN no GPS | ||
1611 | * 0x29 Gobi WWAN + GPS | ||
1612 | * 0x30 WIMAX | ||
1613 | * 0x50 Gobi WWAN no GPS | ||
1614 | * 0x51 Gobi WWAN + GPS | ||
1615 | * 0x70 no SIM card slot | ||
1616 | * 0x71 SIM card slot | ||
1604 | */ | 1617 | */ |
1605 | for (i = 0; i < ARRAY_SIZE(buffer); i++) { | 1618 | for (i = 0; i < ARRAY_SIZE(buffer); i++) { |
1606 | 1619 | ||
1607 | if (buffer[i] == 0xff) | 1620 | if (buffer[i] == 0xff) |
1608 | break; | 1621 | break; |
1609 | 1622 | ||
1610 | dprintk("Radio devices, looking at 0x%.2x\n", buffer[i]); | 1623 | dprintk("Radio devices, found 0x%.2x\n", buffer[i]); |
1611 | 1624 | ||
1612 | if (buffer[i] == 0 && !sony_rfkill_devices[SONY_WIFI]) | 1625 | if (buffer[i] == 0 && !sony_rfkill_devices[SONY_WIFI]) |
1613 | sony_nc_setup_rfkill(device, SONY_WIFI); | 1626 | sony_nc_setup_rfkill(device, SONY_WIFI); |
@@ -1615,13 +1628,15 @@ static void sony_nc_rfkill_setup(struct acpi_device *device) | |||
1615 | if (buffer[i] == 0x10 && !sony_rfkill_devices[SONY_BLUETOOTH]) | 1628 | if (buffer[i] == 0x10 && !sony_rfkill_devices[SONY_BLUETOOTH]) |
1616 | sony_nc_setup_rfkill(device, SONY_BLUETOOTH); | 1629 | sony_nc_setup_rfkill(device, SONY_BLUETOOTH); |
1617 | 1630 | ||
1618 | if ((0xf0 & buffer[i]) == 0x20 && | 1631 | if (((0xf0 & buffer[i]) == 0x20 || |
1632 | (0xf0 & buffer[i]) == 0x50) && | ||
1619 | !sony_rfkill_devices[SONY_WWAN]) | 1633 | !sony_rfkill_devices[SONY_WWAN]) |
1620 | sony_nc_setup_rfkill(device, SONY_WWAN); | 1634 | sony_nc_setup_rfkill(device, SONY_WWAN); |
1621 | 1635 | ||
1622 | if (buffer[i] == 0x30 && !sony_rfkill_devices[SONY_WIMAX]) | 1636 | if (buffer[i] == 0x30 && !sony_rfkill_devices[SONY_WIMAX]) |
1623 | sony_nc_setup_rfkill(device, SONY_WIMAX); | 1637 | sony_nc_setup_rfkill(device, SONY_WIMAX); |
1624 | } | 1638 | } |
1639 | return 0; | ||
1625 | } | 1640 | } |
1626 | 1641 | ||
1627 | /* Keyboard backlight feature */ | 1642 | /* Keyboard backlight feature */ |