summaryrefslogtreecommitdiff
path: root/drivers/gpio/pca953x_gpio.c
AgeCommit message (Collapse)Author
2018-04-27MLK-16219 pca953x_gpio: Clear the polarity invert register at initYe Li
The pca953x_gpio driver uses default value of polarity inversion register. For some devices like PCA9557 and MAX7310, their polarity inversion register default value is 0xf0. So for high 4 ports, when reading their values, the values are inverted as the actual level. This patch clears the polarity inversion register to 0 at init. So that the port read and write values are aligned. Signed-off-by: Ye Li <ye.li@nxp.com> Acked-by: Fugang Duan <fugang.duan@nxp.com> Acked-by: Peng Fan <peng.fan@nxp.com> (cherry picked from commit cc4e6b3786671ec2ce2ea74dc6334f72587cc756)
2018-03-05gpio: pca953x_gpio: Support label setting from DTMario Six
The PCA953x driver uses "gpio@%x_" as the GPIO bank name, where "%x" is instantiated with the I2C address of the chip. While this works, it becomes very confusing if a board has multiple PCAs with the same address on different I2C busses, and it also becomes an issue when a GPIO's value is to be set via the 'gpio' command, because this command only ever sets the value of the first device it encounters, leaving the other devices inaccessible to the command. As to not break boards that rely on this naming scheme, we introduce a new device tree string property "label" for the driver. If it exists, it is used to build a bank name of the form "%s@%x_" (where %x is still instantiated with the I2C address). If it does not exist, the legacy labeling scheme is used. Signed-off-by: Mario Six <mario.six@gdsys.cc>
2018-01-28gpio: pca953x_gpio: Make live-tree compatibleMario Six
Make the pca953x_gpio driver compatible with a live device tree. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
2018-01-28gpio: pca953x_gpio: Fix style violationsMario Six
Fix some style violations in the pca953x_gpio driver. Signed-off-by: Mario Six <mario.six@gdsys.cc>
2017-10-08dm: gpio: pca953x: Drop pointless data structure checksSimon Glass
These checks cannot fail since driver model will not call a driver's method if it cannot fully create the driver data structures. It is confusing to have these checks and others might copy them. Drop this code. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: gpio: Refactor to prepare for live tree supportSimon Glass
Move the main part of the GPIO request function into a separate function so that it can be used by the live tree function when added. Update the xlate method to use a node reference. Update all GPIO drivers to handle the modified xlate() method. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-02-08dm: core: Replace of_offset with accessorSimon Glass
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-06-19gpio: pca953x: Fix register reading past 8th GPIOmario.six@gdsys.cc
A bug in the pca953x driver prevents correct reading of GPIO input values beyond the 8th GPIO; all values are reported as zero. Setting of GPIO output values is not affected. This patch fixes the reading behavior. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Peng Fan <van.freenix@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-05-27dm: gpio: pca953x: Support PCA953X with 40 GPIOsmario.six@gdsys.cc
A DM driver for PCA953x was recently introduced by Peng Fan, which lacked support for the 40 GPIO versions. This patch adds support for these chips. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Peng Fan <van.freenix@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: gpio: pca953x: introduce driver model support for pca953xPeng Fan
Introduce a new driver that supports driver model for pca953x. The pca953x chips are used as I2C I/O expanders. This driver is designed to support the following chips: " 4 bits: pca9536, pca9537 8 bits: max7310, max7315, pca6107, pca9534, pca9538, pca9554, pca9556, pca9557, pca9574, tca6408, xra1202 16 bits: max7312, max7313, pca9535, pca9539, pca9555, pca9575, tca6416 24 bits: tca6424 40 bits: pca9505, pca9698 " But for now this driver only supports max 24 bits and pca953x compatible chips. pca957x compatible chips are not supported now. These can be addressed when we need to add such support for the different chips. This driver has been tested on i.MX6 SoloX Sabreauto board with max7310 i2c expander using gpio command as following: =>gpio status -a Bank gpio@30_: gpio@30_0: input: 1 [ ] => dm tree: i2c [ ] | | `-- i2c@021a8000 gpio [ ] | | |-- gpio@30 gpio [ ] | | `-- gpio@32 Signed-off-by: Peng Fan <van.freenix@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Wenyou Yang <wenyou.yang@atmel.com> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Cc: Purna Chandra Mandal <purna.mandal@microchip.com> Cc: Thomas Chou <thomas@wytron.com.tw> Cc: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Cc: Andrea Scian <andrea.scian@dave.eu> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Stefano Babic <sbabic@denx.de> Cc: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Michal Simek <michal.simek@xilinx.com> #on ZynqMP zcu102