“3bb48060d12876fa851c2624653010ad91ce1148”上不存在“test/sun/util/git@gitcode.net:openanolis/dragonwell8_jdk.git”
未验证 提交 ff28fe48 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!527 i2c: hisi: Only use the completion interrupt to finish the transfer and...

!527 i2c: hisi: Only use the completion interrupt to finish the transfer and i2c: hisi: Avoid redundant interrupts

Merge Pull Request from: @lujunhuaHW 
 
i2c: hisi: Only use the completion interrupt to finish the transfer:
   The controller will always generate a completion interrupt when the
transfer is finished normally or not. Currently we use either error or
completion interrupt to finish, this may result the completion
interrupt unhandled and corrupt the next transfer, especially at low
speed mode. Since on error case, the error interrupt will come first
then is the completion interrupt. So only use the completion interrupt
to finish the whole transfer process.

i2c: hisi: Avoid redundant interrupts
   After issuing all the messages we can disable the TX_EMPTY interrupts
to avoid handling redundant interrupts. For doing a sinlge bus
detection (i2cdetect -y -r 0) we can reduce ~97% interrupts (before
~12000 after ~400).

Test dependencies:i2c-dev.ko i2c-hisi.ko
Test methodology:See the bugzilla link
 
 
Link:https://gitee.com/openeuler/kernel/pulls/527 

Reviewed-by: Jialin Zhang <zhangjialin11@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
...@@ -320,6 +320,13 @@ static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr) ...@@ -320,6 +320,13 @@ static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr)
max_write == 0) max_write == 0)
break; break;
} }
/*
* Disable the TX_EMPTY interrupt after finishing all the messages to
* avoid overwhelming the CPU.
*/
if (ctlr->msg_tx_idx == ctlr->msg_num)
hisi_i2c_disable_int(ctlr, HISI_I2C_INT_TX_EMPTY);
} }
static irqreturn_t hisi_i2c_irq(int irq, void *context) static irqreturn_t hisi_i2c_irq(int irq, void *context)
...@@ -345,7 +352,11 @@ static irqreturn_t hisi_i2c_irq(int irq, void *context) ...@@ -345,7 +352,11 @@ static irqreturn_t hisi_i2c_irq(int irq, void *context)
hisi_i2c_read_rx_fifo(ctlr); hisi_i2c_read_rx_fifo(ctlr);
out: out:
if (int_stat & HISI_I2C_INT_TRANS_CPLT || ctlr->xfer_err) { /*
* Only use TRANS_CPLT to indicate the completion. On error cases we'll
* get two interrupts, INT_ERR first then TRANS_CPLT.
*/
if (int_stat & HISI_I2C_INT_TRANS_CPLT) {
hisi_i2c_disable_int(ctlr, HISI_I2C_INT_ALL); hisi_i2c_disable_int(ctlr, HISI_I2C_INT_ALL);
hisi_i2c_clear_int(ctlr, HISI_I2C_INT_ALL); hisi_i2c_clear_int(ctlr, HISI_I2C_INT_ALL);
complete(ctlr->completion); complete(ctlr->completion);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册