summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-lp8501.c
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2024-06-26 18:00:10 +0200
committerLee Jones <lee@kernel.org>2024-06-26 17:08:30 +0100
commit4d310b96f2db602830c40f82a75ede799b243cce (patch)
tree2143ccdbc7a3a20485a5299042e5489349cb598e /drivers/leds/leds-lp8501.c
parentdb30c2891bfc74acb8823edee5f39cbc36bd9a4d (diff)
downloadlwn-4d310b96f2db602830c40f82a75ede799b243cce.tar.gz
lwn-4d310b96f2db602830c40f82a75ede799b243cce.zip
leds: leds-lp55xx: Generalize load_engine function
LED driver based on lp55xx have all a very similar implementation for load_engine function. Move the function to lp55xx-common and rework the define to be more dynamic instead of having to declare a temp array for them. Engine mask are the same for every LED based on lp55xx. Suggested-by: Lee Jones <lee@kernel.org> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Link: https://lore.kernel.org/r/20240626160027.19703-6-ansuelsmth@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/leds/leds-lp8501.c')
-rw-r--r--drivers/leds/leds-lp8501.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/leds/leds-lp8501.c b/drivers/leds/leds-lp8501.c
index d3c718bb8275..04173d6875af 100644
--- a/drivers/leds/leds-lp8501.c
+++ b/drivers/leds/leds-lp8501.c
@@ -119,17 +119,6 @@ static int lp8501_post_init_device(struct lp55xx_chip *chip)
static void lp8501_load_engine(struct lp55xx_chip *chip)
{
enum lp55xx_engine_index idx = chip->engine_idx;
- static const u8 mask[] = {
- [LP55XX_ENGINE_1] = LP8501_MODE_ENG1_M,
- [LP55XX_ENGINE_2] = LP8501_MODE_ENG2_M,
- [LP55XX_ENGINE_3] = LP8501_MODE_ENG3_M,
- };
-
- static const u8 val[] = {
- [LP55XX_ENGINE_1] = LP8501_LOAD_ENG1,
- [LP55XX_ENGINE_2] = LP8501_LOAD_ENG2,
- [LP55XX_ENGINE_3] = LP8501_LOAD_ENG3,
- };
static const u8 page_sel[] = {
[LP55XX_ENGINE_1] = LP8501_PAGE_ENG1,
@@ -137,9 +126,7 @@ static void lp8501_load_engine(struct lp55xx_chip *chip)
[LP55XX_ENGINE_3] = LP8501_PAGE_ENG3,
};
- lp55xx_update_bits(chip, LP8501_REG_OP_MODE, mask[idx], val[idx]);
-
- lp8501_wait_opmode_done();
+ lp55xx_load_engine(chip);
lp55xx_write(chip, LP8501_REG_PROG_PAGE_SEL, page_sel[idx]);
}
@@ -287,7 +274,7 @@ static struct lp55xx_device_config lp8501_cfg = {
},
.engine_busy = {
.addr = LP8501_REG_STATUS,
- .maks = LP8501_ENGINE_BUSY,
+ .mask = LP8501_ENGINE_BUSY,
},
.reset = {
.addr = LP8501_REG_RESET,