hc
2024-08-16 a24a44ff9ca902811b99aa9663d697cf452e08ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * LED MULTI-CONTROL
 *
 * Copyright 2017 Allen Zhang <zwp@rock-chips.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */
#ifndef __LEDS_MULTI_H_INCLUDED
#define __LEDS_MULTI_H_INCLUDED
 
enum {
   TRIG_NONE = 0,
   TRIG_DEF_ON,
   TRIG_TIMER,
   TRIG_ONESHOT,
   TRIG_MAX,
};
 
struct led_ctrl_data {
   u32 trigger;
   /* the delay time(ms) of triggering a trigger */
   u32 delayed_trigger_ms;
   u32 brightness;
   u32 delay_on;
   u32 delay_off;
} __packed;
 
struct led_ctrl_scroll_data {
   u64 init_bitmap;
   /* the shift bits on every scrolling time*/
   u32 shifts;
   u32 shift_delay_ms;
} __packed;
 
struct led_ctrl_breath_data {
   u64 background_bitmap;
   u64 breath_bitmap;
   u32 change_delay_ms;
   u32 breath_steps;
} __packed;
 
#define MAX_LEDS_NUMBER    64
 
#define LEDS_MULTI_CTRL_IOCTL_MAGIC    'z'
 
#define LEDS_MULTI_CTRL_IOCTL_MULTI_SET    \
   _IOW(LEDS_MULTI_CTRL_IOCTL_MAGIC, 0x01, struct led_ctrl_data*)
#define LEDS_MULTI_CTRL_IOCTL_GET_LED_NUMBER    \
   _IOR(LEDS_MULTI_CTRL_IOCTL_MAGIC, 0x02, int)
#define LEDS_MULTI_CTRL_IOCTL_MULTI_SET_SCROLL    \
   _IOW(LEDS_MULTI_CTRL_IOCTL_MAGIC, 0x03, struct led_ctrl_scroll_data*)
#define LEDS_MULTI_CTRL_IOCTL_MULTI_SET_BREATH    \
   _IOW(LEDS_MULTI_CTRL_IOCTL_MAGIC, 0x04, struct led_ctrl_breath_data*)
 
int led_multi_control_register(struct led_classdev *led_cdev);
int led_multi_control_unregister(struct led_classdev *led_cdev);
int led_multi_control_init(struct device *dev);
int led_multi_control_exit(struct device *dev);
 
#endif    /* __LEDS_MULTI_H_INCLUDED */