From 43e91e5eb9c8b36ddd1dc239e0d8c36cc034e8ca Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 26 Jun 2024 18:00:19 +0200 Subject: leds: leds-lp55xx: Generalize stop_engine function Generalize stop_engine function as the implementation is the same for most of the lp55xx based LED driver. Suggested-by: Lee Jones Signed-off-by: Christian Marangi Link: https://lore.kernel.org/r/20240626160027.19703-15-ansuelsmth@gmail.com Signed-off-by: Lee Jones --- drivers/leds/leds-lp55xx-common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/leds/leds-lp55xx-common.c') diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 58121f27f17b..cecff34e6e15 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -298,6 +298,19 @@ void lp55xx_turn_off_channels(struct lp55xx_chip *chip) } EXPORT_SYMBOL_GPL(lp55xx_turn_off_channels); +void lp55xx_stop_engine(struct lp55xx_chip *chip) +{ + enum lp55xx_engine_index idx = chip->engine_idx; + const struct lp55xx_device_config *cfg = chip->cfg; + u8 mask; + + mask = LP55xx_MODE_ENGn_MASK(idx, cfg->reg_op_mode.shift); + lp55xx_update_bits(chip, cfg->reg_op_mode.addr, mask, 0); + + lp55xx_wait_opmode_done(chip); +} +EXPORT_SYMBOL_GPL(lp55xx_stop_engine); + static void lp55xx_reset_device(struct lp55xx_chip *chip) { const struct lp55xx_device_config *cfg = chip->cfg; -- cgit