aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio
AgeCommit message (Collapse)AuthorFilesLines
2018-01-11gpio: winbond: fix ISA_BUS_API dependencyArnd Bergmann1-1/+1
The newly added GPIO driver for winbond chipsets causes a circular dependency warning in Kconfig: drivers/gpio/Kconfig:13:error: recursive dependency detected! drivers/gpio/Kconfig:13: symbol GPIOLIB is selected by STX104 drivers/iio/adc/Kconfig:699: symbol STX104 depends on ISA_BUS_API arch/Kconfig:830: symbol ISA_BUS_API is selected by GPIO_WINBOND drivers/gpio/Kconfig:701: symbol GPIO_WINBOND depends on GPIOLIB The underlying problem is that ISA_BUS_API is not meant to be selected by device drivers, instead it is provided by the architectures that support ISA add-on card devices, or in case of x86 have this explicitly enabled. This particular driver appears to be different from the other ISA_BUS_API based drivers, in that it is not normally an add-on card (ISA or PC104) but instead is an LPC-attached component on the mainboard. We already support other functionality provided by this chip, at least drivers/watchdog/w83627hf_wdt.c and drivers/hwmon/w83627ehf.c, plus there is a discovery function for this hardware in drivers/parport/parport_pc.c. If we want to use this driver without having to enable CONFIG_EXPERT, it might be better to not use the isa_bus_type for it, but rather turn it into a platform_driver, acpi_driver or add an MFD for it that is shared with the wdt and hwmon portions and does the probing. For now, this patch fixes the dependency by changing 'select' into 'depends on'. Cc: William Breathitt Gray <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Maciej S. Szmigiero <[email protected]> Cc: Andy Shevchenko <[email protected]> Fixes: a0d65009411c ("gpio: winbond: Add driver") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-10gpio: Add GPIO support for the ACCES PCIe-IDIO-24 familyWilliam Breathitt Gray3-0/+458
The ACCES PCIe-IDIO-24 device provides 56 lines of digital I/O (24 lines of optically-isolated non-polarized digital inputs for AC and DC control signals, 24 lines of isolated solid state FET digital outputs, and 8 non-isolated TTL/CMOS compatible programmable I/O). An interrupt is generated when any of the inputs change state (low to high or high to low). Input filter control is not supported by this driver, and input filters are deactivated by this driver. These devices are capable of get_multiple and set_multiple functionality, but these functions have not yet been implemented for this driver. Change-Of-State (COS) detection functionality may be configured to fire interrupts on exclusively rising/falling edges, but this driver currently only implements COS detection for either both edges or none. Signed-off-by: William Breathitt Gray <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-10gpiolib: Export gpiochip_irqchip_irq_valid() to driversStephen Boyd1-2/+3
Some pinctrl drivers can use the gpiochip irq valid information to figure out if certain gpios are exposed to the kernel for usage or not. Expose this API so we can use it in the pinmux_ops::request ops. Signed-off-by: Stephen Boyd <[email protected]> Acked-by: Bjorn Andersson <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-10gpio: Add missing open drain/source handling to gpiod_set_value_cansleep()Geert Uytterhoeven1-12/+23
Since commit f11a04464ae57e8d ("i2c: gpio: Enable working over slow can_sleep GPIOs"), probing the i2c RTC connected to an i2c-gpio bus on r8a7740/armadillo fails with: rtc-s35390a 0-0030: error resetting chip rtc-s35390a: probe of 0-0030 failed with error -5 More debug code reveals: i2c i2c-0: master_xfer[0] R, addr=0x30, len=1 i2c i2c-0: NAK from device addr 0x30 msg #0 s35390a_get_reg: ret = -6 Commit 02e479808b5d62f8 ("gpio: Alter semantics of *raw* operations to actually be raw") moved open drain/source handling from gpiod_set_raw_value_commit() to gpiod_set_value(), but forgot to take into account that gpiod_set_value_cansleep() also needs this handling. The i2c protocol mandates that i2c signals are open drain, hence i2c communication fails. Fix this by adding the missing handling to gpiod_set_value_cansleep(), using a new common helper gpiod_set_value_nocheck(). Fixes: 02e479808b5d62f8 ("gpio: Alter semantics of *raw* operations to actually be raw") Signed-off-by: Geert Uytterhoeven <[email protected]> [removed underscore syntax, added kerneldoc] Signed-off-by: Linus Walleij <[email protected]>
2018-01-10gpio: merrifield: Add support of ACPI enabled platformsAndy Shevchenko1-1/+10
The driver needs the pin control device name for ACPI. We are looking through ACPI namespace and return first found device based on ACPI HID for Intel Merrifield FLIS (pin control device). Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2018-01-09gpio: correct docs about return value of gpiod_get_directionWolfram Sang1-1/+1
The use of the GPIOF_* flags is deprecated, so don't advertise them here. Document the plain numbers for now until we have a better solution. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-09gpio: winbond: Add driverMaciej S. Szmigiero3-0/+749
This commit adds GPIO driver for Winbond Super I/Os. Currently, only W83627UHG model (also known as Nuvoton NCT6627UD) is supported but in the future a support for other Winbond models, too, can be added to the driver. A module parameter "gpios" sets a bitmask of GPIO ports to enable (bit 0 is GPIO1, bit 1 is GPIO2, etc.). One should be careful which ports one tinkers with since some might be managed by the firmware (for functions like powering on and off, sleeping, BIOS recovery, etc.) and some of GPIO port pins are physically shared with other devices included in the Super I/O chip. Signed-off-by: Maciej S. Szmigiero <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-08gpio: of: Support SPI nonstandard GPIO propertiesLinus Walleij1-0/+35
Before it was clearly established that all GPIO properties in the device tree shall be named "foo-gpios" (with the deprecated variant "foo-gpio" for single lines) we unfortunately merged a few bindings which named the lines "gpio-foo" instead. This is most prominent in the GPIO SPI driver in Linux which names the lines "gpio-sck", "gpio-mosi" and "gpio-miso". As we want to switch the GPIO SPI driver to using descriptors, we need devm_gpiod_get() to return something reasonable when looking up these in the device tree. Put in a special #ifdef:ed kludge to do this special lookup only for the SPI case and gets compiled out if we're not enabling SPI. If we have more oddly defined legacy GPIOs like this, they can be handled in a similar manner. Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-05gpio: label descriptors using the device nameLinus Walleij1-1/+2
Some GPIO lines appear named "?" in the lsgpio dump due to their requesting drivers not passing a reasonable label. Most typically this happens if a device tree node just defines gpios = <...> and not foo-gpios = <...>, the former gets named "foo" and the latter gets named "?". However the struct device passed in is always valid so let's just label the GPIO with dev_name() on the device if no proper label was passed. Cc: Reported-by: Jason Kridner <[email protected]> Reported-by: Jason Kridner <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-03gpio: omap: Give unique labels to each GPIO bank/chipLinus Walleij1-1/+6
As we need to add GPIO lookup tables to the OMAP platforms, we need to reference each GPIO chip with a unique label. Use the GPIO base to name each chip, "gpio-0-31", "gpio-32-63" etc. Cc: Grygorii Strashko <[email protected]> Cc: Santosh Shilimkar <[email protected]> Cc: Kevin Hilman <[email protected]> Cc: [email protected] Signed-off-by: Linus Walleij <[email protected]>
2018-01-02gpiolib: add desc validation to gpiod_set_transitory()Vladimir Zapolskiy1-0/+1
The gpiod_set_transitory() function is publicly exported, and it is expected from it to be ready for usage with optional GPIOs on consumer's side. Signed-off-by: Vladimir Zapolskiy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-02gpiolib: remove a redundant check in gpiod_to_chip()Vladimir Zapolskiy1-1/+1
This non-functional change slightly simplifies the implementation of gpiod_to_chip() function. Signed-off-by: Vladimir Zapolskiy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-01-02gpiolib: don't dereference a desc before validationVladimir Zapolskiy1-1/+2
The fix restores a proper validation of an input gpio desc, which might be needed to deal with optional GPIOs correctly. Fixes: 02e479808b5d ("gpio: Alter semantics of *raw* operations to actually be raw") Signed-off-by: Vladimir Zapolskiy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-29genirq/irqdomain: Rename early argument of irq_domain_activate_irq()Thomas Gleixner1-1/+1
The 'early' argument of irq_domain_activate_irq() is actually used to denote reservation mode. To avoid confusion, rename it before abuse happens. No functional change. Fixes: 72491643469a ("genirq/irqdomain: Update irq_domain_ops.activate() signature") Signed-off-by: Thomas Gleixner <[email protected]> Cc: Alexandru Chirvasitu <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Dou Liyang <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Maciej W. Rozycki <[email protected]> Cc: Mikael Pettersson <[email protected]> Cc: Josh Poulson <[email protected]> Cc: Mihai Costache <[email protected]> Cc: Stephen Hemminger <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: [email protected] Cc: Haiyang Zhang <[email protected]> Cc: Dexuan Cui <[email protected]> Cc: Simon Xiao <[email protected]> Cc: Saeed Mahameed <[email protected]> Cc: Jork Loeser <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: [email protected] Cc: KY Srinivasan <[email protected]> Cc: Alan Cox <[email protected]> Cc: Sakari Ailus <[email protected]>, Cc: [email protected]
2017-12-29gpio: brcmstb: Make really use of the new lockdep classThomas Gleixner1-1/+1
The recent extension of irq_set_lockdep_class() with a second argument added the new lockdep class to the mrcmstb driver, but used the already existing lockdep class as second argument, which leaves the new lockdep class defined but unused. Use the new lockdep class as that's what the change intended to do. Fixes: 39c3fd58952d ("kernel/irq: Extend lockdep class for request mutex") Reported-by: Ingo Molnar <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: [email protected]
2017-12-28gpio: fix aspeed_gpio_banks array size checkVasyl Gomonovych1-1/+1
The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE(). Signed-off-by: Vasyl Gomonovych <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-28kernel/irq: Extend lockdep class for request mutexAndrew Lunn4-12/+26
The IRQ code already has support for lockdep class for the lock mutex in an interrupt descriptor. Extend this to add a second class for the request mutex in the descriptor. Not having a class is resulting in false positive splats in some code paths. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
2017-12-22gpio: fix "gpio-line-names" property retrievalChristophe Leroy4-13/+12
Following commit 9427ecbed46cc ("gpio: Rework of_gpiochip_set_names() to use device property accessors"), "gpio-line-names" DT property is not retrieved anymore when chip->parent is not set by the driver. This is due to OF based property reads having been replaced by device based property reads. This patch fixes that by making use of fwnode_property_read_string_array() instead of device_property_read_string_array() and handing over either of_fwnode_handle(chip->of_node) or dev_fwnode(chip->parent) to that function. Fixes: 9427ecbed46cc ("gpio: Rework of_gpiochip_set_names() to use device property accessors") Cc: [email protected] Signed-off-by: Christophe Leroy <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-22gpio: gpio-reg: fix buildGrygorii Strashko1-2/+2
Revert changes introduced by commit f0fbe7bce733 ("gpio: Move irqdomain into struct gpio_irq_chip") as they are not aplicable to this driver. Reported-by: Russell King - ARM Linux <[email protected]> Fixes: f0fbe7bce733 ("gpio: Move irqdomain into struct gpio_irq_chip") Signed-off-by: Grygorii Strashko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-21gpiolib: Fix typo in comment ("piochip_add_data")Jonathan Neuschäfer1-1/+1
Signed-off-by: Jonathan Neuschäfer <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-21gpio: reduce descriptor validation code sizeRasmus Villemoes1-30/+27
While we do need macros to be able to return from the "calling" function, we can still factor the checks done by the VALIDATE_DESC* macros into a real helper function. This reduces the backslashtitis, avoids duplicating the logic in the two macros and saves about 1K of generated code: $ scripts/bloat-o-meter drivers/gpio/gpiolib.o.{0,1} add/remove: 1/0 grow/shrink: 0/15 up/down: 104/-1281 (-1177) Function old new delta validate_desc - 104 +104 gpiod_set_value 192 135 -57 gpiod_set_raw_value 125 67 -58 gpiod_direction_output 412 351 -61 gpiod_set_value_cansleep 150 70 -80 gpiod_set_raw_value_cansleep 132 52 -80 gpiod_get_raw_value 139 54 -85 gpiod_set_debounce 226 140 -86 gpiod_direction_output_raw 124 38 -86 gpiod_get_value 161 74 -87 gpiod_cansleep 126 39 -87 gpiod_get_raw_value_cansleep 130 39 -91 gpiod_get_value_cansleep 152 59 -93 gpiod_is_active_low 128 33 -95 gpiod_request 299 184 -115 gpiod_direction_input 386 266 -120 Total: Before=25460, After=24283, chg -4.62% Signed-off-by: Rasmus Villemoes <[email protected]> Reviewed-by: Vladimir Zapolskiy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-21Revert "gpio: set up initial state from .get_direction()"Timur Tabi1-24/+7
This reverts commit 72d3200061776264941be1b5a9bb8e926b3b30a5. We cannot blindly query the direction of all GPIOs when the pins are first registered. The get_direction callback normally triggers a read/write to hardware, but we shouldn't be touching the hardware for an individual GPIO until after it's been properly claimed. Signed-off-by: Timur Tabi <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-20drivers: gpio: remove duplicate includesPravin Shedge1-1/+0
These duplicate includes have been found with scripts/checkincludes.pl but they have been removed manually to avoid removing false positives. Signed-off-by: Pravin Shedge <[email protected]> Acked-by: Gregory Fong <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-20gpio: sysfs: avoid using kstrtol() in 'value' attribute writeChristophe Leroy1-2/+7
A 'perf record' on an app continuously writing in the 'value' attribute show that most of the time is spent in kstrtol() --17.99%--value_store | |--10.17%--kstrtoint | | | |--8.82%--kstrtoll | |--2.50%--gpiod_set_value_cansleep | |--1.82%--u16_gpio_set | |--1.46%--value_store The normal case is to write 0 or 1 in the attribute, therefore this patch avoids the call to kstrtol() in the most common cases Then 'perf record' shows --7.21%--value_store | |--2.69%--u16_gpio_set | |--1.47%--value_store | |--1.08%--gpiod_set_value_cansleep | |--0.60%--mutex_lock | --0.58%--mutex_unlock Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-20gpio: sysfs: don't use sprintf() for 'value' attributeChristophe Leroy1-1/+3
A bench with 'perf record' shows that most of time spent in value_show() is spent in sprintf() --42.41%--sysfs_kf_read | |--39.73%--dev_attr_show | | | |--38.23%--value_show | | | | | |--29.22%--sprintf | | | | | |--2.94%--gpiod_get_value_cansleep | | | value_show() only returns "0\n" or "1\n", therefore the use of sprintf() can be avoided With this patch we get the following result with 'perf record' --13.89%--sysfs_kf_read | |--10.72%--dev_attr_show | | | |--9.44%--value_show | | | | | |--4.61%--gpiod_get_value_cansleep Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-20gpio: sysfs: correct error handling on 'value' attribute read.Christophe Leroy1-1/+5
'value' attribute is supposed to only return 0 or 1 according to the documentation. With today's implementation, if gpiod_get_value_cansleep() fails the printed 'value' is a negative value. This patch ensures that an error is returned on read instead. Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-20gpio: sysfs: change 'value' attribute to preallocChristophe Leroy1-1/+1
The GPIO 'value' attribute is time critical. A small bench with 'perf record' on the app below shows that 80% of the time spent in sysfs_kf_seq_show() is spent in memset() for zeroising the buffer. |--67.48%--sysfs_kf_seq_show | | | |--54.40%--memset | | | |--11.49%--dev_attr_show | | | | | |--10.06%--value_show | | | | | | | |--4.75%--sprintf | | | | | This patch changes the attribute type to prealloc, eliminating the need to zeroise the buffer at each read. 'perf record' gives the following result. |--42.41%--sysfs_kf_read | | | |--39.73%--dev_attr_show | | | | | |--38.23%--value_show | | | | | | | |--29.22%--sprintf | | | | | Test done with the following small app: int main(int argc, char **argv) { int fd = open(argv[1], O_RDONLY); for (;;) { int buf[512]; read(fd, buf, 512); lseek(fd, 0, SEEK_SET); } exit(0); } Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-20gpiolib: use kstrdup_const() for gpio_device labelBartosz Golaszewski1-6/+3
Users often pass a pointer to a static string to gpiochip_add_data() family of functions. Avoid unnecessary memory allocations with the provided helper routine. While at it: use a ternary operator instead of an if else for brevity. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-20gpiolib: constify label in gpio_deviceBartosz Golaszewski1-1/+1
This string is never modified. Make it const. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-08gpio: mockup: fix a return value checkBartosz Golaszewski1-2/+2
The return value of platform_device_register_resndata() on error is an error code converted to pointer with ERR_PTR(), not NULL. Check the return value correctly. Fixes: 8a39f597bcfd ("gpio: mockup: rework device probing") Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-07Merge branch 'ib-move-axp209' of /home/linus/linux-gpio into develLinus Walleij3-195/+0
2017-12-07Merge branch 'ib-move-axp209' into develLinus Walleij3-195/+0
2017-12-07pinctrl: move gpio-axp209 to pinctrlQuentin Schulz3-196/+0
To prepare the driver for the upcoming pinctrl features, move the GPIO driver AXP209 from GPIO to pinctrl subsystem. Signed-off-by: Quentin Schulz <[email protected]> Acked-by: Maxime Ripard <[email protected]> Acked-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-07gpio: axp209: switch unsigned variables to unsigned intQuentin Schulz1-6/+7
Checkpatch complains with the following message: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Let's make it happy by switching over to unsigned int. Signed-off-by: Quentin Schulz <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: ftgpio010: Fix platform_get_irq's error checkingArvind Yadav1-2/+2
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: aspeed: Add support for reset toleranceAndrew Jeffery1-2/+37
Use the new pinconf parameter for state persistence to expose the associated capability of the Aspeed GPIO controller. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: gpiolib: Generalise state persistence beyond sleepAndrew Jeffery4-12/+71
General support for state persistence is added to gpiolib with the introduction of a new pinconf parameter to propagate the request to hardware. The existing persistence support for sleep is adapted to include hardware support if the GPIO driver provides it. Persistence continues to be enabled by default; in-kernel consumers can opt out, but userspace (currently) does not have a choice. The *_SLEEP_MAY_LOSE_VALUE and *_SLEEP_MAINTAIN_VALUE symbols are renamed, dropping the SLEEP prefix to reflect that the concept is no longer sleep-specific. I feel that renaming to just *_MAY_LOSE_VALUE could initially be misinterpreted, so I've further changed the symbols to *_TRANSITORY and *_PERSISTENT to address this. The sysfs interface is modified only to keep consistency with the chardev interface in enforcing persistence for userspace exports. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Charles Keepax <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: gpio-stmpe: make various char arrays static const, shrinks object sizeColin Ian King1-9/+15
Don't populate the read-only arrays edge_det_values, rise_values and fall_values on the stack but instead make them static and constify them. Makes the object code smaller by over 240 bytes: Before: text data bss dec hex filename 9525 2520 192 12237 2fcd drivers/gpio/gpio-stmpe.o After: text data bss dec hex filename 9025 2776 192 11993 2ed9 drivers/gpio/gpio-stmpe.o (gcc version 7.2.0 x86_64) Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: it87: fix mojibake in module metadataAdam Borowski1-1/+1
It had twice-encoded Unicode. Signed-off-by: Adam Borowski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: add helpers for accessing the gpio rangesBartosz Golaszewski1-4/+14
In order to avoid repeating the calculations on every access - add helpers for gpio base and ngpio components of the ranges array. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: rename gpio_mockup_params_nr to gpio_mockup_num_rangesBartosz Golaszewski1-6/+6
This variable holds the number of mockup GPIO ranges so rename it accordingly. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: modify the return value check for devm_irq_sim_init()Bartosz Golaszewski1-1/+1
As discussed with Marc Zyngier: irq_sim_init() and its devres variant should return the base of the allocated interrupt range on success rather than 0. This will be modified later - first, change the way users handle the return value of these routines. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: implement gpio_mockup_set_multiple()Bartosz Golaszewski1-0/+11
Implement the set_multiple() callback and register it with the gpiolib framework. This is only meant to also test the internal kernel API. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: tweak line breaksBartosz Golaszewski1-4/+4
Minor readability tweak: prefer breaking the lines in a way where the second part is longer than the first. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: verify that ngpio > 0Bartosz Golaszewski1-0/+9
Improve the module params sanitization: bail out from init if the user tries to pass a non-positive number of GPIO lines for any mockup chip. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: fix debugfs handlingBartosz Golaszewski1-5/+5
The debugfs routines returning pointers can return NULL or error codes embedded with ERR_PTR(). Check the return values with IS_ERR_OR_NULL(). While we're at it: make the error message more specific so it's not confused with the one emitted when the top-level gpio-mockup debugfs directory creation fails. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: group code by logicBartosz Golaszewski1-23/+23
Keep GPIO chip callbacks, event trigger callbacks and mockup chip setup code visibly separated. We're mostly good - just need to move the line naming routine below. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: change the type of value field in line state structBartosz Golaszewski1-1/+1
GPIO values are universally represented as integers. Change the type of the variable storing the current line value to int for consistency. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: extend the debugfs layoutBartosz Golaszewski1-2/+8
Currently each chip has a dedicated directory in debugfs for event triggers. We use the chip's label for the directory name, but the user can't really associate these directories with chip names without parsing the relevant sysfs entries. Use chip names for directory names. For backward compatibility: create links pointing to the actual directories named using the chip labels. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-12-02gpio: mockup: pass the named_lines parameter over platform_dataBartosz Golaszewski1-1/+3
Move the last bits of code dealing with module parameters to the init function. Add a new variable to platform data, which indicates to the probe function if it should name the GPIO lines. If we ever want to make the line naming more fine-grained (e.g. per chip switch) it will be easier this way. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>