Linux-Devicetree Archive on lore.kernel.org
 help / color / Atom feed
From: Stephen Boyd <swboyd@chromium.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	Daniel Campello <campello@chromium.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org,
	Douglas Anderson <dianders@chromium.org>,
	Gwendal Grignou <gwendal@chromium.org>,
	Evan Green <evgreen@chromium.org>
Subject: [PATCH] dt-bindings: iio: sx9310: Add various settings as DT properties
Date: Thu,  3 Sep 2020 15:18:28 -0700
Message-ID: <20200903221828.3657250-1-swboyd@chromium.org> (raw)

We need to set various bits in the hardware registers for this device to
operate properly depending on how it is installed. Add a handful of DT
properties to configure these things.

Cc: Daniel Campello <campello@chromium.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: <devicetree@vger.kernel.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Evan Green <evgreen@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

I haven't written any code to handle these properties yet. I'd rather do
that once the binding patch is reviewed. Patch based on iio.git testing
branch.

 .../iio/proximity/semtech,sx9310.yaml         | 182 ++++++++++++++++++
 1 file changed, 182 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9310.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9310.yaml
index 5739074d3592..e74b81483c14 100644
--- a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9310.yaml
+++ b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9310.yaml
@@ -40,6 +40,169 @@ properties:
   "#io-channel-cells":
     const: 1
 
+  semtech,cs0-ground:
+    description: Indicates the CS0 sensor is connected to ground.
+    type: boolean
+
+  semtech,combined-sensors:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 1, 2, 3]
+    default: 0
+    description:
+      Which sensors are combined. 0 for CS3, 1 for CS0+CS1, 2 for CS1+CS2,
+      and 3 for all sensors.
+
+  semtech,cs0-gain-factor:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [1, 2, 4, 8]
+    default: 1
+    description:
+      Gain factor for CS0 (and combined if any) sensor.
+
+  semtech,cs1-gain-factor:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [1, 2, 4, 8]
+    default: 1
+    description:
+      Gain factor for CS1 sensor.
+
+  semtech,cs2-gain-factor:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [1, 2, 4, 8]
+    default: 1
+    description:
+      Gain factor for CS2 sensor.
+
+  semtech,resolution:
+    description:
+      Capacitance measure resolution.
+    enum:
+      - coarsest
+      - very-coarse
+      - coarse
+      - medium-coarse
+      - medium
+      - fine
+      - very-fine
+      - finest
+
+  semtech,startup-sensor:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 1, 2, 3]
+    default: 0
+    description:
+      Sensor used for start-up proximity detection. The combined
+      sensor is represented by 3.
+
+  semtech,proxraw-strength:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 2, 4, 8]
+    default: 2
+    description:
+      PROXRAW filter strength. A value of 0 represents off, and other values
+      represent 1-1/N.
+
+  semtech,compensate-common:
+    description: Any sensor triggers compensation of all channels.
+    type: boolean
+
+  semtech,avg-pos-strength:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 16, 64, 128, 256, 512, 1024, 4294967295]
+    default: 16
+    description:
+      Average positive filter strength. A value of 0 represents off and
+      UINT_MAX (4294967295) represents infinite. Other values
+      represent 1-1/N.
+
+  semtech,cs0-prox-threshold:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [2, 4, 6, 8, 12, 16, 20, 24, 28, 32, 40,
+               48, 56, 64, 72, 80, 88, 96, 112, 128, 144,
+               160, 192, 224, 256, 320, 384, 512, 640,
+               768, 1024, 1536]
+    default: 12
+    description:
+      Proximity detection threshold for CS0 (and combined if any) sensor.
+
+  semtech,cs1-prox-threshold:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [2, 4, 6, 8, 12, 16, 20, 24, 28, 32, 40,
+               48, 56, 64, 72, 80, 88, 96, 112, 128, 144,
+               160, 192, 224, 256, 320, 384, 512, 640,
+               768, 1024, 1536]
+    default: 12
+    description:
+      Proximity detection threshold for CS1 sensor.
+
+  semtech,cs2-prox-threshold:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [2, 4, 6, 8, 12, 16, 20, 24, 28, 32, 40,
+               48, 56, 64, 72, 80, 88, 96, 112, 128, 144,
+               160, 192, 224, 256, 320, 384, 512, 640,
+               768, 1024, 1536]
+    default: 12
+    description:
+      Proximity detection threshold for CS2 sensor.
+
+  semtech,cs0-body-threshold:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 300, 600, 900, 1200, 1500, 1800, 30000]
+    default: 1800
+    description:
+      Body detection threshold for CS0 (and combined if any) sensor.
+
+  semtech,cs1-body-threshold:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 300, 600, 900, 1200, 1500, 1800, 30000]
+    default: 12
+    description:
+      Body detection threshold for CS1 sensor.
+
+  semtech,cs2-body-threshold:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 300, 600, 900, 1200, 1500, 1800, 30000]
+    default: 12
+    description:
+      Body detection threshold for CS2 sensor.
+
+  semtech,hysteresis:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 6, 12, 25]
+    default: 0
+    description:
+      The percentage of hysteresis +/- applied to proximity/body samples.
+
+  semtech,close-debounce-samples:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 2, 4, 8]
+    default: 0
+    description:
+      The number of close samples debounced for proximity/body thresholds.
+
+  semtech,far-debounce-samples:
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint32
+      - enum: [0, 2, 4, 8]
+    default: 0
+    description:
+      The number of far samples debounced for proximity/body thresholds.
+
 required:
   - compatible
   - reg
