summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: Sanity checks on adapter registrationJean Delvare2010-11-151-0/+12
| | | | | | | Make sure I2C adapters being registered have the required struct fields set. If they don't, problems will happen later. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Mark i2c_adapter.id as deprecatedJean Delvare2010-11-151-1/+0
| | | | | | | | | | | It's about time to make it clear that i2c_adapter.id is deprecated. Hopefully this will remind the last user to move over to a different strategy. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Jarod Wilson <jarod@redhat.com> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
* i2c-i801: Add PCI idents for Patsburg 'IDF' SMBus controllersDavid Woodhouse2010-10-311-0/+12
| | | | | | | | These are the extra 'Integrated Device Function' SMBus controllers found on the Patsburg chipset. Mention the absence of slave mode support. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-i801: Handle multiple instances instead of keeping global stateDavid Woodhouse2010-10-311-144/+175
| | | | | | | | | | It's poor form to keep driver state in global variables rather than per-instance. It never really mattered in practice when there was only one controller on the chipset, but the latest chipsets do have more than one controller, so now we care. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c-i801: Add Intel Patsburg device IDSeth Heasley2010-10-312-0/+3
| | | | | | | Add support for the Intel Patsburg PCH SMBus Controller. Signed-off-by: Seth Heasley <seth.heasley@intel.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* Merge branch 'for-2637/i2c-all' of git://git.fluff.org/bjdooks/linuxLinus Torvalds2010-10-295-16/+1176
|\ | | | | | | | | | | | | | | | | | | | | * 'for-2637/i2c-all' of git://git.fluff.org/bjdooks/linux: i2c-intel-mid: Driver depends on PCI i2c-intel-mid: support for Moorestown and Medfield platform i2c-nomadik: fixup bus delays i2c-nomadik: support smbus emulation i2c-nomadik: dynamic clocking i2c-nomadik: documentation fixes i2c-s3c2410: Enable i2c clock only when doing some transfert
| * i2c-intel-mid: Driver depends on PCIRandy Dunlap2010-10-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | i2c-intel-mid driver uses PCI data structs and interfaces, so it should depend on PCI. Fixes these build errors: drivers/i2c/busses/i2c-intel-mid.c:977: error: implicit declaration of function 'pci_request_region' drivers/i2c/busses/i2c-intel-mid.c:1077: error: implicit declaration of function 'pci_release_region' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Ba Zheng <zheng.ba@intel.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Ben Dooks <ben-linux@fluff.org> Cc: linux-i2c@vger.kernel.org Signed-off-by: Ben Dooks <ben-linux@fluff.org>
| * Merge branch 'for-2637/i2c/samsung' into next-i2cBen Dooks2010-10-281-1/+9
| |\
| | * i2c-s3c2410: Enable i2c clock only when doing some transfertArnaud Patard (Rtp)2010-10-211-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch modify the s3c2410 i2c driver behaviour to enable the i2c clock only when needed. I'm not sure if this has a big impact on power usage but at least it's fixing a bug with the uda1380 codec which needs to be hard reset'ed if the i2c clock is enabled before it's powered on (at least on h1940). Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
| * | Merge branch 'for-2637/i2c/i2c-nomadik' into next-i2cBen Dooks2010-10-281-15/+21
| |\ \
| | * | i2c-nomadik: fixup bus delaysLinus Walleij2010-10-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were missing a transfer delay in one execution path leading to hangs and the bus timeout was too low leading to errors under stress tests. Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
| | * | i2c-nomadik: support smbus emulationLinus Walleij2010-10-251-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can do smbus emulation so flag this and drop the duplicate flags implied from smbus emulation. Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
| | * | i2c-nomadik: dynamic clockingLinus Walleij2010-10-251-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes sure the Nomadik I2C bus driver silicon is only clocked when really needed, saving some microamps here and there when there is no I2C traffic. Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
| | * | i2c-nomadik: documentation fixesLinus Walleij2010-10-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes some kerneldoc and assorted documenatation in the Nomadik I2C driver without semantic impact. Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
| * | | i2c-intel-mid: support for Moorestown and Medfield platformAlan Cox2010-10-283-0/+1145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Updated to address Ben's comments. With regard to the message segment restriction it's not something we hit on the actual platform so while I will investigate that further I don't think its a blocker to submission. At worst its a spot over-restrictive) From: Wen Wang <wen.w.wang@intel.com> Initial release of the driver. Updated and verified on hardware. Cleaned up as follows Alan Cox: Squash down the switches into tables, and use the PCI ident field. We could perhaps take this further and put the platform and port number into this. uint32t -> u32 bracketing of case statements spacing and '!' usage Check the speed (which is now 0/1/2) is valid and ignore otherwise. Fix remaining problems/suggestions from Jean's review Fix items from Ben's review Arjan van de Ven: Initial power management hooks Yong Wang <youg.y.wang@intel.com>: Shared IRQ support Wen Wang <wen.w.wang@intel.com>: D3 support Fixes for OCT test runs Interrupt optimisations Hong Liu <hong.liu@intel.com> The runtime PM code is working on the wrong device (i2c_adapter->dev). The correct one should be pci_dev->dev. This breaks attached i2c slave devices with runtime PM enabled. Slave device needs to runtime resume parent device before runtime resuming itself, but we always get error since we don't have pm_runtime callback for i2c_adapter->dev. Bin Yang <bin.yang@intel.com>: Update speed table Saadi Maalem <saadi.maalem@intel.com>: Clear all interrupts in the hardware init Celine Chotard <celinex.chotard@intel.com>: Correct ordering of clear/disable of IRQs Signed-off-by: Wen Wang <wen.w.wang@intel.com> Signed-off-by: Yong Wang <yong.y.wang@intel.com> Signed-off-by: Hong Liu <hong.liu@intel.com> Signed-off-by: Bin Yang <bin.yang@intel.com> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* | | | Merge branch 'linux-next' of ↵Linus Torvalds2010-10-282-7/+7
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 * 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (27 commits) x86: allocate space within a region top-down x86: update iomem_resource end based on CPU physical address capabilities x86/PCI: allocate space from the end of a region, not the beginning PCI: allocate bus resources from the top down resources: support allocating space within a region from the top down resources: handle overflow when aligning start of available area resources: ensure callback doesn't allocate outside available space resources: factor out resource_clip() to simplify find_resource() resources: add a default alignf to simplify find_resource() x86/PCI: MMCONFIG: fix region end calculation PCI: Add support for polling PME state on suspended legacy PCI devices PCI: Export some PCI PM functionality PCI: fix message typo PCI: log vendor/device ID always PCI: update Intel chipset names and defines PCI: use new ccflags variable in Makefile PCI: add PCI_MSIX_TABLE/PBA defines PCI: add PCI vendor id for STmicroelectronics x86/PCI: irq and pci_ids patch for Intel Patsburg DeviceIDs PCI: OLPC: Only enable PCI configuration type override on XO-1 ...
| * | | | PCI: update Intel chipset names and definesSeth Heasley2010-10-172-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch updates the defines for Intel devices in include/linux/pci_ids.h, referenced in arch/x86/pci/irq.c and drivers/i2c/busses/i2c-i801.c, reflecting approved legal branding, and using fuller code-names for products under development. Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Seth Heasley <seth.heasley@intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
* | | | | NULL-terminate all pci_device_id tablesDzianis Kahanovich2010-10-271-1/+2
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | NULL-terminating pci_device_id in pch_dma.c and scx200_acb.c for appying MODULE_DEVICE_TABLE (to publish modalias-es). Signed-off-by: Dzianis Kahanovich <mahatma@eu.by> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* | | | Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6Linus Torvalds2010-10-252-12/+15
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (110 commits) sh: i2c-sh7760: Replase from ctrl_* to __raw_* sh: clkfwk: Shuffle around to match the intc split up. sh: clkfwk: modify for_each_frequency end condition sh: fix clk_get() error handling sh: clkfwk: Fix fault in frequency iterator. sh: clkfwk: Add a helper for rate rounding by divisor ranges. sh: clkfwk: Abstract rate rounding helper. sh: clkfwk: support clock remapping. sh: pci: Convert to upper/lower_32_bits() helpers. sh: mach-sdk7786: Add support for the FPGA SRAM. sh: Provide a generic SRAM pool for tiny memories. sh: pci: Support secondary FPGA-driven PCIe clocks on SDK7786. sh: pci: Support slot 4 routing on SDK7786. sh: Fix up PMB locking. sh: mach-sdk7786: Add support for fpga gpios. sh: use pr_fmt for clock framework, too. sh: remove name and id from struct clk sh: free-without-alloc fix for sh_mobile_lcdcfb sh: perf: Set up perf_max_events. sh: perf: Support SH-X3 hardware counters. ... Fix up trivial conflicts (perf_max_events got removed) in arch/sh/kernel/perf_event.c
| * | | sh: i2c-sh7760: Replase from ctrl_* to __raw_*Nobuhiro Iwamatsu2010-10-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ctrl_* is deprecated. We should to use __raw_*. Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
| * | | Merge branch 'master' of ↵Paul Mundt2010-08-1617-207/+1804
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: arch/sh/include/asm/Kbuild drivers/Makefile Signed-off-by: Paul Mundt <lethal@linux-sh.org>
| * | | | i2c: i2c-sh_mobile irq rollback fixMagnus Damm2010-08-041-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the i2c-sh_mobile driver to properly free interrupts. The function sh_mobile_i2c_hook_irqs() is fixed so module both unload and load are working as expected. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* | | | | i2c-viapro: Don't log nacksJean Delvare2010-10-241-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transactions not acked can happen every now and then, in particular during device detection, and various transaction types can be used for this purpose. So stop logging this event, except when debugging is enabled. This is what other similar drivers (e.g. i2c-i801 or i2c-piix4) do. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* | | | | i2c/pca954x: Remove __devinit and __devexit from probe and remove functionsGuenter Roeck2010-10-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The underlying I2C adapter may or may not be present when this driver gets initialized, and may disappear later, so there is no safe time at which the probe and remove functions can be discarded. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* | | | | i2c/mux: Driver for PCA9541 I2C Master SelectorGuenter Roeck2010-10-243-0/+422
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for PCA9541, an I2C Bus Master Selector. The driver is modeled as single channel I2C Multiplexer to be able to utilize the I2C multiplexer framework. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Tom Grennan <tom.grennan@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
* | | | | i2c: Optimize function i2c_detect()Jean Delvare2010-10-241-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check the class flags before allocating the temporary i2c_client structure, to avoid allocating it when we don't need it. Also optimize the inner loop a bit. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
* | | | | i2c: Discard warning message on device instantiation from user-spaceJean Delvare2010-10-241-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "new_device" sysfs interface has been there for quite some time now, nobody complained about it so it must be good enough. Time to remove the warning and call it stable. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Michael Lawnick <ml.lawnick@gmx.de>
* | | | | i2c-amd8111: Add proper error handlingJulia Lawall2010-10-241-50/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The functions the functions amd_ec_wait_write and amd_ec_wait_read have an unsigned return type, but return a negative constant to indicate an error condition. A sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @exists@ identifier f; constant C; @@ unsigned f(...) { <+... * return -C; ...+> } // </smpl> Fixing amd_ec_wait_write and amd_ec_wait_read leads to the need to adjust the return type of the functions amd_ec_write and amd_ec_read, which are the only functions that call amd_ec_wait_write and amd_ec_wait_read. amd_ec_write and amd_ec_read, in turn, are only called from within the function amd8111_access, which already returns a signed typed value. Each of the calls to amd_ec_write and amd_ec_read are updated using the following semantic patch: // <smpl> @@ @@ + status = amd_ec_write - amd_ec_write (...); + if (status) return status; @@ @@ + status = amd_ec_read - amd_ec_read (...); + if (status) return status; // </smpl> The patch also adds the declaration of the status variable. Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* | | | | i2c: Change to new flag variablematt mooney2010-10-244-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace EXTRA_CFLAGS with ccflags-y. Signed-off-by: matt mooney <mfm@muteddisk.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* | | | | i2c: Remove unneeded inclusions of <linux/i2c-id.h>Jean Delvare2010-10-244-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These drivers don't use anything which is defined in <linux/i2c-id.h>. This header file was never meant to be included directly anyway, and will be deleted soon. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Ben Dooks <ben-linux@fluff.org> Acked-by: Dave Airlie <airlied@linux.ie> Cc: Hans Verkuil <hverkuil@xs4all.nl>
* | | | | i2c: Let i2c_parent_is_i2c_adapter return the parent adapterJean Delvare2010-10-242-19/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the calling site's code clearer IMHO. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Michael Lawnick <ml.lawnick@gmx.de>
* | | | | i2c-pca-platform: Change device name of request_irqNobuhiro Iwamatsu2010-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | i2c->adap.name shouldn't be used in request_irq. Instead the driver name "i2c-pca-platform" should be used. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Cc: stable@kernel.org Signed-off-by: Jean Delvare <khali@linux-fr.org>
* | | | | i2c: Fix Kconfig dependenciesJean Delvare2010-10-242-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drivers/i2c/algos/Kconfig makes all the algorithms dependent on !I2C_HELPER_AUTO, which triggers a Kconfig warning about broken dependencies when some driver selects one of the algorithms. Ideally we would make only the prompts dependent on !I2C_HELPER_AUTO, however Kconfig doesn't currently support that. So we have to redefine the symbols separately for the I2C_HELPER_AUTO=y case. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Michal Marek <mmarek@suse.cz>
* | | | | Merge branch 'next' of ↵Linus Torvalds2010-10-211-1/+1
|\ \ \ \ \ | |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (71 commits) powerpc/44x: Update ppc44x_defconfig powerpc/watchdog: Make default timeout for Book-E watchdog a Kconfig option fsl_rio: Add comments for sRIO registers. powerpc/fsl-booke: Add e55xx (64-bit) smp defconfig powerpc/fsl-booke: Add p5020 DS board support powerpc/fsl-booke64: Use TLB CAMs to cover linear mapping on FSL 64-bit chips powerpc/fsl-booke: Add support for FSL Arch v1.0 MMU in setup_page_sizes powerpc/fsl-booke: Add support for FSL 64-bit e5500 core powerpc/85xx: add cache-sram support powerpc/85xx: add ngPIXIS FPGA device tree node to the P1022DS board powerpc: Fix compile error with paca code on ppc64e powerpc/fsl-booke: Add p3041 DS board support oprofile/fsl emb: Don't set MSR[PMM] until after clearing the interrupt. powerpc/fsl-booke: Add PCI device ids for P2040/P3041/P5010/P5020 QoirQ chips powerpc/mpc8xxx_gpio: Add support for 'qoriq-gpio' controllers powerpc/fsl_booke: Add support to boot from core other than 0 powerpc/p1022: Add probing for individual DMA channels powerpc/fsl_soc: Search all global-utilities nodes for rstccr powerpc: Fix invalid page flags in create TLB CAM path for PTE_64BIT powerpc/mpc83xx: Support for MPC8308 P1M board ... Fix up conflict with the generic irq_work changes in arch/powerpc/kernel/time.c
| * | | | i2c/i2c-pasemi.c: Fix unsigned return typeJulia Lawall2010-10-131-1/+1
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function has an unsigned return type, but returns a negative constant to indicate an error condition. The result of calling the function is always stored in a variable of type (signed) int, and thus unsigned can be dropped from the return type. A sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @exists@ identifier f; constant C; @@ unsigned f(...) { <+... * return -C; ...+> } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | | | i2c-imx: do not allow interruptions when waiting for I2C to completeMarc Kleine-Budde2010-10-181-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The i2c_imx_trx_complete() function is using wait_event_interruptible_timeout() to wait for the I2C controller to signal that it has completed an I2C bus operation. If the process that causes the I2C operation receives a signal, the wait will be interrupted, returning an error. It is better to let the I2C operation finished before handling the signal (i.e. returning into userspace). It is safe to use wait_event_timeout() instead, because the timeout will allow the process to exit if the I2C bus hangs. It's also better to allow the I2C operation to finish, because unacknowledged I2C operations can cause the I2C bus to hang. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* | | | i2c-davinci: Fix TX setup for more SoCsJon Povey2010-10-181-9/+15
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is an improvement to 4bba0fd8d1c6d405df666e2573e1a1f917098be0 which got to mainline a little early. Sudhakar Rajashekhara explains that at least OMAP-L138 requires MDR mode settings before DXR for correct behaviour, so load MDR first with STT cleared and later load again with STT set. Tested on DM355 connected to Techwell TW2836 and Wolfson WM8985 Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk> Acked-by: Troy Kisky <troy.kisky@boundarydevices.com> Tested-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com> Acked-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* | | Merge branch 'i2c-for-linus' of ↵Linus Torvalds2010-10-076-38/+48
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging * 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: of/i2c: Fix module load order issue caused by of_i2c.c i2c: Fix checks which cause legacy suspend to never get called i2c-pca: Fix waitforcompletion() return value i2c: Fix for suspend/resume issue i2c: Remove obsolete cleanup for clientdata
| * | | of/i2c: Fix module load order issue caused by of_i2c.cGrant Likely2010-09-304-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 959e85f7, "i2c: add OF-style registration and binding" caused a module dependency loop where of_i2c.c calls functions in i2c-core, and i2c-core calls of_i2c_register_devices() in of_i2c. This means that when i2c support is built as a module when CONFIG_OF is set, then neither i2c_core nor of_i2c are able to be loaded. This patch fixes the problem by moving the of_i2c_register_devices() calls back into the device drivers. Device drivers already specifically request the core code to parse the device tree for devices anyway by setting the of_node pointer, so it isn't a big deal to also call the registration function. The drivers just become slightly more verbose. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Jean Delvare <khali@linux-fr.org>
| * | | i2c: Fix checks which cause legacy suspend to never get calledRajendra Nayak2010-09-301-20/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For devices which are not adapted to runtime PM a call to pm_runtime_suspended always returns true. Hence the pm_runtime_suspended checks below prevent legacy suspend from getting called. So do a pm_runtime_suspended check only for devices with a dev_pm_ops populated (which hence do not rely on the legacy suspend.) Signed-off-by: Rajendra Nayak <rnayak@ti.com> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Ben Dooks <ben-linux@fluff.org> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
| * | | i2c-pca: Fix waitforcompletion() return valueYegor Yefremov2010-09-302-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ret is still -1, if during the polling read_byte() returns at once with I2C_PCA_CON_SI set. So ret > 0 would lead *_waitforcompletion() to return 0, in spite of the proper behavior. The routine was rewritten, so that ret has always a proper value, before returning. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de> Cc: stable@kernel.org Signed-off-by: Jean Delvare <khali@linux-fr.org>
| * | | i2c: Fix for suspend/resume issueVishwanath BS2010-09-301-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In current i2c core driver, call to pm_runtime_set_active from i2c_device_pm_resume will unconditionally enable i2c module and increment child count of the parent. Because of this, in CPU Idle path, i2c does not idle, preventing Core to enter retention. Also i2c module will not be suspended upon system suspend as pm_runtime_set_suspended is not called from i2c_device_pm_suspend. This issue is fixed by removing pm_runtime_set_active call from resume path which is not necessary. This fix has been tested on OMAP4430. Signed-off-by: Partha Basak <p-basak2@ti.com> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Kevin Hilman <khilman@deeprootsystems.com> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* | | | i2c-s3c2410: fix calculation of SDA line delayMyungJoo Ham2010-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | S3C2440 style I2C controller uses PCLK to calculate the SDA line delay. The driver wrongly assumed that this delay is calculated from the frequency that the controller is operating on. This patch fixes this issue. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* | | | i2c-davinci: Fix race when setting up for TXJon Povey2010-09-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When setting up to transmit, a race exists between the ISR and i2c_davinci_xfer_msg() trying to load the first byte and adjust counters. This is mostly visible for transmits > 1 byte long. The hardware starts sending immediately that MDR is loaded. IMR trickery doesn't work because if we start sending, finish the first byte and an XRDY event occurs before we load IMR to unmask it, we never get an interrupt, and we timeout. Move the MDR load after DXR,IMR loads to avoid this race without locking. Tested on DM355 connected to Techwell TW2836 and Wolfson WM8985 Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* | | | i2c-octeon: Return -ETIMEDOUT in octeon_i2c_wait() on timeoutBernhard Walle2010-09-271-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | It doesn't make sense to set result to -ETIMEDOUT but return 0 (success) afterwards. Since there's code in octeon_i2c_start() to handle the error, it should be called. Signed-off-by: Bernhard Walle <walle@corscience.de> Acked-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* | | i2c-omap: Make sure i2c bus is free before setting it to idleMathias Nyman2010-09-221-0/+2
| |/ |/| | | | | | | | | | | | | | | | | | | | | If the i2c bus receives an interrupt with both BB (bus busy) and ARDY (register access ready) statuses set during the tranfer of the last message the bus was put to idle while still busy. This caused bus to timeout. Signed-off-by: Mathias Nyman <mathias.nyman@nokia.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* | Merge branch 'for-linus/i2c-2636' of git://git.fluff.org/bjdooks/linuxLinus Torvalds2010-08-145-66/+971
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-linus/i2c-2636' of git://git.fluff.org/bjdooks/linux: i2c/nuc900: add i2c driver support for nuc900 i2c: Enable NXP LPC support in Kconfig i2c-pxa: fix compiler warning, due to missing const i2c: davinci: bus recovery procedure to clear the bus i2c: davinci: Add cpufreq support i2c: davinci: Add suspend/resume support i2c: davinci: Add helper functions for power management i2c: davinci: misc. cleanups: remove MOD_REG_BIT and IO_ADDRESS usage i2c: davinci: Fix smbus Oops with AIC33 usage
| * \ Merge branch 'for-2636/i2c/nuc' into next-i2cBen Dooks2010-08-113-0/+717
| |\ \
| | * | i2c/nuc900: add i2c driver support for nuc900Wan ZongShun2010-08-113-0/+717
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is to add i2c driver support for nuc900. Signed-off-by: Wan ZongShun <mcuos.com@gmail.org> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Reviewed-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
| * | | Merge branch 'for-2636/i2c/nxp' into next-i2cBen Dooks2010-08-111-2/+2
| |\ \ \
OpenPOWER on IntegriCloud