asus-wmi.c (a4654e9bde4ecedb4921e6c8fe2088114bdff1b3) asus-wmi.c (dba43fc4ba2fed63e898867fa973c69c37623939)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Asus PC WMI hotkey driver
4 *
5 * Copyright(C) 2010 Intel Corporation.
6 * Copyright(C) 2010-2011 Corentin Chary <corentin.chary@gmail.com>
7 *
8 * Portions based on wistron_btns.c:

--- 412 unchanged lines hidden (view full) ---

421}
422
423static DEVICE_ATTR_RW(charge_control_end_threshold);
424
425static int asus_wmi_battery_add(struct power_supply *battery)
426{
427 /* The WMI method does not provide a way to specific a battery, so we
428 * just assume it is the first battery.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Asus PC WMI hotkey driver
4 *
5 * Copyright(C) 2010 Intel Corporation.
6 * Copyright(C) 2010-2011 Corentin Chary <corentin.chary@gmail.com>
7 *
8 * Portions based on wistron_btns.c:

--- 412 unchanged lines hidden (view full) ---

421}
422
423static DEVICE_ATTR_RW(charge_control_end_threshold);
424
425static int asus_wmi_battery_add(struct power_supply *battery)
426{
427 /* The WMI method does not provide a way to specific a battery, so we
428 * just assume it is the first battery.
429 * Note: On some newer ASUS laptops (Zenbook UM431DA), the primary/first
430 * battery is named BATT.
429 */
431 */
430 if (strcmp(battery->desc->name, "BAT0") != 0)
432 if (strcmp(battery->desc->name, "BAT0") != 0 &&
433 strcmp(battery->desc->name, "BATT") != 0)
431 return -ENODEV;
432
433 if (device_create_file(&battery->dev,
434 &dev_attr_charge_control_end_threshold))
435 return -ENODEV;
436
437 /* The charge threshold is only reset when the system is power cycled,
438 * and we can't get the current threshold so let set it to 100% when

--- 1275 unchanged lines hidden (view full) ---

1714 return -EINVAL;
1715 } else if (new_mode != ASUS_FAN_BOOST_MODE_NORMAL) {
1716 return -EINVAL;
1717 }
1718
1719 asus->fan_boost_mode = new_mode;
1720 fan_boost_mode_write(asus);
1721
434 return -ENODEV;
435
436 if (device_create_file(&battery->dev,
437 &dev_attr_charge_control_end_threshold))
438 return -ENODEV;
439
440 /* The charge threshold is only reset when the system is power cycled,
441 * and we can't get the current threshold so let set it to 100% when

--- 1275 unchanged lines hidden (view full) ---

1717 return -EINVAL;
1718 } else if (new_mode != ASUS_FAN_BOOST_MODE_NORMAL) {
1719 return -EINVAL;
1720 }
1721
1722 asus->fan_boost_mode = new_mode;
1723 fan_boost_mode_write(asus);
1724
1722 return result;
1725 return count;
1723}
1724
1725// Fan boost mode: 0 - normal, 1 - overboost, 2 - silent
1726static DEVICE_ATTR_RW(fan_boost_mode);
1727
1728/* Throttle thermal policy ****************************************************/
1729
1730static int throttle_thermal_policy_check_present(struct asus_wmi *asus)

--- 1087 unchanged lines hidden ---
1726}
1727
1728// Fan boost mode: 0 - normal, 1 - overboost, 2 - silent
1729static DEVICE_ATTR_RW(fan_boost_mode);
1730
1731/* Throttle thermal policy ****************************************************/
1732
1733static int throttle_thermal_policy_check_present(struct asus_wmi *asus)

--- 1087 unchanged lines hidden ---