From patchwork Fri Oct 30 06:02:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1390820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=DGB0CNBQ; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMsDz43N1z9sRk; Fri, 30 Oct 2020 17:03:31 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kYNVV-00086k-F9; Fri, 30 Oct 2020 06:03:25 +0000 Received: from mail-pg1-f193.google.com ([209.85.215.193]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kYNVR-0007wW-12 for kernel-team@lists.ubuntu.com; Fri, 30 Oct 2020 06:03:21 +0000 Received: by mail-pg1-f193.google.com with SMTP id r10so4298152pgb.10 for ; Thu, 29 Oct 2020 23:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Nn0pSsJa21Db2DCt2P8rOTkEy21L6U3mEUQpHiAfsO0=; b=DGB0CNBQLdEiXkCaJllFHVw/qmkPPmqaremRU6dE62yWvQ9IEQMl8sOhjTj+etabEj 7yvwzP5nWT4Mad0ociHDcXNUzgk9XrkJJG2DHANeDjTc+DwbbhYRPcK+y2bROhInA2xn PkzMu9ucdL1MvnlVZlM058aAuLYHGJlKzc+bDGCKEQwTt1KGqyocgi10oe4NhbeNdXQE TWfjkLJ77AxbhGAtg1rrxak1C6dqOBHzKj2NDosG4R6Tc96QU1wIuWtf5cUQHugY4ijy +NiqwaoTb8DjFMS5nm/TZbx+jY7PBrUoN97vT0vEllekqNvwDiiv6zgc8BJMjcUtFBTa f59A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Nn0pSsJa21Db2DCt2P8rOTkEy21L6U3mEUQpHiAfsO0=; b=C7W4V4r6Khnb7mFozhG2DknNJWOkXc/exgQ21ZqWqJp7tziaDRYOlbG1vS+vi6pDdk BdXJRZUSbsijT4LKpM8GpcECVp90R5bxq/YTDhb1pWpD2SVZCFfBYlWCIwOWz02B4ynB Upr0/W1motdaITKpLBtwrMbXTeIYCofhcbXWIeARj/1sI1uDGMA5tnQLhUof4MsfaxEd ErxCrttLaabZSvMHXqVQvYt4t4uuqFzY1+DvipWSRdLmgqsx0rhQrBBiafNAUXnvNqL/ rw765Rgh+2lXskFAj/9rtbVyMl3v8y3F9Res92Y5koZKyz8wM2FwqAhcZvphTNIOC6OM cm7g== X-Gm-Message-State: AOAM532h7PBgippw6i55GkxZyJnCCyuBUdzcwpOwC415U51+8Bd+ShVj QFrlu8GA5luTXW58WPSGpY5zFAENOlGMGg== X-Google-Smtp-Source: ABdhPJz11mll5JgNbOKx83dyXu2imn/T0/LKhliJ/uwoREmQRGB7LlKnu3qjQCH9a+rfVG4zgAhvpg== X-Received: by 2002:a63:e241:: with SMTP id y1mr867268pgj.264.1604037791910; Thu, 29 Oct 2020 23:03:11 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id v16sm4200412pgk.26.2020.10.29.23.03.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 23:03:11 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 16/23][SRU][OEM-5.6] platform/x86: intel_pmc_core: Make pmc_core_substate_res_show() generic Date: Fri, 30 Oct 2020 14:02:07 +0800 Message-Id: <20201030060214.780883-22-acelan.kao@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201030060214.780883-1-acelan.kao@canonical.com> References: <20201030060214.780883-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.193; envelope-from=acelan@gmail.com; helo=mail-pg1-f193.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Gayatri Kammela BugLink: https://bugs.launchpad.net/bugs/1899883 Currently pmc_core_substate_res_show() uses array of char pointers i.e., lpm_modes for Tiger Lake directly to iterate through and to get the number of low power modes which is hardcoded and cannot be re-used for future platforms that support sub-states. To maintain readability, make pmc_core_substate_res_show() generic, so that it can re-used for future platforms. Cc: Chen Zhou Cc: Andy Shevchenko Cc: David E. Box Signed-off-by: Gayatri Kammela Signed-off-by: Andy Shevchenko (cherry picked from commit c61b693c9a032991f34cc4034b466d7807fd61ab) Signed-off-by: AceLan Kao --- drivers/platform/x86/intel_pmc_core.c | 2 ++ drivers/platform/x86/intel_pmc_core.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index 9a031f4e36f2..d2a5d4c36715 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -567,6 +567,7 @@ static const struct pmc_reg_map tgl_reg_map = { .pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET, .pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT, .ltr_ignore_max = TGL_NUM_IP_IGN_ALLOWED, + .lpm_modes = tgl_lpm_modes, .lpm_en_offset = TGL_LPM_EN_OFFSET, .lpm_residency_offset = TGL_LPM_RESIDENCY_OFFSET, .lpm_sts = tgl_lpm_maps, @@ -1009,6 +1010,7 @@ DEFINE_SHOW_ATTRIBUTE(pmc_core_ltr); static int pmc_core_substate_res_show(struct seq_file *s, void *unused) { struct pmc_dev *pmcdev = s->private; + const char **lpm_modes = pmcdev->map->lpm_modes; u32 offset = pmcdev->map->lpm_residency_offset; u32 lpm_en; int index; diff --git a/drivers/platform/x86/intel_pmc_core.h b/drivers/platform/x86/intel_pmc_core.h index 1bbdffe80bde..0d50b2402abe 100644 --- a/drivers/platform/x86/intel_pmc_core.h +++ b/drivers/platform/x86/intel_pmc_core.h @@ -198,7 +198,7 @@ enum ppfear_regs { #define TGL_LPM_STATUS_OFFSET 0x1C3C #define TGL_LPM_LIVE_STATUS_OFFSET 0x1C5C -const char *lpm_modes[] = { +const char *tgl_lpm_modes[] = { "S0i2.0", "S0i2.1", "S0i2.2", @@ -255,6 +255,7 @@ struct pmc_reg_map { const u32 ltr_ignore_max; const u32 pm_vric1_offset; /* Low Power Mode registers */ + const char **lpm_modes; const u32 lpm_en_offset; const u32 lpm_residency_offset; const u32 lpm_status_offset;