Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp162497pxf; Wed, 31 Mar 2021 20:17:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw79oWkNN/aJYMA5ZdCv4BIL0Kn5trXBiio+tI8hZO8+Q3W5Tyjt5KqKMQ8MqoimGKEYWXk X-Received: by 2002:a17:906:7257:: with SMTP id n23mr7008770ejk.412.1617247033156; Wed, 31 Mar 2021 20:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617247033; cv=none; d=google.com; s=arc-20160816; b=WnuL4PGRZ6A+44XqcHZnKG9ZigETLSJNY2nC24vinb3uoxDD9sFmbpMTSjKdKLkX2/ Jp0x1FS4OoZittUae/tfFMbA5k52sV3D/Yp65moXgyWMFFfNJYBUtmWBu1zkaTI9M1AR K7LXgPednHYGXEJUQUJUzV/pEJxBjjmFOtTf5F1VEe8dLOx1Z035qd6lZ8A+uNvWVcuj tm7iFvoNKHq7pnZar2sAAIul9faYtX1DOuiESXhDnFZ3EBP3yeZ4YXo1xFmiqDwaoGWy gL5WW7Dz9bRfR0YQ4rgrgnOxtIy2Jingy487oD8NznnzUZZcxXUOa3QojgzjjOIX+eWX P/4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=dsru8XZBipCZzLaWkPHuAfFmvBX1m5WfiJr98xbcqdk=; b=iigx/CC1RaRgmngtjZYl/zmou7c/lIihGWIhvsJfFoDFlC95lYRiKW/22JvcwGeZM6 2AYufMdtjXQ4SNJ1hF9EvNhcCpCF4ymShxyCZZnM6a7ECyriFkbsjpvqqoMe27nB8dP3 zowgp1oDXAdbt3KYlHTKiMrD6Tx5MY2JZtWlvEiUOf7JGAN7jd3D82URpPVTB1wxGUid Gb1F1IlkZyvxSXzTAePKmtOZ/Z6UH7E38ey8yzR5c4v90BPMHiDSBwBxuMjhb7rZn310 +E8yxpOKWmkY76nPQL1DUagmAw2rba4mDAusmaN6zcpkFJian+G2noREHfK1+I/pD1ZJ i+eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id cy27si3165584edb.529.2021.03.31.20.16.50; Wed, 31 Mar 2021 20:17:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233478AbhDADGy (ORCPT + 99 others); Wed, 31 Mar 2021 23:06:54 -0400 Received: from mga09.intel.com ([134.134.136.24]:60453 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233205AbhDADGU (ORCPT ); Wed, 31 Mar 2021 23:06:20 -0400 IronPort-SDR: MHTnGe5tcvXAV0BuuScgnCQlF3ni2j0pDUBPyUhLiHRL1zJ1+L3lcTN7nWXTbSQji7Ub3MzOjF O5gbcwISEAYw== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="192241097" X-IronPort-AV: E=Sophos;i="5.81,295,1610438400"; d="scan'208";a="192241097" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2021 20:06:16 -0700 IronPort-SDR: WLQRyNWupYXJ3rCP35OUDZPMLkayBykqQxUHoOHoQ54IroD2AxEh4CDh/G+F2f08RUXus+OvBG VBHvgBmzKD5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,295,1610438400"; d="scan'208";a="384668338" Received: from linux.intel.com ([10.54.29.200]) by fmsmga007.fm.intel.com with ESMTP; 31 Mar 2021 20:06:16 -0700 Received: from debox1-desk2.jf.intel.com (debox1-desk2.jf.intel.com [10.54.75.16]) by linux.intel.com (Postfix) with ESMTP id 4520B580949; Wed, 31 Mar 2021 20:06:16 -0700 (PDT) From: "David E. Box" To: irenic.rajneesh@gmail.com, hdegoede@redhat.com, david.e.box@linux.intel.com, mgross@linux.intel.com, gayatri.kammela@intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/9] platform/x86: intel_pmc_core: Don't use global pmcdev in quirks Date: Wed, 31 Mar 2021 20:05:50 -0700 Message-Id: <20210401030558.2301621-2-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210401030558.2301621-1-david.e.box@linux.intel.com> References: <20210401030558.2301621-1-david.e.box@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DMI callbacks, used for quirks, currently access the PMC by getting the address a global pmc_dev struct. Instead, have the callbacks set a global quirk specific variable. In probe, after calling dmi_check_system(), pass pmc_dev to a function that will handle each quirk if its variable condition is met. This allows removing the global pmc_dev later. Signed-off-by: David E. Box --- drivers/platform/x86/intel_pmc_core.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index b5888aeb4bcf..260d49dca1ad 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -1186,9 +1186,15 @@ static const struct pci_device_id pmc_pci_ids[] = { * the platform BIOS enforces 24Mhz crystal to shutdown * before PMC can assert SLP_S0#. */ +static bool xtal_ignore; static int quirk_xtal_ignore(const struct dmi_system_id *id) { - struct pmc_dev *pmcdev = &pmc; + xtal_ignore = true; + return 0; +} + +static void pmc_core_xtal_ignore(struct pmc_dev *pmcdev) +{ u32 value; value = pmc_core_reg_read(pmcdev, pmcdev->map->pm_vric1_offset); @@ -1197,7 +1203,6 @@ static int quirk_xtal_ignore(const struct dmi_system_id *id) /* 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[] = { @@ -1212,6 +1217,14 @@ static const struct dmi_system_id pmc_core_dmi_table[] = { {} }; +static void pmc_core_do_dmi_quirks(struct pmc_dev *pmcdev) +{ + dmi_check_system(pmc_core_dmi_table); + + if (xtal_ignore) + pmc_core_xtal_ignore(pmcdev); +} + static int pmc_core_probe(struct platform_device *pdev) { static bool device_initialized; @@ -1253,7 +1266,7 @@ static int pmc_core_probe(struct platform_device *pdev) mutex_init(&pmcdev->lock); platform_set_drvdata(pdev, pmcdev); pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); - dmi_check_system(pmc_core_dmi_table); + pmc_core_do_dmi_quirks(pmcdev); /* * On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when -- 2.25.1