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

Merge tag 'leds_for_4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds

Pull LED updates from Jacek Anaszewski:
"New LED class driver:
- LED driver for TI LP3952 6-Channel Color LED

LED core improvements:
- Only descend into leds directory when CONFIG_NEW_LEDS is set
- Add no-op gpio_led_register_device when LED subsystem is disabled
- MAINTAINERS: Add file patterns for led device tree bindings

LED Trigger core improvements:
- return error if invalid trigger name is provided via sysfs

LED class drivers improvements
- is31fl32xx: define complete i2c_device_id table
- is31fl32xx: fix typo in id and match table names
- leds-gpio: Set of_node for created LED devices
- pca9532: Add device tree support

Conversion of IDE trigger to common disk trigger:
- leds: convert IDE trigger to common disk trigger
- leds: documentation: 'ide-disk' to 'disk-activity'
- unicore32: use the new LED disk activity trigger
- parisc: use the new LED disk activity trigger
- mips: use the new LED disk activity trigger
- arm: use the new LED disk activity trigger
- powerpc: use the new LED disk activity trigger"

* tag 'leds_for_4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
leds: is31fl32xx: define complete i2c_device_id table
leds: is31fl32xx: fix typo in id and match table names
leds: LED driver for TI LP3952 6-Channel Color LED
leds: leds-gpio: Set of_node for created LED devices
leds: triggers: return error if invalid trigger name is provided via sysfs
leds: Only descend into leds directory when CONFIG_NEW_LEDS is set
leds: Add no-op gpio_led_register_device when LED subsystem is disabled
unicore32: use the new LED disk activity trigger
parisc: use the new LED disk activity trigger
mips: use the new LED disk activity trigger
arm: use the new LED disk activity trigger
powerpc: use the new LED disk activity trigger
leds: documentation: 'ide-disk' to 'disk-activity'
leds: convert IDE trigger to common disk trigger
leds: pca9532: Add device tree support
MAINTAINERS: Add file patterns for led device tree bindings

