All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff LaBundy <jeff@labundy.com>
To: lee.jones@linaro.org
Cc: linux-kernel@vger.kernel.org, Jeff LaBundy <jeff@labundy.com>
Subject: [PATCH 6/6] mfd: iqs62x: Do not change clock frequency during ATI
Date: Sun,  3 Jan 2021 14:56:09 -0600	[thread overview]
Message-ID: <1609707369-11297-7-git-send-email-jeff@labundy.com> (raw)
In-Reply-To: <1609707369-11297-1-git-send-email-jeff@labundy.com>

After a reset event, the device automatically triggers ATI at the
default core clock frequency (16 MHz). Soon afterward, the driver
loads firmware which may attempt to lower the frequency.

If this initial ATI cycle is still in progress when the frequency
is changed, however, the device incorrectly reports channels 0, 1
and 2 to be in a state of touch once ATI finally completes.

To solve this problem, wait until ATI is complete before lowering
the frequency. Because this particular ATI cycle occurs following
a reset event, its duration is predictable and a simple delay can
suffice.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
---
 drivers/mfd/iqs62x.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/mfd/iqs62x.c b/drivers/mfd/iqs62x.c
index 9fdf32f..3b32542 100644
--- a/drivers/mfd/iqs62x.c
+++ b/drivers/mfd/iqs62x.c
@@ -81,6 +81,7 @@
 #define IQS62X_FW_REC_TYPE_MASK			3
 #define IQS62X_FW_REC_TYPE_DATA			4
 
+#define IQS62X_ATI_STARTUP_MS			350
 #define IQS62X_FILT_SETTLE_MS			250
 
 struct iqs62x_fw_rec {
@@ -111,6 +112,14 @@ static int iqs62x_dev_init(struct iqs62x_core *iqs62x)
 	int ret;
 
 	list_for_each_entry(fw_blk, &iqs62x->fw_blk_head, list) {
+		/*
+		 * In case ATI is in progress, wait for it to complete before
+		 * lowering the core clock frequency.
+		 */
+		if (fw_blk->addr == IQS62X_SYS_SETTINGS &&
+		    *fw_blk->data & IQS62X_SYS_SETTINGS_CLK_DIV)
+			msleep(IQS62X_ATI_STARTUP_MS);
+
 		if (fw_blk->mask)
 			ret = regmap_update_bits(iqs62x->regmap, fw_blk->addr,
 						 fw_blk->mask, *fw_blk->data);
-- 
2.7.4


  parent reply	other threads:[~2021-01-03 20:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03 20:56 [PATCH 0/6] mfd: iqs62x: Minor cosmetic and functional improvements Jeff LaBundy
2021-01-03 20:56 ` [PATCH 1/6] mfd: iqs62x: Remove superfluous whitespace above fallthroughs Jeff LaBundy
2021-01-14 10:18   ` Lee Jones
2021-01-03 20:56 ` [PATCH 2/6] mfd: iqs62x: Remove unused bit mask Jeff LaBundy
2021-01-14 10:18   ` Lee Jones
2021-01-03 20:56 ` [PATCH 3/6] mfd: iqs62x: Rename regmap_config struct Jeff LaBundy
2021-01-14 10:19   ` Lee Jones
2021-01-03 20:56 ` [PATCH 4/6] mfd: iqs62x: Increase interrupt handler return delay Jeff LaBundy
2021-01-14 10:20   ` Lee Jones
2021-01-03 20:56 ` [PATCH 5/6] mfd: iqs62x: Do not poll during ATI Jeff LaBundy
2021-01-14 10:17   ` Lee Jones
2021-01-15  4:01     ` Jeff LaBundy
2021-01-03 20:56 ` Jeff LaBundy [this message]
2021-01-14 10:21   ` [PATCH 6/6] mfd: iqs62x: Do not change clock frequency " Lee Jones

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=1609707369-11297-7-git-send-email-jeff@labundy.com \
    --to=jeff@labundy.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.