Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'platform-drivers-x86-v5.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver updates from Hans de Goede:
"Highlights:

- Move all the Intel drivers into their own subdir(s) (mostly Kate's
work)

- New meraki-mx100 platform driver

- Asus WMI driver enhancements, including support for
/sys/firmware/acpi/platform_profile

- New BIOS SAR driver for Intel M.2 WWAM modems

- Alder Lake support for the Intel PMC driver

- A whole bunch of cleanups + fixes all over the place"

* tag 'platform-drivers-x86-v5.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (65 commits)
platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call
platform/x86: dell-smbios-wmi: Avoid false-positive memcpy() warning
platform/x86: ISST: use semi-colons instead of commas
platform/x86: asus-wmi: Fix "unsigned 'retval' is never less than zero" smatch warning
platform/x86: asus-wmi: Delete impossible condition
platform/x86: hp_accel: Convert to be a platform driver
platform/x86: hp_accel: Remove _INI method call
platform/mellanox: mlxbf-pmc: fix kernel-doc notation
platform/x86/intel: pmc/core: Add GBE Package C10 fix for Alder Lake PCH
platform/x86/intel: pmc/core: Add Alder Lake low power mode support for pmc core
platform/x86/intel: pmc/core: Add Latency Tolerance Reporting (LTR) support to Alder Lake
platform/x86/intel: pmc/core: Add Alderlake support to pmc core driver
platform/x86: intel-wmi-thunderbolt: Move to intel sub-directory
platform/x86: intel-wmi-sbl-fw-update: Move to intel sub-directory
platform/x86: intel-vbtn: Move to intel sub-directory
platform/x86: intel_oaktrail: Move to intel sub-directory
platform/x86: intel_int0002_vgpio: Move to intel sub-directory
platform/x86: intel-hid: Move to intel sub-directory
platform/x86: intel_atomisp2: Move to intel sub-directory
platform/x86: intel_speed_select_if: Move to intel sub-directory
...

