mirror of
https://github.com/miskcoo/ugreen_dx4600_leds_controller.git
synced 2025-07-23 04:13:04 +02:00
Squashed commit of the following:
commit 48ad47c2cb990c7550325e798064cfab612c3e7e
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Fri Jun 7 01:51:01 2024 +0800
update README.md
commit 576cc1e21d629e83ac589cd7f806698814da4858
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Fri Jun 7 01:23:31 2024 +0800
update makefiles
commit 577e2fc326df4d8edc8c303a89bde89ceca90949
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Fri Jun 7 00:29:26 2024 +0800
change the i2c device name
commit 303a05e1f4695dcc0bc117c412b0e668dd7bb2a5
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Thu Jun 6 22:46:18 2024 +0800
add the status attribute
commit ca1a51522b9ad28b04dc12d6012994bc6dce022c
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Thu Jun 6 22:34:33 2024 +0800
fix including filename
commit 4684bd1aaaa0de089537686d65caee4352df3bcf
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Thu Jun 6 22:18:11 2024 +0800
add dkms.conf
commit 4925eec10259c5c626c9459a65a7abeb115c4050
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Thu Jun 6 19:35:37 2024 +0800
Update the manual of the kernel module
commit e07f1570efab507221092d9f2d09d6b98e32f2eb
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Thu Jun 6 16:25:30 2024 +0800
add a netdev monitoring script
commit 813884f0bd928424b3e5be9053a7cc9289ab2263
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Thu Jun 6 15:33:28 2024 +0800
support blink and breath
commit 991db7c11521a2b7e2f841bf5916ff58003b951a
Merge: a4e540c c3e6324
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Thu Jun 6 13:35:16 2024 +0800
Merge branch 'master' into kmod
commit a4e540cbbde41d6a8570881a85bbfebab9def1ad
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Thu Jun 6 13:20:28 2024 +0800
add a script of monitoring diskio
commit 5b65173ec68d2a9ebc952d120935e0f533f6760f
Author: Yuhao Zhou <miskcoo@gmail.com>
Date: Wed Jun 5 23:26:09 2024 +0800
add a kernel driver of leds
46 lines
1.0 KiB
C
46 lines
1.0 KiB
C
#ifndef __UGREEN_LED_H
|
|
#define __UGREEN_LED_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/leds.h>
|
|
|
|
|
|
#define MODULE_NAME ( "led-ugreen" )
|
|
|
|
#define UGREEN_LED_SLAVE_ADDR ( 0x3a )
|
|
#define UGREEN_LED_SLAVE_NAME ( "led-ugreen" )
|
|
|
|
#define UGREEN_MAX_LED_NUMBER ( 10 )
|
|
#define UGREEN_LED_CHANGE_STATE_RETRY_COUNT ( 5 )
|
|
|
|
#define UGREEN_LED_STATE_OFF ( 0 )
|
|
#define UGREEN_LED_STATE_ON ( 1 )
|
|
#define UGREEN_LED_STATE_BLINK ( 2 )
|
|
#define UGREEN_LED_STATE_BREATH ( 3 )
|
|
#define UGREEN_LED_STATE_INVALID ( 4 )
|
|
|
|
static const char *ugreen_led_state_name[] = { "off", "on", "blink", "breath", "unknown" };
|
|
|
|
struct ugreen_led_array;
|
|
|
|
struct ugreen_led_state {
|
|
u8 status;
|
|
u8 r, g, b;
|
|
u8 brightness;
|
|
u16 t_on, t_cycle;
|
|
|
|
u8 led_id;
|
|
struct led_classdev cdev;
|
|
struct ugreen_led_array *priv;
|
|
};
|
|
|
|
struct ugreen_led_array {
|
|
struct i2c_client *client;
|
|
struct mutex mutex;
|
|
struct ugreen_led_state state[UGREEN_MAX_LED_NUMBER];
|
|
};
|
|
|
|
|
|
#endif // __UGREEN_LED_H
|