Lines Matching +full:platform +full:- +full:level
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * The GameZone WMI interface provides platform profile and fan curve settings
23 #include "wmi-events.h"
24 #include "wmi-gamezone.h"
25 #include "wmi-helpers.h"
26 #include "wmi-other.h"
28 #define LENOVO_GAMEZONE_GUID "887B54E3-DDDC-4B2C-8B88-68A26A8835D0"
55 * lwmi_gz_mode_call() - Call method for lenovo-wmi-other driver notifier.
57 * @nb: The notifier_block registered to lenovo-wmi-other driver.
75 scoped_guard(spinlock, &priv->gz_mode_lock) { in lwmi_gz_mode_call()
76 **mode = priv->current_mode; in lwmi_gz_mode_call()
85 * lwmi_gz_event_call() - Call method for lenovo-wmi-events driver notifier.
87 * @nb: The notifier_block registered to lenovo-wmi-events driver.
106 scoped_guard(spinlock, &priv->gz_mode_lock) { in lwmi_gz_event_call()
107 priv->current_mode = *mode; in lwmi_gz_event_call()
109 platform_profile_notify(priv->ppdev); in lwmi_gz_event_call()
117 * lwmi_gz_thermal_mode_supported() - Get the version of the WMI
118 * interface to determine the support level.
120 * @supported: Pointer to return the support level with.
132 * lwmi_gz_thermal_mode_get() - Get the current thermal mode.
146 * lwmi_gz_profile_get() - Get the current platform profile.
148 * @profile: Pointer to provide the current platform profile with.
150 * Call lwmi_gz_thermal_mode_get and convert the thermal mode into a platform
151 * profile based on the support level of the interface.
162 ret = lwmi_gz_thermal_mode_get(priv->wdev, &mode); in lwmi_gz_profile_get()
174 if (priv->extreme_supported) { in lwmi_gz_profile_get()
187 return -EINVAL; in lwmi_gz_profile_get()
190 guard(spinlock)(&priv->gz_mode_lock); in lwmi_gz_profile_get()
191 priv->current_mode = mode; in lwmi_gz_profile_get()
197 * lwmi_gz_profile_set() - Set the current platform profile.
199 * @profile: Pointer to the desired platform profile.
201 * Convert the given platform profile into a thermal mode based on the support
202 * level of the interface, then call the WMI method to set the thermal mode.
225 if (priv->extreme_supported) { in lwmi_gz_profile_set()
235 return -EOPNOTSUPP; in lwmi_gz_profile_set()
240 ret = lwmi_dev_evaluate_int(priv->wdev, 0x0, in lwmi_gz_profile_set()
246 guard(spinlock)(&priv->gz_mode_lock); in lwmi_gz_profile_set()
247 priv->current_mode = mode; in lwmi_gz_profile_set()
282 * lwmi_gz_extreme_supported() - Evaluate if a device supports extreme thermal mode.
305 quirks = dmi_id->driver_data; in lwmi_gz_extreme_supported()
307 return quirks->extreme_supported; in lwmi_gz_extreme_supported()
311 * lwmi_gz_platform_profile_probe - Enable and set up the platform profile
314 * @choices: Container for enabled platform profiles.
316 * Determine if thermal mode is supported, and if so to what feature level.
317 * Then enable all supported platform profiles.
327 ret = lwmi_gz_thermal_mode_supported(priv->wdev, &profile_support_ver); in lwmi_gz_platform_profile_probe()
332 return -ENODEV; in lwmi_gz_platform_profile_probe()
339 priv->extreme_supported = lwmi_gz_extreme_supported(profile_support_ver); in lwmi_gz_platform_profile_probe()
340 if (priv->extreme_supported) in lwmi_gz_platform_profile_probe()
357 priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); in lwmi_gz_probe()
359 return -ENOMEM; in lwmi_gz_probe()
361 priv->wdev = wdev; in lwmi_gz_probe()
362 dev_set_drvdata(&wdev->dev, priv); in lwmi_gz_probe()
364 priv->ppdev = devm_platform_profile_register(&wdev->dev, "lenovo-wmi-gamezone", in lwmi_gz_probe()
366 if (IS_ERR(priv->ppdev)) in lwmi_gz_probe()
367 return -ENODEV; in lwmi_gz_probe()
369 spin_lock_init(&priv->gz_mode_lock); in lwmi_gz_probe()
371 ret = lwmi_gz_thermal_mode_get(wdev, &priv->current_mode); in lwmi_gz_probe()
375 priv->event_nb.notifier_call = lwmi_gz_event_call; in lwmi_gz_probe()
376 ret = devm_lwmi_events_register_notifier(&wdev->dev, &priv->event_nb); in lwmi_gz_probe()
380 priv->mode_nb.notifier_call = lwmi_gz_mode_call; in lwmi_gz_probe()
381 return devm_lwmi_om_register_notifier(&wdev->dev, &priv->mode_nb); in lwmi_gz_probe()