aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/muxes
AgeCommit message (Collapse)Author
2016-08-15i2c: mux: demux-pinctrl: properly roll back when adding adapter failsWolfram Sang
We also need to revert the dynamic OF change, so we get a consistent state again. Otherwise, we might have two devices enabled e.g. after pinctrl setup fails. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
2016-07-06i2c: mux: reg: wrong condition checked for of_address_to_resource return valueLukasz Gemborowski
of_address_to_resource return 0 on successful call but devm_ioremap_resource is called only if it returns non-zero value Signed-off-by: Lukasz Gemborowski <lukasz.gemborowski@nokia.com> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
2016-06-09i2c: mux: reg: Provide of_match_tableLukasz Gemborowski
of_match_table was not filled which prevents device to be instantiated from device tree node. Signed-off-by: Lukasz Gemborowski <lukasz.gemborowski@nokia.com> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-05-04i2c: mux: relax locking of the top i2c adapter during mux-locked muxingPeter Rosin
With a i2c topology like the following GPIO ---| ------ BAT1 | v / I2C -----+----------+---- MUX | \ EEPROM ------ BAT2 there is a locking problem with the GPIO controller since it is a client on the same i2c bus that it muxes. Transfers to the mux clients (e.g. BAT1) will lock the whole i2c bus prior to attempting to switch the mux to the correct i2c segment. In the above case, the GPIO device is an I/O expander with an i2c interface, and since the GPIO subsystem knows nothing (and rightfully so) about the lockless needs of the i2c mux code, this results in a deadlock when the GPIO driver issues i2c transfers to modify the mux. So, observing that while it is needed to have the i2c bus locked during the actual MUX update in order to avoid random garbage on the slave side, it is not strictly a must to have it locked over the whole sequence of a full select-transfer-deselect mux client operation. The mux itself needs to be locked, so transfers to clients behind the mux are serialized, and the mux needs to be stable during all i2c traffic (otherwise individual mux slave segments might see garbage, or worse). Introduce this new locking concept as "mux-locked" muxes, and call the pre-existing mux locking scheme "parent-locked". Modify the i2c mux locking so that muxes that are "mux-locked" locks only the muxes on the parent adapter instead of the whole i2c bus when there is a transfer to the slave side of the mux. This lock serializes transfers to the slave side of the muxes on the parent adapter. Add code to i2c-mux-gpio and i2c-mux-pinctrl that checks if all involved gpio/pinctrl devices have a parent that is an i2c adapter in the same adapter tree that is muxed, and request a "mux-locked mux" if that is the case. Modify the select-transfer-deselect code for "mux-locked" muxes so that each of the select-transfer-deselect ops locks the mux parent adapter individually. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-24i2c: mux: pinctrl: fix indentation for better readabilityWolfram Sang
smatch rightfully says: drivers/i2c/muxes/i2c-mux-pinctrl.c:175 i2c_mux_pinctrl_probe() warn: inconsistent indenting Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-22i2c: i2c-mux-reg: 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. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
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>
2016-04-22i2c: i2c-mux-pca9541: 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. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-22i2c: i2c-arb-gpio-challenge: 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. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-22i2c: i2c-mux-pinctrl: 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. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-22i2c: i2c-mux-gpio: 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. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-01i2c: mux: demux-pinctrl: Clean up sysfs attributesBen Hutchings
sysfs attributes should use the same format for reads and writes, rather than pretty-printing on read. * Make the "cur_master" attribute read back as just the name of the master * Expose the list of all masters as a read-only "available_masters" attribute, using space separators as in similar attributes of other devices Also, spell out "cur_master" in full as "current_master". Fixes: 50a5ba876908 ("i2c: mux: demux-pinctrl: add driver") Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-02-12i2c: mux: demux-pinctrl: add driverWolfram Sang
This driver allows an I2C bus to switch between multiple masters. This is not hot-switching because connected I2C slaves will be re-instantiated. It is meant to select the best I2C core at runtime once the task is known. Example: Prefer i2c-gpio over another I2C core because of HW errata affecting your use case. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-09-03i2c: mux: reg Change ioread endianness for readbackYork Sun
Reading the register (if allowed) after writing is to ensure writing is completed on a posted bus. The endianness of reading doesn't matter. Signed-off-by: York Sun <yorksun@freescale.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-09-03i2c: mux: reg: fix compilation warningsMike Rapoport
With CONFIG_OF=n, the following warnings occur when compiling drivers/i2c/muxes/i2c-mux-reg.c: CC drivers/i2c/muxes/i2c-mux-reg.o drivers/i2c/muxes/i2c-mux-reg.c:170:13: warning: ‘struct gpiomux’ declared inside parameter list [enabled by default] struct platform_device *pdev) ^ drivers/i2c/muxes/i2c-mux-reg.c:170:13: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] drivers/i2c/muxes/i2c-mux-reg.c: In function ‘i2c_mux_reg_probe’: drivers/i2c/muxes/i2c-mux-reg.c:201:3: warning: passing argument 1 of ‘i2c_mux_reg_probe_dt’ from incompatible pointer type [enabled by default] ret = i2c_mux_reg_probe_dt(mux, pdev); ^ Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-09-03i2c: mux: reg: simplify register size checkingWolfram Sang
Checking was done at three different locations, just do it once and properly at probing time. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Tested-by: York Sun <yorksun@freescale.com>
2015-08-31i2c: muxes: fix leaked i2c adapter device node referencesVladimir Zapolskiy
Every call of of_parse_phandle() increments user count of found device node, if OF_DYNAMIC is enabled. The change fixes all similar addressed cases in drivers/i2c. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-08-24i2c: mux: Add register-based mux i2c-mux-regYork Sun
Based on i2c-mux-gpio driver, similarly the register-based mux switch from one bus to another by setting a single register. The register can be on PCIe bus, local bus, or any memory-mapped address. The endianness of such register can be specified in device tree if used, or in platform data. Signed-off-by: York Sun <yorksun@freescale.com> Acked-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-08-10i2c: arb-gpio-challenge: use of_get_i2c_adapter_by_node interfaceVladimir Zapolskiy
This change is needed to properly lock I2C parent bus driver. Prior to this change i2c_put_adapter() is misused, which may lead to an overflow over zero of I2C bus driver user counter. Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> 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-05-12i2c: Allow compile test of GPIO consumers if !GPIOLIBGeert Uytterhoeven
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer functionality only, can still be compiled if GPIOLIB is not enabled. Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where appropriate. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-04-03i2c: i2c-mux-gpio: remove error messages for probe deferralsIoan Nicu
Probe deferral is not an error case. It happens only when the necessary dependencies are not there yet. The driver core is already printing a message when a driver requests probe deferral, so this can be traced in the logs without these error prints. This patch removes the error messages for these deferral cases. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nokia.com> Acked-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Acked-by: Peter Korsgaard <peter.korsgaard@barco.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
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-10-20i2c: muxes: drop owner assignment from platform_driversWolfram Sang
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-08-09Merge branch 'i2c/for-3.17' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "Highlights: - class based instantiation finally dropped for most embedded drivers bringing boot up performance gains - removed two drivers (one outdated, one a duplicate) - ACPI has now operation region support (thanks to Lan Tianyu) - the i2c-stub driver got overhauled and gained new features to become more useful when writing i2c client drivers (thanks to Guenter Roeck and Jean Delvare) The rest is driver bugfixes, added bindings/ids, cleanups..." * 'i2c/for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (43 commits) i2c: mpc: delete unneeded test before of_node_put i2c: rk3x: fix interrupt handling issue i2c: imx: Fix format warning for dev_dbg i2c: qup: disable clks and return instead of just returning error i2c: exynos5: always enable HSI2C i2c: designware: add new bindings i2c: gpio: Drop dead code in i2c_gpio_remove i2c: pca954x: put the mux to disconnected state after resume i2c: st: Update i2c timings drivers/i2c/busses: use correct type for dma_map/unmap i2c: i2c-st: Use %pa to print 'resource_size_t' type i2c: s3c2410: resume the I2C controller earlier i2c: stub: Avoid an array overrun on I2C block transfers i2c: i801: Add device ID for Intel Wildcat Point PCH i2c: i801: Fix the alignment of the device table i2c: stub: Add support for banked register ranges i2c: stub: Remember the number of emulated chips i2c: stub: Add support for SMBus block commands i2c: efm32: correct namespacing of location property i2c: exynos5: remove extra line and fix an assignment ...
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-27i2c: mux: pca954x: fix dependenciesLinus Walleij
This driver causes the following randconfig build error: 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 This is because it is getting compiled without gpiolib, so introduce an explicit dependency. Reported-by: Jim Davis <jim.epost@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> 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-11-18Merge branch 'i2c/for-next' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c changes from Wolfram Sang: - new drivers for exynos5, bcm kona, and st micro - bigger overhauls for drivers mxs and rcar - typical driver bugfixes, cleanups, improvements - got rid of the superfluous 'driver' member in i2c_client struct This touches a few drivers in other subsystems. All acked. * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (38 commits) i2c: bcm-kona: fix error return code in bcm_kona_i2c_probe() i2c: i2c-eg20t: do not print error message in syslog if no ACK received i2c: bcm-kona: Introduce Broadcom I2C Driver i2c: cbus-gpio: Fix device tree binding i2c: wmt: add missing clk_disable_unprepare() on error i2c: designware: add new ACPI IDs i2c: i801: Add Device IDs for Intel Wildcat Point-LP PCH i2c: exynos5: Remove incorrect clk_disable_unprepare i2c: i2c-st: Add ST I2C controller i2c: exynos5: add High Speed I2C controller driver i2c: rcar: fixup rcar type naming i2c: scmi: remove some bogus NULL checks i2c: sh_mobile & rcar: Enable the driver on all ARM platforms i2c: sh_mobile: Convert to clk_prepare/unprepare i2c: mux: gpio: use reg value for i2c_add_mux_adapter i2c: mux: gpio: use gpio_set_value_cansleep() i2c: Include linux/of.h header i2c: mxs: Fix PIO mode on i.MX23 i2c: mxs: Rework the PIO mode operation i2c: mxs: distinguish i.MX23 and i.MX28 based I2C controller ...
2013-10-30i2c: mux: gpio: use reg value for i2c_add_mux_adapterIonut Nicu
The i2c-mux driver requires that the chan_id parameter passed to the i2c_add_mux_adapter() function is equal to the reg value for that adapter: for_each_child_of_node(mux_dev->of_node, child) { ret = of_property_read_u32(child, "reg", &reg); if (ret) continue; if (chan_id == reg) { priv->adap.dev.of_node = child; break; } } The i2c-mux-gpio driver uses an internal logical index for chan_id when calling i2c_add_mux_adapter() instead of using the reg value. Because of this, there will problems in selecting the right adapter when the i2c-mux-gpio's index into mux->data.values doesn't match the reg value. An example of such a case: mux->data.values = { 1, 0 } For chan_id = 0, i2c-mux will bind the adapter to the of_node with reg = <0>, but when it will call the select() callback with chan_id set to 0, the i2c-mux-gpio will use it as an index into mux->data.values and it will actually select the bus with reg = <1>. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com> Acked-by: Alexander Sverdlin <alexander.sverdlin@nsn.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
2013-10-30i2c: mux: gpio: use gpio_set_value_cansleep()Ionut Nicu
Some gpio chips may have get/set operations that can sleep. gpio_set_value() only works for chips which do not sleep, for the others we will get a kernel warning. Using gpio_set_value_cansleep() will work for both chips that do sleep and those who don't. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com> Acked-by: Peter Korsgaard <peter.korsgaard@barco.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
2013-10-30i2c: Include linux/of.h headerSachin Kamat
'of_match_ptr' is defined in linux/of.h. Include it explicitly to avoid build breakage in the future. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-10-10i2c: i2c-mux-pinctrl: use deferred probe when adapter not foundWolfram Sang
If it is not there yet, it might appear later. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-10-10i2c: i2c-arb-gpio-challenge: use deferred probe when adapter not foundWolfram Sang
If it is not there yet, it might appear later. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-10-10i2c: i2c-mux-gpio: use deferred probingIonut Nicu
If the i2c-parent bus driver is not loaded, returning -ENODEV will force people to unload and then reload the module again to get it working. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com> Acked-by: Peter Korsgaard <peter.korsgaard@barco.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-10-10i2c: i2c-mux-gpio: don't ignore of_get_named_gpio errorsIonut Nicu
of_get_named_gpio could return -E_PROBE_DEFER or another error code. This error should be passed further instead of being ignored. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com> Acked-by: Peter Korsgaard <peter.korsgaard@barco.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-10-03i2c: remove redundant of_match_ptrSachin Kamat
The data structure of_match_ptr() protects is always compiled in. Hence of_match_ptr() is not needed. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-08-23i2c: move OF helpers into the coreWolfram Sang
I2C of helpers used to live in of_i2c.c but experience (from SPI) shows that it is much cleaner to have this in the core. This also removes a circular dependency between the helpers and the core, and so we can finally register child nodes in the core instead of doing this manually in each driver. So, fix the drivers and documentation, too. 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-05-09Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linuxLinus Torvalds
Pull removal of GENERIC_GPIO from Grant Likely: "GENERIC_GPIO now synonymous with GPIOLIB. There are no longer any valid cases for enableing GENERIC_GPIO without GPIOLIB, even though it is possible to do so which has been causing confusion and breakage. This branch does the work to completely eliminate GENERIC_GPIO." * tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux: gpio: update gpio Chinese documentation Remove GENERIC_GPIO config option Convert selectors of GENERIC_GPIO to GPIOLIB blackfin: force use of gpiolib m68k: coldfire: use gpiolib mips: pnx833x: remove requirement for GENERIC_GPIO openrisc: default GENERIC_GPIO to false avr32: default GENERIC_GPIO to false xtensa: remove explicit selection of GENERIC_GPIO sh: replace CONFIG_GENERIC_GPIO by CONFIG_GPIOLIB powerpc: remove redundant GENERIC_GPIO selection unicore32: default GENERIC_GPIO to false unicore32: remove unneeded select GENERIC_GPIO arm: plat-orion: use GPIO driver on CONFIG_GPIOLIB arm: remove redundant GENERIC_GPIO selection mips: alchemy: require gpiolib mips: txx9: change GENERIC_GPIO to GPIOLIB mips: loongson: use GPIO driver on CONFIG_GPIOLIB mips: remove redundant GENERIC_GPIO select