mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-03 21:48:15 +00:00 
			
		
		
		
	dm: led: auto probe() LEDs with "default-state"
To avoid board specificy LED activation code, automatically activate gpio-leds with "default-state" property during bind(). Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
This commit is contained in:
		
							parent
							
								
									d90f0d4cae
								
							
						
					
					
						commit
						bc882f5d5c
					
				@ -10,6 +10,7 @@
 | 
				
			|||||||
#include <led.h>
 | 
					#include <led.h>
 | 
				
			||||||
#include <asm/gpio.h>
 | 
					#include <asm/gpio.h>
 | 
				
			||||||
#include <dm/lists.h>
 | 
					#include <dm/lists.h>
 | 
				
			||||||
 | 
					#include <dm/uclass-internal.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct led_gpio_priv {
 | 
					struct led_gpio_priv {
 | 
				
			||||||
	struct gpio_desc gpio;
 | 
						struct gpio_desc gpio;
 | 
				
			||||||
@ -117,6 +118,14 @@ static int led_gpio_bind(struct udevice *parent)
 | 
				
			|||||||
			return ret;
 | 
								return ret;
 | 
				
			||||||
		uc_plat = dev_get_uclass_platdata(dev);
 | 
							uc_plat = dev_get_uclass_platdata(dev);
 | 
				
			||||||
		uc_plat->label = label;
 | 
							uc_plat->label = label;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (ofnode_read_bool(node, "default-state")) {
 | 
				
			||||||
 | 
								struct udevice *devp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								ret = uclass_get_device_tail(dev, 0, &devp);
 | 
				
			||||||
 | 
								if (ret)
 | 
				
			||||||
 | 
									return ret;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user