Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp88816ima; Thu, 31 Jan 2019 23:35:27 -0800 (PST) X-Received: by 2002:a17:902:ab84:: with SMTP id f4mr37489879plr.207.1549006497672; Thu, 31 Jan 2019 23:34:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN4626CqYaSGE36K4MX4gP6beSP0Cw1gjKo3UXObz217dANY4Q8T/Qz8cx2xvsBHR3Nk5SUv X-Received: by 2002:a17:902:ab84:: with SMTP id f4mr37489821plr.207.1549006496911; Thu, 31 Jan 2019 23:34:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549006496; cv=none; d=google.com; s=arc-20160816; b=Gw1up4r5SHME6wuJhn5EMGSdR1aA86oX0v3Em1TjLX2vcu/gZ0aW6iiH+DIVfZq1ra tMPhOWpOCJmTrMgsuzxwvmRQSxz+bFvYSzvNQf5SLAAykGX5yfMAm4OjUHwj54Bvm7Vn 3viRI/Z5GEUx9/LTMmAcCd301fGGEcjB4tFfDboKWq5JNoAqVc9roCvFLNy3iwWB7Ks8 ThpTMO9aeucPmZ5sJuTwFDzmrfVNySSFfO/bNkkMsTVklJLzaFQFKhX5Spj5NcmCLB5q aoOzq8FtXoaiv4Ip1oVQuBWtn6vkEciCQ3BQd5qMEesbnBAmemZIvHhArwVxZbRtU9nC OBSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=CUC7mDPTw6iQwU5woIL34sqQU/KXL/OVzQIIu8YG29M=; b=PX3oIdMMxyIv0BNlUYcUg8MfpwICDbNAZgxdA/BlGu+3bC9Ned6ErnsuUx7d2VdoNl QzYh8D6bl/ULF0k/8VbkG4YqW8ScnHnWkQ8k4zWKM9FiYMA3aD+tFiYBLWDWvz9x7Pvs jXG1K3Yb8xtWMVk2eZ1NlUTHalTeWOVpUtOQYfTIwrrOBy9oA4nliK1h/KFQX+b30Ov6 4nBSoTSlKKs79Zw6+h3U7MxH7UZIjsvZRXAkvB8qk0nu9M6IaAWBb3BPV21tYSeW/V+u 6zDjMF2edKKgzyw3s2MOCqle6BhkaqGdDsY2oKTIgnNz4SGx0Vg7zqTMEDl/1wKC8fJ6 qExw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12si6618938pga.506.2019.01.31.23.34.42; Thu, 31 Jan 2019 23:34:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728388AbfBAHdG (ORCPT + 99 others); Fri, 1 Feb 2019 02:33:06 -0500 Received: from mga12.intel.com ([192.55.52.136]:57767 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728307AbfBAHc6 (ORCPT ); Fri, 1 Feb 2019 02:32:58 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2019 23:32:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,547,1539673200"; d="scan'208";a="114430753" Received: from rajneesh-desk.iind.intel.com ([10.223.86.34]) by orsmga008.jf.intel.com with ESMTP; 31 Jan 2019 23:32:56 -0800 From: Rajneesh Bhardwaj To: platform-driver-x86@vger.kernel.org Cc: dvhart@infradead.org, andy@infradead.org, linux-kernel@vger.kernel.org, Rajneesh Bhardwaj Subject: [PATCH 10/10] platform/x86: intel_pmc_core: Quirk to ignore XTAL shutdown Date: Fri, 1 Feb 2019 13:02:34 +0530 Message-Id: <20190201073234.13280-11-rajneesh.bhardwaj@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190201073234.13280-1-rajneesh.bhardwaj@linux.intel.com> References: <20190201073234.13280-1-rajneesh.bhardwaj@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On some platforms such as HP Elite-x2-1013-g3, the platform BIOS enforces XTAL to remain off before S0ix state can be achieved. This may not be optimum when we want to enable use cases like Low Power Audio, Wake on Voice etc which always need 24mhz clock. This introduces a new quirk to allow S0ix entry when all other conditions except for XTAL clock are good on a given platform. The extra power consumed by XTAL clock is about 2mw but it saves much more platform power compared to the system that remains in just PC10. Link: https://bit.ly/2UmnrFf Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201579 Tested-by: "David E. Box" Signed-off-by: Rajneesh Bhardwaj --- drivers/platform/x86/intel_pmc_core.c | 34 +++++++++++++++++++++++++++ drivers/platform/x86/intel_pmc_core.h | 5 ++++ 2 files changed, 39 insertions(+) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index 4e7aa1711148..a27574e3e868 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -151,6 +152,7 @@ static const struct pmc_reg_map spt_reg_map = { .pm_cfg_offset = SPT_PMC_PM_CFG_OFFSET, .pm_read_disable_bit = SPT_PMC_READ_DISABLE_BIT, .ltr_ignore_max = SPT_NUM_IP_IGN_ALLOWED, + .pm_vric1_offset = SPT_PMC_VRIC1_OFFSET, }; /* Cannonlake: PGD PFET Enable Ack Status Register(s) bitmap */ @@ -821,6 +823,37 @@ static const struct pci_device_id pmc_pci_ids[] = { { 0, }, }; +/* + * This quirk can be used on those platforms where + * the platform BIOS enforces 24Mhx Crystal to shutdown + * before PMC can assert SLP_S0#. + */ +int quirk_xtal_ignore(const struct dmi_system_id *id) +{ + struct pmc_dev *pmcdev = &pmc; + u32 value; + + value = pmc_core_reg_read(pmcdev, pmcdev->map->pm_vric1_offset); + /* 24MHz Crystal Shutdown Qualification Disable */ + value |= SPT_PMC_VRIC1_XTALSDQDIS; + /* Low Voltage Mode Enable */ + value &= ~SPT_PMC_VRIC1_SLPS0LVEN; + pmc_core_reg_write(pmcdev, pmcdev->map->pm_vric1_offset, value); + return 0; +} + +static const struct dmi_system_id pmc_core_dmi_table[] = { + { + .callback = quirk_xtal_ignore, + .ident = "HP Elite x2 1013 G3", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Elite x2 1013 G3"), + }, + }, + {} +}; + static int __init pmc_core_probe(void) { struct pmc_dev *pmcdev = &pmc; @@ -862,6 +895,7 @@ static int __init pmc_core_probe(void) return err; } + dmi_check_system(pmc_core_dmi_table); pr_info(" initialized\n"); return 0; } diff --git a/drivers/platform/x86/intel_pmc_core.h b/drivers/platform/x86/intel_pmc_core.h index 6f1b64808075..88d9c0653a5f 100644 --- a/drivers/platform/x86/intel_pmc_core.h +++ b/drivers/platform/x86/intel_pmc_core.h @@ -25,6 +25,7 @@ #define SPT_PMC_MTPMC_OFFSET 0x20 #define SPT_PMC_MFPMC_OFFSET 0x38 #define SPT_PMC_LTR_IGNORE_OFFSET 0x30C +#define SPT_PMC_VRIC1_OFFSET 0x31c #define SPT_PMC_MPHY_CORE_STS_0 0x1143 #define SPT_PMC_MPHY_CORE_STS_1 0x1142 #define SPT_PMC_MPHY_COM_STS_0 0x1155 @@ -136,6 +137,9 @@ enum ppfear_regs { #define SPT_PMC_BIT_MPHY_CMN_LANE2 BIT(2) #define SPT_PMC_BIT_MPHY_CMN_LANE3 BIT(3) +#define SPT_PMC_VRIC1_SLPS0LVEN BIT(13) +#define SPT_PMC_VRIC1_XTALSDQDIS BIT(22) + /* Cannonlake Power Management Controller register offsets */ #define CNP_PMC_SLPS0_DBG_OFFSET 0x10B4 #define CNP_PMC_PM_CFG_OFFSET 0x1818 @@ -224,6 +228,7 @@ struct pmc_reg_map { const int pm_read_disable_bit; const u32 slps0_dbg_offset; const u32 ltr_ignore_max; + const u32 pm_vric1_offset; }; /** -- 2.17.1