+668 -76
+3 -1
Documentation/devicetree/bindings/leds/common.txt
··· 26 26 "default-on" - LED will turn on (but for leds-gpio see "default-state" 27 27 property in Documentation/devicetree/bindings/gpio/led.txt) 28 28 "heartbeat" - LED "double" flashes at a load average based rate 29 - "ide-disk" - LED indicates disk activity 29 + "disk-activity" - LED indicates disk activity 30 + "ide-disk" - LED indicates IDE disk activity (deprecated), 31 + in new implementations use "disk-activity" 30 32 "timer" - LED flashes at a fixed, configurable rate 31 33 32 34 - led-max-microamp : Maximum LED supply current in microamperes. This property
+2 -2
Documentation/devicetree/bindings/leds/leds-gpio.txt
··· 33 33 leds { 34 34 compatible = "gpio-leds"; 35 35 hdd { 36 - label = "IDE Activity"; 36 + label = "Disk Activity"; 37 37 gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>; 38 - linux,default-trigger = "ide-disk"; 38 + linux,default-trigger = "disk-activity"; 39 39 }; 40 40 41 41 fault {
+39
Documentation/devicetree/bindings/leds/leds-pca9532.txt
··· 1 + *NXP - pca9532 PWM LED Driver 2 + 3 + The PCA9532 family is SMBus I/O expander optimized for dimming LEDs. 4 + The PWM support 256 steps. 5 + 6 + Required properties: 7 + - compatible: 8 + "nxp,pca9530" 9 + "nxp,pca9531" 10 + "nxp,pca9532" 11 + "nxp,pca9533" 12 + - reg - I2C slave address 13 + 14 + Each led is represented as a sub-node of the nxp,pca9530. 15 + 16 + Optional sub-node properties: 17 + - label: see Documentation/devicetree/bindings/leds/common.txt 18 + - type: Output configuration, see dt-bindings/leds/leds-pca9532.h (default NONE) 19 + - linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt 20 + 21 + Example: 22 + #include <dt-bindings/leds/leds-pca9532.h> 23 + 24 + leds: pca9530@60 { 25 + compatible = "nxp,pca9530"; 26 + reg = <0x60>; 27 + 28 + red-power { 29 + label = "pca:red:power"; 30 + type = <PCA9532_TYPE_LED>; 31 + }; 32 + green-power { 33 + label = "pca:green:power"; 34 + type = <PCA9532_TYPE_LED>; 35 + }; 36 + }; 37 + 38 + For more product information please see the link below: 39 + http://nxp.com/documents/data_sheet/PCA9532.pdf
+1 -1
Documentation/laptops/asus-laptop.txt
··· 72 72 echo 1 > /sys/class/leds/asus::mail/brightness 73 73 will switch the mail LED on. 74 74 You can also know if they are on/off by reading their content and use 75 - kernel triggers like ide-disk or heartbeat. 75 + kernel triggers like disk-activity or heartbeat. 76 76 77 77 Backlight 78 78 ---------
+1 -1
Documentation/leds/leds-class.txt
··· 11 11 The class also introduces the optional concept of an LED trigger. A trigger 12 12 is a kernel based source of led events. Triggers can either be simple or 13 13 complex. A simple trigger isn't configurable and is designed to slot into 14 - existing subsystems with minimal additional code. Examples are the ide-disk, 14 + existing subsystems with minimal additional code. Examples are the disk-activity, 15 15 nand-disk and sharpsl-charge triggers. With led triggers disabled, the code 16 16 optimises away. 17 17
+1
MAINTAINERS
··· 6783 6783 L: linux-leds@vger.kernel.org 6784 6784 T: git git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git 6785 6785 S: Maintained 6786 + F: Documentation/devicetree/bindings/leds/ 6786 6787 F: drivers/leds/ 6787 6788 F: include/linux/leds.h 6788 6789
+1 -1
arch/arm/boot/dts/am57xx-beagle-x15.dts
··· 86 86 led@3 { 87 87 label = "beagle-x15:usr3"; 88 88 gpios = <&gpio7 15 GPIO_ACTIVE_HIGH>; 89 - linux,default-trigger = "ide-disk"; 89 + linux,default-trigger = "disk-activity"; 90 90 default-state = "off"; 91 91 }; 92 92 };
+1 -1
arch/arm/boot/dts/kirkwood-ns2lite.dts
··· 26 26 blue-sata { 27 27 label = "ns2:blue:sata"; 28 28 gpios = <&gpio0 30 GPIO_ACTIVE_LOW>; 29 - linux,default-trigger = "ide-disk"; 29 + linux,default-trigger = "disk-activity"; 30 30 }; 31 31 }; 32 32 };
+1 -1
arch/arm/boot/dts/kirkwood-topkick.dts
··· 129 129 disk { 130 130 label = "topkick:yellow:disk"; 131 131 gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; 132 - linux,default-trigger = "ide-disk"; 132 + linux,default-trigger = "disk-activity"; 133 133 }; 134 134 system2 { 135 135 label = "topkick:red:system";
+1 -1
arch/arm/configs/collie_defconfig
··· 76 76 CONFIG_LEDS_LOCOMO=y 77 77 CONFIG_LEDS_TRIGGERS=y 78 78 CONFIG_LEDS_TRIGGER_TIMER=y 79 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 79 + CONFIG_LEDS_TRIGGER_DISK=y 80 80 # CONFIG_DNOTIFY is not set 81 81 CONFIG_VFAT_FS=y 82 82 CONFIG_TMPFS=y
+1 -1
arch/arm/configs/ixp4xx_defconfig
··· 180 180 CONFIG_LEDS_GPIO=y 181 181 CONFIG_LEDS_TRIGGERS=y 182 182 CONFIG_LEDS_TRIGGER_TIMER=y 183 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 183 + CONFIG_LEDS_TRIGGER_DISK=y 184 184 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 185 185 CONFIG_RTC_CLASS=y 186 186 CONFIG_RTC_DRV_ISL1208=y
+1 -1
arch/arm/mach-davinci/board-dm644x-evm.c
··· 288 288 { .name = "DS2", .active_low = 1, 289 289 .default_trigger = "mmc0", }, 290 290 { .name = "DS1", .active_low = 1, 291 - .default_trigger = "ide-disk", }, 291 + .default_trigger = "disk-activity", }, 292 292 }; 293 293 294 294 static const struct gpio_led_platform_data evm_led_data = {
+1 -1
arch/arm/mach-omap1/board-osk.c
··· 172 172 * Also, D9 requires non-battery power. 173 173 */ 174 174 { .gpio = OSK_TPS_GPIO_LED_D9, .name = "d9", 175 - .default_trigger = "ide-disk", }, 175 + .default_trigger = "disk-activity", }, 176 176 { .gpio = OSK_TPS_GPIO_LED_D2, .name = "d2", }, 177 177 { .gpio = OSK_TPS_GPIO_LED_D3, .name = "d3", .active_low = 1, 178 178 .default_trigger = "heartbeat", },
+1 -1
arch/arm/mach-pxa/spitz.c
··· 464 464 }, 465 465 { 466 466 .name = "spitz:green:hddactivity", 467 - .default_trigger = "ide-disk", 467 + .default_trigger = "disk-activity", 468 468 .gpio = SPITZ_GPIO_LED_GREEN, 469 469 }, 470 470 };
+1 -1
arch/mips/configs/malta_qemu_32r6_defconfig
··· 146 146 CONFIG_LEDS_CLASS=y 147 147 CONFIG_LEDS_TRIGGERS=y 148 148 CONFIG_LEDS_TRIGGER_TIMER=y 149 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 149 + CONFIG_LEDS_TRIGGER_DISK=y 150 150 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 151 151 CONFIG_LEDS_TRIGGER_BACKLIGHT=y 152 152 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+1 -1
arch/mips/configs/maltaaprp_defconfig
··· 147 147 CONFIG_LEDS_CLASS=y 148 148 CONFIG_LEDS_TRIGGERS=y 149 149 CONFIG_LEDS_TRIGGER_TIMER=y 150 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 150 + CONFIG_LEDS_TRIGGER_DISK=y 151 151 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 152 152 CONFIG_LEDS_TRIGGER_BACKLIGHT=y 153 153 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+1 -1
arch/mips/configs/maltasmvp_eva_defconfig
··· 152 152 CONFIG_LEDS_CLASS=y 153 153 CONFIG_LEDS_TRIGGERS=y 154 154 CONFIG_LEDS_TRIGGER_TIMER=y 155 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 155 + CONFIG_LEDS_TRIGGER_DISK=y 156 156 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 157 157 CONFIG_LEDS_TRIGGER_BACKLIGHT=y 158 158 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+1 -1
arch/mips/configs/maltaup_defconfig
··· 146 146 CONFIG_LEDS_CLASS=y 147 147 CONFIG_LEDS_TRIGGERS=y 148 148 CONFIG_LEDS_TRIGGER_TIMER=y 149 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 149 + CONFIG_LEDS_TRIGGER_DISK=y 150 150 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 151 151 CONFIG_LEDS_TRIGGER_BACKLIGHT=y 152 152 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+1 -1
arch/mips/configs/rbtx49xx_defconfig
··· 90 90 CONFIG_LEDS_CLASS=y 91 91 CONFIG_LEDS_GPIO=y 92 92 CONFIG_LEDS_TRIGGERS=y 93 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 93 + CONFIG_LEDS_TRIGGER_DISK=y 94 94 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 95 95 CONFIG_RTC_CLASS=y 96 96 CONFIG_RTC_INTF_DEV_UIE_EMUL=y
+1 -1
arch/mips/txx9/generic/setup.c
··· 727 727 int i; 728 728 static char *default_triggers[] __initdata = { 729 729 "heartbeat", 730 - "ide-disk", 730 + "disk-activity", 731 731 "nand-disk", 732 732 NULL, 733 733 };
+1 -1
arch/mips/txx9/rbtx4939/setup.c
··· 215 215 int i; 216 216 static char *default_triggers[] __initdata = { 217 217 "heartbeat", 218 - "ide-disk", 218 + "disk-activity", 219 219 "nand-disk", 220 220 }; 221 221
+1 -1
arch/parisc/configs/generic-32bit_defconfig
··· 214 214 CONFIG_LEDS_CLASS=y 215 215 CONFIG_LEDS_TRIGGERS=y 216 216 CONFIG_LEDS_TRIGGER_TIMER=y 217 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 217 + CONFIG_LEDS_TRIGGER_DISK=y 218 218 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 219 219 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y 220 220 CONFIG_DMADEVICES=y
+1 -1
arch/parisc/configs/generic-64bit_defconfig
··· 231 231 CONFIG_LEDS_TRIGGERS=y 232 232 CONFIG_LEDS_TRIGGER_TIMER=y 233 233 CONFIG_LEDS_TRIGGER_ONESHOT=y 234 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 234 + CONFIG_LEDS_TRIGGER_DISK=y 235 235 CONFIG_LEDS_TRIGGER_HEARTBEAT=m 236 236 CONFIG_LEDS_TRIGGER_BACKLIGHT=m 237 237 CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
+1 -1
arch/powerpc/boot/dts/mpc8315erdb.dts
··· 472 472 473 473 hdd { 474 474 gpios = <&mcu_pio 1 0>; 475 - linux,default-trigger = "ide-disk"; 475 + linux,default-trigger = "disk-activity"; 476 476 }; 477 477 }; 478 478 };
+1 -1
arch/powerpc/boot/dts/mpc8377_rdb.dts
··· 496 496 497 497 hdd { 498 498 gpios = <&mcu_pio 1 0>; 499 - linux,default-trigger = "ide-disk"; 499 + linux,default-trigger = "disk-activity"; 500 500 }; 501 501 }; 502 502 };
+1 -1
arch/powerpc/boot/dts/mpc8378_rdb.dts
··· 480 480 481 481 hdd { 482 482 gpios = <&mcu_pio 1 0>; 483 - linux,default-trigger = "ide-disk"; 483 + linux,default-trigger = "disk-activity"; 484 484 }; 485 485 }; 486 486 };
+1 -1
arch/powerpc/boot/dts/mpc8379_rdb.dts
··· 446 446 447 447 hdd { 448 448 gpios = <&mcu_pio 1 0>; 449 - linux,default-trigger = "ide-disk"; 449 + linux,default-trigger = "disk-activity"; 450 450 }; 451 451 }; 452 452 };
+1 -1
arch/powerpc/configs/pmac32_defconfig
··· 158 158 CONFIG_ADB_CUDA=y 159 159 CONFIG_ADB_PMU=y 160 160 CONFIG_ADB_PMU_LED=y 161 - CONFIG_ADB_PMU_LED_IDE=y 161 + CONFIG_ADB_PMU_LED_DISK=y 162 162 CONFIG_PMAC_APM_EMU=m 163 163 CONFIG_PMAC_MEDIABAY=y 164 164 CONFIG_PMAC_BACKLIGHT=y
+1 -1
arch/powerpc/configs/ppc6xx_defconfig
··· 442 442 CONFIG_ADB_CUDA=y 443 443 CONFIG_ADB_PMU=y 444 444 CONFIG_ADB_PMU_LED=y 445 - CONFIG_ADB_PMU_LED_IDE=y 445 + CONFIG_ADB_PMU_LED_DISK=y 446 446 CONFIG_PMAC_APM_EMU=y 447 447 CONFIG_PMAC_MEDIABAY=y 448 448 CONFIG_PMAC_BACKLIGHT=y
+1 -1
arch/unicore32/configs/unicore32_defconfig
··· 161 161 # LED Triggers 162 162 CONFIG_LEDS_TRIGGERS=y 163 163 CONFIG_LEDS_TRIGGER_TIMER=y 164 - CONFIG_LEDS_TRIGGER_IDE_DISK=y 164 + CONFIG_LEDS_TRIGGER_DISK=y 165 165 CONFIG_LEDS_TRIGGER_HEARTBEAT=y 166 166 167 167 # Real Time Clock
+1 -1
arch/unicore32/kernel/gpio.c
··· 27 27 { .name = "cpuhealth", .gpio = GPO_CPU_HEALTH, .active_low = 0, 28 28 .default_trigger = "heartbeat", }, 29 29 { .name = "hdd_led", .gpio = GPO_HDD_LED, .active_low = 1, 30 - .default_trigger = "ide-disk", }, 30 + .default_trigger = "disk-activity", }, 31 31 }; 32 32 33 33 static const struct gpio_led_platform_data puv3_gpio_led_data = {
+1 -1
drivers/Makefile
··· 122 122 obj-$(CONFIG_CPU_IDLE) += cpuidle/ 123 123 obj-y += mmc/ 124 124 obj-$(CONFIG_MEMSTICK) += memstick/ 125 - obj-y += leds/ 125 + obj-$(CONFIG_NEW_LEDS) += leds/ 126 126 obj-$(CONFIG_INFINIBAND) += infiniband/ 127 127 obj-$(CONFIG_SGI_SN) += sn/ 128 128 obj-y += firmware/
+4
drivers/ata/libata-core.c
··· 69 69 #include <asm/unaligned.h> 70 70 #include <linux/cdrom.h> 71 71 #include <linux/ratelimit.h> 72 + #include <linux/leds.h> 72 73 #include <linux/pm_runtime.h> 73 74 #include <linux/platform_device.h> 74 75 ··· 5078 5077 void ata_qc_complete(struct ata_queued_cmd *qc) 5079 5078 { 5080 5079 struct ata_port *ap = qc->ap; 5080 + 5081 + /* Trigger the LED (if available) */ 5082 + ledtrig_disk_activity(); 5081 5083 5082 5084 /* XXX: New EH and old EH use different mechanisms to 5083 5085 * synchronize EH with regular execution path.
+1 -1
drivers/ide/ide-disk.c
··· 186 186 BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED); 187 187 BUG_ON(rq->cmd_type != REQ_TYPE_FS); 188 188 189 - ledtrig_ide_activity(); 189 + ledtrig_disk_activity(); 190 190 191 191 pr_debug("%s: %sing: block=%llu, sectors=%u\n", 192 192 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
+14
drivers/leds/Kconfig
··· 228 228 To compile this driver as a module, choose M here: the 229 229 module will be called leds-lp3944. 230 230 231 + config LEDS_LP3952 232 + tristate "LED Support for TI LP3952 2 channel LED driver" 233 + depends on LEDS_CLASS 234 + depends on I2C 235 + depends on ACPI 236 + depends on GPIOLIB 237 + select REGMAP_I2C 238 + help 239 + This option enables support for LEDs connected to the Texas 240 + Instruments LP3952 LED driver. 241 + 242 + To compile this driver as a module, choose M here: the 243 + module will be called leds-lp3952. 244 + 231 245 config LEDS_LP55XX_COMMON 232 246 tristate "Common Driver for TI/National LP5521/5523/55231/5562/8501" 233 247 depends on LEDS_LP5521 || LEDS_LP5523 || LEDS_LP5562 || LEDS_LP8501
+1
drivers/leds/Makefile
··· 26 26 obj-$(CONFIG_LEDS_GPIO_REGISTER) += leds-gpio-register.o 27 27 obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o 28 28 obj-$(CONFIG_LEDS_LP3944) += leds-lp3944.o 29 + obj-$(CONFIG_LEDS_LP3952) += leds-lp3952.o 29 30 obj-$(CONFIG_LEDS_LP55XX_COMMON) += leds-lp55xx-common.o 30 31 obj-$(CONFIG_LEDS_LP5521) += leds-lp5521.o 31 32 obj-$(CONFIG_LEDS_LP5523) += leds-lp5523.o
+2
drivers/leds/led-triggers.c
··· 60 60 goto unlock; 61 61 } 62 62 } 63 + /* we come here only if buf matches no trigger */ 64 + ret = -EINVAL; 63 65 up_read(&triggers_list_lock); 64 66 65 67 unlock:
+3 -2
drivers/leds/leds-gpio.c
··· 165 165 return ERR_PTR(-ENOMEM); 166 166 167 167 device_for_each_child_node(dev, child) { 168 + struct gpio_led_data *led_dat = &priv->leds[priv->num_leds]; 168 169 struct gpio_led led = {}; 169 170 const char *state = NULL; 170 171 ··· 206 205 if (fwnode_property_present(child, "panic-indicator")) 207 206 led.panic_indicator = 1; 208 207 209 - ret = create_gpio_led(&led, &priv->leds[priv->num_leds], 210 - dev, NULL); 208 + ret = create_gpio_led(&led, led_dat, dev, NULL); 211 209 if (ret < 0) { 212 210 fwnode_handle_put(child); 213 211 goto err; 214 212 } 213 + led_dat->cdev.dev->of_node = np; 215 214 priv->num_leds++; 216 215 } 217 216
+1 -1
drivers/leds/leds-hp6xx.c
··· 50 50 51 51 static struct led_classdev hp6xx_green_led = { 52 52 .name = "hp6xx:green", 53 - .default_trigger = "ide-disk", 53 + .default_trigger = "disk-activity", 54 54 .brightness_set = hp6xxled_green_set, 55 55 .flags = LED_CORE_SUSPENDRESUME, 56 56 };
+15 -9
drivers/leds/leds-is31fl32xx.c
··· 422 422 return ret; 423 423 } 424 424 425 - static const struct of_device_id of_is31fl31xx_match[] = { 425 + static const struct of_device_id of_is31fl32xx_match[] = { 426 426 { .compatible = "issi,is31fl3236", .data = &is31fl3236_cdef, }, 427 427 { .compatible = "issi,is31fl3235", .data = &is31fl3235_cdef, }, 428 428 { .compatible = "issi,is31fl3218", .data = &is31fl3218_cdef, }, ··· 432 432 {}, 433 433 }; 434 434 435 - MODULE_DEVICE_TABLE(of, of_is31fl31xx_match); 435 + MODULE_DEVICE_TABLE(of, of_is31fl32xx_match); 436 436 437 437 static int is31fl32xx_probe(struct i2c_client *client, 438 438 const struct i2c_device_id *id) ··· 444 444 int count; 445 445 int ret = 0; 446 446 447 - of_dev_id = of_match_device(of_is31fl31xx_match, dev); 447 + of_dev_id = of_match_device(of_is31fl32xx_match, dev); 448 448 if (!of_dev_id) 449 449 return -EINVAL; 450 450 ··· 482 482 } 483 483 484 484 /* 485 - * i2c-core requires that id_table be non-NULL, even though 486 - * it is not used for DeviceTree based instantiation. 485 + * i2c-core (and modalias) requires that id_table be properly filled, 486 + * even though it is not used for DeviceTree based instantiation. 487 487 */ 488 - static const struct i2c_device_id is31fl31xx_id[] = { 488 + static const struct i2c_device_id is31fl32xx_id[] = { 489 + { "is31fl3236" }, 490 + { "is31fl3235" }, 491 + { "is31fl3218" }, 492 + { "sn3218" }, 493 + { "is31fl3216" }, 494 + { "sn3216" }, 489 495 {}, 490 496 }; 491 497 492 - MODULE_DEVICE_TABLE(i2c, is31fl31xx_id); 498 + MODULE_DEVICE_TABLE(i2c, is31fl32xx_id); 493 499 494 500 static struct i2c_driver is31fl32xx_driver = { 495 501 .driver = { 496 502 .name = "is31fl32xx", 497 - .of_match_table = of_is31fl31xx_match, 503 + .of_match_table = of_is31fl32xx_match, 498 504 }, 499 505 .probe = is31fl32xx_probe, 500 506 .remove = is31fl32xx_remove, 501 - .id_table = is31fl31xx_id, 507 + .id_table = is31fl32xx_id, 502 508 }; 503 509 504 510 module_i2c_driver(is31fl32xx_driver);
+301
drivers/leds/leds-lp3952.c
··· 1 + /* 2 + * LED driver for TI lp3952 controller 3 + * 4 + * Copyright (C) 2016, DAQRI, LLC. 5 + * Author: Tony Makkiel <tony.makkiel@daqri.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + * 11 + */ 12 + 13 + #include <linux/acpi.h> 14 + #include <linux/delay.h> 15 + #include <linux/gpio.h> 16 + #include <linux/i2c.h> 17 + #include <linux/io.h> 18 + #include <linux/kernel.h> 19 + #include <linux/leds.h> 20 + #include <linux/leds-lp3952.h> 21 + #include <linux/module.h> 22 + #include <linux/notifier.h> 23 + #include <linux/platform_device.h> 24 + #include <linux/pm.h> 25 + #include <linux/reboot.h> 26 + #include <linux/regmap.h> 27 + 28 + static int lp3952_register_write(struct i2c_client *client, u8 reg, u8 val) 29 + { 30 + int ret; 31 + struct lp3952_led_array *priv = i2c_get_clientdata(client); 32 + 33 + ret = regmap_write(priv->regmap, reg, val); 34 + 35 + if (ret) 36 + dev_err(&client->dev, "%s: reg 0x%x, val 0x%x, err %d\n", 37 + __func__, reg, val, ret); 38 + return ret; 39 + } 40 + 41 + static void lp3952_on_off(struct lp3952_led_array *priv, 42 + enum lp3952_leds led_id, bool on) 43 + { 44 + int ret, val; 45 + 46 + dev_dbg(&priv->client->dev, "%s LED %d to %d\n", __func__, led_id, on); 47 + 48 + val = 1 << led_id; 49 + if (led_id == LP3952_LED_ALL) 50 + val = LP3952_LED_MASK_ALL; 51 + 52 + ret = regmap_update_bits(priv->regmap, LP3952_REG_LED_CTRL, val, 53 + on ? val : 0); 54 + if (ret) 55 + dev_err(&priv->client->dev, "%s, Error %d\n", __func__, ret); 56 + } 57 + 58 + /* 59 + * Using Imax to control brightness. There are 4 possible 60 + * setting 25, 50, 75 and 100 % of Imax. Possible values are 61 + * values 0-4. 0 meaning turn off. 62 + */ 63 + static int lp3952_set_brightness(struct led_classdev *cdev, 64 + enum led_brightness value) 65 + { 66 + unsigned int reg, shift_val; 67 + struct lp3952_ctrl_hdl *led = container_of(cdev, 68 + struct lp3952_ctrl_hdl, 69 + cdev); 70 + struct lp3952_led_array *priv = (struct lp3952_led_array *)led->priv; 71 + 72 + dev_dbg(cdev->dev, "Brightness request: %d on %d\n", value, 73 + led->channel); 74 + 75 + if (value == LED_OFF) { 76 + lp3952_on_off(priv, led->channel, false); 77 + return 0; 78 + } 79 + 80 + if (led->channel > LP3952_RED_1) { 81 + dev_err(cdev->dev, " %s Invalid LED requested", __func__); 82 + return -EINVAL; 83 + } 84 + 85 + if (led->channel >= LP3952_BLUE_1) { 86 + reg = LP3952_REG_RGB1_MAX_I_CTRL; 87 + shift_val = (led->channel - LP3952_BLUE_1) * 2; 88 + } else { 89 + reg = LP3952_REG_RGB2_MAX_I_CTRL; 90 + shift_val = led->channel * 2; 91 + } 92 + 93 + /* Enable the LED in case it is not enabled already */ 94 + lp3952_on_off(priv, led->channel, true); 95 + 96 + return regmap_update_bits(priv->regmap, reg, 3 << shift_val, 97 + --value << shift_val); 98 + } 99 + 100 + static int lp3952_get_label(struct device *dev, const char *label, char *dest) 101 + { 102 + int ret; 103 + const char *str; 104 + 105 + ret = device_property_read_string(dev, label, &str); 106 + if (!ret) 107 + strncpy(dest, str, LP3952_LABEL_MAX_LEN); 108 + 109 + return ret; 110 + } 111 + 112 + static int lp3952_register_led_classdev(struct lp3952_led_array *priv) 113 + { 114 + int i, acpi_ret, ret = -ENODEV; 115 + static const char *led_name_hdl[LP3952_LED_ALL] = { 116 + "blue2", 117 + "green2", 118 + "red2", 119 + "blue1", 120 + "green1", 121 + "red1" 122 + }; 123 + 124 + for (i = 0; i < LP3952_LED_ALL; i++) { 125 + acpi_ret = lp3952_get_label(&priv->client->dev, led_name_hdl[i], 126 + priv->leds[i].name); 127 + if (acpi_ret) 128 + continue; 129 + 130 + priv->leds[i].cdev.name = priv->leds[i].name; 131 + priv->leds[i].cdev.brightness = LED_OFF; 132 + priv->leds[i].cdev.max_brightness = LP3952_BRIGHT_MAX; 133 + priv->leds[i].cdev.brightness_set_blocking = 134 + lp3952_set_brightness; 135 + priv->leds[i].channel = i; 136 + priv->leds[i].priv = priv; 137 + 138 + ret = devm_led_classdev_register(&priv->client->dev, 139 + &priv->leds[i].cdev); 140 + if (ret < 0) { 141 + dev_err(&priv->client->dev, 142 + "couldn't register LED %s\n", 143 + priv->leds[i].cdev.name); 144 + break; 145 + } 146 + } 147 + return ret; 148 + } 149 + 150 + static int lp3952_set_pattern_gen_cmd(struct lp3952_led_array *priv, 151 + u8 cmd_index, u8 r, u8 g, u8 b, 152 + enum lp3952_tt tt, enum lp3952_cet cet) 153 + { 154 + int ret; 155 + struct ptrn_gen_cmd line = { 156 + { 157 + { 158 + .r = r, 159 + .g = g, 160 + .b = b, 161 + .cet = cet, 162 + .tt = tt 163 + } 164 + } 165 + }; 166 + 167 + if (cmd_index >= LP3952_CMD_REG_COUNT) 168 + return -EINVAL; 169 + 170 + ret = lp3952_register_write(priv->client, 171 + LP3952_REG_CMD_0 + cmd_index * 2, 172 + line.bytes.msb); 173 + if (ret) 174 + return ret; 175 + 176 + return lp3952_register_write(priv->client, 177 + LP3952_REG_CMD_0 + cmd_index * 2 + 1, 178 + line.bytes.lsb); 179 + } 180 + 181 + static int lp3952_configure(struct lp3952_led_array *priv) 182 + { 183 + int ret; 184 + 185 + /* Disable any LEDs on from any previous conf. */ 186 + ret = lp3952_register_write(priv->client, LP3952_REG_LED_CTRL, 0); 187 + if (ret) 188 + return ret; 189 + 190 + /* enable rgb patter, loop */ 191 + ret = lp3952_register_write(priv->client, LP3952_REG_PAT_GEN_CTRL, 192 + LP3952_PATRN_LOOP | LP3952_PATRN_GEN_EN); 193 + if (ret) 194 + return ret; 195 + 196 + /* Update Bit 6 (Active mode), Select both Led sets, Bit [1:0] */ 197 + ret = lp3952_register_write(priv->client, LP3952_REG_ENABLES, 198 + LP3952_ACTIVE_MODE | LP3952_INT_B00ST_LDR); 199 + if (ret) 200 + return ret; 201 + 202 + /* Set Cmd1 for RGB intensity,cmd and transition time */ 203 + return lp3952_set_pattern_gen_cmd(priv, 0, I46, I71, I100, TT0, 204 + CET197); 205 + } 206 + 207 + static const struct regmap_config lp3952_regmap = { 208 + .reg_bits = 8, 209 + .val_bits = 8, 210 + .max_register = REG_MAX, 211 + .cache_type = REGCACHE_RBTREE, 212 + }; 213 + 214 + static int lp3952_probe(struct i2c_client *client, 215 + const struct i2c_device_id *id) 216 + { 217 + int status; 218 + struct lp3952_led_array *priv; 219 + 220 + priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); 221 + if (!priv) 222 + return -ENOMEM; 223 + 224 + priv->client = client; 225 + 226 + priv->enable_gpio = devm_gpiod_get(&client->dev, "nrst", 227 + GPIOD_OUT_HIGH); 228 + if (IS_ERR(priv->enable_gpio)) { 229 + status = PTR_ERR(priv->enable_gpio); 230 + dev_err(&client->dev, "Failed to enable gpio: %d\n", status); 231 + return status; 232 + } 233 + 234 + priv->regmap = devm_regmap_init_i2c(client, &lp3952_regmap); 235 + if (IS_ERR(priv->regmap)) { 236 + int err = PTR_ERR(priv->regmap); 237 + 238 + dev_err(&client->dev, "Failed to allocate register map: %d\n", 239 + err); 240 + return err; 241 + } 242 + 243 + i2c_set_clientdata(client, priv); 244 + 245 + status = lp3952_configure(priv); 246 + if (status) { 247 + dev_err(&client->dev, "Probe failed. Device not found (%d)\n", 248 + status); 249 + return status; 250 + } 251 + 252 + status = lp3952_register_led_classdev(priv); 253 + if (status) { 254 + dev_err(&client->dev, "Unable to register led_classdev: %d\n", 255 + status); 256 + return status; 257 + } 258 + 259 + return 0; 260 + } 261 + 262 + static int lp3952_remove(struct i2c_client *client) 263 + { 264 + struct lp3952_led_array *priv; 265 + 266 + priv = i2c_get_clientdata(client); 267 + lp3952_on_off(priv, LP3952_LED_ALL, false); 268 + gpiod_set_value(priv->enable_gpio, 0); 269 + 270 + return 0; 271 + } 272 + 273 + static const struct i2c_device_id lp3952_id[] = { 274 + {LP3952_NAME, 0}, 275 + {} 276 + }; 277 + 278 + #ifdef CONFIG_ACPI 279 + static const struct acpi_device_id lp3952_acpi_match[] = { 280 + {"TXNW3952", 0}, 281 + {} 282 + }; 283 + 284 + MODULE_DEVICE_TABLE(acpi, lp3952_acpi_match); 285 + #endif 286 + 287 + static struct i2c_driver lp3952_i2c_driver = { 288 + .driver = { 289 + .name = LP3952_NAME, 290 + .acpi_match_table = ACPI_PTR(lp3952_acpi_match), 291 + }, 292 + .probe = lp3952_probe, 293 + .remove = lp3952_remove, 294 + .id_table = lp3952_id, 295 + }; 296 + 297 + module_i2c_driver(lp3952_i2c_driver); 298 + 299 + MODULE_AUTHOR("Tony Makkiel <tony.makkiel@daqri.com>"); 300 + MODULE_DESCRIPTION("lp3952 I2C LED controller driver"); 301 + MODULE_LICENSE("GPL v2");
+70 -3
drivers/leds/leds-pca9532.c
··· 21 21 #include <linux/workqueue.h> 22 22 #include <linux/leds-pca9532.h> 23 23 #include <linux/gpio.h> 24 + #include <linux/of.h> 25 + #include <linux/of_device.h> 24 26 25 27 /* m = num_leds*/ 26 28 #define PCA9532_REG_INPUT(i) ((i) >> 3) ··· 88 86 }, 89 87 }; 90 88 89 + #ifdef CONFIG_OF 90 + static const struct of_device_id of_pca9532_leds_match[] = { 91 + { .compatible = "nxp,pca9530", .data = (void *)pca9530 }, 92 + { .compatible = "nxp,pca9531", .data = (void *)pca9531 }, 93 + { .compatible = "nxp,pca9532", .data = (void *)pca9532 }, 94 + { .compatible = "nxp,pca9533", .data = (void *)pca9533 }, 95 + {}, 96 + }; 97 + 98 + MODULE_DEVICE_TABLE(of, of_pca9532_leds_match); 99 + #endif 100 + 91 101 static struct i2c_driver pca9532_driver = { 92 102 .driver = { 93 103 .name = "leds-pca953x", 104 + .of_match_table = of_match_ptr(of_pca9532_leds_match), 94 105 }, 95 106 .probe = pca9532_probe, 96 107 .remove = pca9532_remove, ··· 369 354 led->state = pled->state; 370 355 led->name = pled->name; 371 356 led->ldev.name = led->name; 357 + led->ldev.default_trigger = led->default_trigger; 372 358 led->ldev.brightness = LED_OFF; 373 359 led->ldev.brightness_set_blocking = 374 360 pca9532_set_brightness; ··· 448 432 return err; 449 433 } 450 434 435 + static struct pca9532_platform_data * 436 + pca9532_of_populate_pdata(struct device *dev, struct device_node *np) 437 + { 438 + struct pca9532_platform_data *pdata; 439 + struct device_node *child; 440 + const struct of_device_id *match; 441 + int devid, maxleds; 442 + int i = 0; 443 + 444 + match = of_match_device(of_pca9532_leds_match, dev); 445 + if (!match) 446 + return ERR_PTR(-ENODEV); 447 + 448 + devid = (int)(uintptr_t)match->data; 449 + maxleds = pca9532_chip_info_tbl[devid].num_leds; 450 + 451 + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 452 + if (!pdata) 453 + return ERR_PTR(-ENOMEM); 454 + 455 + for_each_child_of_node(np, child) { 456 + if (of_property_read_string(child, "label", 457 + &pdata->leds[i].name)) 458 + pdata->leds[i].name = child->name; 459 + of_property_read_u32(child, "type", &pdata->leds[i].type); 460 + of_property_read_string(child, "linux,default-trigger", 461 + &pdata->leds[i].default_trigger); 462 + if (++i >= maxleds) { 463 + of_node_put(child); 464 + break; 465 + } 466 + } 467 + 468 + return pdata; 469 + } 470 + 451 471 static int pca9532_probe(struct i2c_client *client, 452 472 const struct i2c_device_id *id) 453 473 { 474 + int devid; 454 475 struct pca9532_data *data = i2c_get_clientdata(client); 455 476 struct pca9532_platform_data *pca9532_pdata = 456 477 dev_get_platdata(&client->dev); 478 + struct device_node *np = client->dev.of_node; 457 479 458 - if (!pca9532_pdata) 459 - return -EIO; 480 + if (!pca9532_pdata) { 481 + if (np) { 482 + pca9532_pdata = 483 + pca9532_of_populate_pdata(&client->dev, np); 484 + if (IS_ERR(pca9532_pdata)) 485 + return PTR_ERR(pca9532_pdata); 486 + } else { 487 + dev_err(&client->dev, "no platform data\n"); 488 + return -EINVAL; 489 + } 490 + devid = (int)(uintptr_t)of_match_device( 491 + of_pca9532_leds_match, &client->dev)->data; 492 + } else { 493 + devid = id->driver_data; 494 + } 460 495 461 496 if (!i2c_check_functionality(client->adapter, 462 497 I2C_FUNC_SMBUS_BYTE_DATA)) ··· 517 450 if (!data) 518 451 return -ENOMEM; 519 452 520 - data->chip_info = &pca9532_chip_info_tbl[id->driver_data]; 453 + data->chip_info = &pca9532_chip_info_tbl[devid]; 521 454 522 455 dev_info(&client->dev, "setting platform data\n"); 523 456 i2c_set_clientdata(client, data);
+4 -4
drivers/leds/trigger/Kconfig
··· 33 33 34 34 If unsure, say Y. 35 35 36 - config LEDS_TRIGGER_IDE_DISK 37 - bool "LED IDE Disk Trigger" 38 - depends on IDE_GD_ATA 36 + config LEDS_TRIGGER_DISK 37 + bool "LED Disk Trigger" 38 + depends on IDE_GD_ATA || ATA 39 39 depends on LEDS_TRIGGERS 40 40 help 41 - This allows LEDs to be controlled by IDE disk activity. 41 + This allows LEDs to be controlled by disk activity. 42 42 If unsure, say Y. 43 43 44 44 config LEDS_TRIGGER_MTD
+1 -1
drivers/leds/trigger/Makefile
··· 1 1 obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o 2 2 obj-$(CONFIG_LEDS_TRIGGER_ONESHOT) += ledtrig-oneshot.o 3 - obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o 3 + obj-$(CONFIG_LEDS_TRIGGER_DISK) += ledtrig-disk.o 4 4 obj-$(CONFIG_LEDS_TRIGGER_MTD) += ledtrig-mtd.o 5 5 obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o 6 6 obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o
+12 -7
drivers/leds/trigger/ledtrig-ide-disk.c drivers/leds/trigger/ledtrig-disk.c
··· 1 1 /* 2 - * LED IDE-Disk Activity Trigger 2 + * LED Disk Activity Trigger 3 3 * 4 4 * Copyright 2006 Openedhand Ltd. 5 5 * ··· 17 17 18 18 #define BLINK_DELAY 30 19 19 20 + DEFINE_LED_TRIGGER(ledtrig_disk); 20 21 DEFINE_LED_TRIGGER(ledtrig_ide); 21 22 22 - void ledtrig_ide_activity(void) 23 + void ledtrig_disk_activity(void) 23 24 { 24 - unsigned long ide_blink_delay = BLINK_DELAY; 25 + unsigned long blink_delay = BLINK_DELAY; 25 26 27 + led_trigger_blink_oneshot(ledtrig_disk, 28 + &blink_delay, &blink_delay, 0); 26 29 led_trigger_blink_oneshot(ledtrig_ide, 27 - &ide_blink_delay, &ide_blink_delay, 0); 30 + &blink_delay, &blink_delay, 0); 28 31 } 29 - EXPORT_SYMBOL(ledtrig_ide_activity); 32 + EXPORT_SYMBOL(ledtrig_disk_activity); 30 33 31 - static int __init ledtrig_ide_init(void) 34 + static int __init ledtrig_disk_init(void) 32 35 { 36 + led_trigger_register_simple("disk-activity", &ledtrig_disk); 33 37 led_trigger_register_simple("ide-disk", &ledtrig_ide); 38 + 34 39 return 0; 35 40 } 36 - device_initcall(ledtrig_ide_init); 41 + device_initcall(ledtrig_disk_init);
+6 -7
drivers/macintosh/Kconfig
··· 96 96 Support the front LED on Power/iBooks as a generic LED that can 97 97 be triggered by any of the supported triggers. To get the 98 98 behaviour of the old CONFIG_BLK_DEV_IDE_PMAC_BLINK, select this 99 - and the ide-disk LED trigger and configure appropriately through 100 - sysfs. 99 + and the disk LED trigger and configure appropriately through sysfs. 101 100 102 - config ADB_PMU_LED_IDE 103 - bool "Use front LED as IDE LED by default" 101 + config ADB_PMU_LED_DISK 102 + bool "Use front LED as DISK LED by default" 104 103 depends on ADB_PMU_LED 105 104 depends on LEDS_CLASS 106 105 depends on IDE_GD_ATA 107 106 select LEDS_TRIGGERS 108 - select LEDS_TRIGGER_IDE_DISK 107 + select LEDS_TRIGGER_DISK 109 108 help 110 - This option makes the front LED default to the IDE trigger 111 - so that it blinks on IDE activity. 109 + This option makes the front LED default to the disk trigger 110 + so that it blinks on disk activity. 112 111 113 112 config PMAC_SMU 114 113 bool "Support for SMU based PowerMacs"
+2 -2
drivers/macintosh/via-pmu-led.c
··· 73 73 74 74 static struct led_classdev pmu_led = { 75 75 .name = "pmu-led::front", 76 - #ifdef CONFIG_ADB_PMU_LED_IDE 77 - .default_trigger = "ide-disk", 76 + #ifdef CONFIG_ADB_PMU_LED_DISK 77 + .default_trigger = "disk-activity", 78 78 #endif 79 79 .brightness_set = pmu_led_set, 80 80 };
+18
include/dt-bindings/leds/leds-pca9532.h
··· 1 + /* 2 + * This header provides constants for pca9532 LED bindings. 3 + * 4 + * This file is licensed under the terms of the GNU General Public 5 + * License version 2. This program is licensed "as is" without any 6 + * warranty of any kind, whether express or implied. 7 + */ 8 + 9 + #ifndef _DT_BINDINGS_LEDS_PCA9532_H 10 + #define _DT_BINDINGS_LEDS_PCA9532_H 11 + 12 + #define PCA9532_TYPE_NONE 0 13 + #define PCA9532_TYPE_LED 1 14 + #define PCA9532_TYPE_N2100_BEEP 2 15 + #define PCA9532_TYPE_GPIO 3 16 + #define PCA9532_LED_TIMER2 4 17 + 18 + #endif /* _DT_BINDINGS_LEDS_PCA9532_H */
+125
include/linux/leds-lp3952.h
··· 1 + /* 2 + * LED driver for TI lp3952 controller 3 + * 4 + * Copyright (C) 2016, DAQRI, LLC. 5 + * Author: Tony Makkiel <tony.makkiel@daqri.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + * 11 + */ 12 + 13 + #ifndef LEDS_LP3952_H_ 14 + #define LEDS_LP3952_H_ 15 + 16 + #define LP3952_NAME "lp3952" 17 + #define LP3952_CMD_REG_COUNT 8 18 + #define LP3952_BRIGHT_MAX 4 19 + #define LP3952_LABEL_MAX_LEN 15 20 + 21 + #define LP3952_REG_LED_CTRL 0x00 22 + #define LP3952_REG_R1_BLNK_TIME_CTRL 0x01 23 + #define LP3952_REG_R1_BLNK_CYCLE_CTRL 0x02 24 + #define LP3952_REG_G1_BLNK_TIME_CTRL 0x03 25 + #define LP3952_REG_G1_BLNK_CYCLE_CTRL 0x04 26 + #define LP3952_REG_B1_BLNK_TIME_CTRL 0x05 27 + #define LP3952_REG_B1_BLNK_CYCLE_CTRL 0x06 28 + #define LP3952_REG_ENABLES 0x0B 29 + #define LP3952_REG_PAT_GEN_CTRL 0x11 30 + #define LP3952_REG_RGB1_MAX_I_CTRL 0x12 31 + #define LP3952_REG_RGB2_MAX_I_CTRL 0x13 32 + #define LP3952_REG_CMD_0 0x50 33 + #define LP3952_REG_RESET 0x60 34 + #define REG_MAX LP3952_REG_RESET 35 + 36 + #define LP3952_PATRN_LOOP BIT(1) 37 + #define LP3952_PATRN_GEN_EN BIT(2) 38 + #define LP3952_INT_B00ST_LDR BIT(2) 39 + #define LP3952_ACTIVE_MODE BIT(6) 40 + #define LP3952_LED_MASK_ALL 0x3f 41 + 42 + /* Transition Time in ms */ 43 + enum lp3952_tt { 44 + TT0, 45 + TT55, 46 + TT110, 47 + TT221, 48 + TT422, 49 + TT885, 50 + TT1770, 51 + TT3539 52 + }; 53 + 54 + /* Command Execution Time in ms */ 55 + enum lp3952_cet { 56 + CET197, 57 + CET393, 58 + CET590, 59 + CET786, 60 + CET1180, 61 + CET1376, 62 + CET1573, 63 + CET1769, 64 + CET1966, 65 + CET2163, 66 + CET2359, 67 + CET2556, 68 + CET2763, 69 + CET2949, 70 + CET3146 71 + }; 72 + 73 + /* Max Current in % */ 74 + enum lp3952_colour_I_log_0 { 75 + I0, 76 + I7, 77 + I14, 78 + I21, 79 + I32, 80 + I46, 81 + I71, 82 + I100 83 + }; 84 + 85 + enum lp3952_leds { 86 + LP3952_BLUE_2, 87 + LP3952_GREEN_2, 88 + LP3952_RED_2, 89 + LP3952_BLUE_1, 90 + LP3952_GREEN_1, 91 + LP3952_RED_1, 92 + LP3952_LED_ALL 93 + }; 94 + 95 + struct lp3952_ctrl_hdl { 96 + struct led_classdev cdev; 97 + char name[LP3952_LABEL_MAX_LEN]; 98 + enum lp3952_leds channel; 99 + void *priv; 100 + }; 101 + 102 + struct ptrn_gen_cmd { 103 + union { 104 + struct { 105 + u16 tt:3; 106 + u16 b:3; 107 + u16 cet:4; 108 + u16 g:3; 109 + u16 r:3; 110 + }; 111 + struct { 112 + u8 lsb; 113 + u8 msb; 114 + } bytes; 115 + }; 116 + } __packed; 117 + 118 + struct lp3952_led_array { 119 + struct regmap *regmap; 120 + struct i2c_client *client; 121 + struct gpio_desc *enable_gpio; 122 + struct lp3952_ctrl_hdl leds[LP3952_LED_ALL]; 123 + }; 124 + 125 + #endif /* LEDS_LP3952_H_ */
+4 -5
include/linux/leds-pca9532.h
··· 16 16 17 17 #include <linux/leds.h> 18 18 #include <linux/workqueue.h> 19 + #include <dt-bindings/leds/leds-pca9532.h> 19 20 20 21 enum pca9532_state { 21 22 PCA9532_OFF = 0x0, ··· 25 24 PCA9532_PWM1 = 0x3 26 25 }; 27 26 28 - enum pca9532_type { PCA9532_TYPE_NONE, PCA9532_TYPE_LED, 29 - PCA9532_TYPE_N2100_BEEP, PCA9532_TYPE_GPIO }; 30 - 31 27 struct pca9532_led { 32 28 u8 id; 33 29 struct i2c_client *client; 34 - char *name; 30 + const char *name; 31 + const char *default_trigger; 35 32 struct led_classdev ldev; 36 33 struct work_struct work; 37 - enum pca9532_type type; 34 + u32 type; 38 35 enum pca9532_state state; 39 36 }; 40 37
+11 -3
include/linux/leds.h
··· 325 325 #endif /* CONFIG_LEDS_TRIGGERS */ 326 326 327 327 /* Trigger specific functions */ 328 - #ifdef CONFIG_LEDS_TRIGGER_IDE_DISK 329 - extern void ledtrig_ide_activity(void); 328 + #ifdef CONFIG_LEDS_TRIGGER_DISK 329 + extern void ledtrig_disk_activity(void); 330 330 #else 331 - static inline void ledtrig_ide_activity(void) {} 331 + static inline void ledtrig_disk_activity(void) {} 332 332 #endif 333 333 334 334 #ifdef CONFIG_LEDS_TRIGGER_MTD ··· 387 387 unsigned long *delay_off); 388 388 }; 389 389 390 + #ifdef CONFIG_NEW_LEDS 390 391 struct platform_device *gpio_led_register_device( 391 392 int id, const struct gpio_led_platform_data *pdata); 393 + #else 394 + static inline struct platform_device *gpio_led_register_device( 395 + int id, const struct gpio_led_platform_data *pdata) 396 + { 397 + return 0; 398 + } 399 + #endif 392 400 393 401 enum cpu_led_event { 394 402 CPU_LED_IDLE_START, /* CPU enters idle */