]> git.itanic.dy.fi Git - linux-stable/commit
pwm: sti: Fix capture for st,pwm-num-chan < st,capture-num-chan
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 4 Feb 2024 21:20:43 +0000 (22:20 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:16:40 +0000 (18:16 -0400)
commit97927e0730257fb979257a66535f87cb7fa0ea77
tree7ae17df40b5e771ad5ce42bc6043aa8e53b7ba31
parentfc866c1061220d6aa0abc568592165dac5f3932a
pwm: sti: Fix capture for st,pwm-num-chan < st,capture-num-chan

[ Upstream commit 5f623835584f1c8d1030666796f40c47a448ce0b ]

The driver only used the number of pwm channels to set the pwm_chip's
npwm member. The result is that if there are more capture channels than
PWM channels specified in the device tree, only a part of the capture
channel is usable. Fix that by passing the bigger channel count to the
pwm framework. This makes it possible that the .apply() callback is
called with .hwpwm >= pwm_num_devs, catch that case and return an error
code.

Fixes: c97267ae831d ("pwm: sti: Add PWM capture callback")
Link: https://lore.kernel.org/r/20240204212043.2951852-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pwm/pwm-sti.c