@@ -130,7 +130,7 @@ struct pca955x_led {
130
130
struct led_classdev led_cdev ;
131
131
int led_num ; /* 0 .. 15 potentially */
132
132
u32 type ;
133
- int default_state ;
133
+ enum led_default_state default_state ;
134
134
struct fwnode_handle * fwnode ;
135
135
};
136
136
@@ -437,7 +437,6 @@ pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip)
437
437
return ERR_PTR (- ENOMEM );
438
438
439
439
device_for_each_child_node (& client -> dev , child ) {
440
- const char * state ;
441
440
u32 reg ;
442
441
int res ;
443
442
@@ -448,19 +447,9 @@ pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip)
448
447
led = & pdata -> leds [reg ];
449
448
led -> type = PCA955X_TYPE_LED ;
450
449
led -> fwnode = child ;
451
- fwnode_property_read_u32 ( child , "type" , & led -> type );
450
+ led -> default_state = led_init_default_state_get ( child );
452
451
453
- if (!fwnode_property_read_string (child , "default-state" ,
454
- & state )) {
455
- if (!strcmp (state , "keep" ))
456
- led -> default_state = LEDS_GPIO_DEFSTATE_KEEP ;
457
- else if (!strcmp (state , "on" ))
458
- led -> default_state = LEDS_GPIO_DEFSTATE_ON ;
459
- else
460
- led -> default_state = LEDS_GPIO_DEFSTATE_OFF ;
461
- } else {
462
- led -> default_state = LEDS_GPIO_DEFSTATE_OFF ;
463
- }
452
+ fwnode_property_read_u32 (child , "type" , & led -> type );
464
453
}
465
454
466
455
pdata -> num_leds = chip -> bits ;
@@ -572,13 +561,11 @@ static int pca955x_probe(struct i2c_client *client)
572
561
led -> brightness_set_blocking = pca955x_led_set ;
573
562
led -> brightness_get = pca955x_led_get ;
574
563
575
- if (pdata -> leds [i ].default_state ==
576
- LEDS_GPIO_DEFSTATE_OFF ) {
564
+ if (pdata -> leds [i ].default_state == LEDS_DEFSTATE_OFF ) {
577
565
err = pca955x_led_set (led , LED_OFF );
578
566
if (err )
579
567
return err ;
580
- } else if (pdata -> leds [i ].default_state ==
581
- LEDS_GPIO_DEFSTATE_ON ) {
568
+ } else if (pdata -> leds [i ].default_state == LEDS_DEFSTATE_ON ) {
582
569
err = pca955x_led_set (led , LED_FULL );
583
570
if (err )
584
571
return err ;
@@ -617,8 +604,7 @@ static int pca955x_probe(struct i2c_client *client)
617
604
* brightness to see if it's using PWM1. If so, PWM1
618
605
* should not be written below.
619
606
*/
620
- if (pdata -> leds [i ].default_state ==
621
- LEDS_GPIO_DEFSTATE_KEEP ) {
607
+ if (pdata -> leds [i ].default_state == LEDS_DEFSTATE_KEEP ) {
622
608
if (led -> brightness != LED_FULL &&
623
609
led -> brightness != LED_OFF &&
624
610
led -> brightness != LED_HALF )
0 commit comments