29 Oct, 2018
2 commits
-
Correct device_reset() return value checking.
Signed-off-by: Fugang Duan
-
The pca953x type of devices, e.g. max7310, may have a reset which needs
to be handled to get the device start working. Add a device_reset()
call for that, and defer the probe if the reset controller for that is
not ready yet.Signed-off-by: Shawn Guo
Signed-off-by: Fugang Duan
14 Aug, 2017
1 commit
-
i2c_smbus commands handle the correct byte order for smbus transactions
internally. This will currently result in incorrect operation on big
endian systems.Suggested-by: Sebastian Reichel
Signed-off-by: Andy Shevchenko
Reviewed-by: Sebastian Reichel
Signed-off-by: Linus Walleij
25 Apr, 2017
1 commit
-
The TCA9554 doesn't work with the pcf857x driver, trying to change the direction
gives a NAK bailout error.TCA9554 is similar to the PCA9554, thus change the driver.
Signed-off-by: Anders Darander
Signed-off-by: Linus Walleij
23 Mar, 2017
3 commits
-
GPIO ACPI library is going to be stricter about resources, thus, expand
comment regarding "reset" GPIO resource in this driver to clarify its
usage in ACPI case.Signed-off-by: Andy Shevchenko
Signed-off-by: Linus Walleij -
For sake of better maintenance sort the headers by alphabetical order.
Signed-off-by: Andy Shevchenko
Signed-off-by: Linus Walleij -
Introduce ->get_direction() callback for the driver.
Signed-off-by: Andy Shevchenko
[Removed use of GPIOF_DIR* flags]
Signed-off-by: Linus Walleij
11 Jan, 2017
1 commit
-
Add optional reset-gpios pin control. If present, de-assert the
specified reset gpio pin to bring the chip out of reset.v2:
- Specify that reset signal to PCA953x chip is active low, in
binding doc.
- reorder includes in gpio-pca953x.c.
- remove dev_err() on devm_gpiod_get_optional() error return.Cc: Alexandre Courbot
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Steve Longerbeam
Reviewed-by: Andy Shevchenko
Reviewed-by: Vladimir Zapolskiy
Signed-off-by: Linus Walleij
13 Dec, 2016
1 commit
-
Pull GPIO updates from Luinus Walleij:
"Bulk GPIO changes for the v4.10 kernel cycle:Core changes:
- Simplify threaded interrupt handling: instead of passing numbed
parameters to gpiochip_irqchip_add_chained() we create a new call:
gpiochip_irqchip_add_nested() so the two types are clearly
semantically different. Also make sure that all nested chips call
gpiochip_set_nested_irqchip() which is necessary for IRQ resend to
work properly if it happens.- Return error on seek operations for the chardev.
- Clamp values set as part of gpio[d]_direction_output() so that
anything != 0 will be send down to the driver as "1" not the value
passed in.- ACPI can now support naming of GPIO lines, hogs and holes in the
GPIO lists.New drivers:
- The SX150x driver was deemed unfit for the GPIO subsystem and was
moved over to a combined GPIO+pinctrl driver in the pinctrl
subsystem.New features:
- Various cleanups to various drivers"
* tag 'gpio-v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (49 commits)
gpio: merrifield: Implement gpio_get_direction callback
gpio: merrifield: Add support for hardware debouncer
gpio: chardev: Return error for seek operations
gpio: arizona: Tidy up probe error path
gpio: arizona: Remove pointless set of platform drvdata
gpio: pl061: delete platform data handling
gpio: pl061: move platform data into driver
gpio: pl061: rename variable from chip to pl061
gpio: pl061: rename state container struct
gpio: pl061: use local state for parent IRQ storage
gpio: set explicit nesting on drivers
gpio: simplify adding threaded interrupts
gpio: vf610: use builtin_platform_driver
gpio: axp209: use correct register for GPIO input status
gpio: stmpe: fix interrupt handling bug
gpio: em: depnd on ARCH_SHMOBILE
gpio: zx: depend on ARCH_ZX
gpio: x86: update config dependencies for x86 specific hardware
gpio: mb86s7x: use builtin_platform_driver
gpio: etraxfs: use builtin_platform_driver
...
07 Dec, 2016
1 commit
25 Nov, 2016
1 commit
-
This tries to simplify the use of CONFIG_GPIOLIB_IRQCHIP when
using threaded interrupts: add a new call
gpiochip_irqchip_add_nested() to indicate that we're dealing
with a nested rather than a chained irqchip, then create a
separate gpiochip_set_nested_irqchip() to mirror
the gpiochip_set_chained_irqchip() call to connect the
parent and child interrupts.In the nested case gpiochip_set_nested_irqchip() does nothing
more than call irq_set_parent() on each valid child interrupt,
which has little semantic effect in the kernel, but this is
probably still formally correct.Update all drivers using nested interrupts to use
gpiochip_irqchip_add_nested() so we can now see clearly
which these users are.The DLN2 driver can drop its specific hack with
.irq_not_threaded as we now recognize whether a chip is
threaded or not from its use of gpiochip_irqchip_add_nested()
signature rather than from inspecting .can_sleep.We rename the .irq_parent to .irq_chained_parent since this
parent IRQ is only really kept around for the chained
interrupt handlers.Cc: Lars Poeschel
Cc: Octavian Purdila
Cc: Daniel Baluta
Cc: Bin Gao
Cc: Mika Westerberg
Cc: Ajay Thomas
Cc: Semen Protsenko
Cc: Alexander Stein
Cc: Phil Reid
Cc: Bartosz Golaszewski
Cc: Patrice Chotard
Signed-off-by: Linus Walleij
08 Nov, 2016
2 commits
-
Need to ensure that reg_output is not updated while setting multiple
bits. This makes the mutex locking behaviour for the set_multiple call
consistent with that of the set_value call.Cc: stable@vger.kernel.org
Fixes: b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple")
Signed-off-by: Phil Reid
Signed-off-by: Linus Walleij -
gpiod_set_array_value_complex does not clear the bits field.
Therefore when the drivers set_multiple funciton is called bits outside
the mask are undefined and can be either set or not. So bank_val needs
to be masked with bank_mask before or with the reg_val cache.Cc: stable@vger.kernel.org
Fixes: b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple")
Signed-off-by: Phil Reid
Signed-off-by: Linus Walleij
24 Oct, 2016
1 commit
-
Add compatible string for the MAX7318 part. This is a two bank,
16 lines, I2C GPIO expander with interrupt line.Signed-off-by: Marek Vasut
Signed-off-by: Linus Walleij
12 Oct, 2016
1 commit
-
This is a follow-up to commit 559b46990e76 ("gpio: pca953x: fix an
incorrect lockdep warning"). The reason for calling
lockdep_set_subclass() in pca953x_probe() is not explained in
the code.Add a comment describing the problem, partial solution and required
future extensions.Signed-off-by: Bartosz Golaszewski
Acked-by: Linus Walleij
Signed-off-by: Wolfram Sang
08 Oct, 2016
1 commit
-
Pull i2c updates from Wolfram Sang:
"Here is the 4.9 pull request from I2C including:- centralized error messages when registering to the core
- improved lockdep annotations to prevent false positives
- DT support for muxes, gates, and arbitrators
- bus speeds can now be obtained from ACPI
- i2c-octeon got refactored and now supports ThunderX SoCs, too
- i2c-tegra and i2c-designware got a bigger bunch of updates
- a couple of standard driver fixes and improvements"* 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (71 commits)
i2c: axxia: disable clks in case of failure in probe
i2c: octeon: thunderx: Limit register access retries
i2c: uniphier-f: fix misdetection of incomplete STOP condition
gpio: pca953x: variable 'id' was used twice
i2c: i801: Add support for Kaby Lake PCH-H
gpio: pca953x: fix an incorrect lockdep warning
i2c: add a warning to i2c_adapter_depth()
lockdep: make MAX_LOCKDEP_SUBCLASSES unconditionally visible
i2c: export i2c_adapter_depth()
i2c: rk3x: Fix variable 'min_total_ns' unused warning
i2c: rk3x: Fix sparse warning
i2c / ACPI: Do not touch an I2C device if it belongs to another adapter
i2c: octeon: Fix high-level controller status check
i2c: octeon: Avoid sending STOP during recovery
i2c: octeon: Fix set SCL recovery function
i2c: rcar: add support for r8a7796 (R-Car M3-W)
i2c: imx: make bus recovery through pinctrl optional
i2c: meson: add gxbb compatible string
i2c: uniphier-f: set the adapter to master mode when probing
i2c: uniphier-f: avoid WARN_ON() of clk_disable() in failure path
...
24 Sep, 2016
2 commits
-
sparse rightfully said:
drivers/gpio/gpio-pca953x.c:771:45: warning: symbol 'id' shadows an earlier one
drivers/gpio/gpio-pca953x.c:742:36: originally declared hereSo, name them explicitly 'i2c_id' and 'acpi_id' to avoid any confusion.
Signed-off-by: Wolfram Sang
-
If an I2C GPIO multiplexer is driven by a GPIO provided by an expander
when there's a second expander using the same device driver on one of
the I2C bus segments, lockdep prints a deadlock warning when trying to
set the direction or the value of the GPIOs provided by the second
expander.The below diagram presents the setup:
- - - - -
------- --------- Bus segment 1 | |
| | | |--------------- Devices
| | SCL/SDA | | | |
| Linux |-----------| I2C MUX | - - - - -
| | | | | Bus segment 2
| | | | |-------------------
------- | --------- |
| | - - - - -
------------ | MUX GPIO | |
| | | Devices
| GPIO | | | |
| Expander 1 |---- - - - - -
| | |
------------ | SCL/SDA
|
------------
| |
| GPIO |
| Expander 2 |
| |
------------The reason for lockdep warning is that we take the chip->i2c_lock in
pca953x_gpio_set_value() or pca953x_gpio_direction_output() and then
come right back to pca953x_gpio_set_value() when the GPIO mux kicks
in. The locks actually protect different expanders, but for lockdep
both are of the same class, so it says:Possible unsafe locking scenario:
CPU0
----
lock(&chip->i2c_lock);
lock(&chip->i2c_lock);*** DEADLOCK ***
May be due to missing lock nesting notation
In order to get rid of the warning, retrieve the adapter nesting depth
and use it as lockdep subclass for chip->i2c_lock.Signed-off-by: Bartosz Golaszewski
Acked-by: Peter Rosin
Acked-by: Peter Zijlstra (Intel)
Acked-by: Linus Walleij
Signed-off-by: Wolfram Sang
13 Sep, 2016
1 commit
-
This reverts commit 313b9a9938bf4076425741121d5d766826793e5d.
This was already fixed by
commit bf62efeb164343916ebb89dca6dfe5e6b6751700
"gpio: pca954x: fix undefined error code from remove"The latter is a better fix since it makes it easier to detect
erronous code by not assigning a default error code.Reported-by: Arnd Bergmann
Signed-off-by: Linus Walleij
12 Sep, 2016
6 commits
-
ret is not initialized so it contains garbage. Ensure garbage
is not returned in the case that pdata && pdata->teardown is false
by initializing ret to 0.Signed-off-by: Colin Ian King
Signed-off-by: Linus Walleij -
pca953x_gpio_set_multiple() has some coding style issues that make it
harder to read. Tweak the code a bit.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko
Signed-off-by: Linus Walleij -
The chip_type variable in struct pca953x_chip is no longer required.
Remove it.
Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko
Signed-off-by: Linus Walleij -
Avoid the unnecessary if-else in pca953x_read_regs() by spltting the
routine into smaller, specialized functions and calling the right one
via a function pointer held in struct pca953x.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko
Signed-off-by: Linus Walleij -
Avoid the unnecessary if-else in pca953x_write_regs() by splitting
the routine into smaller, specialized functions and calling the right
one via a function pointer held in struct pca953x_chip.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko
Signed-off-by: Linus Walleij -
There are multiple places in the driver code where a
switch (chip->chip_type) is used to determine the proper register
offset.Unduplicate the code by adding a simple structure holding the possible
offsets that differ between the pca953x and pca957x chip families and
use it to avoid the checks.Signed-off-by: Bartosz Golaszewski
Reviewed-by: Andy Shevchenko
Signed-off-by: Linus Walleij
07 Sep, 2016
1 commit
-
The recent addition of the regulator support has led to the pca953x_remove
function returning uninitialized data when no platform data pointer is
provided, as gcc warns when using -Wmaybe-uninitialized:drivers/gpio/gpio-pca953x.c: In function 'pca953x_remove':
drivers/gpio/gpio-pca953x.c:860:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]This restores the previous behavior, returning 0 on success.
Signed-off-by: Arnd Bergmann
Fixes: e23efa311110 ("gpio: pca954x: Add vcc regulator and enable it")
Acked-by: Phil Reid
Signed-off-by: Linus Walleij
11 Aug, 2016
1 commit
-
Some i2c gpio devices are connected to a switchable power supply
which needs to be enabled prior to probing the device. This patch
allows the drive to enable the devices vcc regulator prior to probing.Signed-off-by: Phil Reid
Signed-off-by: Linus Walleij
15 Jun, 2016
1 commit
-
Intel Edison board has 4 GPIO expanders PCA9555a connected to I2C bus. Add an
ID to support them.Signed-off-by: Andy Shevchenko
Signed-off-by: Linus Walleij
13 Jun, 2016
1 commit
-
NBANK() macro assumes that ngpios is a multiple of 8(BANK_SZ) and
hence results in 0 banks for PCA9536 which has just 4 gpios. This is
wrong as PCA9356 has 1 bank with 4 gpios. This results in uninitialized
PCA953X_INVERT register. Fix this by using DIV_ROUND_UP macro in
NBANK().Cc: stable@vger.kernel.org
Signed-off-by: Vignesh R
Signed-off-by: Linus Walleij
08 Jun, 2016
1 commit
-
The commit 9b8e3ec34318 ("gpio: pca953x: Use correct u16 value for register
word write") fixed regression in pca953x_write_regs(). At the same time the
solution introduced a sparse warning:drivers/gpio/gpio-pca953x.c:168:39: warning: incorrect type in argument 3 (different base types)
drivers/gpio/gpio-pca953x.c:168:39: expected unsigned short [unsigned] [usertype] value
drivers/gpio/gpio-pca953x.c:168:39: got restricted __le16 [usertype]Fix the code by enforcing the type of i2c_smbus_write_word_data() parameter.
Cc: Yong Li
Cc: Phil Reid
Signed-off-by: Andy Shevchenko
Signed-off-by: Linus Walleij
07 Jun, 2016
2 commits
-
There are few redundant assignments of ret variable which is updated anyway.
Remove them for good.While here, correct indentation of the constant definition and remove one empty
line.Signed-off-by: Andy Shevchenko
Signed-off-by: Linus Walleij -
TI PCA9536 is 4-Bit I2C GPIO expander without interrupt support[1].
Add support for the same.[1] TRM: http://www.ti.com/lit/ds/symlink/pca9536.pdf
Signed-off-by: Vignesh R
Acked-by: Rob Herring
Signed-off-by: Linus Walleij
18 May, 2016
1 commit
-
Pull GPIO updates from Linus Walleij:
"This is the bulk of GPIO changes for kernel cycle v4.7:Core infrastructural changes:
- Support for natively single-ended GPIO driver stages.
This means that if the hardware has registers to configure open
drain or open source configuration, we use that rather than (as we
did before) try to emulate it by switching the line to an input to
get high impedance.This is also documented throughly in Documentation/gpio/driver.txt
for those of you who did not understand one word of what I just
wrote.- Start to do away with the unnecessarily complex and unitelligible
ARCH_REQUIRE_GPIOLIB and ARCH_WANT_OPTIONAL_GPIOLIB, another
evolutional artifact from the time when the GPIO subsystem was
unmaintained.Archs can now just select GPIOLIB and be done with it, cleanups to
arches will trickle in for the next kernel. Some minor archs ACKed
the changes immediately so these are included in this pull request.- Advancing the use of the data pointer inside the GPIO device for
storing driver data by switching the PowerPC, Super-H Unicore and
a few other subarches or subsystem drivers in ALSA SoC, Input,
serial, SSB, staging etc to use it.- The initialization now reads the input/output state of the GPIO
lines, so that each GPIO descriptor knows - if this callback is
implemented - whether the line is input or output. This also
reflects nicely in userspace "lsgpio".- It is now possible to name GPIO producer names, line names, from
the device tree. (Platform data has been supported for a while).
I bet we will get a similar mechanism for ACPI one of those days.
This makes is possible to get sensible producer names for e.g.
GPIO rails in "lsgpio" in userspace.New drivers:
- New driver for the Loongson1.
- The XLP driver now supports Broadcom Vulcan ARM64.
- The IT87 driver now supports IT8620 and IT8628.
- The PCA953X driver now supports Galileo Gen2.
Driver improvements:
- MCP23S08 was switched to use the gpiolib irqchip helpers and now
also suppors level-triggered interrupts.- 74x164 and RCAR now supports the .set_multiple() callback
- AMDPT was converted to use generic GPIO.
- TC3589x, TPS65218, SX150X, F7188X, MENZ127, VX855, WM831X, WM8994
support the new single ended callback for open drain and in some
cases open source.- Implement the .get_direction() callback for a few more drivers like
PL061, Xgene.Cleanups:
- Paul Gortmaker combed through the drivers and de-modularized those
who are not really modules.- Move the GPIO poweroff DT bindings to the power subdir where they
belong.- Rename gpio-generic.c to gpio-mmio.c, which is much more to the
point. That's what it is handling, nothing more, nothing less"* tag 'gpio-v4.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (126 commits)
MIPS: do away with ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB
gpio: zevio: make it explicitly non-modular
gpio: timberdale: make it explicitly non-modular
gpio: stmpe: make it explicitly non-modular
gpio: sodaville: make it explicitly non-modular
pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error
gpio: dwapb: Add ACPI device ID for DWAPB GPIO controller on X-Gene platforms
gpio: dt-bindings: add wd,mbl-gpio bindings
gpio: of: make it possible to name GPIO lines
gpio: make gpiod_to_irq() return negative for NO_IRQ
gpio: xgene: implement .get_direction()
gpio: xgene: Enable ACPI support for X-Gene GFC GPIO driver
gpio: tegra: Implement gpio_get_direction callback
gpio: set up initial state from .get_direction()
gpio: rename gpio-generic.c into gpio-mmio.c
gpio: generic: fix GPIO_GENERIC_PLATFORM is set to module case
gpio: dwapb: add gpio-signaled acpi event support
gpio: dwapb: convert device node to fwnode
gpio: dwapb: remove name from dwapb_port_property
gpio/qoriq: select IRQ_DOMAIN
...
10 Apr, 2016
1 commit
-
Galileo Gen2 board uses the PCAL9535 as the GPIO expansion,
it is different from PCA9535 and includes interrupt mask/status registers,
The current driver does not support the interrupt registers configuration,
it causes some gpio pins cannot trigger interrupt events,
this patch fix this issue.The original patch was submitted by
Josef Ahmad
http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-quark/tree/recipes-kernel/linux/files/0015-Quark-GPIO-1-2-quark.patchSigned-off-by: Yong Li
Reviewed-by: Andy Shevchenko
Signed-off-by: Linus Walleij
08 Apr, 2016
1 commit
-
The current implementation only uses the first byte in val,
the second byte is always 0. Change it to use cpu_to_le16
to write the two bytes into the registerCc: stable@vger.kernel.org
Signed-off-by: Yong Li
Reviewed-by: Phil Reid
Signed-off-by: Linus Walleij
16 Mar, 2016
1 commit
-
pca953x_gpio_set_multiple() divides by 4 to convert from longs to bytes,
which assumes a 32-bit platform, and is not correct on 64-bit platforms.
Use "sizeof(...)" instead to fix this.Cc: stable@vger.kernel.org
Fixes: b4818afeacbd8182 ("gpio: pca953x: Add set_multiple to allow multiple bits to be set in one write.")
Signed-off-by: Geert Uytterhoeven
Acked-by: Phil Reid
Signed-off-by: Linus Walleij
23 Feb, 2016
1 commit
-
Use devm_gpiochip_add_data() for GPIO registration.
Signed-off-by: Laxman Dewangan
05 Jan, 2016
1 commit
-
This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().Cc: Grygorii Strashko
Cc: Markus Pargmann
Cc: Toby Smith
Signed-off-by: Linus Walleij
11 Dec, 2015
1 commit
-
Tested with TCA6408 / TCA6416 devices.
Signed-off-by: Phil Reid
Signed-off-by: Linus Walleij
09 Dec, 2015
1 commit
-
After adding the DT matching in
commit 6f29c9afbe636fc0e35c82a11eaf45c3b85eb07a
"gpio: pca935x: fix of-only probed devices"
compilation fails like this:CC [M] drivers/gpio/gpio-pca953x.o
gpio-pca953x.c: In function ‘pca953x_probe’:
gpio-pca953x.c:693:11: error: implicit declaration of
function ‘of_match_device’ [-Werror=implicit-function-declaration]
match = of_match_device(pca953x_dt_ids, &client->dev);
^
gpio-pca953x.c:693:9: warning: assignment makes pointer from
integer without a cast [-Wint-conversion]
match = of_match_device(pca953x_dt_ids, &client->dev);
^
cc1: some warnings being treated as errors
../scripts/Makefile.build:264: recipe for target
'drivers/gpio/gpio-pca953x.o' failedAfter removing the conditional inclusion guards compilation
works fine again. Might be a module problem so that
fix.Cc: Ben Dooks
Signed-off-by: Linus Walleij