Linux-Devicetree Archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: sx9324: Support CS idle mode
@ 2022-05-03  0:41 Stephen Boyd
  2022-05-03  0:41 ` [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode Stephen Boyd
  2022-05-03  0:41 ` [PATCH 2/2] iio: sx9324: Add setting for CS idle mode Stephen Boyd
  0 siblings, 2 replies; 8+ messages in thread
From: Stephen Boyd @ 2022-05-03  0:41 UTC (permalink / raw
  To: Jonathan Cameron
  Cc: linux-kernel, patches, devicetree, linux-iio, Gwendal Grignou,
	Rob Herring, Krzysztof Kozlowski

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]

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   |  8 ++++++++
 drivers/iio/proximity/sx9324.c                   | 16 ++++++++++++++++
 2 files changed, 24 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
-- 
https://chromeos.dev


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
  2022-05-03  0:41 [PATCH 0/2] iio: sx9324: Support CS idle mode Stephen Boyd
@ 2022-05-03  0:41 ` Stephen Boyd
  2022-05-03  0:50   ` Gwendal Grignou
  2022-05-03 14:18   ` Rob Herring
  2022-05-03  0:41 ` [PATCH 2/2] iio: sx9324: Add setting for CS idle mode Stephen Boyd
  1 sibling, 2 replies; 8+ messages in thread
From: Stephen Boyd @ 2022-05-03  0:41 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).

Cc: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 .../devicetree/bindings/iio/proximity/semtech,sx9324.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
index d265eb5258c8..6cec3481c8b2 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:
+      - hz
+      - gnd
+      - vdd
+
   semtech,int-comp-resistor:
     description:
       Internal resistor setting for compensation.
-- 
https://chromeos.dev


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] iio: sx9324: Add setting for CS idle mode
  2022-05-03  0:41 [PATCH 0/2] iio: sx9324: Support CS idle mode Stephen Boyd
  2022-05-03  0:41 ` [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode Stephen Boyd
@ 2022-05-03  0:41 ` Stephen Boyd
  2022-05-03  0:50   ` Gwendal Grignou
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen Boyd @ 2022-05-03  0:41 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.

Cc: 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..79683f0d4e9a 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[] = { "hz", "hz", "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] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
  2022-05-03  0:41 ` [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode Stephen Boyd
@ 2022-05-03  0:50   ` Gwendal Grignou
  2022-05-03  0:54     ` Stephen Boyd
  2022-05-03 14:18   ` Rob Herring
  1 sibling, 1 reply; 8+ messages in thread
From: Gwendal Grignou @ 2022-05-03  0:50 UTC (permalink / raw
  To: Stephen Boyd
  Cc: Jonathan Cameron, linux-kernel, patches, devicetree, linux-iio,
	Rob Herring, Krzysztof Kozlowski

Reviewed-by: Gwendal Grignou <gwendal@chromium.org>

Nit: you may want to add an example.

On Mon, May 2, 2022 at 5:41 PM Stephen Boyd <swboyd@chromium.org> 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).
>
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  .../devicetree/bindings/iio/proximity/semtech,sx9324.yaml | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> index d265eb5258c8..6cec3481c8b2 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:
> +      - hz
> +      - gnd
> +      - vdd
> +
>    semtech,int-comp-resistor:
>      description:
>        Internal resistor setting for compensation.
> --
> https://chromeos.dev
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] iio: sx9324: Add setting for CS idle mode
  2022-05-03  0:41 ` [PATCH 2/2] iio: sx9324: Add setting for CS idle mode Stephen Boyd
@ 2022-05-03  0:50   ` Gwendal Grignou
  0 siblings, 0 replies; 8+ messages in thread
From: Gwendal Grignou @ 2022-05-03  0:50 UTC (permalink / raw
  To: Stephen Boyd
  Cc: Jonathan Cameron, linux-kernel, patches, devicetree, linux-iio,
	Rob Herring, Krzysztof Kozlowski

Reviewed-by: Gwendal Grignou <gwendal@chromium.org>

On Mon, May 2, 2022 at 5:42 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Based on device tree setting, set the CS idle mode.
>
> Cc: 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..79683f0d4e9a 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[] = { "hz", "hz", "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	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
  2022-05-03  0:50   ` Gwendal Grignou
@ 2022-05-03  0:54     ` Stephen Boyd
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2022-05-03  0:54 UTC (permalink / raw
  To: Gwendal Grignou
  Cc: Jonathan Cameron, linux-kernel, patches, devicetree, linux-iio,
	Rob Herring, Krzysztof Kozlowski

Quoting Gwendal Grignou (2022-05-02 17:50:02)
> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
>
> Nit: you may want to add an example.

Good point. I can add to the example and resend. I'll do it tomorrow.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
  2022-05-03  0:41 ` [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode Stephen Boyd
  2022-05-03  0:50   ` Gwendal Grignou
@ 2022-05-03 14:18   ` Rob Herring
  2022-05-03 19:13     ` Stephen Boyd
  1 sibling, 1 reply; 8+ messages in thread
From: Rob Herring @ 2022-05-03 14:18 UTC (permalink / raw
  To: Stephen Boyd
  Cc: Jonathan Cameron, linux-kernel, patches, devicetree, linux-iio,
	Gwendal Grignou, Krzysztof Kozlowski

On Mon, May 02, 2022 at 05:41:55PM -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).
> 
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  .../devicetree/bindings/iio/proximity/semtech,sx9324.yaml | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> index d265eb5258c8..6cec3481c8b2 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:
> +      - hz

I was trying to figure out how Hertz was a pin state. 'hiz' or 'hi-z' 
instead?

> +      - gnd
> +      - vdd
> +
>    semtech,int-comp-resistor:
>      description:
>        Internal resistor setting for compensation.
> -- 
> https://chromeos.dev
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode
  2022-05-03 14:18   ` Rob Herring
@ 2022-05-03 19:13     ` Stephen Boyd
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2022-05-03 19:13 UTC (permalink / raw
  To: Rob Herring
  Cc: Jonathan Cameron, linux-kernel, patches, devicetree, linux-iio,
	Gwendal Grignou, Krzysztof Kozlowski

Quoting Rob Herring (2022-05-03 07:18:44)
> On Mon, May 02, 2022 at 05:41:55PM -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).
> >
> > Cc: Gwendal Grignou <gwendal@chromium.org>
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> > ---
> >  .../devicetree/bindings/iio/proximity/semtech,sx9324.yaml | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml
> > index d265eb5258c8..6cec3481c8b2 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:
> > +      - hz
>
> I was trying to figure out how Hertz was a pin state. 'hiz' or 'hi-z'
> instead?

Sure. I was following the datasheet that has "HZ" but hi-z is better.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-03 19:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-03  0:41 [PATCH 0/2] iio: sx9324: Support CS idle mode Stephen Boyd
2022-05-03  0:41 ` [PATCH 1/2] dt-bindings: iio: sx9324: Add CS idle/sleep mode Stephen Boyd
2022-05-03  0:50   ` Gwendal Grignou
2022-05-03  0:54     ` Stephen Boyd
2022-05-03 14:18   ` Rob Herring
2022-05-03 19:13     ` Stephen Boyd
2022-05-03  0:41 ` [PATCH 2/2] iio: sx9324: Add setting for CS idle mode Stephen Boyd
2022-05-03  0:50   ` Gwendal Grignou

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 read-only IMAP folder(s) and NNTP newsgroup(s).