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