Skip to content

Commit ec9aa89

Browse files
ArenMlag-linaro
authored andcommitted
leds: rgb: leds-group-multicolor: Allow LEDs to stay on in suspend
If none of the managed LEDs enable LED_CORE_SUSPENDRESUME, then we shouldn't need to set it here. This makes it possible to use multicolor groups with GPIO LEDs that enable retain-state-suspended in the device tree. Signed-off-by: Aren Moynihan <[email protected]> Acked-by: Pavel Machek <[email protected]> Link: https://lore.kernel.org/r/[email protected] [Lee: Changed the comment to respect proper grammar] Signed-off-by: Lee Jones <[email protected]>
1 parent 415798b commit ec9aa89

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/leds/rgb/leds-group-multicolor.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static int leds_gmc_probe(struct platform_device *pdev)
6969
struct mc_subled *subled;
7070
struct leds_multicolor *priv;
7171
unsigned int max_brightness = 0;
72-
int i, ret, count = 0;
72+
int i, ret, count = 0, common_flags = 0;
7373

7474
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
7575
if (!priv)
@@ -91,6 +91,7 @@ static int leds_gmc_probe(struct platform_device *pdev)
9191
if (!priv->monochromatics)
9292
return -ENOMEM;
9393

94+
common_flags |= led_cdev->flags;
9495
priv->monochromatics[count] = led_cdev;
9596

9697
max_brightness = max(max_brightness, led_cdev->max_brightness);
@@ -114,12 +115,15 @@ static int leds_gmc_probe(struct platform_device *pdev)
114115

115116
/* Initialise the multicolor's LED class device */
116117
cdev = &priv->mc_cdev.led_cdev;
117-
cdev->flags = LED_CORE_SUSPENDRESUME;
118118
cdev->brightness_set_blocking = leds_gmc_set;
119119
cdev->max_brightness = max_brightness;
120120
cdev->color = LED_COLOR_ID_MULTI;
121121
priv->mc_cdev.num_colors = count;
122122

123+
/* we only need suspend/resume if a sub-led requests it */
124+
if (common_flags & LED_CORE_SUSPENDRESUME)
125+
cdev->flags = LED_CORE_SUSPENDRESUME;
126+
123127
init_data.fwnode = dev_fwnode(dev);
124128
ret = devm_led_classdev_multicolor_register_ext(dev, &priv->mc_cdev, &init_data);
125129
if (ret)

0 commit comments

Comments
 (0)