* [PATCH v2 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
2022-05-03 19:39 [PATCH v2 0/2] iio: sx9324: Support CS idle mode Stephen Boyd
@ 2022-05-03 19:39 ` Stephen Boyd
2022-05-04 6:20 ` Krzysztof Kozlowski
2022-05-04 15:03 ` Rob Herring
2022-05-03 19:39 ` [PATCH v2 2/2] iio: sx9324: Add setting for CS idle mode Stephen Boyd
2022-06-04 16:38 ` [PATCH v2 0/2] iio: sx9324: Support " Jonathan Cameron
2 siblings, 2 replies; 9+ messages in thread
From: Stephen Boyd @ 2022-05-03 19:39 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-kernel, patches, devicetree, linux-iio, Gwendal Grignou,
Rob Herring, Krzysztof Kozlowski
We need to configure the sleep and idle mode of the CS pins for this
device. Add a DT property to do this so pins are in a proper state
during sleep (either hi-z, grounded, or pulled up to vdd).
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
.../bindings/iio/proximity/semtech,sx9324.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
index d265eb5258c8..b3aa2ebf9661 100644
--- a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
+++ b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
@@ -126,6 +126,14 @@ properties:
UINT_MAX (4294967295) represents infinite. Other values
represent 1-1/N.
+ semtech,cs-idle-sleep:
+ description:
+ State of CS pins during sleep mode and idle time.
+ enum:
+ - hi-z
+ - gnd
+ - vdd
+
semtech,int-comp-resistor:
description:
Internal resistor setting for compensation.
@@ -187,5 +195,6 @@ examples:
semtech,avg-pos-strength = <64>;
semtech,int-comp-resistor = "lowest";
semtech,input-precharge-resistor-ohms = <2000>;
+ semtech,cs-idle-sleep = "gnd";
};
};
--
https://chromeos.dev
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
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:03 ` Rob Herring
1 sibling, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-04 6:20 UTC (permalink / raw)
To: Stephen Boyd, Jonathan Cameron
Cc: linux-kernel, patches, devicetree, linux-iio, Gwendal Grignou,
Rob Herring, Krzysztof Kozlowski
On 03/05/2022 21:39, Stephen Boyd wrote:
> We need to configure the sleep and idle mode of the CS pins for this
> device. Add a DT property to do this so pins are in a proper state
> during sleep (either hi-z, grounded, or pulled up to vdd).
>
> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
> .../bindings/iio/proximity/semtech,sx9324.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> index d265eb5258c8..b3aa2ebf9661 100644
> --- a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> +++ b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> @@ -126,6 +126,14 @@ properties:
> UINT_MAX (4294967295) represents infinite. Other values
> represent 1-1/N.
>
> + semtech,cs-idle-sleep:
> + description:
> + State of CS pins during sleep mode and idle time.
> + enum:
> + - hi-z
> + - gnd
> + - vdd
You need a ref to type (string).
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
2022-05-04 6:20 ` Krzysztof Kozlowski
@ 2022-05-04 15:03 ` Rob Herring
2022-05-04 15:15 ` Krzysztof Kozlowski
0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2022-05-04 15:03 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Stephen Boyd, Jonathan Cameron, linux-kernel, patches,
devicetree, linux-iio, Gwendal Grignou, Krzysztof Kozlowski
On Wed, May 04, 2022 at 08:20:40AM +0200, Krzysztof Kozlowski wrote:
> On 03/05/2022 21:39, Stephen Boyd wrote:
> > We need to configure the sleep and idle mode of the CS pins for this
> > device. Add a DT property to do this so pins are in a proper state
> > during sleep (either hi-z, grounded, or pulled up to vdd).
> >
> > Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> > ---
> > .../bindings/iio/proximity/semtech,sx9324.yaml | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> > index d265eb5258c8..b3aa2ebf9661 100644
> > --- a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> > +++ b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> > @@ -126,6 +126,14 @@ properties:
> > UINT_MAX (4294967295) represents infinite. Other values
> > represent 1-1/N.
> >
> > + semtech,cs-idle-sleep:
> > + description:
> > + State of CS pins during sleep mode and idle time.
> > + enum:
> > + - hi-z
> > + - gnd
> > + - vdd
>
> You need a ref to type (string).
Actually, it can be implicit for single strings.
Rob
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
2022-05-04 15:03 ` Rob Herring
@ 2022-05-04 15:15 ` Krzysztof Kozlowski
2022-05-09 21:39 ` Rob Herring
0 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-04 15:15 UTC (permalink / raw)
To: Rob Herring
Cc: Stephen Boyd, Jonathan Cameron, linux-kernel, patches,
devicetree, linux-iio, Gwendal Grignou, Krzysztof Kozlowski
On 04/05/2022 17:03, Rob Herring wrote:
>>>
>>> + semtech,cs-idle-sleep:
>>> + description:
>>> + State of CS pins during sleep mode and idle time.
>>> + enum:
>>> + - hi-z
>>> + - gnd
>>> + - vdd
>>
>> You need a ref to type (string).
>
> Actually, it can be implicit for single strings.
Is this a generic preference?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
2022-05-04 15:15 ` Krzysztof Kozlowski
@ 2022-05-09 21:39 ` Rob Herring
0 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2022-05-09 21:39 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Stephen Boyd, Jonathan Cameron, linux-kernel, patches,
devicetree, linux-iio, Gwendal Grignou, Krzysztof Kozlowski
On Wed, May 04, 2022 at 05:15:55PM +0200, Krzysztof Kozlowski wrote:
> On 04/05/2022 17:03, Rob Herring wrote:
> >>>
> >>> + semtech,cs-idle-sleep:
> >>> + description:
> >>> + State of CS pins during sleep mode and idle time.
> >>> + enum:
> >>> + - hi-z
> >>> + - gnd
> >>> + - vdd
> >>
> >> You need a ref to type (string).
> >
> > Actually, it can be implicit for single strings.
>
> Is this a generic preference?
I don't have a preference, just noting that both are allowed. I like
having a smaller schema, but then it is a bit of a special case.
Rob
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
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
1 sibling, 0 replies; 9+ messages in thread
From: Rob Herring @ 2022-05-04 15:03 UTC (permalink / raw)
To: Stephen Boyd
Cc: linux-iio, Krzysztof Kozlowski, linux-kernel, devicetree,
Gwendal Grignou, Jonathan Cameron, Rob Herring, patches
On Tue, 03 May 2022 12:39:36 -0700, Stephen Boyd wrote:
> We need to configure the sleep and idle mode of the CS pins for this
> device. Add a DT property to do this so pins are in a proper state
> during sleep (either hi-z, grounded, or pulled up to vdd).
>
> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
> .../bindings/iio/proximity/semtech,sx9324.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] iio: sx9324: Add setting for CS idle mode
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-03 19:39 ` Stephen Boyd
2022-06-04 16:38 ` [PATCH v2 0/2] iio: sx9324: Support " Jonathan Cameron
2 siblings, 0 replies; 9+ messages in thread
From: Stephen Boyd @ 2022-05-03 19:39 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-kernel, patches, devicetree, linux-iio, Gwendal Grignou,
Rob Herring, Krzysztof Kozlowski
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] iio: sx9324: Support CS idle mode
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-03 19:39 ` [PATCH v2 2/2] iio: sx9324: Add setting for CS idle mode Stephen Boyd
@ 2022-06-04 16:38 ` Jonathan Cameron
2 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2022-06-04 16:38 UTC (permalink / raw)
To: Stephen Boyd
Cc: linux-kernel, patches, devicetree, linux-iio, Gwendal Grignou,
Rob Herring, Krzysztof Kozlowski
On Tue, 3 May 2022 12:39:35 -0700
Stephen Boyd <swboyd@chromium.org> wrote:
> I need one more property to set another regsiter field for
> how to configure the CS pins during idle and sleep modes. This is based
> on the latest patch series from Gwendal[1]
>
> Changes from v1 (https://lore.kernel.org/r/20220503004156.3559940-1-swboyd@chromium.org):
> * Change 'hz' to 'hi-z'
> * Add property to example
Series applied to the togreg branch of iio.git and pushed out as testing to
let 0-day poke at them a bit before I make a mess of linux-next.
Thanks,
Jonathan
>
> Stephen Boyd (2):
> dt-bindings: iio: sx9324: Add CS idle/sleep mode
> iio: sx9324: Add setting for CS idle mode
>
> .../bindings/iio/proximity/semtech,sx9324.yaml | 9 +++++++++
> drivers/iio/proximity/sx9324.c | 16 ++++++++++++++++
> 2 files changed, 25 insertions(+)
>
> [1] https://lore.kernel.org/all/20220429220144.1476049-1-gwendal@chromium.org/
>
>
> base-commit: d79478a79cfa393cde46bccb05d52fc7d875d2e2
> prerequisite-patch-id: 05986765e921df4c9725d10a3f51e68b0b5cc211
> prerequisite-patch-id: 5e47b28af046dce1eb7d7ca492c466df0f30e07c
> prerequisite-patch-id: adb59d1a14b74ddfe02c442da8bcca04765e7d15
> prerequisite-patch-id: ec6069ee00463db27826962537ff880e69522f70
> prerequisite-patch-id: e40f2a3048da2ff28bb426b85e41d277f29f18ef
> prerequisite-patch-id: 82077662b97c09014c5b291fe5a42938a29ddbcd
> prerequisite-patch-id: d02f0ec3be1fa9cdbf02a22c700982008d0550bd
> prerequisite-patch-id: a02a8faefc5b7b68b99c0cc326973948c9356b60
> prerequisite-patch-id: 522c808e4b8bf99b8404c01d495526a685e5b97a
^ permalink raw reply [flat|nested] 9+ messages in thread