All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@huawei.com>
To: <wsa@kernel.org>, <linux-i2c@vger.kernel.org>
Cc: <chenweilong@huawei.com>, <f.fangjian@huawei.com>,
	<linuxarm@huawei.com>, <prime.zeng@huawei.com>,
	<yangyicong@hisilicon.com>, Sheng Feng <fengsheng5@huawei.com>
Subject: [PATCH 1/2] i2c: hisi: Avoid redundant interrupts
Date: Mon, 13 Mar 2023 15:45:51 +0800	[thread overview]
Message-ID: <20230313074552.54457-2-yangyicong@huawei.com> (raw)
In-Reply-To: <20230313074552.54457-1-yangyicong@huawei.com>

From: Yicong Yang <yangyicong@hisilicon.com>

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).

Reported-by: Sheng Feng <fengsheng5@huawei.com>
Signed-off-by: Sheng Feng <fengsheng5@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
 drivers/i2c/busses/i2c-hisi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/i2c/busses/i2c-hisi.c b/drivers/i2c/busses/i2c-hisi.c
index 8c6c7075c765..1b7609a34f4a 100644
--- a/drivers/i2c/busses/i2c-hisi.c
+++ b/drivers/i2c/busses/i2c-hisi.c
@@ -316,6 +316,13 @@ static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr)
 		    max_write == 0)
 			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)
-- 
2.24.0


  reply	other threads:[~2023-03-13  7:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13  7:45 [PATCH 0/2] Improvement and fix for HiSilicon I2C driver Yicong Yang
2023-03-13  7:45 ` Yicong Yang [this message]
2023-03-16 20:06   ` [PATCH 1/2] i2c: hisi: Avoid redundant interrupts Wolfram Sang
2023-03-13  7:45 ` [PATCH 2/2] i2c: hisi: Only use the completion interrupt to finish the transfer Yicong Yang
2023-03-16 20:06   ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230313074552.54457-2-yangyicong@huawei.com \
    --to=yangyicong@huawei.com \
    --cc=chenweilong@huawei.com \
    --cc=f.fangjian@huawei.com \
    --cc=fengsheng5@huawei.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=prime.zeng@huawei.com \
    --cc=wsa@kernel.org \
    --cc=yangyicong@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.