Use drivers/gpio/pca9539.c instead.
Signed-off-by: eric miao <eric.miao@marvell.com>
Acked-by: Ben Gardner <bgardner@wabtec.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Philipp Zabel <philipp.zabel@gmail.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This patch converts users of pci_enable_device_bars() to the new
pci_enable_device_{io,mem} interface.
The new API fits nicely, except maybe for the QLA case where a bit of
code re-organization might be a good idea but I prefer sticking to the
simple patch as I don't have hardware to test on.
I'll also need some feedback on the cs5520 change.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* orion: (26 commits)
[ARM] Orion: implement power-off method for QNAP TS-109/209
[ARM] Orion: add support for QNAP TS-109/TS-209
[ARM] Orion: I2C support
[I2C] i2c-mv64xxx: Don't set i2c_adapter.retries
[I2C] Split mv643xx I2C platform support
[ARM] Orion: enable CONFIG_RTC_DRV_M41T80 for D-Link DNS-323
[ARM] Orion defconfig
[ARM] Orion: add support for Orion/MV88F5181 based D-Link DNS-323
[ARM] Orion: MV88F5181 support bits
[ARM] Orion: Buffalo/Revogear Kurobox Pro support
[ARM] OrionNAS RD board support
[ARM] Orion: support for Marvell Orion-2 (88F5281) Development Board
[ARM] Orion: common platform setup for Gigabit Ethernet port
[ARM] Orion: platform device registration for UART, USB and NAND
[ARM] Orion: system timer support
[ARM] Orion edge GPIO IRQ support
[ARM] Orion: IRQ support
[ARM] Orion: provide GPIO method for enabling hardware assisted blinking
[ARM] Orion: GPIO support
[ARM] Orion: programable address map support
...
Conflicts:
arch/arm/Kconfig
arch/arm/Makefile
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
All the users of this driver explicitly specify the I2C bus numbers
to be used in their platform data. Make the driver respect that.
Signed-off-by: Kalle Pokki <kalle.pokki@eke.fi>
Cc: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Convert the i2c-au1550 bus driver to platform driver, and
register a platform device for the Alchemy Db/Pb series of
boards.
Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Zero-bytes transfers would leave the bus transaction unfinished
(no i2c stop is sent), with the following transfer actually
sending the slave address to the previously addressed device,
resulting in weird device failures (e.g. reset minute register
values in my RTC).
This patch instructs the controller to send an I2C STOP right after
the slave address in case of a zero-byte transfer.
Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Propagate the error values returned by i2c_wait() instead of overriding
them with a meaningless -1.
Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This adds a i2c_new_dummy() primitive to help work with devices
that consume multiple addresses, which include many I2C eeproms
and at least one RTC.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
It is no longer required to hold adapter->clist_lock to call
i2c_check_addr.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>
This goes on top of the patch removing most i2c_adapter.clients usage,
updating i2c_attach_client:
- Don't call device_register() while holding clist_lock. This
removes a self-deadlock when on the i2c_driver.probe() path,
for drivers that need to attach new devices (e.g. dummies).
- Remove a redundant address check. The driver model core does
this as a consequence of guaranteeing unique names.
- Move the "device registered" diagnostic so that it never lies;
previously, on error paths it would falsely report success.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The i2c_adapter.clients list of i2c_client nodes duplicates driver
model state. This patch starts removing that list, letting us remove
most existing users of those i2c-core lists.
* The core I2C code now iterates over the driver model's list instead
of the i2c-internal one in some places where it's safe:
- Passing a command/ioctl to each client, a mechanims
used almost exclusively by DVB adapters;
- Device address checking, in both i2c-core and i2c-dev.
* Provide i2c_verify_client() to use with driver model iterators.
* Flag the relevant i2c_adapter and i2c_client fields as deprecated,
to help prevent new users from appearing.
For the moment the list needs to stick around, since some issues show
up when deleting devices created by legacy I2C drivers. (They don't
follow standard driver model rules. Removing those devices can cause
self-deadlocks.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Add support for another variant of the VT8237. I couldn't test
I2C block support but I assume it is present as well.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Checking the PCI function number doesn't add any value, and it makes
adding dynamic IDs to the driver more difficult. Drop this check.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The i2c-amd756 and i2c-viapro drivers make use of the driver_data
field of the PCI device ID. When adding device IDs dynamically (by
writing to the new_id sysfs file) you cannot set the value of this
field by default. It has to be allowed explicitly. Do that, and
check the value so that the user can't crash the kernel accidentally.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Add polling I2C transfer implementation for PXA I2C. This is needed
for cases where I2C transactions have to occur at times interrups are
disabled.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: eric miao <eric.miao@marvell.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Allow i2c_transfer to be called in contexts where sleeping is not allowed.
It is the reponsability of the caller to ensure that the underlying i2c bus
driver will not sleep either.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The implementation is unsafe, and anyway one can achieve the same from
userspace using i2c-dev + i2cdetect.
Also tag i2c_sibyte_add_bus __init.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
I2C block read is supported since the ICH5. I couldn't get it to work
using the block buffer, so it's using the old-style byte-by-byte mode
for now.
Note: I'm also updating the driver author... The i2c-i801 driver was
really written by Mark Studebaker, even though he based his work on
the i2c-piix4 driver which was written by Philip Edelbrock.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Clear special mode bits (PEC, block buffer) at driver load time,
you never know in which state the device was left by its last user.
Also make sure that we reset the block buffer mode at the end of every
transaction, not only when PEC was used.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Provide a clearer documentation of which additional features each
ICH chip support, and which of these the driver supports.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Move the tps65010 header file from the OMAP arch directory to the
more generic <linux/i2c/...> directory, and remove the spurious
dependency of this driver on OMAP.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Rename the main mutex in i2c-core from core_lists to core_lock. This
makes more sense now that the redundant lists are gone.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
i2c_driver.list is superfluous, this list duplicates the one
maintained by the driver core. Drop it.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
i2c_adapter.list is superfluous, this list duplicates the one
maintained by the driver core. Drop it.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Use more standard prototypes for i2c_use_client() and
i2c_release_client(). The former now returns a pointer to the client,
and the latter no longer returns anything. This matches what all other
subsystems do.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>
Don't implement our own reference counting mechanism for i2c clients
when the driver model already has one.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>
The framebuffer drivers for these pieces of hardware include support
for the DDC/I2C buses, so there is no need for separate drivers.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
I2C adapter drivers are supposed to handle retries on nack by themselves
if they do, so there's no point in setting .retries if they don't.
As this retry mechanism is going away (at least in its current form),
clean this up now so that we don't get build failures later.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This patch allows much of the I2C client address data to move from initdata
into text.
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The 10-bit address support in i2c-algo-pcf is so heavily broken that
it can't have ever been used. Nobody ever complained, so I'll take it
that nobody needs it. Let's just delete it.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Update comments and logging on return path for byte writes. NAK is
an error, to be reported or optionally ignored. Timeouts are always
errors. Lost arbitration is not currently handled, so don't even list
it as an option in the error message.
Don't return bogus EFAULT code for inappropriate NAK; EIO is better,
there is no bad userspace address in question.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Fix *LOTS* of whitespace goofs and checkpatch.pl warnings, strangely
parenthesized ternary expressions, and other CodingStyle glitches.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
remove #ifdef CONFIG_PXA27x .. #endif and use cpu_is_pxaXXXX() macros
so that a single binary can support PXA25x/PXA27x/PXA3xx at run-time.
Signed-off-by: eric miao <eric.miao@marvell.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This patch contains the overdue removal of three I2C drivers.
[JD: In fact only i2c-ixp4xx can be removed at the moment, the other two
platforms don't implement the generic GPIO layer yet.]
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This patch contains the scheduled removal of legacy I2C RTC drivers with
replacement drivers.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Use numbered adapter registration to always have the same hardware bus
show up at the same number.
PWRficient 1682M has three buses, they are all on the same PCI device but
different functions. So do the simple thing and register them based on
function number. Future products, if having a different number of busses,
are expected to have similar behaviour w.r.t. device/function layout.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
My guess is that all the chips supported by this driver support block
transactions and reset, but for now we play it safe and only list the
ones for which this was actually tested.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Oleg Ryjkov <olegr@olegr.ca>
I2C adapter drivers are supposed to handle retries on nack by themselves
if they do, so there's no point in setting .retries if they don't.
As this retry mechanism is going away (at least in its current form),
clean this up now so that we don't get build failures later.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Mark A. Greer <mgreer@mvista.com>
The motivation for this change is to allow other chips, like the
Marvell Orion ARM SoC family, to use the existing i2c-mv64xxx driver.
Signed-off-by: Tzachi Perelstein <tzachi@marvell.com>
Acked-by: Nicolas Pitre <nico@marvell.com>
Acked-by: Dale Farnsworth <dale@farnsworth.org>
Acked-by: Mark A. Greer <mgreer@mvista.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
If the registration of the second I2C channel fails, we really want to
unregister the first one before we return with an error.
While we're here, fix the printk right above so that it displays the
real driver name.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
This patch fixes bug #9581 reported by Marcio Buss. If kzalloc fails,
omap_i2c_write_reg() tries to reset an unallocated I2C controller.
Cc: Marcio Buss <marciobuss@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Build fix to the isp1301_omap driver ... this driver gets built
more often in the OMAP tree than in mainline, partly because the
defconfig for H2 (plus probably H3 and H4) needs updating.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This is required to let hwmon drivers attach to the adapter.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Recent (i.e. 2005 and later) Sony Vaio laptops have names beginning
with VGN rather than PCG. Update the eeprom driver so that it
recognizes these.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The sysfs interface to DMI data takes care to not make the system
serial number and UUID world-readable, presumably due to privacy
concerns. For consistency, we should not let the eeprom driver
export these same strings to the world on Sony Vaio laptops.
Instead, only make them readable by root, as we already do for BIOS
passwords.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Turns out we don't actually check the status to see if there was a
device out there to talk to, just if we had a timeout when doing so.
Add the proper check, so we don't falsly think there are devices
on the bus that are not there, etc.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
i2c_check_addr is only used inside i2c-core now, so we can make it
static and stop exporting it. Thanks to David Brownell for noticing.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Let i2c-dev deal properly with new-style i2c clients. Instead of
considering them always busy, it needs to check wether a driver is
bound to them or not.
This is still not completely correct, as the client could become
busy later, but the same problem already existed before new-style
clients were introduced. We'll want to fix it someday.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
This adds some "how does this work" comments to the i2c-dev driver,
plus separators between the three main components:
- The parallel list of i2c_adapters ("i2c_dev_list"), each of which
gets a "struct i2c_dev" and a /dev/i2c-X character special file.
- An i2cdev_driver gets adapter add/remove notifications, which are
used to maintain that list of adapters.
- Special file operations, which let userspace talk either directly to
the adapter (for i2c_msg operations) or through cached addressing info
using an anonymous i2c_client (never registered anywhere).
Plus there's the usual module load/unload record keeping.
After making sense of this code, I think that the anonymous i2c_client
is pretty shady. But since it's never registered, using this code with
a system set up for "new style" I2C drivers is no more complicated than
always using the I2C_SLAVE_FORCE ioctl (instead of I2C_SLAVE).
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Most of these fixes were already submitted for old kernel versions, and were
approved, but for some reason they never made it into the releases.
Because this is a consolidation of a couple old missed patches, it touches both
Kconfigs and documentation texts.
Signed-off-by: Matt LaPlante <kernel1@cyberdogtech.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
* Convert files to UTF-8.
* Also correct some people's names
(one example is Eißfeldt, which was found in a source file.
Given that the author used an ß at all in a source file
indicates that the real name has in fact a 'ß' and not an 'ss',
which is commonly used as a substitute for 'ß' when limited to
7bit.)
* Correct town names (Goettingen -> Göttingen)
* Update Eberhard Mönkeberg's address (http://lkml.org/lkml/2007/1/8/313)
Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
i2c-pxa, rename BIT macro to PXA_BIT
BIT macro will be global definiton of (1 << x)
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Nicolas Pitre <nico@cam.org>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Found these while looking at printk uses.
Add missing newlines to dev_<level> uses
Add missing KERN_<level> prefixes to multiline dev_<level>s
Fixed a wierd->weird spelling typo
Added a newline to a printk
Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Tilman Schmidt <tilman@imap.cc>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Greg KH <greg@kroah.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Cc: James Smart <James.Smart@Emulex.Com>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Other/Some pr_*() macros are already defined in kernel.h, but pr_err() was
defined multiple times in several other places
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Tony Lindgren <tony@atomide.com>
Reviewed-by: Satyam Sharma <satyam@infradead.org>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (95 commits)
[ARM] 4578/1: CM-x270: PCMCIA support
[ARM] 4577/1: ITE 8152 PCI bridge support
[ARM] 4576/1: CM-X270 machine support
[ARM] pxa: Avoid pxa_gpio_mode() in gpio_direction_{in,out}put()
[ARM] pxa: move pxa_set_mode() from pxa2xx_mainstone.c to mainstone.c
[ARM] pxa: move pxa_set_mode() from pxa2xx_lubbock.c to lubbock.c
[ARM] pxa: Make cpu_is_pxaXXX dependent on configuration symbols
[ARM] pxa: PXA3xx base support
[NET] smc91x: fix PXA DMA support code
[SERIAL] Fix console initialisation ordering
[ARM] pxa: tidy up arch/arm/mach-pxa/Makefile
[ARM] Update arch/arm/Kconfig for drivers/Kconfig changes
[ARM] 4600/1: fix kernel build failure with build-id-supporting binutils
[ARM] 4599/1: Preserve ATAG list for use with kexec (2.6.23)
[ARM] Rename consistent_sync() as dma_cache_maint()
[ARM] 4572/1: ep93xx: add cirrus logic edb9307 support
[ARM] 4596/1: S3C2412: Correct IRQs for SDI+CF and add decoding support
[ARM] 4595/1: ns9xxx: define registers as void __iomem * instead of volatile u32
[ARM] 4594/1: ns9xxx: use the new gpio functions
[ARM] 4593/1: ns9xxx: implement generic clockevents
...
This patch is to add an abort function that will bring back the MCP51/55
controller if it was blocked by a block-read operation, in particular.
(When a slave sends a wrong byte count on a byte read, the host gets
locked up). I've only tested it on an MCP51 and MCP55. However, I'm
almost certain it will also work on MCP65, I just did not have the board
to test it on. Thus for now the abort function will only be called
if an MCP51/55 was detected.
Signed-off-by: Oleg Ryjkov <olegr@olegr.ca>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This is the first part of the patch that adds a function to reset the
nvidia MCP51/55 i2c controller, if something bad happens to it (e.g.
a slave sends a wrong byte count during a block transaction).
This patch just adds nforce2_check_status function. It was originally
written by Hans-Frieder Vogt.
The reason that I'm the one sending it is:
- I relied on it for the second part of the patch,
- It makes the driver code cleaner/better.
Signed-off-by: Oleg Ryjkov <olegr@olegr.ca>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Fix a "mis-used register" problem on the AMD MIPS Alchemy au1550
I2C interface.
In summary, the programmable serial controller seems to hang the kernel
when I send a single 'address' byte on the I2C bus. The patch
essentially uses the PSC_SMBSTAT register's TE (transmit FIFO empty)
bit to check when the transmit FIFO is empty, instead of using the
PSC_SMBEVNT register's TU (transmit underflow) bit. Using the TE bit
fixed the hang problem.
Signed-off-by: Chris David <cd@chrisdavid.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Rename I2C_FUNC_SMBUS_HWPEC_CALC as I2C_FUNC_SMBUS_PEC, and list that
functionality as always available through the software implementation.
Update documentation accordingly (and list similar requirements).
The way it's currently packaged doesn't present the capability in a
useful way.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Mark the i2c-at91 driver BROKEN in Kconfig, and explain just
why it's broken. (Summary: hardware design issues.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This removes:
- An effectively unused hook: i2c_algorithm.algo_control.
- The i2c_control() call, used only by i2c-dev to call that
unused hook or set two barely supported adapter params.
(That param setting moves into i2c-dev.c ... still iffy
due to lack of locking, but no other changes.)
As shown by diffstat, this is a net code shrink. It also reduces the
complexity of the I2C adapter and /dev interfaces.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This removes NOP implementations of i2c_algorithm.algo_control.
With this change, there are no implementations of this hook in
the kernel.org tree ... that hook seems about ripe to remove.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The I2C_M_RECV_LEN calling convention for i2c_mesg.flags involves
playing games with reported buffer lengths. (They start out less
than their actual size, and the length is then modified to reflect
how many bytes were delivered ... which one hopes is less than the
presumed actual size.) Refuse to play such error prone games across
the boundary between userspace and kernel.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Add support for multiple chips to i2c-stub. I've changed the memory
allocation scheme from static to dynamic, so that we don't waste too
much memory.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Mark M. Hoffman <mhoffman@lightlink.com>
Remove this unneeded mutex. Indeed it was used to serialize access to
the hardware, but this is already done by the i2c-core layer, see
'bus_lock' mutex used by i2c_transfer().
Signed-off-by: Francis Moreau <francis.moro@gmail.com>
Acked-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Clarify use of the I2C_M_* flags by highlighting the fact that
most of them depend on I2C_FUNC_PROTOCOL_MANGLING.
Also provide kerneldoc for i2c_smbus_read_block_data() and also
for "struct i2c_msg".
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Do not initialize the PCF8574 with an arbitrary value. Users will have
to write the initial value to sysfs themselves.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Vladimir Barinov <vbarinov@ru.mvista.com>
Acked-by: Trilok Soni <soni.trilok@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Use i2c_bit_add_numbered_adapter() if device id specified, so that the
i2c-ibm_iic adapter works well with new-style pre-declared devices.
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Switch the tps65010 driver into a "new-style" I2C driver, and convert all
of its in-tree users (board support for OSK, H2, H3) accordingly.
That accounts for most of the board-specific code in this driver; the
rest of that code is now moved into board-specific initcalls.
Also remove some of the many now-superfluous #includes.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Prepare to convert tps65010 driver to "new style" driver by changing
how it references the i2c_client. This lets the eventual patch with
driver and platform updates be smaller.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
We need to be able to flag I2C devices, such as RTCs, which can issue wake
events (usually through IRQ lines). This adds an i2c_board_info.flags bit,
and uses it to initialize the i2c device node. (And shrinks a few lines
that were overly long.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This changes the uevent buffer functions to use a struct instead of a
long list of parameters. It does no longer require the caller to do the
proper buffer termination and size accounting, which is currently wrong
in some places. It fixes a known bug where parts of the uevent
environment are overwritten because of wrong index calculations.
Many thanks to Mathieu Desnoyers for finding bugs and improving the
error handling.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This fixes a bug in the way i2c-algo-bit handles I2C_M_RECV_LEN,
used to implement i2c_smbus_read_block_data(). Previously, in the
absence of PEC (rarely used!) it would NAK the "length" byte:
S addr Rd [A] [length] NA
That prevents the subsequent data bytes from being read:
S addr Rd [A] [length] { A [data] }* NA
The primary fix just reorders two code blocks, so the length used
in the "should I NAK now?" check incorporates the data which it
just read from the slave device.
However, that move also highlighted other fault handling glitches.
This fixes those by abstracting the RX path ack/nak logic, so it
can be used in more than one location. Also, a few CodingStyle
issues were also resolved.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
It turns out that platform_device.id is a "u32" so testing it for being
nonnegative is useless when setting up an i2c adapte. Instead,
do what the platform_bus code does and test it against the value "-1".
Signed-off-by: Jean Delvare <khali@linux-fr.org>
It turns out that platform_device.id is a "u32" so testing it for being
nonnegative is useless when setting up an i2c bitbang device. Instead,
do what the platform_bus code does and test it against the value "-1".
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
We find that SB700 and SB800 use the same SMBus device ID as SB600, which is
0x4385, instead of the already submitted 0x4395.
Besides removing the wrong SB700 device ID, add SB800 support to kernel, by
renaming the PCI_DEVICE_ID_ATI_IXP600_SMBUS into
PCI_DEVICE_ID_ATI_SBX00_SMBUS.
Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Fixup the include files after the arch moves that
where included in 2.6.23.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Under certain conditions, the mv64xxx I2C bus can hang preventing
further operation. To make the driver more robust, we now reset
the I2C hardware and the driver state machine when such hangs are
detected.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Acked-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Disabling module on stop doesn't work on some CPUs (ie. mpc8241,
as reported by Guennadi Liakhovetski), so remove that.
Disable I2C module on errors/interrupts to prevent it from
locking up on mpc5200b.
Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
In order to be able to use sensors on the IOP3xx SoCs, one needs to set
the adapter class to I2C_CLASS_HWMON.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Build fixes for isp1301_omap driver. I think an earlier version
of this must have gotten lost somewhere, or maybe it only went
into the Linux-OMAP tree.
Also, some whitespace fixes to bring this more into sync with the
version of this found in the Linux-OMAP tree. (That version has
updates for the OTG controller on the OMAP 1710 which break that
functionality on OMAP 161x boards like the H2, so merging all of
it is not currently an option.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>