Input: max8997_haptic - optimize PWM configuration
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Mon, 30 Jun 2025 19:24:31 +0000 (12:24 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 30 Jun 2025 19:30:22 +0000 (12:30 -0700)
commit54e626d097b05af9421534d211c9f96211d07d66
tree8478c5ddf3d745bc580fdd8194e5463597287605
parentfc75e51e6977f12f76cdcc6f9658a61b04cc4b3e
Input: max8997_haptic - optimize PWM configuration

Both pwm_config() and pwm_enable() are wrappers around
pwm_apply_might_sleep(). Instead of calling this function twice only
call it once without an intermediate step.

Setup the PWM in max8997_haptic_enable() only where it was enabled
historically. max8997_haptic_set_duty_cycle() is renamed accordingly to
make it clear this function is only about the internal setup now.
pwm_config() was called earlier back then, but that call has no effect
on the hardware when the PWM is disabled, so delaying this configuration
doesn't make a difference.

As pwm_apply_might_sleep() is used now defining the whole state of the
PWM, the call to pwm_apply_args() in .probe() can be dropped now, too.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20250630093718.2062359-2-u.kleine-koenig@baylibre.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/max8997_haptic.c