diff options
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 5f124e98f439..001a532e342e 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -577,20 +577,35 @@ static void atom_set_pstate(struct cpudata *cpudata, int pstate) | |||
577 | wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); | 577 | wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); |
578 | } | 578 | } |
579 | 579 | ||
580 | #define ATOM_BCLK_FREQS 5 | 580 | static int silvermont_get_scaling(void) |
581 | static int atom_freq_table[ATOM_BCLK_FREQS] = { 833, 1000, 1333, 1167, 800}; | ||
582 | |||
583 | static int atom_get_scaling(void) | ||
584 | { | 581 | { |
585 | u64 value; | 582 | u64 value; |
586 | int i; | 583 | int i; |
584 | /* Defined in Table 35-6 from SDM (Sept 2015) */ | ||
585 | static int silvermont_freq_table[] = { | ||
586 | 83300, 100000, 133300, 116700, 80000}; | ||
587 | 587 | ||
588 | rdmsrl(MSR_FSB_FREQ, value); | 588 | rdmsrl(MSR_FSB_FREQ, value); |
589 | i = value & 0x3; | 589 | i = value & 0x7; |
590 | WARN_ON(i > 4); | ||
590 | 591 | ||
591 | WARN_ON(i > ATOM_BCLK_FREQS); | 592 | return silvermont_freq_table[i]; |
593 | } | ||
592 | 594 | ||
593 | return atom_freq_table[i] * 100; | 595 | static int airmont_get_scaling(void) |
596 | { | ||
597 | u64 value; | ||
598 | int i; | ||
599 | /* Defined in Table 35-10 from SDM (Sept 2015) */ | ||
600 | static int airmont_freq_table[] = { | ||
601 | 83300, 100000, 133300, 116700, 80000, | ||
602 | 93300, 90000, 88900, 87500}; | ||
603 | |||
604 | rdmsrl(MSR_FSB_FREQ, value); | ||
605 | i = value & 0xF; | ||
606 | WARN_ON(i > 8); | ||
607 | |||
608 | return airmont_freq_table[i]; | ||
594 | } | 609 | } |
595 | 610 | ||
596 | static void atom_get_vid(struct cpudata *cpudata) | 611 | static void atom_get_vid(struct cpudata *cpudata) |
@@ -726,7 +741,27 @@ static struct cpu_defaults core_params = { | |||
726 | }, | 741 | }, |
727 | }; | 742 | }; |
728 | 743 | ||
729 | static struct cpu_defaults atom_params = { | 744 | static struct cpu_defaults silvermont_params = { |
745 | .pid_policy = { | ||
746 | .sample_rate_ms = 10, | ||
747 | .deadband = 0, | ||
748 | .setpoint = 60, | ||
749 | .p_gain_pct = 14, | ||
750 | .d_gain_pct = 0, | ||
751 | .i_gain_pct = 4, | ||
752 | }, | ||
753 | .funcs = { | ||
754 | .get_max = atom_get_max_pstate, | ||
755 | .get_max_physical = atom_get_max_pstate, | ||
756 | .get_min = atom_get_min_pstate, | ||
757 | .get_turbo = atom_get_turbo_pstate, | ||
758 | .set = atom_set_pstate, | ||
759 | .get_scaling = silvermont_get_scaling, | ||
760 | .get_vid = atom_get_vid, | ||
761 | }, | ||
762 | }; | ||
763 | |||
764 | static struct cpu_defaults airmont_params = { | ||
730 | .pid_policy = { | 765 | .pid_policy = { |
731 | .sample_rate_ms = 10, | 766 | .sample_rate_ms = 10, |
732 | .deadband = 0, | 767 | .deadband = 0, |
@@ -741,7 +776,7 @@ static struct cpu_defaults atom_params = { | |||
741 | .get_min = atom_get_min_pstate, | 776 | .get_min = atom_get_min_pstate, |
742 | .get_turbo = atom_get_turbo_pstate, | 777 | .get_turbo = atom_get_turbo_pstate, |
743 | .set = atom_set_pstate, | 778 | .set = atom_set_pstate, |
744 | .get_scaling = atom_get_scaling, | 779 | .get_scaling = airmont_get_scaling, |
745 | .get_vid = atom_get_vid, | 780 | .get_vid = atom_get_vid, |
746 | }, | 781 | }, |
747 | }; | 782 | }; |
@@ -983,7 +1018,7 @@ static void intel_pstate_timer_func(unsigned long __data) | |||
983 | static const struct x86_cpu_id intel_pstate_cpu_ids[] = { | 1018 | static const struct x86_cpu_id intel_pstate_cpu_ids[] = { |
984 | ICPU(0x2a, core_params), | 1019 | ICPU(0x2a, core_params), |
985 | ICPU(0x2d, core_params), | 1020 | ICPU(0x2d, core_params), |
986 | ICPU(0x37, atom_params), | 1021 | ICPU(0x37, silvermont_params), |
987 | ICPU(0x3a, core_params), | 1022 | ICPU(0x3a, core_params), |
988 | ICPU(0x3c, core_params), | 1023 | ICPU(0x3c, core_params), |
989 | ICPU(0x3d, core_params), | 1024 | ICPU(0x3d, core_params), |
@@ -992,7 +1027,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { | |||
992 | ICPU(0x45, core_params), | 1027 | ICPU(0x45, core_params), |
993 | ICPU(0x46, core_params), | 1028 | ICPU(0x46, core_params), |
994 | ICPU(0x47, core_params), | 1029 | ICPU(0x47, core_params), |
995 | ICPU(0x4c, atom_params), | 1030 | ICPU(0x4c, airmont_params), |
996 | ICPU(0x4e, core_params), | 1031 | ICPU(0x4e, core_params), |
997 | ICPU(0x4f, core_params), | 1032 | ICPU(0x4f, core_params), |
998 | ICPU(0x5e, core_params), | 1033 | ICPU(0x5e, core_params), |