pwm: mxs: Don't modify HW state in .probe() after the PWM chip was registered
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 7 Jul 2021 16:27:50 +0000 (18:27 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Thu, 2 Sep 2021 19:38:36 +0000 (21:38 +0200)
commit020162d6f49f2963062229814a56a89c86cbeaa8
treeff818e000d85d764237bc3c705ca38179696e4a6
parent3d2813fb17e5fd0d73c1d1442ca0192bde4af10e
pwm: mxs: Don't modify HW state in .probe() after the PWM chip was registered

This fixes a race condition: After pwmchip_add() is called there might
already be a consumer and then modifying the hardware behind the
consumer's back is bad. So reset before calling pwmchip_add().

Note that reseting the hardware isn't the right thing to do if the PWM
is already running as it might e.g. disable (or even enable) a backlight
that is supposed to be on (or off).

Fixes: 4dce82c1e840 ("pwm: add pwm-mxs support")
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-mxs.c