From patchwork Mon Oct 21 16:20:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dirk.brandewie@gmail.com X-Patchwork-Id: 3078821 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2DED99F372 for ; Mon, 21 Oct 2013 16:20:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 19D652039C for ; Mon, 21 Oct 2013 16:20:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB93720233 for ; Mon, 21 Oct 2013 16:20:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751287Ab3JUQUt (ORCPT ); Mon, 21 Oct 2013 12:20:49 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:46193 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085Ab3JUQUt (ORCPT ); Mon, 21 Oct 2013 12:20:49 -0400 Received: by mail-pa0-f45.google.com with SMTP id rd3so8271272pab.18 for ; Mon, 21 Oct 2013 09:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1lw4PAl9m8lOpo2f21NUb903Lm0ZJ9LCjqp4TUMOTD4=; b=npg9USmmdY4255vzK+kGA9morg5Y0ZHxXlyyUrgFTphzfgjsfrNScVKPoElSdt47F3 8AwX6PPQfD2b3OYbHi59S6vJwvWAxIFFuCpm+uIO+CDO1H5jhz2lnnppLSzzFISpY0gP XC9iTDrMIwjNro2hXhTGgAdWoMwnqZrNlUgLRaRS6jYa703Uf3Vqy8CulvngSGplt+Yw thR/eOTCquNwYD0Yr5m7R0f3VgmlWlipIi7y1jBL2QOQVgrlpswubM6e3FGU6lWnTT2J R6kG6rg0rTFPMwFvMqhvmmk2tuqOwKKriWzNreWfmAMkDihI5x5grV9p1FVQfnToOVga UcVg== X-Received: by 10.68.173.165 with SMTP id bl5mr1055971pbc.196.1382372449056; Mon, 21 Oct 2013 09:20:49 -0700 (PDT) Received: from echolake.localdomain (static-50-43-59-152.bvtn.or.frontiernet.net. [50.43.59.152]) by mx.google.com with ESMTPSA id fy4sm21918178pbb.1.2013.10.21.09.20.47 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Mon, 21 Oct 2013 09:20:48 -0700 (PDT) From: dirk.brandewie@gmail.com To: linux-pm@vger.kernel.org, rjw@rjwysocki.net Cc: Dirk Brandewie Subject: [PATCH 4/4] cpufreq/intel_pstate: Add Baytrail support Date: Mon, 21 Oct 2013 09:20:35 -0700 Message-Id: <1382372435-29778-5-git-send-email-dirk.j.brandewie@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1382372435-29778-1-git-send-email-dirk.j.brandewie@intel.com> References: <1382372435-29778-1-git-send-email-dirk.j.brandewie@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dirk Brandewie Add support for the Baytrail processor Signed-off-by: Dirk Brandewie --- drivers/cpufreq/intel_pstate.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index c41fff9..89925513 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -33,6 +33,8 @@ #define SAMPLE_COUNT 3 +#define BYT_RATIOS 0x66a + #define FRAC_BITS 8 #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) #define fp_toint(X) ((X) >> FRAC_BITS) @@ -341,6 +343,20 @@ static void intel_pstate_sysfs_expose_params(void) } /************************** sysfs end ************************/ +static int byt_get_min_pstate(void) +{ + u64 value; + rdmsrl(BYT_RATIOS, value); + return value & 0xFF; +} + +static int byt_get_max_pstate(void) +{ + u64 value; + rdmsrl(BYT_RATIOS, value); + return (value >> 16) & 0xFF; +} + static int core_get_min_pstate(void) { u64 value; @@ -395,6 +411,24 @@ static struct cpu_defaults core_params = { }, }; +static struct cpu_defaults byt_params = { + .pid_policy = { + .sample_rate_ms = 10, + .deadband = 0, + .setpoint = 97, + .p_gain_pct = 14, + .d_gain_pct = 0, + .i_gain_pct = 4, + }, + .funcs = { + .get_max = byt_get_max_pstate, + .get_min = byt_get_min_pstate, + .get_turbo = byt_get_max_pstate, + .set = core_set_pstate, + }, +}; + + static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) { int max_perf = cpu->pstate.turbo_pstate; @@ -551,6 +585,7 @@ static void intel_pstate_timer_func(unsigned long __data) static const struct x86_cpu_id intel_pstate_cpu_ids[] = { ICPU(0x2a, core_params), ICPU(0x2d, core_params), + ICPU(0x37, byt_params), ICPU(0x3a, core_params), ICPU(0x3c, core_params), ICPU(0x3e, core_params),