History log of /linux-master/drivers/i2c/algos/i2c-algo-pca.c
Revision Date Author Comments
# 0a355aeb 08-Sep-2020 Evan Nimmo <evan.nimmo@alliedtelesis.co.nz>

i2c: algo: pca: Reapply i2c bus settings after reset

If something goes wrong (such as the SCL being stuck low) then we need
to reset the PCA chip. The issue with this is that on reset we lose all
config settings and the chip ends up in a disabled state which results
in a lock up/high CPU usage. We need to re-apply any configuration that
had previously been set and re-enable the chip.

Signed-off-by: Evan Nimmo <evan.nimmo@alliedtelesis.co.nz>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# f80531c8 11-Jun-2020 Jarkko Nikula <jarkko.nikula@linux.intel.com>

i2c: Use separate MODULE_AUTHOR() statements for multiple authors

Modules with multiple authors should use multiple MODULE_AUTHOR()
statements according to comment in include/linux/module.h.

Split the i2c modules with multiple authors to use multiple
MODULE_AUTHOR() statements.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# cd217f23 01-Jul-2020 Chris Packham <chris.packham@alliedtelesis.co.nz>

i2c: algo-pca: Add 0x78 as SCL stuck low status for PCA9665

The PCA9665 datasheet says that I2CSTA = 78h indicates that SCL is stuck
low, this differs to the PCA9564 which uses 90h for this indication.
Treat either 0x78 or 0x90 as an indication that the SCL line is stuck.

Based on looking through the PCA9564 and PCA9665 datasheets this should
be safe for both chips. The PCA9564 should not return 0x78 for any valid
state and the PCA9665 should not return 0x90.

Fixes: eff9ec95efaa ("i2c-algo-pca: Add PCA9665 support")
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# ab7cf7e5 02-May-2020 Wolfram Sang <wsa@kernel.org>

i2c: algo-pca: update contact email

The 'pengutronix' address is defunct for years. Use the proper contact
address.

Signed-off-by: Wolfram Sang <wsa@kernel.org>


# 7b8c4c0b 24-Mar-2020 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

i2c: algo: Use generic definitions for bus frequencies

Since we have generic definitions for bus frequencies, let's use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# c942fddf 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157

Based on 3 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [kishon] [vijay] [abraham]
[i] [kishon]@[ti] [com] this program is distributed in the hope that
it will be useful but without any warranty without even the implied
warranty of merchantability or fitness for a particular purpose see
the gnu general public license for more details

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [graeme] [gregory]
[gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
[kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
[hk] [hemahk]@[ti] [com] this program is distributed in the hope
that it will be useful but without any warranty without even the
implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1105 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ac6d5298 16-May-2018 Peter Rosin <peda@axentia.se>

i2c: algos: make use of i2c_8bit_addr_from_msg

Because it looks neater.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 0e6dd6a2 18-May-2015 Shailendra Verma <shailendra.capricorn@gmail.com>

i2c: algo-pca: fix typo in comment

Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# ca1f8da9 04-Nov-2014 Wolfram Sang <wsa+renesas@sang-engineering.com>

i2c: remove FSF address

We have a central copy of the GPL for that. Some addresses were already
outdated.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


# 21d0b7c0 21-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com>

i2c: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# a76e7c68 20-Sep-2012 Thomas Kavanagh <tkavanagh@juniper.net>

i2c: algo: pca: Fix chip reset function for PCA9665

The parameter passed to pca9665_reset is adap->data (which is bus driver
specific), not i2c_algp_pca_data *adap. pca9665_reset expects it to be
i2c_algp_pca_data *adap. All other wrappers from the algo call back to
the bus driver, which knows to handle its custom data. Only pca9665_reset
resides inside the algorithm code and does not know how to handle a custom
data structure. This can result in a kernel crash.

Fix by re-factoring pca_reset() from a macro to a function handling chip
specific code, and only call adap->reset_chip() if the chip is not PCA9665.

Signed-off-by: Thomas Kavanagh <tkavanagh@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>


# 5f71a3ef 13-Sep-2012 Thomas Kavanagh <tkavanagh@juniper.net>

i2c: algo: pca: Fix mode selection for PCA9665

The code currently always selects turbo mode for PCA9665, no matter which
clock frequency is configured. This is because it compares the clock frequency
against constants reflecting (boundary / 100). Compare against real boundary
frequencies to fix the problem.

Signed-off-by: Thomas Kavanagh <tkavanagh@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>


# 5694f8a8 26-Mar-2012 Jean Delvare <khali@linux-fr.org>

i2c: Update the FSF address

Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 4403988a 30-Oct-2011 Jean Delvare <khali@linux-fr.org>

i2c-algo-pca: Return standard fault codes

Adjust i2c-algo-pca to return fault codes compliant with
Documentation/i2c/fault-codes, rather than the undocumented and
vague -EREMOTEIO.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Wolfram Sang <w.sang@pengutronix.de>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 2086ca48 21-May-2010 Farid Hammane <farid.hammane@gmail.com>

i2c-algo-pca: Fix coding style issues

Fix up some coding style issues. i2c-algo-pca.c has been built
successfully after applying this patch and the binary object is
still exactly the same. Other issues found by checkpatch.pl were
voluntarily not fixed, either to keep readability, or because of
false positive errors.

Signed-off-by: Farid Hammane <farid.hammane@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>


# eec74a25 01-Mar-2010 Jean Delvare <khali@linux-fr.org>

i2c-algo-pca: Drop duplicate variable

Thanks to -Wshadow.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>


# 2196d1cf 05-May-2009 Enrik Berkhan <Enrik.Berkhan@ge.com>

i2c-algo-pca: Let PCA9564 recover from unacked data byte (state 0x30)

Currently, the i2c-algo-pca driver does nothing if the chip enters state
0x30 (Data byte in I2CDAT has been transmitted; NOT ACK has been
received). Thus, the i2c bus connected to the controller gets stuck
afterwards.

I have seen this kind of error on a custom board in certain load
situations most probably caused by interference or noise.

A possible reaction is to let the controller generate a STOP condition.
This is documented in the PCA9564 data sheet (2006-09-01) and the same
is done for other NACK states as well.

Further, state 0x38 isn't handled completely, either. Try to do another
START in this case like the data sheet says. As this couldn't be tested,
I've added a comment to try to reset the chip if the START doesn't help
as suggested by Wolfram Sang.

Signed-off-by: Enrik Berkhan <Enrik.Berkhan@ge.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>


# c454dee2 13-Apr-2009 Jean Delvare <khali@linux-fr.org>

i2c-algo-pca: Fix use of uninitialized variable in debug message

A recent change broke debugging of pca_xfer(), fix it.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>


# 2378bc09 28-Mar-2009 Wolfram Sang <wsa@kernel.org>

i2c-algo-pca: Use timeout for checking the state machine

We now timeout also if the state machine does not change within the
given time. For that, the driver-specific completion-functions are
extended to return true or false depending on the timeout. This then
gets checked in the algorithm.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 8e99ada8 28-Mar-2009 Wolfram Sang <wsa@kernel.org>

i2c-algo-pca: Rework waiting for a free bus

Waiting for a free bus now accepts the timeout value in jiffies and does
proper checking using time_before.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>


# eff9ec95 28-Mar-2009 Marco Aurelio da Costa <costa@gamic.com>

i2c-algo-pca: Add PCA9665 support

Add support for the PCA9665 I2C controller.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>


# bac3e7c2 28-Mar-2009 Frank Seidel <frank@f-seidel.de>

i2c: Adapt debug macros for KERN_* constants

According to kerneljanitors todo list all printk calls (beginning
a new line) should have an according KERN_* constant.
Those are the changes to the debug macros in the i2c subsystem
to meet this requirement. Also changing no-debug statements
to raw printks again.

Signed-off-by: Frank Seidel <frank@f-seidel.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>


# c80ebe79 14-Jul-2008 Wolfram Sang <wsa@kernel.org>

i2c-pca-algo: Fix error code

Give a more concrete error code, when the bus is not idle.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>


# c01b0831 22-Apr-2008 Wolfram Sang <wsa@kernel.org>

i2c-algo-pca: Extend for future drivers

The separation between algorithm and adapter was unsharp at places. This was
partly hidden by the fact, that the ISA-driver allowed just one instance and
had all private data in static variables. This patch makes neccessary
preparations to add a platform driver on top of the algorithm, while still
supporting ISA. Note: Due to lack of hardware, the ISA-driver could not be
tested except that it builds.

Concerning the core struct i2c_algo_pca_data:

- A private data field was added, all hardware dependant data may go here.
Similar to other algorithms, now a pointer to this data is passed to the
adapter's functions. In order to make as less changes as possible to the
ISA-driver, it leaves the private data empty and still only uses its static
variables.

- A "reset_chip" function pointer was added; such a functionality must come
from the adapter, not the algorithm.

- use a variable "i2c_clock" instead of a function pointer "get_clock",
allowing for write access to a default in case a wrong value was supplied.

In the algorithm-file:

- move "i2c-pca-algo.h" into "linux/i2c-algo-pca.h"
- now using per_instance timeout values (i2c_adap->timeout)
- error messages specify the device, not only the driver name
- restructure initialization to easily support "i2c_add_numbered_adapter"
- drop "retries" and "own" (i2c address) as they were unused

(The state-machine for I2C-communication was not touched.)

In the ISA-driver:

- adapt to new algorithm

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 3d438291 22-Apr-2008 Wolfram Sang <wsa@kernel.org>

i2c-algo-pca: Remove trailing whitespaces and unnecessary UTF

Remove trailing whitespaces to make further patches more readable. Also remove
an unnecessary UTF-char for simplicity ("us" for microseconds is fine enough).

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 96de0e25 19-Oct-2007 Jan Engelhardt <jengelh@gmx.de>

Convert files to UTF-8 and some cleanups

* 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>


# 3269711b 10-Dec-2006 Jean Delvare <khali@linux-fr.org>

i2c: Discard the i2c algo del_bus wrappers

They are all only calling i2c_del_adapter, so we may as well do
it directly.

Signed-off-by: Jean Delvare <khali@linux-fr.org>


# 9e11a9fb 03-Sep-2006 Jean Delvare <khali@linux-fr.org>

i2c: Constify i2c_algorithm declarations, part 1

i2c: Constify i2c_algorithm declarations, part 1

Make struct i2c_algorithm declarations const in all i2c algorithm
drivers.

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>


# b39ad0cf 01-Jul-2006 Mark M. Hoffman <mhoffman@lightlink.com>

[PATCH] i2c: Handle i2c_add_adapter failure in i2c algorithm drivers

Content-Disposition: inline; filename=i2c-algo-error-handling-fix.patch

It is possible for i2c_add_adapter() to fail. Several I2C algorithm
drivers ignore that fact. This (compile-tested only) patch fixes them.

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 60507095 25-Sep-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] i2c: Discard explicit static initializations to 0

Kill explicit static initializations to 0 in 10 i2c drivers.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

drivers/i2c/algos/i2c-algo-pca.c | 2 +-
drivers/i2c/algos/i2c-algo-sibyte.c | 2 +-
drivers/i2c/busses/i2c-ali15x3.c | 4 ++--
drivers/i2c/busses/i2c-amd756.c | 2 +-
drivers/i2c/busses/i2c-iop3xx.c | 2 +-
drivers/i2c/busses/i2c-piix4.c | 8 ++++----
drivers/i2c/busses/i2c-sis5595.c | 4 ++--
drivers/i2c/busses/i2c-sis630.c | 2 +-
drivers/i2c/busses/i2c-sis96x.c | 2 +-
drivers/i2c/busses/i2c-via.c | 2 +-
10 files changed, 15 insertions(+), 15 deletions(-)


# c7a46533 11-Aug-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] I2C: Kill i2c_algorithm.id (5/7)

Merge the algorithm id part (16 upper bits) of the i2c adapters ids
into the definition of the adapters ids directly. After that, we don't
need to OR both ids together for each i2c_adapter structure.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1d8b9e1b 11-Aug-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] I2C: Kill i2c_algorithm.id (4/7)

There are no more users of i2c_algorithm.id, so we can finally drop
this structure member.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 87c3d7a8 11-Aug-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] I2C: Kill i2c_algorithm.id (3/7)

Don't rely on i2c_algorithm.id to alter the i2c adapter's id, use the
I2C_ALGO_* value directly instead, because i2c_algorithm will soon
have no id member no more.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 97518588 11-Aug-2005 Jean Delvare <khali@linux-fr.org>

[PATCH] I2C: Kill i2c_algorithm.name (1/7)

The name member of the i2c_algorithm is never used, although all
drivers conscientiously fill it. We can drop it completely, this
structure doesn't need to have a name.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 48edcb65 10-Aug-2005 Ian Campbell <icampbell@arcom.com>

[PATCH] I2C: i2c-algo-pca -- gracefully handle a busy bus

I've been running with this patch for a while now, and while I've never
seen it trigger except with buggy hardware I think it is a cleaner way
to handle a busy bus. I had -EBUSY until about 10 minutes ago but -EIO
seems to be what most of the existing algo drivers will return in the
same circumstances.

Signed-off-by: Ian Campbell <icampbell@arcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 46b615f4 19-May-2005 Tobias Klauser <tklauser@nuerscht.ch>

[PATCH] I2C: Spelling fixes for drivers/i2c/algos/i2c-algo-pca.c

This patch fixes the some misspellings and a trailing whitespace in
the comments.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 44bbe87e 03-May-2005 Steven Cole <elenstev@mesatop.com>

[PATCH] Spelling fixes for drivers/i2c.

Here are some spelling corrections for drivers/i2c.

occured -> occurred
intialization -> initialization
Everytime -> Every time
transfering -> transferring
relevent -> relevant
continous -> continuous
neccessary -> necessary
explicitely -> explicitly
Celcius -> Celsius
differenciate -> differentiate

Signed-off-by: Steven Cole <elenstev@mesatop.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!