From: Stephen Boyd <swboyd@chromium.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev,
devicetree@vger.kernel.org, linux-iio@vger.kernel.org,
Gwendal Grignou <gwendal@chromium.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>
Subject: [PATCH v2 2/2] iio: sx9324: Add setting for CS idle mode
Date: Tue, 3 May 2022 12:39:37 -0700 [thread overview]
Message-ID: <20220503193937.3794477-3-swboyd@chromium.org> (raw)
In-Reply-To: <20220503193937.3794477-1-swboyd@chromium.org>
Based on device tree setting, set the CS idle mode.
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
drivers/iio/proximity/sx9324.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c
index 7f367f63e362..c7fc75f7badc 100644
--- a/drivers/iio/proximity/sx9324.c
+++ b/drivers/iio/proximity/sx9324.c
@@ -57,6 +57,11 @@
GENMASK(SX9324_REG_AFE_CTRL0_RINT_SHIFT + 1, \
SX9324_REG_AFE_CTRL0_RINT_SHIFT)
#define SX9324_REG_AFE_CTRL0_RINT_LOWEST 0x00
+#define SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT 4
+#define SX9324_REG_AFE_CTRL0_CSIDLE_MASK \
+ GENMASK(SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT + 1, \
+ SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT)
+#define SX9324_REG_AFE_CTRL0_RINT_LOWEST 0x00
#define SX9324_REG_AFE_CTRL1 0x21
#define SX9324_REG_AFE_CTRL2 0x22
#define SX9324_REG_AFE_CTRL3 0x23
@@ -872,6 +877,8 @@ sx9324_get_default_reg(struct device *dev, int idx,
{
static const char * const sx9324_rints[] = { "lowest", "low", "high",
"highest" };
+ static const char * const sx9324_csidle[] = { "hi-z", "hi-z", "gnd",
+ "vdd" };
#define SX9324_PIN_DEF "semtech,ph0-pin"
#define SX9324_RESOLUTION_DEF "semtech,ph01-resolution"
#define SX9324_PROXRAW_DEF "semtech,ph01-proxraw-strength"
@@ -901,6 +908,15 @@ sx9324_get_default_reg(struct device *dev, int idx,
reg_def->def = raw;
break;
case SX9324_REG_AFE_CTRL0:
+ ret = device_property_read_string(dev,
+ "semtech,cs-idle-sleep", &res);
+ if (!ret)
+ ret = match_string(sx9324_csidle, ARRAY_SIZE(sx9324_csidle), res);
+ if (ret >= 0) {
+ reg_def->def &= ~SX9324_REG_AFE_CTRL0_CSIDLE_MASK;
+ reg_def->def |= ret << SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT;
+ }
+
ret = device_property_read_string(dev,
"semtech,int-comp-resistor", &res);
if (ret)
--
https://chromeos.dev
next prev parent reply other threads:[~2022-05-03 19:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 19:39 [PATCH v2 0/2] iio: sx9324: Support CS idle mode Stephen Boyd
2022-05-03 19:39 ` [PATCH v2 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode Stephen Boyd
2022-05-04 6:20 ` Krzysztof Kozlowski
2022-05-04 15:03 ` Rob Herring
2022-05-04 15:15 ` Krzysztof Kozlowski
2022-05-09 21:39 ` Rob Herring
2022-05-04 15:03 ` Rob Herring
2022-05-03 19:39 ` Stephen Boyd [this message]
2022-06-04 16:38 ` [PATCH v2 0/2] iio: sx9324: Support CS idle mode Jonathan Cameron
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=20220503193937.3794477-3-swboyd@chromium.org \
--to=swboyd@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=robh+dt@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.