LED driver framework in Linux kernel

1. Read and write LED device property files -----> show and store methods of LED device properties --------> LED device drivers ----- >> operate LED hardware devices;
2. Definition of led_classdev structure:
struct led_classdev
{
const char * name; // device name
int brightness; // brightness
int max_brightness; // maximum brightness
int flag;
#define LED_SUSPENDED (1 << 0)
#define LED_CORE_SUSPENDRESUME (1 < <16)
void (* brightness_set) (struct led_classdev * led_cdev, enum led_brightness brightness); // Set LED brightness
enum led_brightness (* brightness_get) (struct led_classdev * led_cdev); // Get LED brightness
...
}
3. Write LED driver In fact, it is to fill the members of the led_classdev structure and call the int led_classdev_register (struct device * parent, struct led_classdev * led_cdev) function in the module initialization function to register the LED device with the kernel;

Published 2 original articles · praised 4 · visits 3213

Guess you like

Origin blog.csdn.net/qq_27630885/article/details/105599457