On Mon, Aug 03, 2015 at 09:29:54AM +0800, Gao Pan wrote: > 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. > > 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 > > From the test result, the patch get better performance. > > --- > V2: > As Uwe Kleine-König's suggestion, the version do below changes: > - call clk_prepare_enable in probe to avoid never enabling clock > if CONFIG_PM is disabled > - enable clock before request IRQ in probe > - remove the pm staff in i2c_imx_isr > > V3: > - pm_runtime_get_sync returns < 0 as error > > Signed-off-by: Fugang Duan <B38611@xxxxxxxxxxxxx> > Signed-off-by: Gao Pan <b54642@xxxxxxxxxxxxx> The signed-off lines should be before the "---" line. Applied to for-next, thanks! > --- A second "---" line is not a good idea. Many workflow scripts will break. > static struct platform_driver i2c_imx_driver = { > - .probe = i2c_imx_probe, > - .remove = i2c_imx_remove, > - .driver = { > + .probe = i2c_imx_probe, > + .remove = i2c_imx_remove, > + .driver = { > .name = DRIVER_NAME, > + .pm = I2C_IMX_PM_OPS, > .of_match_table = i2c_imx_dt_ids, > }, > .id_table = imx_i2c_devtype, I fixed this to use one space as an indentation and no tabs. Experience shows this is more future-proof. Thanks, Wolfram
Attachment:
signature.asc
Description: Digital signature