summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: exynos5: Fix possible ABBA deadlock by keeping I2C clock preparedJavier Martinez Canillas2016-04-221-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The exynos5 I2C controller driver always prepares and enables a clock before using it and then disables unprepares it when the clock is not used anymore. But this can cause a possible ABBA deadlock in some scenarios since a driver that uses regmap to access its I2C registers, will first grab the regmap lock and then the I2C xfer function will grab the prepare lock when preparing the I2C clock. But since the clock driver also uses regmap for I2C accesses, preparing a clock will first grab the prepare lock and then the regmap lock when using the regmap API. An example of this happens on the Exynos5422 Odroid XU4 board where a s2mps11 PMIC is used and both the s2mps11 regulators and clk drivers share the same I2C regmap. The possible deadlock is reported by the kernel lockdep: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sec_core:428:(regmap)->lock); lock(prepare_lock); lock(sec_core:428:(regmap)->lock); lock(prepare_lock); *** DEADLOCK *** Fix it by leaving the code prepared on probe and use {en,dis}able in the I2C transfer function. This patch is similar to commit 34e81ad5f0b6 ("i2c: s3c2410: fix ABBA deadlock by keeping clock prepared") that fixes the same bug in other driver for an I2C controller found in Samsung SoCs. Reported-by: Anand Moon <linux.amoon@gmail.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Reviewed-by: Anand Moon <linux.amoon@gmail.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
* i2c: cpm: Fix build break due to incompatible pointer typesMichael Ellerman2016-04-221-2/+2
| | | | | | | | | | | | | | | | Since commit ea8daa7b9784 ("kbuild: Add option to turn incompatible pointer check into error"), assignments from an incompatible pointer types have become a hard error, eg: drivers/i2c/busses/i2c-cpm.c:545:91: error: passing argument 3 of 'dma_alloc_coherent' from incompatible pointer type Fix the build break by converting txdma & rxdma to dma_addr_t. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org Fixes: ea8daa7b9784
* i2c: ismt: Add Intel DNV PCI IDMika Westerberg2016-04-121-0/+2
| | | | | | | | | | Intel DNV has the same iSMT SMBus host controller than Intel Avoton. Add DNV PCI ID to the list of supported devices. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: xlp9xx: add support for Broadcom VulcanTanmay Jagdale2016-04-121-2/+2
| | | | | | | | | The Broadcom Vulcan ARM64 processor uses the same I2C controller present on the Broadcom XLP9xx/5xx MIPS processor family. Updated the Kconfig by adding ARCH_VULCAN option. Signed-off-by: Tanmay Jagdale <tanmay.jagdale@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: rk3x: add support for rk3228Yakir Yang2016-04-121-0/+1
| | | | | | | | | Enable the I2C core for this SoC. Signed-off-by: Yakir Yang <ykk@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: jz4780: really prevent potential division by zeroWolfram Sang2016-04-091-1/+6
| | | | | | | | Make sure we avoid a division-by-zero OOPS in case clock-frequency is set too low in DT. Add missing '\n' while we are here. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Axel Lin <axel.lin@ingics.com>
* Revert "i2c: jz4780: prevent potential division by zero"Wolfram Sang2016-04-091-1/+1
| | | | | | | | This reverts commit 34cf2acdafaa31a13821e45de5ee896adcd307b1. 'ret' is not set when bailing out. Also, there is a better place to check for 0. Reported-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: jz4780: prevent potential division by zeroWolfram Sang2016-04-071-1/+1
| | | | | | | Make sure we don't OOPS in case clock-frequency is set to 0 in a DT. The variable set here is later used as a divisor. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: mux: demux-pinctrl: Clean up sysfs attributesBen Hutchings2016-04-011-10/+29
| | | | | | | | | | | | | | | | | | 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>
* i2c: prevent endless uevent loop with CONFIG_I2C_DEBUG_COREWolfram Sang2016-03-301-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jan reported this: === After enabling CONFIG_I2C_DEBUG_CORE my system was broken (no network, console login not possible). System log was flooded with the this message: ... [ 608.052077] rtc-ds1307 0-0068: uevent [ 608.052500] rtc-ds1307 0-0068: uevent [ 608.052925] rtc-ds1307 0-0068: uevent ... The culprit is the dev_dbg printk in the i2c uevent handler. If this is activated (for instance by CONFIG_I2C_DEBUG_CORE) it results in an endless loop with systemd-journald. This happens if user-space scans the system log and reads the uevent file to get information about a newly created device, which seems fair use to me. Unfortunately reading the "uevent" file uses the same function that runs for creating the uevent for a new device, generating the next syslog entry. Ideally user-space would implement a recursion detection and after reading the same device file for the 1000th time call it a day, but nevertheless I think we should avoid this problem by removing the debug print completely or using another print variant. The same problem seems to be reported here: https://bugs.freedesktop.org/show_bug.cgi?id=76886 === His patch converted the message to pr_debug, but I think the debug can simply go. We have other means to see code paths these days. This enables us to clean up the function some more while we are here. Reported-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Tested-by: Jan Glauber <jglauber@cavium.com>
* Merge branch 'i2c/for-next' of ↵Linus Torvalds2016-03-2224-367/+1717
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "Mostly usual driver updates and improvements. The changelog should give an idea. Standing out is the i2c-qup driver with lots of new capabilities and we also have now an i2c-demuxer. I'd especially like to welcome Peter Rosin as the i2c-mux maintainer. He has an interesting series for muxes in the queue and agreed to look after this part of the subsystem. Thank you, Peter, and welcome again! The octeon changes were applied pretty recently before the merge window. I am aware. They are the first (and relatively simple) patches of a larger overhaul to this driver. In case something goes wrong with them, they are easy to fix (or revert). The advantage I see is that they are out of the way, and I can concentrate on the next block of patches. I really would like to apply the overhaul in smaller batches to avoid regressions. And waiting a cycle for the introductory patches seemed too much of a delay for me" * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (39 commits) i2c: octeon: Support I2C_M_RECV_LEN i2c: octeon: Cleanup resource allocation code i2c: octeon: Cleanup i2c-octeon driver MAINTAINERS: add Peter Rosin as i2c mux maintainer dt-bindings: i2c: Spelling s/propoerty/property/ i2c: immediately mark ourselves as registered i2c: i801: sort IDs alphabetically MAINTAINERS: Mika and me are designated reviewers for I2C DESIGNWARE i2c: octeon: Cleanup kerneldoc comments i2c: do not use internal data from driver core i2c: cadence: Fix the kernel-doc warnings i2c: imx: remove extra spaces. i2c: rcar: don't open code of_device_get_match_data() i2c: qup: Fix fifo handling after adding V2 support i2c: xiic: Implement power management i2c: piix4: Pre-shift the port number i2c: piix4: Always use the same type for port i2c: piix4: Support alternative port selection register i2c: tegra: don't open code of_device_get_match_data() i2c: riic, sh_mobile, rcar: Use ARCH_RENESAS ...
| * i2c: octeon: Support I2C_M_RECV_LENDavid Daney2016-03-181-5/+17
| | | | | | | | | | | | | | | | If I2C_M_RECV_LEN is set consider the length byte. Signed-off-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: octeon: Cleanup resource allocation codeJan Glauber2016-03-181-15/+3
| | | | | | | | | | | | | | | | Remove resource values from struct i2c_octeon and use devm_ioremap_resource helper. Signed-off-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: octeon: Cleanup i2c-octeon driverJan Glauber2016-03-181-106/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleanup only without functional change. - removed DRV_VERSION - defines: use defines instead of plain values, use BIT_ULL macro, add comments - rename waitqueue return value to time_left - sort local variables by length - fix indentation and whitespace errors - make function return void if the result is not used (octeon_i2c_stop, octeon_i2c_set_clock) - remove debug code from octeon_i2c_stop - renamed some functions for readability - update copyright Signed-off-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: immediately mark ourselves as registeredWolfram Sang2016-03-141-1/+4
| | | | | | | | | | | | | | | | | | | | Mark the i2c bus as registered right after the the bus_register call, not at the end of init. Otherwise, we can't register our own dummy driver. Reported-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Fixes: 95026658c46ea2 ("i2c: do not use internal data from driver core")
| * i2c: i801: sort IDs alphabeticallyAndy Shevchenko2016-03-121-4/+4
| | | | | | | | | | | | | | | | | | Sort the list to have a faster search for a certain PCI ID. There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: octeon: Cleanup kerneldoc commentsJan Glauber2016-03-121-50/+39
| | | | | | | | | | | | | | | | Remove point after parameter description and replace kerneldoc by a comment if it has no additional no value. Signed-off-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: do not use internal data from driver coreSudip Mukherjee2016-03-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | The variable p is a data structure which is used by the driver core internally and it is not expected that busses will be directly accessing these driver core internal only data. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [wsa: removed the unlikely()] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: cadence: Fix the kernel-doc warningsShubhrajyoti Datta2016-03-121-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the below warnings drivers/i2c/busses/i2c-cadence.c:164: warning: No description found for parameter 'dev' drivers/i2c/busses/i2c-cadence.c:826: warning: No description found for parameter 'dev' drivers/i2c/busses/i2c-cadence.c:826: warning: Excess function parameter '_dev' description in 'cdns_i2c_runtime_suspend' drivers/i2c/busses/i2c-cadence.c:844: warning: No description found for parameter 'dev' drivers/i2c/busses/i2c-cadence.c:844: warning: Excess function parameter '_dev' description in 'cdns_i2c_runtime_resume' while at it also update the cdns_i2c_clear_bus_hold and the runtime function update. Tested-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: imx: remove extra spaces.Dmitriy Baranov2016-03-031-6/+6
| | | | | | | | | | Signed-off-by: Dmitriy Baranov <dbaranov@dev.rtsoft.ru> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rcar: don't open code of_device_get_match_data()Wolfram Sang2016-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Fix fifo handling after adding V2 supportSricharan R2016-03-031-7/+39
| | | | | | | | | | | | | | | | | | | | | | | | After the addition of V2 support, there was a regression observed when testing it on MSM8996. The reason is driver puts the controller in to RUN state and writes the data to be 'tx' ed in fifo. But controller has to be put in to 'PAUSE' state and data has to written to fifo. Then should be put in to 'RUN' state separately. Signed-off-by: Sricharan R <sricharan@codeaurora.org> Tested-by: Pramod Gurav <gpramod@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Implement power managementShubhrajyoti Datta2016-03-031-7/+81
| | | | | | | | | | | | | | | | | | Enable power management. This patch enables the clocks before transfer and disables after the transfer. It also adds the clock description. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: piix4: Pre-shift the port numberJean Delvare2016-02-241-5/+5
| | | | | | | | | | | | | | | | | | | | Shift the port number at initialization time, so that it is ready to use at run time. That way we don't have to do it again for every SMBus transaction. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: piix4: Always use the same type for portJean Delvare2016-02-241-2/+2
| | | | | | | | | | | | | | | | | | | | Sometimes u8 is used to store the port number, sometimes unsigned short is used. Consistently stick to a single type, for consistency and to avoid implicit casts. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: piix4: Support alternative port selection registerJean Delvare2016-02-241-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SB800 register reference guide says that the SMBus port selection bits may not always be in register Smbus0En (0x2c) but could alternatively be found in register Smbus0Sel (0x2e) depending on the settings in register Smbus0SelEn (0x2f.) Add support for this configuration. The "alternative" register is the only one working for the Bolton (aka Hudson-2) chipset anyway. I do not have any documentation for the "kerncz" chipset so we treat it the same as the Bolton for now. Signed-off-by: Jean Delvare <jdelvare@suse.de> Tested-by: Christian Fetzer <fetzer.ch@gmail.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: tegra: don't open code of_device_get_match_data()Wolfram Sang2016-02-241-3/+1
| | | | | | | | | | | | | | | | | | | | This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
| * i2c: riic, sh_mobile, rcar: Use ARCH_RENESASSimon Horman2016-02-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Make use of ARCH_RENESAS in place of ARCH_SHMOBILE. This is part of an ongoing process to migrate from ARCH_SHMOBILE to ARCH_RENESAS the motivation for which being that RENESAS seems to be a more appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs. Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Add bam dma capabilitiesSricharan R2016-02-241-14/+459
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QUP cores can be attached to a BAM module, which acts as a dma engine for the QUP core. When DMA with BAM is enabled, the BAM consumer pipe transmitted data is written to the output FIFO and the BAM producer pipe received data is read from the input FIFO. With BAM capabilities, qup-i2c core can transfer more than 256 bytes, without a 'stop' which is not possible otherwise. Signed-off-by: Sricharan R <sricharan@codeaurora.org> Reviewed-by: Andy Gross <andy.gross@linaro.org> Tested-by: Archit Taneja <architt@codeaurora.org> Tested-by: Telkar Nagender <ntelkar@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i2c-stub: sort includesWolfram Sang2016-02-201-4/+4
| | | | | | | | | | | | | | I request this for drivers, so the core should adhere to sorted includes as well. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i2c-smbus: sort includesWolfram Sang2016-02-201-4/+4
| | | | | | | | | | | | | | I request this for drivers, so the core should adhere to sorted includes as well. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i2c-mux: sort includesWolfram Sang2016-02-201-4/+4
| | | | | | | | | | | | | | I request this for drivers, so the core should adhere to sorted includes as well. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i2c-dev: sort includesWolfram Sang2016-02-201-7/+7
| | | | | | | | | | | | | | I request this for drivers, so the core should adhere to sorted includes as well. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i2c-core: sort includesWolfram Sang2016-02-201-15/+15
| | | | | | | | | | | | | | I request this for drivers, so the core should adhere to sorted includes as well. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i2c-boardinfo: sort includesWolfram Sang2016-02-201-3/+3
| | | | | | | | | | | | | | I request this for drivers, so the core should adhere to sorted includes as well. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: iproc: Support larger TX transferRay Jui2016-02-121-9/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current iProc I2C driver only allows each TX transfer up to 63 bytes (the TX FIFO has a size of 64 bytes, and one byte is reserved for slave address). This patch enhances the driver to support TX transfer in each I2C message for up to 65535 bytes (a practical maximum, since member 'max_write_len' of 'struct i2c_adapter_quirks is of type 'u16') This works by loading up the I2C TX FIFO and enabling the TX underrun interrupt for each burst. After each burst of TX data is finished, i.e., when the TX FIFO becomes empty, the TX underrun interrupt will be triggered and another burst of TX data can be loaded into the TX FIFO. This repeats until all TX data are finished Signed-off-by: Ray Jui <rjui@broadcom.com> Tested-by: Icarus Chau <ichau@broadcom.com> Reviewed-by: Scott Branden <sbranden@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: iproc: Fix typo in the driverRay Jui2016-02-121-2/+2
| | | | | | | | | | | | | | | | Fix typo in the driver from 'I2C_TIMEOUT_MESC' to 'I2C_TIMEOUT_MSEC' Signed-off-by: Ray Jui <rjui@broadcom.com> Reviewed-by: Scott Branden <sbranden@broadcom.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: iproc: Add recovery mechanism in error caseRay Jui2016-02-121-43/+48
| | | | | | | | | | | | | | | | | | | | | | Add proper recovery mechanism to the iProc I2C driver in error cases. Signed-off-by: Icarus Chau <ichau@broadcom.com> Signed-off-by: Ray Jui <rjui@broadcom.com> Tested-by: Icarus Chau <ichau@broadcom.com> Reviewed-by: Scott Branden <sbranden@broadcom.com> [wsa: whitespace fixes] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: uniphier: add COMPILE_TEST optionMasahiro Yamada2016-02-121-2/+2
| | | | | | | | | | | | | | Add COMPILE_TEST for the compilation test coverage. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: mt65xx: add 4GB DMA mode support in i2c driverLiguo Zhang2016-02-121-0/+42
| | | | | | | | | | | | | | | | | | | | | | If 4GB mode is enabled, we should add 4GB DMA mode support in i2c driver. Set 4GB mode register to support 4GB mode. Signed-off-by: Liguo Zhang <liguo.zhang@mediatek.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Yingjoe Chen <yingjoe.chen@mediatek.com> [wsa: updated commit message] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware: Prevent runtime suspend during adapter registrationJarkko Nikula2016-02-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There can be unnecessary runtime suspend-resume cycle during i2c-designware-platdrv probe when it registers the I2C adapter device. This happens because i2c-designware-platdrv is set to initially active platform device in its probe function and is a parent of I2C adapter. In that case power.usage_count of i2c-designware device is zero and pm_runtime_get()/pm_runtime_put() cycle during probe could put it into runtime suspend. This happens when the i2c_register_adapter() calls the device_register(): i2c_register_adapter device_register device_add bus_probe_device device_initial_probe __device_attach if (dev->parent) pm_runtime_get_sync(dev->parent) ... if (dev->parent) pm_runtime_put(dev->parent) After that the i2c_register_adapter() continues registering I2C slave devices. In case slave device probe does I2C transfers the parent will resume again and thus get a needless runtime suspend/resume cycle during adapter registration. Prevent this while retaining the runtime PM status of i2c-designware by only incrementing/decrementing device power usage count during I2C adapter registration. That makes sure there won't be spurious runtime PM status changes and lets the driver core to idle the device after probe finishes. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware-platform: Drop duplicate module informationJean Delvare2016-02-121-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | The i2c-designware-platform module has duplicate module information when CONFIG_I2C_DESIGNWARE_BAYTRAIL is set. It gets the information from both i2c-designware-platdrv and i2c-designware-baytrail. The latter is optional extra code which ends up in the same module so it should not export module information. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware: remove redundant lockBaruch Siach2016-02-122-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | The per adapter bus_lock already projects from concurrent calls to the master_xfer callback. No need to add a driver internal lock. Also, rephrase a comment to drop mention of this lock. Reported-by: Rongrong Zou <zourongrong@gmail.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Transfer each i2c_msg in i2c_msgs without a stop bitSricharan R2016-02-121-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The definition of i2c_msg says that "If this is the last message in a group, it is followed by a STOP. Otherwise it is followed by the next @i2c_msg transaction segment, beginning with a (repeated) START" So the expectation is that there is no 'STOP' bit inbetween individual i2c_msg segments with repeated 'START'. Adding the support for the same. This is required for some clients like touchscreen which keeps incrementing counts across individual transfers and 'STOP' bit inbetween resets the counter, which is not required. This patch adds the support in non-dma mode. Signed-off-by: Sricharan R <sricharan@codeaurora.org> Reviewed-by: Andy Gross <andy.gross@linaro.org> Tested-by: Archit Taneja <architt@codeaurora.org> Tested-by: Telkar Nagender <ntelkar@codeaurora.org> [wsa: updated commit message] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Add V2 tags supportSricharan R2016-02-121-29/+386
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QUP from version 2.1.1 onwards, supports a new format of i2c command tags. Tag codes instructs the controller to perform a operation like read/write. This new tagging version supports bam dma and transfers of more than 256 bytes without 'stop' in between. Adding the support for the same. For each block a data_write/read tag and data_len tag is added to the output fifo. For the final block of data write_stop/read_stop tag is used. Signed-off-by: Andy Gross <andy.gross@linaro.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Tested-by: Archit Taneja <architt@codeaurora.org> Tested-by: Telkar Nagender <ntelkar@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Change qup_wait_writeready function to use for all timeoutsSricharan R2016-02-121-19/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | qup_wait_writeready waits only on a output fifo empty event. Change the same function to accept the event and data length to wait as parameters. This way the same function can be used for timeouts in other places as well. Signed-off-by: Sricharan R <sricharan@codeaurora.org> Reviewed-by: Andy Gross <andy.gross@linaro.org> Tested-by: Archit Taneja <architt@codeaurora.org> Tested-by: Telkar Nagender <ntelkar@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: mux: demux-pinctrl: add driverWolfram Sang2016-02-123-0/+283
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | i2c: designware: Add device HID for future AMD I2C controllerXiangliang Yu2016-03-101-0/+1
| | | | | | | | | | | | | | | | | | | | Add device HID AMDI0010 to match the AMD ACPI Vendor ID (AMDI) that was registered in http://www.uefi.org/acpi_id_list, and the I2C controller on future AMD paltform will use the HID instead of AMD0010. Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | i2c: brcmstb: allocate correct amount of memory for regmapWolfram Sang2016-03-011-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | We want the size of the struct, not of a pointer to it. To be future proof, just dereference the pointer to get the desired type. Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver") Acked-by: Gregory Fong <gregory.0xf0@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Kamal Dasu <kdasu.kdev@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
* | i2c: i801: Adding Intel Lewisburg support for iTCOAlexandra Yates2016-02-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting from Intel Sunrisepoint (Skylake PCH) the iTCO watchdog resources have been moved to reside under the i801 SMBus host controller whereas previously they were under the LPC device. This patch adds Intel lewisburg SMBus support for iTCO device. It allows to load watchdog dynamically when the hardware is present. Fixes: cdc5a3110e7c ("i2c: i801: add Intel Lewisburg device IDs") Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
OpenPOWER on IntegriCloud