@@ -61,5 +224,24 @@ examples:
         vdd-supply = <&pp3300_a>;
         svdd-supply = <&pp1800_prox>;
         #io-channel-cells = <1>;
+        semtech,cs0-ground;
+        semtech,combined-sensors = <0>;
+        semtech,cs0-gain-factor = <8>;
+        semtech,cs1-gain-factor = <8>;
+        semtech,cs2-gain-factor = <8>;
+        semtech,resolution = "fine";
+        semtech,startup-sensor = <1>;
+        semtech,proxraw-strength = <2>;
+        semtech,compensate-common;
+        semtech,avg-pos-strength = <64>;
+        semtech,cs0-prox-threshold = <96>;
+        semtech,cs1-prox-threshold = <112>;
+        semtech,cs2-prox-threshold = <96>;
+        semtech,cs0-body-threshold = <300>;
+        semtech,cs1-body-threshold = <300>;
+        semtech,cs2-body-threshold = <300>;
+        semtech,hysteresis = <0>;
+        semtech,close-debounce-samples = <2>;
+        semtech,far-debounce-samples = <2>;
       };
     };

base-commit: 1bebdcb928eba880f3a119bacb8149216206958a
-- 
Sent by a computer, using git, on the internet


             reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 22:18 Stephen Boyd [this message]
2020-09-06 14:02 ` Jonathan Cameron
2020-09-09  6:18   ` Stephen Boyd
2020-09-09 11:15     ` Jonathan Cameron
2020-09-23 23:25       ` Stephen Boyd
2020-09-24  7:57         ` Stephen Boyd
2020-09-25 12:47           ` Jonathan Cameron
2020-09-25 12:46         ` Jonathan Cameron
2020-09-26  1:17       ` Stephen Boyd
2020-09-26 15:50         ` Jonathan Cameron
2020-09-14 21:00 ` Rob Herring
2020-09-22 21:43   ` Stephen Boyd

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=20200903221828.3657250-1-swboyd@chromium.org \
    --to=swboyd@chromium.org \
    --cc=campello@chromium.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --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

Linux-Devicetree Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-devicetree/0 linux-devicetree/git/0.git
	git clone --mirror https://lore.kernel.org/linux-devicetree/1 linux-devicetree/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-devicetree linux-devicetree/ https://lore.kernel.org/linux-devicetree \
		devicetree@vger.kernel.org
	public-inbox-index linux-devicetree

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-devicetree


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git