cpufreq: intel_pstate: Allow EPP 0x80 setting by the firmware
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Thu, 27 Oct 2022 17:19:47 +0000 (10:19 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Nov 2022 18:21:52 +0000 (19:21 +0100)
commit21cdb6c18f85fe538ca8740bc79f11fbe08d0197
tree46b7911502becb1734b239befd2c00d9804ff736
parent13fdbc8b8da6a2325cad3359c9a70504b0ff2f93
cpufreq: intel_pstate: Allow EPP 0x80 setting by the firmware

With the
"commit 3d13058ed2a6 ("cpufreq: intel_pstate: Use firmware default EPP")"
the firmware can set an EPP, which driver will not overwrite. But the
driver has a valid range check for:
0x40 > firmware epp < 0x80.
Hence firmware can't specify EPP of 0x80.

If the firmware didn't specify in the valid range, the driver has a
hard coded EPP of 102. But some Chrome hardware vendors don't want
this overwrite and wants to boot with chipset default EPP of 0x80 as
this improves battery life.

In this case they want to have capability to specify EPP of 0x80 via
the firmware. This require the valid range to include 0x80 also.
But here the valid range can't be simply extended to include 0x80 as
this is the chipset default EPP. Even without any firmware specifying
EPP, the chipset will always boot with EPP of 0x80.

To make sure that firmware specified EPP of 0x80 and not by the
chipset default, it will require additional check to make sure HWP
was enabled by the firmware before boot. Only way the firmware can
update EPP, is to enable HWP and update EPP via MSR_HWP_REQUEST.

This driver already checks, if the HWP is enabled by the firmware.
Use the same flag and extend valid range to include 0x80.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c