summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'asm-generic-for-linus' of ↵Linus Torvalds2015-11-061-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic Pull asm-generic cleanups from Arnd Bergmann: "The asm-generic changes for 4.4 are mostly a series from Christoph Hellwig to clean up various abuses of headers in there. The patch to rename the io-64-nonatomic-*.h headers caused some conflicts with new users, so I added a workaround that we can remove in the next merge window. The only other patch is a warning fix from Marek Vasut" * tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: asm-generic: temporarily add back asm-generic/io-64-nonatomic*.h asm-generic: cmpxchg: avoid warnings from macro-ized cmpxchg() implementations gpio-mxc: stop including <asm-generic/bug> n_tracesink: stop including <asm-generic/bug> n_tracerouter: stop including <asm-generic/bug> mlx5: stop including <asm-generic/kmap_types.h> hifn_795x: stop including <asm-generic/kmap_types.h> drbd: stop including <asm-generic/kmap_types.h> move count_zeroes.h out of asm-generic move io-64-nonatomic*.h out of asm-generic
| * move io-64-nonatomic*.h out of asm-genericChristoph Hellwig2015-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | These are not implementations of default architecture code but helpers for drivers. Move them to the place they belong to. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Darren Hart <dvhart@linux.intel.com> Acked-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
* | i2c: pnx: fix runtime warnings caused by enabling unprepared clockVladimir Zapolskiy2015-10-231-5/+5
| | | | | | | | | | | | | | | | | | The driver can not be used on a platform with common clock framework until clk_prepare/clk_unprepare calls are added, otherwise clk_enable calls will fail and a WARN is generated. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | i2c: mv64xxx: really allow I2C offloadingHezi Shahmoon2015-10-221-2/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 00d8689b85a7 ("i2c: mv64xxx: rework offload support to fix several problems") completely reworked the offload support, but left a debugging-related "return false" at the beginning of the mv64xxx_i2c_can_offload() function. This has the unfortunate consequence that offloading is in fact never used, which wasn't really the intention. This commit fixes that problem by removing the bogus "return false". Fixes: 00d8689b85a7 ("i2c: mv64xxx: rework offload support to fix several problems") Signed-off-by: Hezi Shahmoon <hezi@marvell.com> [Thomas: reworked commit log and title.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: <stable@vger.kernel.org>
* | i2c: designware: Do not use parameters from ACPI on Dell Inspiron 7348Mika Westerberg2015-10-181-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ACPI SSCN/FMCN methods were originally added because then the platform can provide the most accurate HCNT/LCNT values to the driver. However, this seems not to be true for Dell Inspiron 7348 where using these causes the touchpad to fail in boot: i2c_hid i2c-DLL0675:00: failed to retrieve report from device. i2c_designware INT3433:00: i2c_dw_handle_tx_abort: lost arbitration i2c_hid i2c-DLL0675:00: failed to retrieve report from device. i2c_designware INT3433:00: controller timed out The values received from ACPI are (in fast mode): HCNT: 72 LCNT: 160 this translates to following timings (input clock is 100MHz on Broadwell): tHIGH: 720 ns (spec min 600 ns) tLOW: 1600 ns (spec min 1300 ns) Bus period: 2920 ns (assuming 300 ns tf and tr) Bus speed: 342.5 kHz Both tHIGH and tLOW are within the I2C specification. The calculated values when ACPI parameters are not used are (in fast mode): HCNT: 87 LCNT: 159 which translates to: tHIGH: 870 ns (spec min 600 ns) tLOW: 1590 ns (spec min 1300 ns) Bus period 3060 ns (assuming 300 ns tf and tr) Bus speed 326.8 kHz These values are also within the I2C specification. Since both ACPI and calculated values meet the I2C specification timing requirements it is hard to say why the touchpad does not function properly with the ACPI values except that the bus speed is higher in this case (but still well below the max 400kHz). Solve this by adding DMI quirk to the driver that disables using ACPI parameters on this particulare machine. Reported-by: Pavel Roskin <plroskin@gmail.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by: Pavel Roskin <plroskin@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
* | i2c: designware-platdrv: enable RuntimePM before registering to the coreWolfram Sang2015-10-151-6/+7
| | | | | | | | | | | | | | | | | | | | | | The core may register clients attached to this master which may use funtionality from the master. So, RuntimePM must be enabled before, otherwise this will fail. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: stable@kernel.org
* | i2c: s3c2410: enable RuntimePM before registering to the coreWolfram Sang2015-10-151-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | The core may register clients attached to this master which may use funtionality from the master. So, RuntimePM must be enabled before, otherwise this will fail. While here, move drvdata, too. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Kukjin Kim <kgene@kernel.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
* | i2c: rcar: enable RuntimePM before registering to the coreWolfram Sang2015-10-151-3/+4
| | | | | | | | | | | | | | | | | | | | | | The core may register clients attached to this master which may use funtionality from the master. So, RuntimePM must be enabled before, otherwise this will fail. While here, move drvdata, too. Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
* | i2c: return probe deferred status on dev_pm_domain_attachKieran Bingham2015-10-151-6/+6
|/ | | | | | | | | | | | | | | A change of return status was introduced in commit 3fffd1283927 ("i2c: allow specifying separate wakeup interrupt in device tree") The commit prevents the defer status being passed up the call stack appropriately when dev_pm_domain_attach returns -EPROBE_DEFER. Catch the PROBE_DEFER and clear up the IRQ wakeup status Signed-off-by: Kieran Bingham <kieranbingham@gmail.com> Fixes: 3fffd1283927 ("i2c: allow specifying separate wakeup interrupt in device tree") Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* Merge branch 'i2c/for-4.3' of ↵Linus Torvalds2015-09-0926-485/+1906
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "Features: - new drivers: Renesas EMEV2, register based MUX, NXP LPC2xxx - core: scans DT and assigns wakeup interrupts. no driver changes needed. - core: some refcouting issues fixed and better API for that - core: new helper function for best effort block read emulation - slave framework: proper DT bindings and userspace instantiation - some bigger work for xiic, pxa, omap drivers .. and quite a number of smaller driver fixes, cleanups, improvements" * 'i2c/for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (65 commits) i2c: mux: reg Change ioread endianness for readback i2c: mux: reg: fix compilation warnings i2c: mux: reg: simplify register size checking i2c: muxes: fix leaked i2c adapter device node references i2c: allow specifying separate wakeup interrupt in device tree of/irq: export of_get_irq_byname() i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code i2c: Replace I2C_CROS_EC_TUNNEL dependency eeprom: at24: use i2c_smbus_read_i2c_block_data_or_emulated i2c: core: Add support for best effort block read emulation i2c: lpc2k: add driver i2c: mux: Add register-based mux i2c-mux-reg i2c: dt: describe generic bindings i2c: slave: print warning if slave flag not set i2c: support 10 bit and slave addresses in sysfs 'new_device' i2c: take address space into account when checking for used addresses i2c: apply DT flags when probing i2c: make address check indpendent from client struct i2c: rename address check functions i2c: apply address offset for slaves, too ...
| * i2c: mux: reg Change ioread endianness for readbackYork Sun2015-09-031-14/+14
| | | | | | | | | | | | | | | | 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>
| * i2c: mux: reg: fix compilation warningsMike Rapoport2015-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * i2c: mux: reg: simplify register size checkingWolfram Sang2015-09-031-11/+6Star
| | | | | | | | | | | | | | | | 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>
| * i2c: muxes: fix leaked i2c adapter device node referencesVladimir Zapolskiy2015-08-314-0/+4
| | | | | | | | | | | | | | | | | | | | 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>
| * i2c: allow specifying separate wakeup interrupt in device treeDmitry Torokhov2015-08-261-9/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of having each i2c driver individually parse device tree data in case it or platform supports separate wakeup interrupt, and handle enabling and disabling wakeup interrupts in their power management routines, let's have i2c core do that for us. Platforms wishing to specify separate wakeup interrupt for the device should use named interrupt syntax in their DTSes: interrupt-parent = <&intc1>; interrupts = <5 0>, <6 0>; interrupt-names = "irq", "wakeup"; This patch is inspired by work done by Vignesh R <vigneshr@ti.com> for pixcir_i2c_ts driver. Note that the original code tried to preserve any existing wakeup settings from userspace but was not quite right in that regard: it would preserve wakeup flag set by userspace upon driver rebinding; but it would re-arm the wakeup flag if it was disabled by userspace. We think that resetting the flag upon re-binding the driver is proper behavior as the driver is responsible for setting up and handling wakeups. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Vignesh R <vigneshr@ti.com> [wsa: updated the commit message] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xgene-slimpro: dma_mapping_error() doesn't return an error codeDan Carpenter2015-08-241-4/+4
| | | | | | | | | | | | | | | | | | | | The dma_mapping_error() function returns true if there is an error, it doesn't return an error code. We should return -ENOMEM. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
| * i2c: Replace I2C_CROS_EC_TUNNEL dependencyJavier Martinez Canillas2015-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ChromeOS EC tunnel I2C bus driver depend on CROS_EC_PROTO but MFD_CROS_EC select CROS_EC_PROTO instead. Mixing select and depends on is bad practice as it may lead to circular Kconfig dependencies. Since the platform device that is matched with the I2C bus driver is registered by the ChromeOS EC mfd driver, I2C_CROS_EC_TUNNEL really depends on MFD_CROS_EC. And because this config option selects CROS_EC_PROTO, that dependency is met as well. So make the driver to depend on MFD_CROS_EC instead of CROS_EC_PROTO. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: core: Add support for best effort block read emulationIrina Tirdea2015-08-241-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are devices that need to handle block transactions regardless of the capabilities exported by the adapter. For performance reasons, they need to use i2c read blocks if available, otherwise emulate the block transaction with word or byte transactions. Add support for a helper function that would read a data block using the best transfer available: I2C_FUNC_SMBUS_READ_I2C_BLOCK, I2C_FUNC_SMBUS_READ_WORD_DATA or I2C_FUNC_SMBUS_READ_BYTE_DATA. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: lpc2k: add driverJoachim Eastwood2015-08-243-0/+524
| | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the I2C controller found on several NXP devices including LPC2xxx, LPC178x/7x and LPC18xx/43xx. The controller is implemented as a state machine and the driver act upon the state changes when the bus is accessed. The I2C controller supports master/slave operation, bus arbitration, programmable clock rate, and speeds up to 1 Mbit/s. Signed-off-by: Joachim Eastwood <manabian@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: mux: Add register-based mux i2c-mux-regYork Sun2015-08-243-0/+306
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * i2c: slave: print warning if slave flag not setWolfram Sang2015-08-241-0/+4
| | | | | | | | | | | | | | | | Address collisions will be rare, but we should let the user know that slaves have their own address space nonetheless. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: support 10 bit and slave addresses in sysfs 'new_device'Wolfram Sang2015-08-241-1/+11
| | | | | | | | | | | | | | | | | | | | We now have seperate address spaces for 10 bit and we-are-slave clients. Update the sysfs device instantiation method to support these types by accepting the address offsets that are assigned to the extra address spaces. Update the documentation, too. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: take address space into account when checking for used addressesWolfram Sang2015-08-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | It is not enough to compare the plain address value, we also need to check the flags enabling a different address space. E.g. it is valid to have address 0x50 as a 7-bit address and 0x050 as 10-bit address on the same bus. Same for addresses when we are the slave. Tested-by: Andrey Danin <danindrey@mail.ru> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: apply DT flags when probingWolfram Sang2015-08-241-5/+18
| | | | | | | | | | | | | | | | | | | | Check for slave and 10-bit flags when probing and mark the client when found. Improve the address validity check, too Tested-by: Andrey Danin <danindrey@mail.ru> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: make address check indpendent from client structWolfram Sang2015-08-241-6/+5Star
| | | | | | | | | | | | | | | | | | | | | | | | We want to use this function with struct boardinfo soon, so let's just pass the parameters really needed. We also extend the type of addr, so more types can be input. Remove a superfluous dangling comment while here. Tested-by: Andrey Danin <danindrey@mail.ru> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rename address check functionsWolfram Sang2015-08-241-6/+6
| | | | | | | | | | | | | | | | | | | | | | The current naming is based on the arguments of the functions and not on what they do. Even I as the maintainer find this confusing, so let's rename them to something more descriptive. Tested-by: Andrey Danin <danindrey@mail.ru> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: apply address offset for slaves, tooWolfram Sang2015-08-241-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | We want a separate address range for being an I2C slave. Add an offset of 0x1000, so it can be combined with ten bit addresses as well. Add a separate function to create the address value, we will need it later in other places. Tested-by: Andrey Danin <danindrey@mail.ru> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: mediatek: Fixup i2c ack error interrupt handlingEddie Huang2015-08-111-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | When occur i2c ack error, i2c controller generate two interrupts, first is the ack error interrupt, then the complete interrupt. i2c interrupt handler should keep the two interrupt value, and only call complete() for the complete interrupt. Signed-off-by: Liguo Zhang <liguo.zhang@mediatek.com> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: mediatek: Reset DMA engine in hardware init functionEddie Huang2015-08-111-0/+6
| | | | | | | | | | | | | | | | | | | | Reset DMA in hardware init function to avoid unknown hardware state before do any I2C operation. Signed-off-by: Liguo Zhang <liguo.zhang@mediatek.com> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: viperboard: clean up inconsistent indentingColin Ian King2015-08-101-5/+5
| | | | | | | | | | | | | | | | Minor clean up of indenting, no functional change Signed-off-by: Colin Ian King <colin.king@canonical.com> [wsa: squashed two lines into one] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: cadence: set THIS_MODULE to the owner of the adapterMasahiro Yamada2015-08-101-0/+1
| | | | | | | | | | | | | | The owner of the adapter is missing, while this driver is tristate. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware: Make debug print in i2c_dw_isr() shorterJarkko Nikula2015-08-101-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Printing adapter name is irrelevant from this debug print and makes output needlessly long. Having already device and functions names printed here is enough for debugging. While at it remove extra space from "enabled= 0x" and use "%#x" for printing "0x" prefixed hexadecimal values. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> [wsa: made it a oneliner] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: arb-gpio-challenge: use of_get_i2c_adapter_by_node interfaceVladimir Zapolskiy2015-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
| * i2c: core: add and export of_get_i2c_adapter_by_node() interfaceVladimir Zapolskiy2015-08-101-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_find_i2c_adapter_by_node() call requires quite often missing put_device(), and i2c_put_adapter() releases a device locked by i2c_get_adapter() only. In general module_put(adapter->owner) and put_device(dev) are not interchangeable. This is a common error reproduction scenario as a result of the misusage described above (for clearness this is run on iMX6 platform with HDMI and I2C bus drivers compiled as kernel modules): root@mx6q:~# lsmod | grep i2c i2c_imx 10213 0 root@mx6q:~# lsmod | grep dw_hdmi_imx dw_hdmi_imx 3631 0 dw_hdmi 11846 1 dw_hdmi_imx imxdrm 8674 3 dw_hdmi_imx,imx_ipuv3_crtc,imx_ldb drm_kms_helper 113765 5 dw_hdmi,imxdrm,imx_ipuv3_crtc,imx_ldb root@mx6q:~# rmmod dw_hdmi_imx root@mx6q:~# lsmod | grep i2c i2c_imx 10213 -1 ^^^^^ root@mx6q:~# rmmod i2c_imx rmmod: ERROR: Module i2c_imx is in use To fix existing users of these interfaces and to avoid any further confusion and misusage in future, add one more interface of_get_i2c_adapter_by_node(), it is similar to i2c_get_adapter() in sense that an I2C bus device driver found and locked by user can be correctly unlocked by i2c_put_adapter(). Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: core: manage i2c bus device refcount in i2c_[get|put]_adapterVladimir Zapolskiy2015-08-101-3/+12
| | | | | | | | | | | | | | | | | | | | In addition to module_get()/module_put() add get_device()/put_device() calls into i2c_get_adapter()/i2c_put_adapter() exported interfaces. This is done to lock I2C bus device, if it is in use by a client. Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: Drop owner assignment from i2c_driverKrzysztof Kozlowski2015-08-103-3/+0Star
| | | | | | | | | | | | | | | | 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>
| * i2c: designware-pci: use IRQF_COND_SUSPEND flagAndy Shevchenko2015-08-101-2/+2
| | | | | | | | | | | | | | | | | | The mentioned flag fixes a warning on Intel Edison board since one of the I2C controller shares IRQ line with watchdog timer. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: parport: Add VCT-jig adapterOndrej Zary2015-08-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | Add support for VCT-jig parallel port I2C adapter to i2c-parport. The adapter schematic can be found here (in the RAR file): http://remont-aud.net/shop/22/desc/vct-jig-komplekt-dlja-samostojatelnoj-sborki Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: removed work arounds in i2c driver for Zynq Ultrascale+ MPSoCAnurag Kumar Vulisha2015-08-101-11/+57
| | | | | | | | | | | | | | | | | | Cadence 1.0 version has bugs which have been fixed in the cadence 1.4 version. This patch removes the quirks present in the driver for cadence 1.4 version. Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com> [wsa: fixed indentation issues in r1p10_i2c_def] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: tegra: add support for fast plus (FM+) mode clock rateLaxman Dewangan2015-08-101-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tegra I2C controller required to configure the clock divisor register inside controller to different value based on the clock speed. The recommended clock divisor for the I2C controller for standard/fast mode is 0x19 and for fast-mode plus is 0x10. Add support to configure clock divisor register of I2C controller based on bus clock rate. This clock divisor is supported form T114 onwards. Signed-off-by: Chaitanya Bandi <bandik@nvidia.com> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: tegra: update CONFIG_LOAD for new conifigurationLaxman Dewangan2015-08-101-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once the new configuration is set on the conifg register of I2C controller, it is require to update the CONFIG_LOAD register to transfer the new SW configuration to actual HW internal registers that would be used in the actual logic. It is like, SW is programming only shadow registers through regular configuration and when these load_config bit fields are set to 1, it causes the regular/shadows registers configuration transferred to the HW internal active registers. So SW has to set these bit fields at the end of all regular registers configuration. And these config_load bits are HW auto-clear bits. HW clears these bit fields once the register configuration is moved to HW internal active registers. So SW has to wait until these bits are auto-cleared before going for any further programming This mechanism is supported on T124 and after this SoCs. Signed-off-by: Chaitanya Bandi <bandik@nvidia.com> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: omap: fix cleanup regressionWolfram Sang2015-08-101-1/+1
| | | | | | | | | | | | | | | | | | Patch "i2c: omap: abolish variable name confusion" triggered a coccinelle warning which we fix here: drivers/i2c/busses/i2c-omap.c:1333:5-24: pm_runtime_get_sync returns < 0 as error. Unecessary IS_ERR_VALUE at line 1334 Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Do not continue in case of errors in RxShubhrajyoti Datta2015-08-101-0/+2
| | | | | | | | | | | | | | | | | | | | In case of error conditions like Arbitration lost or NACK lets signal the waiting process. Handle error cases in the Rx path Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Service all interrupts in isrShubhrajyoti Datta2015-08-101-14/+10Star
| | | | | | | | | | | | | | | | | | Currently only one interrupt is serviced in the isr. In case the multiple interrupts happen simultenously we service and ack only one of them. Check for all the causes in the isr and service them. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Remove the Addressed as slave interruptShubhrajyoti Datta2015-08-101-1/+1
| | | | | | | | | | | | | | | | | | Currently there is no slave mode support in the driver also in the isr we just ack it and do nothing. So disable the AAS interrupt. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Remove busy loop while waiting for bus busyShubhrajyoti Datta2015-08-101-1/+1
| | | | | | | | | | | | | | | | Remove the busy loop while waiting for bus busy. Instead let the processor sleep. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Remove the disabling of interruptsShubhrajyoti Datta2015-08-101-7/+0Star
| | | | | | | | | | | | | | | | | | | | | | Currently before every transfer the interrupts are disabled. So incase the slave nacks in the middle of the transfer the current transfer is not aborted. Upon enabling the interrupts conditions like NACK , arbitration lost will not be masked. Remove the disabling of the interrupts. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Do not reset controller before every transferShubhrajyoti Datta2015-08-101-1/+0Star
| | | | | | | | | | | | | | | | | | | | Currently before every transfer the controller is reinitialised. We are already resetting the controller upon errors so upon every transfer is a performance kill. Remove the same. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: move the xiic_process to thread contextShubhrajyoti Datta2015-08-101-13/+20
| | | | | | | | | | | | | | | | | | | | The xiic_process is a 154 line code that runs in isr context currently move it to thread context. Also the name xiic_process suggests that the intension was to run in process context. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> [wsa: initialized irqreturn_t to IRQ_NONE instead of IRQ_HANDLED] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xiic: Remove the disabling of interruptsShubhrajyoti Datta2015-08-101-3/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | Currently the interrupts are disabled at the start of the isr and enabled at the end of the isr. Remove the same. In case the slave device NACKs the transaction while in the isr the transfer will continue and the NACK interrupt will arrive only after the isr is serviced. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>