- 26 10月, 2020 3 次提交
-
-
由 Andy Shevchenko 提交于
Use named item instead of plain integer for enum gpiod_flags to make it clear that even 0 has its own meaning. Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
The line.eflags field is shared so document this fact and highlight it throughout using READ_ONCE() and WRITE_ONCE() accessors. Also use a local copy of the eflags in edge_irq_thread() to ensure consistent control flow even if eflags changes. This is only a defensive measure as edge_irq_thread() is currently disabled when the eflags are changed. Signed-off-by: NKent Gibson <warthog618@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Andy Shevchenko 提交于
Several places in the code are using same idiom, i.e. IS_ERR(desc) && PTR_ERR(desc) == -ENOENT which meaning is GPIO description is not found. For better readability extract gpiod_not_found() helper and use it. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
- 10 10月, 2020 1 次提交
-
-
由 Marc Zyngier 提交于
Make the tegra186 GPIO driver resistent to variable depth interrupt hierarchy, which we are about to introduce. No functionnal change yet. Signed-off-by: NMarc Zyngier <maz@kernel.org>
-
- 09 10月, 2020 2 次提交
-
-
由 Andy Shevchenko 提交于
The dev_t is defined in types.h while struct gpio_device forward declaration is missed. Take into account above and update header block in gpiolib-cdev.h. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20201005095622.73616-1-andriy.shevchenko@linux.intel.comSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Kent Gibson 提交于
Use kstrndup() to copy line labels from the userspace provided char array, rather than ensuring the char array contains a null terminator and using kstrdup(). Note that the length provided to kstrndup() still assumes that the char array does contain a null terminator, so the maximum string length is one less than the array. This is consistent with the previous behaviour. Suggested-by: NAndy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: NKent Gibson <warthog618@gmail.com> Link: https://lore.kernel.org/r/20201005070246.20927-1-warthog618@gmail.comSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 07 10月, 2020 2 次提交
-
-
由 Marc Zyngier 提交于
The pca953x driver never checks the result of irq_find_mapping(), which returns 0 when no mapping is found. When a spurious interrupt is delivered (which can happen under obscure circumstances), the kernel explodes as it still tries to handle the error code as a real interrupt. Handle this particular case and warn on spurious interrupts. Signed-off-by: NMarc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20201005140217.1390851-1-maz@kernel.orgSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Andy Shevchenko 提交于
It appears that UML (arch/um) has no compat.h header defined and hence can't compile a recently provided piece of code in GPIO library. Disable compat ->read() code in UML case to avoid compilation errors. While at it, use pattern which is already being used in the kernel elsewhere. Fixes: 5ad284ab ("gpiolib: Fix line event handling in syscall compatible mode") Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20201005131044.87276-1-andriy.shevchenko@linux.intel.comSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 01 10月, 2020 2 次提交
-
-
由 Andy Shevchenko 提交于
When driver has been converted to the bitmap API the non-bitmap functions started behaving differently on 32-bit BE architectures since the bytes in two consequent unsigned longs are in different order in comparison to byte array. Hence if the chip had had more than 32 lines the memset() call over it would have not set up upper lines correctly. Although it's currently a theoretical case (no supported chips of this type has 32+ lines), it's better to provide a clean code to avoid people thinking this is okay and potentially producing not fully working things. Fixes: 35d13d94 ("gpio: pca953x: convert to use bitmap API") Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20200930142013.59247-2-andriy.shevchenko@linux.intel.comSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Andy Shevchenko 提交于
In IRQ handler we have to clear bitmap before use. Currently the GCC extension has been used for that. For sake of the consistency switch to bitmap API. As expected bloat-o-meter shows no difference in the object size. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20200930142013.59247-1-andriy.shevchenko@linux.intel.comSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 30 9月, 2020 21 次提交
-
-
由 Mike Looijmans 提交于
The NXP PCAL9554B is a variant of the PCA953x GPIO expander, with 8 GPIOs, latched interrupts and some advanced configuration options. The "C" version only differs in I2C address. Signed-off-by: NMike Looijmans <mike.looijmans@topic.nl> Reviewed-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20200930092053.2114-2-mike.looijmans@topic.nlSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Kent Gibson 提交于
Add support for setting debounce on a line via the GPIO uAPI. Where debounce is not supported by hardware, a software debounce is provided. The implementation of the software debouncer waits for the line to be stable for the debounce period before determining if a level change, and a corresponding edge event, has occurred. This provides maximum protection against glitches, but also introduces a debounce_period latency to edge events. The software debouncer is integrated with the edge detection as it utilises the line interrupt, and integration is simpler than getting the two to interwork. Where software debounce AND edge detection is required, the debouncer provides both. Signed-off-by: NKent Gibson <warthog618@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Add support for the GPIO_V2_LINE_SET_VALUES_IOCTL. Signed-off-by: NKent Gibson <warthog618@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Add support for GPIO_V2_LINE_SET_CONFIG_IOCTL, the uAPI v2 line set config ioctl. Signed-off-by: NKent Gibson <warthog618@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Add support for edge detection to lines requested using GPIO_V2_GET_LINE_IOCTL. The edge_detector implementation is based on the v1 lineevent implementation. Unlike the v1 implementation, an overflow of the event buffer results in discarding older events, rather than the most recent, so the final event in a burst will correspond to the current state of the line. Signed-off-by: NKent Gibson <warthog618@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Add support for GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL. The core of this change is the event kfifo switching to contain struct gpioline_info_changed_v2, instead of v1 as v2 is richer. The two uAPI versions are mostly independent - other than where they both provide line info changes via reads on the chip fd. As the info change structs differ between v1 and v2, the infowatch implementation tracks which version of the infowatch ioctl, either GPIO_GET_LINEINFO_WATCH_IOCTL or GPIO_V2_GET_LINEINFO_WATCH_IOCTL, initiates the initial watch and returns the corresponding info change struct to the read. The version supported on that fd locks to that version on the first watch request, so subsequent watches from that process must use the same uAPI version. Signed-off-by: NKent Gibson <warthog618@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL. The struct linereq implementation is based on the v1 struct linehandle implementation. Signed-off-by: NKent Gibson <warthog618@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Add a build option to allow the removal of the CDEV v1 ABI. Suggested-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: NKent Gibson <warthog618@gmail.com> Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Make the gpiolib-cdev module a build option. This allows the CDEV interface to be removed from the kernel to reduce kernel size in applications where is it not required, and provides the parent for other CDEV interface specific build options to follow. Suggested-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: NKent Gibson <warthog618@gmail.com> Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Replace usage of strncpy() with strscpy() to remove -Wstringop-truncation warnings. The structures being populated are zeroed, to prevent stack leakage as they are returned to userspace, so strscpy() performs the equivalent function without the warnings. Reported-by: Nkernel test robot <lkp@intel.com> Signed-off-by: NKent Gibson <warthog618@gmail.com> Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Kent Gibson 提交于
Set the value of the line info offset in gpio_desc_to_lineinfo(), rather than relying on it being passed in the info. This makes the function behave as you would expect from the name - it generates the line info corresponding to a given GPIO desc. Signed-off-by: NKent Gibson <warthog618@gmail.com> Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Bartosz Golaszewski 提交于
Let's move the code preparing the device properties into a separate routine. This has the advantage of simplifying the error handling and makes the indentation less deep. Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
由 Bartosz Golaszewski 提交于
GPIO line names are currently created by the driver from the chip label. We'll want to support custom formats for line names (for instance: to name all lines the same) for user-space tests so create them in the module init function and pass them to the driver using the standard 'gpio-line-names' property. Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
由 Bartosz Golaszewski 提交于
While we do check the "chip-name" property in probe(), we never actually use it. Let's pass the chip label to the driver using device properties as we'll want to allow users to define their own once dynamically created chips are supported. The property is renamed to "chip-label" to not cause any confusion with the actual chip name which is of the form: "gpiochipX". If the "chip-label" property is missing, let's do what most devices in drivers/gpio/ do and use dev_name(). Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
由 Bartosz Golaszewski 提交于
The driver actually supports 4 properties but we only ever set up up to three. This will change however in upcoming patches so increase the number of really (as in: the number the property array can hold) supported properties to 4. Reported-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
由 Bartosz Golaszewski 提交于
There's a return; at the end of a void function. This is not needed so remove it. Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
由 Bartosz Golaszewski 提交于
We don't need a custom logging helper. Let's use the standard pr_fmt() macro which allows us to use all pr_*() routines with custom format. Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
由 Bartosz Golaszewski 提交于
Drop the definition for the driver name. Let's use KBUILD_MODNAME for the log format and use the "gpio-mockup" value directly in the only place where it's relevant: in the name of the device. Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
由 Bartosz Golaszewski 提交于
This module doesn't need gpio/consumer.h - it's a provider. It also doesn't use any symbols from init.h so let's remove both includes. Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
由 Michael Walle 提交于
Some Layerscape/QoriQ SoCs have input buffers which needs to be enabled first. This was done in two different ways in the driver. Unify it. This was tested on a LS1028A SoC. Signed-off-by: NMichael Walle <michael@walle.cc> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Bartosz Golaszewski 提交于
If the module init function fails after creating the debugs directory, it's never removed. Add proper cleanup calls to avoid this resource leak. Fixes: 9202ba23 ("gpio: mockup: implement event injecting over debugfs") Cc: <stable@vger.kernel.org> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
-
- 29 9月, 2020 1 次提交
-
-
由 Anson Huang 提交于
Change config to tristate, add module device table, module author, description and license to support module build for i.MX GPIO driver. As this is a SoC GPIO module, it provides common functions for most of the peripheral devices, such as GPIO pins control, secondary interrupt controller for GPIO pins IRQ etc., without GPIO driver, most of the peripheral devices will NOT work properly, so GPIO module is similar with clock, pinctrl driver that should be loaded ONCE and never unloaded. Since MXC GPIO driver needs to have init function to register syscore ops once, here still use subsys_initcall(), NOT module_platform_driver(). Signed-off-by: NAnson Huang <Anson.Huang@nxp.com> Link: https://lore.kernel.org/r/1600320829-1453-1-git-send-email-Anson.Huang@nxp.comSigned-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 28 9月, 2020 1 次提交
-
-
由 Ed Wildgoose 提交于
The original commit appears to have the logic reversed in amd_fch_gpio_get_direction. Also confirmed by observing the value of "direction" in the sys tree. Signed-off-by: NEd Wildgoose <lists@wildgooses.com> Fixes: e09d168f ("gpio: AMD G-Series PCH gpio driver") Cc: stable@vger.kernel.org Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
- 24 9月, 2020 4 次提交
-
-
由 Tao Ren 提交于
GPIO_U is mapped to the least significant byte of input/output mask, and the byte in "output" mask should be 0 because GPIO_U is input only. All the other bits need to be 1 because GPIO_V/W/X support both input and output modes. Similarly, GPIO_Y/Z are mapped to the 2 least significant bytes, and the according bits need to be 1 because GPIO_Y/Z support both input and output modes. Fixes: ab4a8553 ("gpio: aspeed: Add in ast2600 details to Aspeed driver") Signed-off-by: NTao Ren <rentao.bupt@gmail.com> Reviewed-by: NAndrew Jeffery <andrew@aj.id.au> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Jeremy Kerr 提交于
Currently, the IRQ setup for the SGPIO driver enables all interrupts in dual-edge trigger mode. Since the default handler is handle_bad_irq, any state change on input GPIOs will trigger bad IRQ warnings. This change applies sensible IRQ defaults: single-edge trigger, and all IRQs disabled. Signed-off-by: NJeremy Kerr <jk@codeconstruct.com.au> Fixes: 7db47faa ("gpio: aspeed: Add SGPIO driver") Reviewed-by: NJoel Stanley <joel@jms.id.au> Acked-by: NAndrew Jeffery <andrew@aj.id.au> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Jeremy Kerr 提交于
Currently, the aspeed-sgpio driver exposes up to 80 GPIO lines, corresponding to the 80 status bits available in hardware. Each of these lines can be configured as either an input or an output. However, each of these GPIOs is actually an input *and* an output; we actually have 80 inputs plus 80 outputs. This change expands the maximum number of GPIOs to 160; the lower half of this range are the input-only GPIOs, the upper half are the outputs. We fix the GPIO directions to correspond to this mapping. This also fixes a bug when setting GPIOs - we were reading from the input register, making it impossible to set more than one output GPIO. Signed-off-by: NJeremy Kerr <jk@codeconstruct.com.au> Fixes: 7db47faa ("gpio: aspeed: Add SGPIO driver") Reviewed-by: NJoel Stanley <joel@jms.id.au> Reviewed-by: NAndrew Jeffery <andrew@aj.id.au> Acked-by: NRob Herring <robh@kernel.org> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
由 Ye Li 提交于
When pca953x_irq_pending returns false, the pending parameter won't be set. But pca953x_irq_handler continues using this uninitialized variable as pending irqs and will cause problem. Fix the issue by initializing pending to 0. Fixes: 064c73af ("gpio: pca953x: Synchronize interrupt handler properly") Signed-off-by: NYe Li <ye.li@nxp.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-
- 17 9月, 2020 3 次提交
-
-
由 Michael Walle 提交于
Add support for the GPIO controller of the sl28 board management controller. This driver is part of a multi-function device. A controller has 8 lines. There are three different flavors: full-featured GPIO with interrupt support, input-only and output-only. Signed-off-by: NMichael Walle <michael@walle.cc> Reviewed-by: NLinus Walleij <linus.walleij@linaro.org> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NLee Jones <lee.jones@linaro.org>
-
由 Bartosz Golaszewski 提交于
It's possible for a GPIO chip to not have a parent device (whose properties we inspect for 'gpio-line-names'). In this case we should simply return from devprop_gpiochip_set_names(). Add an appropriate check for this use-case. Fixes: 7cba1a4d ("gpiolib: generalize devprop_gpiochip_set_names() for device properties") Reported-by: NAnders Roxell <anders.roxell@linaro.org> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: NAnders Roxell <anders.roxell@linaro.org> Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
-
由 Andy Shevchenko 提交于
The introduced line event handling ABI in the commit 61f922db ("gpio: userspace ABI for reading GPIO line events") missed the fact that 64-bit kernel may serve for 32-bit applications. In such case the very first check in the lineevent_read() will fail due to alignment differences. To workaround this introduce lineevent_get_size() helper which returns actual size of the structure in user space. Fixes: 61f922db ("gpio: userspace ABI for reading GPIO line events") Suggested-by: NArnd Bergmann <arnd@arndb.de> Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: NArnd Bergmann <arnd@arndb.de> Tested-by: NKent Gibson <warthog618@gmail.com> Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
-