1
0
Fork 0
Commit Graph

65 Commits (e0e8398c7a40f1fb65cefa9d35ed6cd84cee6008)

Author SHA1 Message Date
Jean Delvare e0e8398c7a i2c-i801: All newer devices have all the optional features
Only the oldest devices lack some of the features supported by this
driver. List them explicitly, and default to all features enabled for
all other chips, including the ones added through sysfs. This will
make future driver maintenance easier.

In the unlikely event of a not yet supported device not implementing
all the features, one can always use the disable_features module
parameter to prevent the driver from attempting to use them.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Seth Heasley <seth.heasley@intel.com>
2010-05-21 18:40:55 +02:00
Jean Delvare adff687d8c i2c-i801: Let the user disable selected driver features
Let the user disable selected features normally supported by the
device. This makes it possible to work around possible driver or
hardware bugs if the feature in question doesn't work as intended
for whatever reason.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Felix Rubinstein <felixru@gmail.com>
2010-05-21 18:40:54 +02:00
Jean Delvare c074c39d62 i2c-i801: Don't use the block buffer for I2C block writes
Experience has shown that the block buffer can only be used for SMBus
(not I2C) block transactions, even though the datasheet doesn't
mention this limitation.

Reported-by: Felix Rubinstein <felixru@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Oleg Ryjkov <oryjkov@gmail.com>
Cc: stable@kernel.org
2010-03-13 20:56:53 +01:00
Seth Heasley 393764340b i2c-i801: Add Intel Cougar Point device IDs
Add the Intel Cougar Point (PCH) SMBus controller device IDs.

Signed-off-by: Seth Heasley <seth.heasley@intel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-03-02 12:23:39 +01:00
Márton Németh 4111ecd217 i2c: Make PCI device ids constant
The id_table field of the struct pci_driver is constant in <linux/pci.h>
so it is worth to make initialization data also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-03-02 12:23:37 +01:00
Jean Delvare 7e2193a8f9 i2c-i801: Retry on lost arbitration
The Intel 82801 is sometimes used on systems with a BMC connected. The
BMC can access the SMBus, resulting in lost arbitration for the 82801.
We should let i2c-core retry transactions for us in this case.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-12-06 17:06:27 +01:00
Jean Delvare 18669eabde i2c: Hide probe errors caused by ACPI resource conflicts
When an ACPI resource conflict is detected, error messages are already
printed by ACPI. There's no point in causing the driver core to print
more error messages, so return one of the error codes for which no
message is printed.

This fixes bug #14293:
http://bugzilla.kernel.org/show_bug.cgi?id=14293

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-10-04 22:53:45 +02:00
Roel Kluin 4ccc28f725 i2c: Timeouts off by 1
with while (timeout++ < MAX_TIMEOUT); timeout reaches MAX_TIMEOUT + 1
after the loop, so the tests below are off by one.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-05-05 08:39:24 +02:00
Hans de Goede fa5bfab712 i2c-i801: Instantiate FSC hardware montioring chips
Detect various FSC hwmon IC's based on DMI tables and then let
the i2c-i801 driver instantiate the i2c client devices. Note that
some of the info in the added table is indentical for all rows, still
this is kept in the table to keep the code general and thus (hopefully)
easily extensible in the future.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-03-30 21:46:44 +02:00
Jean Delvare 1745522ccb i2c: Delete many unused adapter IDs
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2009-01-26 21:19:52 +01:00
Jean Delvare 1561bfe59c Input: apanel - convert to new i2c binding
Convert the apanel driver to the new i2c device driver binding model,
as the legacy model is going away soon. In the new model, the apanel
driver is no longer scanning all the i2c adapters, instead the
relevant bus driver (i2c-i801) is instantiating the device as needed.

One side benefit is that the apanel driver will now load automatically
on all systems where it is needed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
2009-01-07 14:29:17 +01:00
Seth Heasley c429a247f5 i2c-i801: Add support for Intel Ibex Peak
Adds the Intel Ibex Peak (PCH) SMBus Controller Device IDs.

Signed-off-by: Seth Heasley <seth.heasley@intel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-10-22 20:21:29 +02:00
Jean Delvare 954a99307f i2c: Drop stray references to lm_sensors
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:34 +02:00
Jean Delvare 54fb4a05af i2c: Check for ACPI resource conflicts
Check for ACPI resource conflicts in i2c bus drivers. I've included
all recent SMBus master drivers for PC hardware.

