Commit 9c2b23a2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull thermal control fix from Rafael Wysocki:
 "This prevents the int340x thermal driver from taking the power slider
  offset parameter into account incorrectly in some cases (Srinivas
  Pandruvada)"

* tag 'thermal-7.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal: intel: int340x: soc_slider: Set offset only for balanced mode
parents 2d74bd3c 7dfe9846
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -176,15 +176,21 @@ static inline void write_soc_slider(struct proc_thermal_device *proc_priv, u64 v

static void set_soc_power_profile(struct proc_thermal_device *proc_priv, int slider)
{
	u8 offset;
	u64 val;

	val = read_soc_slider(proc_priv);
	val &= ~SLIDER_MASK;
	val |= FIELD_PREP(SLIDER_MASK, slider) | BIT(SLIDER_ENABLE_BIT);

	if (slider == SOC_SLIDER_VALUE_MINIMUM || slider == SOC_SLIDER_VALUE_MAXIMUM)
		offset = 0;
	else
		offset = slider_offset;

	/* Set the slider offset from module params */
	val &= ~SLIDER_OFFSET_MASK;
	val |= FIELD_PREP(SLIDER_OFFSET_MASK, slider_offset);
	val |= FIELD_PREP(SLIDER_OFFSET_MASK, offset);

	write_soc_slider(proc_priv, val);
}