Lines Matching +full:hall +full:- +full:channel

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (C) 2007-2009 Carlos Corbacho <carlos@strangeworlds.co.uk>
8 * Copyright (C) 2005-2007 E.M. Smith
9 * Copyright (C) 2007-2008 Carlos Corbacho <cathectic@gmail.com>
30 #include <linux/input/sparse-keymap.h>
41 * Meaning is unknown - this number is required for writing to ACPI for AMW0
78 #define AMW0_GUID1 "67C3371D-95A3-4C37-BB61-DD47B491DAAB"
79 #define AMW0_GUID2 "431F16ED-0C2B-444C-B267-27DEB140CF9C"
80 #define WMID_GUID1 "6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3"
81 #define WMID_GUID2 "95764E09-FB56-4E83-B31A-37761F60994A"
82 #define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531"
83 #define WMID_GUID4 "7A4DDFE7-5B5D-40B4-8595-4408E0CC7F56"
88 #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026"
90 MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB");
91 MODULE_ALIAS("wmi:6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3");
92 MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026");
186 * Bit[7]: Hall Sensor Application Status
268 static int mailled = -1;
269 static int brightness = -1;
270 static int threeg = -1;
272 static int force_caps = -1;
315 /* Each low-level interface must define at least some of the following */
354 if (quirks->mailled) in set_quirks()
355 interface->capability |= ACER_CAP_MAILLED; in set_quirks()
357 if (quirks->brightness) in set_quirks()
358 interface->capability |= ACER_CAP_BRIGHTNESS; in set_quirks()
360 if (quirks->turbo) in set_quirks()
361 interface->capability |= ACER_CAP_TURBO_OC | ACER_CAP_TURBO_LED in set_quirks()
364 if (quirks->predator_v4) in set_quirks()
365 interface->capability |= ACER_CAP_PLATFORM_PROFILE | in set_quirks()
371 quirks = dmi->driver_data; in dmi_matched()
377 if (force_caps == -1) { in set_force_caps()
378 force_caps = (uintptr_t)dmi->driver_data; in set_force_caps()
379 pr_info("Found %s, set force_caps to 0x%x\n", dmi->ident, force_caps); in set_force_caps()
388 .brightness = -1,
418 /* The Aspire One has a dummy ACPI-WMI interface - disable it */
461 * that those machines are supported by acer-wmi driver.
574 .ident = "Acer Predator PH315-53",
577 DMI_MATCH(DMI_PRODUCT_NAME, "Predator PH315-53"),
583 .ident = "Acer Predator PHN16-71",
586 DMI_MATCH(DMI_PRODUCT_NAME, "Predator PHN16-71"),
592 .ident = "Acer Predator PH16-71",
595 DMI_MATCH(DMI_PRODUCT_NAME, "Predator PH16-71"),
601 .ident = "Acer Predator PH18-71",
604 DMI_MATCH(DMI_PRODUCT_NAME, "Predator PH18-71"),
610 .ident = "Acer Aspire Switch 10E SW3-016",
613 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW3-016"),
619 .ident = "Acer Aspire Switch 10 SW5-012",
622 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
628 .ident = "Acer Aspire Switch V 10 SW5-017",
631 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SW5-017"),
648 * This quirk list is for those non-acer machines that have AMW0_GUID1
649 * but supported by acer-wmi in past days. Keeping this quirk list here
651 * here anymore. Those non-acer machines should be supported by
702 .ident = "Lenovo Ideapad S205-10382JG",
711 .ident = "Lenovo Ideapad S205-1038DPG",
768 return interface->capability & cap; in has_cap()
809 switch (quirks->mailled) { in AMW0_get_u32()
819 switch (quirks->wireless) { in AMW0_get_u32()
847 switch (quirks->bluetooth) { in AMW0_get_u32()
857 switch (quirks->brightness) { in AMW0_get_u32()
899 switch (quirks->brightness) { in AMW0_set_u32()
927 if (obj && obj->type == ACPI_TYPE_BUFFER && in AMW0_find_mailled()
928 obj->buffer.length == sizeof(struct wmab_ret)) { in AMW0_find_mailled()
929 ret = *((struct wmab_ret *) obj->buffer.pointer); in AMW0_find_mailled()
936 interface->capability |= ACER_CAP_MAILLED; in AMW0_find_mailled()
947 { "SNY5001", 0}, /* sony-laptop in charge */
956 for (id = norfkill_ids; id->id[0]; id++) in AMW0_set_cap_acpi_check_device()
957 if (acpi_dev_found(id->id)) in AMW0_set_cap_acpi_check_device()
978 interface->capability |= ACER_CAP_WIRELESS; in AMW0_set_capabilities()
993 if (obj && obj->type == ACPI_TYPE_BUFFER && in AMW0_set_capabilities()
994 obj->buffer.length == sizeof(struct wmab_ret)) { in AMW0_set_capabilities()
995 ret = *((struct wmab_ret *) obj->buffer.pointer); in AMW0_set_capabilities()
1002 interface->capability |= ACER_CAP_WIRELESS; in AMW0_set_capabilities()
1016 if (obj && obj->type == ACPI_TYPE_BUFFER in AMW0_set_capabilities()
1017 && obj->buffer.length == sizeof(struct wmab_ret)) { in AMW0_set_capabilities()
1018 ret = *((struct wmab_ret *) obj->buffer.pointer); in AMW0_set_capabilities()
1025 interface->capability |= ACER_CAP_BLUETOOTH; in AMW0_set_capabilities()
1032 if (quirks->brightness >= 0) in AMW0_set_capabilities()
1033 interface->capability |= ACER_CAP_BRIGHTNESS; in AMW0_set_capabilities()
1068 if (obj->type == ACPI_TYPE_BUFFER && in WMI_execute_u32()
1069 (obj->buffer.length == sizeof(u32) || in WMI_execute_u32()
1070 obj->buffer.length == sizeof(u64))) { in WMI_execute_u32()
1071 tmp = *((u32 *) obj->buffer.pointer); in WMI_execute_u32()
1072 } else if (obj->type == ACPI_TYPE_INTEGER) { in WMI_execute_u32()
1073 tmp = (u32) obj->integer.value; in WMI_execute_u32()
1105 if (quirks->mailled == 1) { in WMID_get_u32()
1151 if (quirks->mailled == 1) { in WMID_set_u32()
1189 else if (obj->type != ACPI_TYPE_BUFFER) { in wmid3_get_device_status()
1193 if (obj->buffer.length != 8) { in wmid3_get_device_status()
1194 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in wmid3_get_device_status()
1199 return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer); in wmid3_get_device_status()
1203 pr_warn("Get 0x%x Device Status failed: 0x%x - 0x%x\n", in wmid3_get_device_status()
1268 else if (obj->type != ACPI_TYPE_BUFFER) { in wmid3_set_device_status()
1272 if (obj->buffer.length != 8) { in wmid3_set_device_status()
1273 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in wmid3_set_device_status()
1278 return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer); in wmid3_set_device_status()
1282 pr_warn("Get Current Device Status failed: 0x%x - 0x%x\n", in wmid3_set_device_status()
1299 else if (obj->type != ACPI_TYPE_BUFFER) { in wmid3_set_device_status()
1303 if (obj->buffer.length != 4) { in wmid3_set_device_status()
1304 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in wmid3_set_device_status()
1309 return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer); in wmid3_set_device_status()
1313 pr_warn("Set Device Status failed: 0x%x - 0x%x\n", in wmid3_set_device_status()
1344 /* We are looking for OEM-specific Type AAh */ in type_aa_dmi_decode()
1345 if (header->type != 0xAA) in type_aa_dmi_decode()
1352 type_aa->commun_func_bitmap); in type_aa_dmi_decode()
1353 commun_func_bitmap = type_aa->commun_func_bitmap; in type_aa_dmi_decode()
1355 if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_WIRELESS) in type_aa_dmi_decode()
1356 interface->capability |= ACER_CAP_WIRELESS; in type_aa_dmi_decode()
1357 if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_THREEG) in type_aa_dmi_decode()
1358 interface->capability |= ACER_CAP_THREEG; in type_aa_dmi_decode()
1359 if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH) in type_aa_dmi_decode()
1360 interface->capability |= ACER_CAP_BLUETOOTH; in type_aa_dmi_decode()
1361 if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_RFBTN) in type_aa_dmi_decode()
1364 commun_fn_key_number = type_aa->commun_fn_key_number; in type_aa_dmi_decode()
1380 if (obj->type == ACPI_TYPE_BUFFER && in WMID_set_capabilities()
1381 (obj->buffer.length == sizeof(u32) || in WMID_set_capabilities()
1382 obj->buffer.length == sizeof(u64))) { in WMID_set_capabilities()
1383 devices = *((u32 *) obj->buffer.pointer); in WMID_set_capabilities()
1384 } else if (obj->type == ACPI_TYPE_INTEGER) { in WMID_set_capabilities()
1385 devices = (u32) obj->integer.value; in WMID_set_capabilities()
1397 interface->capability |= ACER_CAP_WIRELESS; in WMID_set_capabilities()
1399 interface->capability |= ACER_CAP_THREEG; in WMID_set_capabilities()
1401 interface->capability |= ACER_CAP_BLUETOOTH; in WMID_set_capabilities()
1438 if (obj->type == ACPI_TYPE_BUFFER) { in WMI_gaming_execute_u64()
1439 if (obj->buffer.length == sizeof(u32)) in WMI_gaming_execute_u64()
1440 tmp = *((u32 *) obj->buffer.pointer); in WMI_gaming_execute_u64()
1441 else if (obj->buffer.length == sizeof(u64)) in WMI_gaming_execute_u64()
1442 tmp = *((u64 *) obj->buffer.pointer); in WMI_gaming_execute_u64()
1443 } else if (obj->type == ACPI_TYPE_INTEGER) { in WMI_gaming_execute_u64()
1444 tmp = (u64) obj->integer.value; in WMI_gaming_execute_u64()
1460 if (!(interface->capability & cap)) in WMID_gaming_set_u64()
1487 if (!(interface->capability & cap)) in WMID_gaming_get_u64()
1511 if (quirks->cpu_fans > 0) in WMID_gaming_set_fan_mode()
1513 for (i = 0; i < (quirks->cpu_fans + quirks->gpu_fans); ++i) in WMID_gaming_set_fan_mode()
1515 for (i = 0; i < quirks->gpu_fans; ++i) in WMID_gaming_set_fan_mode()
1517 if (quirks->cpu_fans > 0) in WMID_gaming_set_fan_mode()
1519 for (i = 0; i < (quirks->cpu_fans + quirks->gpu_fans); ++i) in WMID_gaming_set_fan_mode()
1521 for (i = 0; i < quirks->gpu_fans; ++i) in WMID_gaming_set_fan_mode()
1527 * Generic Device (interface-independent)
1534 switch (interface->type) { in get_u32()
1564 if (interface->capability & cap) { in set_u32()
1565 switch (interface->type) { in set_u32()
1628 .name = "acer-wmi::mail",
1677 bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops, in acer_backlight_init()
1687 bd->props.power = BACKLIGHT_POWER_ON; in acer_backlight_init()
1688 bd->props.brightness = read_brightness(bd); in acer_backlight_init()
1713 return -1; in acer_gsensor_init()
1730 return -1; in acer_gsensor_event()
1737 return -1; in acer_gsensor_event()
1739 if (out_obj->package.count != 4) in acer_gsensor_event()
1740 return -1; in acer_gsensor_event()
1743 (s16)out_obj->package.elements[0].integer.value); in acer_gsensor_event()
1745 (s16)out_obj->package.elements[1].integer.value); in acer_gsensor_event()
1747 (s16)out_obj->package.elements[2].integer.value); in acer_gsensor_event()
1754 if (quirks->predator_v4) { in acer_get_fan_speed()
1765 return -EIO; in acer_get_fan_speed()
1769 return -EOPNOTSUPP; in acer_get_fan_speed()
1781 return -1; in acer_toggle_turbo()
1836 return -EOPNOTSUPP; in acer_predator_v4_platform_profile_get()
1866 return -EOPNOTSUPP; in acer_predator_v4_platform_profile_set()
1873 return -EIO; in acer_predator_v4_platform_profile_set()
1883 if (quirks->predator_v4) { in acer_platform_profile_setup()
1908 /* Set default non-turbo profile */ in acer_platform_profile_setup()
1921 if (quirks->predator_v4) { in acer_thermal_profile_change()
1939 return -EIO; in acer_thermal_profile_change()
1981 return -EOPNOTSUPP; in acer_thermal_profile_change()
1988 return -EIO; in acer_thermal_profile_change()
1990 /* Store non-turbo profile for turbo mode toggle*/ in acer_thermal_profile_change()
2008 case 0x04: /* Stand-alone tablet */ in acer_kbd_dock_state_to_sw_tablet_mode()
2029 pr_err("Error getting keyboard-dock initial status: %s\n", in acer_kbd_dock_get_initial_state()
2035 if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) { in acer_kbd_dock_get_initial_state()
2036 pr_err("Unexpected output format getting keyboard-dock initial status\n"); in acer_kbd_dock_get_initial_state()
2040 output = obj->buffer.pointer; in acer_kbd_dock_get_initial_state()
2042 pr_err("Unexpected output [0]=0x%02x [3]=0x%02x getting keyboard-dock initial status\n", in acer_kbd_dock_get_initial_state()
2061 sw_tablet_mode = acer_kbd_dock_state_to_sw_tablet_mode(event->kbd_dock_state); in acer_kbd_dock_event()
2079 if (quirks->wireless == 3) in acer_rfkill_update()
2109 return -ENODEV; in acer_rfkill_set()
2132 return ERR_PTR(-ENOMEM); in acer_rfkill_register()
2154 "acer-wireless", ACER_CAP_WIRELESS); in acer_rfkill_init()
2163 RFKILL_TYPE_BLUETOOTH, "acer-bluetooth", in acer_rfkill_init()
2173 RFKILL_TYPE_WWAN, "acer-threeg", in acer_rfkill_init()
2235 if (obj->type != ACPI_TYPE_BUFFER) { in acer_wmi_notify()
2236 pr_warn("Unknown response received %d\n", obj->type); in acer_wmi_notify()
2239 if (obj->buffer.length != 8) { in acer_wmi_notify()
2240 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in acer_wmi_notify()
2244 return_value = *((struct event_return_value *)obj->buffer.pointer); in acer_wmi_notify()
2254 pr_warn("Unknown key number - 0x%x\n", in acer_wmi_notify()
2258 switch (key->keycode) { in acer_wmi_notify()
2289 pr_warn("Unknown function number - %d - %d\n", in acer_wmi_notify()
2313 else if (obj->type != ACPI_TYPE_BUFFER) { in wmid3_set_function_mode()
2317 if (obj->buffer.length != 4) { in wmid3_set_function_mode()
2318 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in wmid3_set_function_mode()
2323 *return_value = *((struct func_return_value *)obj->buffer.pointer); in wmid3_set_function_mode()
2344 pr_warn("Enabling EC raw mode failed: 0x%x - 0x%x\n", in acer_wmi_enable_ec_raw()
2368 pr_warn("Enabling Launch Manager failed: 0x%x - 0x%x\n", in acer_wmi_enable_lm()
2390 pr_warn("Enabling RF Button failed: 0x%x - 0x%x\n", in acer_wmi_enable_rf_button()
2402 adev = acpi_dev_get_first_match_dev("BST0001", NULL, -1); in acer_wmi_accel_setup()
2404 return -ENODEV; in acer_wmi_accel_setup()
2411 return -ENOMEM; in acer_wmi_accel_setup()
2413 acer_wmi_accel_dev->open = acer_gsensor_open; in acer_wmi_accel_setup()
2415 acer_wmi_accel_dev->name = "Acer BMA150 accelerometer"; in acer_wmi_accel_setup()
2416 acer_wmi_accel_dev->phys = "wmi/input1"; in acer_wmi_accel_setup()
2417 acer_wmi_accel_dev->id.bustype = BUS_HOST; in acer_wmi_accel_setup()
2418 acer_wmi_accel_dev->evbit[0] = BIT_MASK(EV_ABS); in acer_wmi_accel_setup()
2419 input_set_abs_params(acer_wmi_accel_dev, ABS_X, -16384, 16384, 0, 0); in acer_wmi_accel_setup()
2420 input_set_abs_params(acer_wmi_accel_dev, ABS_Y, -16384, 16384, 0, 0); in acer_wmi_accel_setup()
2421 input_set_abs_params(acer_wmi_accel_dev, ABS_Z, -16384, 16384, 0, 0); in acer_wmi_accel_setup()
2441 return -ENOMEM; in acer_wmi_input_setup()
2443 acer_wmi_input_dev->name = "Acer WMI hotkeys"; in acer_wmi_input_setup()
2444 acer_wmi_input_dev->phys = "wmi/input0"; in acer_wmi_input_setup()
2445 acer_wmi_input_dev->id.bustype = BUS_HOST; in acer_wmi_input_setup()
2457 err = -EIO; in acer_wmi_input_setup()
2499 if (obj->type == ACPI_TYPE_BUFFER && in get_wmid_devices()
2500 (obj->buffer.length == sizeof(u32) || in get_wmid_devices()
2501 obj->buffer.length == sizeof(u64))) { in get_wmid_devices()
2502 devices = *((u32 *) obj->buffer.pointer); in get_wmid_devices()
2503 } else if (obj->type == ACPI_TYPE_INTEGER) { in get_wmid_devices()
2504 devices = (u32) obj->integer.value; in get_wmid_devices()
2522 err = acer_led_init(&device->dev); in acer_platform_probe()
2528 err = acer_backlight_init(&device->dev); in acer_platform_probe()
2533 err = acer_rfkill_init(&device->dev); in acer_platform_probe()
2583 struct acer_data *data = &interface->data; in acer_suspend()
2586 return -ENOMEM; in acer_suspend()
2591 data->mailled = value; in acer_suspend()
2596 data->brightness = value; in acer_suspend()
2604 struct acer_data *data = &interface->data; in acer_resume()
2607 return -ENOMEM; in acer_resume()
2610 set_u32(data->mailled, ACER_CAP_MAILLED); in acer_resume()
2613 set_u32(data->brightness, ACER_CAP_BRIGHTNESS); in acer_resume()
2629 struct acer_data *data = &interface->data; in acer_platform_shutdown()
2640 .name = "acer-wmi",
2652 debugfs_remove_recursive(interface->debug.root); in remove_debugfs()
2657 interface->debug.root = debugfs_create_dir("acer-wmi", NULL); in create_debugfs()
2659 debugfs_create_u32("devices", S_IRUGO, interface->debug.root, in create_debugfs()
2660 &interface->debug.wmid_devices); in create_debugfs()
2665 int channel) in acer_wmi_hwmon_is_visible() argument
2669 if (acer_get_fan_speed(channel) >= 0) in acer_wmi_hwmon_is_visible()
2680 u32 attr, int channel, long *val) in acer_wmi_hwmon_read() argument
2686 ret = acer_get_fan_speed(channel); in acer_wmi_hwmon_read()
2692 return -EOPNOTSUPP; in acer_wmi_hwmon_read()
2714 struct device *dev = &acer_platform_device->dev; in acer_wmi_hwmon_init()
2734 pr_info("Acer Laptop ACPI-WMI Extras\n"); in acer_wmi_init()
2737 pr_info("Blacklisted hardware detected - not loading\n"); in acer_wmi_init()
2738 return -ENODEV; in acer_wmi_init()
2746 * acer-wmi driver handled those non-Acer machines by quirks list. in acer_wmi_init()
2747 * But actually acer-wmi driver was loaded on any machines that have in acer_wmi_init()
2749 * be supported by appropriate wmi drivers. e.g. fujitsu-laptop, in acer_wmi_init()
2750 * ideapad-laptop. So, here checks the machine that has AMW0_GUID1 in acer_wmi_init()
2758 return -ENODEV; in acer_wmi_init()
2762 * Detect which ACPI-WMI interface we're using. in acer_wmi_init()
2779 return -ENODEV; in acer_wmi_init()
2782 interface->capability |= ACER_CAP_BRIGHTNESS; in acer_wmi_init()
2783 } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa && force_caps == -1) { in acer_wmi_init()
2785 return -ENODEV; in acer_wmi_init()
2793 return -ENODEV; in acer_wmi_init()
2802 return -ENODEV; in acer_wmi_init()
2808 interface->capability &= ~ACER_CAP_BRIGHTNESS; in acer_wmi_init()
2811 interface->capability |= ACER_CAP_SET_FUNCTION_MODE; in acer_wmi_init()
2813 if (force_caps != -1) in acer_wmi_init()
2814 interface->capability = force_caps; in acer_wmi_init()
2817 (interface->capability & ACER_CAP_SET_FUNCTION_MODE)) { in acer_wmi_init()
2824 return -ENODEV; in acer_wmi_init()
2828 return -ENODEV; in acer_wmi_init()
2839 if (err && err != -ENODEV) in acer_wmi_init()
2849 acer_platform_device = platform_device_alloc("acer-wmi", PLATFORM_DEVID_NONE); in acer_wmi_init()
2851 err = -ENOMEM; in acer_wmi_init()
2860 interface->debug.wmid_devices = get_wmid_devices(); in acer_wmi_init()