forked from Minki/linux
i2c-cht-wc: Workaround CHT GPIO controller IRQ issues
The Cherry Trail Whiskey Cove PMIC's IRQ line is attached to one of the GPIOs of the Cherry Trail SoC. The CHT GPIO controller sometimes fails to deliver IRQs (seen when there is an IRQ storm on another pin). This commit works around this by reducing the long timeout which was a poor attempt to workaround this from 3s to 30ms and after that manually checking the status register for transfer completion by calling the threaded IRQ handler directly. This is safe todo as the entire threaded IRQ handler is protected by a mutex. Note 30ms should be more then long enough, at 100KHz any smbus single byte transaction should be finished in 4ms. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
8de60c636e
commit
ed1094012a
@ -158,10 +158,16 @@ static int cht_wc_i2c_adap_smbus_xfer(struct i2c_adapter *_adap, u16 addr,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* 3 second timeout, during cable plug the PMIC responds quite slow */
|
||||
ret = wait_event_timeout(adap->wait, adap->done, 3 * HZ);
|
||||
if (ret == 0)
|
||||
return -ETIMEDOUT;
|
||||
ret = wait_event_timeout(adap->wait, adap->done, msecs_to_jiffies(30));
|
||||
if (ret == 0) {
|
||||
/*
|
||||
* The CHT GPIO controller serializes all IRQs, sometimes
|
||||
* causing significant delays, check status manually.
|
||||
*/
|
||||
cht_wc_i2c_adap_thread_handler(0, adap);
|
||||
if (!adap->done)
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
mutex_lock(&adap->adap_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user