Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2105243rdh; Tue, 26 Sep 2023 12:34:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTEZgWsWZ8pfqs8TQhC1Jsbg7tu198GluPGkB3bA+tRWHVmL9TwshPy7olJpvmdk70bF4B X-Received: by 2002:a05:6a00:1886:b0:690:1720:aaa5 with SMTP id x6-20020a056a00188600b006901720aaa5mr13355915pfh.9.1695756851022; Tue, 26 Sep 2023 12:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695756851; cv=none; d=google.com; s=arc-20160816; b=MAF+sZGBCDLRBX2oA8CS0xgZ5kPOtp/UnSFEcTFhxd6EswgMCaIo7mxGhFRgIDDiYH mcc9PxHJm5TJ31qVemkRQHXYRcMD2qsuqjTMAtkU+X2Kby2WawJVta4kSyaUHY5EjcRa enAcEEeye83A81dumnTia1jB4IHac85qXoNJPvFRjpuwkKi67s7rROLi+9DIn5yozt/O ut3Dh2+AHoSji9dlfUqCQPhBByRQliK/Ky9IeuMJbISbYVDPbK+/QlA1eoQM2TOEEXnn 4xclKUHPr8jR/oG/bAh4wVXG1hzewG034AwHPuHLgn7uhGM5Fqk4NjAbTmpO9YSpZrgP xkrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=FA8S/3pMuigt/P6vPyHxpfESDulYHpjQIG57Z6PFX2w=; fh=mOqrdtzLxfRdhx+JUcCLIFZwj5ZpRA4B+MTwRGfrWMA=; b=ZJF+75xByifx37TvIs5FzZf7mdt147ywDT1BJEDdKHSVPJtsmoQGehiiYDG/i1fyDH BWbdUDtABrSL9HhoTVQySHS2YEzTw9zRj1PAoGBYY4m1WMUDvuuzocz19f03PWVxndy5 LslbA0gEBXE2PZnB4iAKOHBp7RxPdtfGlj+R2knjA5EiVBP6pQDDc5Zk+v2JIavqq+Lt EPhOCLdmqXK4h6gpRmgTNhW7FuQ2mzY5eUxfaShDismmQGB/nYHgW9WrX5tq/D1VDWtM rfxTvNjNAGUsif1eh1yvSTcPoWhyilX/BhD455j0WfLjPDZJVbJkY5v5TLiwbJta0i/c VwBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hs+AbrTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id u24-20020a056a00099800b0068e47e5f221si14063494pfg.195.2023.09.26.12.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 12:34:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hs+AbrTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 1F3588069433; Tue, 26 Sep 2023 08:57:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231137AbjIZP5H (ORCPT + 99 others); Tue, 26 Sep 2023 11:57:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235149AbjIZP5G (ORCPT ); Tue, 26 Sep 2023 11:57:06 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 937C211F; Tue, 26 Sep 2023 08:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695743819; x=1727279819; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=o04UZaiPAW8CtWqG5r0zg6d8eGqesbuNB7DpA4lF29E=; b=Hs+AbrTPn3csWecsx74grsQy/P2cLrljQRU2ghwnk5oE7Et2X3gSDZae paWFQecPuDKqnFi8oWCN3r4T3RPrDopcWNCRbaERiAODZfc2isU1aoE+q DTKcp/Yj8kfJYs4eIsK+cv9dm5p2AjAumVBnxdeqwiGzHyeCX4jaA09bl z/LTicMveIezkpgCDgyA/t9ybx50Xxc+J56aiggKP6Gm+HhVta+L+456M 5lvBFPTyjUycK4z3vL5KX76h47lQlAJ6jYgn7hFjPnU9Hu5ZfKbqPSz8V hPBjyEQXRzVxa9giiwwZv7hDu6EfYUVh0sQbw+jQtWNyFudxCYfp1g/jQ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="371932462" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="371932462" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 08:56:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="864451283" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="864451283" Received: from hhalmen-mobl.ger.corp.intel.com ([10.251.219.207]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 08:56:57 -0700 Date: Tue, 26 Sep 2023 18:56:54 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: "David E. Box" cc: LKML , platform-driver-x86@vger.kernel.org, rajvi.jingar@linux.intel.com Subject: Re: [PATCH 05/11] platform/x86:intel/pmc: Move get_low_power_modes function In-Reply-To: <20230922213032.1770590-6-david.e.box@linux.intel.com> Message-ID: References: <20230922213032.1770590-1-david.e.box@linux.intel.com> <20230922213032.1770590-6-david.e.box@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 26 Sep 2023 08:57:10 -0700 (PDT) On Fri, 22 Sep 2023, David E. Box wrote: > From: Xi Pardee > > Some platforms will have a need to retrieve the low power modes as part of > their driver initialization. As such, make the function global and call it > from the platform specific init code. What is the real justification for this change, I don't think it's clearly stated above? -- i. > Signed-off-by: Xi Pardee > Signed-off-by: David E. Box > --- > drivers/platform/x86/intel/pmc/adl.c | 2 ++ > drivers/platform/x86/intel/pmc/cnp.c | 2 ++ > drivers/platform/x86/intel/pmc/core.c | 7 +++---- > drivers/platform/x86/intel/pmc/core.h | 1 + > drivers/platform/x86/intel/pmc/icl.c | 10 +++++++++- > drivers/platform/x86/intel/pmc/mtl.c | 4 +++- > drivers/platform/x86/intel/pmc/spt.c | 10 +++++++++- > drivers/platform/x86/intel/pmc/tgl.c | 1 + > 8 files changed, 30 insertions(+), 7 deletions(-) > > diff --git a/drivers/platform/x86/intel/pmc/adl.c b/drivers/platform/x86/intel/pmc/adl.c > index 5006008e01be..64c492391ede 100644 > --- a/drivers/platform/x86/intel/pmc/adl.c > +++ b/drivers/platform/x86/intel/pmc/adl.c > @@ -319,6 +319,8 @@ int adl_core_init(struct pmc_dev *pmcdev) > if (ret) > return ret; > > + pmc_core_get_low_power_modes(pmcdev); > + > /* Due to a hardware limitation, the GBE LTR blocks PC10 > * when a cable is attached. Tell the PMC to ignore it. > */ > diff --git a/drivers/platform/x86/intel/pmc/cnp.c b/drivers/platform/x86/intel/pmc/cnp.c > index 420aaa1d7c76..59298f184d0e 100644 > --- a/drivers/platform/x86/intel/pmc/cnp.c > +++ b/drivers/platform/x86/intel/pmc/cnp.c > @@ -214,6 +214,8 @@ int cnp_core_init(struct pmc_dev *pmcdev) > if (ret) > return ret; > > + pmc_core_get_low_power_modes(pmcdev); > + > /* Due to a hardware limitation, the GBE LTR blocks PC10 > * when a cable is attached. Tell the PMC to ignore it. > */ > diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c > index 5a36b3f77bc5..e58c8cc286a3 100644 > --- a/drivers/platform/x86/intel/pmc/core.c > +++ b/drivers/platform/x86/intel/pmc/core.c > @@ -966,9 +966,8 @@ static bool pmc_core_pri_verify(u32 lpm_pri, u8 *mode_order) > return true; > } > > -static void pmc_core_get_low_power_modes(struct platform_device *pdev) > +void pmc_core_get_low_power_modes(struct pmc_dev *pmcdev) > { > - struct pmc_dev *pmcdev = platform_get_drvdata(pdev); > struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; > u8 pri_order[LPM_MAX_NUM_MODES] = LPM_DEFAULT_PRI; > u8 mode_order[LPM_MAX_NUM_MODES]; > @@ -1000,7 +999,8 @@ static void pmc_core_get_low_power_modes(struct platform_device *pdev) > for (mode = 0; mode < LPM_MAX_NUM_MODES; mode++) > pri_order[mode_order[mode]] = mode; > else > - dev_warn(&pdev->dev, "Assuming a default substate order for this platform\n"); > + dev_warn(&pmcdev->pdev->dev, > + "Assuming a default substate order for this platform\n"); > > /* > * Loop through all modes from lowest to highest priority, > @@ -1250,7 +1250,6 @@ static int pmc_core_probe(struct platform_device *pdev) > } > > pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(primary_pmc); > - pmc_core_get_low_power_modes(pdev); > pmc_core_do_dmi_quirks(primary_pmc); > > pmc_core_dbgfs_register(pmcdev); > diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h > index 0729f593c6a7..ccf24e0f5e50 100644 > --- a/drivers/platform/x86/intel/pmc/core.h > +++ b/drivers/platform/x86/intel/pmc/core.h > @@ -490,6 +490,7 @@ extern int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value); > > int pmc_core_resume_common(struct pmc_dev *pmcdev); > int get_primary_reg_base(struct pmc *pmc); > +extern void pmc_core_get_low_power_modes(struct pmc_dev *pmcdev); > > extern void pmc_core_ssram_init(struct pmc_dev *pmcdev); > > diff --git a/drivers/platform/x86/intel/pmc/icl.c b/drivers/platform/x86/intel/pmc/icl.c > index d08e3174230d..71b0fd6cb7d8 100644 > --- a/drivers/platform/x86/intel/pmc/icl.c > +++ b/drivers/platform/x86/intel/pmc/icl.c > @@ -53,7 +53,15 @@ const struct pmc_reg_map icl_reg_map = { > int icl_core_init(struct pmc_dev *pmcdev) > { > struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; > + int ret; > > pmc->map = &icl_reg_map; > - return get_primary_reg_base(pmc); > + > + ret = get_primary_reg_base(pmc); > + if (ret) > + return ret; > + > + pmc_core_get_low_power_modes(pmcdev); > + > + return ret; > } > diff --git a/drivers/platform/x86/intel/pmc/mtl.c b/drivers/platform/x86/intel/pmc/mtl.c > index 2204bc666980..c3b5f4fe01d1 100644 > --- a/drivers/platform/x86/intel/pmc/mtl.c > +++ b/drivers/platform/x86/intel/pmc/mtl.c > @@ -985,7 +985,7 @@ static int mtl_resume(struct pmc_dev *pmcdev) > int mtl_core_init(struct pmc_dev *pmcdev) > { > struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC]; > - int ret = 0; > + int ret; > > mtl_d3_fixup(); > > @@ -1002,6 +1002,8 @@ int mtl_core_init(struct pmc_dev *pmcdev) > return ret; > } > > + pmc_core_get_low_power_modes(pmcdev); > + > /* Due to a hardware limitation, the GBE LTR blocks PC10 > * when a cable is attached. Tell the PMC to ignore it. > */ > diff --git a/drivers/platform/x86/intel/pmc/spt.c b/drivers/platform/x86/intel/pmc/spt.c > index 4b6f5cbda16c..ab993a69e33e 100644 > --- a/drivers/platform/x86/intel/pmc/spt.c > +++ b/drivers/platform/x86/intel/pmc/spt.c > @@ -137,7 +137,15 @@ const struct pmc_reg_map spt_reg_map = { > int spt_core_init(struct pmc_dev *pmcdev) > { > struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; > + int ret; > > pmc->map = &spt_reg_map; > - return get_primary_reg_base(pmc); > + > + ret = get_primary_reg_base(pmc); > + if (ret) > + return ret; > + > + pmc_core_get_low_power_modes(pmcdev); > + > + return ret; > } > diff --git a/drivers/platform/x86/intel/pmc/tgl.c b/drivers/platform/x86/intel/pmc/tgl.c > index 2449940102db..d5f1d2223c5a 100644 > --- a/drivers/platform/x86/intel/pmc/tgl.c > +++ b/drivers/platform/x86/intel/pmc/tgl.c > @@ -263,6 +263,7 @@ int tgl_core_init(struct pmc_dev *pmcdev) > if (ret) > return ret; > > + pmc_core_get_low_power_modes(pmcdev); > pmc_core_get_tgl_lpm_reqs(pmcdev->pdev); > /* Due to a hardware limitation, the GBE LTR blocks PC10 > * when a cable is attached. Tell the PMC to ignore it. >