leds: qcom-lpg: Fix PWM period limits
authorBjorn Andersson <quic_bjorande@quicinc.com>
Mon, 15 May 2023 16:26:04 +0000 (09:26 -0700)
committerJohan Hovold <johan@kernel.org>
Sat, 3 Jun 2023 15:00:28 +0000 (17:00 +0200)
commitb05d39466ba111fc3775d5d46180b73c34ebe8f7
tree80f36fd138a642d7f7867ff34a239a4115cfcaa1
parent7877cb91f1081754a1487c144d85dc0d2e2e7fc4
leds: qcom-lpg: Fix PWM period limits

The introduction of high resolution PWM support changed the order of the
operations in the calculation of min and max period. The result in both
divisions is in most cases a truncation to 0, which limits the period to
the range of [0, 0].

Both numerators (and denominators) are within 64 bits, so the whole
expression can be put directly into the div64_u64, instead of doing it
partially.

Fixes: b00d2ed37617 ("leds: rgb: leds-qcom-lpg: Add support for high resolution PWM")
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Tested-by: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Acked-by: Lee Jones <lee@kernel.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Link: https://lore.kernel.org/r/20230515162604.649203-1-quic_bjorande@quicinc.com
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/leds/rgb/leds-qcom-lpg.c