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>
This commit is contained in:
parent
aa33924f35
commit
a1e7363240
1 changed files with 33 additions and 18 deletions
|
@ -170,7 +170,8 @@ enum sony_nc_rfkill {
|
||||||
static int sony_rfkill_handle;
|
static int sony_rfkill_handle;
|
||||||
static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL];
|
static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL];
|
||||||
static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900};
|
static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900};
|
||||||
static void sony_nc_rfkill_setup(struct acpi_device *device);
|
static int sony_nc_rfkill_setup(struct acpi_device *device,
|
||||||
|
unsigned int handle);
|
||||||
static void sony_nc_rfkill_cleanup(void);
|
static void sony_nc_rfkill_cleanup(void);
|
||||||
static void sony_nc_rfkill_update(void);
|
static void sony_nc_rfkill_update(void);
|
||||||
|
|
||||||
|
@ -1313,7 +1314,10 @@ static void sony_nc_function_setup(struct acpi_device *device,
|
||||||
break;
|
break;
|
||||||
case 0x0124:
|
case 0x0124:
|
||||||
case 0x0135:
|
case 0x0135:
|
||||||
sony_nc_rfkill_setup(device);
|
result = sony_nc_rfkill_setup(device, handle);
|
||||||
|
if (result)
|
||||||
|
pr_err("couldn't set up rfkill support (%d)\n",
|
||||||
|
result);
|
||||||
break;
|
break;
|
||||||
case 0x0137:
|
case 0x0137:
|
||||||
case 0x0143:
|
case 0x0143:
|
||||||
|
@ -1577,37 +1581,46 @@ static void sony_nc_rfkill_update(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sony_nc_rfkill_setup(struct acpi_device *device)
|
static int sony_nc_rfkill_setup(struct acpi_device *device,
|
||||||
|
unsigned int handle)
|
||||||
{
|
{
|
||||||
u64 offset;
|
u64 offset;
|
||||||
int i;
|
int i;
|
||||||
unsigned char buffer[32] = { 0 };
|
unsigned char buffer[32] = { 0 };
|
||||||
|
|
||||||
offset = sony_find_snc_handle(0x124);
|
offset = sony_find_snc_handle(handle);
|
||||||
if (offset == -1) {
|
sony_rfkill_handle = handle;
|
||||||
offset = sony_find_snc_handle(0x135);
|
|
||||||
if (offset == -1)
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
sony_rfkill_handle = 0x135;
|
|
||||||
} else
|
|
||||||
sony_rfkill_handle = 0x124;
|
|
||||||
dprintk("Found rkfill handle: 0x%.4x\n", sony_rfkill_handle);
|
|
||||||
|
|
||||||
i = sony_nc_buffer_call(sony_nc_acpi_handle, "SN06", &offset, buffer,
|
i = sony_nc_buffer_call(sony_nc_acpi_handle, "SN06", &offset, buffer,
|
||||||
32);
|
32);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return;
|
return i;
|
||||||
|
|
||||||
/* the buffer is filled with magic numbers describing the devices
|
/* The buffer is filled with magic numbers describing the devices
|
||||||
* available, 0xff terminates the enumeration
|
* available, 0xff terminates the enumeration.
|
||||||
|
* Known codes:
|
||||||
|
* 0x00 WLAN
|
||||||
|
* 0x10 BLUETOOTH
|
||||||
|
* 0x20 WWAN GPRS-EDGE
|
||||||
|
* 0x21 WWAN HSDPA
|
||||||
|
* 0x22 WWAN EV-DO
|
||||||
|
* 0x23 WWAN GPS
|
||||||
|
* 0x25 Gobi WWAN no GPS
|
||||||
|
* 0x26 Gobi WWAN + GPS
|
||||||
|
* 0x28 Gobi WWAN no GPS
|
||||||
|
* 0x29 Gobi WWAN + GPS
|
||||||
|
* 0x30 WIMAX
|
||||||
|
* 0x50 Gobi WWAN no GPS
|
||||||
|
* 0x51 Gobi WWAN + GPS
|
||||||
|
* 0x70 no SIM card slot
|
||||||
|
* 0x71 SIM card slot
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ARRAY_SIZE(buffer); i++) {
|
for (i = 0; i < ARRAY_SIZE(buffer); i++) {
|
||||||
|
|
||||||
if (buffer[i] == 0xff)
|
if (buffer[i] == 0xff)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
dprintk("Radio devices, looking at 0x%.2x\n", buffer[i]);
|
dprintk("Radio devices, found 0x%.2x\n", buffer[i]);
|
||||||
|
|
||||||
if (buffer[i] == 0 && !sony_rfkill_devices[SONY_WIFI])
|
if (buffer[i] == 0 && !sony_rfkill_devices[SONY_WIFI])
|
||||||
sony_nc_setup_rfkill(device, SONY_WIFI);
|
sony_nc_setup_rfkill(device, SONY_WIFI);
|
||||||
|
@ -1615,13 +1628,15 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
|
||||||
if (buffer[i] == 0x10 && !sony_rfkill_devices[SONY_BLUETOOTH])
|
if (buffer[i] == 0x10 && !sony_rfkill_devices[SONY_BLUETOOTH])
|
||||||
sony_nc_setup_rfkill(device, SONY_BLUETOOTH);
|
sony_nc_setup_rfkill(device, SONY_BLUETOOTH);
|
||||||
|
|
||||||
if ((0xf0 & buffer[i]) == 0x20 &&
|
if (((0xf0 & buffer[i]) == 0x20 ||
|
||||||
|
(0xf0 & buffer[i]) == 0x50) &&
|
||||||
!sony_rfkill_devices[SONY_WWAN])
|
!sony_rfkill_devices[SONY_WWAN])
|
||||||
sony_nc_setup_rfkill(device, SONY_WWAN);
|
sony_nc_setup_rfkill(device, SONY_WWAN);
|
||||||
|
|
||||||
if (buffer[i] == 0x30 && !sony_rfkill_devices[SONY_WIMAX])
|
if (buffer[i] == 0x30 && !sony_rfkill_devices[SONY_WIMAX])
|
||||||
sony_nc_setup_rfkill(device, SONY_WIMAX);
|
sony_nc_setup_rfkill(device, SONY_WIMAX);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keyboard backlight feature */
|
/* Keyboard backlight feature */
|
||||||
|
|
Loading…
Reference in a new issue