I've voluntarily left out:
* Drivers that don't run on PCs: they can't conflict with ACPI.
* Bit-banged bus device drivers: it's very unlikely that ACPI would
  deal with such buses.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
2008-07-14 22:38:33 +02:00
Jean Delvare cf898dc5e9 i2c-i801: Fix handling of error conditions
Move the check of pre-transaction and post-transaction conditions to
separate functions, and adjust them a bit. Having dedicated functions
for that ensures that errors are handled in a consistent way.

Bit HOST_BUSY of the status register is read-only, so writing to it is
certainly not going to clear it. If this bit is set then we simply
don't want to start the transaction, as it means that somebody else
(ACPI, SMM?) is already using the controller.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:33 +02:00
Jean Delvare 2b73809d06 i2c-i801: Rename local variable temp to status
"temp" isn't a terribly well chosen name for a local variable.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:32 +02:00
Jean Delvare dcb5c9239d i2c-i801: Properly report bus arbitration loss
Bit BUS_ERR of the status register means that the ICH host controller
lost the arbitration. Report this event as such.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:32 +02:00
Jean Delvare 90df2cb1c8 i2c-i801: Remove verbose debugging messages
Dumping the register values before and after every transaction was
useful during driver development but now it's only spamming the log.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:32 +02:00
Jean Delvare 3401b2fff3 i2c: Let bus drivers add SPD to their class
Let general purpose I2C/SMBus bus drivers add SPD to their class. Once
this is done, we will be able to tell the eeprom driver to only probe
for SPD EEPROMs and similar on these buses.

Note that I took a conservative approach here, adding I2C_CLASS_SPD to
many drivers that have no idea whether they can host SPD EEPROMs or not.
This is to make sure that the eeprom driver doesn't stop probing buses
where SPD EEPROMs or equivalent live.

So, bus driver maintainers and users should feel free to remove the SPD
class from drivers those buses never have SPD EEPROMs or they don't
want the eeprom driver to bind to them. Likewise, feel free to add the
SPD class to any bus driver I might have missed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:29 +02:00
Jean Delvare ac7fc4fb2b i2c: Consistently reject unsupported transactions
Many PC SMBus host controller drivers don't properly handle the case
where they are requested to achieve a transaction they do not support.
Update them so that the consistently print a warning message and
return a single error value in this case.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:25 +02:00
David Brownell 97140342e6 i2c: Bus drivers return -Errno not -1
Tighten error paths used by various i2c adapters (mostly x86) so
they return real fault/errno codes instead of a "-1" (which is
most often interpreted as "-EPERM").  Build tested, with eyeball
review.

One minor initial goal is to have adapters consistently return
the code "-ENXIO" when addressing a device doesn't get an ACK
response, at least in the probe paths where they are already
good at stifling related logspam.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-07-14 22:38:25 +02:00
Gaston, Jason D d28dc71121 i2c-i801: Add support for the ICH10
Add the Intel ICH10 SMBus Controller DeviceID's and updates
Tolapai support.

Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-02-24 20:03:42 +01:00
Jean Delvare 6342064cad i2c-i801: Implement I2C block read support
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>
2008-01-27 18:14:50 +01:00
Jean Delvare a0921b6c07 i2c-i801: Clear special mode bits as needed
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>
2008-01-27 18:14:50 +01:00
Jean Delvare 369f6f4aec i2c-i801: More explicit names for chip features
Use separate flags with explicit names to describe the features of
the ICH chip.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-01-27 18:14:50 +01:00
Jean Delvare ae7b0497b8 i2c-i801: Document which chip support what feature
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>
2008-01-27 18:14:49 +01:00
David Brownell 6662cbb989 i2c: Rename the PEC functionality bit
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>
2007-10-13 23:56:33 +02:00
Jason Gaston e07bc679fb i2c-i801: Add support for the Intel Tolapai SMBus
Add the Intel Tolapai SMBus Controller DID.

Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-10-13 23:56:31 +02:00
Jean Delvare 002cf63191 i2c-i801: Typo: erroneous
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-08-14 18:37:13 +02:00
Oleg Ryjkov 7edcb9abb5 i2c-i801: Use the internal 32-byte buffer on ICH4+
Add an ability to utilize the internal SRAM buffer on ICH4
and newer host controllers to speed up execution of block operations.

