xref: /linux/include/linux/leds-expresswire.h (revision 1e525507)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Shared library for Kinetic's ExpressWire protocol.
4  * This protocol works by pulsing the ExpressWire IC's control GPIO.
5  * ktd2692 and ktd2801 are known to use this protocol.
6  */
7 
8 #ifndef _LEDS_EXPRESSWIRE_H
9 #define _LEDS_EXPRESSWIRE_H
10 
11 #include <linux/types.h>
12 
13 struct gpio_desc;
14 
15 struct expresswire_timing {
16 	unsigned long poweroff_us;
17 	unsigned long detect_delay_us;
18 	unsigned long detect_us;
19 	unsigned long data_start_us;
20 	unsigned long end_of_data_low_us;
21 	unsigned long end_of_data_high_us;
22 	unsigned long short_bitset_us;
23 	unsigned long long_bitset_us;
24 };
25 
26 struct expresswire_common_props {
27 	struct gpio_desc *ctrl_gpio;
28 	struct expresswire_timing timing;
29 };
30 
31 void expresswire_power_off(struct expresswire_common_props *props);
32 void expresswire_enable(struct expresswire_common_props *props);
33 void expresswire_start(struct expresswire_common_props *props);
34 void expresswire_end(struct expresswire_common_props *props);
35 void expresswire_set_bit(struct expresswire_common_props *props, bool bit);
36 void expresswire_write_u8(struct expresswire_common_props *props, u8 val);
37 
38 #endif /* _LEDS_EXPRESSWIRE_H */
39