Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branches 'ib-qcom-leds-6.9' and 'ib-leds-backlight-6.9' into ibs-for-leds-merged

+341 -90
+46
Documentation/devicetree/bindings/leds/backlight/kinetic,ktd2801.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/leds/backlight/kinetic,ktd2801.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Kinetic Technologies KTD2801 one-wire backlight 8 + 9 + maintainers: 10 + - Duje Mihanović <duje.mihanovic@skole.hr> 11 + 12 + description: | 13 + The Kinetic Technologies KTD2801 is a LED backlight driver controlled 14 + by a single GPIO line. The driver can be controlled with a PWM signal 15 + or by pulsing the GPIO line to set the backlight level. This is called 16 + "ExpressWire". 17 + 18 + allOf: 19 + - $ref: common.yaml# 20 + 21 + properties: 22 + compatible: 23 + const: kinetic,ktd2801 24 + 25 + ctrl-gpios: 26 + maxItems: 1 27 + 28 + default-brightness: true 29 + max-brightness: true 30 + 31 + required: 32 + - compatible 33 + - ctrl-gpios 34 + 35 + additionalProperties: false 36 + 37 + examples: 38 + - | 39 + #include <dt-bindings/gpio/gpio.h> 40 + 41 + backlight { 42 + compatible = "kinetic,ktd2801"; 43 + ctrl-gpios = <&gpio 97 GPIO_ACTIVE_HIGH>; 44 + max-brightness = <210>; 45 + default-brightness = <100>; 46 + };
+13
MAINTAINERS
··· 7979 7979 T: git git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat.git 7980 7980 F: fs/exfat/ 7981 7981 7982 + EXPRESSWIRE PROTOCOL LIBRARY 7983 + M: Duje Mihanović <duje.mihanovic@skole.hr> 7984 + L: linux-leds@vger.kernel.org 7985 + S: Maintained 7986 + F: drivers/leds/leds-expresswire.c 7987 + F: include/linux/leds-expresswire.h 7988 + 7982 7989 EXT2 FILE SYSTEM 7983 7990 M: Jan Kara <jack@suse.com> 7984 7991 L: linux-ext4@vger.kernel.org ··· 12051 12044 S: Maintained 12052 12045 F: Documentation/devicetree/bindings/leds/backlight/kinetic,ktd253.yaml 12053 12046 F: drivers/video/backlight/ktd253-backlight.c 12047 + 12048 + KTD2801 BACKLIGHT DRIVER 12049 + M: Duje Mihanović <duje.mihanovic@skole.hr> 12050 + S: Maintained 12051 + F: Documentation/devicetree/bindings/leds/backlight/kinetic,ktd2801.yaml 12052 + F: drivers/video/backlight/ktd2801-backlight.c 12054 12053 12055 12054 KTEST 12056 12055 M: Steven Rostedt <rostedt@goodmis.org>
+4
drivers/leds/Kconfig
··· 186 186 To compile this driver as a module, choose M here: the module 187 187 will be called leds-el15203000. 188 188 189 + config LEDS_EXPRESSWIRE 190 + bool 191 + depends on GPIOLIB 192 + 189 193 config LEDS_TURRIS_OMNIA 190 194 tristate "LED support for CZ.NIC's Turris Omnia" 191 195 depends on LEDS_CLASS_MULTICOLOR
+3
drivers/leds/Makefile
··· 91 91 obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o 92 92 obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o 93 93 94 + # Kinetic ExpressWire Protocol 95 + obj-$(CONFIG_LEDS_EXPRESSWIRE) += leds-expresswire.o 96 + 94 97 # LED SPI Drivers 95 98 obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o 96 99 obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
+2 -1
drivers/leds/flash/Kconfig
··· 23 23 config LEDS_KTD2692 24 24 tristate "LED support for Kinetic KTD2692 flash LED controller" 25 25 depends on OF 26 - depends on GPIOLIB || COMPILE_TEST 26 + depends on GPIOLIB 27 + select LEDS_EXPRESSWIRE 27 28 help 28 29 This option enables support for Kinetic KTD2692 LED flash connected 29 30 through ExpressWire interface.
+27 -89
drivers/leds/flash/leds-ktd2692.c
··· 6 6 * Ingi Kim <ingi2.kim@samsung.com> 7 7 */ 8 8 9 - #include <linux/delay.h> 10 9 #include <linux/err.h> 11 10 #include <linux/gpio/consumer.h> 11 + #include <linux/leds-expresswire.h> 12 12 #include <linux/led-class-flash.h> 13 13 #include <linux/module.h> 14 14 #include <linux/mutex.h> ··· 37 37 #define KTD2692_REG_FLASH_CURRENT_BASE 0x80 38 38 #define KTD2692_REG_MODE_BASE 0xA0 39 39 40 - /* Set bit coding time for expresswire interface */ 41 - #define KTD2692_TIME_RESET_US 700 42 - #define KTD2692_TIME_DATA_START_TIME_US 10 43 - #define KTD2692_TIME_HIGH_END_OF_DATA_US 350 44 - #define KTD2692_TIME_LOW_END_OF_DATA_US 10 45 - #define KTD2692_TIME_SHORT_BITSET_US 4 46 - #define KTD2692_TIME_LONG_BITSET_US 12 47 - 48 40 /* KTD2692 default length of name */ 49 41 #define KTD2692_NAME_LENGTH 20 50 - 51 - enum ktd2692_bitset { 52 - KTD2692_LOW = 0, 53 - KTD2692_HIGH, 54 - }; 55 42 56 43 /* Movie / Flash Mode Control */ 57 44 enum ktd2692_led_mode { ··· 58 71 enum led_brightness max_brightness; 59 72 }; 60 73 74 + const struct expresswire_timing ktd2692_timing = { 75 + .poweroff_us = 700, 76 + .data_start_us = 10, 77 + .end_of_data_low_us = 10, 78 + .end_of_data_high_us = 350, 79 + .short_bitset_us = 4, 80 + .long_bitset_us = 12 81 + }; 82 + 61 83 struct ktd2692_context { 84 + /* Common ExpressWire properties (ctrl GPIO and timing) */ 85 + struct expresswire_common_props props; 86 + 62 87 /* Related LED Flash class device */ 63 88 struct led_classdev_flash fled_cdev; 64 89 ··· 79 80 struct regulator *regulator; 80 81 81 82 struct gpio_desc *aux_gpio; 82 - struct gpio_desc *ctrl_gpio; 83 83 84 84 enum ktd2692_led_mode mode; 85 85 enum led_brightness torch_brightness; ··· 88 90 struct led_classdev_flash *fled_cdev) 89 91 { 90 92 return container_of(fled_cdev, struct ktd2692_context, fled_cdev); 91 - } 92 - 93 - static void ktd2692_expresswire_start(struct ktd2692_context *led) 94 - { 95 - gpiod_direction_output(led->ctrl_gpio, KTD2692_HIGH); 96 - udelay(KTD2692_TIME_DATA_START_TIME_US); 97 - } 98 - 99 - static void ktd2692_expresswire_reset(struct ktd2692_context *led) 100 - { 101 - gpiod_direction_output(led->ctrl_gpio, KTD2692_LOW); 102 - udelay(KTD2692_TIME_RESET_US); 103 - } 104 - 105 - static void ktd2692_expresswire_end(struct ktd2692_context *led) 106 - { 107 - gpiod_direction_output(led->ctrl_gpio, KTD2692_LOW); 108 - udelay(KTD2692_TIME_LOW_END_OF_DATA_US); 109 - gpiod_direction_output(led->ctrl_gpio, KTD2692_HIGH); 110 - udelay(KTD2692_TIME_HIGH_END_OF_DATA_US); 111 - } 112 - 113 - static void ktd2692_expresswire_set_bit(struct ktd2692_context *led, bool bit) 114 - { 115 - /* 116 - * The Low Bit(0) and High Bit(1) is based on a time detection 117 - * algorithm between time low and time high 118 - * Time_(L_LB) : Low time of the Low Bit(0) 119 - * Time_(H_LB) : High time of the LOW Bit(0) 120 - * Time_(L_HB) : Low time of the High Bit(1) 121 - * Time_(H_HB) : High time of the High Bit(1) 122 - * 123 - * It can be simplified to: 124 - * Low Bit(0) : 2 * Time_(H_LB) < Time_(L_LB) 125 - * High Bit(1) : 2 * Time_(L_HB) < Time_(H_HB) 126 - * HIGH ___ ____ _.. _________ ___ 127 - * |_________| |_.. |____| |__| 128 - * LOW <L_LB> <H_LB> <L_HB> <H_HB> 129 - * [ Low Bit (0) ] [ High Bit(1) ] 130 - */ 131 - if (bit) { 132 - gpiod_direction_output(led->ctrl_gpio, KTD2692_LOW); 133 - udelay(KTD2692_TIME_SHORT_BITSET_US); 134 - gpiod_direction_output(led->ctrl_gpio, KTD2692_HIGH); 135 - udelay(KTD2692_TIME_LONG_BITSET_US); 136 - } else { 137 - gpiod_direction_output(led->ctrl_gpio, KTD2692_LOW); 138 - udelay(KTD2692_TIME_LONG_BITSET_US); 139 - gpiod_direction_output(led->ctrl_gpio, KTD2692_HIGH); 140 - udelay(KTD2692_TIME_SHORT_BITSET_US); 141 - } 142 - } 143 - 144 - static void ktd2692_expresswire_write(struct ktd2692_context *led, u8 value) 145 - { 146 - int i; 147 - 148 - ktd2692_expresswire_start(led); 149 - for (i = 7; i >= 0; i--) 150 - ktd2692_expresswire_set_bit(led, value & BIT(i)); 151 - ktd2692_expresswire_end(led); 152 93 } 153 94 154 95 static int ktd2692_led_brightness_set(struct led_classdev *led_cdev, ··· 100 163 101 164 if (brightness == LED_OFF) { 102 165 led->mode = KTD2692_MODE_DISABLE; 103 - gpiod_direction_output(led->aux_gpio, KTD2692_LOW); 166 + gpiod_direction_output(led->aux_gpio, 0); 104 167 } else { 105 - ktd2692_expresswire_write(led, brightness | 168 + expresswire_write_u8(&led->props, brightness | 106 169 KTD2692_REG_MOVIE_CURRENT_BASE); 107 170 led->mode = KTD2692_MODE_MOVIE; 108 171 } 109 172 110 - ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE); 173 + expresswire_write_u8(&led->props, led->mode | KTD2692_REG_MODE_BASE); 111 174 mutex_unlock(&led->lock); 112 175 113 176 return 0; ··· 124 187 125 188 if (state) { 126 189 flash_tm_reg = GET_TIMEOUT_OFFSET(timeout->val, timeout->step); 127 - ktd2692_expresswire_write(led, flash_tm_reg 190 + expresswire_write_u8(&led->props, flash_tm_reg 128 191 | KTD2692_REG_FLASH_TIMEOUT_BASE); 129 192 130 193 led->mode = KTD2692_MODE_FLASH; 131 - gpiod_direction_output(led->aux_gpio, KTD2692_HIGH); 194 + gpiod_direction_output(led->aux_gpio, 1); 132 195 } else { 133 196 led->mode = KTD2692_MODE_DISABLE; 134 - gpiod_direction_output(led->aux_gpio, KTD2692_LOW); 197 + gpiod_direction_output(led->aux_gpio, 0); 135 198 } 136 199 137 - ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE); 200 + expresswire_write_u8(&led->props, led->mode | KTD2692_REG_MODE_BASE); 138 201 139 202 fled_cdev->led_cdev.brightness = LED_OFF; 140 203 led->mode = KTD2692_MODE_DISABLE; ··· 184 247 static void ktd2692_setup(struct ktd2692_context *led) 185 248 { 186 249 led->mode = KTD2692_MODE_DISABLE; 187 - ktd2692_expresswire_reset(led); 188 - gpiod_direction_output(led->aux_gpio, KTD2692_LOW); 250 + expresswire_power_off(&led->props); 251 + gpiod_direction_output(led->aux_gpio, 0); 189 252 190 - ktd2692_expresswire_write(led, (KTD2692_MM_MIN_CURR_THRESHOLD_SCALE - 1) 253 + expresswire_write_u8(&led->props, (KTD2692_MM_MIN_CURR_THRESHOLD_SCALE - 1) 191 254 | KTD2692_REG_MM_MIN_CURR_THRESHOLD_BASE); 192 - ktd2692_expresswire_write(led, KTD2692_FLASH_MODE_CURR_PERCENT(45) 255 + expresswire_write_u8(&led->props, KTD2692_FLASH_MODE_CURR_PERCENT(45) 193 256 | KTD2692_REG_FLASH_CURRENT_BASE); 194 257 } 195 258 ··· 214 277 if (!np) 215 278 return -ENXIO; 216 279 217 - led->ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_ASIS); 218 - ret = PTR_ERR_OR_ZERO(led->ctrl_gpio); 280 + led->props.ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_ASIS); 281 + ret = PTR_ERR_OR_ZERO(led->props.ctrl_gpio); 219 282 if (ret) 220 283 return dev_err_probe(dev, ret, "cannot get ctrl-gpios\n"); 221 284 ··· 349 412 350 413 module_platform_driver(ktd2692_driver); 351 414 415 + MODULE_IMPORT_NS(EXPRESSWIRE); 352 416 MODULE_AUTHOR("Ingi Kim <ingi2.kim@samsung.com>"); 353 417 MODULE_DESCRIPTION("Kinetic KTD2692 LED driver"); 354 418 MODULE_LICENSE("GPL v2");
+72
drivers/leds/leds-expresswire.c
··· 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 + #include <linux/bits.h> 9 + #include <linux/delay.h> 10 + #include <linux/export.h> 11 + #include <linux/gpio/consumer.h> 12 + #include <linux/types.h> 13 + 14 + #include <linux/leds-expresswire.h> 15 + 16 + void expresswire_power_off(struct expresswire_common_props *props) 17 + { 18 + gpiod_set_value_cansleep(props->ctrl_gpio, 0); 19 + usleep_range(props->timing.poweroff_us, props->timing.poweroff_us * 2); 20 + } 21 + EXPORT_SYMBOL_NS_GPL(expresswire_power_off, EXPRESSWIRE); 22 + 23 + void expresswire_enable(struct expresswire_common_props *props) 24 + { 25 + gpiod_set_value(props->ctrl_gpio, 1); 26 + udelay(props->timing.detect_delay_us); 27 + gpiod_set_value(props->ctrl_gpio, 0); 28 + udelay(props->timing.detect_us); 29 + gpiod_set_value(props->ctrl_gpio, 1); 30 + } 31 + EXPORT_SYMBOL_NS_GPL(expresswire_enable, EXPRESSWIRE); 32 + 33 + void expresswire_start(struct expresswire_common_props *props) 34 + { 35 + gpiod_set_value(props->ctrl_gpio, 1); 36 + udelay(props->timing.data_start_us); 37 + } 38 + EXPORT_SYMBOL_NS_GPL(expresswire_start, EXPRESSWIRE); 39 + 40 + void expresswire_end(struct expresswire_common_props *props) 41 + { 42 + gpiod_set_value(props->ctrl_gpio, 0); 43 + udelay(props->timing.end_of_data_low_us); 44 + gpiod_set_value(props->ctrl_gpio, 1); 45 + udelay(props->timing.end_of_data_high_us); 46 + } 47 + EXPORT_SYMBOL_NS_GPL(expresswire_end, EXPRESSWIRE); 48 + 49 + void expresswire_set_bit(struct expresswire_common_props *props, bool bit) 50 + { 51 + if (bit) { 52 + gpiod_set_value(props->ctrl_gpio, 0); 53 + udelay(props->timing.short_bitset_us); 54 + gpiod_set_value(props->ctrl_gpio, 1); 55 + udelay(props->timing.long_bitset_us); 56 + } else { 57 + gpiod_set_value(props->ctrl_gpio, 0); 58 + udelay(props->timing.long_bitset_us); 59 + gpiod_set_value(props->ctrl_gpio, 1); 60 + udelay(props->timing.short_bitset_us); 61 + } 62 + } 63 + EXPORT_SYMBOL_NS_GPL(expresswire_set_bit, EXPRESSWIRE); 64 + 65 + void expresswire_write_u8(struct expresswire_common_props *props, u8 val) 66 + { 67 + expresswire_start(props); 68 + for (int i = 7; i >= 0; i--) 69 + expresswire_set_bit(props, val & BIT(i)); 70 + expresswire_end(props); 71 + } 72 + EXPORT_SYMBOL_NS_GPL(expresswire_write_u8, EXPRESSWIRE);
+7
drivers/video/backlight/Kconfig
··· 183 183 which is a 1-wire GPIO-controlled backlight found in some mobile 184 184 phones. 185 185 186 + config BACKLIGHT_KTD2801 187 + tristate "Backlight Driver for Kinetic KTD2801" 188 + select LEDS_EXPRESSWIRE 189 + help 190 + Say Y to enable the backlight driver for the Kinetic KTD2801 1-wire 191 + GPIO-controlled backlight found in Samsung Galaxy Core Prime VE LTE. 192 + 186 193 config BACKLIGHT_KTZ8866 187 194 tristate "Backlight Driver for Kinetic KTZ8866" 188 195 depends on I2C
+1
drivers/video/backlight/Makefile
··· 34 34 obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o 35 35 obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o 36 36 obj-$(CONFIG_BACKLIGHT_KTD253) += ktd253-backlight.o 37 + obj-$(CONFIG_BACKLIGHT_KTD2801) += ktd2801-backlight.o 37 38 obj-$(CONFIG_BACKLIGHT_KTZ8866) += ktz8866.o 38 39 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o 39 40 obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o
+128
drivers/video/backlight/ktd2801-backlight.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Datasheet: 4 + * https://www.kinet-ic.com/uploads/web/KTD2801/KTD2801-04b.pdf 5 + */ 6 + #include <linux/backlight.h> 7 + #include <linux/gpio/consumer.h> 8 + #include <linux/leds-expresswire.h> 9 + #include <linux/platform_device.h> 10 + #include <linux/property.h> 11 + 12 + #define KTD2801_DEFAULT_BRIGHTNESS 100 13 + #define KTD2801_MAX_BRIGHTNESS 255 14 + 15 + /* These values have been extracted from Samsung's driver. */ 16 + static const struct expresswire_timing ktd2801_timing = { 17 + .poweroff_us = 2600, 18 + .detect_delay_us = 150, 19 + .detect_us = 270, 20 + .data_start_us = 5, 21 + .short_bitset_us = 5, 22 + .long_bitset_us = 15, 23 + .end_of_data_low_us = 10, 24 + .end_of_data_high_us = 350 25 + }; 26 + 27 + struct ktd2801_backlight { 28 + struct expresswire_common_props props; 29 + struct backlight_device *bd; 30 + bool was_on; 31 + }; 32 + 33 + static int ktd2801_update_status(struct backlight_device *bd) 34 + { 35 + struct ktd2801_backlight *ktd2801 = bl_get_data(bd); 36 + u8 brightness = (u8) backlight_get_brightness(bd); 37 + 38 + if (backlight_is_blank(bd)) { 39 + expresswire_power_off(&ktd2801->props); 40 + ktd2801->was_on = false; 41 + return 0; 42 + } 43 + 44 + if (!ktd2801->was_on) { 45 + expresswire_enable(&ktd2801->props); 46 + ktd2801->was_on = true; 47 + } 48 + 49 + expresswire_write_u8(&ktd2801->props, brightness); 50 + 51 + return 0; 52 + } 53 + 54 + static const struct backlight_ops ktd2801_backlight_ops = { 55 + .update_status = ktd2801_update_status, 56 + }; 57 + 58 + static int ktd2801_backlight_probe(struct platform_device *pdev) 59 + { 60 + struct device *dev = &pdev->dev; 61 + struct backlight_device *bd; 62 + struct ktd2801_backlight *ktd2801; 63 + u32 brightness, max_brightness; 64 + int ret; 65 + 66 + ktd2801 = devm_kzalloc(dev, sizeof(*ktd2801), GFP_KERNEL); 67 + if (!ktd2801) 68 + return -ENOMEM; 69 + ktd2801->was_on = true; 70 + ktd2801->props.timing = ktd2801_timing; 71 + 72 + ret = device_property_read_u32(dev, "max-brightness", &max_brightness); 73 + if (ret) 74 + max_brightness = KTD2801_MAX_BRIGHTNESS; 75 + if (max_brightness > KTD2801_MAX_BRIGHTNESS) { 76 + dev_err(dev, "illegal max brightness specified\n"); 77 + max_brightness = KTD2801_MAX_BRIGHTNESS; 78 + } 79 + 80 + ret = device_property_read_u32(dev, "default-brightness", &brightness); 81 + if (ret) 82 + brightness = KTD2801_DEFAULT_BRIGHTNESS; 83 + if (brightness > max_brightness) { 84 + dev_err(dev, "default brightness exceeds max\n"); 85 + brightness = max_brightness; 86 + } 87 + 88 + ktd2801->props.ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_OUT_HIGH); 89 + if (IS_ERR(ktd2801->props.ctrl_gpio)) 90 + return dev_err_probe(dev, PTR_ERR(ktd2801->props.ctrl_gpio), 91 + "failed to get backlight GPIO"); 92 + gpiod_set_consumer_name(ktd2801->props.ctrl_gpio, dev_name(dev)); 93 + 94 + bd = devm_backlight_device_register(dev, dev_name(dev), dev, ktd2801, 95 + &ktd2801_backlight_ops, NULL); 96 + if (IS_ERR(bd)) 97 + return dev_err_probe(dev, PTR_ERR(bd), 98 + "failed to register backlight"); 99 + 100 + bd->props.max_brightness = max_brightness; 101 + bd->props.brightness = brightness; 102 + 103 + ktd2801->bd = bd; 104 + platform_set_drvdata(pdev, bd); 105 + backlight_update_status(bd); 106 + 107 + return 0; 108 + } 109 + 110 + static const struct of_device_id ktd2801_of_match[] = { 111 + { .compatible = "kinetic,ktd2801" }, 112 + { } 113 + }; 114 + MODULE_DEVICE_TABLE(of, ktd2801_of_match); 115 + 116 + static struct platform_driver ktd2801_backlight_driver = { 117 + .driver = { 118 + .name = "ktd2801-backlight", 119 + .of_match_table = ktd2801_of_match, 120 + }, 121 + .probe = ktd2801_backlight_probe, 122 + }; 123 + module_platform_driver(ktd2801_backlight_driver); 124 + 125 + MODULE_IMPORT_NS(EXPRESSWIRE); 126 + MODULE_AUTHOR("Duje Mihanović <duje.mihanovic@skole.hr>"); 127 + MODULE_DESCRIPTION("Kinetic KTD2801 Backlight Driver"); 128 + MODULE_LICENSE("GPL");
+38
include/linux/leds-expresswire.h
··· 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 */