summaryrefslogtreecommitdiffstats
path: root/drivers/led
Commit message (Collapse)AuthorAgeFilesLines
* PWM: align struct pwm_state member names with LinuxAhmad Fatoum11 days1-4/+4
| | | | | | | | | | This introduces no functional change, but removes some churn of porting Linux drivers by aligning the naming of the frequently used struct pwm_state. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240415053600.370622-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: use dev_err_probe instead of comparisons against EPROBE_DEFERAhmad Fatoum2024-02-201-4/+1
| | | | | | | | | | | | | | Drivers should not need to compare an error value against EPROBE_DEFER. We have a number of drivers doing that though to decide whether to print an error or not. This error message will be lost if the probe is deferred, so use dev_err_probe to store the error in that case. While at it, we shorten the error messages a bit. dev_err_probe will already print the string 'error' before the error code string. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219172659.3796647-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Print device nodes with %pOFSascha Hauer2023-07-031-2/+2
| | | | | | | We have the %pOF format specifier for printing device nodes. Use it where appropriate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-133-0/+3
| | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-103-3/+3
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-103-3/+3
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-103-4/+4
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: led: pca955x: Remove redundant assignmentAlexander Shiyan2022-06-301-3/+2
| | | | | | Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220629063024.3945-6-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-222-2/+2
| | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-017-54/+7
| | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: include <linux/math64.h> wrapper instead of <asm-generic/div64.h>Ahmad Fatoum2021-02-191-1/+1
| | | | | | | | | | | <asm-generic/div64.h> isn't meant for direct usage as <asm/div64.h> may override this on a per-architecture basis. We don't do that currently, but in the future we might. Include the <linux/math64.h> instead. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/driver-macro' into masterSascha Hauer2020-10-141-5/+1
|\
| * treewide: Use driver macroSascha Hauer2020-09-291-5/+1
| | | | | | | | | | | | | | We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | led: pca955x: fix probing from device treeAhmad Fatoum2020-10-091-40/+37
|/ | | | | | | | | | | | dev->id_entry is not populated for devices probed from the device tree. It was used unconditionally however. Use device_get_match_data instead to support device tree probing. While at it, remove the array and the enum, we can store pointers to the correct chipdef structs directly. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* poller: Give pollers a nameSascha Hauer2020-05-201-1/+1
| | | | | | It helps debugging when pollers have a name, so give them one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: remove references to CREDITSUwe Kleine-König2020-04-274-12/+0
| | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: pwm: use new pwm_apply_state APIAhmad Fatoum2020-03-311-7/+10
| | | | | | | | To support PWM_POLARITY_INVERTED for PWM LEDs, we need to to use the apply API. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: pwm: always initialize PWM LEDs as inactiveAhmad Fatoum2020-03-311-1/+1
| | | | | | | | | | While the active-low property is respected when setting brightness, it's ignored when initializing the LED as off in the probe function and thus LEDs are active on startup. Fix this. Fixes: 769eb5e7bb ("led: pwm: support active-low property") Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: pwm: support active-low propertyAhmad Fatoum2020-02-101-0/+4
| | | | | | | | active-low is an optional property to describe PWMs where the LED is wired to supply rather than ground. Add barebox support for it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: pwm: fail if required max-brightness option is missingAhmad Fatoum2020-02-101-1/+3
| | | | | | | | | If we leave max_value at the default value of zero led_pwm_set above will divide by zero in do_div. The binding makes max-brightness a mandatory property, so have the driver treat it as such as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: pwm: don't test if pointer is smaller than zeroAhmad Fatoum2020-02-101-1/+1
| | | | | | | | of_pwm_request returns either the valid or an error pointer. Revise the error check to reflect this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-01-151-1/+0
|\
| * led: pca955x: remove ineffectual assignmentAhmad Fatoum2019-12-131-1/+0
| | | | | | | | | | | | | | | | | | the .num member of struct led is a 'private' member populated by led_register. Populating it has no effect because it's always overwritten. Remove the assignment. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | led: parse panic-indicator from device-treeHubert Feurstein2019-12-111-3/+8
| | | | | | | | | | Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | led: check for 'barebox, default-trigger' when 'linux, default-trigger' is ↵Hubert Feurstein2019-12-111-5/+8
| | | | | | | | | | | | | | | | | | | | not found When the linux,default-trigger is not found by barebox, then also check if there might be a barebox,default-trigger. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | led: unify led trigger tablesHubert Feurstein2019-12-112-43/+28
|/ | | | | | | | | | Currently we have two slightly different led-trigger tables. One in the core module, and the other one in the led-triggers module. The one in the core module, which is used to parse the device-tree triggers, is lacking net-rx and net-tx. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: core: Make use of ARRAY_AND_SIZEAndrey Smirnov2018-12-101-2/+2
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: core: Initialize blink_next_event with 0Andrey Smirnov2018-12-101-1/+1
| | | | | | | | | A simpler way to make pattern to trigger immediately is to initialize blink_next_event to 0 instead of current time value. Save a function call and convert the code to do just that. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: core: Don't call get_time_us() twiceAndrey Smirnov2018-12-101-2/+3
| | | | | | | | | The code doesn't seem to be time-sensitive enough to warrant calling get_time_ns() twice instead of caching its value and using it no both places. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: use max led value in case of led triggerOleg.Karfich@wago.com2018-09-101-1/+3
| | | | | | | | | | The led_poller function blink_func uses for flashing and blinking only the values 1/0 for setting the leds. In case of an e.g. gpio led this is true. But in case of pwm driven leds, where someone could dimm the leds, the value of 1 dimms the led. Use the max value for blinking and flashing of a led when enabling. Signed-off-by: Oleg Karfich <oleg.karfich@wago.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: add pca955x led supportOleg.Karfich@wago.com2018-09-103-0/+431
| | | | | Signed-off-by: Oleg Karfich <oleg.karfich@wago.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led-trigger: Allow multiple led triggers of the same typeSascha Hauer2017-03-301-28/+97
| | | | | | | | | | | | | | We used to have a static array of trigger types which, allows only one led per trigger. While this is enough for panic and heartbeat, it falls short when multiple leds are associated to the default-on trigger. The default-on trigger is used to turn on a led statically from devicetree and may be used multiple times. This patch reworks the led triggers so that a trigger struct is allocated dynamically when needed and put onto a list. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: trigger: Use led triggersSascha Hauer2017-03-301-35/+5
| | | | | | | | | Since the LED framework now supports blinking/flashing, use this functionality in the LED triggers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: add blinking/flashing and led_blink_pattern interfaceSascha Hauer2017-03-302-1/+101
| | | | | | | | | | | | | | | So far blinking/flashing LEDs is only supported on led-trigger level. Even without triggers it useful to be able to blink/flash LEDs, so add this functionality to the LED core. A led_blink_pattern consists of a number of on and off-periods which are described in an array. Using such an array you can encode nearly every blink pattern you need. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: gpio: Free GPIOs on unregister()Sebastian Hesselbarth2015-04-201-0/+6
| | | | | | | | Free requested GPIOs on unregistration of mono-, bi-, and tri-color GPIO leds. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: Fix led_gpio_rgb_unregister prototypeSascha Hauer2015-04-201-1/+1
| | | | | | | Analog to the other led_unregister prototypes this must take the LED type specific struct. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: gpio: Properly deal with deferred probingSebastian Hesselbarth2015-04-171-4/+26
| | | | | | | | | | GPIO LEDs can suffer from deferred probing due to failing gpio request. Instead of registering each gpio led independently, pre-allocate an array of struct gpio_led for all and tear it down properly if probing of one leds fails. While at it, silence error messages on -EPROBE_DEFER. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: gpio: add support for default-state dt-propertyHubert Feurstein2015-03-041-0/+8
| | | | | | | This patch adds support for the default-state device tree property. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: trigger: Turn of flashing leds only onceSascha Hauer2014-10-081-1/+4
| | | | | | | The current code continuously turns leds off. Preserve the current led status so that we only turn it off once. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: trigger: use max_value to turn on led instead of hardcoded '1'Sascha Hauer2014-10-081-2/+2
| | | | | | For PWM LEDs '1' may be really dark. Use max_value instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2014-08-071-1/+5
|\ | | | | | | | | Conflicts: lib/Makefile
| * led: try to get LED's label from the 'label' propertyAntony Pavlov2014-07-291-1/+5
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | led: triggers: fix "no previous prototype for 'trigger_init'" warningAntony Pavlov2014-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | Here is compiler's message: drivers/led/led-triggers.c:148:5: warning: no previous prototype for 'trigger_init' [-Wmissing-prototypes] int trigger_init(void) ^ Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | led: triggers: fix crash on disabling "default-on" triggerAntony Pavlov2014-07-311-1/+1
|/ | | | | | | | | | | | | | | | | | Here is a sample crash log on Ritmix RZX-50: barebox:/ trigger 0: panic 1: heartbeat 2: net rx 3: net tx 4: net 5: default on (led 0) barebox:/ trigger -d 5 ... Ooops, TLB miss on store! Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: Add default-on triggerSascha Hauer2014-03-032-0/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: Add pwm-led driverSascha Hauer2014-03-033-0/+98
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: move led_of_parse_trigger to coreSascha Hauer2014-03-032-35/+34
| | | | | | So that other LED drivers can use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: trigger: disable LEDs with trigger before installing itSebastian Hesselbarth2013-11-111-1/+3
| | | | | | | | | This disables LEDs that have a trigger function assigned right before the trigger is installed. As the trigger was parsed before the LED has been registered, also swap LED registration and trigger parsing. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* led: gpio: Add trigger supportSascha Hauer2013-07-101-0/+33
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* LED: add support for device tree parsing of gpio-ledsSebastian Hesselbarth2013-07-092-0/+49
| | | | | | | | This adds a driver option to probe GPIO LEDs from device tree compatible with "gpio-leds" device tree nodes. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>