pwm: atmel: Fix polarity handling
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Fri, 14 Mar 2014 14:19:08 +0000 (15:19 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 18 Mar 2014 19:47:31 +0000 (20:47 +0100)
commit8db9e29fe540c9640ea60f37ecf99d3a73bd12c5
treed7458bb791e71432ad12fe47aa9380d78830733f
parent42586315b7b6e682bd4136a1a2bc2b1d50113487
pwm: atmel: Fix polarity handling

When atmel_pwm_config() calculates and then sets the prescaler, it is
overwriting the channel's CMR register so we are losing the CPOL
configuration.

As atmel_pwm_config() is always called before enabling a channel,
inverting the polarity doesn't work.

Fix that by reading CMR first and only overwriting the prescaler bits.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-atmel.c