Lines Matching +full:hall +full:- +full:enable

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>
39 * Meaning is unknown - this number is required for writing to ACPI for AMW0
66 #define AMW0_GUID1 "67C3371D-95A3-4C37-BB61-DD47B491DAAB"
67 #define AMW0_GUID2 "431F16ED-0C2B-444C-B267-27DEB140CF9C"
68 #define WMID_GUID1 "6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3"
69 #define WMID_GUID2 "95764E09-FB56-4E83-B31A-37761F60994A"
70 #define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531"
75 #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026"
77 MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB");
78 MODULE_ALIAS("wmi:6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3");
79 MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026");
157 * Bit[7]: Hall Sensor Application Status
235 static int mailled = -1;
236 static int brightness = -1;
237 static int threeg = -1;
253 MODULE_PARM_DESC(ec_raw_mode, "Enable EC raw mode");
271 /* Each low-level interface must define at least some of the following */
291 * Some laptops require us to directly access the EC to either enable or query
309 if (quirks->mailled) in set_quirks()
310 interface->capability |= ACER_CAP_MAILLED; in set_quirks()
312 if (quirks->brightness) in set_quirks()
313 interface->capability |= ACER_CAP_BRIGHTNESS; in set_quirks()
318 quirks = dmi->driver_data; in dmi_matched()
326 .brightness = -1,
346 /* The Aspire One has a dummy ACPI-WMI interface - disable it */
389 * that those machines are supported by acer-wmi driver.
504 * This quirk list is for those non-acer machines that have AMW0_GUID1
505 * but supported by acer-wmi in past days. Keeping this quirk list here
507 * here anymore. Those non-acer machines should be supported by
558 .ident = "Lenovo Ideapad S205-10382JG",
567 .ident = "Lenovo Ideapad S205-1038DPG",
580 interface->capability &= ~ACER_CAP_BRIGHTNESS; in video_set_backlight_video_vendor()
662 return interface->capability & cap; in has_cap()
703 switch (quirks->mailled) { in AMW0_get_u32()
713 switch (quirks->wireless) { in AMW0_get_u32()
741 switch (quirks->bluetooth) { in AMW0_get_u32()
751 switch (quirks->brightness) { in AMW0_get_u32()
793 switch (quirks->brightness) { in AMW0_set_u32()
822 if (obj && obj->type == ACPI_TYPE_BUFFER && in AMW0_find_mailled()
823 obj->buffer.length == sizeof(struct wmab_ret)) { in AMW0_find_mailled()
824 ret = *((struct wmab_ret *) obj->buffer.pointer); in AMW0_find_mailled()
831 interface->capability |= ACER_CAP_MAILLED; in AMW0_find_mailled()
842 { "SNY5001", 0}, /* sony-laptop in charge */
851 for (id = norfkill_ids; id->id[0]; id++) in AMW0_set_cap_acpi_check_device()
852 if (acpi_dev_found(id->id)) in AMW0_set_cap_acpi_check_device()
873 interface->capability |= ACER_CAP_WIRELESS; in AMW0_set_capabilities()
888 if (obj && obj->type == ACPI_TYPE_BUFFER && in AMW0_set_capabilities()
889 obj->buffer.length == sizeof(struct wmab_ret)) { in AMW0_set_capabilities()
890 ret = *((struct wmab_ret *) obj->buffer.pointer); in AMW0_set_capabilities()
897 interface->capability |= ACER_CAP_WIRELESS; in AMW0_set_capabilities()
911 if (obj && obj->type == ACPI_TYPE_BUFFER in AMW0_set_capabilities()
912 && obj->buffer.length == sizeof(struct wmab_ret)) { in AMW0_set_capabilities()
913 ret = *((struct wmab_ret *) obj->buffer.pointer); in AMW0_set_capabilities()
920 interface->capability |= ACER_CAP_BLUETOOTH; in AMW0_set_capabilities()
923 * This appears to be safe to enable, since all Wistron based laptops in AMW0_set_capabilities()
927 if (quirks->brightness >= 0) in AMW0_set_capabilities()
928 interface->capability |= ACER_CAP_BRIGHTNESS; in AMW0_set_capabilities()
963 if (obj->type == ACPI_TYPE_BUFFER && in WMI_execute_u32()
964 (obj->buffer.length == sizeof(u32) || in WMI_execute_u32()
965 obj->buffer.length == sizeof(u64))) { in WMI_execute_u32()
966 tmp = *((u32 *) obj->buffer.pointer); in WMI_execute_u32()
967 } else if (obj->type == ACPI_TYPE_INTEGER) { in WMI_execute_u32()
968 tmp = (u32) obj->integer.value; in WMI_execute_u32()
1000 if (quirks->mailled == 1) { in WMID_get_u32()
1046 if (quirks->mailled == 1) { in WMID_set_u32()
1084 else if (obj->type != ACPI_TYPE_BUFFER) { in wmid3_get_device_status()
1088 if (obj->buffer.length != 8) { in wmid3_get_device_status()
1089 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in wmid3_get_device_status()
1094 return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer); in wmid3_get_device_status()
1098 pr_warn("Get 0x%x Device Status failed: 0x%x - 0x%x\n", in wmid3_get_device_status()
1163 else if (obj->type != ACPI_TYPE_BUFFER) { in wmid3_set_device_status()
1167 if (obj->buffer.length != 8) { in wmid3_set_device_status()
1168 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in wmid3_set_device_status()
1173 return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer); in wmid3_set_device_status()
1177 pr_warn("Get Current Device Status failed: 0x%x - 0x%x\n", in wmid3_set_device_status()
1194 else if (obj->type != ACPI_TYPE_BUFFER) { in wmid3_set_device_status()
1198 if (obj->buffer.length != 4) { in wmid3_set_device_status()
1199 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in wmid3_set_device_status()
1204 return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer); in wmid3_set_device_status()
1208 pr_warn("Set Device Status failed: 0x%x - 0x%x\n", in wmid3_set_device_status()
1239 /* We are looking for OEM-specific Type AAh */ in type_aa_dmi_decode()
1240 if (header->type != 0xAA) in type_aa_dmi_decode()
1247 type_aa->commun_func_bitmap); in type_aa_dmi_decode()
1248 commun_func_bitmap = type_aa->commun_func_bitmap; in type_aa_dmi_decode()
1250 if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_WIRELESS) in type_aa_dmi_decode()
1251 interface->capability |= ACER_CAP_WIRELESS; in type_aa_dmi_decode()
1252 if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_THREEG) in type_aa_dmi_decode()
1253 interface->capability |= ACER_CAP_THREEG; in type_aa_dmi_decode()
1254 if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH) in type_aa_dmi_decode()
1255 interface->capability |= ACER_CAP_BLUETOOTH; in type_aa_dmi_decode()
1256 if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_RFBTN) { in type_aa_dmi_decode()
1257 interface->capability |= ACER_CAP_RFBTN; in type_aa_dmi_decode()
1261 commun_fn_key_number = type_aa->commun_fn_key_number; in type_aa_dmi_decode()
1277 if (obj->type == ACPI_TYPE_BUFFER && in WMID_set_capabilities()
1278 (obj->buffer.length == sizeof(u32) || in WMID_set_capabilities()
1279 obj->buffer.length == sizeof(u64))) { in WMID_set_capabilities()
1280 devices = *((u32 *) obj->buffer.pointer); in WMID_set_capabilities()
1281 } else if (obj->type == ACPI_TYPE_INTEGER) { in WMID_set_capabilities()
1282 devices = (u32) obj->integer.value; in WMID_set_capabilities()
1294 interface->capability |= ACER_CAP_WIRELESS; in WMID_set_capabilities()
1296 interface->capability |= ACER_CAP_THREEG; in WMID_set_capabilities()
1298 interface->capability |= ACER_CAP_BLUETOOTH; in WMID_set_capabilities()
1316 * Generic Device (interface-independent)
1323 switch (interface->type) { in get_u32()
1353 if (interface->capability & cap) { in set_u32()
1354 switch (interface->type) { in set_u32()
1417 .name = "acer-wmi::mail",
1446 int intensity = bd->props.brightness; in update_bl_status()
1448 if (bd->props.power != FB_BLANK_UNBLANK) in update_bl_status()
1450 if (bd->props.fb_blank != FB_BLANK_UNBLANK) in update_bl_status()
1471 bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops, in acer_backlight_init()
1481 bd->props.power = FB_BLANK_UNBLANK; in acer_backlight_init()
1482 bd->props.brightness = read_brightness(bd); in acer_backlight_init()
1507 return -1; in acer_gsensor_init()
1524 return -1; in acer_gsensor_event()
1531 return -1; in acer_gsensor_event()
1533 if (out_obj->package.count != 4) in acer_gsensor_event()
1534 return -1; in acer_gsensor_event()
1537 (s16)out_obj->package.elements[0].integer.value); in acer_gsensor_event()
1539 (s16)out_obj->package.elements[1].integer.value); in acer_gsensor_event()
1541 (s16)out_obj->package.elements[2].integer.value); in acer_gsensor_event()
1559 if (quirks->wireless == 3) in acer_rfkill_update()
1589 return -ENODEV; in acer_rfkill_set()
1612 return ERR_PTR(-ENOMEM); in acer_rfkill_register()
1634 "acer-wireless", ACER_CAP_WIRELESS); in acer_rfkill_init()
1643 RFKILL_TYPE_BLUETOOTH, "acer-bluetooth", in acer_rfkill_init()
1653 RFKILL_TYPE_WWAN, "acer-threeg", in acer_rfkill_init()
1727 if (obj->type != ACPI_TYPE_BUFFER) { in acer_wmi_notify()
1728 pr_warn("Unknown response received %d\n", obj->type); in acer_wmi_notify()
1732 if (obj->buffer.length != 8) { in acer_wmi_notify()
1733 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in acer_wmi_notify()
1738 return_value = *((struct event_return_value *)obj->buffer.pointer); in acer_wmi_notify()
1749 pr_warn("Unknown key number - 0x%x\n", in acer_wmi_notify()
1753 switch (key->keycode) { in acer_wmi_notify()
1777 pr_warn("Unknown function number - %d - %d\n", in acer_wmi_notify()
1801 else if (obj->type != ACPI_TYPE_BUFFER) { in wmid3_set_function_mode()
1805 if (obj->buffer.length != 4) { in wmid3_set_function_mode()
1806 pr_warn("Unknown buffer length %d\n", obj->buffer.length); in wmid3_set_function_mode()
1811 *return_value = *((struct func_return_value *)obj->buffer.pointer); in wmid3_set_function_mode()
1832 pr_warn("Enabling EC raw mode failed: 0x%x - 0x%x\n", in acer_wmi_enable_ec_raw()
1856 pr_warn("Enabling Launch Manager failed: 0x%x - 0x%x\n", in acer_wmi_enable_lm()
1878 pr_warn("Enabling RF Button failed: 0x%x - 0x%x\n", in acer_wmi_enable_rf_button()
1890 adev = acpi_dev_get_first_match_dev("BST0001", NULL, -1); in acer_wmi_accel_setup()
1892 return -ENODEV; in acer_wmi_accel_setup()
1897 interface->capability |= ACER_CAP_ACCEL; in acer_wmi_accel_setup()
1901 return -ENOMEM; in acer_wmi_accel_setup()
1903 acer_wmi_accel_dev->open = acer_gsensor_open; in acer_wmi_accel_setup()
1905 acer_wmi_accel_dev->name = "Acer BMA150 accelerometer"; in acer_wmi_accel_setup()
1906 acer_wmi_accel_dev->phys = "wmi/input1"; in acer_wmi_accel_setup()
1907 acer_wmi_accel_dev->id.bustype = BUS_HOST; in acer_wmi_accel_setup()
1908 acer_wmi_accel_dev->evbit[0] = BIT_MASK(EV_ABS); in acer_wmi_accel_setup()
1909 input_set_abs_params(acer_wmi_accel_dev, ABS_X, -16384, 16384, 0, 0); in acer_wmi_accel_setup()
1910 input_set_abs_params(acer_wmi_accel_dev, ABS_Y, -16384, 16384, 0, 0); in acer_wmi_accel_setup()
1911 input_set_abs_params(acer_wmi_accel_dev, ABS_Z, -16384, 16384, 0, 0); in acer_wmi_accel_setup()
1936 return -ENOMEM; in acer_wmi_input_setup()
1938 acer_wmi_input_dev->name = "Acer WMI hotkeys"; in acer_wmi_input_setup()
1939 acer_wmi_input_dev->phys = "wmi/input0"; in acer_wmi_input_setup()
1940 acer_wmi_input_dev->id.bustype = BUS_HOST; in acer_wmi_input_setup()
1949 err = -EIO; in acer_wmi_input_setup()
1988 if (obj->type == ACPI_TYPE_BUFFER && in get_wmid_devices()
1989 (obj->buffer.length == sizeof(u32) || in get_wmid_devices()
1990 obj->buffer.length == sizeof(u64))) { in get_wmid_devices()
1991 devices = *((u32 *) obj->buffer.pointer); in get_wmid_devices()
1992 } else if (obj->type == ACPI_TYPE_INTEGER) { in get_wmid_devices()
1993 devices = (u32) obj->integer.value; in get_wmid_devices()
2009 err = acer_led_init(&device->dev); in acer_platform_probe()
2015 err = acer_backlight_init(&device->dev); in acer_platform_probe()
2020 err = acer_rfkill_init(&device->dev); in acer_platform_probe()
2051 struct acer_data *data = &interface->data; in acer_suspend()
2054 return -ENOMEM; in acer_suspend()
2059 data->mailled = value; in acer_suspend()
2064 data->brightness = value; in acer_suspend()
2072 struct acer_data *data = &interface->data; in acer_resume()
2075 return -ENOMEM; in acer_resume()
2078 set_u32(data->mailled, ACER_CAP_MAILLED); in acer_resume()
2081 set_u32(data->brightness, ACER_CAP_BRIGHTNESS); in acer_resume()
2097 struct acer_data *data = &interface->data; in acer_platform_shutdown()
2108 .name = "acer-wmi",
2120 debugfs_remove_recursive(interface->debug.root); in remove_debugfs()
2125 interface->debug.root = debugfs_create_dir("acer-wmi", NULL); in create_debugfs()
2127 debugfs_create_u32("devices", S_IRUGO, interface->debug.root, in create_debugfs()
2128 &interface->debug.wmid_devices); in create_debugfs()
2135 pr_info("Acer Laptop ACPI-WMI Extras\n"); in acer_wmi_init()
2138 pr_info("Blacklisted hardware detected - not loading\n"); in acer_wmi_init()
2139 return -ENODEV; in acer_wmi_init()
2147 * acer-wmi driver handled those non-Acer machines by quirks list. in acer_wmi_init()
2148 * But actually acer-wmi driver was loaded on any machines that have in acer_wmi_init()
2150 * be supported by appropriate wmi drivers. e.g. fujitsu-laptop, in acer_wmi_init()
2151 * ideapad-laptop. So, here checks the machine that has AMW0_GUID1 in acer_wmi_init()
2159 return -ENODEV; in acer_wmi_init()
2163 * Detect which ACPI-WMI interface we're using. in acer_wmi_init()
2180 return -ENODEV; in acer_wmi_init()
2183 interface->capability |= ACER_CAP_BRIGHTNESS; in acer_wmi_init()
2186 return -ENODEV; in acer_wmi_init()
2194 return -ENODEV; in acer_wmi_init()
2203 return -ENODEV; in acer_wmi_init()
2212 interface->capability &= ~ACER_CAP_BRIGHTNESS; in acer_wmi_init()
2216 pr_warn("Cannot enable RF Button Driver\n"); in acer_wmi_init()
2220 pr_err("Cannot enable EC raw mode\n"); in acer_wmi_init()
2221 return -ENODEV; in acer_wmi_init()
2224 pr_err("Cannot enable Launch Manager mode\n"); in acer_wmi_init()
2225 return -ENODEV; in acer_wmi_init()
2228 pr_info("No WMID EC raw mode enable method\n"); in acer_wmi_init()
2236 if (err && err != -ENODEV) in acer_wmi_init()
2237 pr_warn("Cannot enable accelerometer\n"); in acer_wmi_init()
2246 acer_platform_device = platform_device_alloc("acer-wmi", -1); in acer_wmi_init()
2248 err = -ENOMEM; in acer_wmi_init()
2257 interface->debug.wmid_devices = get_wmid_devices(); in acer_wmi_init()