Hans de Goede 2153bbc12f pwm: lpss: Only set update bit if we are actually changing the settings
According to the datasheet the update bit must be set if the on-time-div
or the base-unit changes.

Now that we properly order device resume on Cherry Trail so that the GFX0
_PS0 method no longer exits with an error, we end up with a sequence of
events where we are writing the same values twice in a row.

First the _PS0 method restores the duty cycle of 0% the GPU driver set
on suspend and then the GPU driver first updates just the enabled bit in
the pwm_state from 0 to 1, causing us to write the same values again,
before restoring the pre-suspend duty-cycle in a separate pwm_apply call.

When writing the update bit the second time, without changing any of
the values the update bit clears immediately / instantly, instead of
staying 1 for a while as usual. After this the next setting of the update
bit seems to be ignored, causing the restoring of the pre-suspend
duty-cycle to not get applied. This makes the backlight come up with
a 0% dutycycle after suspend/resume.

Any further brightness changes after this do work.

This commit moves the setting of the update bit into pwm_lpss_prepare()
and only sets the bit if we have actually changed any of the values.

This avoids the setting of the update bit the second time we configure
the PWM to 0% dutycycle, this fixes the backlight coming up with 0%
duty-cycle after a suspend/resume.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2018-10-16 13:16:15 +02:00
..
2017-07-06 08:29:16 +02:00
2018-10-16 13:14:52 +02:00
2018-03-26 15:57:08 +02:00
2018-04-30 10:40:57 +02:00
2017-04-06 17:45:03 +02:00
2017-11-15 10:38:37 +01:00
2018-07-09 18:59:14 +02:00
2018-08-20 11:32:25 +02:00
2018-07-12 09:03:06 +02:00
2017-01-19 00:38:17 +01:00
2018-06-14 16:25:43 +09:00
2017-08-21 08:11:24 +02:00