Highlights: - alienware-wmi: WMAX thermal interface support - amd/hsmp: Split ACPI and platform device based drivers - amd/x3d_vcache: X3D frequency/cache mode switching support - asus-wmi: Thermal policy fixes - intel/pmt: Disable C1 auto-demotion in suspend to allow entering the deepest C-states - intel-hid: Fix volume buttons on Thinkpad X12 Detachable Tablet Gen 1 - intel_scu_ipc: Replace "workaround" with 32-bit IO - panasonic-laptop: Correct *_show() function error handling - p2sb: Gemini Lake P2SB devfn correction - think-lmi: Admin/System certificate authentication support - wmi: Disable WMI devices for shutdown, refactoring continues - x86-android-tablets: Vexia EDU ATLA 10 tablet support - platform/surface: Surface Pro 9 5G (Arm/QCOM) support - Miscellaneous cleanups / refactoring / improvements Expected conflicts: - hsmp driver split into two vs constifying bin_attribute [1] [1] https://lore.kernel.org/all/20241107212645.41252436@canb.auug.org.au/ The following is an automated shortlog grouped by driver: alienware-wmi: - added force module parameters - added platform profile support - Adds support to Alienware x17 R2 - alienware_wmax_command() is now input size agnostic - create_thermal_profile() no longer brute-forces IDs - extends the list of supported models - fixed indentation and clean up - Fix spelling mistake "requieres" -> "requires" - order alienware_quirks[] alphabetically - WMAX interface documentation amd: amd_3d_vcache: - Add AMD 3D V-Cache optimizer driver - Add sysfs ABI documentation amd/hsmp: - Add new error code and error logs - Change generic plat_dev name to hsmp_pdev - Change the error type - Convert amd_hsmp_rdwr() to a function pointer - Create hsmp/ directory - Create separate ACPI, plat and common drivers - Create wrapper function init_acpi() - Make hsmp_pdev static instead of global - mark hsmp_msg_desc_table[] as maybe_unused - Move ACPI code to acpi.c - Move platform device specific code to plat.c - Move structure and macros to header file - Use dev_groups in the driver structure - Use name space while exporting module symbols amd/pmf: - Switch to platform_get_resource() and devm_ioremap_resource() - Use dev_err_probe() to simplify error handling asus-laptop: - prefer strscpy() over strcpy() asus-wmi: - Fix inconsistent use of thermal policies - Use platform_profile_cycle() classmate-laptop: - Replace snprintf in show functions with sysfs_emit compal-laptop: - use sysfs_emit() instead of sprintf() dell-dcdbase: - Replace snprintf in show functions with sysfs_emit Documentation: alienware-wmi: - Describe THERMAL_INFORMATION operation 0x02 eeepc-laptop: - use sysfs_emit() instead of sprintf() hp: hp-bioscfg: - remove redundant if statement intel: - Add 'intel' prefix to the modules automatically intel-hid: - fix volume buttons on Thinkpad X12 Detachable Tablet Gen 1 intel/pmc: - Disable C1 auto-demotion during suspend - Refactor platform resume functions to use cnl_resume() intel/pmt: - allow user offset for PMT callbacks - Correct the typo 'ACCCESS_LOCAL' intel_scu_ipc: - Convert to check for errors first - Don't use "proxy" headers - Replace workaround by 32-bit IO - Save a copy of the entire struct intel_scu_ipc_data - Simplify code with cleanup helpers - Unify the flow in pwr_reg_rdwr() intel/vsec: - Remove a useless mutex MAINTAINERS: - adjust file entry in INTEL TPMI DRIVER - Change AMD PMF driver status to "Supported" - Update ISHTP ECLITE maintainer entry p2sb: - Cache correct PCI bar for P2SB on Gemini Lake panasonic-laptop: - Return errno correctly in show callback surface: aggregator_registry: - Add Surface Pro 9 5G Switch back to struct platform_driver:: - remove() think-lmi: - Add certificate as mechanism - Allow empty admin password - improve check if BIOS account security enabled - Multi-certificate support wmi: - Implement proper shutdown handling - Introduce to_wmi_driver() - Remove wmi_block_list - Replace dev_to_wdev() with to_wmi_device() x86: acer-wmi: - remove unused macros x86-android-tablets: - Add get_i2c_adap_by_handle() helper - Add support for getting i2c_adapter by PCI parent devname() - Add support for Vexia EDU ATLA 10 tablet -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSCSUwRdwTNL2MhaBlZrE9hU+XOMQUCZz3IswAKCRBZrE9hU+XO McdKAQCY9gIuqtHpYK0QIQYMoZOWhpiCzfZ96DDHqt4Wknh6NgD/YY6eESyDokyB 4BkujKwqo3cdGNPjIBy41jnNjekNsw8= =QEd2 -----END PGP SIGNATURE----- Merge tag 'platform-drivers-x86-v6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 Pull x86 platform driver updates from Ilpo Järvinen: - alienware WMAX thermal interface support - Split ACPI and platform device based amd/hsmp drivers - AMD X3D frequency/cache mode switching support - asus thermal policy fixes - Disable C1 auto-demotion in suspend to allow entering the deepest C-states - Fix volume buttons on Thinkpad X12 Detachable Tablet Gen 1 - Replace intel_scu_ipc "workaround" with 32-bit IO - Correct *_show() function error handling in panasonic-laptop - Gemini Lake P2SB devfn correction - think-lmi Admin/System certificate authentication support - Disable WMI devices for shutdown, refactoring continues - Vexia EDU ATLA 10 tablet support - Surface Pro 9 5G (Arm/QCOM) support - Misc cleanups / refactoring / improvements * tag 'platform-drivers-x86-v6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (69 commits) platform/x86: p2sb: Cache correct PCI bar for P2SB on Gemini Lake platform/x86: panasonic-laptop: Return errno correctly in show callback Documentation: alienware-wmi: Describe THERMAL_INFORMATION operation 0x02 alienware-wmi: create_thermal_profile() no longer brute-forces IDs alienware-wmi: Adds support to Alienware x17 R2 alienware-wmi: extends the list of supported models alienware-wmi: order alienware_quirks[] alphabetically platform/x86/intel/pmt: allow user offset for PMT callbacks platform/x86/amd/hsmp: Change the error type platform/x86/amd/hsmp: Add new error code and error logs platform/x86/amd: amd_3d_vcache: Add sysfs ABI documentation platform/x86/amd: amd_3d_vcache: Add AMD 3D V-Cache optimizer driver intel-hid: fix volume buttons on Thinkpad X12 Detachable Tablet Gen 1 platform/x86/amd/hsmp: mark hsmp_msg_desc_table[] as maybe_unused platform/x86: asus-wmi: Use platform_profile_cycle() platform/x86: asus-wmi: Fix inconsistent use of thermal policies platform/x86: hp: hp-bioscfg: remove redundant if statement MAINTAINERS: Update ISHTP ECLITE maintainer entry platform/x86: x86-android-tablets: Add support for Vexia EDU ATLA 10 tablet platform/x86: x86-android-tablets: Add support for getting i2c_adapter by PCI parent devname() ...
293 lines
7.7 KiB
C
293 lines
7.7 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* This file contains platform specific structure definitions
|
|
* and init function used by Cannon Lake Point PCH.
|
|
*
|
|
* Copyright (c) 2022, Intel Corporation.
|
|
* All Rights Reserved.
|
|
*
|
|
*/
|
|
|
|
#include <linux/smp.h>
|
|
#include <linux/suspend.h>
|
|
#include "core.h"
|
|
|
|
/* Cannon Lake: PGD PFET Enable Ack Status Register(s) bitmap */
|
|
const struct pmc_bit_map cnp_pfear_map[] = {
|
|
{"PMC", BIT(0)},
|
|
{"OPI-DMI", BIT(1)},
|
|
{"SPI/eSPI", BIT(2)},
|
|
{"XHCI", BIT(3)},
|
|
{"SPA", BIT(4)},
|
|
{"SPB", BIT(5)},
|
|
{"SPC", BIT(6)},
|
|
{"GBE", BIT(7)},
|
|
|
|
{"SATA", BIT(0)},
|
|
{"HDA_PGD0", BIT(1)},
|
|
{"HDA_PGD1", BIT(2)},
|
|
{"HDA_PGD2", BIT(3)},
|
|
{"HDA_PGD3", BIT(4)},
|
|
{"SPD", BIT(5)},
|
|
{"LPSS", BIT(6)},
|
|
{"LPC", BIT(7)},
|
|
|
|
{"SMB", BIT(0)},
|
|
{"ISH", BIT(1)},
|
|
{"P2SB", BIT(2)},
|
|
{"NPK_VNN", BIT(3)},
|
|
{"SDX", BIT(4)},
|
|
{"SPE", BIT(5)},
|
|
{"Fuse", BIT(6)},
|
|
{"SBR8", BIT(7)},
|
|
|
|
{"CSME_FSC", BIT(0)},
|
|
{"USB3_OTG", BIT(1)},
|
|
{"EXI", BIT(2)},
|
|
{"CSE", BIT(3)},
|
|
{"CSME_KVM", BIT(4)},
|
|
{"CSME_PMT", BIT(5)},
|
|
{"CSME_CLINK", BIT(6)},
|
|
{"CSME_PTIO", BIT(7)},
|
|
|
|
{"CSME_USBR", BIT(0)},
|
|
{"CSME_SUSRAM", BIT(1)},
|
|
{"CSME_SMT1", BIT(2)},
|
|
{"CSME_SMT4", BIT(3)},
|
|
{"CSME_SMS2", BIT(4)},
|
|
{"CSME_SMS1", BIT(5)},
|
|
{"CSME_RTC", BIT(6)},
|
|
{"CSME_PSF", BIT(7)},
|
|
|
|
{"SBR0", BIT(0)},
|
|
{"SBR1", BIT(1)},
|
|
{"SBR2", BIT(2)},
|
|
{"SBR3", BIT(3)},
|
|
{"SBR4", BIT(4)},
|
|
{"SBR5", BIT(5)},
|
|
{"CSME_PECI", BIT(6)},
|
|
{"PSF1", BIT(7)},
|
|
|
|
{"PSF2", BIT(0)},
|
|
{"PSF3", BIT(1)},
|
|
{"PSF4", BIT(2)},
|
|
{"CNVI", BIT(3)},
|
|
{"UFS0", BIT(4)},
|
|
{"EMMC", BIT(5)},
|
|
{"SPF", BIT(6)},
|
|
{"SBR6", BIT(7)},
|
|
|
|
{"SBR7", BIT(0)},
|
|
{"NPK_AON", BIT(1)},
|
|
{"HDA_PGD4", BIT(2)},
|
|
{"HDA_PGD5", BIT(3)},
|
|
{"HDA_PGD6", BIT(4)},
|
|
{"PSF6", BIT(5)},
|
|
{"PSF7", BIT(6)},
|
|
{"PSF8", BIT(7)},
|
|
{}
|
|
};
|
|
|
|
const struct pmc_bit_map *ext_cnp_pfear_map[] = {
|
|
/*
|
|
* Check intel_pmc_core_ids[] users of cnp_reg_map for
|
|
* a list of core SoCs using this.
|
|
*/
|
|
cnp_pfear_map,
|
|
NULL
|
|
};
|
|
|
|
const struct pmc_bit_map cnp_slps0_dbg0_map[] = {
|
|
{"AUDIO_D3", BIT(0)},
|
|
{"OTG_D3", BIT(1)},
|
|
{"XHCI_D3", BIT(2)},
|
|
{"LPIO_D3", BIT(3)},
|
|
{"SDX_D3", BIT(4)},
|
|
{"SATA_D3", BIT(5)},
|
|
{"UFS0_D3", BIT(6)},
|
|
{"UFS1_D3", BIT(7)},
|
|
{"EMMC_D3", BIT(8)},
|
|
{}
|
|
};
|
|
|
|
const struct pmc_bit_map cnp_slps0_dbg1_map[] = {
|
|
{"SDIO_PLL_OFF", BIT(0)},
|
|
{"USB2_PLL_OFF", BIT(1)},
|
|
{"AUDIO_PLL_OFF", BIT(2)},
|
|
{"OC_PLL_OFF", BIT(3)},
|
|
{"MAIN_PLL_OFF", BIT(4)},
|
|
{"XOSC_OFF", BIT(5)},
|
|
{"LPC_CLKS_GATED", BIT(6)},
|
|
{"PCIE_CLKREQS_IDLE", BIT(7)},
|
|
{"AUDIO_ROSC_OFF", BIT(8)},
|
|
{"HPET_XOSC_CLK_REQ", BIT(9)},
|
|
{"PMC_ROSC_SLOW_CLK", BIT(10)},
|
|
{"AON2_ROSC_GATED", BIT(11)},
|
|
{"CLKACKS_DEASSERTED", BIT(12)},
|
|
{}
|
|
};
|
|
|
|
const struct pmc_bit_map cnp_slps0_dbg2_map[] = {
|
|
{"MPHY_CORE_GATED", BIT(0)},
|
|
{"CSME_GATED", BIT(1)},
|
|
{"USB2_SUS_GATED", BIT(2)},
|
|
{"DYN_FLEX_IO_IDLE", BIT(3)},
|
|
{"GBE_NO_LINK", BIT(4)},
|
|
{"THERM_SEN_DISABLED", BIT(5)},
|
|
{"PCIE_LOW_POWER", BIT(6)},
|
|
{"ISH_VNNAON_REQ_ACT", BIT(7)},
|
|
{"ISH_VNN_REQ_ACT", BIT(8)},
|
|
{"CNV_VNNAON_REQ_ACT", BIT(9)},
|
|
{"CNV_VNN_REQ_ACT", BIT(10)},
|
|
{"NPK_VNNON_REQ_ACT", BIT(11)},
|
|
{"PMSYNC_STATE_IDLE", BIT(12)},
|
|
{"ALST_GT_THRES", BIT(13)},
|
|
{"PMC_ARC_PG_READY", BIT(14)},
|
|
{}
|
|
};
|
|
|
|
const struct pmc_bit_map *cnp_slps0_dbg_maps[] = {
|
|
cnp_slps0_dbg0_map,
|
|
cnp_slps0_dbg1_map,
|
|
cnp_slps0_dbg2_map,
|
|
NULL
|
|
};
|
|
|
|
const struct pmc_bit_map cnp_ltr_show_map[] = {
|
|
{"SOUTHPORT_A", CNP_PMC_LTR_SPA},
|
|
{"SOUTHPORT_B", CNP_PMC_LTR_SPB},
|
|
{"SATA", CNP_PMC_LTR_SATA},
|
|
{"GIGABIT_ETHERNET", CNP_PMC_LTR_GBE},
|
|
{"XHCI", CNP_PMC_LTR_XHCI},
|
|
{"Reserved", CNP_PMC_LTR_RESERVED},
|
|
{"ME", CNP_PMC_LTR_ME},
|
|
/* EVA is Enterprise Value Add, doesn't really exist on PCH */
|
|
{"EVA", CNP_PMC_LTR_EVA},
|
|
{"SOUTHPORT_C", CNP_PMC_LTR_SPC},
|
|
{"HD_AUDIO", CNP_PMC_LTR_AZ},
|
|
{"CNV", CNP_PMC_LTR_CNV},
|
|
{"LPSS", CNP_PMC_LTR_LPSS},
|
|
{"SOUTHPORT_D", CNP_PMC_LTR_SPD},
|
|
{"SOUTHPORT_E", CNP_PMC_LTR_SPE},
|
|
{"CAMERA", CNP_PMC_LTR_CAM},
|
|
{"ESPI", CNP_PMC_LTR_ESPI},
|
|
{"SCC", CNP_PMC_LTR_SCC},
|
|
{"ISH", CNP_PMC_LTR_ISH},
|
|
{"UFSX2", CNP_PMC_LTR_UFSX2},
|
|
{"EMMC", CNP_PMC_LTR_EMMC},
|
|
/*
|
|
* Check intel_pmc_core_ids[] users of cnp_reg_map for
|
|
* a list of core SoCs using this.
|
|
*/
|
|
{"WIGIG", ICL_PMC_LTR_WIGIG},
|
|
{"THC0", TGL_PMC_LTR_THC0},
|
|
{"THC1", TGL_PMC_LTR_THC1},
|
|
/* Below two cannot be used for LTR_IGNORE */
|
|
{"CURRENT_PLATFORM", CNP_PMC_LTR_CUR_PLT},
|
|
{"AGGREGATED_SYSTEM", CNP_PMC_LTR_CUR_ASLT},
|
|
{}
|
|
};
|
|
|
|
const struct pmc_reg_map cnp_reg_map = {
|
|
.pfear_sts = ext_cnp_pfear_map,
|
|
.slp_s0_offset = CNP_PMC_SLP_S0_RES_COUNTER_OFFSET,
|
|
.slp_s0_res_counter_step = SPT_PMC_SLP_S0_RES_COUNTER_STEP,
|
|
.slps0_dbg_maps = cnp_slps0_dbg_maps,
|
|
.ltr_show_sts = cnp_ltr_show_map,
|
|
.msr_sts = msr_map,
|
|
.slps0_dbg_offset = CNP_PMC_SLPS0_DBG_OFFSET,
|
|
.ltr_ignore_offset = CNP_PMC_LTR_IGNORE_OFFSET,
|
|
.regmap_length = CNP_PMC_MMIO_REG_LEN,
|
|
.ppfear0_offset = CNP_PMC_HOST_PPFEAR0A,
|
|
.ppfear_buckets = CNP_PPFEAR_NUM_ENTRIES,
|
|
.pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
|
|
.pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
|
|
.ltr_ignore_max = CNP_NUM_IP_IGN_ALLOWED,
|
|
.etr3_offset = ETR3_OFFSET,
|
|
};
|
|
|
|
|
|
/*
|
|
* Disable C1 auto-demotion
|
|
*
|
|
* Aggressive C1 auto-demotion may lead to failure to enter the deepest C-state
|
|
* during suspend-to-idle, causing high power consumption. To prevent this, we
|
|
* disable C1 auto-demotion during suspend and re-enable on resume.
|
|
*
|
|
* Note that, although MSR_PKG_CST_CONFIG_CONTROL has 'package' in its name, it
|
|
* is actually a per-core MSR on client platforms, affecting only a single CPU.
|
|
* Therefore, it must be configured on all online CPUs. The online cpu mask is
|
|
* unchanged during the phase of suspend/resume as user space is frozen.
|
|
*/
|
|
|
|
static DEFINE_PER_CPU(u64, pkg_cst_config);
|
|
|
|
static void disable_c1_auto_demote(void *unused)
|
|
{
|
|
int cpunum = smp_processor_id();
|
|
u64 val;
|
|
|
|
rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, val);
|
|
per_cpu(pkg_cst_config, cpunum) = val;
|
|
val &= ~NHM_C1_AUTO_DEMOTE;
|
|
wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, val);
|
|
|
|
pr_debug("%s: cpu:%d cst %llx\n", __func__, cpunum, val);
|
|
}
|
|
|
|
static void restore_c1_auto_demote(void *unused)
|
|
{
|
|
int cpunum = smp_processor_id();
|
|
|
|
wrmsrl(MSR_PKG_CST_CONFIG_CONTROL, per_cpu(pkg_cst_config, cpunum));
|
|
|
|
pr_debug("%s: cpu:%d cst %llx\n", __func__, cpunum,
|
|
per_cpu(pkg_cst_config, cpunum));
|
|
}
|
|
|
|
static void s2idle_cpu_quirk(smp_call_func_t func)
|
|
{
|
|
if (pm_suspend_via_firmware())
|
|
return;
|
|
|
|
on_each_cpu(func, NULL, true);
|
|
}
|
|
|
|
void cnl_suspend(struct pmc_dev *pmcdev)
|
|
{
|
|
s2idle_cpu_quirk(disable_c1_auto_demote);
|
|
|
|
/*
|
|
* Due to a hardware limitation, the GBE LTR blocks PC10
|
|
* when a cable is attached. To unblock PC10 during suspend,
|
|
* tell the PMC to ignore it.
|
|
*/
|
|
pmc_core_send_ltr_ignore(pmcdev, 3, 1);
|
|
}
|
|
|
|
int cnl_resume(struct pmc_dev *pmcdev)
|
|
{
|
|
s2idle_cpu_quirk(restore_c1_auto_demote);
|
|
|
|
pmc_core_send_ltr_ignore(pmcdev, 3, 0);
|
|
|
|
return pmc_core_resume_common(pmcdev);
|
|
}
|
|
|
|
int cnp_core_init(struct pmc_dev *pmcdev)
|
|
{
|
|
struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
|
|
int ret;
|
|
|
|
pmcdev->suspend = cnl_suspend;
|
|
pmcdev->resume = cnl_resume;
|
|
|
|
pmc->map = &cnp_reg_map;
|
|
ret = get_primary_reg_base(pmc);
|
|
if (ret)
|
|
return ret;
|
|
|
|
pmc_core_get_low_power_modes(pmcdev);
|
|
|
|
return 0;
|
|
}
|