i2c: imx: add runtime pm support to improve the performance
authorGao Pan <b54642@freescale.com>
Fri, 11 Dec 2015 02:24:09 +0000 (10:24 +0800)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 3 Jan 2016 18:08:09 +0000 (19:08 +0100)
commit588eb93ea49f672cb3ff55d0a5c34df3e1afa7ec
treea9cd17d01ac3a1002b5b76f0b5f3cf3e8fcaf165
parenta5f650182bcf956b2b0341575e8bff01e402224f
i2c: imx: add runtime pm support to improve the performance

In our former i2c driver, i2c clk is enabled and disabled in
xfer function, which contributes to power saving. However,
the clk enable process brings a busy wait delay until the core
is stable. As a result, the performance is sacrificed.

To weigh the power consumption and i2c bus performance, runtime
pm is the good solution for it. The clk is enabled when a i2c
transfer starts, and disabled after a specifically defined delay.

If CONFIG_PM is disabled the net result of this patch is that the
clock is never disabled.

Without the patch the test case (many eeprom reads) executes with approx:
real 1m7.735s
user 0m0.488s
sys 0m20.040s

With the patch the same test case (many eeprom reads) executes with approx:
real 0m54.241s
user 0m0.440s
sys 0m5.920s

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Gao Pan <b54642@freescale.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[wsa: sorted includes]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-imx.c