+2431 -638
+1 -1
Documentation/ABI/testing/dell-smbios-wmi
··· 1 1 What: /dev/wmi/dell-smbios 2 2 Date: November 2017 3 3 KernelVersion: 4.15 4 - Contact: "Mario Limonciello" <mario.limonciello@dell.com> 4 + Contact: Dell.Client.Kernel@dell.com 5 5 Description: 6 6 Perform SMBIOS calls on supported Dell machines. 7 7 through the Dell ACPI-WMI interface.
+1 -1
Documentation/ABI/testing/sysfs-bus-thunderbolt
··· 232 232 What: /sys/bus/thunderbolt/devices/.../nvm_authenticate_on_disconnect 233 233 Date: Oct 2020 234 234 KernelVersion: v5.9 235 - Contact: Mario Limonciello <mario.limonciello@dell.com> 235 + Contact: Mario Limonciello <mario.limonciello@outlook.com> 236 236 Description: For supported devices, automatically authenticate the new Thunderbolt 237 237 image when the device is disconnected from the host system. 238 238
+15 -4
Documentation/ABI/testing/sysfs-class-firmware-attributes
··· 2 2 Date: February 2021 3 3 KernelVersion: 5.11 4 4 Contact: Divya Bharathi <Divya.Bharathi@Dell.com>, 5 - Mario Limonciello <mario.limonciello@dell.com>, 6 5 Prasanth KSR <prasanth.ksr@dell.com> 6 + Dell.Client.Kernel@dell.com 7 7 Description: 8 8 A sysfs interface for systems management software to enable 9 9 configuration capability on supported systems. This directory ··· 130 130 Date: February 2021 131 131 KernelVersion: 5.11 132 132 Contact: Divya Bharathi <Divya.Bharathi@Dell.com>, 133 - Mario Limonciello <mario.limonciello@dell.com>, 134 133 Prasanth KSR <prasanth.ksr@dell.com> 134 + Dell.Client.Kernel@dell.com 135 135 Description: 136 136 Devices support various authentication mechanisms which can be exposed 137 137 as a separate configuration object. ··· 220 220 Date: February 2021 221 221 KernelVersion: 5.11 222 222 Contact: Divya Bharathi <Divya.Bharathi@Dell.com>, 223 - Mario Limonciello <mario.limonciello@dell.com>, 224 223 Prasanth KSR <prasanth.ksr@dell.com> 224 + Dell.Client.Kernel@dell.com 225 225 Description: 226 226 A read-only attribute reads 1 if a reboot is necessary to apply 227 227 pending BIOS attribute changes. Also, an uevent_KOBJ_CHANGE is ··· 249 249 Date: February 2021 250 250 KernelVersion: 5.11 251 251 Contact: Divya Bharathi <Divya.Bharathi@Dell.com>, 252 - Mario Limonciello <mario.limonciello@dell.com>, 253 252 Prasanth KSR <prasanth.ksr@dell.com> 253 + Dell.Client.Kernel@dell.com 254 254 Description: 255 255 This attribute can be used to reset the BIOS Configuration. 256 256 Specifically, it tells which type of reset BIOS configuration is being ··· 272 272 273 273 Note that any changes to this attribute requires a reboot 274 274 for changes to take effect. 275 + 276 + What: /sys/class/firmware-attributes/*/attributes/debug_cmd 277 + Date: July 2021 278 + KernelVersion: 5.14 279 + Contact: Mark Pearson <markpearson@lenovo.com> 280 + Description: 281 + This write only attribute can be used to send debug commands to the BIOS. 282 + This should only be used when recommended by the BIOS vendor. Vendors may 283 + use it to enable extra debug attributes or BIOS features for testing purposes. 284 + 285 + Note that any changes to this attribute requires a reboot for changes to take effect.
+54
Documentation/ABI/testing/sysfs-driver-intc_sar
··· 1 + What: /sys/bus/platform/devices/INTC1092:00/intc_reg 2 + Date: August 2021 3 + KernelVersion: 5.15 4 + Contact: Shravan S <s.shravan@intel.com>, 5 + An Sudhakar <sudhakar.an@intel.com> 6 + Description: 7 + Specific Absorption Rate (SAR) regulatory mode is typically 8 + derived based on information like mcc (Mobile Country Code) and 9 + mnc (Mobile Network Code) that is available for the currently 10 + attached LTE network. A userspace application is required to set 11 + the current SAR regulatory mode on the Dynamic SAR driver using 12 + this sysfs node. Such an application can also read back using 13 + this sysfs node, the currently configured regulatory mode value 14 + from the Dynamic SAR driver. 15 + 16 + Acceptable regulatory modes are: 17 + == ==== 18 + 0 FCC 19 + 1 CE 20 + 2 ISED 21 + == ==== 22 + 23 + - The regulatory mode value has one of the above values. 24 + - The default regulatory mode used in the driver is 0. 25 + 26 + What: /sys/bus/platform/devices/INTC1092:00/intc_data 27 + Date: August 2021 28 + KernelVersion: 5.15 29 + Contact: Shravan S <s.shravan@intel.com>, 30 + An Sudhakar <sudhakar.an@intel.com> 31 + Description: 32 + This sysfs entry is used to retrieve Dynamic SAR information 33 + emitted/maintained by a BIOS that supports Dynamic SAR. 34 + 35 + The retrieved information is in the order given below: 36 + - device_mode 37 + - bandtable_index 38 + - antennatable_index 39 + - sartable_index 40 + 41 + The above information is sent as integer values separated 42 + by a single space. This information can then be pushed to a 43 + WWAN modem that uses this to control the transmit signal 44 + level using the Band/Antenna/SAR table index information. 45 + These parameters are derived/decided by aggregating 46 + device-mode like laptop/tablet/clamshell etc. and the 47 + proximity-sensor data available to the embedded controller on 48 + given host. The regulatory mode configured on Dynamic SAR 49 + driver also influences these values. 50 + 51 + The userspace applications can poll for changes to this file 52 + using POLLPRI event on file-descriptor (fd) obtained by opening 53 + this sysfs entry. Application can then read this information from 54 + the sysfs node and consume the given information.
+1 -1
Documentation/ABI/testing/sysfs-platform-dell-smbios
··· 1 1 What: /sys/devices/platform/<platform>/tokens/* 2 2 Date: November 2017 3 3 KernelVersion: 4.15 4 - Contact: "Mario Limonciello" <mario.limonciello@dell.com> 4 + Contact: Dell.Client.Kernel@dell.com 5 5 Description: 6 6 A read-only description of Dell platform tokens 7 7 available on the machine.
+1 -1
Documentation/ABI/testing/sysfs-platform-intel-wmi-thunderbolt
··· 1 1 What: /sys/devices/platform/<platform>/force_power 2 2 Date: September 2017 3 3 KernelVersion: 4.15 4 - Contact: "Mario Limonciello" <mario.limonciello@dell.com> 4 + Contact: "Mario Limonciello" <mario.limonciello@outlook.com> 5 5 Description: 6 6 Modify the platform force power state, influencing 7 7 Thunderbolt controllers to turn on or off when no
+1 -1
Documentation/ABI/testing/sysfs-power
··· 295 295 296 296 What: /sys/power/resume_offset 297 297 Date: April 2018 298 - Contact: Mario Limonciello <mario.limonciello@dell.com> 298 + Contact: Mario Limonciello <mario.limonciello@outlook.com> 299 299 Description: 300 300 This file is used for telling the kernel an offset into a disk 301 301 to use when hibernating the system such as with a swap file.
+1 -3
Documentation/admin-guide/laptops/lg-laptop.rst
··· 13 13 The following FN keys are ignored by the kernel without this driver: 14 14 15 15 - FN-F1 (LG control panel) - Generates F15 16 - - FN-F5 (Touchpad toggle) - Generates F13 16 + - FN-F5 (Touchpad toggle) - Generates F21 17 17 - FN-F6 (Airplane mode) - Generates RFKILL 18 - - FN-F8 (Keyboard backlight) - Generates F16. 19 - This key also changes keyboard backlight mode. 20 18 - FN-F9 (Reader mode) - Generates F14 21 19 22 20 The rest of the FN keys work without a need for a special driver.
+21 -14
MAINTAINERS
··· 9269 9269 M: Hans de Goede <hdegoede@redhat.com> 9270 9270 L: platform-driver-x86@vger.kernel.org 9271 9271 S: Maintained 9272 - F: drivers/platform/x86/intel_atomisp2_pm.c 9272 + F: drivers/platform/x86/intel/atomisp2/pm.c 9273 9273 9274 9274 INTEL ATOMISP2 LED DRIVER 9275 9275 M: Hans de Goede <hdegoede@redhat.com> 9276 9276 L: platform-driver-x86@vger.kernel.org 9277 9277 S: Maintained 9278 - F: drivers/platform/x86/intel_atomisp2_led.c 9278 + F: drivers/platform/x86/intel/atomisp2/led.c 9279 + 9280 + INTEL BIOS SAR INT1092 DRIVER 9281 + M: Shravan S <s.shravan@intel.com> 9282 + M: Intel Corporation <linuxwwan@intel.com> 9283 + L: platform-driver-x86@vger.kernel.org 9284 + S: Maintained 9285 + F: drivers/platform/x86/intel/int1092/ 9279 9286 9280 9287 INTEL BROXTON PMC DRIVER 9281 9288 M: Mika Westerberg <mika.westerberg@linux.intel.com> ··· 9378 9371 M: Alex Hung <alex.hung@canonical.com> 9379 9372 L: platform-driver-x86@vger.kernel.org 9380 9373 S: Maintained 9381 - F: drivers/platform/x86/intel-hid.c 9374 + F: drivers/platform/x86/intel/hid.c 9382 9375 9383 9376 INTEL I/OAT DMA DRIVER 9384 9377 M: Dave Jiang <dave.jiang@intel.com> ··· 9522 9515 9523 9516 INTEL MENLOW THERMAL DRIVER 9524 9517 M: Sujith Thomas <sujith.thomas@intel.com> 9525 - L: platform-driver-x86@vger.kernel.org 9518 + L: linux-pm@vger.kernel.org 9526 9519 S: Supported 9527 9520 W: https://01.org/linux-acpi 9528 - F: drivers/platform/x86/intel_menlow.c 9521 + F: drivers/thermal/intel/intel_menlow.c 9529 9522 9530 9523 INTEL P-Unit IPC DRIVER 9531 9524 M: Zha Qipeng <qipeng.zha@intel.com> 9532 9525 L: platform-driver-x86@vger.kernel.org 9533 9526 S: Maintained 9534 9527 F: arch/x86/include/asm/intel_punit_ipc.h 9535 - F: drivers/platform/x86/intel_punit_ipc.c 9528 + F: drivers/platform/x86/intel/punit_ipc.c 9536 9529 9537 9530 INTEL PMC CORE DRIVER 9538 9531 M: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com> ··· 9540 9533 L: platform-driver-x86@vger.kernel.org 9541 9534 S: Maintained 9542 9535 F: Documentation/ABI/testing/sysfs-platform-intel-pmc 9543 - F: drivers/platform/x86/intel_pmc_core* 9536 + F: drivers/platform/x86/intel/pmc/ 9544 9537 9545 9538 INTEL PMIC GPIO DRIVERS 9546 9539 M: Andy Shevchenko <andy@kernel.org> ··· 9558 9551 M: "David E. Box" <david.e.box@linux.intel.com> 9559 9552 S: Maintained 9560 9553 F: drivers/mfd/intel_pmt.c 9561 - F: drivers/platform/x86/intel_pmt_* 9554 + F: drivers/platform/x86/intel/pmt/ 9562 9555 9563 9556 INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT 9564 9557 M: Stanislav Yakovlev <stas.yakovlev@gmail.com> ··· 9595 9588 M: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 9596 9589 L: platform-driver-x86@vger.kernel.org 9597 9590 S: Maintained 9598 - F: drivers/platform/x86/intel_speed_select_if/ 9591 + F: drivers/platform/x86/intel/speed_select_if/ 9599 9592 F: include/uapi/linux/isst_if.h 9600 9593 F: tools/power/x86/intel-speed-select/ 9601 9594 ··· 9616 9609 L: platform-driver-x86@vger.kernel.org 9617 9610 S: Maintained 9618 9611 F: arch/x86/include/asm/intel_telemetry.h 9619 - F: drivers/platform/x86/intel_telemetry* 9612 + F: drivers/platform/x86/intel/telemetry/ 9620 9613 9621 9614 INTEL UNCORE FREQUENCY CONTROL 9622 9615 M: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 9623 9616 L: platform-driver-x86@vger.kernel.org 9624 9617 S: Maintained 9625 - F: drivers/platform/x86/intel-uncore-frequency.c 9618 + F: drivers/platform/x86/intel/uncore-frequency.c 9626 9619 9627 9620 INTEL VIRTUAL BUTTON DRIVER 9628 9621 M: AceLan Kao <acelan.kao@canonical.com> 9629 9622 L: platform-driver-x86@vger.kernel.org 9630 9623 S: Maintained 9631 - F: drivers/platform/x86/intel-vbtn.c 9624 + F: drivers/platform/x86/intel/vbtn.c 9632 9625 9633 9626 INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy) 9634 9627 M: Stanislaw Gruszka <stf_xl@wp.pl> ··· 9649 9642 R: Maurice Ma <maurice.ma@intel.com> 9650 9643 S: Maintained 9651 9644 W: https://slimbootloader.github.io/security/firmware-update.html 9652 - F: drivers/platform/x86/intel-wmi-sbl-fw-update.c 9645 + F: drivers/platform/x86/intel/wmi/sbl-fw-update.c 9653 9646 9654 9647 INTEL WMI THUNDERBOLT FORCE POWER DRIVER 9655 9648 L: Dell.Client.Kernel@dell.com 9656 9649 S: Maintained 9657 - F: drivers/platform/x86/intel-wmi-thunderbolt.c 9650 + F: drivers/platform/x86/intel/wmi/thunderbolt.c 9658 9651 9659 9652 INTEL WWAN IOSM DRIVER 9660 9653 M: M Chetan Kumar <m.chetan.kumar@intel.com>
+32
drivers/i2c/i2c-core-acpi.c
··· 69 69 } 70 70 EXPORT_SYMBOL_GPL(i2c_acpi_get_i2c_resource); 71 71 72 + static int i2c_acpi_resource_count(struct acpi_resource *ares, void *data) 73 + { 74 + struct acpi_resource_i2c_serialbus *sb; 75 + int *count = data; 76 + 77 + if (i2c_acpi_get_i2c_resource(ares, &sb)) 78 + *count = *count + 1; 79 + 80 + return 1; 81 + } 82 + 83 + /** 84 + * i2c_acpi_client_count - Count the number of I2cSerialBus resources 85 + * @adev: ACPI device 86 + * 87 + * Returns the number of I2cSerialBus resources in the ACPI-device's 88 + * resource-list; or a negative error code. 89 + */ 90 + int i2c_acpi_client_count(struct acpi_device *adev) 91 + { 92 + int ret, count = 0; 93 + LIST_HEAD(r); 94 + 95 + ret = acpi_dev_get_resources(adev, &r, i2c_acpi_resource_count, &count); 96 + if (ret < 0) 97 + return ret; 98 + 99 + acpi_dev_free_resource_list(&r); 100 + return count; 101 + } 102 + EXPORT_SYMBOL_GPL(i2c_acpi_client_count); 103 + 72 104 static int i2c_acpi_fill_info(struct acpi_resource *ares, void *data) 73 105 { 74 106 struct i2c_acpi_lookup *lookup = data;
-1
drivers/misc/lis3lv02d/lis3lv02d.h
··· 271 271 int regs_size; 272 272 u8 *reg_cache; 273 273 bool regs_stored; 274 - bool init_required; 275 274 u8 odr_mask; /* ODR bit mask */ 276 275 u8 whoami; /* indicates measurement precision */ 277 276 s16 (*read_data) (struct lis3lv02d *lis3, int reg);
+7 -6
drivers/platform/mellanox/mlxbf-pmc.c
··· 79 79 #define MLXBF_PMC_L3C_PERF_CNT_HIGH_VAL GENMASK(24, 0) 80 80 81 81 /** 82 - * Structure to hold attribute and block info for each sysfs entry 82 + * struct mlxbf_pmc_attribute - Structure to hold attribute and block info 83 + * for each sysfs entry 83 84 * @dev_attr: Device attribute struct 84 85 * @index: index to identify counter number within a block 85 86 * @nr: block number to which the sysfs belongs ··· 92 91 }; 93 92 94 93 /** 95 - * Structure to hold info for each HW block 94 + * struct mlxbf_pmc_block_info - Structure to hold info for each HW block 96 95 * 97 96 * @mmio_base: The VA at which the PMC block is mapped 98 97 * @blk_size: Size of each mapped region ··· 103 102 * @attr_event_list: Attributes for "event_list" sysfs files 104 103 * @attr_enable: Attributes for "enable" sysfs files 105 104 * @block_attr: All attributes needed for the block 106 - * @blcok_attr_grp: Attribute group for the block 105 + * @block_attr_grp: Attribute group for the block 107 106 */ 108 107 struct mlxbf_pmc_block_info { 109 108 void __iomem *mmio_base; ··· 119 118 }; 120 119 121 120 /** 122 - * Structure to hold PMC context info 121 + * struct mlxbf_pmc_context - Structure to hold PMC context info 123 122 * 124 123 * @pdev: The kernel structure representing the device 125 124 * @total_blocks: Total number of blocks ··· 128 127 * @block_name: Block name 129 128 * @block: Block info 130 129 * @groups: Attribute groups from each block 131 - * @sv_sreg_support: Whether SMCs are used to access performance registers 130 + * @svc_sreg_support: Whether SMCs are used to access performance registers 132 131 * @sreg_tbl_perf: Secure register access table number 133 132 * @event_set: Event set to use 134 133 */ ··· 146 145 }; 147 146 148 147 /** 149 - * Structure to hold supported events for each block 148 + * struct mlxbf_pmc_events - Structure to hold supported events for each block 150 149 * @evt_num: Event number used to program counters 151 150 * @evt_name: Name of the event 152 151 */
+6 -9
drivers/platform/surface/aggregator/Makefile
··· 6 6 7 7 obj-$(CONFIG_SURFACE_AGGREGATOR) += surface_aggregator.o 8 8 9 - surface_aggregator-objs := core.o 10 - surface_aggregator-objs += ssh_parser.o 11 - surface_aggregator-objs += ssh_packet_layer.o 12 - surface_aggregator-objs += ssh_request_layer.o 13 - surface_aggregator-objs += controller.o 14 - 15 - ifeq ($(CONFIG_SURFACE_AGGREGATOR_BUS),y) 16 - surface_aggregator-objs += bus.o 17 - endif 9 + surface_aggregator-y := core.o 10 + surface_aggregator-y += ssh_parser.o 11 + surface_aggregator-y += ssh_packet_layer.o 12 + surface_aggregator-y += ssh_request_layer.o 13 + surface_aggregator-$(CONFIG_SURFACE_AGGREGATOR_BUS) += bus.o 14 + surface_aggregator-y += controller.o
+1 -7
drivers/platform/surface/surface3_power.c
··· 384 384 if (ACPI_FAILURE(ret)) 385 385 return ret; 386 386 387 - if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) { 388 - ret = AE_BAD_PARAMETER; 389 - goto err; 390 - } 391 - 392 - sb = &ares->data.i2c_serial_bus; 393 - if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) { 387 + if (!value64 || !i2c_acpi_get_i2c_resource(ares, &sb)) { 394 388 ret = AE_BAD_PARAMETER; 395 389 goto err; 396 390 }
+14 -277
drivers/platform/x86/Kconfig
··· 77 77 To compile this driver as a module, choose M here: the module will 78 78 be called uv_sysfs. 79 79 80 - config INTEL_WMI_SBL_FW_UPDATE 81 - tristate "Intel WMI Slim Bootloader firmware update signaling driver" 82 - depends on ACPI_WMI 83 - help 84 - Say Y here if you want to be able to use the WMI interface to signal 85 - Slim Bootloader to trigger update on next reboot. 86 - 87 - To compile this driver as a module, choose M here: the module will 88 - be called intel-wmi-sbl-fw-update. 89 - 90 - config INTEL_WMI_THUNDERBOLT 91 - tristate "Intel WMI thunderbolt force power driver" 92 - depends on ACPI_WMI 93 - help 94 - Say Y here if you want to be able to use the WMI interface on select 95 - systems to force the power control of Intel Thunderbolt controllers. 96 - This is useful for updating the firmware when devices are not plugged 97 - into the controller. 98 - 99 - To compile this driver as a module, choose M here: the module will 100 - be called intel-wmi-thunderbolt. 101 - 102 80 config MXM_WMI 103 81 tristate "WMI support for MXM Laptop Graphics" 104 82 depends on ACPI_WMI ··· 259 281 select INPUT_SPARSEKMAP 260 282 select LEDS_CLASS 261 283 select NEW_LEDS 284 + select ACPI_PLATFORM_PROFILE 262 285 help 263 286 Say Y here if you have a WMI aware Asus laptop (like Eee PCs or new 264 287 Asus Notebooks). ··· 280 301 281 302 If you have an ACPI-WMI compatible Asus Notebook, say Y or M 282 303 here. 304 + 305 + config MERAKI_MX100 306 + tristate "Cisco Meraki MX100 Platform Driver" 307 + depends on GPIOLIB 308 + depends on GPIO_ICH 309 + depends on LEDS_CLASS 310 + select LEDS_GPIO 311 + help 312 + This driver provides support for the front button and LEDs on 313 + the Cisco Meraki MX100 (Tinkerbell) 1U appliance. 314 + 315 + To compile this driver as a module, choose M here: the module 316 + will be called meraki-mx100. 283 317 284 318 config EEEPC_LAPTOP 285 319 tristate "Eee PC Hotkey Driver" ··· 645 653 be called think-lmi. 646 654 647 655 source "drivers/platform/x86/intel/Kconfig" 648 - 649 - config INTEL_ATOMISP2_LED 650 - tristate "Intel AtomISP2 camera LED driver" 651 - depends on GPIOLIB && LEDS_GPIO 652 - help 653 - Many Bay Trail and Cherry Trail devices come with a camera attached 654 - to Intel's Image Signal Processor. Linux currently does not have a 655 - driver for these, so they do not work as a camera. Some of these 656 - camera's have a LED which is controlled through a GPIO. 657 - 658 - Some of these devices have a firmware issue where the LED gets turned 659 - on at boot. This driver will turn the LED off at boot and also allows 660 - controlling the LED (repurposing it) through the sysfs LED interface. 661 - 662 - Which GPIO is attached to the LED is usually not described in the 663 - ACPI tables, so this driver contains per-system info about the GPIO 664 - inside the driver, this means that this driver only works on systems 665 - the driver knows about. 666 - 667 - To compile this driver as a module, choose M here: the module 668 - will be called intel_atomisp2_led. 669 - 670 - config INTEL_ATOMISP2_PM 671 - tristate "Intel AtomISP2 dummy / power-management driver" 672 - depends on PCI && IOSF_MBI && PM 673 - depends on !INTEL_ATOMISP 674 - help 675 - Power-management driver for Intel's Image Signal Processor found on 676 - Bay Trail and Cherry Trail devices. This dummy driver's sole purpose 677 - is to turn the ISP off (put it in D3) to save power and to allow 678 - entering of S0ix modes. 679 - 680 - To compile this driver as a module, choose M here: the module 681 - will be called intel_atomisp2_pm. 682 - 683 - config INTEL_HID_EVENT 684 - tristate "INTEL HID Event" 685 - depends on ACPI 686 - depends on INPUT 687 - depends on I2C 688 - select INPUT_SPARSEKMAP 689 - help 690 - This driver provides support for the Intel HID Event hotkey interface. 691 - Some laptops require this driver for hotkey support. 692 - 693 - To compile this driver as a module, choose M here: the module will 694 - be called intel_hid. 695 - 696 - config INTEL_INT0002_VGPIO 697 - tristate "Intel ACPI INT0002 Virtual GPIO driver" 698 - depends on GPIOLIB && ACPI && PM_SLEEP 699 - select GPIOLIB_IRQCHIP 700 - help 701 - Some peripherals on Bay Trail and Cherry Trail platforms signal a 702 - Power Management Event (PME) to the Power Management Controller (PMC) 703 - to wakeup the system. When this happens software needs to explicitly 704 - clear the PME bus 0 status bit in the GPE0a_STS register to avoid an 705 - IRQ storm on IRQ 9. 706 - 707 - This is modelled in ACPI through the INT0002 ACPI device, which is 708 - called a "Virtual GPIO controller" in ACPI because it defines the 709 - event handler to call when the PME triggers through _AEI and _L02 710 - methods as would be done for a real GPIO interrupt in ACPI. 711 - 712 - To compile this driver as a module, choose M here: the module will 713 - be called intel_int0002_vgpio. 714 - 715 - config INTEL_MENLOW 716 - tristate "Thermal Management driver for Intel menlow platform" 717 - depends on ACPI_THERMAL 718 - select THERMAL 719 - help 720 - ACPI thermal management enhancement driver on 721 - Intel Menlow platform. 722 - 723 - If unsure, say N. 724 - 725 - config INTEL_OAKTRAIL 726 - tristate "Intel Oaktrail Platform Extras" 727 - depends on ACPI 728 - depends on ACPI_VIDEO || ACPI_VIDEO = n 729 - depends on RFKILL && BACKLIGHT_CLASS_DEVICE && ACPI 730 - help 731 - Intel Oaktrail platform need this driver to provide interfaces to 732 - enable/disable the Camera, WiFi, BT etc. devices. If in doubt, say Y 733 - here; it will only load on supported platforms. 734 - 735 - config INTEL_VBTN 736 - tristate "INTEL VIRTUAL BUTTON" 737 - depends on ACPI 738 - depends on INPUT 739 - depends on I2C 740 - select INPUT_SPARSEKMAP 741 - help 742 - This driver provides support for the Intel Virtual Button interface. 743 - Some laptops require this driver for power button support. 744 - 745 - To compile this driver as a module, choose M here: the module will 746 - be called intel_vbtn. 747 656 748 657 config MSI_LAPTOP 749 658 tristate "MSI Laptop Extras" ··· 999 1106 functionality. If in doubt, say Y here; it will only load on 1000 1107 supported platforms. 1001 1108 1002 - config INTEL_RST 1003 - tristate "Intel Rapid Start Technology Driver" 1004 - depends on ACPI 1005 - help 1006 - This driver provides support for modifying parameters on systems 1007 - equipped with Intel's Rapid Start Technology. When put in an ACPI 1008 - sleep state, these devices will wake after either a configured 1009 - timeout or when the system battery reaches a critical state, 1010 - automatically copying memory contents to disk. On resume, the 1011 - firmware will copy the memory contents back to RAM and resume the OS 1012 - as usual. 1013 - 1014 - config INTEL_SMARTCONNECT 1015 - tristate "Intel Smart Connect disabling driver" 1016 - depends on ACPI 1017 - help 1018 - Intel Smart Connect is a technology intended to permit devices to 1019 - update state by resuming for a short period of time at regular 1020 - intervals. If a user enables this functionality under Windows and 1021 - then reboots into Linux, the system may remain configured to resume 1022 - on suspend. In the absence of any userspace to support it, the system 1023 - will then remain awake until something triggers another suspend. 1024 - 1025 - This driver checks to determine whether the device has Intel Smart 1026 - Connect enabled, and if so disables it. 1027 - 1028 - source "drivers/platform/x86/intel_speed_select_if/Kconfig" 1029 - 1030 - config INTEL_TURBO_MAX_3 1031 - bool "Intel Turbo Boost Max Technology 3.0 enumeration driver" 1032 - depends on X86_64 && SCHED_MC_PRIO 1033 - help 1034 - This driver reads maximum performance ratio of each CPU and set up 1035 - the scheduler priority metrics. In this way scheduler can prefer 1036 - CPU with higher performance to schedule tasks. 1037 - This driver is only required when the system is not using Hardware 1038 - P-States (HWP). In HWP mode, priority can be read from ACPI tables. 1039 - 1040 - config INTEL_UNCORE_FREQ_CONTROL 1041 - tristate "Intel Uncore frequency control driver" 1042 - depends on X86_64 1043 - help 1044 - This driver allows control of uncore frequency limits on 1045 - supported server platforms. 1046 - Uncore frequency controls RING/LLC (last-level cache) clocks. 1047 - 1048 - To compile this driver as a module, choose M here: the module 1049 - will be called intel-uncore-frequency. 1050 - 1051 - config INTEL_BXTWC_PMIC_TMU 1052 - tristate "Intel BXT Whiskey Cove TMU Driver" 1053 - depends on REGMAP 1054 - depends on MFD_INTEL_PMC_BXT 1055 - depends on INTEL_SOC_PMIC_BXTWC 1056 - help 1057 - Select this driver to use Intel BXT Whiskey Cove PMIC TMU feature. 1058 - This driver enables the alarm wakeup functionality in the TMU unit 1059 - of Whiskey Cove PMIC. 1060 - 1061 - config INTEL_CHTDC_TI_PWRBTN 1062 - tristate "Intel Cherry Trail Dollar Cove TI power button driver" 1063 - depends on INTEL_SOC_PMIC_CHTDC_TI 1064 - depends on INPUT 1065 - help 1066 - This option adds a power button driver driver for Dollar Cove TI 1067 - PMIC on Intel Cherry Trail devices. 1068 - 1069 - To compile this driver as a module, choose M here: the module 1070 - will be called intel_chtdc_ti_pwrbtn. 1071 - 1072 - config INTEL_MRFLD_PWRBTN 1073 - tristate "Intel Merrifield Basin Cove power button driver" 1074 - depends on INTEL_SOC_PMIC_MRFLD 1075 - depends on INPUT 1076 - help 1077 - This option adds a power button driver for Basin Cove PMIC 1078 - on Intel Merrifield devices. 1079 - 1080 - To compile this driver as a module, choose M here: the module 1081 - will be called intel_mrfld_pwrbtn. 1082 - 1083 - config INTEL_PMC_CORE 1084 - tristate "Intel PMC Core driver" 1085 - depends on PCI 1086 - depends on ACPI 1087 - help 1088 - The Intel Platform Controller Hub for Intel Core SoCs provides access 1089 - to Power Management Controller registers via various interfaces. This 1090 - driver can utilize debugging capabilities and supported features as 1091 - exposed by the Power Management Controller. It also may perform some 1092 - tasks in the PMC in order to enable transition into the SLPS0 state. 1093 - It should be selected on all Intel platforms supported by the driver. 1094 - 1095 - Supported features: 1096 - - SLP_S0_RESIDENCY counter 1097 - - PCH IP Power Gating status 1098 - - LTR Ignore / LTR Show 1099 - - MPHY/PLL gating status (Sunrisepoint PCH only) 1100 - - SLPS0 Debug registers (Cannonlake/Icelake PCH) 1101 - - Low Power Mode registers (Tigerlake and beyond) 1102 - - PMC quirks as needed to enable SLPS0/S0ix 1103 - 1104 - config INTEL_PMT_CLASS 1105 - tristate 1106 - help 1107 - The Intel Platform Monitoring Technology (PMT) class driver provides 1108 - the basic sysfs interface and file hierarchy used by PMT devices. 1109 - 1110 - For more information, see: 1111 - <file:Documentation/ABI/testing/sysfs-class-intel_pmt> 1112 - 1113 - To compile this driver as a module, choose M here: the module 1114 - will be called intel_pmt_class. 1115 - 1116 - config INTEL_PMT_TELEMETRY 1117 - tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" 1118 - depends on MFD_INTEL_PMT 1119 - select INTEL_PMT_CLASS 1120 - help 1121 - The Intel Platform Monitory Technology (PMT) Telemetry driver provides 1122 - access to hardware telemetry metrics on devices that support the 1123 - feature. 1124 - 1125 - To compile this driver as a module, choose M here: the module 1126 - will be called intel_pmt_telemetry. 1127 - 1128 - config INTEL_PMT_CRASHLOG 1129 - tristate "Intel Platform Monitoring Technology (PMT) Crashlog driver" 1130 - depends on MFD_INTEL_PMT 1131 - select INTEL_PMT_CLASS 1132 - help 1133 - The Intel Platform Monitoring Technology (PMT) crashlog driver provides 1134 - access to hardware crashlog capabilities on devices that support the 1135 - feature. 1136 - 1137 - To compile this driver as a module, choose M here: the module 1138 - will be called intel_pmt_crashlog. 1139 - 1140 - config INTEL_PUNIT_IPC 1141 - tristate "Intel P-Unit IPC Driver" 1142 - help 1143 - This driver provides support for Intel P-Unit Mailbox IPC mechanism, 1144 - which is used to bridge the communications between kernel and P-Unit. 1145 - 1146 1109 config INTEL_SCU_IPC 1147 1110 bool 1148 1111 ··· 1045 1296 The IPC Util driver provides an interface with the SCU enabling 1046 1297 low level access for debug work and updating the firmware. Say 1047 1298 N unless you will be doing this on an Intel MID platform. 1048 - 1049 - config INTEL_TELEMETRY 1050 - tristate "Intel SoC Telemetry Driver" 1051 - depends on X86_64 1052 - depends on MFD_INTEL_PMC_BXT 1053 - depends on INTEL_PUNIT_IPC 1054 - help 1055 - This driver provides interfaces to configure and use 1056 - telemetry for INTEL SoC from APL onwards. It is also 1057 - used to get various SoC events and parameters 1058 - directly via debugfs files. Various tools may use 1059 - this interface for SoC state monitoring. 1060 1299 1061 1300 endif # X86_PLATFORM_DEVICES 1062 1301
+3 -26
drivers/platform/x86/Makefile
··· 10 10 11 11 # WMI drivers 12 12 obj-$(CONFIG_HUAWEI_WMI) += huawei-wmi.o 13 - obj-$(CONFIG_INTEL_WMI_SBL_FW_UPDATE) += intel-wmi-sbl-fw-update.o 14 - obj-$(CONFIG_INTEL_WMI_THUNDERBOLT) += intel-wmi-thunderbolt.o 15 13 obj-$(CONFIG_MXM_WMI) += mxm-wmi.o 16 14 obj-$(CONFIG_PEAQ_WMI) += peaq-wmi.o 17 15 obj-$(CONFIG_XIAOMI_WMI) += xiaomi-wmi.o ··· 36 38 obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o 37 39 obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o 38 40 obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o 41 + 42 + # Cisco/Meraki 43 + obj-$(CONFIG_MERAKI_MX100) += meraki-mx100.o 39 44 40 45 # Dell 41 46 obj-$(CONFIG_X86_PLATFORM_DRIVERS_DELL) += dell/ ··· 68 67 69 68 # Intel 70 69 obj-$(CONFIG_X86_PLATFORM_DRIVERS_INTEL) += intel/ 71 - 72 - obj-$(CONFIG_INTEL_ATOMISP2_LED) += intel_atomisp2_led.o 73 - obj-$(CONFIG_INTEL_ATOMISP2_PM) += intel_atomisp2_pm.o 74 - obj-$(CONFIG_INTEL_HID_EVENT) += intel-hid.o 75 - obj-$(CONFIG_INTEL_INT0002_VGPIO) += intel_int0002_vgpio.o 76 - obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o 77 - obj-$(CONFIG_INTEL_OAKTRAIL) += intel_oaktrail.o 78 - obj-$(CONFIG_INTEL_VBTN) += intel-vbtn.o 79 70 80 71 # MSI 81 72 obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o ··· 111 118 112 119 # Intel uncore drivers 113 120 obj-$(CONFIG_INTEL_IPS) += intel_ips.o 114 - obj-$(CONFIG_INTEL_RST) += intel-rst.o 115 - obj-$(CONFIG_INTEL_SMARTCONNECT) += intel-smartconnect.o 116 - obj-$(CONFIG_INTEL_SPEED_SELECT_INTERFACE) += intel_speed_select_if/ 117 - obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o 118 - obj-$(CONFIG_INTEL_UNCORE_FREQ_CONTROL) += intel-uncore-frequency.o 119 121 120 122 # Intel PMIC / PMC / P-Unit devices 121 - obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU) += intel_bxtwc_tmu.o 122 - obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o 123 - obj-$(CONFIG_INTEL_MRFLD_PWRBTN) += intel_mrfld_pwrbtn.o 124 - obj-$(CONFIG_INTEL_PMC_CORE) += intel_pmc_core.o intel_pmc_core_pltdrv.o 125 - obj-$(CONFIG_INTEL_PMT_CLASS) += intel_pmt_class.o 126 - obj-$(CONFIG_INTEL_PMT_TELEMETRY) += intel_pmt_telemetry.o 127 - obj-$(CONFIG_INTEL_PMT_CRASHLOG) += intel_pmt_crashlog.o 128 - obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o 129 123 obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o 130 124 obj-$(CONFIG_INTEL_SCU_PCI) += intel_scu_pcidrv.o 131 125 obj-$(CONFIG_INTEL_SCU_PLATFORM) += intel_scu_pltdrv.o 132 126 obj-$(CONFIG_INTEL_SCU_WDT) += intel_scu_wdt.o 133 127 obj-$(CONFIG_INTEL_SCU_IPC_UTIL) += intel_scu_ipcutil.o 134 - obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_core.o \ 135 - intel_telemetry_pltdrv.o \ 136 - intel_telemetry_debugfs.o 137 128 obj-$(CONFIG_PMC_ATOM) += pmc_atom.o
+179
drivers/platform/x86/acer-wmi.c
··· 60 60 #define ACER_WMID_GET_THREEG_METHODID 10 61 61 #define ACER_WMID_SET_THREEG_METHODID 11 62 62 63 + #define ACER_WMID_SET_GAMING_LED_METHODID 2 64 + #define ACER_WMID_GET_GAMING_LED_METHODID 4 65 + #define ACER_WMID_SET_GAMING_FAN_BEHAVIOR 14 66 + #define ACER_WMID_SET_GAMING_MISC_SETTING_METHODID 22 67 + 63 68 /* 64 69 * Acer ACPI method GUIDs 65 70 */ ··· 73 68 #define WMID_GUID1 "6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3" 74 69 #define WMID_GUID2 "95764E09-FB56-4E83-B31A-37761F60994A" 75 70 #define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531" 71 + #define WMID_GUID4 "7A4DDFE7-5B5D-40B4-8595-4408E0CC7F56" 76 72 77 73 /* 78 74 * Acer ACPI event GUIDs ··· 87 81 enum acer_wmi_event_ids { 88 82 WMID_HOTKEY_EVENT = 0x1, 89 83 WMID_ACCEL_OR_KBD_DOCK_EVENT = 0x5, 84 + WMID_GAMING_TURBO_KEY_EVENT = 0x7, 90 85 }; 91 86 92 87 static const struct key_entry acer_wmi_keymap[] __initconst = { ··· 222 215 #define ACER_CAP_THREEG BIT(4) 223 216 #define ACER_CAP_SET_FUNCTION_MODE BIT(5) 224 217 #define ACER_CAP_KBD_DOCK BIT(6) 218 + #define ACER_CAP_TURBO_OC BIT(7) 219 + #define ACER_CAP_TURBO_LED BIT(8) 220 + #define ACER_CAP_TURBO_FAN BIT(9) 225 221 226 222 /* 227 223 * Interface type flags ··· 311 301 u8 mailled; 312 302 s8 brightness; 313 303 u8 bluetooth; 304 + u8 turbo; 305 + u8 cpu_fans; 306 + u8 gpu_fans; 314 307 }; 315 308 316 309 static struct quirk_entry *quirks; ··· 325 312 326 313 if (quirks->brightness) 327 314 interface->capability |= ACER_CAP_BRIGHTNESS; 315 + 316 + if (quirks->turbo) 317 + interface->capability |= ACER_CAP_TURBO_OC | ACER_CAP_TURBO_LED 318 + | ACER_CAP_TURBO_FAN; 328 319 } 329 320 330 321 static int __init dmi_matched(const struct dmi_system_id *dmi) ··· 355 338 356 339 static struct quirk_entry quirk_acer_travelmate_2490 = { 357 340 .mailled = 1, 341 + }; 342 + 343 + static struct quirk_entry quirk_acer_predator_ph315_53 = { 344 + .turbo = 1, 345 + .cpu_fans = 1, 346 + .gpu_fans = 1, 358 347 }; 359 348 360 349 /* This AMW0 laptop has no bluetooth */ ··· 529 506 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4200"), 530 507 }, 531 508 .driver_data = &quirk_acer_travelmate_2490, 509 + }, 510 + { 511 + .callback = dmi_matched, 512 + .ident = "Acer Predator PH315-53", 513 + .matches = { 514 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 515 + DMI_MATCH(DMI_PRODUCT_NAME, "Predator PH315-53"), 516 + }, 517 + .driver_data = &quirk_acer_predator_ph315_53, 532 518 }, 533 519 { 534 520 .callback = set_force_caps, ··· 1377 1345 }; 1378 1346 1379 1347 /* 1348 + * WMID Gaming interface 1349 + */ 1350 + 1351 + static acpi_status 1352 + WMI_gaming_execute_u64(u32 method_id, u64 in, u64 *out) 1353 + { 1354 + struct acpi_buffer input = { (acpi_size) sizeof(u64), (void *)(&in) }; 1355 + struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL }; 1356 + union acpi_object *obj; 1357 + u32 tmp = 0; 1358 + acpi_status status; 1359 + 1360 + status = wmi_evaluate_method(WMID_GUID4, 0, method_id, &input, &result); 1361 + 1362 + if (ACPI_FAILURE(status)) 1363 + return status; 1364 + obj = (union acpi_object *) result.pointer; 1365 + 1366 + if (obj) { 1367 + if (obj->type == ACPI_TYPE_BUFFER) { 1368 + if (obj->buffer.length == sizeof(u32)) 1369 + tmp = *((u32 *) obj->buffer.pointer); 1370 + else if (obj->buffer.length == sizeof(u64)) 1371 + tmp = *((u64 *) obj->buffer.pointer); 1372 + } else if (obj->type == ACPI_TYPE_INTEGER) { 1373 + tmp = (u64) obj->integer.value; 1374 + } 1375 + } 1376 + 1377 + if (out) 1378 + *out = tmp; 1379 + 1380 + kfree(result.pointer); 1381 + 1382 + return status; 1383 + } 1384 + 1385 + static acpi_status WMID_gaming_set_u64(u64 value, u32 cap) 1386 + { 1387 + u32 method_id = 0; 1388 + 1389 + if (!(interface->capability & cap)) 1390 + return AE_BAD_PARAMETER; 1391 + 1392 + switch (cap) { 1393 + case ACER_CAP_TURBO_LED: 1394 + method_id = ACER_WMID_SET_GAMING_LED_METHODID; 1395 + break; 1396 + case ACER_CAP_TURBO_FAN: 1397 + method_id = ACER_WMID_SET_GAMING_FAN_BEHAVIOR; 1398 + break; 1399 + case ACER_CAP_TURBO_OC: 1400 + method_id = ACER_WMID_SET_GAMING_MISC_SETTING_METHODID; 1401 + break; 1402 + default: 1403 + return AE_BAD_PARAMETER; 1404 + } 1405 + 1406 + return WMI_gaming_execute_u64(method_id, value, NULL); 1407 + } 1408 + 1409 + static acpi_status WMID_gaming_get_u64(u64 *value, u32 cap) 1410 + { 1411 + acpi_status status; 1412 + u64 result; 1413 + u64 input; 1414 + u32 method_id; 1415 + 1416 + if (!(interface->capability & cap)) 1417 + return AE_BAD_PARAMETER; 1418 + 1419 + switch (cap) { 1420 + case ACER_CAP_TURBO_LED: 1421 + method_id = ACER_WMID_GET_GAMING_LED_METHODID; 1422 + input = 0x1; 1423 + break; 1424 + default: 1425 + return AE_BAD_PARAMETER; 1426 + } 1427 + status = WMI_gaming_execute_u64(method_id, input, &result); 1428 + if (ACPI_SUCCESS(status)) 1429 + *value = (u64) result; 1430 + 1431 + return status; 1432 + } 1433 + 1434 + static void WMID_gaming_set_fan_mode(u8 fan_mode) 1435 + { 1436 + /* fan_mode = 1 is used for auto, fan_mode = 2 used for turbo*/ 1437 + u64 gpu_fan_config1 = 0, gpu_fan_config2 = 0; 1438 + int i; 1439 + 1440 + if (quirks->cpu_fans > 0) 1441 + gpu_fan_config2 |= 1; 1442 + for (i = 0; i < (quirks->cpu_fans + quirks->gpu_fans); ++i) 1443 + gpu_fan_config2 |= 1 << (i + 1); 1444 + for (i = 0; i < quirks->gpu_fans; ++i) 1445 + gpu_fan_config2 |= 1 << (i + 3); 1446 + if (quirks->cpu_fans > 0) 1447 + gpu_fan_config1 |= fan_mode; 1448 + for (i = 0; i < (quirks->cpu_fans + quirks->gpu_fans); ++i) 1449 + gpu_fan_config1 |= fan_mode << (2 * i + 2); 1450 + for (i = 0; i < quirks->gpu_fans; ++i) 1451 + gpu_fan_config1 |= fan_mode << (2 * i + 6); 1452 + WMID_gaming_set_u64(gpu_fan_config2 | gpu_fan_config1 << 16, ACER_CAP_TURBO_FAN); 1453 + } 1454 + 1455 + /* 1380 1456 * Generic Device (interface-independent) 1381 1457 */ 1382 1458 ··· 1713 1573 (s16)out_obj->package.elements[2].integer.value); 1714 1574 input_sync(acer_wmi_accel_dev); 1715 1575 return 0; 1576 + } 1577 + 1578 + /* 1579 + * Predator series turbo button 1580 + */ 1581 + static int acer_toggle_turbo(void) 1582 + { 1583 + u64 turbo_led_state; 1584 + 1585 + /* Get current state from turbo button */ 1586 + if (ACPI_FAILURE(WMID_gaming_get_u64(&turbo_led_state, ACER_CAP_TURBO_LED))) 1587 + return -1; 1588 + 1589 + if (turbo_led_state) { 1590 + /* Turn off turbo led */ 1591 + WMID_gaming_set_u64(0x1, ACER_CAP_TURBO_LED); 1592 + 1593 + /* Set FAN mode to auto */ 1594 + WMID_gaming_set_fan_mode(0x1); 1595 + 1596 + /* Set OC to normal */ 1597 + WMID_gaming_set_u64(0x5, ACER_CAP_TURBO_OC); 1598 + WMID_gaming_set_u64(0x7, ACER_CAP_TURBO_OC); 1599 + } else { 1600 + /* Turn on turbo led */ 1601 + WMID_gaming_set_u64(0x10001, ACER_CAP_TURBO_LED); 1602 + 1603 + /* Set FAN mode to turbo */ 1604 + WMID_gaming_set_fan_mode(0x2); 1605 + 1606 + /* Set OC to turbo mode */ 1607 + WMID_gaming_set_u64(0x205, ACER_CAP_TURBO_OC); 1608 + WMID_gaming_set_u64(0x207, ACER_CAP_TURBO_OC); 1609 + } 1610 + return turbo_led_state; 1716 1611 } 1717 1612 1718 1613 /* ··· 2046 1871 case WMID_ACCEL_OR_KBD_DOCK_EVENT: 2047 1872 acer_gsensor_event(); 2048 1873 acer_kbd_dock_event(&return_value); 1874 + break; 1875 + case WMID_GAMING_TURBO_KEY_EVENT: 1876 + if (return_value.key_num == 0x4) 1877 + acer_toggle_turbo(); 2049 1878 break; 2050 1879 default: 2051 1880 pr_warn("Unknown function number - %d - %d\n",
+412 -4
drivers/platform/x86/asus-wmi.c
··· 26 26 #include <linux/rfkill.h> 27 27 #include <linux/pci.h> 28 28 #include <linux/pci_hotplug.h> 29 + #include <linux/platform_profile.h> 29 30 #include <linux/power_supply.h> 30 31 #include <linux/hwmon.h> 31 32 #include <linux/hwmon-sysfs.h> ··· 211 210 u8 fan_boost_mode_mask; 212 211 u8 fan_boost_mode; 213 212 213 + bool egpu_enable_available; // 0 = enable 214 + bool egpu_enable; 215 + 216 + bool dgpu_disable_available; 217 + bool dgpu_disable; 218 + 214 219 bool throttle_thermal_policy_available; 215 220 u8 throttle_thermal_policy_mode; 216 221 222 + struct platform_profile_handler platform_profile_handler; 223 + bool platform_profile_support; 224 + 217 225 // The RSOC controls the maximum charging percentage. 218 226 bool battery_rsoc_available; 227 + 228 + bool panel_overdrive_available; 229 + bool panel_overdrive; 219 230 220 231 struct hotplug_slot hotplug_slot; 221 232 struct mutex hotplug_lock; ··· 436 423 input_sync(asus->inputdev); 437 424 } 438 425 } 426 + 427 + /* dGPU ********************************************************************/ 428 + static int dgpu_disable_check_present(struct asus_wmi *asus) 429 + { 430 + u32 result; 431 + int err; 432 + 433 + asus->dgpu_disable_available = false; 434 + 435 + err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_DGPU, &result); 436 + if (err) { 437 + if (err == -ENODEV) 438 + return 0; 439 + return err; 440 + } 441 + 442 + if (result & ASUS_WMI_DSTS_PRESENCE_BIT) { 443 + asus->dgpu_disable_available = true; 444 + asus->dgpu_disable = result & ASUS_WMI_DSTS_STATUS_BIT; 445 + } 446 + 447 + return 0; 448 + } 449 + 450 + static int dgpu_disable_write(struct asus_wmi *asus) 451 + { 452 + u32 retval; 453 + u8 value; 454 + int err; 455 + 456 + /* Don't rely on type conversion */ 457 + value = asus->dgpu_disable ? 1 : 0; 458 + 459 + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_DGPU, value, &retval); 460 + if (err) { 461 + pr_warn("Failed to set dgpu disable: %d\n", err); 462 + return err; 463 + } 464 + 465 + if (retval > 1) { 466 + pr_warn("Failed to set dgpu disable (retval): 0x%x\n", retval); 467 + return -EIO; 468 + } 469 + 470 + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "dgpu_disable"); 471 + 472 + return 0; 473 + } 474 + 475 + static ssize_t dgpu_disable_show(struct device *dev, 476 + struct device_attribute *attr, char *buf) 477 + { 478 + struct asus_wmi *asus = dev_get_drvdata(dev); 479 + u8 mode = asus->dgpu_disable; 480 + 481 + return sysfs_emit(buf, "%d\n", mode); 482 + } 483 + 484 + /* 485 + * A user may be required to store the value twice, typcial store first, then 486 + * rescan PCI bus to activate power, then store a second time to save correctly. 487 + * The reason for this is that an extra code path in the ACPI is enabled when 488 + * the device and bus are powered. 489 + */ 490 + static ssize_t dgpu_disable_store(struct device *dev, 491 + struct device_attribute *attr, 492 + const char *buf, size_t count) 493 + { 494 + bool disable; 495 + int result; 496 + 497 + struct asus_wmi *asus = dev_get_drvdata(dev); 498 + 499 + result = kstrtobool(buf, &disable); 500 + if (result) 501 + return result; 502 + 503 + asus->dgpu_disable = disable; 504 + 505 + result = dgpu_disable_write(asus); 506 + if (result) 507 + return result; 508 + 509 + return count; 510 + } 511 + 512 + static DEVICE_ATTR_RW(dgpu_disable); 513 + 514 + /* eGPU ********************************************************************/ 515 + static int egpu_enable_check_present(struct asus_wmi *asus) 516 + { 517 + u32 result; 518 + int err; 519 + 520 + asus->egpu_enable_available = false; 521 + 522 + err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_EGPU, &result); 523 + if (err) { 524 + if (err == -ENODEV) 525 + return 0; 526 + return err; 527 + } 528 + 529 + if (result & ASUS_WMI_DSTS_PRESENCE_BIT) { 530 + asus->egpu_enable_available = true; 531 + asus->egpu_enable = result & ASUS_WMI_DSTS_STATUS_BIT; 532 + } 533 + 534 + return 0; 535 + } 536 + 537 + static int egpu_enable_write(struct asus_wmi *asus) 538 + { 539 + u32 retval; 540 + u8 value; 541 + int err; 542 + 543 + /* Don't rely on type conversion */ 544 + value = asus->egpu_enable ? 1 : 0; 545 + 546 + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, value, &retval); 547 + 548 + if (err) { 549 + pr_warn("Failed to set egpu disable: %d\n", err); 550 + return err; 551 + } 552 + 553 + if (retval > 1) { 554 + pr_warn("Failed to set egpu disable (retval): 0x%x\n", retval); 555 + return -EIO; 556 + } 557 + 558 + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "egpu_enable"); 559 + 560 + return 0; 561 + } 562 + 563 + static ssize_t egpu_enable_show(struct device *dev, 564 + struct device_attribute *attr, char *buf) 565 + { 566 + struct asus_wmi *asus = dev_get_drvdata(dev); 567 + bool mode = asus->egpu_enable; 568 + 569 + return sysfs_emit(buf, "%d\n", mode); 570 + } 571 + 572 + /* The ACPI call to enable the eGPU also disables the internal dGPU */ 573 + static ssize_t egpu_enable_store(struct device *dev, 574 + struct device_attribute *attr, 575 + const char *buf, size_t count) 576 + { 577 + bool enable; 578 + int result; 579 + 580 + struct asus_wmi *asus = dev_get_drvdata(dev); 581 + 582 + result = kstrtobool(buf, &enable); 583 + if (result) 584 + return result; 585 + 586 + asus->egpu_enable = enable; 587 + 588 + result = egpu_enable_write(asus); 589 + if (result) 590 + return result; 591 + 592 + /* Ensure that the kernel status of dgpu is updated */ 593 + result = dgpu_disable_check_present(asus); 594 + if (result) 595 + return result; 596 + 597 + return count; 598 + } 599 + 600 + static DEVICE_ATTR_RW(egpu_enable); 439 601 440 602 /* Battery ********************************************************************/ 441 603 ··· 1409 1221 return result; 1410 1222 } 1411 1223 1224 + /* Panel Overdrive ************************************************************/ 1225 + static int panel_od_check_present(struct asus_wmi *asus) 1226 + { 1227 + u32 result; 1228 + int err; 1229 + 1230 + asus->panel_overdrive_available = false; 1231 + 1232 + err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_PANEL_OD, &result); 1233 + if (err) { 1234 + if (err == -ENODEV) 1235 + return 0; 1236 + return err; 1237 + } 1238 + 1239 + if (result & ASUS_WMI_DSTS_PRESENCE_BIT) { 1240 + asus->panel_overdrive_available = true; 1241 + asus->panel_overdrive = result & ASUS_WMI_DSTS_STATUS_BIT; 1242 + } 1243 + 1244 + return 0; 1245 + } 1246 + 1247 + static int panel_od_write(struct asus_wmi *asus) 1248 + { 1249 + u32 retval; 1250 + u8 value; 1251 + int err; 1252 + 1253 + /* Don't rely on type conversion */ 1254 + value = asus->panel_overdrive ? 1 : 0; 1255 + 1256 + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PANEL_OD, value, &retval); 1257 + 1258 + if (err) { 1259 + pr_warn("Failed to set panel overdrive: %d\n", err); 1260 + return err; 1261 + } 1262 + 1263 + if (retval > 1) { 1264 + pr_warn("Failed to set panel overdrive (retval): 0x%x\n", retval); 1265 + return -EIO; 1266 + } 1267 + 1268 + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "panel_od"); 1269 + 1270 + return 0; 1271 + } 1272 + 1273 + static ssize_t panel_od_show(struct device *dev, 1274 + struct device_attribute *attr, char *buf) 1275 + { 1276 + struct asus_wmi *asus = dev_get_drvdata(dev); 1277 + 1278 + return sysfs_emit(buf, "%d\n", asus->panel_overdrive); 1279 + } 1280 + 1281 + static ssize_t panel_od_store(struct device *dev, 1282 + struct device_attribute *attr, 1283 + const char *buf, size_t count) 1284 + { 1285 + bool overdrive; 1286 + int result; 1287 + 1288 + struct asus_wmi *asus = dev_get_drvdata(dev); 1289 + 1290 + result = kstrtobool(buf, &overdrive); 1291 + if (result) 1292 + return result; 1293 + 1294 + asus->panel_overdrive = overdrive; 1295 + result = panel_od_write(asus); 1296 + 1297 + if (result) 1298 + return result; 1299 + 1300 + return count; 1301 + } 1302 + 1303 + static DEVICE_ATTR_RW(panel_od); 1304 + 1412 1305 /* Quirks *********************************************************************/ 1413 1306 1414 1307 static void asus_wmi_set_xusb2pr(struct asus_wmi *asus) ··· 2107 1838 static int throttle_thermal_policy_switch_next(struct asus_wmi *asus) 2108 1839 { 2109 1840 u8 new_mode = asus->throttle_thermal_policy_mode + 1; 1841 + int err; 2110 1842 2111 1843 if (new_mode > ASUS_THROTTLE_THERMAL_POLICY_SILENT) 2112 1844 new_mode = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT; 2113 1845 2114 1846 asus->throttle_thermal_policy_mode = new_mode; 2115 - return throttle_thermal_policy_write(asus); 1847 + err = throttle_thermal_policy_write(asus); 1848 + if (err) 1849 + return err; 1850 + 1851 + /* 1852 + * Ensure that platform_profile updates userspace with the change to ensure 1853 + * that platform_profile and throttle_thermal_policy_mode are in sync. 1854 + */ 1855 + platform_profile_notify(); 1856 + 1857 + return 0; 2116 1858 } 2117 1859 2118 1860 static ssize_t throttle_thermal_policy_show(struct device *dev, ··· 2139 1859 struct device_attribute *attr, 2140 1860 const char *buf, size_t count) 2141 1861 { 2142 - int result; 2143 - u8 new_mode; 2144 1862 struct asus_wmi *asus = dev_get_drvdata(dev); 1863 + u8 new_mode; 1864 + int result; 1865 + int err; 2145 1866 2146 1867 result = kstrtou8(buf, 10, &new_mode); 2147 1868 if (result < 0) ··· 2152 1871 return -EINVAL; 2153 1872 2154 1873 asus->throttle_thermal_policy_mode = new_mode; 2155 - throttle_thermal_policy_write(asus); 1874 + err = throttle_thermal_policy_write(asus); 1875 + if (err) 1876 + return err; 1877 + 1878 + /* 1879 + * Ensure that platform_profile updates userspace with the change to ensure 1880 + * that platform_profile and throttle_thermal_policy_mode are in sync. 1881 + */ 1882 + platform_profile_notify(); 2156 1883 2157 1884 return count; 2158 1885 } 2159 1886 2160 1887 // Throttle thermal policy: 0 - default, 1 - overboost, 2 - silent 2161 1888 static DEVICE_ATTR_RW(throttle_thermal_policy); 1889 + 1890 + /* Platform profile ***********************************************************/ 1891 + static int platform_profile_get(struct platform_profile_handler *pprof, 1892 + enum platform_profile_option *profile) 1893 + { 1894 + struct asus_wmi *asus; 1895 + int tp; 1896 + 1897 + asus = container_of(pprof, struct asus_wmi, platform_profile_handler); 1898 + 1899 + tp = asus->throttle_thermal_policy_mode; 1900 + 1901 + switch (tp) { 1902 + case ASUS_THROTTLE_THERMAL_POLICY_DEFAULT: 1903 + *profile = PLATFORM_PROFILE_BALANCED; 1904 + break; 1905 + case ASUS_THROTTLE_THERMAL_POLICY_OVERBOOST: 1906 + *profile = PLATFORM_PROFILE_PERFORMANCE; 1907 + break; 1908 + case ASUS_THROTTLE_THERMAL_POLICY_SILENT: 1909 + *profile = PLATFORM_PROFILE_QUIET; 1910 + break; 1911 + default: 1912 + return -EINVAL; 1913 + } 1914 + 1915 + return 0; 1916 + } 1917 + 1918 + static int platform_profile_set(struct platform_profile_handler *pprof, 1919 + enum platform_profile_option profile) 1920 + { 1921 + struct asus_wmi *asus; 1922 + int tp; 1923 + 1924 + asus = container_of(pprof, struct asus_wmi, platform_profile_handler); 1925 + 1926 + switch (profile) { 1927 + case PLATFORM_PROFILE_PERFORMANCE: 1928 + tp = ASUS_THROTTLE_THERMAL_POLICY_OVERBOOST; 1929 + break; 1930 + case PLATFORM_PROFILE_BALANCED: 1931 + tp = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT; 1932 + break; 1933 + case PLATFORM_PROFILE_QUIET: 1934 + tp = ASUS_THROTTLE_THERMAL_POLICY_SILENT; 1935 + break; 1936 + default: 1937 + return -EOPNOTSUPP; 1938 + } 1939 + 1940 + asus->throttle_thermal_policy_mode = tp; 1941 + return throttle_thermal_policy_write(asus); 1942 + } 1943 + 1944 + static int platform_profile_setup(struct asus_wmi *asus) 1945 + { 1946 + struct device *dev = &asus->platform_device->dev; 1947 + int err; 1948 + 1949 + /* 1950 + * Not an error if a component platform_profile relies on is unavailable 1951 + * so early return, skipping the setup of platform_profile. 1952 + */ 1953 + if (!asus->throttle_thermal_policy_available) 1954 + return 0; 1955 + 1956 + dev_info(dev, "Using throttle_thermal_policy for platform_profile support\n"); 1957 + 1958 + asus->platform_profile_handler.profile_get = platform_profile_get; 1959 + asus->platform_profile_handler.profile_set = platform_profile_set; 1960 + 1961 + set_bit(PLATFORM_PROFILE_QUIET, asus->platform_profile_handler.choices); 1962 + set_bit(PLATFORM_PROFILE_BALANCED, 1963 + asus->platform_profile_handler.choices); 1964 + set_bit(PLATFORM_PROFILE_PERFORMANCE, 1965 + asus->platform_profile_handler.choices); 1966 + 1967 + err = platform_profile_register(&asus->platform_profile_handler); 1968 + if (err) 1969 + return err; 1970 + 1971 + asus->platform_profile_support = true; 1972 + return 0; 1973 + } 2162 1974 2163 1975 /* Backlight ******************************************************************/ 2164 1976 ··· 2702 2328 &dev_attr_camera.attr, 2703 2329 &dev_attr_cardr.attr, 2704 2330 &dev_attr_touchpad.attr, 2331 + &dev_attr_egpu_enable.attr, 2332 + &dev_attr_dgpu_disable.attr, 2705 2333 &dev_attr_lid_resume.attr, 2706 2334 &dev_attr_als_enable.attr, 2707 2335 &dev_attr_fan_boost_mode.attr, 2708 2336 &dev_attr_throttle_thermal_policy.attr, 2337 + &dev_attr_panel_od.attr, 2709 2338 NULL 2710 2339 }; 2711 2340 ··· 2730 2353 devid = ASUS_WMI_DEVID_LID_RESUME; 2731 2354 else if (attr == &dev_attr_als_enable.attr) 2732 2355 devid = ASUS_WMI_DEVID_ALS_ENABLE; 2356 + else if (attr == &dev_attr_egpu_enable.attr) 2357 + ok = asus->egpu_enable_available; 2358 + else if (attr == &dev_attr_dgpu_disable.attr) 2359 + ok = asus->dgpu_disable_available; 2733 2360 else if (attr == &dev_attr_fan_boost_mode.attr) 2734 2361 ok = asus->fan_boost_mode_available; 2735 2362 else if (attr == &dev_attr_throttle_thermal_policy.attr) 2736 2363 ok = asus->throttle_thermal_policy_available; 2364 + else if (attr == &dev_attr_panel_od.attr) 2365 + ok = asus->panel_overdrive_available; 2737 2366 2738 2367 if (devid != -1) 2739 2368 ok = !(asus_wmi_get_devstate_simple(asus, devid) < 0); ··· 2995 2612 if (err) 2996 2613 goto fail_platform; 2997 2614 2615 + err = egpu_enable_check_present(asus); 2616 + if (err) 2617 + goto fail_egpu_enable; 2618 + 2619 + err = dgpu_disable_check_present(asus); 2620 + if (err) 2621 + goto fail_dgpu_disable; 2622 + 2998 2623 err = fan_boost_mode_check_present(asus); 2999 2624 if (err) 3000 2625 goto fail_fan_boost_mode; ··· 3012 2621 goto fail_throttle_thermal_policy; 3013 2622 else 3014 2623 throttle_thermal_policy_set_default(asus); 2624 + 2625 + err = platform_profile_setup(asus); 2626 + if (err) 2627 + goto fail_platform_profile_setup; 2628 + 2629 + err = panel_od_check_present(asus); 2630 + if (err) 2631 + goto fail_panel_od; 3015 2632 3016 2633 err = asus_wmi_sysfs_init(asus->platform_device); 3017 2634 if (err) ··· 3106 2707 asus_wmi_sysfs_exit(asus->platform_device); 3107 2708 fail_sysfs: 3108 2709 fail_throttle_thermal_policy: 2710 + fail_platform_profile_setup: 2711 + if (asus->platform_profile_support) 2712 + platform_profile_remove(); 3109 2713 fail_fan_boost_mode: 2714 + fail_egpu_enable: 2715 + fail_dgpu_disable: 3110 2716 fail_platform: 2717 + fail_panel_od: 3111 2718 kfree(asus); 3112 2719 return err; 3113 2720 } ··· 3132 2727 asus_wmi_sysfs_exit(asus->platform_device); 3133 2728 asus_fan_set_auto(asus); 3134 2729 asus_wmi_battery_exit(asus); 2730 + 2731 + if (asus->platform_profile_support) 2732 + platform_profile_remove(); 3135 2733 3136 2734 kfree(asus); 3137 2735 return 0;
+1 -1
drivers/platform/x86/dell/Kconfig
··· 140 140 config DELL_SMO8800 141 141 tristate "Dell Latitude freefall driver (ACPI SMO88XX)" 142 142 default m 143 - depends on ACPI 143 + depends on ACPI || COMPILE_TEST 144 144 help 145 145 Say Y here if you want to support SMO88XX freefall devices 146 146 on Dell Latitude laptops.
+2 -2
drivers/platform/x86/dell/dcdbas.c
··· 278 278 } 279 279 280 280 /* SMI requires CPU 0 */ 281 - get_online_cpus(); 281 + cpus_read_lock(); 282 282 ret = smp_call_on_cpu(0, raise_smi, smi_cmd, true); 283 - put_online_cpus(); 283 + cpus_read_unlock(); 284 284 285 285 return ret; 286 286 }
-31
drivers/platform/x86/dell/dell-smbios-smm.c
··· 24 24 static struct platform_device *platform_device; 25 25 static DEFINE_MUTEX(smm_mutex); 26 26 27 - static const struct dmi_system_id dell_device_table[] __initconst = { 28 - { 29 - .ident = "Dell laptop", 30 - .matches = { 31 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 32 - DMI_MATCH(DMI_CHASSIS_TYPE, "8"), 33 - }, 34 - }, 35 - { 36 - .matches = { 37 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 38 - DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /*Laptop*/ 39 - }, 40 - }, 41 - { 42 - .matches = { 43 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 44 - DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /*Notebook*/ 45 - }, 46 - }, 47 - { 48 - .ident = "Dell Computer Corporation", 49 - .matches = { 50 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 51 - DMI_MATCH(DMI_CHASSIS_TYPE, "8"), 52 - }, 53 - }, 54 - { } 55 - }; 56 - MODULE_DEVICE_TABLE(dmi, dell_device_table); 57 - 58 27 static void parse_da_table(const struct dmi_header *dm) 59 28 { 60 29 struct calling_interface_structure *table =
+2 -1
drivers/platform/x86/dell/dell-smbios-wmi.c
··· 69 69 if (obj->type == ACPI_TYPE_INTEGER) 70 70 dev_dbg(&wdev->dev, "SMBIOS call failed: %llu\n", 71 71 obj->integer.value); 72 + kfree(output.pointer); 72 73 return -EIO; 73 74 } 74 - memcpy(&priv->buf->std, obj->buffer.pointer, obj->buffer.length); 75 + memcpy(input.pointer, obj->buffer.pointer, obj->buffer.length); 75 76 dev_dbg(&wdev->dev, "result: [%08x,%08x,%08x,%08x]\n", 76 77 priv->buf->std.output[0], priv->buf->std.output[1], 77 78 priv->buf->std.output[2], priv->buf->std.output[3]);
+21 -57
drivers/platform/x86/dell/dell-smo8800.c
··· 10 10 11 11 #define DRIVER_NAME "smo8800" 12 12 13 - #include <linux/kernel.h> 14 - #include <linux/module.h> 15 - #include <linux/acpi.h> 16 - #include <linux/interrupt.h> 17 - #include <linux/miscdevice.h> 18 - #include <linux/uaccess.h> 19 13 #include <linux/fs.h> 14 + #include <linux/interrupt.h> 15 + #include <linux/kernel.h> 16 + #include <linux/miscdevice.h> 17 + #include <linux/mod_devicetable.h> 18 + #include <linux/module.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/uaccess.h> 20 21 21 22 struct smo8800_device { 22 23 u32 irq; /* acpi device irq */ ··· 43 42 44 43 dev_info(smo8800->dev, "detected free fall\n"); 45 44 return IRQ_HANDLED; 46 - } 47 - 48 - static acpi_status smo8800_get_resource(struct acpi_resource *resource, 49 - void *context) 50 - { 51 - struct acpi_resource_extended_irq *irq; 52 - 53 - if (resource->type != ACPI_RESOURCE_TYPE_EXTENDED_IRQ) 54 - return AE_OK; 55 - 56 - irq = &resource->data.extended_irq; 57 - if (!irq || !irq->interrupt_count) 58 - return AE_OK; 59 - 60 - *((u32 *)context) = irq->interrupts[0]; 61 - return AE_CTRL_TERMINATE; 62 - } 63 - 64 - static u32 smo8800_get_irq(struct acpi_device *device) 65 - { 66 - u32 irq = 0; 67 - acpi_status status; 68 - 69 - status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, 70 - smo8800_get_resource, &irq); 71 - if (ACPI_FAILURE(status)) { 72 - dev_err(&device->dev, "acpi_walk_resources failed\n"); 73 - return 0; 74 - } 75 - 76 - return irq; 77 45 } 78 46 79 47 static ssize_t smo8800_misc_read(struct file *file, char __user *buf, ··· 106 136 .release = smo8800_misc_release, 107 137 }; 108 138 109 - static int smo8800_add(struct acpi_device *device) 139 + static int smo8800_probe(struct platform_device *device) 110 140 { 111 141 int err; 112 142 struct smo8800_device *smo8800; ··· 130 160 return err; 131 161 } 132 162 133 - device->driver_data = smo8800; 163 + platform_set_drvdata(device, smo8800); 134 164 135 - smo8800->irq = smo8800_get_irq(device); 136 - if (!smo8800->irq) { 137 - dev_err(&device->dev, "failed to obtain IRQ\n"); 138 - err = -EINVAL; 165 + err = platform_get_irq(device, 0); 166 + if (err < 0) 139 167 goto error; 140 - } 168 + smo8800->irq = err; 141 169 142 170 err = request_threaded_irq(smo8800->irq, smo8800_interrupt_quick, 143 171 smo8800_interrupt_thread, ··· 157 189 return err; 158 190 } 159 191 160 - static int smo8800_remove(struct acpi_device *device) 192 + static int smo8800_remove(struct platform_device *device) 161 193 { 162 - struct smo8800_device *smo8800 = device->driver_data; 194 + struct smo8800_device *smo8800 = platform_get_drvdata(device); 163 195 164 196 free_irq(smo8800->irq, smo8800); 165 197 misc_deregister(&smo8800->miscdev); ··· 179 211 { "SMO8831", 0 }, 180 212 { "", 0 }, 181 213 }; 182 - 183 214 MODULE_DEVICE_TABLE(acpi, smo8800_ids); 184 215 185 - static struct acpi_driver smo8800_driver = { 186 - .name = DRIVER_NAME, 187 - .class = "Latitude", 188 - .ids = smo8800_ids, 189 - .ops = { 190 - .add = smo8800_add, 191 - .remove = smo8800_remove, 216 + static struct platform_driver smo8800_driver = { 217 + .probe = smo8800_probe, 218 + .remove = smo8800_remove, 219 + .driver = { 220 + .name = DRIVER_NAME, 221 + .acpi_match_table = smo8800_ids, 192 222 }, 193 - .owner = THIS_MODULE, 194 223 }; 195 - 196 - module_acpi_driver(smo8800_driver); 224 + module_platform_driver(smo8800_driver); 197 225 198 226 MODULE_DESCRIPTION("Dell Latitude freefall driver (ACPI SMO88XX)"); 199 227 MODULE_LICENSE("GPL");
+1 -25
drivers/platform/x86/dual_accel_detect.h
··· 17 17 #include <linux/acpi.h> 18 18 #include <linux/i2c.h> 19 19 20 - static int dual_accel_i2c_resource_count(struct acpi_resource *ares, void *data) 21 - { 22 - struct acpi_resource_i2c_serialbus *sb; 23 - int *count = data; 24 - 25 - if (i2c_acpi_get_i2c_resource(ares, &sb)) 26 - *count = *count + 1; 27 - 28 - return 1; 29 - } 30 - 31 - static int dual_accel_i2c_client_count(struct acpi_device *adev) 32 - { 33 - int ret, count = 0; 34 - LIST_HEAD(r); 35 - 36 - ret = acpi_dev_get_resources(adev, &r, dual_accel_i2c_resource_count, &count); 37 - if (ret < 0) 38 - return ret; 39 - 40 - acpi_dev_free_resource_list(&r); 41 - return count; 42 - } 43 - 44 20 static bool dual_accel_detect_bosc0200(void) 45 21 { 46 22 struct acpi_device *adev; ··· 26 50 if (!adev) 27 51 return false; 28 52 29 - count = dual_accel_i2c_client_count(adev); 53 + count = i2c_acpi_client_count(adev); 30 54 31 55 acpi_dev_put(adev); 32 56
+15 -63
drivers/platform/x86/hp_accel.c
··· 28 28 #include <linux/serio.h> 29 29 #include "../../misc/lis3lv02d/lis3lv02d.h" 30 30 31 - #define DRIVER_NAME "hp_accel" 32 - #define ACPI_MDPS_CLASS "accelerometer" 33 - 34 31 /* Delayed LEDs infrastructure ------------------------------------ */ 35 32 36 33 /* Special LED class that can defer work */ ··· 75 78 }; 76 79 MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids); 77 80 78 - 79 81 /** 80 - * lis3lv02d_acpi_init - ACPI _INI method: initialize the device. 82 + * lis3lv02d_acpi_init - initialize the device for ACPI 81 83 * @lis3: pointer to the device struct 82 84 * 83 85 * Returns 0 on success. 84 86 */ 85 87 static int lis3lv02d_acpi_init(struct lis3lv02d *lis3) 86 88 { 87 - struct acpi_device *dev = lis3->bus_priv; 88 - if (!lis3->init_required) 89 - return 0; 90 - 91 - if (acpi_evaluate_object(dev->handle, METHOD_NAME__INI, 92 - NULL, NULL) != AE_OK) 93 - return -EINVAL; 94 - 95 89 return 0; 96 90 } 97 91 ··· 266 278 .set_brightness = hpled_set, 267 279 }; 268 280 269 - static acpi_status 270 - lis3lv02d_get_resource(struct acpi_resource *resource, void *context) 271 - { 272 - if (resource->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { 273 - struct acpi_resource_extended_irq *irq; 274 - u32 *device_irq = context; 275 - 276 - irq = &resource->data.extended_irq; 277 - *device_irq = irq->interrupts[0]; 278 - } 279 - 280 - return AE_OK; 281 - } 282 - 283 - static void lis3lv02d_enum_resources(struct acpi_device *device) 284 - { 285 - acpi_status status; 286 - 287 - status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, 288 - lis3lv02d_get_resource, &lis3_dev.irq); 289 - if (ACPI_FAILURE(status)) 290 - printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); 291 - } 292 - 293 281 static bool hp_accel_i8042_filter(unsigned char data, unsigned char str, 294 282 struct serio *port) 295 283 { ··· 295 331 return false; 296 332 } 297 333 298 - static int lis3lv02d_add(struct acpi_device *device) 334 + static int lis3lv02d_probe(struct platform_device *device) 299 335 { 300 336 int ret; 301 337 302 - if (!device) 303 - return -EINVAL; 304 - 305 - lis3_dev.bus_priv = device; 338 + lis3_dev.bus_priv = ACPI_COMPANION(&device->dev); 306 339 lis3_dev.init = lis3lv02d_acpi_init; 307 340 lis3_dev.read = lis3lv02d_acpi_read; 308 341 lis3_dev.write = lis3lv02d_acpi_write; 309 - strcpy(acpi_device_name(device), DRIVER_NAME); 310 - strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); 311 - device->driver_data = &lis3_dev; 312 342 313 343 /* obtain IRQ number of our device from ACPI */ 314 - lis3lv02d_enum_resources(device); 344 + ret = platform_get_irq_optional(device, 0); 345 + if (ret > 0) 346 + lis3_dev.irq = ret; 315 347 316 348 /* If possible use a "standard" axes order */ 317 349 if (lis3_dev.ac.x && lis3_dev.ac.y && lis3_dev.ac.z) { ··· 319 359 } 320 360 321 361 /* call the core layer do its init */ 322 - lis3_dev.init_required = true; 323 362 ret = lis3lv02d_init_device(&lis3_dev); 324 363 if (ret) 325 364 return ret; ··· 340 381 return ret; 341 382 } 342 383 343 - static int lis3lv02d_remove(struct acpi_device *device) 384 + static int lis3lv02d_remove(struct platform_device *device) 344 385 { 345 - if (!device) 346 - return -EINVAL; 347 - 348 386 i8042_remove_filter(hp_accel_i8042_filter); 349 387 lis3lv02d_joystick_disable(&lis3_dev); 350 388 lis3lv02d_poweroff(&lis3_dev); ··· 351 395 352 396 return lis3lv02d_remove_fs(&lis3_dev); 353 397 } 354 - 355 398 356 399 #ifdef CONFIG_PM_SLEEP 357 400 static int lis3lv02d_suspend(struct device *dev) ··· 362 407 363 408 static int lis3lv02d_resume(struct device *dev) 364 409 { 365 - lis3_dev.init_required = false; 366 410 lis3lv02d_poweron(&lis3_dev); 367 411 return 0; 368 412 } 369 413 370 414 static int lis3lv02d_restore(struct device *dev) 371 415 { 372 - lis3_dev.init_required = true; 373 416 lis3lv02d_poweron(&lis3_dev); 374 417 return 0; 375 418 } ··· 387 434 #endif 388 435 389 436 /* For the HP MDPS aka 3D Driveguard */ 390 - static struct acpi_driver lis3lv02d_driver = { 391 - .name = DRIVER_NAME, 392 - .class = ACPI_MDPS_CLASS, 393 - .ids = lis3lv02d_device_ids, 394 - .ops = { 395 - .add = lis3lv02d_add, 396 - .remove = lis3lv02d_remove, 437 + static struct platform_driver lis3lv02d_driver = { 438 + .probe = lis3lv02d_probe, 439 + .remove = lis3lv02d_remove, 440 + .driver = { 441 + .name = "hp_accel", 442 + .pm = HP_ACCEL_PM, 443 + .acpi_match_table = lis3lv02d_device_ids, 397 444 }, 398 - .drv.pm = HP_ACCEL_PM, 399 445 }; 400 - module_acpi_driver(lis3lv02d_driver); 446 + module_platform_driver(lis3lv02d_driver); 401 447 402 448 MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED."); 403 449 MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek");
+1 -26
drivers/platform/x86/i2c-multi-instantiate.c
··· 32 32 struct i2c_client *clients[]; 33 33 }; 34 34 35 - static int i2c_multi_inst_count(struct acpi_resource *ares, void *data) 36 - { 37 - struct acpi_resource_i2c_serialbus *sb; 38 - int *count = data; 39 - 40 - if (i2c_acpi_get_i2c_resource(ares, &sb)) 41 - *count = *count + 1; 42 - 43 - return 1; 44 - } 45 - 46 - static int i2c_multi_inst_count_resources(struct acpi_device *adev) 47 - { 48 - LIST_HEAD(r); 49 - int count = 0; 50 - int ret; 51 - 52 - ret = acpi_dev_get_resources(adev, &r, i2c_multi_inst_count, &count); 53 - if (ret < 0) 54 - return ret; 55 - 56 - acpi_dev_free_resource_list(&r); 57 - return count; 58 - } 59 - 60 35 static int i2c_multi_inst_probe(struct platform_device *pdev) 61 36 { 62 37 struct i2c_multi_inst_data *multi; ··· 51 76 adev = ACPI_COMPANION(dev); 52 77 53 78 /* Count number of clients to instantiate */ 54 - ret = i2c_multi_inst_count_resources(adev); 79 + ret = i2c_acpi_client_count(adev); 55 80 if (ret < 0) 56 81 return ret; 57 82
+9
drivers/platform/x86/ideapad-laptop.c
··· 41 41 static const char *const ideapad_wmi_fnesc_events[] = { 42 42 "26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6", /* Yoga 3 */ 43 43 "56322276-8493-4CE8-A783-98C991274F5E", /* Yoga 700 */ 44 + "8FC0DE0C-B4E4-43FD-B0F3-8871711C1294", /* Legion 5 */ 44 45 }; 45 46 #endif 46 47 ··· 1460 1459 static void ideapad_wmi_notify(u32 value, void *context) 1461 1460 { 1462 1461 struct ideapad_private *priv = context; 1462 + unsigned long result; 1463 1463 1464 1464 switch (value) { 1465 1465 case 128: 1466 1466 ideapad_input_report(priv, value); 1467 + break; 1468 + case 208: 1469 + if (!eval_hals(priv->adev->handle, &result)) { 1470 + bool state = test_bit(HALS_FNLOCK_STATE_BIT, &result); 1471 + 1472 + exec_sals(priv->adev->handle, state ? SALS_FNLOCK_ON : SALS_FNLOCK_OFF); 1473 + } 1467 1474 break; 1468 1475 default: 1469 1476 dev_info(&priv->platform_device->dev,
+1 -1
drivers/platform/x86/intel-hid.c drivers/platform/x86/intel/hid.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/platform_device.h> 16 16 #include <linux/suspend.h> 17 - #include "dual_accel_detect.h" 17 + #include "../dual_accel_detect.h" 18 18 19 19 /* When NOT in tablet mode, VGBS returns with the flag 0x40 */ 20 20 #define TABLET_MODE_FLAG BIT(6)
drivers/platform/x86/intel-rst.c drivers/platform/x86/intel/rst.c
drivers/platform/x86/intel-smartconnect.c drivers/platform/x86/intel/smartconnect.c
drivers/platform/x86/intel-uncore-frequency.c drivers/platform/x86/intel/uncore-frequency.c
+1 -1
drivers/platform/x86/intel-vbtn.c drivers/platform/x86/intel/vbtn.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/platform_device.h> 16 16 #include <linux/suspend.h> 17 - #include "dual_accel_detect.h" 17 + #include "../dual_accel_detect.h" 18 18 19 19 /* Returned when NOT in tablet mode on some HP Stream x360 11 models */ 20 20 #define VGBS_TABLET_MODE_FLAG_ALT 0x10
drivers/platform/x86/intel-wmi-sbl-fw-update.c drivers/platform/x86/intel/wmi/sbl-fw-update.c
drivers/platform/x86/intel-wmi-thunderbolt.c drivers/platform/x86/intel/wmi/thunderbolt.c
+149
drivers/platform/x86/intel/Kconfig
··· 16 16 17 17 if X86_PLATFORM_DRIVERS_INTEL 18 18 19 + source "drivers/platform/x86/intel/atomisp2/Kconfig" 20 + source "drivers/platform/x86/intel/int1092/Kconfig" 19 21 source "drivers/platform/x86/intel/int33fe/Kconfig" 20 22 source "drivers/platform/x86/intel/int3472/Kconfig" 23 + source "drivers/platform/x86/intel/pmc/Kconfig" 24 + source "drivers/platform/x86/intel/pmt/Kconfig" 25 + source "drivers/platform/x86/intel/speed_select_if/Kconfig" 26 + source "drivers/platform/x86/intel/telemetry/Kconfig" 27 + source "drivers/platform/x86/intel/wmi/Kconfig" 28 + 29 + config INTEL_HID_EVENT 30 + tristate "Intel HID Event" 31 + depends on ACPI 32 + depends on INPUT 33 + depends on I2C 34 + select INPUT_SPARSEKMAP 35 + help 36 + This driver provides support for the Intel HID Event hotkey interface. 37 + Some laptops require this driver for hotkey support. 38 + 39 + To compile this driver as a module, choose M here: the module will 40 + be called intel_hid. 41 + 42 + config INTEL_VBTN 43 + tristate "Intel Virtual Button" 44 + depends on ACPI 45 + depends on INPUT 46 + depends on I2C 47 + select INPUT_SPARSEKMAP 48 + help 49 + This driver provides support for the Intel Virtual Button interface. 50 + Some laptops require this driver for power button support. 51 + 52 + To compile this driver as a module, choose M here: the module will 53 + be called intel_vbtn. 54 + 55 + config INTEL_INT0002_VGPIO 56 + tristate "Intel ACPI INT0002 Virtual GPIO driver" 57 + depends on GPIOLIB && ACPI && PM_SLEEP 58 + select GPIOLIB_IRQCHIP 59 + help 60 + Some peripherals on Bay Trail and Cherry Trail platforms signal a 61 + Power Management Event (PME) to the Power Management Controller (PMC) 62 + to wakeup the system. When this happens software needs to explicitly 63 + clear the PME bus 0 status bit in the GPE0a_STS register to avoid an 64 + IRQ storm on IRQ 9. 65 + 66 + This is modelled in ACPI through the INT0002 ACPI device, which is 67 + called a "Virtual GPIO controller" in ACPI because it defines the 68 + event handler to call when the PME triggers through _AEI and _L02 69 + methods as would be done for a real GPIO interrupt in ACPI. 70 + 71 + To compile this driver as a module, choose M here: the module will 72 + be called intel_int0002_vgpio. 73 + 74 + config INTEL_OAKTRAIL 75 + tristate "Intel Oaktrail Platform Extras" 76 + depends on ACPI 77 + depends on ACPI_VIDEO || ACPI_VIDEO=n 78 + depends on RFKILL && BACKLIGHT_CLASS_DEVICE && ACPI 79 + help 80 + Intel Oaktrail platform need this driver to provide interfaces to 81 + enable/disable the Camera, WiFi, BT etc. devices. If in doubt, say Y 82 + here; it will only load on supported platforms. 83 + 84 + config INTEL_BXTWC_PMIC_TMU 85 + tristate "Intel Broxton Whiskey Cove TMU Driver" 86 + depends on INTEL_SOC_PMIC_BXTWC 87 + depends on MFD_INTEL_PMC_BXT 88 + select REGMAP 89 + help 90 + Select this driver to use Intel Broxton Whiskey Cove PMIC TMU feature. 91 + This driver enables the alarm wakeup functionality in the TMU unit of 92 + Whiskey Cove PMIC. 93 + 94 + config INTEL_CHTDC_TI_PWRBTN 95 + tristate "Intel Cherry Trail Dollar Cove TI power button driver" 96 + depends on INTEL_SOC_PMIC_CHTDC_TI 97 + depends on INPUT 98 + help 99 + This option adds a power button driver for Dollar Cove TI 100 + PMIC on Intel Cherry Trail devices. 101 + 102 + To compile this driver as a module, choose M here: the module 103 + will be called intel_chtdc_ti_pwrbtn. 104 + 105 + config INTEL_MRFLD_PWRBTN 106 + tristate "Intel Merrifield Basin Cove power button driver" 107 + depends on INTEL_SOC_PMIC_MRFLD 108 + depends on INPUT 109 + help 110 + This option adds a power button driver for Basin Cove PMIC 111 + on Intel Merrifield devices. 112 + 113 + To compile this driver as a module, choose M here: the module 114 + will be called intel_mrfld_pwrbtn. 115 + 116 + config INTEL_PUNIT_IPC 117 + tristate "Intel P-Unit IPC Driver" 118 + help 119 + This driver provides support for Intel P-Unit Mailbox IPC mechanism, 120 + which is used to bridge the communications between kernel and P-Unit. 121 + 122 + config INTEL_RST 123 + tristate "Intel Rapid Start Technology Driver" 124 + depends on ACPI 125 + help 126 + This driver provides support for modifying parameters on systems 127 + equipped with Intel's Rapid Start Technology. When put in an ACPI 128 + sleep state, these devices will wake after either a configured 129 + timeout or when the system battery reaches a critical state, 130 + automatically copying memory contents to disk. On resume, the 131 + firmware will copy the memory contents back to RAM and resume the OS 132 + as usual. 133 + 134 + config INTEL_SMARTCONNECT 135 + tristate "Intel Smart Connect disabling driver" 136 + depends on ACPI 137 + help 138 + Intel Smart Connect is a technology intended to permit devices to 139 + update state by resuming for a short period of time at regular 140 + intervals. If a user enables this functionality under Windows and 141 + then reboots into Linux, the system may remain configured to resume 142 + on suspend. In the absence of any userspace to support it, the system 143 + will then remain awake until something triggers another suspend. 144 + 145 + This driver checks to determine whether the device has Intel Smart 146 + Connect enabled, and if so disables it. 147 + 148 + config INTEL_TURBO_MAX_3 149 + bool "Intel Turbo Boost Max Technology 3.0 enumeration driver" 150 + depends on X86_64 && SCHED_MC_PRIO 151 + help 152 + This driver reads maximum performance ratio of each CPU and set up 153 + the scheduler priority metrics. In this way scheduler can prefer 154 + CPU with higher performance to schedule tasks. 155 + 156 + This driver is only required when the system is not using Hardware 157 + P-States (HWP). In HWP mode, priority can be read from ACPI tables. 158 + 159 + config INTEL_UNCORE_FREQ_CONTROL 160 + tristate "Intel Uncore frequency control driver" 161 + depends on X86_64 162 + help 163 + This driver allows control of Uncore frequency limits on 164 + supported server platforms. 165 + 166 + Uncore frequency controls RING/LLC (last-level cache) clocks. 167 + 168 + To compile this driver as a module, choose M here: the module 169 + will be called intel-uncore-frequency. 21 170 22 171 endif # X86_PLATFORM_DRIVERS_INTEL
+39
drivers/platform/x86/intel/Makefile
··· 4 4 # Intel x86 Platform-Specific Drivers 5 5 # 6 6 7 + obj-$(CONFIG_INTEL_ATOMISP2_PDX86) += atomisp2/ 8 + obj-$(CONFIG_INTEL_SAR_INT1092) += int1092/ 7 9 obj-$(CONFIG_INTEL_CHT_INT33FE) += int33fe/ 8 10 obj-$(CONFIG_INTEL_SKL_INT3472) += int3472/ 11 + obj-$(CONFIG_INTEL_PMC_CORE) += pmc/ 12 + obj-$(CONFIG_INTEL_PMT_CLASS) += pmt/ 13 + obj-$(CONFIG_INTEL_SPEED_SELECT_INTERFACE) += speed_select_if/ 14 + obj-$(CONFIG_INTEL_TELEMETRY) += telemetry/ 15 + obj-$(CONFIG_INTEL_WMI) += wmi/ 16 + 17 + # Intel input drivers 18 + intel-hid-y := hid.o 19 + obj-$(CONFIG_INTEL_HID_EVENT) += intel-hid.o 20 + intel-vbtn-y := vbtn.o 21 + obj-$(CONFIG_INTEL_VBTN) += intel-vbtn.o 22 + 23 + # Intel miscellaneous drivers 24 + intel_int0002_vgpio-y := int0002_vgpio.o 25 + obj-$(CONFIG_INTEL_INT0002_VGPIO) += intel_int0002_vgpio.o 26 + intel_oaktrail-y := oaktrail.o 27 + obj-$(CONFIG_INTEL_OAKTRAIL) += intel_oaktrail.o 28 + 29 + # Intel PMIC / PMC / P-Unit drivers 30 + intel_bxtwc_tmu-y := bxtwc_tmu.o 31 + obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU) += intel_bxtwc_tmu.o 32 + intel_chtdc_ti_pwrbtn-y := chtdc_ti_pwrbtn.o 33 + obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o 34 + intel_mrfld_pwrbtn-y := mrfld_pwrbtn.o 35 + obj-$(CONFIG_INTEL_MRFLD_PWRBTN) += intel_mrfld_pwrbtn.o 36 + intel_punit_ipc-y := punit_ipc.o 37 + obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o 38 + 39 + # Intel Uncore drivers 40 + intel-rst-y := rst.o 41 + obj-$(CONFIG_INTEL_RST) += intel-rst.o 42 + intel-smartconnect-y := smartconnect.o 43 + obj-$(CONFIG_INTEL_SMARTCONNECT) += intel-smartconnect.o 44 + intel_turbo_max_3-y := turbo_max_3.o 45 + obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o 46 + intel-uncore-frequency-y := uncore-frequency.o 47 + obj-$(CONFIG_INTEL_UNCORE_FREQ_CONTROL) += intel-uncore-frequency.o
+43
drivers/platform/x86/intel/atomisp2/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # Intel x86 Platform Specific Drivers 4 + # 5 + 6 + config INTEL_ATOMISP2_PDX86 7 + bool 8 + 9 + config INTEL_ATOMISP2_LED 10 + tristate "Intel AtomISP v2 camera LED driver" 11 + depends on GPIOLIB && LEDS_GPIO 12 + select INTEL_ATOMISP2_PDX86 13 + help 14 + Many Bay Trail and Cherry Trail devices come with a camera attached 15 + to Intel's Image Signal Processor. Linux currently does not have a 16 + driver for these, so they do not work as a camera. Some of these 17 + camera's have a LED which is controlled through a GPIO. 18 + 19 + Some of these devices have a firmware issue where the LED gets turned 20 + on at boot. This driver will turn the LED off at boot and also allows 21 + controlling the LED (repurposing it) through the sysfs LED interface. 22 + 23 + Which GPIO is attached to the LED is usually not described in the 24 + ACPI tables, so this driver contains per-system info about the GPIO 25 + inside the driver, this means that this driver only works on systems 26 + the driver knows about. 27 + 28 + To compile this driver as a module, choose M here: the module 29 + will be called intel_atomisp2_led. 30 + 31 + config INTEL_ATOMISP2_PM 32 + tristate "Intel AtomISP v2 dummy / power-management driver" 33 + depends on PCI && IOSF_MBI && PM 34 + depends on !INTEL_ATOMISP 35 + select INTEL_ATOMISP2_PDX86 36 + help 37 + Power-management driver for Intel's Image Signal Processor found on 38 + Bay Trail and Cherry Trail devices. This dummy driver's sole purpose 39 + is to turn the ISP off (put it in D3) to save power and to allow 40 + entering of S0ix modes. 41 + 42 + To compile this driver as a module, choose M here: the module 43 + will be called intel_atomisp2_pm.
+9
drivers/platform/x86/intel/atomisp2/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # Intel x86 Platform Specific Drivers 4 + # 5 + 6 + intel_atomisp2_led-y := led.o 7 + obj-$(CONFIG_INTEL_ATOMISP2_LED) += intel_atomisp2_led.o 8 + intel_atomisp2_pm-y += pm.o 9 + obj-$(CONFIG_INTEL_ATOMISP2_PM) += intel_atomisp2_pm.o
+14
drivers/platform/x86/intel/int1092/Kconfig
··· 1 + config INTEL_SAR_INT1092 2 + tristate "Intel Specific Absorption Rate Driver" 3 + depends on ACPI 4 + help 5 + This driver helps to limit the exposure of human body to RF frequency by 6 + providing information to userspace application that will inform the Intel 7 + M.2 modem to regulate the RF power based on SAR data obtained from the 8 + sensors captured in the BIOS. ACPI interface exposes this data from the BIOS 9 + to SAR driver. The front end application in userspace will interact with SAR 10 + driver to obtain information like the device mode, Antenna index, baseband index, 11 + SAR table index and use available communication like MBIM interface to enable 12 + data communication to modem for RF power regulation. Enable this config when 13 + given platform needs to support "Dynamic SAR" configuration for a modem available 14 + on the platform.
+1
drivers/platform/x86/intel/int1092/Makefile
··· 1 + obj-$(CONFIG_INTEL_SAR_INT1092) += intel_sar.o
+316
drivers/platform/x86/intel/int1092/intel_sar.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (c) 2021, Intel Corporation. 4 + */ 5 + 6 + #include <linux/acpi.h> 7 + #include <linux/kobject.h> 8 + #include <linux/platform_device.h> 9 + #include <linux/sysfs.h> 10 + #include "intel_sar.h" 11 + 12 + /** 13 + * get_int_value: Retrieve integer values from ACPI Object 14 + * @obj: acpi_object pointer which has the integer value 15 + * @out: output pointer will get integer value 16 + * 17 + * Function is used to retrieve integer value from acpi object. 18 + * 19 + * Return: 20 + * * 0 on success 21 + * * -EIO if there is an issue in acpi_object passed. 22 + */ 23 + static int get_int_value(union acpi_object *obj, int *out) 24 + { 25 + if (!obj || obj->type != ACPI_TYPE_INTEGER) 26 + return -EIO; 27 + *out = (int)obj->integer.value; 28 + return 0; 29 + } 30 + 31 + /** 32 + * update_sar_data: sar data is updated based on regulatory mode 33 + * @context: pointer to driver context structure 34 + * 35 + * sar_data is updated based on regulatory value 36 + * context->reg_value will never exceed MAX_REGULATORY 37 + */ 38 + static void update_sar_data(struct wwan_sar_context *context) 39 + { 40 + struct wwan_device_mode_configuration *config = 41 + &context->config_data[context->reg_value]; 42 + 43 + if (config->device_mode_info && 44 + context->sar_data.device_mode < config->total_dev_mode) { 45 + struct wwan_device_mode_info *dev_mode = 46 + &config->device_mode_info[context->sar_data.device_mode]; 47 + 48 + context->sar_data.antennatable_index = dev_mode->antennatable_index; 49 + context->sar_data.bandtable_index = dev_mode->bandtable_index; 50 + context->sar_data.sartable_index = dev_mode->sartable_index; 51 + } 52 + } 53 + 54 + /** 55 + * parse_package: parse acpi package for retrieving SAR information 56 + * @context: pointer to driver context structure 57 + * @item : acpi_object pointer 58 + * 59 + * Given acpi_object is iterated to retrieve information for each device mode. 60 + * If a given package corresponding to a specific device mode is faulty, it is 61 + * skipped and the specific entry in context structure will have the default value 62 + * of zero. Decoding of subsequent device modes is realized by having "continue" 63 + * statements in the for loop on encountering error in parsing given device mode. 64 + * 65 + * Return: 66 + * AE_OK if success 67 + * AE_ERROR on error 68 + */ 69 + static acpi_status parse_package(struct wwan_sar_context *context, union acpi_object *item) 70 + { 71 + struct wwan_device_mode_configuration *data; 72 + int value, itr, reg; 73 + union acpi_object *num; 74 + 75 + num = &item->package.elements[0]; 76 + if (get_int_value(num, &value) || value < 0 || value >= MAX_REGULATORY) 77 + return AE_ERROR; 78 + 79 + reg = value; 80 + 81 + data = &context->config_data[reg]; 82 + if (data->total_dev_mode > MAX_DEV_MODES || data->total_dev_mode == 0 || 83 + item->package.count <= data->total_dev_mode) 84 + return AE_ERROR; 85 + 86 + data->device_mode_info = kmalloc_array(data->total_dev_mode, 87 + sizeof(struct wwan_device_mode_info), GFP_KERNEL); 88 + if (!data->device_mode_info) 89 + return AE_ERROR; 90 + 91 + for (itr = 0; itr < data->total_dev_mode; itr++) { 92 + struct wwan_device_mode_info temp = { 0 }; 93 + 94 + num = &item->package.elements[itr + 1]; 95 + if (num->type != ACPI_TYPE_PACKAGE || num->package.count < TOTAL_DATA) 96 + continue; 97 + if (get_int_value(&num->package.elements[0], &temp.device_mode)) 98 + continue; 99 + if (get_int_value(&num->package.elements[1], &temp.bandtable_index)) 100 + continue; 101 + if (get_int_value(&num->package.elements[2], &temp.antennatable_index)) 102 + continue; 103 + if (get_int_value(&num->package.elements[3], &temp.sartable_index)) 104 + continue; 105 + data->device_mode_info[itr] = temp; 106 + } 107 + return AE_OK; 108 + } 109 + 110 + /** 111 + * sar_get_device_mode: Extraction of information from BIOS via DSM calls 112 + * @device: ACPI device for which to retrieve the data 113 + * 114 + * Retrieve the current device mode information from the BIOS. 115 + * 116 + * Return: 117 + * AE_OK on success 118 + * AE_ERROR on error 119 + */ 120 + static acpi_status sar_get_device_mode(struct platform_device *device) 121 + { 122 + struct wwan_sar_context *context = dev_get_drvdata(&device->dev); 123 + acpi_status status = AE_OK; 124 + union acpi_object *out; 125 + u32 rev = 0; 126 + int value; 127 + 128 + out = acpi_evaluate_dsm(context->handle, &context->guid, rev, 129 + COMMAND_ID_DEV_MODE, NULL); 130 + if (get_int_value(out, &value)) { 131 + dev_err(&device->dev, "DSM cmd:%d Failed to retrieve value\n", COMMAND_ID_DEV_MODE); 132 + status = AE_ERROR; 133 + goto dev_mode_error; 134 + } 135 + context->sar_data.device_mode = value; 136 + update_sar_data(context); 137 + sysfs_notify(&device->dev.kobj, NULL, SYSFS_DATANAME); 138 + 139 + dev_mode_error: 140 + ACPI_FREE(out); 141 + return status; 142 + } 143 + 144 + static const struct acpi_device_id sar_device_ids[] = { 145 + { "INTC1092", 0}, 146 + {} 147 + }; 148 + MODULE_DEVICE_TABLE(acpi, sar_device_ids); 149 + 150 + static ssize_t intc_data_show(struct device *dev, struct device_attribute *attr, char *buf) 151 + { 152 + struct wwan_sar_context *context = dev_get_drvdata(dev); 153 + 154 + return sysfs_emit(buf, "%d %d %d %d\n", context->sar_data.device_mode, 155 + context->sar_data.bandtable_index, 156 + context->sar_data.antennatable_index, 157 + context->sar_data.sartable_index); 158 + } 159 + static DEVICE_ATTR_RO(intc_data); 160 + 161 + static ssize_t intc_reg_show(struct device *dev, struct device_attribute *attr, char *buf) 162 + { 163 + struct wwan_sar_context *context = dev_get_drvdata(dev); 164 + 165 + return sysfs_emit(buf, "%d\n", context->reg_value); 166 + } 167 + 168 + static ssize_t intc_reg_store(struct device *dev, struct device_attribute *attr, 169 + const char *buf, size_t count) 170 + { 171 + struct wwan_sar_context *context = dev_get_drvdata(dev); 172 + unsigned int value; 173 + int read; 174 + 175 + if (!count) 176 + return -EINVAL; 177 + read = kstrtouint(buf, 10, &value); 178 + if (read < 0) 179 + return read; 180 + if (value >= MAX_REGULATORY) 181 + return -EOVERFLOW; 182 + context->reg_value = value; 183 + update_sar_data(context); 184 + sysfs_notify(&dev->kobj, NULL, SYSFS_DATANAME); 185 + return count; 186 + } 187 + static DEVICE_ATTR_RW(intc_reg); 188 + 189 + static struct attribute *intcsar_attrs[] = { 190 + &dev_attr_intc_data.attr, 191 + &dev_attr_intc_reg.attr, 192 + NULL 193 + }; 194 + 195 + static struct attribute_group intcsar_group = { 196 + .attrs = intcsar_attrs, 197 + }; 198 + 199 + static void sar_notify(acpi_handle handle, u32 event, void *data) 200 + { 201 + struct platform_device *device = data; 202 + 203 + if (event == SAR_EVENT) { 204 + if (sar_get_device_mode(device) != AE_OK) 205 + dev_err(&device->dev, "sar_get_device_mode error"); 206 + } 207 + } 208 + 209 + static void sar_get_data(int reg, struct wwan_sar_context *context) 210 + { 211 + union acpi_object *out, req; 212 + u32 rev = 0; 213 + 214 + req.type = ACPI_TYPE_INTEGER; 215 + req.integer.value = reg; 216 + out = acpi_evaluate_dsm(context->handle, &context->guid, rev, 217 + COMMAND_ID_CONFIG_TABLE, &req); 218 + if (!out) 219 + return; 220 + if (out->type == ACPI_TYPE_PACKAGE && out->package.count >= 3 && 221 + out->package.elements[0].type == ACPI_TYPE_INTEGER && 222 + out->package.elements[1].type == ACPI_TYPE_INTEGER && 223 + out->package.elements[2].type == ACPI_TYPE_PACKAGE && 224 + out->package.elements[2].package.count > 0) { 225 + context->config_data[reg].version = out->package.elements[0].integer.value; 226 + context->config_data[reg].total_dev_mode = 227 + out->package.elements[1].integer.value; 228 + if (context->config_data[reg].total_dev_mode <= 0 || 229 + context->config_data[reg].total_dev_mode > MAX_DEV_MODES) { 230 + ACPI_FREE(out); 231 + return; 232 + } 233 + parse_package(context, &out->package.elements[2]); 234 + } 235 + ACPI_FREE(out); 236 + } 237 + 238 + static int sar_probe(struct platform_device *device) 239 + { 240 + struct wwan_sar_context *context; 241 + int reg; 242 + int result; 243 + 244 + context = kzalloc(sizeof(*context), GFP_KERNEL); 245 + if (!context) 246 + return -ENOMEM; 247 + 248 + context->sar_device = device; 249 + context->handle = ACPI_HANDLE(&device->dev); 250 + dev_set_drvdata(&device->dev, context); 251 + 252 + result = guid_parse(SAR_DSM_UUID, &context->guid); 253 + if (result) { 254 + dev_err(&device->dev, "SAR UUID parse error: %d\n", result); 255 + goto r_free; 256 + } 257 + 258 + for (reg = 0; reg < MAX_REGULATORY; reg++) 259 + sar_get_data(reg, context); 260 + 261 + if (sar_get_device_mode(device) != AE_OK) { 262 + dev_err(&device->dev, "Failed to get device mode\n"); 263 + result = -EIO; 264 + goto r_free; 265 + } 266 + 267 + result = sysfs_create_group(&device->dev.kobj, &intcsar_group); 268 + if (result) { 269 + dev_err(&device->dev, "sysfs creation failed\n"); 270 + goto r_free; 271 + } 272 + 273 + if (acpi_install_notify_handler(ACPI_HANDLE(&device->dev), ACPI_DEVICE_NOTIFY, 274 + sar_notify, (void *)device) != AE_OK) { 275 + dev_err(&device->dev, "Failed acpi_install_notify_handler\n"); 276 + result = -EIO; 277 + goto r_sys; 278 + } 279 + return 0; 280 + 281 + r_sys: 282 + sysfs_remove_group(&device->dev.kobj, &intcsar_group); 283 + r_free: 284 + kfree(context); 285 + return result; 286 + } 287 + 288 + static int sar_remove(struct platform_device *device) 289 + { 290 + struct wwan_sar_context *context = dev_get_drvdata(&device->dev); 291 + int reg; 292 + 293 + acpi_remove_notify_handler(ACPI_HANDLE(&device->dev), 294 + ACPI_DEVICE_NOTIFY, sar_notify); 295 + sysfs_remove_group(&device->dev.kobj, &intcsar_group); 296 + for (reg = 0; reg < MAX_REGULATORY; reg++) 297 + kfree(context->config_data[reg].device_mode_info); 298 + 299 + kfree(context); 300 + return 0; 301 + } 302 + 303 + static struct platform_driver sar_driver = { 304 + .probe = sar_probe, 305 + .remove = sar_remove, 306 + .driver = { 307 + .name = DRVNAME, 308 + .owner = THIS_MODULE, 309 + .acpi_match_table = ACPI_PTR(sar_device_ids) 310 + } 311 + }; 312 + module_platform_driver(sar_driver); 313 + 314 + MODULE_LICENSE("GPL v2"); 315 + MODULE_DESCRIPTION("Platform device driver for INTEL MODEM BIOS SAR"); 316 + MODULE_AUTHOR("Shravan S <s.shravan@intel.com>");
+86
drivers/platform/x86/intel/int1092/intel_sar.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (c) 2021, Intel Corporation. 4 + */ 5 + #ifndef INTEL_SAR_H 6 + #define INTEL_SAR_H 7 + 8 + #define COMMAND_ID_DEV_MODE 1 9 + #define COMMAND_ID_CONFIG_TABLE 2 10 + #define DRVNAME "intc_sar" 11 + #define MAX_DEV_MODES 50 12 + #define MAX_REGULATORY 3 13 + #define SAR_DSM_UUID "82737E72-3A33-4C45-A9C7-57C0411A5F13" 14 + #define SAR_EVENT 0x80 15 + #define SYSFS_DATANAME "intc_data" 16 + #define TOTAL_DATA 4 17 + 18 + /** 19 + * Structure wwan_device_mode_info - device mode information 20 + * Holds the data that needs to be passed to userspace. 21 + * The data is updated from the BIOS sensor information. 22 + * @device_mode: Specific mode of the device 23 + * @bandtable_index: Index of RF band 24 + * @antennatable_index: Index of antenna 25 + * @sartable_index: Index of SAR 26 + */ 27 + struct wwan_device_mode_info { 28 + int device_mode; 29 + int bandtable_index; 30 + int antennatable_index; 31 + int sartable_index; 32 + }; 33 + 34 + /** 35 + * Structure wwan_device_mode_configuration - device configuration 36 + * Holds the data that is configured and obtained on probe event. 37 + * The data is updated from the BIOS sensor information. 38 + * @version: Mode configuration version 39 + * @total_dev_mode: Total number of device modes 40 + * @device_mode_info: pointer to structure wwan_device_mode_info 41 + */ 42 + struct wwan_device_mode_configuration { 43 + int version; 44 + int total_dev_mode; 45 + struct wwan_device_mode_info *device_mode_info; 46 + }; 47 + 48 + /** 49 + * Structure wwan_supported_info - userspace datastore 50 + * Holds the data that is obtained from userspace 51 + * The data is updated from the userspace and send value back in the 52 + * structure format that is mentioned here. 53 + * @reg_mode_needed: regulatory mode set by user for tests 54 + * @bios_table_revision: Version of SAR table 55 + * @num_supported_modes: Total supported modes based on reg_mode 56 + */ 57 + struct wwan_supported_info { 58 + int reg_mode_needed; 59 + int bios_table_revision; 60 + int num_supported_modes; 61 + }; 62 + 63 + /** 64 + * Structure wwan_sar_context - context of SAR 65 + * Holds the complete context as long as the driver is in existence 66 + * The context holds instance of the data used for different cases. 67 + * @guid: Group id 68 + * @handle: store acpi handle 69 + * @reg_value: regulatory value 70 + * Regulatory 0: FCC, 1: CE, 2: ISED 71 + * @sar_device: platform_device type 72 + * @sar_kobject: kobject for sysfs 73 + * @supported_data: wwan_supported_info struct 74 + * @sar_data: wwan_device_mode_info struct 75 + * @config_data: wwan_device_mode_configuration array struct 76 + */ 77 + struct wwan_sar_context { 78 + guid_t guid; 79 + acpi_handle handle; 80 + int reg_value; 81 + struct platform_device *sar_device; 82 + struct wwan_supported_info supported_data; 83 + struct wwan_device_mode_info sar_data; 84 + struct wwan_device_mode_configuration config_data[MAX_REGULATORY]; 85 + }; 86 + #endif /* INTEL_SAR_H */
+1 -1
drivers/platform/x86/intel/int33fe/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 obj-$(CONFIG_INTEL_CHT_INT33FE) += intel_cht_int33fe.o 3 - intel_cht_int33fe-objs := intel_cht_int33fe_common.o \ 3 + intel_cht_int33fe-y := intel_cht_int33fe_common.o \ 4 4 intel_cht_int33fe_typec.o \ 5 5 intel_cht_int33fe_microb.o
+1 -28
drivers/platform/x86/intel/int33fe/intel_cht_int33fe_common.c
··· 16 16 17 17 #define EXPECTED_PTYPE 4 18 18 19 - static int cht_int33fe_i2c_res_filter(struct acpi_resource *ares, void *data) 20 - { 21 - struct acpi_resource_i2c_serialbus *sb; 22 - int *count = data; 23 - 24 - if (i2c_acpi_get_i2c_resource(ares, &sb)) 25 - (*count)++; 26 - 27 - return 1; 28 - } 29 - 30 - static int cht_int33fe_count_i2c_clients(struct device *dev) 31 - { 32 - struct acpi_device *adev = ACPI_COMPANION(dev); 33 - LIST_HEAD(resource_list); 34 - int count = 0; 35 - int ret; 36 - 37 - ret = acpi_dev_get_resources(adev, &resource_list, 38 - cht_int33fe_i2c_res_filter, &count); 39 - acpi_dev_free_resource_list(&resource_list); 40 - if (ret < 0) 41 - return ret; 42 - 43 - return count; 44 - } 45 - 46 19 static int cht_int33fe_check_hw_type(struct device *dev) 47 20 { 48 21 unsigned long long ptyp; ··· 42 69 return -ENODEV; 43 70 } 44 71 45 - ret = cht_int33fe_count_i2c_clients(dev); 72 + ret = i2c_acpi_client_count(ACPI_COMPANION(dev)); 46 73 if (ret < 0) 47 74 return ret; 48 75
+1 -1
drivers/platform/x86/intel/int3472/Makefile
··· 1 1 obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472.o 2 - intel_skl_int3472-objs := intel_skl_int3472_common.o \ 2 + intel_skl_int3472-y := intel_skl_int3472_common.o \ 3 3 intel_skl_int3472_discrete.o \ 4 4 intel_skl_int3472_tps68470.o \ 5 5 intel_skl_int3472_clk_and_regulator.o
+25
drivers/platform/x86/intel/pmc/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # 3 + # Intel x86 Platform-Specific Drivers 4 + # 5 + 6 + config INTEL_PMC_CORE 7 + tristate "Intel PMC Core driver" 8 + depends on PCI 9 + depends on ACPI 10 + help 11 + The Intel Platform Controller Hub for Intel Core SoCs provides access 12 + to Power Management Controller registers via various interfaces. This 13 + driver can utilize debugging capabilities and supported features as 14 + exposed by the Power Management Controller. It also may perform some 15 + tasks in the PMC in order to enable transition into the SLPS0 state. 16 + It should be selected on all Intel platforms supported by the driver. 17 + 18 + Supported features: 19 + - SLP_S0_RESIDENCY counter 20 + - PCH IP Power Gating status 21 + - LTR Ignore / LTR Show 22 + - MPHY/PLL gating status (Sunrisepoint PCH only) 23 + - SLPS0 Debug registers (Cannonlake/Icelake PCH) 24 + - Low Power Mode registers (Tigerlake and beyond) 25 + - PMC quirks as needed to enable SLPS0/S0ix
+9
drivers/platform/x86/intel/pmc/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # 3 + # Intel x86 Platform-Specific Drivers 4 + # 5 + 6 + intel_pmc_core-y := core.o 7 + obj-$(CONFIG_INTEL_PMC_CORE) += intel_pmc_core.o 8 + intel_pmc_core_pltdrv-y := pltdrv.o 9 + obj-$(CONFIG_INTEL_PMC_CORE) += intel_pmc_core_pltdrv.o
+40
drivers/platform/x86/intel/pmt/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # Intel Platform Monitoring Technology drivers 4 + # 5 + 6 + config INTEL_PMT_CLASS 7 + tristate 8 + help 9 + The Intel Platform Monitoring Technology (PMT) class driver provides 10 + the basic sysfs interface and file hierarchy used by PMT devices. 11 + 12 + For more information, see: 13 + <file:Documentation/ABI/testing/sysfs-class-intel_pmt> 14 + 15 + To compile this driver as a module, choose M here: the module 16 + will be called intel_pmt_class. 17 + 18 + config INTEL_PMT_TELEMETRY 19 + tristate "Intel Platform Monitoring Technology (PMT) Telemetry driver" 20 + depends on MFD_INTEL_PMT 21 + select INTEL_PMT_CLASS 22 + help 23 + The Intel Platform Monitory Technology (PMT) Telemetry driver provides 24 + access to hardware telemetry metrics on devices that support the 25 + feature. 26 + 27 + To compile this driver as a module, choose M here: the module 28 + will be called intel_pmt_telemetry. 29 + 30 + config INTEL_PMT_CRASHLOG 31 + tristate "Intel Platform Monitoring Technology (PMT) Crashlog driver" 32 + depends on MFD_INTEL_PMT 33 + select INTEL_PMT_CLASS 34 + help 35 + The Intel Platform Monitoring Technology (PMT) crashlog driver provides 36 + access to hardware crashlog capabilities on devices that support the 37 + feature. 38 + 39 + To compile this driver as a module, choose M here: the module 40 + will be called intel_pmt_crashlog.
+12
drivers/platform/x86/intel/pmt/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # 3 + # Makefile for linux/drivers/platform/x86/intel/pmt 4 + # Intel Platform Monitoring Technology Drivers 5 + # 6 + 7 + obj-$(CONFIG_INTEL_PMT_CLASS) += pmt_class.o 8 + pmt_class-y := class.o 9 + obj-$(CONFIG_INTEL_PMT_TELEMETRY) += pmt_telemetry.o 10 + pmt_telemetry-y := telemetry.o 11 + obj-$(CONFIG_INTEL_PMT_CRASHLOG) += pmt_crashlog.o 12 + pmt_crashlog-y := crashlog.o
+16
drivers/platform/x86/intel/telemetry/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # Intel x86 Platform Specific Drivers 4 + # 5 + 6 + config INTEL_TELEMETRY 7 + tristate "Intel SoC Telemetry driver" 8 + depends on X86_64 9 + depends on MFD_INTEL_PMC_BXT 10 + depends on INTEL_PUNIT_IPC 11 + help 12 + This driver provides interfaces to configure and use 13 + telemetry for Intel SoC from Apollo Lake onwards. 14 + It is also used to get various SoC events and parameters 15 + directly via debugfs files. Various tools may use 16 + this interface for SoC state monitoring.
+11
drivers/platform/x86/intel/telemetry/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # Intel x86 Platform Specific Drivers 4 + # 5 + 6 + intel_telemetry_core-y := core.o 7 + obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_core.o 8 + intel_telemetry_pltdrv-y := pltdrv.o 9 + obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_pltdrv.o 10 + intel_telemetry_debugfs-y := debugfs.o 11 + obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_debugfs.o
+31
drivers/platform/x86/intel/wmi/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # Intel x86 Platform Specific Drivers 4 + # 5 + 6 + config INTEL_WMI 7 + bool 8 + 9 + config INTEL_WMI_SBL_FW_UPDATE 10 + tristate "Intel WMI Slim Bootloader firmware update signaling driver" 11 + depends on ACPI_WMI 12 + select INTEL_WMI 13 + help 14 + Say Y here if you want to be able to use the WMI interface to signal 15 + Slim Bootloader to trigger update on next reboot. 16 + 17 + To compile this driver as a module, choose M here: the module will 18 + be called intel-wmi-sbl-fw-update. 19 + 20 + config INTEL_WMI_THUNDERBOLT 21 + tristate "Intel WMI thunderbolt force power driver" 22 + depends on ACPI_WMI 23 + select INTEL_WMI 24 + help 25 + Say Y here if you want to be able to use the WMI interface on select 26 + systems to force the power control of Intel Thunderbolt controllers. 27 + This is useful for updating the firmware when devices are not plugged 28 + into the controller. 29 + 30 + To compile this driver as a module, choose M here: the module will 31 + be called intel-wmi-thunderbolt.
+9
drivers/platform/x86/intel/wmi/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # Intel x86 Platform Specific Drivers 4 + # 5 + 6 + intel-wmi-sbl-fw-update-y := sbl-fw-update.o 7 + obj-$(CONFIG_INTEL_WMI_SBL_FW_UPDATE) += intel-wmi-sbl-fw-update.o 8 + intel-wmi-thunderbolt-y := thunderbolt.o 9 + obj-$(CONFIG_INTEL_WMI_THUNDERBOLT) += intel-wmi-thunderbolt.o
drivers/platform/x86/intel_atomisp2_led.c drivers/platform/x86/intel/atomisp2/led.c
drivers/platform/x86/intel_atomisp2_pm.c drivers/platform/x86/intel/atomisp2/pm.c
drivers/platform/x86/intel_bxtwc_tmu.c drivers/platform/x86/intel/bxtwc_tmu.c
drivers/platform/x86/intel_chtdc_ti_pwrbtn.c drivers/platform/x86/intel/chtdc_ti_pwrbtn.c
drivers/platform/x86/intel_int0002_vgpio.c drivers/platform/x86/intel/int0002_vgpio.c
drivers/platform/x86/intel_menlow.c drivers/thermal/intel/intel_menlow.c
drivers/platform/x86/intel_mrfld_pwrbtn.c drivers/platform/x86/intel/mrfld_pwrbtn.c
drivers/platform/x86/intel_oaktrail.c drivers/platform/x86/intel/oaktrail.c
+356 -18
drivers/platform/x86/intel_pmc_core.c drivers/platform/x86/intel/pmc/core.c
··· 31 31 #include <asm/msr.h> 32 32 #include <asm/tsc.h> 33 33 34 - #include "intel_pmc_core.h" 34 + #include "core.h" 35 35 36 36 #define ACPI_S0IX_DSM_UUID "57a6512e-3979-4e9d-9708-ff13b2508972" 37 37 #define ACPI_GET_LOW_MODE_REGISTERS 1 ··· 644 644 free_acpi_obj: 645 645 ACPI_FREE(out_obj); 646 646 } 647 + 648 + /* Alder Lake: PGD PFET Enable Ack Status Register(s) bitmap */ 649 + static const struct pmc_bit_map adl_pfear_map[] = { 650 + {"SPI/eSPI", BIT(2)}, 651 + {"XHCI", BIT(3)}, 652 + {"SPA", BIT(4)}, 653 + {"SPB", BIT(5)}, 654 + {"SPC", BIT(6)}, 655 + {"GBE", BIT(7)}, 656 + 657 + {"SATA", BIT(0)}, 658 + {"HDA_PGD0", BIT(1)}, 659 + {"HDA_PGD1", BIT(2)}, 660 + {"HDA_PGD2", BIT(3)}, 661 + {"HDA_PGD3", BIT(4)}, 662 + {"SPD", BIT(5)}, 663 + {"LPSS", BIT(6)}, 664 + 665 + {"SMB", BIT(0)}, 666 + {"ISH", BIT(1)}, 667 + {"ITH", BIT(3)}, 668 + 669 + {"XDCI", BIT(1)}, 670 + {"DCI", BIT(2)}, 671 + {"CSE", BIT(3)}, 672 + {"CSME_KVM", BIT(4)}, 673 + {"CSME_PMT", BIT(5)}, 674 + {"CSME_CLINK", BIT(6)}, 675 + {"CSME_PTIO", BIT(7)}, 676 + 677 + {"CSME_USBR", BIT(0)}, 678 + {"CSME_SUSRAM", BIT(1)}, 679 + {"CSME_SMT1", BIT(2)}, 680 + {"CSME_SMS2", BIT(4)}, 681 + {"CSME_SMS1", BIT(5)}, 682 + {"CSME_RTC", BIT(6)}, 683 + {"CSME_PSF", BIT(7)}, 684 + 685 + {"CNVI", BIT(3)}, 686 + 687 + {"HDA_PGD4", BIT(2)}, 688 + {"HDA_PGD5", BIT(3)}, 689 + {"HDA_PGD6", BIT(4)}, 690 + {} 691 + }; 692 + 693 + static const struct pmc_bit_map *ext_adl_pfear_map[] = { 694 + /* 695 + * Check intel_pmc_core_ids[] users of cnp_reg_map for 696 + * a list of core SoCs using this. 697 + */ 698 + adl_pfear_map, 699 + NULL 700 + }; 701 + 702 + static const struct pmc_bit_map adl_ltr_show_map[] = { 703 + {"SOUTHPORT_A", CNP_PMC_LTR_SPA}, 704 + {"SOUTHPORT_B", CNP_PMC_LTR_SPB}, 705 + {"SATA", CNP_PMC_LTR_SATA}, 706 + {"GIGABIT_ETHERNET", CNP_PMC_LTR_GBE}, 707 + {"XHCI", CNP_PMC_LTR_XHCI}, 708 + {"SOUTHPORT_F", ADL_PMC_LTR_SPF}, 709 + {"ME", CNP_PMC_LTR_ME}, 710 + /* EVA is Enterprise Value Add, doesn't really exist on PCH */ 711 + {"SATA1", CNP_PMC_LTR_EVA}, 712 + {"SOUTHPORT_C", CNP_PMC_LTR_SPC}, 713 + {"HD_AUDIO", CNP_PMC_LTR_AZ}, 714 + {"CNV", CNP_PMC_LTR_CNV}, 715 + {"LPSS", CNP_PMC_LTR_LPSS}, 716 + {"SOUTHPORT_D", CNP_PMC_LTR_SPD}, 717 + {"SOUTHPORT_E", CNP_PMC_LTR_SPE}, 718 + {"SATA2", CNP_PMC_LTR_CAM}, 719 + {"ESPI", CNP_PMC_LTR_ESPI}, 720 + {"SCC", CNP_PMC_LTR_SCC}, 721 + {"ISH", CNP_PMC_LTR_ISH}, 722 + {"UFSX2", CNP_PMC_LTR_UFSX2}, 723 + {"EMMC", CNP_PMC_LTR_EMMC}, 724 + /* 725 + * Check intel_pmc_core_ids[] users of cnp_reg_map for 726 + * a list of core SoCs using this. 727 + */ 728 + {"WIGIG", ICL_PMC_LTR_WIGIG}, 729 + {"THC0", TGL_PMC_LTR_THC0}, 730 + {"THC1", TGL_PMC_LTR_THC1}, 731 + {"SOUTHPORT_G", CNP_PMC_LTR_RESERVED}, 732 + 733 + /* Below two cannot be used for LTR_IGNORE */ 734 + {"CURRENT_PLATFORM", CNP_PMC_LTR_CUR_PLT}, 735 + {"AGGREGATED_SYSTEM", CNP_PMC_LTR_CUR_ASLT}, 736 + {} 737 + }; 738 + 739 + static const struct pmc_bit_map adl_clocksource_status_map[] = { 740 + {"CLKPART1_OFF_STS", BIT(0)}, 741 + {"CLKPART2_OFF_STS", BIT(1)}, 742 + {"CLKPART3_OFF_STS", BIT(2)}, 743 + {"CLKPART4_OFF_STS", BIT(3)}, 744 + {"CLKPART5_OFF_STS", BIT(4)}, 745 + {"CLKPART6_OFF_STS", BIT(5)}, 746 + {"CLKPART7_OFF_STS", BIT(6)}, 747 + {"CLKPART8_OFF_STS", BIT(7)}, 748 + {"PCIE0PLL_OFF_STS", BIT(10)}, 749 + {"PCIE1PLL_OFF_STS", BIT(11)}, 750 + {"PCIE2PLL_OFF_STS", BIT(12)}, 751 + {"PCIE3PLL_OFF_STS", BIT(13)}, 752 + {"PCIE4PLL_OFF_STS", BIT(14)}, 753 + {"PCIE5PLL_OFF_STS", BIT(15)}, 754 + {"PCIE6PLL_OFF_STS", BIT(16)}, 755 + {"USB2PLL_OFF_STS", BIT(18)}, 756 + {"OCPLL_OFF_STS", BIT(22)}, 757 + {"AUDIOPLL_OFF_STS", BIT(23)}, 758 + {"GBEPLL_OFF_STS", BIT(24)}, 759 + {"Fast_XTAL_Osc_OFF_STS", BIT(25)}, 760 + {"AC_Ring_Osc_OFF_STS", BIT(26)}, 761 + {"MC_Ring_Osc_OFF_STS", BIT(27)}, 762 + {"SATAPLL_OFF_STS", BIT(29)}, 763 + {"USB3PLL_OFF_STS", BIT(31)}, 764 + {} 765 + }; 766 + 767 + static const struct pmc_bit_map adl_power_gating_status_0_map[] = { 768 + {"PMC_PGD0_PG_STS", BIT(0)}, 769 + {"DMI_PGD0_PG_STS", BIT(1)}, 770 + {"ESPISPI_PGD0_PG_STS", BIT(2)}, 771 + {"XHCI_PGD0_PG_STS", BIT(3)}, 772 + {"SPA_PGD0_PG_STS", BIT(4)}, 773 + {"SPB_PGD0_PG_STS", BIT(5)}, 774 + {"SPC_PGD0_PG_STS", BIT(6)}, 775 + {"GBE_PGD0_PG_STS", BIT(7)}, 776 + {"SATA_PGD0_PG_STS", BIT(8)}, 777 + {"DSP_PGD0_PG_STS", BIT(9)}, 778 + {"DSP_PGD1_PG_STS", BIT(10)}, 779 + {"DSP_PGD2_PG_STS", BIT(11)}, 780 + {"DSP_PGD3_PG_STS", BIT(12)}, 781 + {"SPD_PGD0_PG_STS", BIT(13)}, 782 + {"LPSS_PGD0_PG_STS", BIT(14)}, 783 + {"SMB_PGD0_PG_STS", BIT(16)}, 784 + {"ISH_PGD0_PG_STS", BIT(17)}, 785 + {"NPK_PGD0_PG_STS", BIT(19)}, 786 + {"PECI_PGD0_PG_STS", BIT(21)}, 787 + {"XDCI_PGD0_PG_STS", BIT(25)}, 788 + {"EXI_PGD0_PG_STS", BIT(26)}, 789 + {"CSE_PGD0_PG_STS", BIT(27)}, 790 + {"KVMCC_PGD0_PG_STS", BIT(28)}, 791 + {"PMT_PGD0_PG_STS", BIT(29)}, 792 + {"CLINK_PGD0_PG_STS", BIT(30)}, 793 + {"PTIO_PGD0_PG_STS", BIT(31)}, 794 + {} 795 + }; 796 + 797 + static const struct pmc_bit_map adl_power_gating_status_1_map[] = { 798 + {"USBR0_PGD0_PG_STS", BIT(0)}, 799 + {"SMT1_PGD0_PG_STS", BIT(2)}, 800 + {"CSMERTC_PGD0_PG_STS", BIT(6)}, 801 + {"CSMEPSF_PGD0_PG_STS", BIT(7)}, 802 + {"CNVI_PGD0_PG_STS", BIT(19)}, 803 + {"DSP_PGD4_PG_STS", BIT(26)}, 804 + {"SPG_PGD0_PG_STS", BIT(27)}, 805 + {"SPE_PGD0_PG_STS", BIT(28)}, 806 + {} 807 + }; 808 + 809 + static const struct pmc_bit_map adl_power_gating_status_2_map[] = { 810 + {"THC0_PGD0_PG_STS", BIT(7)}, 811 + {"THC1_PGD0_PG_STS", BIT(8)}, 812 + {"SPF_PGD0_PG_STS", BIT(14)}, 813 + {} 814 + }; 815 + 816 + static const struct pmc_bit_map adl_d3_status_0_map[] = { 817 + {"ISH_D3_STS", BIT(2)}, 818 + {"LPSS_D3_STS", BIT(3)}, 819 + {"XDCI_D3_STS", BIT(4)}, 820 + {"XHCI_D3_STS", BIT(5)}, 821 + {"SPA_D3_STS", BIT(12)}, 822 + {"SPB_D3_STS", BIT(13)}, 823 + {"SPC_D3_STS", BIT(14)}, 824 + {"SPD_D3_STS", BIT(15)}, 825 + {"SPE_D3_STS", BIT(16)}, 826 + {"DSP_D3_STS", BIT(19)}, 827 + {"SATA_D3_STS", BIT(20)}, 828 + {"DMI_D3_STS", BIT(22)}, 829 + {} 830 + }; 831 + 832 + static const struct pmc_bit_map adl_d3_status_1_map[] = { 833 + {"GBE_D3_STS", BIT(19)}, 834 + {"CNVI_D3_STS", BIT(27)}, 835 + {} 836 + }; 837 + 838 + static const struct pmc_bit_map adl_d3_status_2_map[] = { 839 + {"CSMERTC_D3_STS", BIT(1)}, 840 + {"CSE_D3_STS", BIT(4)}, 841 + {"KVMCC_D3_STS", BIT(5)}, 842 + {"USBR0_D3_STS", BIT(6)}, 843 + {"SMT1_D3_STS", BIT(8)}, 844 + {"PTIO_D3_STS", BIT(16)}, 845 + {"PMT_D3_STS", BIT(17)}, 846 + {} 847 + }; 848 + 849 + static const struct pmc_bit_map adl_d3_status_3_map[] = { 850 + {"THC0_D3_STS", BIT(14)}, 851 + {"THC1_D3_STS", BIT(15)}, 852 + {} 853 + }; 854 + 855 + static const struct pmc_bit_map adl_vnn_req_status_0_map[] = { 856 + {"ISH_VNN_REQ_STS", BIT(2)}, 857 + {"ESPISPI_VNN_REQ_STS", BIT(18)}, 858 + {"DSP_VNN_REQ_STS", BIT(19)}, 859 + {} 860 + }; 861 + 862 + static const struct pmc_bit_map adl_vnn_req_status_1_map[] = { 863 + {"NPK_VNN_REQ_STS", BIT(4)}, 864 + {"EXI_VNN_REQ_STS", BIT(9)}, 865 + {"GBE_VNN_REQ_STS", BIT(19)}, 866 + {"SMB_VNN_REQ_STS", BIT(25)}, 867 + {"CNVI_VNN_REQ_STS", BIT(27)}, 868 + {} 869 + }; 870 + 871 + static const struct pmc_bit_map adl_vnn_req_status_2_map[] = { 872 + {"CSMERTC_VNN_REQ_STS", BIT(1)}, 873 + {"CSE_VNN_REQ_STS", BIT(4)}, 874 + {"SMT1_VNN_REQ_STS", BIT(8)}, 875 + {"CLINK_VNN_REQ_STS", BIT(14)}, 876 + {"GPIOCOM4_VNN_REQ_STS", BIT(20)}, 877 + {"GPIOCOM3_VNN_REQ_STS", BIT(21)}, 878 + {"GPIOCOM2_VNN_REQ_STS", BIT(22)}, 879 + {"GPIOCOM1_VNN_REQ_STS", BIT(23)}, 880 + {"GPIOCOM0_VNN_REQ_STS", BIT(24)}, 881 + {} 882 + }; 883 + 884 + static const struct pmc_bit_map adl_vnn_req_status_3_map[] = { 885 + {"GPIOCOM5_VNN_REQ_STS", BIT(11)}, 886 + {} 887 + }; 888 + 889 + static const struct pmc_bit_map adl_vnn_misc_status_map[] = { 890 + {"CPU_C10_REQ_STS", BIT(0)}, 891 + {"PCIe_LPM_En_REQ_STS", BIT(3)}, 892 + {"ITH_REQ_STS", BIT(5)}, 893 + {"CNVI_REQ_STS", BIT(6)}, 894 + {"ISH_REQ_STS", BIT(7)}, 895 + {"USB2_SUS_PG_Sys_REQ_STS", BIT(10)}, 896 + {"PCIe_Clk_REQ_STS", BIT(12)}, 897 + {"MPHY_Core_DL_REQ_STS", BIT(16)}, 898 + {"Break-even_En_REQ_STS", BIT(17)}, 899 + {"MPHY_SUS_REQ_STS", BIT(22)}, 900 + {"xDCI_attached_REQ_STS", BIT(24)}, 901 + {} 902 + }; 903 + 904 + static const struct pmc_bit_map *adl_lpm_maps[] = { 905 + adl_clocksource_status_map, 906 + adl_power_gating_status_0_map, 907 + adl_power_gating_status_1_map, 908 + adl_power_gating_status_2_map, 909 + adl_d3_status_0_map, 910 + adl_d3_status_1_map, 911 + adl_d3_status_2_map, 912 + adl_d3_status_3_map, 913 + adl_vnn_req_status_0_map, 914 + adl_vnn_req_status_1_map, 915 + adl_vnn_req_status_2_map, 916 + adl_vnn_req_status_3_map, 917 + adl_vnn_misc_status_map, 918 + tgl_signal_status_map, 919 + NULL 920 + }; 921 + 922 + static const struct pmc_reg_map adl_reg_map = { 923 + .pfear_sts = ext_adl_pfear_map, 924 + .slp_s0_offset = ADL_PMC_SLP_S0_RES_COUNTER_OFFSET, 925 + .slp_s0_res_counter_step = TGL_PMC_SLP_S0_RES_COUNTER_STEP, 926 + .ltr_show_sts = adl_ltr_show_map, 927 + .msr_sts = msr_map, 928 + .ltr_ignore_offset = CNP_PMC_LTR_IGNORE_OFFSET, 929 + .regmap_length = CNP_PMC_MMIO_REG_LEN, 930 + .ppfear0_offset = CNP_PMC_HOST_PPFEAR0A, 931 + .ppfear_buckets = CNP_PPFEAR_NUM_ENTRIES, 932 + .pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET, 933 + .pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT, 934 + .ltr_ignore_max = ADL_NUM_IP_IGN_ALLOWED, 935 + .lpm_num_modes = ADL_LPM_NUM_MODES, 936 + .lpm_num_maps = ADL_LPM_NUM_MAPS, 937 + .lpm_res_counter_step_x2 = TGL_PMC_LPM_RES_COUNTER_STEP_X2, 938 + .etr3_offset = ETR3_OFFSET, 939 + .lpm_sts_latch_en_offset = ADL_LPM_STATUS_LATCH_EN_OFFSET, 940 + .lpm_priority_offset = ADL_LPM_PRI_OFFSET, 941 + .lpm_en_offset = ADL_LPM_EN_OFFSET, 942 + .lpm_residency_offset = ADL_LPM_RESIDENCY_OFFSET, 943 + .lpm_sts = adl_lpm_maps, 944 + .lpm_status_offset = ADL_LPM_STATUS_OFFSET, 945 + .lpm_live_status_offset = ADL_LPM_LIVE_STATUS_OFFSET, 946 + }; 647 947 648 948 static inline u32 pmc_core_reg_read(struct pmc_dev *pmcdev, int reg_offset) 649 949 { ··· 1749 1449 } 1750 1450 DEFINE_SHOW_ATTRIBUTE(pmc_core_pkgc); 1751 1451 1752 - static void pmc_core_get_low_power_modes(struct pmc_dev *pmcdev) 1452 + static bool pmc_core_pri_verify(u32 lpm_pri, u8 *mode_order) 1753 1453 { 1754 - u8 lpm_priority[LPM_MAX_NUM_MODES]; 1454 + int i, j; 1455 + 1456 + if (!lpm_pri) 1457 + return false; 1458 + /* 1459 + * Each byte contains the priority level for 2 modes (7:4 and 3:0). 1460 + * In a 32 bit register this allows for describing 8 modes. Store the 1461 + * levels and look for values out of range. 1462 + */ 1463 + for (i = 0; i < 8; i++) { 1464 + int level = lpm_pri & GENMASK(3, 0); 1465 + 1466 + if (level >= LPM_MAX_NUM_MODES) 1467 + return false; 1468 + 1469 + mode_order[i] = level; 1470 + lpm_pri >>= 4; 1471 + } 1472 + 1473 + /* Check that we have unique values */ 1474 + for (i = 0; i < LPM_MAX_NUM_MODES - 1; i++) 1475 + for (j = i + 1; j < LPM_MAX_NUM_MODES; j++) 1476 + if (mode_order[i] == mode_order[j]) 1477 + return false; 1478 + 1479 + return true; 1480 + } 1481 + 1482 + static void pmc_core_get_low_power_modes(struct platform_device *pdev) 1483 + { 1484 + struct pmc_dev *pmcdev = platform_get_drvdata(pdev); 1485 + u8 pri_order[LPM_MAX_NUM_MODES] = LPM_DEFAULT_PRI; 1486 + u8 mode_order[LPM_MAX_NUM_MODES]; 1487 + u32 lpm_pri; 1755 1488 u32 lpm_en; 1756 1489 int mode, i, p; 1757 1490 ··· 1795 1462 lpm_en = pmc_core_reg_read(pmcdev, pmcdev->map->lpm_en_offset); 1796 1463 pmcdev->num_lpm_modes = hweight32(lpm_en); 1797 1464 1798 - /* Each byte contains information for 2 modes (7:4 and 3:0) */ 1799 - for (mode = 0; mode < LPM_MAX_NUM_MODES; mode += 2) { 1800 - u8 priority = pmc_core_reg_read_byte(pmcdev, 1801 - pmcdev->map->lpm_priority_offset + (mode / 2)); 1802 - int pri0 = GENMASK(3, 0) & priority; 1803 - int pri1 = (GENMASK(7, 4) & priority) >> 4; 1465 + /* Read 32 bit LPM_PRI register */ 1466 + lpm_pri = pmc_core_reg_read(pmcdev, pmcdev->map->lpm_priority_offset); 1804 1467 1805 - lpm_priority[pri0] = mode; 1806 - lpm_priority[pri1] = mode + 1; 1807 - } 1808 1468 1809 1469 /* 1810 - * Loop though all modes from lowest to highest priority, 1470 + * If lpm_pri value passes verification, then override the default 1471 + * modes here. Otherwise stick with the default. 1472 + */ 1473 + if (pmc_core_pri_verify(lpm_pri, mode_order)) 1474 + /* Get list of modes in priority order */ 1475 + for (mode = 0; mode < LPM_MAX_NUM_MODES; mode++) 1476 + pri_order[mode_order[mode]] = mode; 1477 + else 1478 + dev_warn(&pdev->dev, "Assuming a default substate order for this platform\n"); 1479 + 1480 + /* 1481 + * Loop through all modes from lowest to highest priority, 1811 1482 * and capture all enabled modes in order 1812 1483 */ 1813 1484 i = 0; 1814 1485 for (p = LPM_MAX_NUM_MODES - 1; p >= 0; p--) { 1815 - int mode = lpm_priority[p]; 1486 + int mode = pri_order[p]; 1816 1487 1817 1488 if (!(BIT(mode) & lpm_en)) 1818 1489 continue; ··· 1911 1574 X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, &icl_reg_map), 1912 1575 X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, &tgl_reg_map), 1913 1576 X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &tgl_reg_map), 1577 + X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &adl_reg_map), 1914 1578 {} 1915 1579 }; 1916 1580 ··· 2013 1675 mutex_init(&pmcdev->lock); 2014 1676 2015 1677 pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(pmcdev); 2016 - pmc_core_get_low_power_modes(pmcdev); 1678 + pmc_core_get_low_power_modes(pdev); 2017 1679 pmc_core_do_dmi_quirks(pmcdev); 2018 1680 2019 1681 if (pmcdev->map == &tgl_reg_map) 2020 1682 pmc_core_get_tgl_lpm_reqs(pdev); 2021 1683 2022 1684 /* 2023 - * On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when 2024 - * a cable is attached. Tell the PMC to ignore it. 1685 + * On TGL and ADL, due to a hardware limitation, the GBE LTR blocks PC10 1686 + * when a cable is attached. Tell the PMC to ignore it. 2025 1687 */ 2026 - if (pmcdev->map == &tgl_reg_map) { 1688 + if (pmcdev->map == &tgl_reg_map || pmcdev->map == &adl_reg_map) { 2027 1689 dev_dbg(&pdev->dev, "ignoring GBE LTR\n"); 2028 1690 pmc_core_send_ltr_ignore(pmcdev, 3); 2029 1691 }
+19
drivers/platform/x86/intel_pmc_core.h drivers/platform/x86/intel/pmc/core.h
··· 188 188 #define ICL_PMC_SLP_S0_RES_COUNTER_STEP 0x64 189 189 190 190 #define LPM_MAX_NUM_MODES 8 191 + #define LPM_DEFAULT_PRI { 7, 6, 2, 5, 4, 1, 3, 0 } 192 + 191 193 #define GET_X2_COUNTER(v) ((v) >> 1) 192 194 #define LPM_STS_LATCH_MODE BIT(31) 193 195 ··· 198 196 #define TGL_PMC_LTR_THC1 0x1C08 199 197 #define TGL_NUM_IP_IGN_ALLOWED 23 200 198 #define TGL_PMC_LPM_RES_COUNTER_STEP_X2 61 /* 30.5us * 2 */ 199 + 200 + #define ADL_PMC_LTR_SPF 0x1C00 201 + #define ADL_NUM_IP_IGN_ALLOWED 23 202 + #define ADL_PMC_SLP_S0_RES_COUNTER_OFFSET 0x1098 201 203 202 204 /* 203 205 * Tigerlake Power Management Controller register offsets ··· 223 217 224 218 /* Extended Test Mode Register LPM bits (TGL and later */ 225 219 #define ETR3_CLEAR_LPM_EVENTS BIT(28) 220 + 221 + /* Alder Lake Power Management Controller register offsets */ 222 + #define ADL_LPM_EN_OFFSET 0x179C 223 + #define ADL_LPM_RESIDENCY_OFFSET 0x17A4 224 + #define ADL_LPM_NUM_MODES 2 225 + #define ADL_LPM_NUM_MAPS 14 226 + 227 + /* Alder Lake Low Power Mode debug registers */ 228 + #define ADL_LPM_STATUS_OFFSET 0x170C 229 + #define ADL_LPM_PRI_OFFSET 0x17A0 230 + #define ADL_LPM_STATUS_LATCH_EN_OFFSET 0x1704 231 + #define ADL_LPM_LIVE_STATUS_OFFSET 0x1764 226 232 227 233 const char *pmc_lpm_modes[] = { 228 234 "S0i2.0", ··· 295 277 const u32 pm_vric1_offset; 296 278 /* Low Power Mode registers */ 297 279 const int lpm_num_maps; 280 + const int lpm_num_modes; 298 281 const int lpm_res_counter_step_x2; 299 282 const u32 lpm_sts_latch_en_offset; 300 283 const u32 lpm_en_offset;
drivers/platform/x86/intel_pmc_core_pltdrv.c drivers/platform/x86/intel/pmc/pltdrv.c
+1 -1
drivers/platform/x86/intel_pmt_class.c drivers/platform/x86/intel/pmt/class.c
··· 13 13 #include <linux/mm.h> 14 14 #include <linux/pci.h> 15 15 16 - #include "intel_pmt_class.h" 16 + #include "class.h" 17 17 18 18 #define PMT_XA_START 0 19 19 #define PMT_XA_MAX INT_MAX
drivers/platform/x86/intel_pmt_class.h drivers/platform/x86/intel/pmt/class.h
+1 -1
drivers/platform/x86/intel_pmt_crashlog.c drivers/platform/x86/intel/pmt/crashlog.c
··· 15 15 #include <linux/uaccess.h> 16 16 #include <linux/overflow.h> 17 17 18 - #include "intel_pmt_class.h" 18 + #include "class.h" 19 19 20 20 #define DRV_NAME "pmt_crashlog" 21 21
+9 -1
drivers/platform/x86/intel_pmt_telemetry.c drivers/platform/x86/intel/pmt/telemetry.c
··· 15 15 #include <linux/uaccess.h> 16 16 #include <linux/overflow.h> 17 17 18 - #include "intel_pmt_class.h" 18 + #include "class.h" 19 19 20 20 #define TELEM_DEV_NAME "pmt_telemetry" 21 21 ··· 60 60 61 61 /* Size is measured in DWORDS, but accessor returns bytes */ 62 62 header->size = TELEM_SIZE(readl(disc_table)); 63 + 64 + /* 65 + * Some devices may expose non-functioning entries that are 66 + * reserved for future use. They have zero size. Do not fail 67 + * probe for these. Just ignore them. 68 + */ 69 + if (header->size == 0) 70 + return 1; 63 71 64 72 return 0; 65 73 }
drivers/platform/x86/intel_punit_ipc.c drivers/platform/x86/intel/punit_ipc.c
+1 -1
drivers/platform/x86/intel_scu_ipc.c
··· 457 457 EXPORT_SYMBOL(intel_scu_ipc_dev_simple_command); 458 458 459 459 /** 460 - * intel_scu_ipc_command_with_size() - Command with data 460 + * intel_scu_ipc_dev_command_with_size() - Command with data 461 461 * @scu: Optional SCU IPC instance 462 462 * @cmd: Command 463 463 * @sub: Sub type
drivers/platform/x86/intel_speed_select_if/Kconfig drivers/platform/x86/intel/speed_select_if/Kconfig
drivers/platform/x86/intel_speed_select_if/Makefile drivers/platform/x86/intel/speed_select_if/Makefile
+5 -4
drivers/platform/x86/intel_speed_select_if/isst_if_common.c drivers/platform/x86/intel/speed_select_if/isst_if_common.c
··· 265 265 { 266 266 struct isst_if_platform_info info; 267 267 268 - info.api_version = ISST_IF_API_VERSION, 269 - info.driver_version = ISST_IF_DRIVER_VERSION, 270 - info.max_cmds_per_ioctl = ISST_IF_CMD_LIMIT, 268 + info.api_version = ISST_IF_API_VERSION; 269 + info.driver_version = ISST_IF_DRIVER_VERSION; 270 + info.max_cmds_per_ioctl = ISST_IF_CMD_LIMIT; 271 271 info.mbox_supported = punit_callbacks[ISST_IF_DEV_MBOX].registered; 272 272 info.mmio_supported = punit_callbacks[ISST_IF_DEV_MMIO].registered; 273 273 ··· 379 379 u64 data; 380 380 int ret; 381 381 382 + isst_cpu_info[cpu].numa_node = cpu_to_node(cpu); 383 + 382 384 ret = rdmsrl_safe(MSR_CPU_BUS_NUMBER, &data); 383 385 if (ret) { 384 386 /* This is not a fatal error on MSR mailbox only I/F */ ··· 399 397 return ret; 400 398 } 401 399 isst_cpu_info[cpu].punit_cpu_id = data; 402 - isst_cpu_info[cpu].numa_node = cpu_to_node(cpu); 403 400 404 401 isst_restore_msr_local(cpu); 405 402
drivers/platform/x86/intel_speed_select_if/isst_if_common.h drivers/platform/x86/intel/speed_select_if/isst_if_common.h
drivers/platform/x86/intel_speed_select_if/isst_if_mbox_msr.c drivers/platform/x86/intel/speed_select_if/isst_if_mbox_msr.c
drivers/platform/x86/intel_speed_select_if/isst_if_mbox_pci.c drivers/platform/x86/intel/speed_select_if/isst_if_mbox_pci.c
drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
drivers/platform/x86/intel_telemetry_core.c drivers/platform/x86/intel/telemetry/core.c
drivers/platform/x86/intel_telemetry_debugfs.c drivers/platform/x86/intel/telemetry/debugfs.c
drivers/platform/x86/intel_telemetry_pltdrv.c drivers/platform/x86/intel/telemetry/pltdrv.c
drivers/platform/x86/intel_turbo_max_3.c drivers/platform/x86/intel/turbo_max_3.c
+89 -18
drivers/platform/x86/lg-laptop.c
··· 8 8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 9 9 10 10 #include <linux/acpi.h> 11 + #include <linux/dmi.h> 11 12 #include <linux/input.h> 12 13 #include <linux/input/sparse-keymap.h> 13 14 #include <linux/kernel.h> ··· 17 16 #include <linux/platform_device.h> 18 17 #include <linux/types.h> 19 18 20 - #define LED_DEVICE(_name, max) struct led_classdev _name = { \ 19 + #define LED_DEVICE(_name, max, flag) struct led_classdev _name = { \ 21 20 .name = __stringify(_name), \ 22 21 .max_brightness = max, \ 23 22 .brightness_set = _name##_set, \ 24 23 .brightness_get = _name##_get, \ 24 + .flags = flag, \ 25 25 } 26 26 27 27 MODULE_AUTHOR("Matan Ziv-Av"); ··· 71 69 #define INIT_INPUT_ACPI 0x04 72 70 #define INIT_SPARSE_KEYMAP 0x80 73 71 72 + static int battery_limit_use_wmbb; 73 + static struct led_classdev kbd_backlight; 74 + static enum led_brightness get_kbd_backlight_level(void); 75 + 74 76 static const struct key_entry wmi_keymap[] = { 75 77 {KE_KEY, 0x70, {KEY_F15} }, /* LG control panel (F1) */ 76 - {KE_KEY, 0x74, {KEY_F13} }, /* Touchpad toggle (F5) */ 78 + {KE_KEY, 0x74, {KEY_F21} }, /* Touchpad toggle (F5) */ 77 79 {KE_KEY, 0xf020000, {KEY_F14} }, /* Read mode (F9) */ 78 80 {KE_KEY, 0x10000000, {KEY_F16} },/* Keyboard backlight (F8) - pressing 79 81 * this key both sends an event and ··· 220 214 int eventcode = obj->integer.value; 221 215 struct key_entry *key; 222 216 223 - key = 224 - sparse_keymap_entry_from_scancode(wmi_input_dev, eventcode); 225 - if (key && key->type == KE_KEY) 226 - sparse_keymap_report_entry(wmi_input_dev, key, 1, true); 217 + if (eventcode == 0x10000000) { 218 + led_classdev_notify_brightness_hw_changed( 219 + &kbd_backlight, get_kbd_backlight_level()); 220 + } else { 221 + key = sparse_keymap_entry_from_scancode( 222 + wmi_input_dev, eventcode); 223 + if (key && key->type == KE_KEY) 224 + sparse_keymap_report_entry(wmi_input_dev, 225 + key, 1, true); 226 + } 227 227 } 228 228 229 229 pr_debug("Type: %i Eventcode: 0x%llx\n", obj->type, ··· 473 461 if (value == 100 || value == 80) { 474 462 union acpi_object *r; 475 463 476 - r = lg_wmab(WM_BATT_LIMIT, WM_SET, value); 464 + if (battery_limit_use_wmbb) 465 + r = lg_wmbb(WMBB_BATT_LIMIT, WM_SET, value); 466 + else 467 + r = lg_wmab(WM_BATT_LIMIT, WM_SET, value); 477 468 if (!r) 478 469 return -EIO; 479 470 ··· 494 479 unsigned int status; 495 480 union acpi_object *r; 496 481 497 - r = lg_wmab(WM_BATT_LIMIT, WM_GET, 0); 498 - if (!r) 499 - return -EIO; 482 + if (battery_limit_use_wmbb) { 483 + r = lg_wmbb(WMBB_BATT_LIMIT, WM_GET, 0); 484 + if (!r) 485 + return -EIO; 500 486 501 - if (r->type != ACPI_TYPE_INTEGER) { 502 - kfree(r); 503 - return -EIO; 487 + if (r->type != ACPI_TYPE_BUFFER) { 488 + kfree(r); 489 + return -EIO; 490 + } 491 + 492 + status = r->buffer.pointer[0x10]; 493 + } else { 494 + r = lg_wmab(WM_BATT_LIMIT, WM_GET, 0); 495 + if (!r) 496 + return -EIO; 497 + 498 + if (r->type != ACPI_TYPE_INTEGER) { 499 + kfree(r); 500 + return -EIO; 501 + } 502 + 503 + status = r->integer.value; 504 504 } 505 - 506 - status = r->integer.value; 507 505 kfree(r); 508 506 if (status != 80 && status != 100) 509 507 status = 0; ··· 557 529 return ggov(GOV_TLED) > 0 ? LED_ON : LED_OFF; 558 530 } 559 531 560 - static LED_DEVICE(tpad_led, 1); 532 + static LED_DEVICE(tpad_led, 1, 0); 561 533 562 534 static void kbd_backlight_set(struct led_classdev *cdev, 563 535 enum led_brightness brightness) ··· 574 546 kfree(r); 575 547 } 576 548 577 - static enum led_brightness kbd_backlight_get(struct led_classdev *cdev) 549 + static enum led_brightness get_kbd_backlight_level(void) 578 550 { 579 551 union acpi_object *r; 580 552 int val; ··· 605 577 return val; 606 578 } 607 579 608 - static LED_DEVICE(kbd_backlight, 255); 580 + static enum led_brightness kbd_backlight_get(struct led_classdev *cdev) 581 + { 582 + return get_kbd_backlight_level(); 583 + } 584 + 585 + static LED_DEVICE(kbd_backlight, 255, LED_BRIGHT_HW_CHANGED); 609 586 610 587 static void wmi_input_destroy(void) 611 588 { ··· 635 602 static int acpi_add(struct acpi_device *device) 636 603 { 637 604 int ret; 605 + const char *product; 606 + int year = 2017; 638 607 639 608 if (pf_device) 640 609 return 0; ··· 654 619 pr_err("unable to register platform device\n"); 655 620 goto out_platform_registered; 656 621 } 622 + product = dmi_get_system_info(DMI_PRODUCT_NAME); 623 + if (strlen(product) > 4) 624 + switch (product[4]) { 625 + case '5': 626 + case '6': 627 + year = 2016; 628 + break; 629 + case '7': 630 + year = 2017; 631 + break; 632 + case '8': 633 + year = 2018; 634 + break; 635 + case '9': 636 + year = 2019; 637 + break; 638 + case '0': 639 + if (strlen(product) > 5) 640 + switch (product[5]) { 641 + case 'N': 642 + year = 2020; 643 + break; 644 + case 'P': 645 + year = 2021; 646 + break; 647 + default: 648 + year = 2022; 649 + } 650 + break; 651 + default: 652 + year = 2019; 653 + } 654 + pr_info("product: %s year: %d\n", product, year); 655 + 656 + if (year >= 2019) 657 + battery_limit_use_wmbb = 1; 657 658 658 659 ret = sysfs_create_group(&pf_device->dev.kobj, &dev_attribute_group); 659 660 if (ret)
+230
drivers/platform/x86/meraki-mx100.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + 3 + /* 4 + * Cisco Meraki MX100 (Tinkerbell) board platform driver 5 + * 6 + * Based off of arch/x86/platform/meraki/tink.c from the 7 + * Meraki GPL release meraki-firmware-sources-r23-20150601 8 + * 9 + * Format inspired by platform/x86/pcengines-apuv2.c 10 + * 11 + * Copyright (C) 2021 Chris Blake <chrisrblake93@gmail.com> 12 + */ 13 + 14 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 15 + 16 + #include <linux/dmi.h> 17 + #include <linux/err.h> 18 + #include <linux/gpio_keys.h> 19 + #include <linux/gpio/machine.h> 20 + #include <linux/input.h> 21 + #include <linux/io.h> 22 + #include <linux/kernel.h> 23 + #include <linux/leds.h> 24 + #include <linux/module.h> 25 + #include <linux/platform_device.h> 26 + 27 + #define TINK_GPIO_DRIVER_NAME "gpio_ich" 28 + 29 + /* LEDs */ 30 + static const struct gpio_led tink_leds[] = { 31 + { 32 + .name = "mx100:green:internet", 33 + .default_trigger = "default-on", 34 + }, 35 + { 36 + .name = "mx100:green:lan2", 37 + }, 38 + { 39 + .name = "mx100:green:lan3", 40 + }, 41 + { 42 + .name = "mx100:green:lan4", 43 + }, 44 + { 45 + .name = "mx100:green:lan5", 46 + }, 47 + { 48 + .name = "mx100:green:lan6", 49 + }, 50 + { 51 + .name = "mx100:green:lan7", 52 + }, 53 + { 54 + .name = "mx100:green:lan8", 55 + }, 56 + { 57 + .name = "mx100:green:lan9", 58 + }, 59 + { 60 + .name = "mx100:green:lan10", 61 + }, 62 + { 63 + .name = "mx100:green:lan11", 64 + }, 65 + { 66 + .name = "mx100:green:ha", 67 + }, 68 + { 69 + .name = "mx100:orange:ha", 70 + }, 71 + { 72 + .name = "mx100:green:usb", 73 + }, 74 + { 75 + .name = "mx100:orange:usb", 76 + }, 77 + }; 78 + 79 + static const struct gpio_led_platform_data tink_leds_pdata = { 80 + .num_leds = ARRAY_SIZE(tink_leds), 81 + .leds = tink_leds, 82 + }; 83 + 84 + static struct gpiod_lookup_table tink_leds_table = { 85 + .dev_id = "leds-gpio", 86 + .table = { 87 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 11, 88 + NULL, 0, GPIO_ACTIVE_LOW), 89 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 18, 90 + NULL, 1, GPIO_ACTIVE_HIGH), 91 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 20, 92 + NULL, 2, GPIO_ACTIVE_HIGH), 93 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 22, 94 + NULL, 3, GPIO_ACTIVE_HIGH), 95 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 23, 96 + NULL, 4, GPIO_ACTIVE_HIGH), 97 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 32, 98 + NULL, 5, GPIO_ACTIVE_HIGH), 99 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 34, 100 + NULL, 6, GPIO_ACTIVE_HIGH), 101 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 35, 102 + NULL, 7, GPIO_ACTIVE_HIGH), 103 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 36, 104 + NULL, 8, GPIO_ACTIVE_HIGH), 105 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 37, 106 + NULL, 9, GPIO_ACTIVE_HIGH), 107 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 48, 108 + NULL, 10, GPIO_ACTIVE_HIGH), 109 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 16, 110 + NULL, 11, GPIO_ACTIVE_LOW), 111 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 7, 112 + NULL, 12, GPIO_ACTIVE_LOW), 113 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 21, 114 + NULL, 13, GPIO_ACTIVE_LOW), 115 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 19, 116 + NULL, 14, GPIO_ACTIVE_LOW), 117 + {} /* Terminating entry */ 118 + } 119 + }; 120 + 121 + /* Reset Button */ 122 + static struct gpio_keys_button tink_buttons[] = { 123 + { 124 + .desc = "Reset", 125 + .type = EV_KEY, 126 + .code = KEY_RESTART, 127 + .active_low = 1, 128 + .debounce_interval = 100, 129 + }, 130 + }; 131 + 132 + static const struct gpio_keys_platform_data tink_buttons_pdata = { 133 + .buttons = tink_buttons, 134 + .nbuttons = ARRAY_SIZE(tink_buttons), 135 + .poll_interval = 20, 136 + .rep = 0, 137 + .name = "mx100-keys", 138 + }; 139 + 140 + static struct gpiod_lookup_table tink_keys_table = { 141 + .dev_id = "gpio-keys-polled", 142 + .table = { 143 + GPIO_LOOKUP_IDX(TINK_GPIO_DRIVER_NAME, 60, 144 + NULL, 0, GPIO_ACTIVE_LOW), 145 + {} /* Terminating entry */ 146 + } 147 + }; 148 + 149 + /* Board setup */ 150 + static const struct dmi_system_id tink_systems[] __initconst = { 151 + { 152 + .matches = { 153 + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Cisco"), 154 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MX100-HW"), 155 + }, 156 + }, 157 + {} /* Terminating entry */ 158 + }; 159 + MODULE_DEVICE_TABLE(dmi, tink_systems); 160 + 161 + static struct platform_device *tink_leds_pdev; 162 + static struct platform_device *tink_keys_pdev; 163 + 164 + static struct platform_device * __init tink_create_dev( 165 + const char *name, const void *pdata, size_t sz) 166 + { 167 + struct platform_device *pdev; 168 + 169 + pdev = platform_device_register_data(NULL, 170 + name, PLATFORM_DEVID_NONE, pdata, sz); 171 + if (IS_ERR(pdev)) 172 + pr_err("failed registering %s: %ld\n", name, PTR_ERR(pdev)); 173 + 174 + return pdev; 175 + } 176 + 177 + static int __init tink_board_init(void) 178 + { 179 + int ret; 180 + 181 + if (!dmi_first_match(tink_systems)) 182 + return -ENODEV; 183 + 184 + /* 185 + * We need to make sure that GPIO60 isn't set to native mode as is default since it's our 186 + * Reset Button. To do this, write to GPIO_USE_SEL2 to have GPIO60 set to GPIO mode. 187 + * This is documented on page 1609 of the PCH datasheet, order number 327879-005US 188 + */ 189 + outl(inl(0x530) | BIT(28), 0x530); 190 + 191 + gpiod_add_lookup_table(&tink_leds_table); 192 + gpiod_add_lookup_table(&tink_keys_table); 193 + 194 + tink_leds_pdev = tink_create_dev("leds-gpio", 195 + &tink_leds_pdata, sizeof(tink_leds_pdata)); 196 + if (IS_ERR(tink_leds_pdev)) { 197 + ret = PTR_ERR(tink_leds_pdev); 198 + goto err; 199 + } 200 + 201 + tink_keys_pdev = tink_create_dev("gpio-keys-polled", 202 + &tink_buttons_pdata, sizeof(tink_buttons_pdata)); 203 + if (IS_ERR(tink_keys_pdev)) { 204 + ret = PTR_ERR(tink_keys_pdev); 205 + platform_device_unregister(tink_leds_pdev); 206 + goto err; 207 + } 208 + 209 + return 0; 210 + 211 + err: 212 + gpiod_remove_lookup_table(&tink_keys_table); 213 + gpiod_remove_lookup_table(&tink_leds_table); 214 + return ret; 215 + } 216 + module_init(tink_board_init); 217 + 218 + static void __exit tink_board_exit(void) 219 + { 220 + platform_device_unregister(tink_keys_pdev); 221 + platform_device_unregister(tink_leds_pdev); 222 + gpiod_remove_lookup_table(&tink_keys_table); 223 + gpiod_remove_lookup_table(&tink_leds_table); 224 + } 225 + module_exit(tink_board_exit); 226 + 227 + MODULE_AUTHOR("Chris Blake <chrisrblake93@gmail.com>"); 228 + MODULE_DESCRIPTION("Cisco Meraki MX100 Platform Driver"); 229 + MODULE_LICENSE("GPL"); 230 + MODULE_ALIAS("platform:meraki-mx100");
+80
drivers/platform/x86/think-lmi.c
··· 20 20 #include "firmware_attributes_class.h" 21 21 #include "think-lmi.h" 22 22 23 + static bool debug_support; 24 + module_param(debug_support, bool, 0444); 25 + MODULE_PARM_DESC(debug_support, "Enable debug command support"); 26 + 23 27 /* 24 28 * Name: 25 29 * Lenovo_BiosSetting ··· 119 115 * <- "Enabled,Disabled" 120 116 */ 121 117 #define LENOVO_GET_BIOS_SELECTIONS_GUID "7364651A-132F-4FE7-ADAA-40C6C7EE2E3B" 118 + 119 + /* 120 + * Name: 121 + * Lenovo_DebugCmdGUID 122 + * Description 123 + * Debug entry GUID method for entering debug commands to the BIOS 124 + */ 125 + #define LENOVO_DEBUG_CMD_GUID "7FF47003-3B6C-4E5E-A227-E979824A85D1" 122 126 123 127 #define TLMI_POP_PWD (1 << 0) 124 128 #define TLMI_PAP_PWD (1 << 1) ··· 672 660 673 661 static struct kobj_attribute pending_reboot = __ATTR_RO(pending_reboot); 674 662 663 + /* ---- Debug interface--------------------------------------------------------- */ 664 + static ssize_t debug_cmd_store(struct kobject *kobj, struct kobj_attribute *attr, 665 + const char *buf, size_t count) 666 + { 667 + char *set_str = NULL, *new_setting = NULL; 668 + char *auth_str = NULL; 669 + char *p; 670 + int ret; 671 + 672 + if (!tlmi_priv.can_debug_cmd) 673 + return -EOPNOTSUPP; 674 + 675 + new_setting = kstrdup(buf, GFP_KERNEL); 676 + if (!new_setting) 677 + return -ENOMEM; 678 + 679 + /* Strip out CR if one is present */ 680 + p = strchrnul(new_setting, '\n'); 681 + *p = '\0'; 682 + 683 + if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) { 684 + auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;", 685 + tlmi_priv.pwd_admin->password, 686 + encoding_options[tlmi_priv.pwd_admin->encoding], 687 + tlmi_priv.pwd_admin->kbdlang); 688 + if (!auth_str) { 689 + ret = -ENOMEM; 690 + goto out; 691 + } 692 + } 693 + 694 + if (auth_str) 695 + set_str = kasprintf(GFP_KERNEL, "%s,%s", new_setting, auth_str); 696 + else 697 + set_str = kasprintf(GFP_KERNEL, "%s;", new_setting); 698 + if (!set_str) { 699 + ret = -ENOMEM; 700 + goto out; 701 + } 702 + 703 + ret = tlmi_simple_call(LENOVO_DEBUG_CMD_GUID, set_str); 704 + if (ret) 705 + goto out; 706 + 707 + if (!ret && !tlmi_priv.pending_changes) { 708 + tlmi_priv.pending_changes = true; 709 + /* let userland know it may need to check reboot pending again */ 710 + kobject_uevent(&tlmi_priv.class_dev->kobj, KOBJ_CHANGE); 711 + } 712 + out: 713 + kfree(auth_str); 714 + kfree(set_str); 715 + kfree(new_setting); 716 + return ret ?: count; 717 + } 718 + 719 + static struct kobj_attribute debug_cmd = __ATTR_WO(debug_cmd); 720 + 675 721 /* ---- Initialisation --------------------------------------------------------- */ 676 722 static void tlmi_release_attr(void) 677 723 { ··· 743 673 } 744 674 } 745 675 sysfs_remove_file(&tlmi_priv.attribute_kset->kobj, &pending_reboot.attr); 676 + if (tlmi_priv.can_debug_cmd && debug_support) 677 + sysfs_remove_file(&tlmi_priv.attribute_kset->kobj, &debug_cmd.attr); 746 678 kset_unregister(tlmi_priv.attribute_kset); 747 679 748 680 /* Authentication structures */ ··· 809 737 if (ret) 810 738 goto fail_create_attr; 811 739 740 + if (tlmi_priv.can_debug_cmd && debug_support) { 741 + ret = sysfs_create_file(&tlmi_priv.attribute_kset->kobj, &debug_cmd.attr); 742 + if (ret) 743 + goto fail_create_attr; 744 + } 812 745 /* Create authentication entries */ 813 746 tlmi_priv.authentication_kset = kset_create_and_add("authentication", NULL, 814 747 &tlmi_priv.class_dev->kobj); ··· 869 792 870 793 if (wmi_has_guid(LENOVO_BIOS_PASSWORD_SETTINGS_GUID)) 871 794 tlmi_priv.can_get_password_settings = true; 795 + 796 + if (wmi_has_guid(LENOVO_DEBUG_CMD_GUID)) 797 + tlmi_priv.can_debug_cmd = true; 872 798 873 799 /* 874 800 * Try to find the number of valid settings of this machine
+1
drivers/platform/x86/think-lmi.h
··· 61 61 bool can_set_bios_password; 62 62 bool can_get_password_settings; 63 63 bool pending_changes; 64 + bool can_debug_cmd; 64 65 65 66 struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT]; 66 67 struct device *class_dev;
+9
drivers/thermal/intel/Kconfig
··· 90 90 Note that, on different platforms, the behavior might be different 91 91 on how fast the setting takes effect, and how much the CPU frequency 92 92 is reduced. 93 + 94 + config INTEL_MENLOW 95 + tristate "Thermal Management driver for Intel menlow platform" 96 + depends on ACPI_THERMAL 97 + help 98 + ACPI thermal management enhancement driver on 99 + Intel Menlow platform. 100 + 101 + If unsure, say N.
+1
drivers/thermal/intel/Makefile
··· 12 12 obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o 13 13 obj-$(CONFIG_INTEL_TCC_COOLING) += intel_tcc_cooling.o 14 14 obj-$(CONFIG_X86_THERMAL_VECTOR) += therm_throt.o 15 + obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o
+5
include/linux/i2c.h
··· 1010 1010 #if IS_ENABLED(CONFIG_ACPI) 1011 1011 bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares, 1012 1012 struct acpi_resource_i2c_serialbus **i2c); 1013 + int i2c_acpi_client_count(struct acpi_device *adev); 1013 1014 u32 i2c_acpi_find_bus_speed(struct device *dev); 1014 1015 struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, 1015 1016 struct i2c_board_info *info); ··· 1020 1019 struct acpi_resource_i2c_serialbus **i2c) 1021 1020 { 1022 1021 return false; 1022 + } 1023 + static inline int i2c_acpi_client_count(struct acpi_device *adev) 1024 + { 1025 + return 0; 1023 1026 } 1024 1027 static inline u32 i2c_acpi_find_bus_speed(struct device *dev) 1025 1028 {
+7
include/linux/platform_data/x86/asus-wmi.h
··· 61 61 #define ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY 0x00120075 62 62 63 63 /* Misc */ 64 + #define ASUS_WMI_DEVID_PANEL_OD 0x00050019 64 65 #define ASUS_WMI_DEVID_CAMERA 0x00060013 65 66 #define ASUS_WMI_DEVID_LID_FLIP 0x00060062 66 67 ··· 89 88 90 89 /* Keyboard dock */ 91 90 #define ASUS_WMI_DEVID_KBD_DOCK 0x00120063 91 + 92 + /* dgpu on/off */ 93 + #define ASUS_WMI_DEVID_EGPU 0x00090019 94 + 95 + /* dgpu on/off */ 96 + #define ASUS_WMI_DEVID_DGPU 0x00090020 92 97 93 98 /* DSTS masks */ 94 99 #define ASUS_WMI_DSTS_STATUS_BIT 0x00000001