File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -491,6 +491,10 @@ int led_classdev_register_ext(struct device *parent,
491
491
fwnode_property_read_u32 (init_data -> fwnode ,
492
492
"max-brightness" ,
493
493
& led_cdev -> max_brightness );
494
+
495
+ if (fwnode_property_present (init_data -> fwnode , "color" ))
496
+ fwnode_property_read_u32 (init_data -> fwnode , "color" ,
497
+ & led_cdev -> color );
494
498
}
495
499
} else {
496
500
proposed_name = led_cdev -> name ;
@@ -500,6 +504,9 @@ int led_classdev_register_ext(struct device *parent,
500
504
if (ret < 0 )
501
505
return ret ;
502
506
507
+ if (led_cdev -> color >= LED_COLOR_ID_MAX )
508
+ dev_warn (parent , "LED %s color identifier out of range\n" , final_name );
509
+
503
510
mutex_init (& led_cdev -> led_access );
504
511
mutex_lock (& led_cdev -> led_access );
505
512
led_cdev -> dev = device_create_with_groups (& leds_class , parent , 0 ,
Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ struct led_classdev {
100
100
const char * name ;
101
101
unsigned int brightness ;
102
102
unsigned int max_brightness ;
103
+ unsigned int color ;
103
104
int flags ;
104
105
105
106
/* Lower 16 bits reflect status */
You can’t perform that action at this time.
0 commit comments