]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
i2c: designware: refactor low-level enable/disable
authorAlexander Monakov <amonakov@ispras.ru>
Sat, 28 Apr 2018 13:56:07 +0000 (16:56 +0300)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 15 May 2018 08:42:19 +0000 (10:42 +0200)
commit9f4659ba384780f8bc5b18717865026d83d455ce
tree36c570dbf4a689c24272cc5e564b3ab7cbbfd67c
parente6218bf390a9992de86a535bcb227f75e2c20cf9
i2c: designware: refactor low-level enable/disable

Low-level controller enable function __i2c_dw_enable is overloaded to
also handle disabling. What's worse, even though the documentation
requires polling the IC_ENABLE_STATUS register when disabling, this
is not done: polling needs to be requested specifically by calling
__i2c_dw_enable_and_wait, which can also poll on enabling, but that
doesn't work if the IC_ENABLE_STATUS register is not implemented.
This is quite confusing if not in fact backwards.

Especially since the documentation says that disabling should be
followed by polling, the driver should be using a separate function
where it does one-shot disables to make the optimization stand out.

This refactors the two functions so that requested status is given
in the name rather than in a boolean argument. Specifically:

 - __i2c_dw_enable: enable without polling (in accordance with docs)
 - __i2c_dw_disable: disable and do poll (also as suggested by docs)
 - __i2c_dw_disable_nowait: disable without polling (Linux-specific)

No functional change.

Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
[wsa: fixed blank lines in header file]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-designware-common.c
drivers/i2c/busses/i2c-designware-core.h
drivers/i2c/busses/i2c-designware-master.c
drivers/i2c/busses/i2c-designware-slave.c