summaryrefslogtreecommitdiffstats
path: root/drivers/leds
AgeCommit message (Collapse)AuthorFilesLines
2016-03-23Merge tag 'platform-drivers-x86-v4.6-1' of ↵Linus Torvalds2-112/+15
git://git.infradead.org/users/dvhart/linux-platform-drivers-x86 Pull x86 platform driver updates from Darren Hart: "Significant refactoring of Dell laptop drivers, modularizing the smbios code. Multiple new platforms added for ideapad, asus, dell, and alienware using existing quirks. A few fixes and cleanups. hp-wmi: - Remove GPS rfkill support via pre-2009 interface - fix unregister order in hp_wmi_rfkill_setup() once again ideapad-laptop: - Add ideapad Y700 (15) to the no_hw_rfkill DMI list fujitsu-laptop: - Support radio toggle button intel-hid: - allocate correct amount of memory for private struct platform/x86: - Make intel_scu_ipc explicitly non-modular intel_pmc_ipc: - Avoid pending IPC1 command during legacy suspend - Fix GCR register base address and length asus-nb-wmi: - add wapf=4 quirk for ASUS X75VD intel_telemetry_pltdrv: - Change verbosity control bits dell-rbtn: - Add a comment about the XPS 13 9350 dell-wmi, dell-laptop: - depends DMI dell-wmi: - support Dell Inspiron M5110 - properly process Dell Instant Launch hotkey - enable receiving WMI events on Dell Vostro V131 - Support new hotkeys on the XPS 13 9350 (Skylake) - Clean up hotkey table size check - Stop storing pointers to DMI tables dell-laptop: - move dell_smi_error() to dell-smbios - use dell_smbios_find_token() instead of find_token_location() - use dell_smbios_find_token() instead of find_token_id() - extract SMBIOS-related code to a separate module dell-smbios: - rename dell_smi_error() to dell_smbios_error() - make da_tokens static - remove find_token_{id,location}() - implement new function for finding DMI table 0xDA tokens - make the SMBIOS buffer static - return the SMBIOS buffer from dell_smbios_get_buffer() - don't return an SMBIOS buffer from dell_smbios_send_request() - don't pass an SMBIOS buffer to dell_smbios_send_request() - rename dell_send_request() to dell_smbios_send_request() - rename release_buffer() to dell_smbios_release_buffer() - rename clear_buffer() to dell_smbios_clear_buffer() - rename get_buffer() to dell_smbios_get_buffer() dell-led: - use dell_smbios_send_request() for performing SMBIOS calls - use dell_smbios_find_token() for finding mic DMI tokens toshiba_acpi: - Add a module parameter to disable hotkeys registration - Add sysfs entries for the Cooling Method feature - Add support for cooling method feature Documentation/ABI: - Update sysfs-driver-toshiba_acpi file thinkpad_acpi: - Remove ambiguous logging for "Unsupported brightness interface" alienware-wmi: - whitespace improvements - Add support for two new systems: ASM200 and ASM201. - Add support for deep sleep control. - Add initial support for alienware graphics amplifier. - Add support for new platform: X51-R3 - Clean up whitespace for ASM100 platform" * tag 'platform-drivers-x86-v4.6-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: (47 commits) hp-wmi: Remove GPS rfkill support via pre-2009 interface hp-wmi: fix unregister order in hp_wmi_rfkill_setup() once again dell-wmi: support Dell Inspiron M5110 dell-wmi: properly process Dell Instant Launch hotkey dell-wmi: enable receiving WMI events on Dell Vostro V131 dell-smbios: rename dell_smi_error() to dell_smbios_error() dell-laptop: move dell_smi_error() to dell-smbios ideapad-laptop: Add ideapad Y700 (15) to the no_hw_rfkill DMI list fujitsu-laptop: Support radio toggle button intel-hid: allocate correct amount of memory for private struct platform/x86: Make intel_scu_ipc explicitly non-modular intel_pmc_ipc: Avoid pending IPC1 command during legacy suspend intel_pmc_ipc: Fix GCR register base address and length asus-nb-wmi: add wapf=4 quirk for ASUS X75VD intel_telemetry_pltdrv: Change verbosity control bits dell-rbtn: Add a comment about the XPS 13 9350 dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake) dell-wmi: Clean up hotkey table size check dell-wmi, dell-laptop: depends DMI dell-wmi: Stop storing pointers to DMI tables ...
2016-03-23dell-led: use dell_smbios_send_request() for performing SMBIOS callsMichał Kępień1-59/+6
Instead of using the WMI wrapper, dell-led can take advantage of dell_smbios_send_request() for performing the SMBIOS calls required to change the state of the microphone LED. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23dell-led: use dell_smbios_find_token() for finding mic DMI tokensMichał Kępień2-54/+10
With the advent of dell_smbios_find_token(), dell-led does not need to perform any DMI walking on its own, but it can rather ask dell-smbios to look up the DMI tokens it needs for changing the state of the microphone LED. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-14leds: triggers: simplify led_trigger_storeHeiner Kallweit1-11/+2
led_trigger_store can be significantly simplified by using sysfs_streq(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: max8997: Use devm_led_classdev_registerAmitoj Kaur Chawla1-13/+1
Switch to resource-managed function devm_led_classdev_register instead of led_classdev_register and remove unneeded led_classdev_unregister. Also, remove platform_set_drvdata in probe function and the remove function, max8997_led_remove as it is now has nothing to do. The Coccinelle semantic patch used to make this change is as follows: //<smpl> @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e; @@ probefn(struct platform_device *pdev, ...) { ... e = - led_classdev_register + devm_led_classdev_register (...); ... ?- led_classdev_unregister(...); ... } @remove depends on prb@ identifier platform.removefn; @@ removefn(...) { ... ?- led_classdev_unregister(...); ... } //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: da903x: Use devm_led_classdev_registerAmitoj Kaur Chawla1-11/+1
Switch to resource-managed function devm_led_classdev_register instead of led_classdev_register and remove unneeded led_classdev_unregister. Also, remove platform_set_drvdata in probe function and the remove function, da903x_led_remove as it is now has nothing to do. The Coccinelle semantic patch used to make this change is as follows: //<smpl> @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e; @@ probefn(struct platform_device *pdev, ...) { ... e = - led_classdev_register + devm_led_classdev_register (...); ... ?- led_classdev_unregister(...); ... } @remove depends on prb@ identifier platform.removefn; @@ removefn(...) { ... ?- led_classdev_unregister(...); ... } //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: s3c24xx: Use devm_led_classdev_registerAmitoj Kaur Chawla1-18/+1
Switch to resource-managed function devm_led_classdev_register instead of led_classdev_register and remove unneeded led_classdev_unregister. Also, remove unnecessary function pdev_to_gpio, platform_set_drvdata in the probe function and the remove function, s3c24xx_led_remove as it is now has nothing to do. The Coccinelle semantic patch used to make this change is as follows: //<smpl> @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e; @@ probefn(struct platform_device *pdev, ...) { ... e = - led_classdev_register + devm_led_classdev_register (...); ... ?- led_classdev_unregister(...); ... } @remove depends on prb@ identifier platform.removefn; @@ removefn(...) { ... ?- led_classdev_unregister(...); ... } //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: wm831x-status: Use devm_led_classdev_registerAmitoj Kaur Chawla1-12/+1
Switch to resource-managed function devm_led_classdev_register instead of led_classdev_register and remove unneeded led_classdev_unregister. Also, remove platform_set_drvdata from probe function and the remove function, wm831x_status_remove as it is now has nothing to do. The Coccinelle semantic patch used to make this change is as follows: //<smpl> @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e; @@ probefn(struct platform_device *pdev, ...) { ... e = - led_classdev_register + devm_led_classdev_register (...); ... ?- led_classdev_unregister(...); ... } @remove depends on prb@ identifier platform.removefn; @@ removefn(...) { ... ?- led_classdev_unregister(...); ... } //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: lp8788: Use devm_led_classdev_registerAmitoj Kaur Chawla1-13/+1
Switch to resource-managed function devm_led_classdev_register instead of led_classdev_register and remove unneeded led_classdev_unregister. Also, remove platform_set_drvdata in probe function and the remove function, lp8788_led_remove as it is now has nothing to do. The Coccinelle semantic patch used to make this change is as follows: //<smpl> @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e; @@ probefn(struct platform_device *pdev, ...) { ... e = - led_classdev_register + devm_led_classdev_register (...); ... ?- led_classdev_unregister(...); ... } @remove depends on prb@ identifier platform.removefn; @@ removefn(...) { ... ?- led_classdev_unregister(...); ... } //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: 88pm860x: Use devm_led_classdev_registerAmitoj Kaur Chawla1-11/+1
Switch to resource-managed function devm_led_classdev_register instead of led_classdev_register and remove unneeded led_classdev_unregister. Also, remove platform_set_drvdata in probe function and the remove function, pm860x_led_remove as it is now has nothing to do. The Coccinelle semantic patch used to make this change is as follows: //<smpl> @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e; @@ probefn(struct platform_device *pdev, ...) { ... e = - led_classdev_register + devm_led_classdev_register (...); ... ?- led_classdev_unregister(...); ... } @remove depends on prb@ identifier platform.removefn; @@ removefn(...) { ... ?- led_classdev_unregister(...); ... } //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: Add SN3218 and SN3216 support to the IS31FL32XX driverDavid Rivshin2-4/+8
Si-En Technology was acquired by ISSI in 2011, and it appears that the IS31FL3218/IS31FL3216 are just rebranded SN3218/SN3216 devices. Add the "si-en,sn3218" and "si-en,sn3216" compatible strings into the IS31FL32XX driver as aliases for the issi equivalents, and update binding documentation. Datasheets: IS31FL3218: http://www.issi.com/WW/pdf/31FL3218.pdf SN3218: http://www.si-en.com/uploadpdf/s2011517171720.pdf IS31FL3216: http://www.issi.com/WW/pdf/31FL3216.pdf SN3216: http://www.si-en.com/uploadpdf/SN3216201152410148.pdf Signed-off-by: David Rivshin <drivshin@allworx.com> Acked-by: Rob Herring <robh@kernel.org> Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: Add driver for the ISSI IS31FL32xx family of LED controllersDavid Rivshin3-0/+513
The IS31FL32xx family of LED controllers are I2C devices with multiple constant-current channels, each with independent 256-level PWM control. Datasheets: http://www.issi.com/US/product-analog-fxled-driver.shtml This has been tested on the IS31FL3236 and IS31FL3216, on an ARM (TI am335x) platform. The programming paradigm of these devices is similar in the following ways: - All registers are 8 bit - All LED control registers are write-only - Each LED channel has a PWM register (0-255) - PWM register writes are shadowed until an Update register is poked - All have a concept of Software Shutdown, which disables output However, there are some differences in devices: - 3236/3235 have a separate Control register for each LED, (3218/3216 pack the enable bits into fewer registers) - 3236/3235 have a per-channel current divisor setting - 3236/3235 have a Global Control register that can turn off all LEDs - 3216 is unique in a number of ways - OUT9-OUT16 can be configured as GPIOs instead of LED controls - LEDs can be programmed with an 8-frame animation, with programmable delay between frames - LEDs can be modulated by an input audio signal - Max output current can be adjusted from 1/4 to 2x globally - Has a Configuration register instead of a Shutdown register This driver currently only supports the base PWM control function of these devices. The following features of these devices are not implemented, although it should be possible to add them in the future: - All devices are capable of going into a lower-power "software shutdown" mode. - The is31fl3236 and is31fl3235 can reduce the max output current per-channel with a divisor of 1, 2, 3, or 4. - The is31fl3216 can use some LED channels as GPIOs instead. - The is31fl3216 can animate LEDs in hardware. - The is31fl3216 can modulate LEDs according to an audio input. - The is31fl3216 can reduce/increase max output current globally. Signed-off-by: David Rivshin <drivshin@allworx.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: lm3533: Use devm_led_classdev_registerAmitoj Kaur Chawla1-9/+3
Switch to resource-managed function devm_led_classdev_register instead of led_classdev_register and remove unneeded led_classdev_unregister. To be compatible with this change, remove an unnecessary label by replacing it with direct return statement. The Coccinelle semantic patch used to make this change is as follows: //<smpl> @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e; @@ probefn(struct platform_device *pdev, ...) { ... e = - led_classdev_register + devm_led_classdev_register (...); ... ?- led_classdev_unregister(...); ... } @remove depends on prb@ identifier platform.removefn; @@ removefn(...) { ... ?- led_classdev_unregister(...); ... } //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: gpio: Use GPIOF_OUT_INIT_LOW instead of hardcoded zeroGeert Uytterhoeven1-1/+1
Use the GPIO flag definition instead of a numeric literal, so the casual reader grepping for GPIOF_ will find the GPIO flags used. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: core: add helpers for calling brightness_set(_blocking)Heiner Kallweit1-14/+26
Add helpers for calling brightness_set(_blocking) allowing to simplify the code and make it better readable. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: leds-gpio: Fix return value check in create_gpio_led()Wei Yongjun1-2/+2
In case of error, the function gpio_to_desc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: lp3944: improve wording and formatting in a commentAntonio Ospite1-2/+5
Improve the wording for the comment about the led status, and while at it also use the standard formatting for multi-line comments. Signed-off-by: Antonio Ospite <ao2@ao2.it> Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-14leds: core: avoid error message when a USB LED device is unpluggedHeiner Kallweit2-1/+6
When a USB LED device is unplugged the remove call chain calls led_classdev_unregister which tries to switch the LED off. As the device has been removed already this results in a ENODEV error message in dmesg. Avoid this error message by ignoring ENODEV in calls from led_classdev_unregister if the LED device is flagged as pluggable. Therefore a new flag LED_HW_PLUGGABLE was introduced which should be set by all LED drivers handling pluggable LED devices (mainly USB LED devices). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-17Merge tag 'gpio-v4.5-1' of ↵Linus Torvalds2-10/+10
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "Here is the bulk of GPIO changes for v4.5. Notably there are big refactorings mostly by myself, aimed at getting the gpio_chip into a shape that makes me believe I can proceed to preserve state for a proper userspace ABI (character device) that has already been proposed once, but resulted in the feedback that I need to go back and restructure stuff. So I've been restructuring stuff. On the way I ran into brokenness (return code from the get_value() callback) and had to fix it. Also, refactored generic GPIO to be simpler. Some of that is still waiting to trickle down from the subsystems all over the kernel that provide random gpio_chips, I've touched every single GPIO driver in the kernel now, oh man I didn't know I was responsible for so much... Apart from that we're churning along as usual. I took some effort to test and retest so it should merge nicely and we shook out a couple of bugs in -next. Infrastructural changes: - In struct gpio_chip, rename the .dev node to .parent to better reflect the fact that this is not the GPIO struct device abstraction. We will add that soon so this would be totallt confusing. - It was noted that the driver .get_value() callbacks was sometimes reporting negative -ERR values to the gpiolib core, expecting them to be propagated to consumer gpiod_get_value() and gpio_get_value() calls. This was not happening, so as there was a mess of drivers returning negative errors and some returning "anything else than zero" to indicate that a line was active. As some would have bit 31 set to indicate "line active" it clashed with negative error codes. This is fixed by the largeish series clamping values in all drivers with !!value to [0,1] and then augmenting the code to propagate error codes to consumers. (Includes some ACKed patches in other subsystems.) - Add a void *data pointer to struct gpio_chip. The container_of() design pattern is indeed very nice, but we want to reform the struct gpio_chip to be a non-volative, stateless business, and keep states internal to the gpiolib to be able to hold on to the state when adding a proper userspace ABI (character device) further down the road. To achieve this, drivers need a handle at the internal state that is not dependent on their struct gpio_chip() so we add gpiochip_add_data() and gpiochip_get_data() following the pattern of many other subsystems. All the "use gpiochip data pointer" patches transforms drivers to this scheme. - The Generic GPIO chip header has been merged into the general <linux/gpio/driver.h> header, and the custom header for that removed. Instead of having a separate mm_gpio_chip struct for these generic drivers, merge that into struct gpio_chip, simplifying the code and removing the need for separate and confusing includes. Misc improvements: - Stabilize the way GPIOs are looked up from the ACPI legacy specification. - Incremental driver features for PXA, PCA953X, Lantiq (patches from the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48 New drivers: - Add a GPIO chip to the ALSA SoC AC97 driver. - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir, but the branch is merged here too to account for infrastructural changes). - The sx150x driver now supports the sx1502" * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits) gpio: generic: make bgpio_pdata always visible gpiolib: fix chip order in gpio list gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs() gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs() gpio: brcmstb: Allow building driver for BMIPS_GENERIC gpio: brcmstb: Set endian flags for big-endian MIPS gpio: moxart: fix build regression gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() leds: pca9532: use gpiochip data pointer leds: tca6507: use gpiochip data pointer hid: cp2112: use gpiochip data pointer bcma: gpio: use gpiochip data pointer avr32: gpio: use gpiochip data pointer video: fbdev: via: use gpiochip data pointer gpio: pch: Optimize pch_gpio_get() Revert "pinctrl: lantiq: Implement gpio_chip.to_irq" pinctrl: nsp-gpio: use gpiochip data pointer pinctrl: vt8500-wmt: use gpiochip data pointer pinctrl: exynos5440: use gpiochip data pointer pinctrl: at91-pio4: use gpiochip data pointer ...
2016-01-07leds: pca9532: use gpiochip data pointerLinus Walleij1-4/+4
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: linux-leds@vger.kernel.org Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-01-07leds: tca6507: use gpiochip data pointerLinus Walleij1-2/+2
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: linux-leds@vger.kernel.org Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-01-04leds: add HAS_IOMEM dependency to LEDS_BCM6328/LEDS_BCM6358Vegard Nossum1-0/+2
Ran into this on UML: drivers/built-in.o: In function `bcm6328_leds_probe': drivers/leds/leds-bcm6328.c:340: undefined reference to `devm_ioremap_resource' drivers/built-in.o: In function `bcm6358_leds_probe': drivers/leds/leds-bcm6358.c:173: undefined reference to `devm_ioremap_resource' collect2: error: ld returned 1 exit status devm_ioremap_resource() is defined only when HAS_IOMEM is selected. Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: linux-leds@vger.kernel.org Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: core: add managed version of led_trigger_registerHeiner Kallweit1-0/+28
Complementing devm_led_classdev_register add a managed version of led_trigger_register. I omit a managed version of led_classdev_unregister as the equivalent devm_led_classdev_unregister isn't used in the kernel as of today. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6358: remove unneeded busy status checkÁlvaro Fernández Rojas1-3/+0
The busy status checking isn't needed while reading initial LED status. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6328: improve blink supportÁlvaro Fernández Rojas1-5/+15
BCM6328 controller has a margin of 20ms per blink step, which means that we can only set it to 20, 40, 60 ... 1260 ms (0x3f * 20ms). However, when checking if delay_on == delay_off, we were not considering the case when the user had set delay_on=20 and delay_off=21, since this will cause the driver to fallback to software blinking. This update fixes this issue and improves blink steps by rounding them in a more sensible way. Now 30-49ms is rounded to 40 ms, and previous behaviour implied 40-59ms being rounded to 40 ms. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6358: merge bcm6358_led_mode and bcm6358_led_setÁlvaro Fernández Rojas1-14/+6
bcm6358_led_mode is now only called by bcm6358_led_set, so merge both in one single function. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6328: simplify duplicated unlock in bcm6328_blink_setÁlvaro Fernández Rojas1-5/+5
Instead of duplicating the unlock we can store the return value and use a single unlock before returning that value, which simplifies the code. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6358: add little endian supportÁlvaro Fernández Rojas1-0/+8
This adds little endian support while keeping big endian support. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6328: add little endian supportÁlvaro Fernández Rojas1-0/+8
This adds little endian support while keeping big endian support. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6358: remove unneded lock when checking initial LED statusÁlvaro Fernández Rojas1-3/+0
This lock isn't really needed, since we're only reading the register and changes made to other LEDs aren't relevant. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6358: Use bcm6358_led_set() in order to get rid of the lockÁlvaro Fernández Rojas1-1/+2
Replaces bcm6358_led_mode with bcm6358_led_set so we don't need to handle the lock. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6328: remove unneded lock when checking initial LEDÁlvaro Fernández Rojas1-3/+0
This lock isn't really needed, since we're only reading the register and changes made to other LEDs aren't relevant. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6328: code cleaningÁlvaro Fernández Rojas1-4/+4
- Remove double whitespace - Add missing brackets - Add spinlock info Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: syscon: Make the driver explicitly non-modularPaul Gortmaker1-15/+3
The Kconfig currently controlling compilation of this code is: drivers/leds/Kconfig:config LEDS_SYSCON drivers/leds/Kconfig: bool "LED support for LEDs on system controllers" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers. Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit. Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code. Cc: Richard Purdie <rpurdie@rpsys.net> Cc: linux-leds@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: ledtrig-ide-disk: Make the driver explicitly non-modularPaul Gortmaker1-13/+1
The Kconfig for this driver is currently: config LEDS_TRIGGER_IDE_DISK bool "LED IDE Disk Trigger" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Cc: Bryan Wu <cooloney@gmail.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: linux-leds@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: ledtrig-cpu: Make the driver explicitly non-modularPaul Gortmaker1-25/+1
The Kconfig for this driver is currently: config LEDS_TRIGGER_CPU bool "LED CPU Trigger" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Cc: Bryan Wu <cooloney@gmail.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: linux-leds@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: sunfire: Use platform_register/unregister_drivers()Thierry Reding1-16/+7
These new helpers simplify implementing multi-driver modules and properly handle failure to register one driver by unregistering all previously registered drivers. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: max77693: Add missing of_node_putJacek Anaszewski1-0/+1
Each break out of the for_each_available_child_of_node loop requires of_node_put(). This patch adds missing of_node_put() when loop breaks on conflicting values of led-sources DT property. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Cc: Rob Herring <robh@kernel.org> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
2016-01-04leds: aat1290: Add missing of_node_putJacek Anaszewski1-4/+5
The refcount of device_node increases after of_get_next_available_child() is called. Make sure it is decremented also in case of DT parsing error. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Cc: Rob Herring <robh@kernel.org> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
2016-01-04leds: powernv: Implement brightness_set_blocking opJacek Anaszewski1-6/+10
Since brightness setting can sleep for this driver, implement brightness_set_blocking op, instead of brightness_set. It makes this driver compatible with LED triggers. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
2016-01-04leds: ipaq-micro: Implement brightness_set_blocking opJacek Anaszewski1-3/+3
Since brightness setting can sleep for this driver, implement brightness_set_blocking op, instead of brightness_set. It makes this driver compatible with LED triggers. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2016-01-04leds: powernv: removing NULL checkSaurabh Sengar1-2/+0
No need to explicitly check for pointer to be null, of_prop_next_string anyways returns NULL, if passed pointer is NULL and hence loop will continue. Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com> Acked-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6328: Swap LED ON and OFF definitionsSimon Arlott1-6/+6
The values of BCM6328_LED_MODE_ON and BCM6328_LED_MODE_OFF were named for active low LEDs. These should be swapped so that they are named for the default case of active high LEDs. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: bcm6328: Reuse bcm6328_led_set() instead of copying its functionalitySimon Arlott1-6/+2
When ensuring a consistent initial LED state in bcm6328_led (as they may be blinking instead of on/off), the LED register is set using an inverted copy of bcm6328_led_set(). To avoid further errors relating to active low handling, call this function directly instead. As bcm6328_led_set() acquires the same spinlock again when updating the register, it is called after unlocking. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: ns2: Remove work queueJacek Anaszewski1-18/+13
Now the core implements the work queue, remove it from the drivers, and switch to using brightness_set_blocking op. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Tested-by: Simon Guinot <simon.guinot@sequanux.org>
2016-01-04leds: pwm: fix driver description and make license match the headerUwe Kleine-König1-2/+2
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: turn off the LED and wait for completion on unregistering LED class deviceMilo Kim1-2/+3
Workqueue, 'set_brightness_work' is used for scheduling brightness control. This workqueue is canceled when the LED class device is unregistered. Currently, LED subsystem handles like below. cancel_work_sync(&led_cdev->set_brightness_work) led_set_brightness(led_cdev, LED_OFF) However, this could be a problem. Workqueue is going to be canceled but LED device needs to be off. The worst case is null pointer access due to scheduling a workqueue. LED module is loaded. LED driver private data is allocated by using devm_zalloc(). LED module is unloaded. led_classdev_unregister() is called. cancel_work_sync() led_set_brightness(led_cdev, LED_OFF) schedule_work() if LED driver uses brightness_set_blocking() In the meantime, driver private data will be freed. ..scheduling.. brightness_set_blocking() callback is invoked. For the brightness control, LED driver tries to access private data but resource is removed! To avoid this problem, LED subsystem should turn off the brightness first and wait for completion. led_set_brightness(led_cdev, LED_OFF) flush_work(&led_cdev->set_brightness_work) It guarantees that LED driver turns off the brightness prior to resource management. Cc: linux-leds@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Milo Kim <milo.kim@ti.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: flash: Remove checking for state < 1 in flash_strobe_store()Jacek Anaszewski1-1/+1
Strobe state variable is declared as unsigned long, remove the check for values less than zero then. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Reported-by: David Binderman <dcb314@hotmail.com>
2016-01-04leds: ktd2692: Add missing of_node_putIngi Kim1-3/+6
The refcount of device_node increases after of_node_get() is called. So, a break out of the loop requires of_node_put(). This patch adds missing of_node_put() when loop breaks. Signed-off-by: Ingi Kim <ingi2.kim@samsung.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-01-04leds: call led_pwm_set() in leds-pwm to enforce default LED_OFFMarkus Hofstaetter1-0/+1
Some PWMs are disabled by default or the default pin setting does not match the LED_OFF state (e.g., active-low leds). Hence, the driver may end up reporting 0 brightness, but the leds are actually on using full brightness, because it never enforces its default configuration. So enforce it by calling led_pwm_set() after successfully registering the device. Tested on a Phytec phyFLEX i.MX6Q board based on kernel v3.19.5. Signed-off-by: Markus Hofstaetter <markus.hofstaetter@ait.ac.at> Tested-by: Markus Hofstaetter <markus.hofstaetter@ait.ac.at> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>