linux-stable/drivers/i2c
Peter Rosin 8320f495cf i2c: allow adapter drivers to override the adapter locking
Add i2c_lock_bus() and i2c_unlock_bus(), which call the new lock_bus and
unlock_bus ops in the adapter. These funcs/ops take an additional flags
argument that indicates for what purpose the adapter is locked.

There are two flags, I2C_LOCK_ROOT_ADAPTER and I2C_LOCK_SEGMENT, but they
are both implemented the same. For now. Locking the root adapter means
that the whole bus is locked, locking the segment means that only the
current bus segment is locked (i.e. i2c traffic on the parent side of
a mux is still allowed even if the child side of the mux is locked).

Also support a trylock_bus op (but no function to call it, as it is not
expected to be needed outside of the i2c core).

Implement i2c_lock_adapter/i2c_unlock_adapter in terms of the new locking
scheme (i.e. lock with the I2C_LOCK_ROOT_ADAPTER flag).

Locking the root adapter and locking the segment is the same thing for
all root adapters (e.g. in the normal case of a simple topology with no
i2c muxes). The two locking variants are also the same for traditional
muxes (aka parent-locked muxes). These muxes traverse the tree, locking
each level as they go until they reach the root. This patch is preparatory
for a later patch in the series introducing mux-locked muxes, which behave
differently depending on the requested locking. Since all current users
are using i2c_lock_adapter, which is a wrapper for I2C_LOCK_ROOT_ADAPTER,
we only need to annotate the calls that will not need to lock the root
adapter for mux-locked muxes. I.e. the instances that needs to use
I2C_LOCK_SEGMENT instead of i2c_lock_adapter/I2C_LOCK_ROOT_ADAPTER. Those
instances are in the i2c_transfer and i2c_smbus_xfer functions, so that
mux-locked muxes can single out normal i2c accesses to its slave side
and adjust the locking for those accesses.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-05-04 22:28:31 +02:00
..
algos i2c: algo-bit: add I2C_AQ_NO_CLK_STRETCH 2015-11-30 18:37:25 +01:00
busses i2c: uniphier: add "\n" at the end of error log 2016-04-27 19:09:04 +02:00
muxes i2c: mux: pinctrl: fix indentation for better readability 2016-04-24 23:11:41 +02:00
i2c-boardinfo.c i2c: i2c-boardinfo: sort includes 2016-02-20 23:33:38 +01:00
i2c-core.c i2c: allow adapter drivers to override the adapter locking 2016-05-04 22:28:31 +02:00
i2c-core.h
i2c-dev.c i2c: i2c-dev: sort includes 2016-02-20 23:33:38 +01:00
i2c-mux.c i2c: mux: drop old unused i2c-mux api 2016-04-22 15:00:19 +02:00
i2c-slave-eeprom.c i2c: Drop owner assignment from i2c_driver 2015-08-10 08:37:35 +02:00
i2c-smbus.c i2c: i2c-smbus: sort includes 2016-02-20 23:33:39 +01:00
i2c-stub.c i2c: i2c-stub: sort includes 2016-02-20 23:33:39 +01:00
Kconfig kconfig: use bool instead of boolean for type definition attributes 2015-01-07 13:08:04 +01:00
Makefile i2c: slave-eeprom: add eeprom simulator driver 2014-12-11 22:25:54 +01:00