I've split the code so that it is more clear which block transaction is
performed.

First of all the host controller's type is identified. isich4 is set when
we think that the controller has the internal buffer. Then, before every
block transaction, if isich4 is set, we attempt to enable the E32B bit in
SMBAUXCTL register.

Signed-off-by: Oleg Ryjkov <olegr@google.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-07-12 14:12:31 +02:00
Oleg Ryjkov ca8b9e32a1 i2c-i801: Various cleanups
* Use defines instead of raw numbers for register bits
* Fix several wrong indentations and trailing whitespace
* Move hwpec timeout checking to a separate function

Signed-off-by: Oleg Ryjkov <olegr@google.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-07-12 14:12:31 +02:00
David Brownell 2096b956d2 i2c: Shrink struct i2c_client
This shrinks the size of "struct i2c_client" by 40 bytes:

 - Substantially shrinks the string used to identify the chip type
 - The "flags" don't need to be so big
 - Removes some internal padding

It also adds kerneldoc for that struct, explaining how "name" is really a
chip type identifier; it's otherwise potentially confusing.

Because the I2C_NAME_SIZE symbol was abused for both i2c_client.name
and for i2c_adapter.name, this needed to affect i2c_adapter too.  The
adapters which used that symbol now use the more-obviously-correct
idiom of taking the size of that field.

JD: Shorten i2c_adapter.name from 50 to 48 bytes while we're here, to
avoid wasting space in padding.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-05-01 23:26:28 +02:00
Jean Delvare a5aaea3785 i2c-i801: Restore the device state before leaving
Restore the original host configuration on driver unload and on
suspend. In particular this returns the SMBus master in I2C mode if it
was originally in I2C mode, which should help with suspend/resume if
the BIOS expects to find the SMBus master in I2C mode.

This fixes bug #6449 (for real this time.)
http://bugzilla.kernel.org/show_bug.cgi?id=6449

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Tommi Kyntola <tommi.kyntola@ray.fi>
2007-03-22 19:49:01 +01:00
Robert P. J. Day 405ae7d381 Replace remaining references to "driverfs" with "sysfs".
Globally, s/driverfs/sysfs/g.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2007-02-17 19:13:42 +01:00
Tim Schmielau cd354f1ae7 [PATCH] remove many unneeded #includes of sched.h
After Al Viro (finally) succeeded in removing the sched.h #include in module.h
recently, it makes sense again to remove other superfluous sched.h includes.
There are quite a lot of files which include it but don't actually need
anything defined in there.  Presumably these includes were once needed for
macros that used to live in sched.h, but moved to other header files in the
course of cleaning it up.

To ease the pain, this time I did not fiddle with any header files and only
removed #includes from .c-files, which tend to cause less trouble.

Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
configs in arch/arm/configs on arm.  I also checked that no new warnings were
introduced by the patch (actually, some warnings are removed that were emitted
by unnecessarily included header files).

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-14 08:09:54 -08:00
Stephen Hemminger 9ace555d7d i2c: Add IDs to adapters
IDs have been defined but not used by most of the I2C adapters.
By having a unique ID, clients can check for correct connection
during probe.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:09:01 +01:00
Jean Delvare fcdd96ecaf i2c-i801: Spelling fix
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2007-02-13 22:08:59 +01:00
Jean Delvare 250d1bd3f4 i2c: Enable PEC on more i2c-i801 devices
Enable PEC on recent Intel SMBus controllers (ICH6, ICH7, ICH8, ICH9
and ESB2.)

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jason Gaston <jason.d.gaston@intel.com>
2006-12-10 21:21:33 +01:00
Jason Gaston adbc2a1022 i2c-i801: SMBus patch for Intel ICH9
This updated patch adds the Intel ICH9 LPC and SMBus Controller DID's.  Thi=
s patch relies on the irq ICH9 patch to pci_ids.h.

Signed-off-by: Jason Gaston <jason.d.gaston@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-01 14:36:59 -08:00
Jean Delvare 8f9082c5ce i2c: Constify i2c_algorithm declarations, part 2
i2c: Constify i2c_algorithm declarations, part 2

