Lines 78-84
static struct platform_driver platform_driver = {
Link Here
|
78 |
} |
78 |
} |
79 |
}; |
79 |
}; |
80 |
|
80 |
|
81 |
static struct calling_interface_buffer *buffer; |
|
|
82 |
static struct platform_device *platform_device; |
81 |
static struct platform_device *platform_device; |
83 |
static struct backlight_device *dell_backlight_device; |
82 |
static struct backlight_device *dell_backlight_device; |
84 |
static struct rfkill *wifi_rfkill; |
83 |
static struct rfkill *wifi_rfkill; |
Lines 286-292
static const struct dmi_system_id dell_quirks[] __initconst = {
Link Here
|
286 |
{ } |
285 |
{ } |
287 |
}; |
286 |
}; |
288 |
|
287 |
|
289 |
void dell_set_arguments(u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
288 |
static void dell_fill_request(struct calling_interface_buffer *buffer, |
|
|
289 |
u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
290 |
{ |
290 |
{ |
291 |
memset(buffer, 0, sizeof(struct calling_interface_buffer)); |
291 |
memset(buffer, 0, sizeof(struct calling_interface_buffer)); |
292 |
buffer->input[0] = arg0; |
292 |
buffer->input[0] = arg0; |
Lines 295-301
void dell_set_arguments(u32 arg0, u32 arg1, u32 arg2, u32 arg3)
Link Here
|
295 |
buffer->input[3] = arg3; |
295 |
buffer->input[3] = arg3; |
296 |
} |
296 |
} |
297 |
|
297 |
|
298 |
int dell_send_request(u16 class, u16 select) |
298 |
static int dell_send_request(struct calling_interface_buffer *buffer, |
|
|
299 |
u16 class, u16 select) |
299 |
{ |
300 |
{ |
300 |
int ret; |
301 |
int ret; |
301 |
|
302 |
|
Lines 432-452
static int dell_rfkill_set(void *data, bool blocked)
Link Here
|
432 |
int disable = blocked ? 1 : 0; |
433 |
int disable = blocked ? 1 : 0; |
433 |
unsigned long radio = (unsigned long)data; |
434 |
unsigned long radio = (unsigned long)data; |
434 |
int hwswitch_bit = (unsigned long)data - 1; |
435 |
int hwswitch_bit = (unsigned long)data - 1; |
|
|
436 |
struct calling_interface_buffer buffer; |
435 |
int hwswitch; |
437 |
int hwswitch; |
436 |
int status; |
438 |
int status; |
437 |
int ret; |
439 |
int ret; |
438 |
|
440 |
|
439 |
dell_set_arguments(0, 0, 0, 0); |
441 |
dell_fill_request(&buffer, 0, 0, 0, 0); |
440 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
442 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
441 |
if (ret) |
443 |
if (ret) |
442 |
return ret; |
444 |
return ret; |
443 |
status = buffer->output[1]; |
445 |
status = buffer.output[1]; |
444 |
|
446 |
|
445 |
dell_set_arguments(0x2, 0, 0, 0); |
447 |
dell_fill_request(&buffer, 0x2, 0, 0, 0); |
446 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
448 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
447 |
if (ret) |
449 |
if (ret) |
448 |
return ret; |
450 |
return ret; |
449 |
hwswitch = buffer->output[1]; |
451 |
hwswitch = buffer.output[1]; |
450 |
|
452 |
|
451 |
/* If the hardware switch controls this radio, and the hardware |
453 |
/* If the hardware switch controls this radio, and the hardware |
452 |
switch is disabled, always disable the radio */ |
454 |
switch is disabled, always disable the radio */ |
Lines 454-461
static int dell_rfkill_set(void *data, bool blocked)
Link Here
|
454 |
(status & BIT(0)) && !(status & BIT(16))) |
456 |
(status & BIT(0)) && !(status & BIT(16))) |
455 |
disable = 1; |
457 |
disable = 1; |
456 |
|
458 |
|
457 |
dell_set_arguments(1 | (radio<<8) | (disable << 16), 0, 0, 0); |
459 |
dell_fill_request(&buffer, 1 | (radio<<8) | (disable << 16), 0, 0, 0); |
458 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
460 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
459 |
return ret; |
461 |
return ret; |
460 |
} |
462 |
} |
461 |
|
463 |
|
Lines 464-472
static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio,
Link Here
|
464 |
{ |
466 |
{ |
465 |
if (status & BIT(0)) { |
467 |
if (status & BIT(0)) { |
466 |
/* Has hw-switch, sync sw_state to BIOS */ |
468 |
/* Has hw-switch, sync sw_state to BIOS */ |
|
|
469 |
struct calling_interface_buffer buffer; |
467 |
int block = rfkill_blocked(rfkill); |
470 |
int block = rfkill_blocked(rfkill); |
468 |
dell_set_arguments(1 | (radio << 8) | (block << 16), 0, 0, 0); |
471 |
dell_fill_request(&buffer, |
469 |
dell_send_request(CLASS_INFO, SELECT_RFKILL); |
472 |
1 | (radio << 8) | (block << 16), 0, 0, 0); |
|
|
473 |
dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
470 |
} else { |
474 |
} else { |
471 |
/* No hw-switch, sync BIOS state to sw_state */ |
475 |
/* No hw-switch, sync BIOS state to sw_state */ |
472 |
rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16))); |
476 |
rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16))); |
Lines 483-503
static void dell_rfkill_update_hw_state(struct rfkill *rfkill, int radio,
Link Here
|
483 |
static void dell_rfkill_query(struct rfkill *rfkill, void *data) |
487 |
static void dell_rfkill_query(struct rfkill *rfkill, void *data) |
484 |
{ |
488 |
{ |
485 |
int radio = ((unsigned long)data & 0xF); |
489 |
int radio = ((unsigned long)data & 0xF); |
|
|
490 |
struct calling_interface_buffer buffer; |
486 |
int hwswitch; |
491 |
int hwswitch; |
487 |
int status; |
492 |
int status; |
488 |
int ret; |
493 |
int ret; |
489 |
|
494 |
|
490 |
dell_set_arguments(0, 0, 0, 0); |
495 |
dell_fill_request(&buffer, 0, 0, 0, 0); |
491 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
496 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
492 |
status = buffer->output[1]; |
497 |
status = buffer.output[1]; |
493 |
|
498 |
|
494 |
if (ret != 0 || !(status & BIT(0))) { |
499 |
if (ret != 0 || !(status & BIT(0))) { |
495 |
return; |
500 |
return; |
496 |
} |
501 |
} |
497 |
|
502 |
|
498 |
dell_set_arguments(0, 0x2, 0, 0); |
503 |
dell_fill_request(&buffer, 0, 0x2, 0, 0); |
499 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
504 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
500 |
hwswitch = buffer->output[1]; |
505 |
hwswitch = buffer.output[1]; |
501 |
|
506 |
|
502 |
if (ret != 0) |
507 |
if (ret != 0) |
503 |
return; |
508 |
return; |
Lines 514-535
static struct dentry *dell_laptop_dir;
Link Here
|
514 |
|
519 |
|
515 |
static int dell_debugfs_show(struct seq_file *s, void *data) |
520 |
static int dell_debugfs_show(struct seq_file *s, void *data) |
516 |
{ |
521 |
{ |
|
|
522 |
struct calling_interface_buffer buffer; |
517 |
int hwswitch_state; |
523 |
int hwswitch_state; |
518 |
int hwswitch_ret; |
524 |
int hwswitch_ret; |
519 |
int status; |
525 |
int status; |
520 |
int ret; |
526 |
int ret; |
521 |
|
527 |
|
522 |
dell_set_arguments(0, 0, 0, 0); |
528 |
dell_fill_request(&buffer, 0, 0, 0, 0); |
523 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
529 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
524 |
if (ret) |
530 |
if (ret) |
525 |
return ret; |
531 |
return ret; |
526 |
status = buffer->output[1]; |
532 |
status = buffer.output[1]; |
527 |
|
533 |
|
528 |
dell_set_arguments(0, 0x2, 0, 0); |
534 |
dell_fill_request(&buffer, 0, 0x2, 0, 0); |
529 |
hwswitch_ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
535 |
hwswitch_ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
530 |
if (hwswitch_ret) |
536 |
if (hwswitch_ret) |
531 |
return hwswitch_ret; |
537 |
return hwswitch_ret; |
532 |
hwswitch_state = buffer->output[1]; |
538 |
hwswitch_state = buffer.output[1]; |
533 |
|
539 |
|
534 |
seq_printf(s, "return:\t%d\n", ret); |
540 |
seq_printf(s, "return:\t%d\n", ret); |
535 |
seq_printf(s, "status:\t0x%X\n", status); |
541 |
seq_printf(s, "status:\t0x%X\n", status); |
Lines 610-631
static const struct file_operations dell_debugfs_fops = {
Link Here
|
610 |
|
616 |
|
611 |
static void dell_update_rfkill(struct work_struct *ignored) |
617 |
static void dell_update_rfkill(struct work_struct *ignored) |
612 |
{ |
618 |
{ |
|
|
619 |
struct calling_interface_buffer buffer; |
613 |
int hwswitch = 0; |
620 |
int hwswitch = 0; |
614 |
int status; |
621 |
int status; |
615 |
int ret; |
622 |
int ret; |
616 |
|
623 |
|
617 |
dell_set_arguments(0, 0, 0, 0); |
624 |
dell_fill_request(&buffer, 0, 0, 0, 0); |
618 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
625 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
619 |
status = buffer->output[1]; |
626 |
status = buffer.output[1]; |
620 |
|
627 |
|
621 |
if (ret != 0) |
628 |
if (ret != 0) |
622 |
return; |
629 |
return; |
623 |
|
630 |
|
624 |
dell_set_arguments(0, 0x2, 0, 0); |
631 |
dell_fill_request(&buffer, 0, 0x2, 0, 0); |
625 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
632 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
626 |
|
633 |
|
627 |
if (ret == 0 && (status & BIT(0))) |
634 |
if (ret == 0 && (status & BIT(0))) |
628 |
hwswitch = buffer->output[1]; |
635 |
hwswitch = buffer.output[1]; |
629 |
|
636 |
|
630 |
if (wifi_rfkill) { |
637 |
if (wifi_rfkill) { |
631 |
dell_rfkill_update_hw_state(wifi_rfkill, 1, status, hwswitch); |
638 |
dell_rfkill_update_hw_state(wifi_rfkill, 1, status, hwswitch); |
Lines 683-688
static struct notifier_block dell_laptop_rbtn_notifier = {
Link Here
|
683 |
|
690 |
|
684 |
static int __init dell_setup_rfkill(void) |
691 |
static int __init dell_setup_rfkill(void) |
685 |
{ |
692 |
{ |
|
|
693 |
struct calling_interface_buffer buffer; |
686 |
int status, ret, whitelisted; |
694 |
int status, ret, whitelisted; |
687 |
const char *product; |
695 |
const char *product; |
688 |
|
696 |
|
Lines 698-706
static int __init dell_setup_rfkill(void)
Link Here
|
698 |
if (!force_rfkill && !whitelisted) |
706 |
if (!force_rfkill && !whitelisted) |
699 |
return 0; |
707 |
return 0; |
700 |
|
708 |
|
701 |
dell_set_arguments(0, 0, 0, 0); |
709 |
dell_fill_request(&buffer, 0, 0, 0, 0); |
702 |
ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
710 |
ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
703 |
status = buffer->output[1]; |
711 |
status = buffer.output[1]; |
704 |
|
712 |
|
705 |
/* dell wireless info smbios call is not supported */ |
713 |
/* dell wireless info smbios call is not supported */ |
706 |
if (ret != 0) |
714 |
if (ret != 0) |
Lines 853-858
static void dell_cleanup_rfkill(void)
Link Here
|
853 |
|
861 |
|
854 |
static int dell_send_intensity(struct backlight_device *bd) |
862 |
static int dell_send_intensity(struct backlight_device *bd) |
855 |
{ |
863 |
{ |
|
|
864 |
struct calling_interface_buffer buffer; |
856 |
struct calling_interface_token *token; |
865 |
struct calling_interface_token *token; |
857 |
int ret; |
866 |
int ret; |
858 |
|
867 |
|
Lines 860-876
static int dell_send_intensity(struct backlight_device *bd)
Link Here
|
860 |
if (!token) |
869 |
if (!token) |
861 |
return -ENODEV; |
870 |
return -ENODEV; |
862 |
|
871 |
|
863 |
dell_set_arguments(token->location, bd->props.brightness, 0, 0); |
872 |
dell_fill_request(&buffer, |
|
|
873 |
token->location, bd->props.brightness, 0, 0); |
864 |
if (power_supply_is_system_supplied() > 0) |
874 |
if (power_supply_is_system_supplied() > 0) |
865 |
ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_AC); |
875 |
ret = dell_send_request(&buffer, |
|
|
876 |
CLASS_TOKEN_WRITE, SELECT_TOKEN_AC); |
866 |
else |
877 |
else |
867 |
ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_BAT); |
878 |
ret = dell_send_request(&buffer, |
|
|
879 |
CLASS_TOKEN_WRITE, SELECT_TOKEN_BAT); |
868 |
|
880 |
|
869 |
return ret; |
881 |
return ret; |
870 |
} |
882 |
} |
871 |
|
883 |
|
872 |
static int dell_get_intensity(struct backlight_device *bd) |
884 |
static int dell_get_intensity(struct backlight_device *bd) |
873 |
{ |
885 |
{ |
|
|
886 |
struct calling_interface_buffer buffer; |
874 |
struct calling_interface_token *token; |
887 |
struct calling_interface_token *token; |
875 |
int ret; |
888 |
int ret; |
876 |
|
889 |
|
Lines 878-891
static int dell_get_intensity(struct backlight_device *bd)
Link Here
|
878 |
if (!token) |
891 |
if (!token) |
879 |
return -ENODEV; |
892 |
return -ENODEV; |
880 |
|
893 |
|
881 |
dell_set_arguments(token->location, 0, 0, 0); |
894 |
dell_fill_request(&buffer, token->location, 0, 0, 0); |
882 |
if (power_supply_is_system_supplied() > 0) |
895 |
if (power_supply_is_system_supplied() > 0) |
883 |
ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
896 |
ret = dell_send_request(&buffer, |
|
|
897 |
CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
884 |
else |
898 |
else |
885 |
ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_BAT); |
899 |
ret = dell_send_request(&buffer, |
|
|
900 |
CLASS_TOKEN_READ, SELECT_TOKEN_BAT); |
886 |
|
901 |
|
887 |
if (ret == 0) |
902 |
if (ret == 0) |
888 |
ret = buffer->output[1]; |
903 |
ret = buffer.output[1]; |
|
|
904 |
|
889 |
return ret; |
905 |
return ret; |
890 |
} |
906 |
} |
891 |
|
907 |
|
Lines 1149-1179
static DEFINE_MUTEX(kbd_led_mutex);
Link Here
|
1149 |
|
1165 |
|
1150 |
static int kbd_get_info(struct kbd_info *info) |
1166 |
static int kbd_get_info(struct kbd_info *info) |
1151 |
{ |
1167 |
{ |
|
|
1168 |
struct calling_interface_buffer buffer; |
1152 |
u8 units; |
1169 |
u8 units; |
1153 |
int ret; |
1170 |
int ret; |
1154 |
|
1171 |
|
1155 |
dell_set_arguments(0, 0, 0, 0); |
1172 |
dell_fill_request(&buffer, 0, 0, 0, 0); |
1156 |
ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
1173 |
ret = dell_send_request(&buffer, |
|
|
1174 |
CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
1157 |
if (ret) |
1175 |
if (ret) |
1158 |
return ret; |
1176 |
return ret; |
1159 |
|
1177 |
|
1160 |
info->modes = buffer->output[1] & 0xFFFF; |
1178 |
info->modes = buffer.output[1] & 0xFFFF; |
1161 |
info->type = (buffer->output[1] >> 24) & 0xFF; |
1179 |
info->type = (buffer.output[1] >> 24) & 0xFF; |
1162 |
info->triggers = buffer->output[2] & 0xFF; |
1180 |
info->triggers = buffer.output[2] & 0xFF; |
1163 |
units = (buffer->output[2] >> 8) & 0xFF; |
1181 |
units = (buffer.output[2] >> 8) & 0xFF; |
1164 |
info->levels = (buffer->output[2] >> 16) & 0xFF; |
1182 |
info->levels = (buffer.output[2] >> 16) & 0xFF; |
1165 |
|
1183 |
|
1166 |
if (quirks && quirks->kbd_led_levels_off_1 && info->levels) |
1184 |
if (quirks && quirks->kbd_led_levels_off_1 && info->levels) |
1167 |
info->levels--; |
1185 |
info->levels--; |
1168 |
|
1186 |
|
1169 |
if (units & BIT(0)) |
1187 |
if (units & BIT(0)) |
1170 |
info->seconds = (buffer->output[3] >> 0) & 0xFF; |
1188 |
info->seconds = (buffer.output[3] >> 0) & 0xFF; |
1171 |
if (units & BIT(1)) |
1189 |
if (units & BIT(1)) |
1172 |
info->minutes = (buffer->output[3] >> 8) & 0xFF; |
1190 |
info->minutes = (buffer.output[3] >> 8) & 0xFF; |
1173 |
if (units & BIT(2)) |
1191 |
if (units & BIT(2)) |
1174 |
info->hours = (buffer->output[3] >> 16) & 0xFF; |
1192 |
info->hours = (buffer.output[3] >> 16) & 0xFF; |
1175 |
if (units & BIT(3)) |
1193 |
if (units & BIT(3)) |
1176 |
info->days = (buffer->output[3] >> 24) & 0xFF; |
1194 |
info->days = (buffer.output[3] >> 24) & 0xFF; |
1177 |
|
1195 |
|
1178 |
return ret; |
1196 |
return ret; |
1179 |
} |
1197 |
} |
Lines 1233-1263
static int kbd_set_level(struct kbd_state *state, u8 level)
Link Here
|
1233 |
|
1251 |
|
1234 |
static int kbd_get_state(struct kbd_state *state) |
1252 |
static int kbd_get_state(struct kbd_state *state) |
1235 |
{ |
1253 |
{ |
|
|
1254 |
struct calling_interface_buffer buffer; |
1236 |
int ret; |
1255 |
int ret; |
1237 |
|
1256 |
|
1238 |
dell_set_arguments(0x1, 0, 0, 0); |
1257 |
dell_fill_request(&buffer, 0, 0, 0, 0); |
1239 |
ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
1258 |
ret = dell_send_request(&buffer, |
|
|
1259 |
CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
1240 |
if (ret) |
1260 |
if (ret) |
1241 |
return ret; |
1261 |
return ret; |
1242 |
|
1262 |
|
1243 |
state->mode_bit = ffs(buffer->output[1] & 0xFFFF); |
1263 |
state->mode_bit = ffs(buffer.output[1] & 0xFFFF); |
1244 |
if (state->mode_bit != 0) |
1264 |
if (state->mode_bit != 0) |
1245 |
state->mode_bit--; |
1265 |
state->mode_bit--; |
1246 |
|
1266 |
|
1247 |
state->triggers = (buffer->output[1] >> 16) & 0xFF; |
1267 |
state->triggers = (buffer.output[1] >> 16) & 0xFF; |
1248 |
state->timeout_value = (buffer->output[1] >> 24) & 0x3F; |
1268 |
state->timeout_value = (buffer.output[1] >> 24) & 0x3F; |
1249 |
state->timeout_unit = (buffer->output[1] >> 30) & 0x3; |
1269 |
state->timeout_unit = (buffer.output[1] >> 30) & 0x3; |
1250 |
state->als_setting = buffer->output[2] & 0xFF; |
1270 |
state->als_setting = buffer.output[2] & 0xFF; |
1251 |
state->als_value = (buffer->output[2] >> 8) & 0xFF; |
1271 |
state->als_value = (buffer.output[2] >> 8) & 0xFF; |
1252 |
state->level = (buffer->output[2] >> 16) & 0xFF; |
1272 |
state->level = (buffer.output[2] >> 16) & 0xFF; |
1253 |
state->timeout_value_ac = (buffer->output[2] >> 24) & 0x3F; |
1273 |
state->timeout_value_ac = (buffer.output[2] >> 24) & 0x3F; |
1254 |
state->timeout_unit_ac = (buffer->output[2] >> 30) & 0x3; |
1274 |
state->timeout_unit_ac = (buffer.output[2] >> 30) & 0x3; |
1255 |
|
1275 |
|
1256 |
return ret; |
1276 |
return ret; |
1257 |
} |
1277 |
} |
1258 |
|
1278 |
|
1259 |
static int kbd_set_state(struct kbd_state *state) |
1279 |
static int kbd_set_state(struct kbd_state *state) |
1260 |
{ |
1280 |
{ |
|
|
1281 |
struct calling_interface_buffer buffer; |
1261 |
int ret; |
1282 |
int ret; |
1262 |
u32 input1; |
1283 |
u32 input1; |
1263 |
u32 input2; |
1284 |
u32 input2; |
Lines 1270-1277
static int kbd_set_state(struct kbd_state *state)
Link Here
|
1270 |
input2 |= (state->level & 0xFF) << 16; |
1291 |
input2 |= (state->level & 0xFF) << 16; |
1271 |
input2 |= (state->timeout_value_ac & 0x3F) << 24; |
1292 |
input2 |= (state->timeout_value_ac & 0x3F) << 24; |
1272 |
input2 |= (state->timeout_unit_ac & 0x3) << 30; |
1293 |
input2 |= (state->timeout_unit_ac & 0x3) << 30; |
1273 |
dell_set_arguments(0x2, input1, input2, 0); |
1294 |
dell_fill_request(&buffer, 0x2, input1, input2, 0); |
1274 |
ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
1295 |
ret = dell_send_request(&buffer, |
|
|
1296 |
CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
1275 |
|
1297 |
|
1276 |
return ret; |
1298 |
return ret; |
1277 |
} |
1299 |
} |
Lines 1298-1303
static int kbd_set_state_safe(struct kbd_state *state, struct kbd_state *old)
Link Here
|
1298 |
|
1320 |
|
1299 |
static int kbd_set_token_bit(u8 bit) |
1321 |
static int kbd_set_token_bit(u8 bit) |
1300 |
{ |
1322 |
{ |
|
|
1323 |
struct calling_interface_buffer buffer; |
1301 |
struct calling_interface_token *token; |
1324 |
struct calling_interface_token *token; |
1302 |
int ret; |
1325 |
int ret; |
1303 |
|
1326 |
|
Lines 1308-1321
static int kbd_set_token_bit(u8 bit)
Link Here
|
1308 |
if (!token) |
1331 |
if (!token) |
1309 |
return -EINVAL; |
1332 |
return -EINVAL; |
1310 |
|
1333 |
|
1311 |
dell_set_arguments(token->location, token->value, 0, 0); |
1334 |
dell_fill_request(&buffer, token->location, token->value, 0, 0); |
1312 |
ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
1335 |
ret = dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
1313 |
|
1336 |
|
1314 |
return ret; |
1337 |
return ret; |
1315 |
} |
1338 |
} |
1316 |
|
1339 |
|
1317 |
static int kbd_get_token_bit(u8 bit) |
1340 |
static int kbd_get_token_bit(u8 bit) |
1318 |
{ |
1341 |
{ |
|
|
1342 |
struct calling_interface_buffer buffer; |
1319 |
struct calling_interface_token *token; |
1343 |
struct calling_interface_token *token; |
1320 |
int ret; |
1344 |
int ret; |
1321 |
int val; |
1345 |
int val; |
Lines 1327-1335
static int kbd_get_token_bit(u8 bit)
Link Here
|
1327 |
if (!token) |
1351 |
if (!token) |
1328 |
return -EINVAL; |
1352 |
return -EINVAL; |
1329 |
|
1353 |
|
1330 |
dell_set_arguments(token->location, 0, 0, 0); |
1354 |
dell_fill_request(&buffer, token->location, 0, 0, 0); |
1331 |
ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_STD); |
1355 |
ret = dell_send_request(&buffer, CLASS_TOKEN_READ, SELECT_TOKEN_STD); |
1332 |
val = buffer->output[1]; |
1356 |
val = buffer.output[1]; |
1333 |
|
1357 |
|
1334 |
if (ret) |
1358 |
if (ret) |
1335 |
return ret; |
1359 |
return ret; |
Lines 2046-2051
static struct notifier_block dell_laptop_notifier = {
Link Here
|
2046 |
|
2070 |
|
2047 |
int dell_micmute_led_set(int state) |
2071 |
int dell_micmute_led_set(int state) |
2048 |
{ |
2072 |
{ |
|
|
2073 |
struct calling_interface_buffer buffer; |
2049 |
struct calling_interface_token *token; |
2074 |
struct calling_interface_token *token; |
2050 |
|
2075 |
|
2051 |
if (state == 0) |
2076 |
if (state == 0) |
Lines 2058-2065
int dell_micmute_led_set(int state)
Link Here
|
2058 |
if (!token) |
2083 |
if (!token) |
2059 |
return -ENODEV; |
2084 |
return -ENODEV; |
2060 |
|
2085 |
|
2061 |
dell_set_arguments(token->location, token->value, 0, 0); |
2086 |
dell_fill_request(&buffer, token->location, token->value, 0, 0); |
2062 |
dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
2087 |
dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
2063 |
|
2088 |
|
2064 |
return state; |
2089 |
return state; |
2065 |
} |
2090 |
} |
Lines 2090-2102
static int __init dell_init(void)
Link Here
|
2090 |
if (ret) |
2115 |
if (ret) |
2091 |
goto fail_platform_device2; |
2116 |
goto fail_platform_device2; |
2092 |
|
2117 |
|
2093 |
buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL); |
|
|
2094 |
if (!buffer) { |
2095 |
ret = -ENOMEM; |
2096 |
goto fail_buffer; |
2097 |
} |
2098 |
|
2099 |
|
2100 |
ret = dell_setup_rfkill(); |
2118 |
ret = dell_setup_rfkill(); |
2101 |
|
2119 |
|
2102 |
if (ret) { |
2120 |
if (ret) { |
Lines 2121-2130
static int __init dell_init(void)
Link Here
|
2121 |
|
2139 |
|
2122 |
token = dell_smbios_find_token(BRIGHTNESS_TOKEN); |
2140 |
token = dell_smbios_find_token(BRIGHTNESS_TOKEN); |
2123 |
if (token) { |
2141 |
if (token) { |
2124 |
dell_set_arguments(token->location, 0, 0, 0); |
2142 |
struct calling_interface_buffer buffer; |
2125 |
ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
2143 |
|
|
|
2144 |
dell_fill_request(&buffer, token->location, 0, 0, 0); |
2145 |
ret = dell_send_request(&buffer, |
2146 |
CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
2126 |
if (ret) |
2147 |
if (ret) |
2127 |
max_intensity = buffer->output[3]; |
2148 |
max_intensity = buffer.output[3]; |
2128 |
} |
2149 |
} |
2129 |
|
2150 |
|
2130 |
if (max_intensity) { |
2151 |
if (max_intensity) { |
Lines 2158-2165
static int __init dell_init(void)
Link Here
|
2158 |
fail_get_brightness: |
2179 |
fail_get_brightness: |
2159 |
backlight_device_unregister(dell_backlight_device); |
2180 |
backlight_device_unregister(dell_backlight_device); |
2160 |
fail_backlight: |
2181 |
fail_backlight: |
2161 |
kfree(buffer); |
|
|
2162 |
fail_buffer: |
2163 |
dell_cleanup_rfkill(); |
2182 |
dell_cleanup_rfkill(); |
2164 |
fail_rfkill: |
2183 |
fail_rfkill: |
2165 |
platform_device_del(platform_device); |
2184 |
platform_device_del(platform_device); |
Lines 2179-2185
static void __exit dell_exit(void)
Link Here
|
2179 |
touchpad_led_exit(); |
2198 |
touchpad_led_exit(); |
2180 |
kbd_led_exit(); |
2199 |
kbd_led_exit(); |
2181 |
backlight_device_unregister(dell_backlight_device); |
2200 |
backlight_device_unregister(dell_backlight_device); |
2182 |
kfree(buffer); |
|
|
2183 |
dell_cleanup_rfkill(); |
2201 |
dell_cleanup_rfkill(); |
2184 |
if (platform_device) { |
2202 |
if (platform_device) { |
2185 |
platform_device_unregister(platform_device); |
2203 |
platform_device_unregister(platform_device); |