Lines Matching +full:battery +full:- +full:profile
1 // SPDX-License-Identifier: GPL-2.0-or-later
22 #include <linux/input/sparse-keymap.h>
38 MODULE_ALIAS("wmi:95F24279-4D7B-4334-9387-ACCDC67EF61C");
39 MODULE_ALIAS("wmi:5FB7F034-2C63-45E9-BE91-3D44E2C707E4");
41 #define HPWMI_EVENT_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
42 #define HPWMI_BIOS_GUID "5FB7F034-2C63-45E9-BE91-3D44E2C707E4"
58 * "OMEN", and it can use the thermal profile stuff if the "Feature" array
71 * profile version 0 by the Omen Command Center app, regardless of what
78 /* DMI board names of Omen laptops that have a thermal profile timer which will
79 * cause the embedded controller to set the thermal profile back to
122 * were introduced that exceeds 128-byte data size. Changes to handle
312 return -EINVAL; in encode_outsize_for_pvsz()
335 * -EINVAL if the query was not successful at all
336 * -EINVAL if the output buffer size exceeds buffersize
339 * size. E.g. Battery info query is defined to have 1 byte input
363 return -ENOMEM; in hp_wmi_perform_query()
368 args->signature = 0x55434553; in hp_wmi_perform_query()
369 args->command = command; in hp_wmi_perform_query()
370 args->commandtype = query; in hp_wmi_perform_query()
371 args->datasize = insize; in hp_wmi_perform_query()
372 memcpy(args->data, buffer, flex_array_size(args, data, insize)); in hp_wmi_perform_query()
380 ret = -EINVAL; in hp_wmi_perform_query()
384 if (obj->type != ACPI_TYPE_BUFFER) { in hp_wmi_perform_query()
386 ret = -EINVAL; in hp_wmi_perform_query()
390 bios_return = (struct bios_return *)obj->buffer.pointer; in hp_wmi_perform_query()
391 ret = bios_return->return_code; in hp_wmi_perform_query()
404 actual_outsize = min(outsize, (int)(obj->buffer.length - sizeof(*bios_return))); in hp_wmi_perform_query()
405 memcpy(buffer, obj->buffer.pointer + sizeof(*bios_return), actual_outsize); in hp_wmi_perform_query()
406 memset(buffer + actual_outsize, 0, outsize - actual_outsize); in hp_wmi_perform_query()
424 return -EINVAL; in hp_wmi_get_fan_speed()
440 return ret < 0 ? ret : -EINVAL; in hp_wmi_read_int()
464 return -ENODEV; in hp_wmi_get_tablet_mode()
470 return -ENODEV; in hp_wmi_get_tablet_mode()
487 char buffer[2] = {-1, mode}; in omen_thermal_profile_set()
494 return ret < 0 ? ret : -EINVAL; in omen_thermal_profile_set()
530 return ret < 0 ? ret : -EINVAL; in omen_get_thermal_policy_version()
555 return ret < 0 ? ret : -EINVAL; in hp_wmi_fan_speed_max_set()
568 return ret < 0 ? ret : -EINVAL; in hp_wmi_fan_speed_max_get()
581 return (ret == HPWMI_RET_UNKNOWN_CMDTYPE) ? 0 : -ENXIO; in hp_wmi_bios_2008_later()
592 return (ret == HPWMI_RET_UNKNOWN_CMDTYPE) ? 0 : -ENXIO; in hp_wmi_bios_2009_later()
601 return ret <= 0 ? ret : -EINVAL; in hp_wmi_enable_hotkeys()
613 return ret <= 0 ? ret : -EINVAL; in hp_wmi_set_block()
653 return ret <= 0 ? ret : -EINVAL; in hp_wmi_rfkill2_set_block()
677 devstate->rfkill_id != rfkill2[i].id) { in hp_wmi_rfkill2_refresh()
683 IS_SWBLOCKED(devstate->power), in hp_wmi_rfkill2_refresh()
684 IS_HWBLOCKED(devstate->power)); in hp_wmi_rfkill2_refresh()
764 return ret < 0 ? ret : -EINVAL; in als_store()
781 return -EINVAL; in postcode_store()
787 return ret < 0 ? ret : -EINVAL; in postcode_store()
798 return -ENOMEM; in camera_shutter_input_setup()
800 camera_shutter_input_dev->name = "HP WMI camera shutter"; in camera_shutter_input_setup()
801 camera_shutter_input_dev->phys = "wmi/input1"; in camera_shutter_input_setup()
802 camera_shutter_input_dev->id.bustype = BUS_HOST; in camera_shutter_input_setup()
804 __set_bit(EV_SW, camera_shutter_input_dev->evbit); in camera_shutter_input_setup()
805 __set_bit(SW_CAMERA_LENS_COVER, camera_shutter_input_dev->swbit); in camera_shutter_input_setup()
845 if (obj->type != ACPI_TYPE_BUFFER) { in hp_wmi_notify()
846 pr_info("Unknown response received %d\n", obj->type); in hp_wmi_notify()
854 location = (u32 *)obj->buffer.pointer; in hp_wmi_notify()
855 if (obj->buffer.length == 8) { in hp_wmi_notify()
858 } else if (obj->buffer.length == 16) { in hp_wmi_notify()
862 pr_info("Unknown buffer length %d\n", obj->buffer.length); in hp_wmi_notify()
868 if (test_bit(SW_DOCK, hp_wmi_input_dev->swbit)) in hp_wmi_notify()
871 if (test_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit)) in hp_wmi_notify()
887 pr_info("Unknown key code - 0x%x\n", key_code); in hp_wmi_notify()
897 pr_info("Unknown key code - 0x%x\n", key_code); in hp_wmi_notify()
919 pr_info("Unimplemented CPU throttle because of 3 Cell battery event detected\n"); in hp_wmi_notify()
952 pr_warn("Unknown camera shutter state - 0x%x\n", event_data); in hp_wmi_notify()
958 pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data); in hp_wmi_notify()
970 return -ENOMEM; in hp_wmi_input_setup()
972 hp_wmi_input_dev->name = "HP WMI hotkeys"; in hp_wmi_input_setup()
973 hp_wmi_input_dev->phys = "wmi/input0"; in hp_wmi_input_setup()
974 hp_wmi_input_dev->id.bustype = BUS_HOST; in hp_wmi_input_setup()
976 __set_bit(EV_SW, hp_wmi_input_dev->evbit); in hp_wmi_input_setup()
981 __set_bit(SW_DOCK, hp_wmi_input_dev->swbit); in hp_wmi_input_setup()
988 __set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit); in hp_wmi_input_setup()
1004 err = -EIO; in hp_wmi_input_setup()
1041 wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev, in hp_wmi_rfkill_setup()
1046 return -ENOMEM; in hp_wmi_rfkill_setup()
1057 bluetooth_rfkill = rfkill_alloc("hp-bluetooth", &device->dev, in hp_wmi_rfkill_setup()
1062 err = -ENOMEM; in hp_wmi_rfkill_setup()
1075 wwan_rfkill = rfkill_alloc("hp-wwan", &device->dev, in hp_wmi_rfkill_setup()
1080 err = -ENOMEM; in hp_wmi_rfkill_setup()
1118 return err < 0 ? err : -EINVAL; in hp_wmi_rfkill2_setup()
1122 return -EINVAL; in hp_wmi_rfkill2_setup()
1133 name = "hp-wifi"; in hp_wmi_rfkill2_setup()
1137 name = "hp-bluetooth"; in hp_wmi_rfkill2_setup()
1141 name = "hp-wwan"; in hp_wmi_rfkill2_setup()
1145 name = "hp-gps"; in hp_wmi_rfkill2_setup()
1159 rfkill = rfkill_alloc(name, &device->dev, type, in hp_wmi_rfkill2_setup()
1162 err = -ENOMEM; in hp_wmi_rfkill2_setup()
1189 for (; rfkill2_count > 0; rfkill2_count--) { in hp_wmi_rfkill2_setup()
1190 rfkill_unregister(rfkill2[rfkill2_count - 1].rfkill); in hp_wmi_rfkill2_setup()
1191 rfkill_destroy(rfkill2[rfkill2_count - 1].rfkill); in hp_wmi_rfkill2_setup()
1196 static int platform_profile_omen_get_ec(enum platform_profile_option *profile) in platform_profile_omen_get_ec() argument
1207 *profile = PLATFORM_PROFILE_PERFORMANCE; in platform_profile_omen_get_ec()
1211 *profile = PLATFORM_PROFILE_BALANCED; in platform_profile_omen_get_ec()
1215 *profile = PLATFORM_PROFILE_COOL; in platform_profile_omen_get_ec()
1218 return -EINVAL; in platform_profile_omen_get_ec()
1225 enum platform_profile_option *profile) in platform_profile_omen_get() argument
1228 * We directly return the stored platform profile, as the embedded in platform_profile_omen_get()
1232 * If we directly return what the EC reports, the platform profile will in platform_profile_omen_get()
1235 * the Platform Profile Section page of the kernel documentation. in platform_profile_omen_get()
1240 *profile = active_platform_profile; in platform_profile_omen_get()
1267 static int platform_profile_omen_set_ec(enum platform_profile_option profile) in platform_profile_omen_set_ec() argument
1275 return -EOPNOTSUPP; in platform_profile_omen_set_ec()
1277 switch (profile) { in platform_profile_omen_set_ec()
1297 return -EOPNOTSUPP; in platform_profile_omen_set_ec()
1309 if (profile == PLATFORM_PROFILE_PERFORMANCE) in platform_profile_omen_set_ec()
1322 enum platform_profile_option profile) in platform_profile_omen_set() argument
1328 err = platform_profile_omen_set_ec(profile); in platform_profile_omen_set()
1332 active_platform_profile = profile; in platform_profile_omen_set()
1349 enum platform_profile_option *profile) in hp_wmi_platform_profile_get() argument
1359 *profile = PLATFORM_PROFILE_PERFORMANCE; in hp_wmi_platform_profile_get()
1362 *profile = PLATFORM_PROFILE_BALANCED; in hp_wmi_platform_profile_get()
1365 *profile = PLATFORM_PROFILE_COOL; in hp_wmi_platform_profile_get()
1368 *profile = PLATFORM_PROFILE_QUIET; in hp_wmi_platform_profile_get()
1371 return -EINVAL; in hp_wmi_platform_profile_get()
1378 enum platform_profile_option profile) in hp_wmi_platform_profile_set() argument
1382 switch (profile) { in hp_wmi_platform_profile_set()
1396 return -EOPNOTSUPP; in hp_wmi_platform_profile_set()
1418 static int platform_profile_victus_get_ec(enum platform_profile_option *profile) in platform_profile_victus_get_ec() argument
1428 *profile = PLATFORM_PROFILE_PERFORMANCE; in platform_profile_victus_get_ec()
1431 *profile = PLATFORM_PROFILE_BALANCED; in platform_profile_victus_get_ec()
1434 *profile = PLATFORM_PROFILE_QUIET; in platform_profile_victus_get_ec()
1437 return -EOPNOTSUPP; in platform_profile_victus_get_ec()
1444 enum platform_profile_option *profile) in platform_profile_victus_get() argument
1447 return platform_profile_omen_get(pprof, profile); in platform_profile_victus_get()
1450 static int platform_profile_victus_set_ec(enum platform_profile_option profile) in platform_profile_victus_set_ec() argument
1454 switch (profile) { in platform_profile_victus_set_ec()
1465 return -EOPNOTSUPP; in platform_profile_victus_set_ec()
1476 enum platform_profile_option profile) in platform_profile_victus_set() argument
1482 err = platform_profile_victus_set_ec(profile); in platform_profile_victus_set()
1486 active_platform_profile = profile; in platform_profile_victus_set()
1499 if (strcmp(event_entry->device_class, ACPI_AC_CLASS) != 0) in omen_powersource_event()
1517 * Although we failed to get the current platform profile, we in omen_powersource_event()
1520 pr_warn("Failed to read current platform profile (%d)\n", err); in omen_powersource_event()
1525 * If we're back on AC and that the user-chosen power profile is in omen_powersource_event()
1526 * different from what the EC reports, we restore the user-chosen in omen_powersource_event()
1531 pr_debug("Platform profile update skipped, conditions unmet\n"); in omen_powersource_event()
1541 pr_warn("Failed to restore platform profile (%d)\n", err); in omen_powersource_event()
1578 * call thermal profile write command to ensure that the in thermal_profile_setup()
1595 * call thermal profile write command to ensure that the in thermal_profile_setup()
1613 * call thermal profile write command to ensure that the in thermal_profile_setup()
1651 * In pre-2009 BIOS, command 1Bh return 0x4 to indicate that in hp_wmi_bios_setup()
1706 if (test_bit(SW_DOCK, hp_wmi_input_dev->swbit)) in hp_wmi_resume_handler()
1709 if (test_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit)) in hp_wmi_resume_handler()
1747 .name = "hp-wmi",
1799 return -ENODATA; in hp_wmi_hwmon_read()
1802 return -EINVAL; in hp_wmi_hwmon_read()
1820 return -EINVAL; in hp_wmi_hwmon_write()
1823 return -EOPNOTSUPP; in hp_wmi_hwmon_write()
1846 struct device *dev = &hp_wmi_platform_dev->dev; in hp_wmi_hwmon_init()
1867 return -ENODEV; in hp_wmi_init()
1881 platform_device_register_simple("hp-wmi", PLATFORM_DEVID_NONE, NULL, 0); in hp_wmi_init()