From: Gwendal Grignou <gwendal@chromium.org>
To: jic23@kernel.org, robh+dt@kernel.org, swboyd@chromium.org
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
Gwendal Grignou <gwendal@chromium.org>
Subject: [PATCH v2 4/8] iio: sx9324: Add precharge internal resistance setting
Date: Mon, 21 Mar 2022 23:25:00 -0700 [thread overview]
Message-ID: <20220322062504.1019504-5-gwendal@chromium.org> (raw)
In-Reply-To: <20220322062504.1019504-1-gwendal@chromium.org>
Add ability to set the precharge internal resistance from the device
tree.
Fix the default value for the register that set the resistance:
it has to be 0x10.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
Changes since v1:
- Suffix field with kOhms unit.
drivers/iio/proximity/sx9324.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c
index 1dfa19426c210..95de5d9f8eacb 100644
--- a/drivers/iio/proximity/sx9324.c
+++ b/drivers/iio/proximity/sx9324.c
@@ -72,6 +72,7 @@
#define SX9324_REG_AFE_CTRL8 0x2c
#define SX9324_REG_AFE_CTRL8_RSVD 0x10
#define SX9324_REG_AFE_CTRL8_RESFILTIN_4KOHM 0x02
+#define SX9324_REG_AFE_CTRL8_RESFILTIN_MASK GENMASK(3, 0)
#define SX9324_REG_AFE_CTRL9 0x2d
#define SX9324_REG_AFE_CTRL9_AGAIN_1 0x08
@@ -893,6 +894,15 @@ sx9324_get_default_reg(struct device *dev, int idx,
reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL4_RESOLUTION_MASK,
raw);
break;
+ case SX9324_REG_AFE_CTRL8:
+ ret = device_property_read_u32(dev,
+ "semtech,input-precharge-resistor-kohms",
+ &raw);
+ reg_def->def &= ~SX9324_REG_AFE_CTRL8_RESFILTIN_MASK;
+ reg_def->def |= FIELD_PREP(SX9324_REG_AFE_CTRL8_RESFILTIN_MASK,
+ raw / 2);
+ break;
+
case SX9324_REG_ADV_CTRL5:
ret = device_property_read_u32(dev, "semtech,startup-sensor",
&start);
--
2.35.1.894.gb6a874cedc-goog
next prev parent reply other threads:[~2022-03-22 6:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-22 6:24 [PATCH v2 0/8] Add settings for precharge and internal resistor Gwendal Grignou
2022-03-22 6:24 ` [PATCH v2 1/8] iio: sx9324: Fix default precharge internal resistance register Gwendal Grignou
2022-03-22 6:50 ` Stephen Boyd
2022-03-22 6:24 ` [PATCH v2 2/8] iio: sx9324: Fix register field spelling Gwendal Grignou
2022-03-22 6:50 ` Stephen Boyd
2022-03-22 6:24 ` [PATCH v2 3/8] dt-bindings: iio: sx9324: Add precharge resistor setting Gwendal Grignou
2022-03-22 6:51 ` Stephen Boyd
2022-03-25 22:01 ` Gwendal Grignou
2022-03-22 6:25 ` Gwendal Grignou [this message]
2022-03-22 6:25 ` [PATCH v2 5/8] dt-bindings: iio: sx9324: Add internal compensation " Gwendal Grignou
2022-03-22 6:59 ` Stephen Boyd
2022-03-22 6:25 ` [PATCH v2 6/8] iio: sx9324: Add Setting for internal compensation resistor Gwendal Grignou
2022-03-22 6:59 ` Stephen Boyd
2022-03-22 6:25 ` [PATCH v2 7/8] dt-bindings: iio: sx9360: Add precharge resistor setting Gwendal Grignou
2022-03-22 6:25 ` [PATCH v2 8/8] iio: sx9360: Add pre-charge " Gwendal Grignou
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=20220322062504.1019504-5-gwendal@chromium.org \
--to=gwendal@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=swboyd@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).