• Daniel Kurtz's avatar
    i2c: s3c2410: grab adapter lock while changing i2c clock · 9bcd04bf
    Daniel Kurtz authored
    We probably don't want to change I2C frequency while a transfer is in
    progress.  The current implementation grabs a spinlock, but that only
    protected the writes to IICCON when starting a message, it didn't protect
    against clock changes in the middle of a transaction.
    
    Note: The i2c-core already grabs the adapter lock before calling
    s3c24xx_i2c_doxfer(), which ensures that only one caller is issuing a
    xfer at a time. This means it is not necessary to disable interrupts
    (spin_lock_irqsave) when changing frequencies, since there won't be
    any i2c interrupts if there is no on-going xfer.
    
    Lastly, i2c_lock_adapter() may cause the cpufreq_transition to sleep if
    if a xfer is in progress, but this is ok since cpufreq notifiers are
    called in a kernel thread, and there are already cases where it could
    sleep, such as when using i2c to update the output of a voltage
    regulator.
    
    Note: the cpufreq part of this change has no functional affect on
    	exynos, where the i2c clock is independent of the cpufreq.
    	But, there is a slight perfomance boost since we no longer need to
    	lock/unlock an additional spinlock.
    Signed-off-by: default avatarDaniel Kurtz <djkurtz@chromium.org>
    Signed-off-by: default avatarNaveen Krishna Chatradhi <ch.naveen@samsung.com>
    Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
    9bcd04bf
i2c-s3c2410.c 26 KB