summaryrefslogtreecommitdiff
path: root/drivers/leds
AgeCommit message (Collapse)Author
2016-09-20leds: triggers: Check return value of kobject_uevent_env()Jacek Anaszewski
Log error message if kobject_uevent_env() fails in led_trigger_set(). Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20leds: triggers: Return from led_trigger_set() if there is nothing to doJacek Anaszewski
If led_trigger_set() is called with "trig" argument set to NULL, and there is no trigger to remove then the function should return immediately so as to avoid doing unnecessary allocation and sending uevent. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Reported-by: Daniel Romell <daro@hms.se> Acked-by Daniel Romell <daro@hms.se>
2016-09-15leds: gpio: fix and simplify error handling in gpio_leds_createHeiner Kallweit
Simplify the error handling and add a missing call to fwnode_handle_put when checking led.name. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-09-15leds: gpio: switch to managed version of led_classdev_registerHeiner Kallweit
Using the managed version of led_classdev_register allows to significantly simplify the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-09-15leds: gpio: fix and simplify reading property "label"Heiner Kallweit
Checking for the presence of the property first isn't strictly needed as we can react on the return code of fwnode_property_read_string. Also, even if the presence of a property "label" was checked, reading a string value for it theoretically still can fail and this case isn't handled. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-09-15leds: gpio: simplify gpio_leds_createHeiner Kallweit
Definition of np can be moved into the loop as well to simplify the code a little. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-09-15leds: gpio: add helper cdev_to_gpio_led_dataHeiner Kallweit
Add a helper for the container_of as it's used more than once. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-09-15leds: gpio: fix an unhandled error case in create_gpio_ledHeiner Kallweit
gpiod_get_value_cansleep returns 0, 1, or an error code. So far errors are not handled and treated the same as 1. Change this to bail out if an error code is returned and remove the double negation. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-09-15leds: gpio: introduce gpio_blink_set_tHeiner Kallweit
Introduce a typedef gpio_blink_set_t to improve readability of the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-09-15leds: add driver for Mellanox systems LEDsVadim Pasternak
This makes it possible to create a set of LEDs for Mellanox systems: "msx6710", "msx6720", "msb7700", "msn2700", "msx1410", "msn2410", "msb7800", "msn2740", "msn2100". Driver obtains LED devices according to system configuration, provided through system DMI data, like mlxcpld:fan1:green, mlxcpld:fan1:red and creates devices in form: "devicename:colour:function". LED setting is controlled through on board CPLD Lattice device. For setting particular LED off, solid, blink: echo 0 > /sys/class/leds/mlxcpld\:status\:green/brightness echo 1 > /sys/class/leds/mlxcpld\:status\:green/brightness echo timer > /sys/class/leds/mlxcpld\:status\:green/trigger On module probing all LEDs are set green, on removing - off. Last setting overwrites previous, f.e. sequence for changing LED from green - red - green: echo 1 > /sys/class/leds/mlxcpld\:psu\:green/brightness echo 1 > /sys/class/leds/mlxcpld\:psu\:red/brightness echo 1 > /sys/class/leds/mlxcpld\:psu\:green/brightness Note: LEDs cannot be turned on/off simultaneously. The Kconfig currently controlling compilation of this code is: drivers/leds/Kconfig:config LEDS_MLXCPLD Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-08-16leds: add PM8058 LEDs driverLinus Walleij
This adds a driver for the six PM8058 LEDs, three ordinary LEDs, two "flash" LEDs and one "keypad" LED. The "keypad" and "flash" LEDs are not really hard-wired to these usecases: for example on the APQ8060 Dragonboard, the "keypad" LED is instead used to drive an IR LED used for the proximity sensor. The "flash" LEDs are just ordinary high-current LED drivers. Cc: linux-arm-msm@vger.kernel.org Cc: Andy Gross <andy.gross@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-08-16leds: do not overflow sysfs buffer in led_trigger_showNathan Sullivan
Per the documentation, use scnprintf instead of sprintf to ensure there is never more than PAGE_SIZE bytes of trigger names put into the buffer. Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com> Signed-off-by: Zach Brown <zach.brown@ni.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-08-16leds: make triggers explicitly non-modularPaul Gortmaker
The Kconfig currently controlling compilation of this code is: drivers/leds/trigger/Kconfig:menuconfig LEDS_TRIGGERS drivers/leds/trigger/Kconfig: bool "LED Trigger support" ...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modular infrastructure use, so that when reading the driver there is no doubt it is builtin-only. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. We don't replace module.h with init.h since the file doesn't need that. However it does use EXPORT_SYMBOL, so we add the export.h header. 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-08-15leds: is31fl319x: 1/3/6/9-channel light effect led driverH. Nikolaus Schaller
This is a driver for the Integrated Silicon Solution Inc. LED driver chips series IS31FL319x. They can drive 1, 3, 6 or up to 9 LEDs. Each LED is individually controllable in brightness (through pwm) in 256 steps so that RGB LEDs can show any of ca. 16 Mio colors. The maximum current of the LEDs can be programmed and limited to 5 .. 40mA through a device tree property. The chip is connected through I2C and can have one of 4 addresses in the range 0x64 .. 0x67 depending on how the AD pin is connected. The address is defined by the reg property as usual. The chip also has a shutdown input which could be connected to a GPIO, but this driver uses software shutdown if all LEDs are inactivated. The chip also has breathing and audio features which are not fully supported by this driver. Tested-on: OMAP5 based Pyra handheld prototype. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Andrey Utkin <andrey_utkin@fastmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-07-30Merge tag 'powerpc-4.8-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux Pull powerpc updates from Michael Ellerman: "Highlights: - PowerNV PCI hotplug support. - Lots more Power9 support. - eBPF JIT support on ppc64le. - Lots of cxl updates. - Boot code consolidation. Bug fixes: - Fix spin_unlock_wait() from Boqun Feng - Fix stack pointer corruption in __tm_recheckpoint() from Michael Neuling - Fix multiple bugs in memory_hotplug_max() from Bharata B Rao - mm: Ensure "special" zones are empty from Oliver O'Halloran - ftrace: Separate the heuristics for checking call sites from Michael Ellerman - modules: Never restore r2 for a mprofile-kernel style mcount() call from Michael Ellerman - Fix endianness when reading TCEs from Alexey Kardashevskiy - start rtasd before PCI probing from Greg Kurz - PCI: rpaphp: Fix slot registration for multiple slots under a PHB from Tyrel Datwyler - powerpc/mm: Add memory barrier in __hugepte_alloc() from Sukadev Bhattiprolu Cleanups & fixes: - Drop support for MPIC in pseries from Rashmica Gupta - Define and use PPC64_ELF_ABI_v2/v1 from Michael Ellerman - Remove unused symbols in asm-offsets.c from Rashmica Gupta - Fix SRIOV not building without EEH enabled from Russell Currey - Remove kretprobe_trampoline_holder from Thiago Jung Bauermann - Reduce log level of PCI I/O space warning from Benjamin Herrenschmidt - Add array bounds checking to crash_shutdown_handlers from Suraj Jitindar Singh - Avoid -maltivec when using clang integrated assembler from Anton Blanchard - Fix array overrun in ppc_rtas() syscall from Andrew Donnellan - Fix error return value in cmm_mem_going_offline() from Rasmus Villemoes - export cpu_to_core_id() from Mauricio Faria de Oliveira - Remove old symbols from defconfigs from Andrew Donnellan - Update obsolete comments in setup_32.c about entry conditions from Benjamin Herrenschmidt - Add comment explaining the purpose of setup_kdump_trampoline() from Benjamin Herrenschmidt - Merge the RELOCATABLE config entries for ppc32 and ppc64 from Kevin Hao - Remove RELOCATABLE_PPC32 from Kevin Hao - Fix .long's in tlb-radix.c to more meaningful from Balbir Singh Minor cleanups & fixes: - Andrew Donnellan, Anna-Maria Gleixner, Anton Blanchard, Benjamin Herrenschmidt, Bharata B Rao, Christophe Leroy, Colin Ian King, Geliang Tang, Greg Kurz, Madhavan Srinivasan, Michael Ellerman, Michael Ellerman, Stephen Rothwell, Stewart Smith. Freescale updates from Scott: - "Highlights include more 8xx optimizations, device tree updates, and MVME7100 support." PowerNV PCI hotplug from Gavin Shan: - PCI: Add pcibios_setup_bridge() - Override pcibios_setup_bridge() - Remove PCI_RESET_DELAY_US - Move pnv_pci_ioda_setup_opal_tce_kill() around - Increase PE# capacity - Allocate PE# in reverse order - Create PEs in pcibios_setup_bridge() - Setup PE for root bus - Extend PCI bridge resources - Make pnv_ioda_deconfigure_pe() visible - Dynamically release PE - Update bridge windows on PCI plug - Delay populating pdn - Support PCI slot ID - Use PCI slot reset infrastructure - Introduce pnv_pci_get_slot_id() - Functions to get/set PCI slot state - PCI/hotplug: PowerPC PowerNV PCI hotplug driver - Print correct PHB type names Power9 idle support from Shreyas B. Prabhu: - set power_save func after the idle states are initialized - Use PNV_THREAD_WINKLE macro while requesting for winkle - make hypervisor state restore a function - Rename idle_power7.S to idle_book3s.S - Rename reusable idle functions to hardware agnostic names - Make pnv_powersave_common more generic - abstraction for saving SPRs before entering deep idle states - Add platform support for stop instruction - cpuidle/powernv: Use CPUIDLE_STATE_MAX instead of MAX_POWERNV_IDLE_STATES - cpuidle/powernv: cleanup cpuidle-powernv.c - cpuidle/powernv: Add support for POWER ISA v3 idle states - Use deepest stop state when cpu is offlined Power9 PMU from Madhavan Srinivasan: - factor out power8 pmu macros and defines - factor out power8 pmu functions - factor out power8 __init_pmu code - Add power9 event list macros for generic and cache events - Power9 PMU support - Export Power9 generic and cache events to sysfs Power9 preliminary interrupt & PCI support from Benjamin Herrenschmidt: - Add XICS emulation APIs - Move a few exception common handlers to make room - Add support for HV virtualization interrupts - Add mechanism to force a replay of interrupts - Add ICP OPAL backend - Discover IODA3 PHBs - pci: Remove obsolete SW invalidate - opal: Add real mode call wrappers - Rename TCE invalidation calls - Remove SWINV constants and obsolete TCE code - Rework accessing the TCE invalidate register - Fallback to OPAL for TCE invalidations - Use the device-tree to get available range of M64's - Check status of a PHB before using it - pci: Don't try to allocate resources that will be reassigned Other Power9: - Send SIGBUS on unaligned copy and paste from Chris Smart - Large Decrementer support from Oliver O'Halloran - Load Monitor Register Support from Jack Miller Performance improvements from Anton Blanchard: - Avoid load hit store in __giveup_fpu() and __giveup_altivec() - Avoid load hit store in setup_sigcontext() - Remove assembly versions of strcpy, strcat, strlen and strcmp - Align hot loops of some string functions eBPF JIT from Naveen N. Rao: - Fix/enhance 32-bit Load Immediate implementation - Optimize 64-bit Immediate loads - Introduce rotate immediate instructions - A few cleanups - Isolate classic BPF JIT specifics into a separate header - Implement JIT compiler for extended BPF Operator Panel driver from Suraj Jitindar Singh: - devicetree/bindings: Add binding for operator panel on FSP machines - Add inline function to get rc from an ASYNC_COMP opal_msg - Add driver for operator panel on FSP machines Sparse fixes from Daniel Axtens: - make some things static - Introduce asm-prototypes.h - Include headers containing prototypes - Use #ifdef __BIG_ENDIAN__ #else for REG_BYTE - kvm: Clarify __user annotations - Pass endianness to sparse - Make ppc_md.{halt, restart} __noreturn MM fixes & cleanups from Aneesh Kumar K.V: - radix: Update LPCR HR bit as per ISA - use _raw variant of page table accessors - Compile out radix related functions if RADIX_MMU is disabled - Clear top 16 bits of va only on older cpus - Print formation regarding the the MMU mode - hash: Update SDR1 size encoding as documented in ISA 3.0 - radix: Update PID switch sequence - radix: Update machine call back to support new HCALL. - radix: Add LPID based tlb flush helpers - radix: Add a kernel command line to disable radix - Cleanup LPCR defines Boot code consolidation from Benjamin Herrenschmidt: - Move epapr_paravirt_early_init() to early_init_devtree() - cell: Don't use flat device-tree after boot - ge_imp3a: Don't use the flat device-tree after boot - mpc85xx_ds: Don't use the flat device-tree after boot - mpc85xx_rdb: Don't use the flat device-tree after boot - Don't test for machine type in rtas_initialize() - Don't test for machine type in smp_setup_cpu_maps() - dt: Add of_device_compatible_match() - Factor do_feature_fixup calls - Move 64-bit feature fixup earlier - Move 64-bit memory reserves to setup_arch() - Use a cachable DART - Move FW feature probing out of pseries probe() - Put exception configuration in a common place - Remove early allocation of the SMU command buffer - Move MMU backend selection out of platform code - pasemi: Remove IOBMAP allocation from platform probe() - mm/hash: Don't use machine_is() early during boot - Don't test for machine type to detect HEA special case - pmac: Remove spurrious machine type test - Move hash table ops to a separate structure - Ensure that ppc_md is empty before probing for machine type - Move 64-bit probe_machine() to later in the boot process - Move 32-bit probe() machine to later in the boot process - Get rid of ppc_md.init_early() - Move the boot time info banner to a separate function - Move setting of {i,d}cache_bsize to initialize_cache_info() - Move the content of setup_system() to setup_arch() - Move cache info inits to a separate function - Re-order the call to smp_setup_cpu_maps() - Re-order setup_panic() - Make a few boot functions __init - Merge 32-bit and 64-bit setup_arch() Other new features: - tty/hvc: Use IRQF_SHARED for OPAL hvc consoles from Sam Mendoza-Jonas - tty/hvc: Use opal irqchip interface if available from Sam Mendoza-Jonas - powerpc: Add module autoloading based on CPU features from Alastair D'Silva - crypto: vmx - Convert to CPU feature based module autoloading from Alastair D'Silva - Wake up kopald polling thread before waiting for events from Benjamin Herrenschmidt - xmon: Dump ISA 2.06 SPRs from Michael Ellerman - xmon: Dump ISA 2.07 SPRs from Michael Ellerman - Add a parameter to disable 1TB segs from Oliver O'Halloran - powerpc/boot: Add OPAL console to epapr wrappers from Oliver O'Halloran - Assign fixed PHB number based on device-tree properties from Guilherme G. Piccoli - pseries: Add pseries hotplug workqueue from John Allen - pseries: Add support for hotplug interrupt source from John Allen - pseries: Use kernel hotplug queue for PowerVM hotplug events from John Allen - pseries: Move property cloning into its own routine from Nathan Fontenot - pseries: Dynamic add entires to associativity lookup array from Nathan Fontenot - pseries: Auto-online hotplugged memory from Nathan Fontenot - pseries: Remove call to memblock_add() from Nathan Fontenot cxl: - Add set and get private data to context struct from Michael Neuling - make base more explicitly non-modular from Paul Gortmaker - Use for_each_compatible_node() macro from Wei Yongjun - Frederic Barrat - Abstract the differences between the PSL and XSL - Make vPHB device node match adapter's - Philippe Bergheaud - Add mechanism for delivering AFU driver specific events - Ignore CAPI adapters misplaced in switched slots - Refine slice error debug messages - Andrew Donnellan - static-ify variables to fix sparse warnings - PCI/hotplug: pnv_php: export symbols and move struct types needed by cxl - PCI/hotplug: pnv_php: handle OPAL_PCI_SLOT_OFFLINE power state - Add cxl_check_and_switch_mode() API to switch bi-modal cards - remove dead Kconfig options - fix potential NULL dereference in free_adapter() - Ian Munsie - Update process element after allocating interrupts - Add support for CAPP DMA mode - Fix allowing bogus AFU descriptors with 0 maximum processes - Fix allocating a minimum of 2 pages for the SPA - Fix bug where AFU disable operation had no effect - Workaround XSL bug that does not clear the RA bit after a reset - Fix NULL pointer dereference on kernel contexts with no AFU interrupts - powerpc/powernv: Split cxl code out into a separate file - Add cxl_slot_is_supported API - Enable bus mastering for devices using CAPP DMA mode - Move cxl_afu_get / cxl_afu_put to base - Allow a default context to be associated with an external pci_dev - Do not create vPHB if there are no AFU configuration records - powerpc/powernv: Add support for the cxl kernel api on the real phb - Add support for using the kernel API with a real PHB - Add kernel APIs to get & set the max irqs per context - Add preliminary workaround for CX4 interrupt limitation - Add support for interrupts on the Mellanox CX4 - Workaround PE=0 hardware limitation in Mellanox CX4 - powerpc/powernv: Fix pci-cxl.c build when CONFIG_MODULES=n selftests: - Test unaligned copy and paste from Chris Smart - Load Monitor Register Tests from Jack Miller - Cyril Bur - exec() with suspended transaction - Use signed long to read perf_event_paranoid - Fix usage message in context_switch - Fix generation of vector instructions/types in context_switch - Michael Ellerman - Use "Delta" rather than "Error" in normal output - Import Anton's mmap & futex micro benchmarks - Add a test for PROT_SAO" * tag 'powerpc-4.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (263 commits) powerpc/mm: Parenthesise IS_ENABLED() in if condition tty/hvc: Use opal irqchip interface if available tty/hvc: Use IRQF_SHARED for OPAL hvc consoles selftests/powerpc: exec() with suspended transaction powerpc: Improve comment explaining why we modify VRSAVE powerpc/mm: Drop unused externs for hpte_init_beat[_v3]() powerpc/mm: Rename hpte_init_lpar() and move the fallback to a header powerpc/mm: Fix build break when PPC_NATIVE=n crypto: vmx - Convert to CPU feature based module autoloading powerpc: Add module autoloading based on CPU features powerpc/powernv/ioda: Fix endianness when reading TCEs powerpc/mm: Add memory barrier in __hugepte_alloc() powerpc/modules: Never restore r2 for a mprofile-kernel style mcount() call powerpc/ftrace: Separate the heuristics for checking call sites powerpc: Merge 32-bit and 64-bit setup_arch() powerpc/64: Make a few boot functions __init powerpc: Re-order setup_panic() powerpc: Re-order the call to smp_setup_cpu_maps() powerpc/32: Move cache info inits to a separate function powerpc/64: Move the content of setup_system() to setup_arch() ...
2016-07-29Merge branch 'smp-hotplug-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull smp hotplug updates from Thomas Gleixner: "This is the next part of the hotplug rework. - Convert all notifiers with a priority assigned - Convert all CPU_STARTING/DYING notifiers The final removal of the STARTING/DYING infrastructure will happen when the merge window closes. Another 700 hundred line of unpenetrable maze gone :)" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (70 commits) timers/core: Correct callback order during CPU hot plug leds/trigger/cpu: Move from CPU_STARTING to ONLINE level powerpc/numa: Convert to hotplug state machine arm/perf: Fix hotplug state machine conversion irqchip/armada: Avoid unused function warnings ARC/time: Convert to hotplug state machine clocksource/atlas7: Convert to hotplug state machine clocksource/armada-370-xp: Convert to hotplug state machine clocksource/exynos_mct: Convert to hotplug state machine clocksource/arm_global_timer: Convert to hotplug state machine rcu: Convert rcutree to hotplug state machine KVM/arm/arm64/vgic-new: Convert to hotplug state machine smp/cfd: Convert core to hotplug state machine x86/x2apic: Convert to CPU hotplug state machine profile: Convert to hotplug state machine timers/core: Convert to hotplug state machine hrtimer: Convert to hotplug state machine x86/tboot: Convert to hotplug state machine arm64/armv8 deprecated: Convert to hotplug state machine hwtracing/coresight-etm4x: Convert to hotplug state machine ...
2016-07-22leds/trigger/cpu: Move from CPU_STARTING to ONLINE levelSebastian Andrzej Siewior
There is no need the ledtriger to be called *that* early in the hotplug process (+ with disabled interrupts). As explained by Jacek Anaszewski [0] there is no need for it. Therefore this patch moves it to the ONLINE/PREPARE_DOWN level using the dynamic registration for the id. [0] https://lkml.kernel.org/r/578C92BC.2070603@samsung.com Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: rt@linutronix.de Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: linux-leds@vger.kernel.org Link: http://lkml.kernel.org/r/1469028295-14702-1-git-send-email-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-07-19leds: is31fl32xx: define complete i2c_device_id tableH. Nikolaus Schaller
Otherwise the driver module will not be automatically probed. Fixes: 9d7cffaf99f5 ("leds: Add driver for the ISSI IS31FL32xx family of LED controllers") Fixes: e0442d7def8f ("leds: Add SN3218 and SN3216 support to the IS31FL32XX driver") Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Tested-by: David Rivshin <drivshin@allworx.com> Acked-by: David Rivshin <drivshin@allworx.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-07-19leds: is31fl32xx: fix typo in id and match table namesH. Nikolaus Schaller
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Tested-by: David Rivshin <drivshin@allworx.com> Acked-by: David Rivshin <drivshin@allworx.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-07-18leds: LED driver for TI LP3952 6-Channel Color LEDTony Makkiel
The chip can drive 2 sets of RGB leds. Controller can be controlled via PWM, I2C and audio synchronisation. This driver uses I2C to communicate with the chip. Datasheet: http://www.ti.com/lit/gpn/lp3952 Signed-off-by: Tony Makkiel <tony.makkiel@daqri.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-07-15leds/trigger/cpu: Convert to hotplug state machineRichard Cochran
This is a straightforward conversion. We place this callback last in the list so that the LED illuminates only after a successful bring up sequence. ( NOTE: The patch adds a FIXME question about the callback used, this question should probably be revisited later on.) Signed-off-by: Richard Cochran <rcochran@linutronix.de> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-leds@vger.kernel.org Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153336.465496902@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-11leds: leds-gpio: Set of_node for created LED devicesRafał Miłecki
When working with Device Tree we iterate over children of "gpio-leds" compatible node and create LED device for each of them. We take care of all common DT properties (label, default trigger, state, etc.), however some triggers may want to support more of them. It could be useful for timer trigger to support setting delay on/off values with Device Tree property. Or for transient trigger to support e.g. duration property. We obviously should handle such properties in triggers, not in generic code. To let trigger drivers read properties from DT node we need to set of_node to point the relevant node. This change allows using all kind of of helpers in e.g. "activate" callbacks. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-07-04leds: triggers: return error if invalid trigger name is provided via sysfsHeiner Kallweit
If an invalid trigger name is provided via sysfs currently no error is returned. Therefore it's not possible to determine whether the trigger was set successfully. Fix this by returning -EINVAL if no trigger is matched. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-06-29powerpc/opal: Add inline function to get rc from an ASYNC_COMP opal_msgSuraj Jitindar Singh
An opal_msg of type OPAL_MSG_ASYNC_COMP contains the return code in the params[1] struct member. However this isn't intuitive or obvious when reading the code and requires that a user look at the skiboot documentation or opal-api.h to verify this. Add an inline function to get the return code from an opal_msg and update call sites accordingly. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-06-20leds: convert IDE trigger to common disk triggerStephan Linz
This patch converts the IDE specific LED trigger to a generic disk activity LED trigger. The libata core is now a trigger source just like before the IDE disk driver. It's merely a replacement of the string ide by disk. The patch is taken from http://dev.gentoo.org/~josejx/ata.patch and is widely used by any ibook/powerbook owners with great satisfaction. Likewise, it is very often used successfully on different ARM platforms. Unlike the original patch, the existing 'ide-disk' trigger is still available for backward compatibility. That reduce the amount of patches in affected device trees out of the mainline kernel. For further development, the new name 'disk-activity' should be used. Cc: Joseph Jezak <josejx@gentoo.org> Cc: Jörg Sommer <joerg@alea.gnuu.de> Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Stephan Linz <linz@li-pro.net> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-06-20leds: pca9532: Add device tree supportPhil Reid
This patch adds basic device tree support for the pca9532 LEDs. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-06-08leds: handle suspend/resume in heartbeat triggerLinus Walleij
The following phenomena was observed: when suspending the system, sometimes the heartbeat LED was left on, glowing and wasting power while the rest of the system is asleep, also disturbing power dissapation measures on the odd suspend cycle when it's left on. Clearly this is not how we want the heartbeat trigger to work: it should turn off and leave the LED off during system suspend. This removes the heartbeat trigger when preparing suspend and restores it during resume. The trigger code will make sure all LEDs are left in OFF state after removing the trigger, and will re-enable the trigger on all LEDs after resuming. Cc: linux-pm@vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-06-08leds: core: Fix brightness setting upon hardware blinking enabledTony Makkiel
Commit 76931edd54f8 ("leds: fix brightness changing when software blinking is active") changed the semantics of led_set_brightness() which according to the documentation should disable blinking upon any brightness setting. Moreover it made it different for soft blink case, where it was possible to change blink brightness, and for hardware blink case, where setting any brightness greater than 0 was ignored. While the change itself is against the documentation claims, it was driven also by the fact that timer trigger remained active after turning blinking off. Fixing that would have required major refactoring in the led-core, led-class, and led-triggers because of cyclic dependencies. Finally, it has been decided that allowing for brightness change during blinking is beneficial as it can be accomplished without disturbing blink rhythm. The change in brightness setting semantics will not affect existing LED class drivers that implement blink_set op thanks to the LED_BLINK_SW flag introduced by this patch. The flag state will be from now on checked in led_set_brightness() which will allow to distinguish between software and hardware blink mode. In the latter case the control will be passed directly to the drivers which apply their semantics on brightness set, which is disable the blinking in case of most such drivers. New drivers will apply new semantics and just change the brightness while hardware blinking is on, if possible. The issue was smuggled by subsequent LED core improvements, which modified the code that originally introduced the problem. Fixes: f1e80c07416a ("leds: core: Add two new LED_BLINK_ flags") Signed-off-by: Tony Makkiel <tony.makkiel@daqri.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-05-25Merge tag 'pwm/for-4.7-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm Pull pwm updates from Thierry Reding: "This set of changes introduces an atomic API to the PWM subsystem. This is influenced by the DRM atomic API that was introduced a while back, though it is obviously a lot simpler. The fundamental idea remains the same, though: drivers provide a single callback to implement the atomic configuration of a PWM channel. As a side-effect the PWM subsystem gains the ability for initial state retrieval, so that the logical state mirrors that of the hardware. Many use-cases don't care about this, but for others it is essential. These new features require changes in all users, which these patches take care of. The core is transitioned to use the atomic callback if available and provides a fallback mechanism for other drivers. Changes to transition users and drivers to the atomic API are postponed to v4.8" * tag 'pwm/for-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (30 commits) pwm: Add information about polarity, duty cycle and period to debugfs pwm: Switch to the atomic API pwm: Update documentation pwm: Add core infrastructure to allow atomic updates pwm: Add hardware readout infrastructure pwm: Move the enabled/disabled info into pwm_state pwm: Introduce the pwm_state concept pwm: Keep PWM state in sync with hardware state ARM: Explicitly apply PWM config extracted from pwm_args drm: i915: Explicitly apply PWM config extracted from pwm_args input: misc: pwm-beeper: Explicitly apply PWM config extracted from pwm_args input: misc: max8997: Explicitly apply PWM config extracted from pwm_args backlight: lm3630a: explicitly apply PWM config extracted from pwm_args backlight: lp855x: Explicitly apply PWM config extracted from pwm_args backlight: lp8788: Explicitly apply PWM config extracted from pwm_args backlight: pwm_bl: Use pwm_get_args() where appropriate fbdev: ssd1307fb: Use pwm_get_args() where appropriate regulator: pwm: Use pwm_get_args() where appropriate leds: pwm: Use pwm_get_args() where appropriate input: misc: max77693: Use pwm_get_args() where appropriate ...
2016-05-17leds: pwm: Use pwm_get_args() where appropriateBoris Brezillon
The PWM framework has clarified the concept of reference PWM config (the platform dependent config retrieved from the DT or the PWM lookup table) and real PWM state. Use pwm_get_args() when the PWM user wants to retrieve this reference config and not the current state. This is part of the rework allowing the PWM framework to support hardware readout and expose real PWM state even when the PWM has just been requested (before the user calls pwm_config/enable/disable()). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2016-05-06leds: gpio: Support the "panic-indicator" firmware propertyEzequiel Garcia
Calling a GPIO LEDs is quite likely to work even if the kernel has paniced, so they are ideal to blink in this situation. This commit adds support for the new "panic-indicator" firmware property, allowing to mark a given LED to blink on a kernel panic. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-by: Matthias Brugger <mbrugger@suse.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-05-06leds: triggers: Allow to switch the trigger to "panic" on a kernel panicEzequiel Garcia
This commit adds a new led_cdev flag LED_PANIC_INDICATOR, which allows to mark a specific LED to be switched to the "panic" trigger, on a kernel panic. This is useful to allow the user to assign a regular trigger to a given LED, and still blink that LED on a kernel panic. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-by: Matthias Brugger <mbrugger@suse.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-04-19leds: ss4200: add DMI data for FSC SCALEO Home ServerMartin Dummer
The Intel NAS SS4200 was also sold by Fujitsu Siemens (FSC) under the name "SCALEO Home Server". The hardware is equivalent. This patch adds the DMI data of this rebranded device. Signed-off-by: Martin Dummer <martin.dummer@gmx.net> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-04-19leds: ss4200: Add depend on x86 archMartin Dummer
There is only one x86 hardware where the driver leds-ss4200 applies to. Add kconfig dependency to x86 architecture, fix help text whitespace. Signed-off-by: Martin Dummer <martin.dummer@gmx.net> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-04-19leds: ledtrig-ide-disk: Move ide_blink_delay to ledtrig_ide_activity()Jacek Anaszewski
Parameters delay_on and delay_off of led_trigger_blink_oneshot() are pointers, to enable blink interval adjustment by LED class drivers of the controllers that implement hardware blinking. Move ide_blink_delay variable to ledtrig_ide_activity() in order to prevent the situation when adjustment committed by one LED class driver influences blink interval of the software fallback blink feature, that is applied to the drivers that don't implement blink_set op. Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-04-14leds: tca6507: silence an uninitialized variable warningDan Carpenter
If choose_times() returns -EINVAL that means "c1" and "c2" haven't been initialized. I've added a check for that. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-04-13leds: trigger: Introduce a MTD (NAND/NOR) triggerEzequiel Garcia
This commit introduces a MTD trigger for flash (NAND/NOR) device activity. The implementation is copied from IDE disk. This trigger deprecates the "nand-disk" LED trigger, but for backwards compatibility, we still keep the "nand-disk" trigger around. The motivation for deprecating the "nand-disk" LED trigger is that it only works for NAND drivers, whereas the "mtd" LED trigger is more generic (in fact, "nand-disk" currently only works for certain NAND drivers). Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-30leds: trigger: Introduce a kernel panic LED triggerEzequiel Garcia
This commit introduces a new LED trigger which allows to configure a LED to blink on a kernel panic (through panic_blink). Notice that currently the Openmoko FreeRunner (GTA02) mach code sets panic_blink to blink a hard-coded LED. The new trigger is meant to introduce a generic mechanism to achieve this. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
2016-03-23Merge tag 'platform-drivers-x86-v4.6-1' of ↵Linus Torvalds
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ń
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ń
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 Kallweit
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 Chawla
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 Chawla
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 Chawla
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 Chawla
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 Chawla
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 Chawla
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 Rivshin
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 Rivshin
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>