aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/gpio/gpioled.c
Commit message (Collapse)AuthorAgeFilesLines
* gpioled: remove redundant -1 checkAhmad Khalifa2025-09-181-2/+0
| | | | | | | The function is never called with onoff = -1 MFC after: 3 days MFC with: 9ae3c30
* gpioled: use hw pin inversion if availableStéphane Rochoy2025-09-051-17/+91
| | | | | | | | | | | | | | | | | | Add hint.gpioled.%d.invmode to allow setting the pin inversion method. Accept the following values: - auto Use hardware pin inversion if available, else fallback to software pin inversion. - hw Use hardware pin inversion. - sw Use software pin inversion. Default is auto. This hint is ignored when no pin inversion is requested (hint.gpioled.%d.invert=0). Signed-off-by: Stéphane Rochoy <stephane.rochoy@stormshield.eu> Sponsored-by: Stormshield Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1805
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* gpio: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-091-3/+1
|
* gpioled: add a new hint for initial stateAndriy Gapon2019-05-231-0/+3
| | | | | | | | | | | | | | | hint.gpioled.%d.state determines the initial state of the LED when the driver takes control over it: 0 - the LED is off 1 - the LED is on -1 - the LED is kept as it was While here, add a module version declaration. MFC after: 2 weks Notes: svn path=/head/; revision=348153
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Refactor FDT part of gpioled driverOleksandr Tymoshenko2016-11-071-99/+0
| | | | | | | | | | | | - Split driver in two parts: FDT and non-FDT - Instead of reattach gpioled nodes to GPIO bus use gpio_pin_get_by_ofw_idx and add ofwbus and simplebus as parrent buses Reviewed by: loos Differential Revision: https://reviews.freebsd.org/D8233 Notes: svn path=/head/; revision=308428
* [gpioled] add support for inverting the LED polarity.Adrian Chadd2016-07-311-0/+5
| | | | | | | | | | No, this isn't a star trek science joke - sometimes LEDs are wired up to be active low, so this is needed. Submitted by: Dan Nelson <dnelson_1901@yahoo.com> Notes: svn path=/head/; revision=303574
* Get rid of two consumers of gpiobus acquire/release.Luiz Otavio O Souza2016-05-221-11/+3
| | | | | | | | | | | | | The GPIO hardware should not be owned by a single device, this defeats any chance of use of the GPIO controller as an interrupt source. ow(4) is now the only consumer of this 'feature' before we can remove it for good. Discussed with: ian, bsdimp Notes: svn path=/head/; revision=300392
* Fix probe routine to return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.Luiz Otavio O Souza2016-05-221-6/+5
| | | | | | | While here fix a few style(9) issues. Notes: svn path=/head/; revision=300390
* Add OF_prop_free function as a counterpart for OF_*prop_allocOleksandr Tymoshenko2016-05-111-3/+3
| | | | | | | | | | | | | | | | | | | - Introduce new OF API function OF_prop_free to free memory allocated by OF_getprop_alloc and OF_getencprop_alloc. Current code just calls free(9) with M_OFWPROP memory class which assumes knowledge about OF_*prop_alloc functions' internals and leads to unneccessary code coupling - Convert some of the free(..., M_OFWPROP) instances to OF_prop_free Files affected by this commit are the ones I was able to test on real hardware. The rest of free(..., M_OFWPROP) instances will be handled with idividual maintainers Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D6315 Notes: svn path=/head/; revision=299477
* Use DEVMETHOD_END instead of its value to indicate end of methods tableOleksandr Tymoshenko2016-05-111-1/+1
| | | | Notes: svn path=/head/; revision=299396
* gpioled(4) depends on gpiobus.Luiz Otavio O Souza2015-08-171-0/+1
| | | | | | | | | This fixes the loading of gpioled as a module. Sponsored by: Rubicon Communications (Netgate) Notes: svn path=/head/; revision=286847
* This implements default-state support as described in:Ganbold Tsagaankhuu2015-05-241-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/leds-gpio.txt Without this booting the VSATV102 causes the blue "working" led to turn off when the kernel starts up. With this the led (which is turned on by the firmware) stays on since that's the default state specified in the FDT. Expanded the meaning of the led_create_state state parameter in order to implement support for "keep". The original values were: == 0 Off != 0 On The new values are: == -1 don't change / keep current setting == 0 Off != -1 && != 0 On This should have no effect on acpi_asus_attach which only calls led_create_state with state set to 1. Updated acpi_ibm_attach in order to avoid surprises. Differential Revision: https://reviews.freebsd.org/D2615 Submitted by: John Wehle Reviewed by: gonzo, loos Notes: svn path=/head/; revision=283360
* Handle multiple "gpio-leds"-compatible nodesOleksandr Tymoshenko2015-04-021-8/+9
| | | | | | | | | | There are cases when gpioled nodes in DTS come from different sources (e.g. standard Beaglebone Black LEDs in main DTS + shield LEDs in overlay DTS) so instead of handling only first compatible node go through all child nodes Notes: svn path=/head/; revision=280978
* Add ofw_gpiobus_parse_gpios(), a new public function, to parse the gpiosLuiz Otavio O Souza2015-02-281-3/+5
| | | | | | | | | | | | | | | | property for devices that doesn't descend directly from gpiobus. The parser supports multiple pins, different GPIO controllers and can use arbitrary names for the property (to match the many linux variants: cd-gpios, power-gpios, wp-gpios, etc.). Pass the driver name on ofw_gpiobus_add_fdt_child(). Update gpioled to match. An usage example of ofw_gpiobus_parse_gpios() will follow soon. Notes: svn path=/head/; revision=279408
* Fix the build of non-FDT systems by moving the gpiobusvar.h header outsideLuiz Otavio O Souza2014-11-011-5/+3
| | | | | | | | | the FDT #ifdef. While here remove a few unused headers. Notes: svn path=/head/; revision=273926
* Fix the gpiobus locking by using a more sane model where it isn't necessaryLuiz Otavio O Souza2014-10-311-8/+15
| | | | | | | | | | | | | | | | | | | hold the gpiobus lock between the gpio calls. gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus what to do when the bus is already busy. When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep until the bus became free. With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right away and then it can act upon. This fixes the gpioiic(4) locking issues that arises when doing multiple concurrent access on the bus. Notes: svn path=/head/; revision=273917
* Add OFW support to the in tree gpio compatible devices: gpioiic(4) andLuiz Otavio O Souza2014-02-131-0/+83
| | | | | | | | | | | | | | | | | | | gpioled(4). Tested on RPi and BBB (using the hardware I2C controller and gpioiic(4) for the I2C tests). It was also verified for regressions on RSPRO (MIPS/ar71xx) used as reference for a non OFW-based system. Update the gpioled(4) and gpioiic(4) man pages with some details and examples about the FDT/OFW support. Some compatibility details pointed out by imp@ will follow in subsequent commits. Approved by: adrian (mentor, implicit) Notes: svn path=/head/; revision=261843
* Move the GPIOBUS_SET_PINFLAGS(..., ..., pin, GPIO_PIN_OUTPUT) to led(4)Luiz Otavio O Souza2013-12-061-3/+2
| | | | | | | | | | control callback function. This makes gpioled(4) works even if the pin is accidentally set to an input. Approved by: adrian (mentor) Notes: svn path=/head/; revision=259036
* Set the pin to output on attach, we can't assume it already is.Andrew Thompson2010-11-081-0/+3
| | | | | | | Reviewed by: gonzo Notes: svn path=/head/; revision=214971
* Fix legal staff in GPIO sources:Oleksandr Tymoshenko2010-09-291-10/+11
| | | | | | | | | | | - license clause now contains "AUTHOR AND CONTRIBUTORS" instead of just "AUTHOR" - Add license/copyright to gpioc.c Spotted by: Edward Tomasz Napierala, Andrew Turner Notes: svn path=/head/; revision=213277
* Initial GPIO bus support. Includes:Oleksandr Tymoshenko2010-09-281-0/+142
- GPIO bus controller interface - GPIO bus interface - Implementation of GPIO led(4) compatible device - Implementation of iic(4) bus over GPIO (author: Luiz Otavio O Souza) Tested by: Luiz Otavio O Souza, Alexandr Rybalko Notes: svn path=/head/; revision=213237