Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp888131yba; Thu, 18 Apr 2019 11:14:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+9iEA43GeI1nZEsBR52EEWmzeeyNeU4CFGuBqEk9K0JyInjBv9kSZKhDabOCrf+/E/Zot X-Received: by 2002:a17:902:29c9:: with SMTP id h67mr1189692plb.114.1555611267330; Thu, 18 Apr 2019 11:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611267; cv=none; d=google.com; s=arc-20160816; b=bzIj92PBIxuoT0A/B4+zISyMq7SPEk2jtXf/m5hLgpWVfNWZK1OfS7omdGHh2R+qW3 /UWoY4nnjrlYwCPIwCgxSNYRkYJPJp4+S6w8t3RjweRRUZm/28IkpTgqEHGcasMtph9f 4/2b2P0l4KkVS9rWdrP1Xua9RI8MUn4hzI1SSNyLPiNWuE18QLHDyO2QfQTTd0leSSP1 D2IPg1foFFFqhO3NbGBww3ADN/33fQWSlyeDv8hSWCJFli9mE7hguBwgeRsGsnOfXOuj iDZP2pBjfKgl/2f8zlXtqYbhlKYz3Ohj1Vw3MxGQeRdtVf6dDp/cP4vlIgTy4wnuudVb cA4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K2QSyPoop01C0ifBAdi9Bzw27mPIXPQ1doRPmfrQidw=; b=aF1dTQAR0bGy+CgtsTiFEE65vWUvAmGhDmESKNTVSf+sj55bbsYQYU4/Py9KoSkOUv DIhJgv6mIgmR7S850cGEp3b8eUnm9ixo9Uq1UxfWpnZlNqs0eLJAf0jFYE15Dpyep5GC htx4jAnNK0yQ5teFRaE5F3lhUlaOjf3T3aXvtlvBpZGWXen3wjdk1Gj0hTr8KI9XNqG9 ETkJgzYDqgIiqlJjGFAgEJVj3KxJ3VPHXVe0Dm3maPJWGarMt5NmpuJKrrrvyTd52vQq OJ7PR1DGhiku6KHqtStJawr/2MqNGxcXAW7hFpiDvN2kWwn0WaU2W1MBURtBfrTFHm+Z /emg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SQae3m99; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si3048073pfa.268.2019.04.18.11.14.12; Thu, 18 Apr 2019 11:14:27 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=SQae3m99; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404325AbfDRSMj (ORCPT + 99 others); Thu, 18 Apr 2019 14:12:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:45188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404300AbfDRSMi (ORCPT ); Thu, 18 Apr 2019 14:12:38 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CDE620652; Thu, 18 Apr 2019 18:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611157; bh=eZ7balOe1P4dCh2PtPSrsGbrsHZB00FQdELE53Dv6Js=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQae3m99fKu+ztQFke0qn1tJ7iPNoTPtkDScLTMm0dyquwyNy32VawSYO4Cz5RzGC PshcXR+HmZGM4Wl1Y+U4dn8GC8YCzt71nNpo5wOkvlGPztN34aw6M6Wg4Dl7/PszA1 0ltOoVw48cq9mDVYKrhoh4hH8776mDKjy3VYiCvQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David E. Box" , Rajneesh Bhardwaj , Andy Shevchenko , "Darren Hart (VMware)" , Sasha Levin , russianneuromancer Subject: [PATCH 5.0 81/93] platform/x86: intel_pmc_core: Quirk to ignore XTAL shutdown Date: Thu, 18 Apr 2019 19:57:59 +0200 Message-Id: <20190418160445.178163032@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 238f9c11351f8af8534ae0318b4d9acc77b09ee8 ] 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" Reported-and-tested-by: russianneuromancer Signed-off-by: Rajneesh Bhardwaj Signed-off-by: Andy Shevchenko Signed-off-by: Darren Hart (VMware) Signed-off-by: Sasha Levin --- 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 c37e74ee609d..a9cbe5be277b 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 @@ -139,6 +140,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 */ @@ -751,6 +753,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; @@ -792,6 +825,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 1a0104d2cbf0..9bc16d7d2917 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 @@ -135,6 +136,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 @@ -217,6 +221,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.19.1