aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/muxes/i2c-mux-pca954x.c
AgeCommit message (Collapse)Author
2016-04-22i2c: i2c-mux-pca954x: convert to use an explicit i2c mux corePeter Rosin
Allocate an explicit i2c mux core to handle parent and child adapters etc. Update the select/deselect ops to be in terms of the i2c mux core instead of the child adapter. Add a mask to handle the case where not all child adapters should cause a mux deselect to happen, now that there is a common deselect op for all child adapters. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-08-10i2c: Drop owner assignment from i2c_driverKrzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-06-17i2c: mux: pca954x: Use __i2c_transfer because of quirksAlexander Sverdlin
pca9541 and pca954x are calling master_xfer() of the parent adapter directly thus bypassing the quirks checks of the adapter. Use __i2c_transfer() instead. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Tested-by: Łukasz Gemborowski <lukasz.gemborowski@nokia.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jisheng Zhang <jszhang@marvell.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org Fixes: b7f625840267b1 ("i2c: add quirk checks to core")
2015-03-09i2c: pca954x: improve usage of gpiod APIUwe Kleine-König
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions) which appeared in v3.17-rc1, the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for outputs. Also there is an *_optional variant that serves well here. The sematics is slightly changed here by using it. Now if a reset gpio is specified and getting hold on it fails, pca954x_probe fails, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-01-23of: i2c: Add i2c-mux-idle-disconnect DT property to PCA954x mux driverAlexander Sverdlin
Add i2c-mux-idle-disconnect device tree property to PCA954x mux driver. The new property forces the multiplexer to disconnect child buses in idle state. This is used, for example, when there are several multiplexers on the same bus and the devices on the underlying buses might have same I2C addresses. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nsn.com> [wsa: added a newline] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-08-01i2c: pca954x: put the mux to disconnected state after resumeJisheng Zhang
pca954x may be power lost during suspend, so after resume we also suffer the issue fixed by commit cd823db8b1161ef0d756514d280715a576d65cc3, "pca954x power-on default is channel 0 connected. If multiple pca954x muxes are connected to the same physical I2C bus, the parent bus will see channel 0 devices behind both muxes by default." What's more, when resume bootloader may also operate the mux, so the the channel connected after that may not be the one driver thought. We fix this problem by putting the mux to disconnected state and clearing last_chan in the resume hook. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-05i2c: pca954x: Fix compilation without CONFIG_GPIOLIBLaurent Pinchart
The pca954x driver recently switched to the GPIO descriptor API without including the correct <linux/gpio/consumer.h> header. This breaks compilation without CONFIG_GPIOLIB. drivers/i2c/muxes/i2c-mux-pca954x.c: In function ‘pca954x_probe’: drivers/i2c/muxes/i2c-mux-pca954x.c:204:2: error: implicit declaration of function ‘devm_gpiod_get’ [-Werror=implicit-function-declaration] gpio = devm_gpiod_get(&client->dev, "reset"); ^ drivers/i2c/muxes/i2c-mux-pca954x.c:204:7: warning: assignment makes pointer from integer without a cast [enabled by default] gpio = devm_gpiod_get(&client->dev, "reset"); ^ drivers/i2c/muxes/i2c-mux-pca954x.c:206:3: error: implicit declaration of function ‘gpiod_direction_output’ [-Werror=implicit-function-declaration] gpiod_direction_output(gpio, 0); ^ cc1: some warnings being treated as errors make[3]: *** [drivers/i2c/muxes/i2c-mux-pca954x.o] Error 1 Fix it by including the right header. Reported-by: Jim Davis <jim.epost@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-06-03i2c: mux: pca954x: Use the descriptor-based GPIO APILaurent Pinchart
The ID-based GPIO API pushes handling of GPIO polarity to drivers. Simplify the driver by switching to the descriptor-based GPIO API. This also fixes a mismatch between the pca954x DT bindings that document a "reset-gpios" property and the driver that requests a "reset-gpio" property. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-29Merge branch 'i2c/for-current' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull more i2c updates from Wolfram Sang: "Mostly bugfixes, small but wanted cleanups, and Paul's init.h removal applied" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: rcar: fix NACK error code i2c: update i2c_algorithm documentation i2c: rcar: use devm_clk_get to ensure clock is properly ref-counted i2c: rcar: do not print error if device nacks transfer i2c: rely on driver core when sanitizing devices i2c: delete non-required instances of include <linux/init.h> i2c: acorn: is tristate and should use module.h i2c: piix4: Standardize log messages i2c: piix4: Use different message for AMD Auxiliary SMBus Controller i2c: piix4: Add support for AMD ML and CZ SMBus changes
2014-01-29Merge branch 'hwmon-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging Pull hwmon updates from Jean Delvare: "This include it87 driver improvements, and a tree-wide change of my e-mail address" * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: Update Jean Delvare's e-mail address hwmon: (it87) Print proper names for the IT8771E and IT8772E hwmon: (it87) Add support for the ITE IT8603E
2014-01-29Update Jean Delvare's e-mail addressJean Delvare
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2014-01-24i2c: delete non-required instances of include <linux/init.h>Paul Gortmaker
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-03i2c: pca954x: Add reset GPIO supportLaurent Pinchart
If a reset GPIO support is specified, request the GPIO and get the chip out of reset at probe time. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-03i2c: pca954x: Use devm_kzalloc managed allocatorLaurent Pinchart
This simplifies error and removal paths. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-03i2c: pca954x: Sort headers alphabeticallyLaurent Pinchart
This helps avoiding duplicate includes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-08-19i2c: use dev_get_platdata()Jingoo Han
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-04-02i2c: Ignore the return value of i2c_del_mux_adapter()Lars-Peter Clausen
i2c_del_mux_adapter() always returns 0. So all checks testing whether it will be non zero will always evaluate to false and the conditional code is dead code. This patch updates all callers of i2c_del_mux_adapter() to ignore its return value and assume that it will always succeed (which it will). A subsequent patch will make the return type of i2c_del_mux_adapter() void. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2012-10-05i2c-mux: Add support for device auto-detectionJean Delvare
Let I2C bus segments behind multiplexers have a class. This allows for device auto-detection on these segments. As long as parent segments don't share the same class, it should be fine. I implemented support in drivers i2c-mux-gpio and i2c-mux-pca954x. I left i2c-mux-pca9541 and i2c-mux-pinctrl alone for the moment as I don't know if this feature makes sense for the use cases of these drivers. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Peter Korsgaard <peter.korsgaard@barco.com> Cc: David Daney <david.daney@cavium.com> Cc: Michael Lawnick <ml.lawnick@gmx.de> Cc: Rodolfo Giometti <giometti@linux.it>
2012-05-12i2c: muxes: rename first set of drivers to a standard patternWolfram Sang
Apply a naming pattern like in the rest of the subsystem to a first set of mux drivers. Those drivers are the low-hanging fruit; we want to pick them to motivate upcoming drivers to follow the new pattern. The missing GPIO driver will be converted in a later patch. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> (pca9541) Acked-by: Jean Delvare <khali@linux-fr.org>