diff options
author | Stefan Agner <stefan@agner.ch> | 2015-11-23 14:45:07 -0800 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2015-12-16 16:54:32 +0100 |
commit | 816aec2325e620b6454474372a21f90a8740cb28 (patch) | |
tree | 6db9059a4e4673662a15aaebc67b4791b6ccb42d /Documentation | |
parent | 37670676a122a38e72ecd9dac0feff2a3dac967f (diff) | |
download | linux-stable-816aec2325e620b6454474372a21f90a8740cb28.tar.gz linux-stable-816aec2325e620b6454474372a21f90a8740cb28.tar.bz2 linux-stable-816aec2325e620b6454474372a21f90a8740cb28.zip |
pwm: fsl-ftm: Fix clock enable/disable when using PM
A FTM PWM instance enables/disables three clocks: The bus clock, the
counter clock and the PWM clock. The bus clock gets enabled on
pwm_request, whereas the counter and PWM clocks will be enabled upon
pwm_enable.
The driver has three closesly related issues when enabling/disabling
clocks during suspend/resume:
- The three clocks are not treated differently in regards to the
individual PWM state enabled/requested. This can lead to clocks
getting disabled which have not been enabled in the first place
(a PWM channel which only has been requested going through
suspend/resume).
- When entering suspend, the current behavior relies on the
FTM_OUTMASK register: If a PWM output is unmasked, the driver
assumes the clocks are enabled. However, some PWM instances
have only 2 channels connected (e.g. Vybrid's FTM1). In that case,
the FTM_OUTMASK reads 0x3 if all channels are disabled, even if
the code wrote 0xff to it before. For those PWM instances, the
current approach to detect enabled PWM signals does not work.
- A third issue applies to the bus clock only, which can get enabled
multiple times (once for each PWM channel of a PWM chip). This is
fine, however when entering suspend mode, the clock only gets
disabled once.
This change introduces a different approach by relying on the enable
and prepared counters of the clock framework and using the frameworks
PWM signal states to address all three issues.
Clocks get disabled during suspend and back enabled on resume
regarding to the PWM channels individual state (requested/enabled).
Since we do not count the clock enables in the driver, this change no
longer clears the Status and Control registers Clock Source Selection
(FTM_SC[CLKS]). However, since we disable the selected clock anyway,
and we explicitly select the clock source on reenabling a PWM channel
this approach should not make a difference in practice.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions