Phil Reid | 6 May 09:27 2016

Re: I2C driver for LTC1760 dual smart battery system manager

G'day Karl
On 29/04/2016 03:15, Karl-Heinz Schneider wrote:
> I have written an Kernel driver for the LTC1760 which is basically an
> charger which can handle 2 batteries. Datasheet can be found at
They're nice chips.
> However, the device has one speciality: Hence it handles two smart
> batteries, which are expected to sit on I2C address 0x0b, it implements
> an i2c mux. As the device does so, my driver does also (using
> i2c_add_mux_adapter() call).
> Further more, Linux already ships with an driver capable to talk to
> these smart battery chips, namely "sbs-battery".
> I currently using device tree to bind the LTC1760 to the smbus it sits
> on and further to define the i2c-lines it implements as well as the
> batteries sitting on the two muxed lines.
> Would you say this approach is technically right? The LTC expects SBS
> compliant batteries connected to it, which implies a standard minimal
> interface. But binding the batteries via device tree gives the user the
> freedom to specify a more specialized driver.
> On the other hand one could argue that if the LTC is present, also
> batteries are (potentially) present and the LTC driver is responsible to
> read the related registers and provide proper PM attributes. Personally
> I don't like to rewrite or copy code wich works just fine...

I've been writing a driver for the same chip :).
(Continue reading)

Naveen Kaje | 5 May 20:33 2016

[PATCH] i2c: qup: use address helper function in read transfer

qup_i2c_issue_read() derives the address from i2c_msg.
This called in the read path when I2C_M_RD flag is set.
Therefore, use the 8 bit address helper function.

Signed-off-by: Naveen Kaje <nkaje <at>>
 drivers/i2c/busses/i2c-qup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 8082919..072e352 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
 <at>  <at>  -1038,7 +1038,7  <at>  <at>  static void qup_i2c_issue_read(struct qup_i2c_dev *qup, struct i2c_msg *msg)
 	u32 addr, len, val;

-	addr = (msg->addr << 1) | 1;
+	addr = i2c_8bit_addr_from_msg(msg);

 	/* 0 is used to specify a length 256 (QUP_READ_LIMIT) */
 	len = (msg->len == QUP_READ_LIMIT) ? 0 : msg->len;

Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

Pali Rohár | 5 May 10:27 2016

Re: [PATCH] i2c: i801: Allow ACPI SystemIO OpRegion to conflict with PCI BAR

On Friday 29 April 2016 17:56:14 Andy Lutomirski wrote:
> On Fri, Apr 29, 2016 at 2:42 PM, Andy Lutomirski <luto <at>> wrote:
> > On Fri, Apr 29, 2016 at 2:00 PM, Pali Rohár <pali.rohar <at>> wrote:
> >> On Friday 29 April 2016 20:10:23 Andy Lutomirski wrote:
> >>> Jean and Wolfram: is there a quirk mechanism to add i2c devices that
> >>> aren't directly enumerable but are known to exist due to DMI?
> >>
> >> Maybe something like i2c_register_board_info()?
> >
> > Maybe.  i think that wants to be called before the adapter shows up, though.
> i2c_probe_optional_slaves may be a more appropriate place to put this.

I cannot find function i2c_probe_optional_slaves. Where is it?


Pali Rohár
pali.rohar <at>
Kieran Bingham | 4 May 17:14 2016

[PATCHv5 0/8] 2c: Relax mandatory I2C ID table passing

This patch set finally pops up again, after a long time stuck somewhere in the
midst of my stack.

As it stood last year, the requirements were to rename probe2 to probe_new, and
ensure that it was correctly tested. The rename was the easy bit, but the
testing took me more time to get things set up properly. And other commitments
then got in the way of things. Of course this patch set has also been rebased
as well, but there wasn't any major pain there.


To try to establish testing, I have used a beagle-bone-black, and a DS1307 RTC
connected to the BBB SCL and SDA lines. The main reason for these choices is
accesibility. i.e. I have them, and the BBB readily boots a kernel for me to
test and iterate with.

I've tested the device with i2cdetect, and then worked through testing the
sysfs interface, device tree, and module autoloading, each time ensuring that
the RTC enumerates and operates

* new_device (built-in, and external module)
  echo ds1307 0x68 > /sys/bus/i2c/devices/i2c-2/new_device
  cat /sys/class/rtc/rtc0/date

 - Both of those worked fine.

* Device Tree
  I tested that the device would still register by adding a node in the device
  tree for the board, and testing with a built-in module. 
(Continue reading)

Naveen Kaje | 4 May 01:25 2016

[PATCH 1/2] i2c: qup: add ACPI support

Add support to get the device parameters from ACPI. Assume that
the clocks are managed by firmware.

Signed-off-by: Naveen Kaje <nkaje <at>>
 drivers/i2c/busses/i2c-qup.c | 61 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 46 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 23eaabb..ef31b26 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
 <at>  <at>  -29,6 +29,7  <at>  <at> 
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/scatterlist.h>
+#include <linux/acpi.h>

 /* QUP Registers */
 #define QUP_CONFIG		0x000
 <at>  <at>  -132,6 +133,10  <at>  <at> 
 /* Max timeout in ms for 32k bytes */
 #define TOUT_MAX			300

+/* Default values. Use these if FW query fails */
+#define DEFAULT_CLK_FREQ 100000
+#define DEFAULT_SRC_CLK 20000000
 struct qup_i2c_block {
 	int	count;
(Continue reading)

Erico Nunes | 3 May 20:45 2016

[PATCH 1/1] i2c-dev: switch from register_chrdev to cdev API

i2c-dev had never moved away from the older register_chrdev interface to
implement its char device registration. The register_chrdev API has the
limitation of enabling only up to 256 i2c-dev busses to exist.

Large platforms with lots of i2c devices (i.e. pluggable transceivers)
with dedicated busses may have to exceed that limit.
In particular, there are also platforms making use of the i2c bus
multiplexing API, which instantiates a virtual bus for each possible
multiplexed selection.

This patch removes the register_chrdev usage and replaces it with the
less old cdev API, which takes away the 256 i2c-dev bus limitation.
It should not have any other impact for i2c bus drivers or user space.

This patch has been tested on qemu x86 and qemu powerpc platforms with
the aid of a module which adds and removes 5000 virtual i2c busses, as
well as validated on an existing powerpc hardware platform which makes
use of the i2c bus multiplexing API.
i2c-dev busses with device minor numbers larger than 256 have also been
validated to work with the existing i2c-tools.

Signed-off-by: Erico Nunes <erico.nunes <at>>
 drivers/i2c/i2c-dev.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 0b1108d..bacb472 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
(Continue reading)

RE: [PATCH v3 2/2] i2c, i2c_imc: Add DIMM bus code

> -----Original Message-----
> From: Andy Lutomirski [mailto:luto <at>]
> Sent: Thursday, April 28, 2016 8:03 PM
> To: Wolfram Sang <wsa <at>>; Christoph Hellwig <hch <at>>
> Cc: Boaz Harrosh <boaz <at>>; One Thousand Gnomes
> <gnomes <at>>; Rui Wang < <at>>; Jean Delvare
> <jdelvare <at>>; Alun Evans <alun <at>>; Robert Elliott
> <Elliott <at>>; linux-i2c <at>; Mauro Carvalho Chehab
> <m.chehab <at>>; Paul Bolle <pebolle <at>>; Tony Luck
> <tony.luck <at>>; linux-kernel <at>; Guenter Roeck
> <linux <at>>; Andy Lutomirski <luto <at>>
> Subject: [PATCH v3 2/2] i2c, i2c_imc: Add DIMM bus code
> Add i2c_scan_dimm_bus to declare that a particular i2c_adapter
> contains DIMMs.  This will probe (and autoload modules!) for useful
> SMBUS devices that live on DIMMs.  i2c_imc calls it.
> As more SMBUS-addressable DIMM components become supported, this
> code can be extended to probe for them.
> Signed-off-by: Andy Lutomirski <luto <at>>
> ---
>  drivers/i2c/busses/Kconfig    |   5 ++
>  drivers/i2c/busses/Makefile   |   4 ++
>  drivers/i2c/busses/dimm-bus.c | 107
> ++++++++++++++++++++++++++++++++++++++++++
>  drivers/i2c/busses/i2c-imc.c  |   3 ++
>  include/linux/i2c/dimm-bus.h  |  20 ++++++++
>  5 files changed, 139 insertions(+)
(Continue reading)

Jan Glauber | 2 May 19:35 2016

[PATCH v8 0/8] i2c-octeon and i2c-thunderx driver

Hi Wolfram,

this are the remaining patches that implement the ThunderX driver.
I like to send them now even if they might not make 4.7.
After the Octeon parts are merged the ThunderX driver code is
quite straight-forward, as should be the driver split.

Patch #5 - #7 are (final) cleanup patches.

Patches are on-top of next-20160502.



Changes to v7:
- Sort include files also in octeon-core.c
- Add cleanup bool patch (left-over from v7)
- Dropped read-write function shuffle patch

Changes to v6:
- Fixed read_int kerneldoc
- Removed udelay after write-int in recovery
- Killed retries in recovery, use EAGAIN
- Disable SMBUS QUICK and remove unneeded length check
- Spell out enable/disable
- Switch to wait_event_timeout
- Removed superfluous status check in HLC write
- Optimize wait-queue also for HLC
(Continue reading)

Sricharan R | 2 May 07:23 2016

[PATCH 0/2] drivers: i2c: qup: Some misc fixes

One for fixing the bug with CONFIG_DEBUG_SG enabled and another
to suspend the transfer for all errors instead of just for nack.

Sricharan R (2):
  drivers: i2c: qup: Fix broken dma when CONFIG_DEBUG_SG is enabled.
  drivers: i2c: qup: Fix error handling

 drivers/i2c/busses/i2c-qup.c | 87 +++++++++++++++++++++-----------------------
 1 file changed, 42 insertions(+), 45 deletions(-)


QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
The Linux Foundation

Michele Curti | 27 Apr 21:37 2016

[PATCH] i2c-algo-bit: declare i2c_bit_quirk_no_clk_stretch as static

i2c_bit_quirk_no_clk_stretch is used in i2c-algo-bit.c only, so
declare it as static.

Signed-off-by: Michele Curti <michele.curti <at>>
 drivers/i2c/algos/i2c-algo-bit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 9d233bb..a8e89df 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
 <at>  <at>  -617,7 +617,7  <at>  <at>  const struct i2c_algorithm i2c_bit_algo = {

-const struct i2c_adapter_quirks i2c_bit_quirk_no_clk_stretch = {
+static const struct i2c_adapter_quirks i2c_bit_quirk_no_clk_stretch = {
 	.flags = I2C_AQ_NO_CLK_STRETCH,



Julia Lawall | 27 Apr 21:06 2016

[PATCH] i2c-mux-pca9541: fix setup_timer.cocci warnings

Use setup_timer function instead of initializing timer with the function
and data fields

Generated by: scripts/coccinelle/api/setup_timer.cocci

Signed-off-by: Fengguang Wu <fengguang.wu <at>>
Signed-off-by: Julia Lawall <julia.lawall <at>>

tree:   git:// v4.5-ipmi
head:   671fec027e30fdac67b341f0271841f02db0a027
commit: 4a199ab1bf7b7a2b5f7e0b0eb4162b4e98b9cd7f [25/33] i2c-mux-pca9541: 
Add support for non-blocking handling

 i2c-mux-pca9541.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/i2c/muxes/i2c-mux-pca9541.c
+++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
 <at>  <at>  -547,9 +547,7  <at>  <at>  static int pca9541_probe(struct i2c_clie
 	data-> = &data->op_data;
 	data->op_e.smbus.size = I2C_SMBUS_BYTE_DATA;

-	init_timer(&data->timer);
-	data-> = (unsigned long) data;
-	data->timer.function = pca9541_timeout;
+	setup_timer(&data->timer, pca9541_timeout, (unsigned long)data);

 	 * I2C accesses are unprotected here.
(Continue reading)