aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-07-03serial: exar: Add support for IOT2040 deviceJan Kiszka1-1/+128
This implements the setup of RS232 and the switch-over to RS485 or RS422 for the Siemens IOT2040. That uses an EXAR XR17V352 with external logic to switch between the different modes. The external logic is controlled via MPIO pins of the EXAR controller. Only pin 10 can be exported as GPIO on the IOT2040. It is connected to an LED. As the XR17V352 used on the IOT2040 is not equipped with an external EEPROM, it cannot present itself as IOT2040-variant via subvendor/ subdevice IDs. Thus, we have to check via DMI for the target platform. Co-developed with Sascha Weisenberger. Signed-off-by: Sascha Weisenberger <[email protected]> Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]>
2017-07-03gpio-exar/8250-exar: Make set of exported GPIOs configurableJan Kiszka2-26/+45
On the SIMATIC, IOT2040 only a single pin is exportable as GPIO, the rest is required to operate the UART. To allow modeling this case, expand the platform device data structure to specify a (consecutive) pin subset for exporting by the gpio-exar driver. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2017-07-03platform: Accept const propertiesJan Kiszka2-2/+2
Aligns us with device_add_properties, the function we call. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2017-07-03serial: exar: Factor out platform hooksJan Kiszka1-5/+27
This prepares the addition of IOT2040 platform support by preparing the needed setup and rs485_config hooks. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]>
2017-07-03gpio-exar/8250-exar: Rearrange gpiochip parenthoodJan Kiszka2-1/+3
Set the parent of the exar gpiochip to its platform device, like other gpiochips are doing it. In order to keep the relationship discoverable for ACPI systems, set the platform device companion to the PCI device. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]>
2017-07-03gpio: exar: Fix iomap requestJan Kiszka1-7/+3
The UART driver already maps the resource for us. Trying to do this here only fails and leaves us with a non-working device. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]>
2017-07-03gpio-exar/8250-exar: Do not even instantiate a GPIO device for Commtech cardsJan Kiszka2-4/+3
Commtech adapters need the MPIOs for internal purposes, and the gpio-exar driver already refused to pick them up. But there is actually no point in even creating the underlying platform device. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]>
2017-07-03serial: uapi: Add support for bus terminationJan Kiszka1-0/+3
The Siemens IOT2040 comes with a RS485 interface that allows to enable or disable bus termination via software. Add a bit to the flags field of serial_rs485 that applications can set in order to request this feature from the hardware. This seems generic enough to add it for everyone. Existing driver will simply ignore it when set. Signed-off-by: Sascha Weisenberger <[email protected]> Signed-off-by: Jan Kiszka <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-06-29gpio: rcar: Add R8A7743 (RZ/G1M) supportBiju Das2-0/+5
Renesas RZ/G1M (R8A7743) SoC GPIO blocks are identical to the R-Car Gen2 family. Add support for its GPIO controllers. Signed-off-by: Biju Das <[email protected]> Reviewed-by: Chris Paterson <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-29gpio: gpio-wcove: Fix GPIO control register offset calculationKuppuswamy Sathyanarayanan1-24/+51
According to Whiskey Cove PMIC GPIO controller specification, for GPIO pins 0-12, GPIO input and output register control address range from, 0x4e44-0x4e50 for GPIO outputs control register 0x4e51-0x4e5d for GPIO input control register But, currently when calculating the GPIO register offsets in to_reg() function, all GPIO pins in the same bank uses the same GPIO control register address. This logic is incorrect. This patch fixes this issue. This patch also adds support to selectively skip register modification for virtual GPIOs. In case of Whiskey Cove PMIC, ACPI code may use up 94 virtual GPIOs. These virtual GPIOs are used by the ACPI code as means to access various non GPIO bits of PMIC. So for these virtual GPIOs, we don't need to manipulate the physical GPIO pin register. A similar patch has been merged recently by Hans for Crystal Cove PMIC GPIO driver. You can find more details about it in Commit 9a752b4c9ab9 ("gpio: crystalcove: Do not write regular gpio registers for virtual GPIOs") Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]> Reported-by: Jukka Laitinen <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-21gpio: lp87565: Add support for GPIOKeerthy3-0/+201
Add driver for lp87565 PMIC family GPIOs. Three GPIOs are supported and can be configured in Open-drain output or Push-pull output. Signed-off-by: Keerthy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-21gpio: dwapb: fix missing first irq for edgeboth irq typeXiaoguang Chen1-1/+2
dwapb_irq_set_type overwrites polarity register value for IRQ_TYPE_EDGE_BOTH case. If the polarity of one gpio is 0 by default, then it will set falling edge irq trigger. and the gpio may requires rising edge irq for the first time, and it will be missed. Do not overwrite polarity register for IRQ_TYPE_EDGE_BOTH case can solve this issue. Signed-off-by: Xiaoguang Chen <[email protected]> Tested-by: Jisheng Zhang <[email protected]> [Fix some really weird text encoding problem] Signed-off-by: Linus Walleij <[email protected]>
2017-06-20MAINTAINERS: Take maintainership for GPIO ACPI supportAndy Shevchenko1-0/+9
We will help Linus to maintain GPIO ACPI support. Append a dedicated record to the MAINTAINERS data base. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: exar: Fix reading of directions and valuesJan Kiszka1-4/+4
First, the logic for translating a register bit to the return code of exar_get_direction and exar_get_value were wrong. And second, there was a flip regarding the register bank in exar_get_direction. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: exar: Allocate resources on behalf of the platform deviceJan Kiszka1-2/+2
Do not allocate resources on behalf of the parent device but on our own. Otherwise, cleanup does not properly work if gpio-exar is removed but not the parent device. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio-exar/8250-exar: Fix passing in of parent PCI deviceJan Kiszka2-2/+3
This fixes reloading of the GPIO driver for the same platform device instance as created by the exar UART driver: First of all, the driver sets drvdata to its own value during probing and does not restore the original value on exit. But this won't help anyway as the core clears drvdata after the driver left. Set the platform device parent instead. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: mockup: use devm_kcalloc() where applicableBartosz Golaszewski1-4/+4
When allocating a zeroed array of objects use devm_kcalloc() instead of manually calculating the required size and using devm_kzalloc(). Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: mockup: add myself as authorBartosz Golaszewski1-0/+2
Just taking credit for the recent changes and new features. :) Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: mockup: improve the error messageBartosz Golaszewski1-2/+3
Indicate the error number and make the message a bit more elaborate. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: mockup: don't return magic numbers from probe()Bartosz Golaszewski1-1/+1
When the requested number of GPIO lines is 0, return -EINVAL, not -1 which is -EPERM. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: mockup: improve readabilityBartosz Golaszewski1-7/+13
We currently shift bits here and there without actually explaining what we're doing. Add some helper variables with names indicating their purpose to improve the code readability. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: mockup: refuse to accept an odd number of GPIO rangesBartosz Golaszewski1-1/+1
Currently we ignore the last odd range value, since each chip is described by two values. Be more strict and require the user to pass an even number of ranges. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: mockup: tweak gpio_mockup_event_write()Bartosz Golaszewski1-11/+10
Invert the logic of the irq_enabled check and only access the private data after the input is sanitized. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-20gpio: mockup: improve the debugfs input sanitizationBartosz Golaszewski1-12/+7
We're currently only checking the first character of the input to the debugfs event files, so a string like '0sdfdsf' is valid and indicates a falling edge event. Be more strict and only allow '0', '1', '0\n' & '1\n'. While we're at it: move the sanitization code before the irq_enabled check so that we indicate an error on invalid input even if nobody is waiting for events. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-16gpio: mvebu: Add support for the Armada 7K/8K SoCsGregory CLEMENT1-71/+141
The Armada 7K and 8K SoCs use the same gpio controller as most of the other mvebu SoCs. However, the main difference is that the GPIO controller is part of a bigger system controller, and a syscon is used to control the overall system controller. Therefore, the driver needs to be adjusted to retrieve the regmap of the syscon to access registers, and account for the fact that registers are located at a certain offset within the regmap. This commit add the support of the syscon and introduce a new variant for this case. It was based on the preliminary work of Thomas Petazzoni. Tested-by: Thomas Petazzoni <[email protected]> Signed-off-by: Gregory CLEMENT <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-16gpio: mvebu: fix regmap_update_bits usageGregory CLEMENT1-2/+2
In some place in the driver regmap_update_bits was misused. Indeed the last argument is not the value of the bit (or group of bits) itself but the mask value inside the register. So when setting the bit N, then the value must be BIT(N) and not 1. CC: Ralph Sennhauser <[email protected]> Signed-off-by: Gregory CLEMENT <[email protected]> Reviewed-by: Thomas Petazzoni <[email protected]> Tested-by: Ralph Sennhauser <[email protected]> Tested-by: Chris Packham <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-16gpio: zynq: Clarify quirk and provide helper functionSoren Brinkmann1-6/+15
The one quirk used in the zynq GPIO driver was called FOO which is not very descriptive. Rename the quirk to IS_ZYNQ as it indicates whether the HW is a zynq or zynqmp device to allow handling of device-specific differences of the HW. Also provide a helper function to test whether the HW is zynq or zynqmp. Signed-off-by: Soren Brinkmann <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-16MAINTAINERS: gpio: gpio-davinci: Add entry for gpio-davinci driverKeerthy1-0/+7
Add an entry for the gpio-davinci driver and add myself as a maintainer for the same. Signed-off-by: Keerthy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-16gpio: merrifield: Remove unused headerAndy Shevchenko1-1/+0
I don't remember how linux/gpio.h made the source, now it seems unused. Remove it. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-06-16gpio: of: Spelling: s/retures/returns/Geert Uytterhoeven1-1/+1
Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-31gpio: xra1403: select REGMAP_SPIArnd Bergmann1-0/+1
Without the regmap code, we get a link error: drivers/gpio/built-in.o: In function `xra1403_probe': (.text+0x132e0): undefined reference to `__devm_regmap_init_spi' Fixes: 5704520d7880 ("gpio: xra1403: Add EXAR XRA1403 SPI GPIO expander driver") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Nandor Han <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-31gpiolib: remove unused variableArnd Bergmann1-2/+0
This was left behind by a cleanup patch: drivers/gpio/gpiolib.c: In function 'gpiochip_irqchip_init_valid_mask': drivers/gpio/gpiolib.c:1474:6: error: unused variable 'i' [-Werror=unused-variable] Fixes: 923a654c186c ("gpiolib: Re-use bitmap_fill() instead of open coded loop") Reported-by: kbuild test robot <[email protected]> Reported-by: Stephen Rothwell <[email protected]> Reported-by: Colin King <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: adp5588: move header file out of I2C realmWolfram Sang4-3/+3
include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: ml-ioh: check the return value of irq_alloc_generic_chip()Bartosz Golaszewski1-3/+13
This function can fail, so check the return value before dereferencing the returned pointer. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: sta2x11: check the return value of irq_alloc_generic_chip()Bartosz Golaszewski1-2/+10
This function can fail, so check the return value before dereferencing the returned pointer. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: pch: check the return value of irq_alloc_generic_chip()Bartosz Golaszewski1-3/+12
This function can fail, so check the return value before dereferencing the returned pointer. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: mockup: support irqmask and irqunmaskBartosz Golaszewski1-6/+20
Even though this is a testing module, be nice and actually implement these functions. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: mockup: be quiet unless something goes wrongBartosz Golaszewski1-3/+0
When inserting and removing the module repeatedly (e.g. when running the libgpiod test-suite) the kernel log gets clobbered with messages reporting successful creation of dummy gpiochips. Remove this message and only emit logs when something bad happens. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: mockup: add prefixes to the direction enumBartosz Golaszewski1-4/+4
All internal symbols except for the direction enum follow the same convention and use the gpio_mockup prefix. Add the prefix to the DIR_IN and DIR_OUT definitions as well for consistency across the file. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: mockup: fix direction valuesBartosz Golaszewski1-2/+2
The comment in linux/gpio/driver.h says: @get_direction: returns direction for signal "offset", 0=out, 1=in We got those switched at some point. Fix the values. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpiolib: Re-use bitmap_fill() instead of open coded loopAndy Shevchenko1-3/+2
Re-use bitmap_fill() instead of open coded loop for setting an area of bits in a bitmap. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29PNP / ACPI: remove FSF addressAndy Shevchenko1-4/+0
There is no point in keeping an address in the file since it's subject to change. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29PNP / ACPI: join strings back for better maintenanceAndy Shevchenko1-9/+9
Simply join string literals back for better maintenance and debugging. No functional changes intended. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29PNP / ACPI: add support for GpioInt resource typeJagadish Krishnamoorthy1-0/+16
The PNP ACPI driver parses ACPI interrupt resource but not GpioInt resource. When the firmware passes GpioInt resource for IRQ the PNP ACPI driver ignores it and hence the interrupt for the particular driver will not work. One such example is 8042 keyboard which uses PNP driver for obtaining the interrupt resource. On Intel Braswell project GpioInt is used instead of interrupt resource and the keyboard driver fails to register interrupt. Fix the issue by parsing GpioInt resource type. Signed-off-by: Jagadish Krishnamoorthy <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> [Fixed a parenthesis coding style thing] Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: acpi: Split out acpi_gpio_get_irq_resource() helperAndy Shevchenko2-5/+25
The helper does retrieve pointer to struct acpi_resource_gpio from struct acpi_resource if it represents GpioInt() resource. It will be used by PNP code later on. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: acpi: Override GPIO initialization flagsAndy Shevchenko3-6/+67
This allows ACPI GPIO code to modify flags based on ACPI GpioIo() / GpioInt() resources. Signed-off-by: Andy Shevchenko <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: acpi: Factor out acpi_gpio_to_gpiod_flags() helperAndy Shevchenko1-25/+36
The helper function acpi_gpio_to_gpiod_flags() will be used later to configure pin properly whenever it's requested. While here, introduce a checking error code returned by gpiod_configure_flags() and bail out if it's not okay. Signed-off-by: Andy Shevchenko <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: acpi: Explain how to get GPIO descriptors in ACPI caseAndy Shevchenko1-0/+65
Documentation lacks of explanation how we actually use device properties for GPIO resources. Add a section to the documentation about that. Suggested-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: acpi: Synchronize acpi_find_gpio() and acpi_gpio_count()Andy Shevchenko1-0/+3
If we pass connection ID to the both functions and at the same time acpi_can_fallback_to_crs() returns false we will get different results, i.e. the number of GPIO resources returned by acpi_gpio_count() might be not correct. Fix this by calling acpi_can_fallback_to_crs() in acpi_gpio_count() before trying to fallback. Signed-off-by: Andy Shevchenko <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-05-29gpio: acpi: Even more tighten up ACPI GPIO lookupsAndy Shevchenko1-35/+1
The commit 10cf4899f8af ("gpiolib: tighten up ACPI legacy gpio lookups") prevents to getting same resource twice if the driver asks twice using different connection ID. But the whole idea of fallback might bring some problems. Imagine the case when we have two versions of BIOS/hardware where in one _DSD is introduced along with GPIO resources, but the other one uses just plain GPIO resource for another purpose Case 1: Device (DEVX) { ... Name (_CRS, ResourceTemplate () { GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly, "\\_SB.GPO0", 0, ResourceConsumer) {15} }) Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () {"some-gpios", Package() {^DEVX, 0, 0, 0 }}, } }) } Case 2: Device (DEVX) { ... Name (_CRS, ResourceTemplate () { GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly, "\\_SB.GPO0", 0, ResourceConsumer) {27} }) } To prevent the possible misconfiguration tighten up even more GPIO ACPI lookups for case without connection ID provided. In the past the issue had been triggered by "use mctrl_gpio helpers" series [1,2]. [1] commit 4ef03d328769 ("tty/serial/8250: use mctrl_gpio helpers") [2] https://patchwork.kernel.org/patch/9283745/ Cc: Dmitry Torokhov <[email protected]> Cc: Bastien Nocera <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Signed-off-by: Linus Walleij <[email protected]>