Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds

* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds:
leds: Fix race between LED device uevent and actual attributes creation
leds-gpio: fix default state handling on OF platforms
leds: Add Dell Business Class Netbook LED driver
leds: Kconfig cleanup
leds: led-class.c - Quiet boot messages
leds: make PCI device id constant
leds: ALIX2: Add dependency to !GPIO_CS5335

+257 -71
+45 -35
drivers/leds/Kconfig
··· 15 This option enables the led sysfs class in /sys/class/leds. You'll 16 need this to do anything useful with LEDs. If unsure, say N. 17 18 comment "LED drivers" 19 20 config LEDS_88PM860X ··· 28 29 config LEDS_ATMEL_PWM 30 tristate "LED Support using Atmel PWM outputs" 31 - depends on LEDS_CLASS && ATMEL_PWM 32 help 33 This option enables support for LEDs driven using outputs 34 of the dedicated PWM controller found on newer Atmel SOCs. 35 36 config LEDS_LOCOMO 37 tristate "LED Support for Locomo device" 38 - depends on LEDS_CLASS && SHARP_LOCOMO 39 help 40 This option enables support for the LEDs on Sharp Locomo. 41 Zaurus models SL-5500 and SL-5600. 42 43 config LEDS_MIKROTIK_RB532 44 tristate "LED Support for Mikrotik Routerboard 532" 45 - depends on LEDS_CLASS && MIKROTIK_RB532 46 help 47 This option enables support for the so called "User LED" of 48 Mikrotik's Routerboard 532. 49 50 config LEDS_S3C24XX 51 tristate "LED Support for Samsung S3C24XX GPIO LEDs" 52 - depends on LEDS_CLASS && ARCH_S3C2410 53 help 54 This option enables support for LEDs connected to GPIO lines 55 on Samsung S3C24XX series CPUs, such as the S3C2410 and S3C2440. 56 57 config LEDS_AMS_DELTA 58 tristate "LED Support for the Amstrad Delta (E3)" 59 - depends on LEDS_CLASS && MACH_AMS_DELTA 60 help 61 This option enables support for the LEDs on Amstrad Delta (E3). 62 63 config LEDS_NET48XX 64 tristate "LED Support for Soekris net48xx series Error LED" 65 - depends on LEDS_CLASS && SCx200_GPIO 66 help 67 This option enables support for the Soekris net4801 and net4826 error 68 LED. 69 70 config LEDS_FSG 71 tristate "LED Support for the Freecom FSG-3" 72 - depends on LEDS_CLASS && MACH_FSG 73 help 74 This option enables support for the LEDs on the Freecom FSG-3. 75 76 config LEDS_WRAP 77 tristate "LED Support for the WRAP series LEDs" 78 - depends on LEDS_CLASS && SCx200_GPIO 79 help 80 This option enables support for the PCEngines WRAP programmable LEDs. 81 82 config LEDS_ALIX2 83 tristate "LED Support for ALIX.2 and ALIX.3 series" 84 - depends on LEDS_CLASS && X86 && EXPERIMENTAL 85 help 86 This option enables support for the PCEngines ALIX.2 and ALIX.3 LEDs. 87 You have to set leds-alix2.force=1 for boards with Award BIOS. 88 89 config LEDS_H1940 90 tristate "LED Support for iPAQ H1940 device" 91 - depends on LEDS_CLASS && ARCH_H1940 92 help 93 This option enables support for the LEDs on the h1940. 94 95 config LEDS_COBALT_QUBE 96 tristate "LED Support for the Cobalt Qube series front LED" 97 - depends on LEDS_CLASS && MIPS_COBALT 98 help 99 This option enables support for the front LED on Cobalt Qube series 100 ··· 107 108 config LEDS_SUNFIRE 109 tristate "LED support for SunFire servers." 110 - depends on LEDS_CLASS && SPARC64 111 select LEDS_TRIGGERS 112 help 113 This option enables support for the Left, Middle, and Right ··· 115 116 config LEDS_HP6XX 117 tristate "LED Support for the HP Jornada 6xx" 118 - depends on LEDS_CLASS && SH_HP6XX 119 help 120 This option enables LED support for the handheld 121 HP Jornada 620/660/680/690. 122 123 config LEDS_PCA9532 124 tristate "LED driver for PCA9532 dimmer" 125 - depends on LEDS_CLASS && I2C && INPUT && EXPERIMENTAL 126 help 127 This option enables support for NXP pca9532 128 LED controller. It is generally only useful ··· 130 131 config LEDS_GPIO 132 tristate "LED Support for GPIO connected LEDs" 133 - depends on LEDS_CLASS && GENERIC_GPIO 134 help 135 This option enables support for the LEDs connected to GPIO 136 outputs. To be useful the particular board must have LEDs ··· 157 158 config LEDS_LP3944 159 tristate "LED Support for N.S. LP3944 (Fun Light) I2C chip" 160 - depends on LEDS_CLASS && I2C 161 help 162 This option enables support for LEDs connected to the National 163 Semiconductor LP3944 Lighting Management Unit (LMU) also known as ··· 168 169 config LEDS_CLEVO_MAIL 170 tristate "Mail LED on Clevo notebook" 171 - depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI 172 help 173 This driver makes the mail LED accessible from userspace 174 programs through the leds subsystem. This LED have three ··· 198 199 config LEDS_PCA955X 200 tristate "LED Support for PCA955x I2C chips" 201 - depends on LEDS_CLASS && I2C 202 help 203 This option enables support for LEDs connected to PCA955x 204 LED driver chips accessed via the I2C bus. Supported ··· 206 207 config LEDS_WM831X_STATUS 208 tristate "LED support for status LEDs on WM831x PMICs" 209 - depends on LEDS_CLASS && MFD_WM831X 210 help 211 This option enables support for the status LEDs of the WM831x 212 series of PMICs. 213 214 config LEDS_WM8350 215 tristate "LED Support for WM8350 AudioPlus PMIC" 216 - depends on LEDS_CLASS && MFD_WM8350 217 help 218 This option enables support for LEDs driven by the Wolfson 219 Microelectronics WM8350 AudioPlus PMIC. 220 221 config LEDS_DA903X 222 tristate "LED Support for DA9030/DA9034 PMIC" 223 - depends on LEDS_CLASS && PMIC_DA903X 224 help 225 This option enables support for on-chip LED drivers found 226 on Dialog Semiconductor DA9030/DA9034 PMICs. 227 228 config LEDS_DAC124S085 229 tristate "LED Support for DAC124S085 SPI DAC" 230 - depends on LEDS_CLASS && SPI 231 help 232 This option enables support for DAC124S085 SPI DAC from NatSemi, 233 which can be used to control up to four LEDs. 234 235 config LEDS_PWM 236 tristate "PWM driven LED Support" 237 - depends on LEDS_CLASS && HAVE_PWM 238 help 239 This option enables support for pwm driven LEDs 240 241 config LEDS_REGULATOR 242 tristate "REGULATOR driven LED support" 243 - depends on LEDS_CLASS && REGULATOR 244 help 245 This option enables support for regulator driven LEDs. 246 247 config LEDS_BD2802 248 tristate "LED driver for BD2802 RGB LED" 249 - depends on LEDS_CLASS && I2C 250 help 251 This option enables support for BD2802GU RGB LED driver chips 252 accessed via the I2C bus. 253 254 config LEDS_INTEL_SS4200 255 tristate "LED driver for Intel NAS SS4200 series" 256 - depends on LEDS_CLASS && PCI && DMI 257 help 258 This option enables support for the Intel SS4200 series of 259 Network Attached Storage servers. You may control the hard ··· 262 263 config LEDS_LT3593 264 tristate "LED driver for LT3593 controllers" 265 - depends on LEDS_CLASS && GENERIC_GPIO 266 help 267 This option enables support for LEDs driven by a Linear Technology 268 LT3593 controller. This controller uses a special one-wire pulse ··· 270 271 config LEDS_ADP5520 272 tristate "LED Support for ADP5520/ADP5501 PMIC" 273 - depends on LEDS_CLASS && PMIC_ADP5520 274 help 275 This option enables support for on-chip LED drivers found 276 on Analog Devices ADP5520/ADP5501 PMICs. ··· 278 To compile this driver as a module, choose M here: the module will 279 be called leds-adp5520. 280 281 - comment "LED Triggers" 282 283 config LEDS_TRIGGERS 284 bool "LED Trigger support" ··· 292 These triggers allow kernel events to drive the LEDs and can 293 be configured via sysfs. If unsure, say Y. 294 295 config LEDS_TRIGGER_TIMER 296 tristate "LED Timer Trigger" 297 - depends on LEDS_TRIGGERS 298 help 299 This allows LEDs to be controlled by a programmable timer 300 via sysfs. Some LED hardware can be programmed to start ··· 308 309 config LEDS_TRIGGER_IDE_DISK 310 bool "LED IDE Disk Trigger" 311 - depends on LEDS_TRIGGERS && IDE_GD_ATA 312 help 313 This allows LEDs to be controlled by IDE disk activity. 314 If unsure, say Y. 315 316 config LEDS_TRIGGER_HEARTBEAT 317 tristate "LED Heartbeat Trigger" 318 - depends on LEDS_TRIGGERS 319 help 320 This allows LEDs to be controlled by a CPU load average. 321 The flash frequency is a hyperbolic function of the 1-minute ··· 323 324 config LEDS_TRIGGER_BACKLIGHT 325 tristate "LED backlight Trigger" 326 - depends on LEDS_TRIGGERS 327 help 328 This allows LEDs to be controlled as a backlight device: they 329 turn off and on when the display is blanked and unblanked. ··· 331 332 config LEDS_TRIGGER_GPIO 333 tristate "LED GPIO Trigger" 334 - depends on LEDS_TRIGGERS 335 depends on GPIOLIB 336 help 337 This allows LEDs to be controlled by gpio events. It's good ··· 343 344 config LEDS_TRIGGER_DEFAULT_ON 345 tristate "LED Default ON Trigger" 346 - depends on LEDS_TRIGGERS 347 help 348 This allows LEDs to be initialised in the ON state. 349 If unsure, say Y. 350 351 comment "iptables trigger is under Netfilter config (LED target)" 352 depends on LEDS_TRIGGERS 353 354 endif # NEW_LEDS
··· 15 This option enables the led sysfs class in /sys/class/leds. You'll 16 need this to do anything useful with LEDs. If unsure, say N. 17 18 + if LEDS_CLASS 19 + 20 comment "LED drivers" 21 22 config LEDS_88PM860X ··· 26 27 config LEDS_ATMEL_PWM 28 tristate "LED Support using Atmel PWM outputs" 29 + depends on ATMEL_PWM 30 help 31 This option enables support for LEDs driven using outputs 32 of the dedicated PWM controller found on newer Atmel SOCs. 33 34 config LEDS_LOCOMO 35 tristate "LED Support for Locomo device" 36 + depends on SHARP_LOCOMO 37 help 38 This option enables support for the LEDs on Sharp Locomo. 39 Zaurus models SL-5500 and SL-5600. 40 41 config LEDS_MIKROTIK_RB532 42 tristate "LED Support for Mikrotik Routerboard 532" 43 + depends on MIKROTIK_RB532 44 help 45 This option enables support for the so called "User LED" of 46 Mikrotik's Routerboard 532. 47 48 config LEDS_S3C24XX 49 tristate "LED Support for Samsung S3C24XX GPIO LEDs" 50 + depends on ARCH_S3C2410 51 help 52 This option enables support for LEDs connected to GPIO lines 53 on Samsung S3C24XX series CPUs, such as the S3C2410 and S3C2440. 54 55 config LEDS_AMS_DELTA 56 tristate "LED Support for the Amstrad Delta (E3)" 57 + depends on MACH_AMS_DELTA 58 help 59 This option enables support for the LEDs on Amstrad Delta (E3). 60 61 config LEDS_NET48XX 62 tristate "LED Support for Soekris net48xx series Error LED" 63 + depends on SCx200_GPIO 64 help 65 This option enables support for the Soekris net4801 and net4826 error 66 LED. 67 68 config LEDS_FSG 69 tristate "LED Support for the Freecom FSG-3" 70 + depends on MACH_FSG 71 help 72 This option enables support for the LEDs on the Freecom FSG-3. 73 74 config LEDS_WRAP 75 tristate "LED Support for the WRAP series LEDs" 76 + depends on SCx200_GPIO 77 help 78 This option enables support for the PCEngines WRAP programmable LEDs. 79 80 config LEDS_ALIX2 81 tristate "LED Support for ALIX.2 and ALIX.3 series" 82 + depends on X86 && !GPIO_CS5535 && !CS5535_GPIO 83 help 84 This option enables support for the PCEngines ALIX.2 and ALIX.3 LEDs. 85 You have to set leds-alix2.force=1 for boards with Award BIOS. 86 87 config LEDS_H1940 88 tristate "LED Support for iPAQ H1940 device" 89 + depends on ARCH_H1940 90 help 91 This option enables support for the LEDs on the h1940. 92 93 config LEDS_COBALT_QUBE 94 tristate "LED Support for the Cobalt Qube series front LED" 95 + depends on MIPS_COBALT 96 help 97 This option enables support for the front LED on Cobalt Qube series 98 ··· 105 106 config LEDS_SUNFIRE 107 tristate "LED support for SunFire servers." 108 + depends on SPARC64 109 select LEDS_TRIGGERS 110 help 111 This option enables support for the Left, Middle, and Right ··· 113 114 config LEDS_HP6XX 115 tristate "LED Support for the HP Jornada 6xx" 116 + depends on SH_HP6XX 117 help 118 This option enables LED support for the handheld 119 HP Jornada 620/660/680/690. 120 121 config LEDS_PCA9532 122 tristate "LED driver for PCA9532 dimmer" 123 + depends on I2C && INPUT && EXPERIMENTAL 124 help 125 This option enables support for NXP pca9532 126 LED controller. It is generally only useful ··· 128 129 config LEDS_GPIO 130 tristate "LED Support for GPIO connected LEDs" 131 + depends on GENERIC_GPIO 132 help 133 This option enables support for the LEDs connected to GPIO 134 outputs. To be useful the particular board must have LEDs ··· 155 156 config LEDS_LP3944 157 tristate "LED Support for N.S. LP3944 (Fun Light) I2C chip" 158 + depends on I2C 159 help 160 This option enables support for LEDs connected to the National 161 Semiconductor LP3944 Lighting Management Unit (LMU) also known as ··· 166 167 config LEDS_CLEVO_MAIL 168 tristate "Mail LED on Clevo notebook" 169 + depends on X86 && SERIO_I8042 && DMI 170 help 171 This driver makes the mail LED accessible from userspace 172 programs through the leds subsystem. This LED have three ··· 196 197 config LEDS_PCA955X 198 tristate "LED Support for PCA955x I2C chips" 199 + depends on I2C 200 help 201 This option enables support for LEDs connected to PCA955x 202 LED driver chips accessed via the I2C bus. Supported ··· 204 205 config LEDS_WM831X_STATUS 206 tristate "LED support for status LEDs on WM831x PMICs" 207 + depends on MFD_WM831X 208 help 209 This option enables support for the status LEDs of the WM831x 210 series of PMICs. 211 212 config LEDS_WM8350 213 tristate "LED Support for WM8350 AudioPlus PMIC" 214 + depends on MFD_WM8350 215 help 216 This option enables support for LEDs driven by the Wolfson 217 Microelectronics WM8350 AudioPlus PMIC. 218 219 config LEDS_DA903X 220 tristate "LED Support for DA9030/DA9034 PMIC" 221 + depends on PMIC_DA903X 222 help 223 This option enables support for on-chip LED drivers found 224 on Dialog Semiconductor DA9030/DA9034 PMICs. 225 226 config LEDS_DAC124S085 227 tristate "LED Support for DAC124S085 SPI DAC" 228 + depends on SPI 229 help 230 This option enables support for DAC124S085 SPI DAC from NatSemi, 231 which can be used to control up to four LEDs. 232 233 config LEDS_PWM 234 tristate "PWM driven LED Support" 235 + depends on HAVE_PWM 236 help 237 This option enables support for pwm driven LEDs 238 239 config LEDS_REGULATOR 240 tristate "REGULATOR driven LED support" 241 + depends on REGULATOR 242 help 243 This option enables support for regulator driven LEDs. 244 245 config LEDS_BD2802 246 tristate "LED driver for BD2802 RGB LED" 247 + depends on I2C 248 help 249 This option enables support for BD2802GU RGB LED driver chips 250 accessed via the I2C bus. 251 252 config LEDS_INTEL_SS4200 253 tristate "LED driver for Intel NAS SS4200 series" 254 + depends on PCI && DMI 255 help 256 This option enables support for the Intel SS4200 series of 257 Network Attached Storage servers. You may control the hard ··· 260 261 config LEDS_LT3593 262 tristate "LED driver for LT3593 controllers" 263 + depends on GENERIC_GPIO 264 help 265 This option enables support for LEDs driven by a Linear Technology 266 LT3593 controller. This controller uses a special one-wire pulse ··· 268 269 config LEDS_ADP5520 270 tristate "LED Support for ADP5520/ADP5501 PMIC" 271 + depends on PMIC_ADP5520 272 help 273 This option enables support for on-chip LED drivers found 274 on Analog Devices ADP5520/ADP5501 PMICs. ··· 276 To compile this driver as a module, choose M here: the module will 277 be called leds-adp5520. 278 279 + config LEDS_DELL_NETBOOKS 280 + tristate "External LED on Dell Business Netbooks" 281 + depends on X86 && ACPI_WMI 282 + help 283 + This adds support for the Latitude 2100 and similar 284 + notebooks that have an external LED. 285 286 config LEDS_TRIGGERS 287 bool "LED Trigger support" ··· 285 These triggers allow kernel events to drive the LEDs and can 286 be configured via sysfs. If unsure, say Y. 287 288 + if LEDS_TRIGGERS 289 + 290 + comment "LED Triggers" 291 + 292 config LEDS_TRIGGER_TIMER 293 tristate "LED Timer Trigger" 294 help 295 This allows LEDs to be controlled by a programmable timer 296 via sysfs. Some LED hardware can be programmed to start ··· 298 299 config LEDS_TRIGGER_IDE_DISK 300 bool "LED IDE Disk Trigger" 301 + depends on IDE_GD_ATA 302 help 303 This allows LEDs to be controlled by IDE disk activity. 304 If unsure, say Y. 305 306 config LEDS_TRIGGER_HEARTBEAT 307 tristate "LED Heartbeat Trigger" 308 help 309 This allows LEDs to be controlled by a CPU load average. 310 The flash frequency is a hyperbolic function of the 1-minute ··· 314 315 config LEDS_TRIGGER_BACKLIGHT 316 tristate "LED backlight Trigger" 317 help 318 This allows LEDs to be controlled as a backlight device: they 319 turn off and on when the display is blanked and unblanked. ··· 323 324 config LEDS_TRIGGER_GPIO 325 tristate "LED GPIO Trigger" 326 depends on GPIOLIB 327 help 328 This allows LEDs to be controlled by gpio events. It's good ··· 336 337 config LEDS_TRIGGER_DEFAULT_ON 338 tristate "LED Default ON Trigger" 339 help 340 This allows LEDs to be initialised in the ON state. 341 If unsure, say Y. 342 343 comment "iptables trigger is under Netfilter config (LED target)" 344 depends on LEDS_TRIGGERS 345 + 346 + endif # LEDS_TRIGGERS 347 + 348 + endif # LEDS_CLASS 349 350 endif # NEW_LEDS
+1
drivers/leds/Makefile
··· 34 obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o 35 obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o 36 obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o 37 38 # LED SPI Drivers 39 obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
··· 34 obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o 35 obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o 36 obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o 37 + obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o 38 39 # LED SPI Drivers 40 obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
+200
drivers/leds/dell-led.c
···
··· 1 + /* 2 + * dell_led.c - Dell LED Driver 3 + * 4 + * Copyright (C) 2010 Dell Inc. 5 + * Louis Davis <louis_davis@dell.com> 6 + * Jim Dailey <jim_dailey@dell.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License as 10 + * published by the Free Software Foundation. 11 + * 12 + */ 13 + 14 + #include <linux/acpi.h> 15 + #include <linux/leds.h> 16 + 17 + MODULE_AUTHOR("Louis Davis/Jim Dailey"); 18 + MODULE_DESCRIPTION("Dell LED Control Driver"); 19 + MODULE_LICENSE("GPL"); 20 + 21 + #define DELL_LED_BIOS_GUID "F6E4FE6E-909D-47cb-8BAB-C9F6F2F8D396" 22 + MODULE_ALIAS("wmi:" DELL_LED_BIOS_GUID); 23 + 24 + /* Error Result Codes: */ 25 + #define INVALID_DEVICE_ID 250 26 + #define INVALID_PARAMETER 251 27 + #define INVALID_BUFFER 252 28 + #define INTERFACE_ERROR 253 29 + #define UNSUPPORTED_COMMAND 254 30 + #define UNSPECIFIED_ERROR 255 31 + 32 + /* Device ID */ 33 + #define DEVICE_ID_PANEL_BACK 1 34 + 35 + /* LED Commands */ 36 + #define CMD_LED_ON 16 37 + #define CMD_LED_OFF 17 38 + #define CMD_LED_BLINK 18 39 + 40 + struct bios_args { 41 + unsigned char length; 42 + unsigned char result_code; 43 + unsigned char device_id; 44 + unsigned char command; 45 + unsigned char on_time; 46 + unsigned char off_time; 47 + }; 48 + 49 + static int dell_led_perform_fn(u8 length, 50 + u8 result_code, 51 + u8 device_id, 52 + u8 command, 53 + u8 on_time, 54 + u8 off_time) 55 + { 56 + struct bios_args *bios_return; 57 + u8 return_code; 58 + union acpi_object *obj; 59 + struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 60 + struct acpi_buffer input; 61 + acpi_status status; 62 + 63 + struct bios_args args; 64 + args.length = length; 65 + args.result_code = result_code; 66 + args.device_id = device_id; 67 + args.command = command; 68 + args.on_time = on_time; 69 + args.off_time = off_time; 70 + 71 + input.length = sizeof(struct bios_args); 72 + input.pointer = &args; 73 + 74 + status = wmi_evaluate_method(DELL_LED_BIOS_GUID, 75 + 1, 76 + 1, 77 + &input, 78 + &output); 79 + 80 + if (ACPI_FAILURE(status)) 81 + return status; 82 + 83 + obj = output.pointer; 84 + 85 + if (!obj) 86 + return -EINVAL; 87 + else if (obj->type != ACPI_TYPE_BUFFER) { 88 + kfree(obj); 89 + return -EINVAL; 90 + } 91 + 92 + bios_return = ((struct bios_args *)obj->buffer.pointer); 93 + return_code = bios_return->result_code; 94 + 95 + kfree(obj); 96 + 97 + return return_code; 98 + } 99 + 100 + static int led_on(void) 101 + { 102 + return dell_led_perform_fn(3, /* Length of command */ 103 + INTERFACE_ERROR, /* Init to INTERFACE_ERROR */ 104 + DEVICE_ID_PANEL_BACK, /* Device ID */ 105 + CMD_LED_ON, /* Command */ 106 + 0, /* not used */ 107 + 0); /* not used */ 108 + } 109 + 110 + static int led_off(void) 111 + { 112 + return dell_led_perform_fn(3, /* Length of command */ 113 + INTERFACE_ERROR, /* Init to INTERFACE_ERROR */ 114 + DEVICE_ID_PANEL_BACK, /* Device ID */ 115 + CMD_LED_OFF, /* Command */ 116 + 0, /* not used */ 117 + 0); /* not used */ 118 + } 119 + 120 + static int led_blink(unsigned char on_eighths, 121 + unsigned char off_eighths) 122 + { 123 + return dell_led_perform_fn(5, /* Length of command */ 124 + INTERFACE_ERROR, /* Init to INTERFACE_ERROR */ 125 + DEVICE_ID_PANEL_BACK, /* Device ID */ 126 + CMD_LED_BLINK, /* Command */ 127 + on_eighths, /* blink on in eigths of a second */ 128 + off_eighths); /* blink off in eights of a second */ 129 + } 130 + 131 + static void dell_led_set(struct led_classdev *led_cdev, 132 + enum led_brightness value) 133 + { 134 + if (value == LED_OFF) 135 + led_off(); 136 + else 137 + led_on(); 138 + } 139 + 140 + static int dell_led_blink(struct led_classdev *led_cdev, 141 + unsigned long *delay_on, 142 + unsigned long *delay_off) 143 + { 144 + unsigned long on_eighths; 145 + unsigned long off_eighths; 146 + 147 + /* The Dell LED delay is based on 125ms intervals. 148 + Need to round up to next interval. */ 149 + 150 + on_eighths = (*delay_on + 124) / 125; 151 + if (0 == on_eighths) 152 + on_eighths = 1; 153 + if (on_eighths > 255) 154 + on_eighths = 255; 155 + *delay_on = on_eighths * 125; 156 + 157 + off_eighths = (*delay_off + 124) / 125; 158 + if (0 == off_eighths) 159 + off_eighths = 1; 160 + if (off_eighths > 255) 161 + off_eighths = 255; 162 + *delay_off = off_eighths * 125; 163 + 164 + led_blink(on_eighths, off_eighths); 165 + 166 + return 0; 167 + } 168 + 169 + static struct led_classdev dell_led = { 170 + .name = "dell::lid", 171 + .brightness = LED_OFF, 172 + .max_brightness = 1, 173 + .brightness_set = dell_led_set, 174 + .blink_set = dell_led_blink, 175 + .flags = LED_CORE_SUSPENDRESUME, 176 + }; 177 + 178 + static int __init dell_led_init(void) 179 + { 180 + int error = 0; 181 + 182 + if (!wmi_has_guid(DELL_LED_BIOS_GUID)) 183 + return -ENODEV; 184 + 185 + error = led_off(); 186 + if (error != 0) 187 + return -ENODEV; 188 + 189 + return led_classdev_register(NULL, &dell_led); 190 + } 191 + 192 + static void __exit dell_led_exit(void) 193 + { 194 + led_classdev_unregister(&dell_led); 195 + 196 + led_off(); 197 + } 198 + 199 + module_init(dell_led_init); 200 + module_exit(dell_led_exit);
+9 -33
drivers/leds/led-class.c
··· 72 return sprintf(buf, "%u\n", led_cdev->max_brightness); 73 } 74 75 - static DEVICE_ATTR(brightness, 0644, led_brightness_show, led_brightness_store); 76 - static DEVICE_ATTR(max_brightness, 0444, led_max_brightness_show, NULL); 77 #ifdef CONFIG_LEDS_TRIGGERS 78 - static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store); 79 #endif 80 81 /** 82 * led_classdev_suspend - suspend an led_classdev. ··· 130 */ 131 int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) 132 { 133 - int rc; 134 - 135 led_cdev->dev = device_create(leds_class, parent, 0, led_cdev, 136 "%s", led_cdev->name); 137 if (IS_ERR(led_cdev->dev)) 138 return PTR_ERR(led_cdev->dev); 139 - 140 - /* register the attributes */ 141 - rc = device_create_file(led_cdev->dev, &dev_attr_brightness); 142 - if (rc) 143 - goto err_out; 144 145 #ifdef CONFIG_LEDS_TRIGGERS 146 init_rwsem(&led_cdev->trigger_lock); ··· 146 if (!led_cdev->max_brightness) 147 led_cdev->max_brightness = LED_FULL; 148 149 - rc = device_create_file(led_cdev->dev, &dev_attr_max_brightness); 150 - if (rc) 151 - goto err_out_attr_max; 152 - 153 led_update_brightness(led_cdev); 154 155 #ifdef CONFIG_LEDS_TRIGGERS 156 - rc = device_create_file(led_cdev->dev, &dev_attr_trigger); 157 - if (rc) 158 - goto err_out_led_list; 159 - 160 led_trigger_set_default(led_cdev); 161 #endif 162 163 - printk(KERN_INFO "Registered led device: %s\n", 164 led_cdev->name); 165 166 return 0; 167 - 168 - #ifdef CONFIG_LEDS_TRIGGERS 169 - err_out_led_list: 170 - device_remove_file(led_cdev->dev, &dev_attr_max_brightness); 171 - #endif 172 - err_out_attr_max: 173 - device_remove_file(led_cdev->dev, &dev_attr_brightness); 174 - list_del(&led_cdev->node); 175 - err_out: 176 - device_unregister(led_cdev->dev); 177 - return rc; 178 } 179 EXPORT_SYMBOL_GPL(led_classdev_register); 180 181 /** ··· 168 */ 169 void led_classdev_unregister(struct led_classdev *led_cdev) 170 { 171 - device_remove_file(led_cdev->dev, &dev_attr_max_brightness); 172 - device_remove_file(led_cdev->dev, &dev_attr_brightness); 173 #ifdef CONFIG_LEDS_TRIGGERS 174 - device_remove_file(led_cdev->dev, &dev_attr_trigger); 175 down_write(&led_cdev->trigger_lock); 176 if (led_cdev->trigger) 177 led_trigger_set(led_cdev, NULL); ··· 190 return PTR_ERR(leds_class); 191 leds_class->suspend = led_suspend; 192 leds_class->resume = led_resume; 193 return 0; 194 } 195
··· 72 return sprintf(buf, "%u\n", led_cdev->max_brightness); 73 } 74 75 + static struct device_attribute led_class_attrs[] = { 76 + __ATTR(brightness, 0644, led_brightness_show, led_brightness_store), 77 + __ATTR(max_brightness, 0644, led_max_brightness_show, NULL), 78 #ifdef CONFIG_LEDS_TRIGGERS 79 + __ATTR(trigger, 0644, led_trigger_show, led_trigger_store), 80 #endif 81 + __ATTR_NULL, 82 + }; 83 84 /** 85 * led_classdev_suspend - suspend an led_classdev. ··· 127 */ 128 int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) 129 { 130 led_cdev->dev = device_create(leds_class, parent, 0, led_cdev, 131 "%s", led_cdev->name); 132 if (IS_ERR(led_cdev->dev)) 133 return PTR_ERR(led_cdev->dev); 134 135 #ifdef CONFIG_LEDS_TRIGGERS 136 init_rwsem(&led_cdev->trigger_lock); ··· 150 if (!led_cdev->max_brightness) 151 led_cdev->max_brightness = LED_FULL; 152 153 led_update_brightness(led_cdev); 154 155 #ifdef CONFIG_LEDS_TRIGGERS 156 led_trigger_set_default(led_cdev); 157 #endif 158 159 + printk(KERN_DEBUG "Registered led device: %s\n", 160 led_cdev->name); 161 162 return 0; 163 } 164 + 165 EXPORT_SYMBOL_GPL(led_classdev_register); 166 167 /** ··· 190 */ 191 void led_classdev_unregister(struct led_classdev *led_cdev) 192 { 193 #ifdef CONFIG_LEDS_TRIGGERS 194 down_write(&led_cdev->trigger_lock); 195 if (led_cdev->trigger) 196 led_trigger_set(led_cdev, NULL); ··· 215 return PTR_ERR(leds_class); 216 leds_class->suspend = led_suspend; 217 leds_class->resume = led_resume; 218 + leds_class->dev_attrs = led_class_attrs; 219 return 0; 220 } 221
+1 -2
drivers/leds/leds-gpio.c
··· 211 const struct of_device_id *match) 212 { 213 struct device_node *np = ofdev->node, *child; 214 - struct gpio_led led; 215 struct gpio_led_of_platform_data *pdata; 216 int count = 0, ret; 217 ··· 225 if (!pdata) 226 return -ENOMEM; 227 228 - memset(&led, 0, sizeof(led)); 229 for_each_child_of_node(np, child) { 230 enum of_gpio_flags flags; 231 const char *state; 232
··· 211 const struct of_device_id *match) 212 { 213 struct device_node *np = ofdev->node, *child; 214 struct gpio_led_of_platform_data *pdata; 215 int count = 0, ret; 216 ··· 226 if (!pdata) 227 return -ENOMEM; 228 229 for_each_child_of_node(np, child) { 230 + struct gpio_led led = {}; 231 enum of_gpio_flags flags; 232 const char *state; 233
+1 -1
drivers/leds/leds-ss4200.c
··· 63 /* 64 * PCI ID of the Intel ICH7 LPC Device within which the GPIO block lives. 65 */ 66 - static struct pci_device_id ich7_lpc_pci_id[] = 67 { 68 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0) }, 69 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1) },
··· 63 /* 64 * PCI ID of the Intel ICH7 LPC Device within which the GPIO block lives. 65 */ 66 + static const struct pci_device_id ich7_lpc_pci_id[] = 67 { 68 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0) }, 69 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1) },