// SPDX-License-Identifier: GPL-2.0-only /* * Driver for Dell laptop extras * * Copyright (c) Lyndon Sanche <[email protected]> * * Based on documentation in the libsmbios package: * Copyright (C) 2005-2014 Dell Inc. */ #define pr_fmt(fmt) … #include <linux/bitfield.h> #include <linux/bits.h> #include <linux/dmi.h> #include <linux/err.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_profile.h> #include <linux/slab.h> #include "dell-smbios.h" static const struct dmi_system_id dell_device_table[] __initconst = …; MODULE_DEVICE_TABLE(dmi, dell_device_table); /* Derived from smbios-thermal-ctl * * cbClass 17 * cbSelect 19 * User Selectable Thermal Tables(USTT) * cbArg1 determines the function to be performed * cbArg1 0x0 = Get Thermal Information * cbRES1 Standard return codes (0, -1, -2) * cbRES2, byte 0 Bitmap of supported thermal modes. A mode is supported if * its bit is set to 1 * Bit 0 Balanced * Bit 1 Cool Bottom * Bit 2 Quiet * Bit 3 Performance * cbRES2, byte 1 Bitmap of supported Active Acoustic Controller (AAC) modes. * Each mode corresponds to the supported thermal modes in * byte 0. A mode is supported if its bit is set to 1. * Bit 0 AAC (Balanced) * Bit 1 AAC (Cool Bottom * Bit 2 AAC (Quiet) * Bit 3 AAC (Performance) * cbRes3, byte 0 Current Thermal Mode * Bit 0 Balanced * Bit 1 Cool Bottom * Bit 2 Quiet * Bit 3 Performanc * cbRes3, byte 1 AAC Configuration type * 0 Global (AAC enable/disable applies to all supported USTT modes) * 1 USTT mode specific * cbRes3, byte 2 Current Active Acoustic Controller (AAC) Mode * If AAC Configuration Type is Global, * 0 AAC mode disabled * 1 AAC mode enabled * If AAC Configuration Type is USTT mode specific (multiple bits may be set), * Bit 0 AAC (Balanced) * Bit 1 AAC (Cool Bottom * Bit 2 AAC (Quiet) * Bit 3 AAC (Performance) * cbRes3, byte 3 Current Fan Failure Mode * Bit 0 Minimal Fan Failure (at least one fan has failed, one fan working) * Bit 1 Catastrophic Fan Failure (all fans have failed) * * cbArg1 0x1 (Set Thermal Information), both desired thermal mode and * desired AAC mode shall be applied * cbArg2, byte 0 Desired Thermal Mode to set * (only one bit may be set for this parameter) * Bit 0 Balanced * Bit 1 Cool Bottom * Bit 2 Quiet * Bit 3 Performance * cbArg2, byte 1 Desired Active Acoustic Controller (AAC) Mode to set * If AAC Configuration Type is Global, * 0 AAC mode disabled * 1 AAC mode enabled * If AAC Configuration Type is USTT mode specific * (multiple bits may be set for this parameter), * Bit 0 AAC (Balanced) * Bit 1 AAC (Cool Bottom * Bit 2 AAC (Quiet) * Bit 3 AAC (Performance) */ #define DELL_ACC_GET_FIELD … #define DELL_ACC_SET_FIELD … #define DELL_THERMAL_SUPPORTED … static struct platform_profile_handler *thermal_handler; enum thermal_mode_bits { … }; static int thermal_get_mode(void) { … } static int thermal_get_supported_modes(int *supported_bits) { … } static int thermal_get_acc_mode(int *acc_mode) { … } static int thermal_set_mode(enum thermal_mode_bits state) { … } static int thermal_platform_profile_set(struct platform_profile_handler *pprof, enum platform_profile_option profile) { … } static int thermal_platform_profile_get(struct platform_profile_handler *pprof, enum platform_profile_option *profile) { … } static int thermal_init(void) { … } static void thermal_cleanup(void) { … } static int __init dell_init(void) { … } static void __exit dell_exit(void) { … } module_init(…) …; module_exit(dell_exit); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;