Make struct i2c_algorithm declarations const in all i2c bus drivers
where it is possible.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-26 15:38:52 -07:00
Andrew Morton 598736c556 [PATCH] i2c-801: 64bit resource fix
drivers/i2c/busses/i2c-i801.c: In function 'i801_probe':
drivers/i2c/busses/i2c-i801.c:496: warning: format '%lx' expects type 'long unsigned int', but argument 5 has type 'resource_size_t'

Cc: Greg KH <greg@kroah.com>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-30 11:25:41 -07:00
Daniel Ritz d6fcb3b9cf [PATCH] i2c-i801.c: don't pci_disable_device() after it was just enabled
Commit 02dd7ae289 ("[PATCH] i2c-i801:
Merge setup function") has a missing return 0 in the _probe() function.
This means the error path is always executed and pci_disable_device() is
called even when the device just got successfully enabled.

Having the SMBus device disabled makes some systems (eg.
Fujitsu-Siemens Lifebook E8010) hang hard during power-off.

Intead of reverting the whole commit this patch fixes it up:
- don't ever call pci_disable_device(), also not in the _remove() function
  to avoid hangs
- fix missing pci_release_region() in error path

Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-27 18:36:39 -07:00
Jean Delvare 02dd7ae289 [PATCH] i2c-i801: Merge setup function
i2c-i801: Merge setup function

Merge i801_setup into i801_probe, as it doesn't make much sense to
have them split. This lets us handle errors better. Christopher
Hellwig had been suggesting this back in March 2003 when the driver
was merged.

Also drop two useless debug messages (revision and base address can be
obtained from lspci, procfs or sysfs.)

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-22 11:10:35 -07:00
Jean Delvare 6dcc19dfbc [PATCH] i2c-i801: Better pci subsystem integration
i2c-i801: Better pci subsystem integration

Integrate the i2c-i801 driver better with the pci subsystem, by
calling pci_{enable,disable}_device and requesting the I/O region
by BAR rather than direct configuration space access.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-22 11:10:35 -07:00
Jean Delvare 455f332323 [PATCH] i2c-i801: Cleanups
i2c-i801: Cleanups

Various cleanups to the i2c-i801 driver:
* Fix documentation file and self file name references.
* i801_setup can be marked __devinit.
* Drop useless error local variable and label in i801_setup.
* Avoid a double PCI configuration register write in some cases.
* Use symbolic names for SMBHSTCFG bits.
* Transmit the error code returned by i801_setup instead of forcing it
  to an arbitrary value.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-22 11:10:35 -07:00
Jean Delvare 520e64d5c0 [PATCH] i2c-i801: Remove PCI function check
i2c-i801: Remove PCI function check

Remove the PCI function number check when probing devices.
This check is redundant, each function has a separate PCI device
ID, so checking for that ID is sufficient.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-22 11:10:35 -07:00
Jean Delvare d8db8f9856 [PATCH] i2c-i801: Remove force_addr parameter
i2c-i801: Remove force_addr parameter

Remove the force_addr module parameter. It doesn't appear to ever
have been needed, and PCI resources shouldn't be arbitrarily
changed anyway.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-22 11:10:35 -07:00
Jean Delvare 397e2f66a2 [PATCH] i2c-i801: Fix block transaction poll loops
i2c-i801: Fix block transaction poll loops

Two of the three poll loops have the poll and sleep swapped,
causing an extra sleep to occur after the polled condition is
fulfilled. In practice, this doubles the amount of sleep time for
every block transaction.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-22 11:10:35 -07:00
Jean Delvare c79cfbacca [PATCH] i2c-i801: Fix resume when PEC is used
Fix for bug #6395:

Fail to resume on Tecra M2 with ADM1032 and Intel 82801DBM

The BIOS of the Tecra M2 doesn't like it when it has to reboot or resume
after the i2c-i801 driver has left the SMBus in PEC mode.  The most simple
fix is to clear the PEC bit after after every transaction.  That's what
this driver was doing up to 2.6.15 (inclusive).

Thanks to Daniele Gaffuri for the very good report.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-20 07:54:04 -07:00
Jason Gaston 8254fc4afc [PATCH] i2c-i801: I2C patch for Intel ICH8
This patch adds the Intel ICH8 DID to the i2c-i801.c and Kconfig files for I2C
support.

Signed-off-by: Jason Gaston <Jason.d.gaston@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-02-06 12:02:14 -08:00