mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yasin Lee <yasin.lee.x@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
	 Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	yasin.lee.x@outlook.com
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, Yasin Lee <yasin.lee.x@gmail.com>
Subject: [PATCH v3 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration
Date: Thu, 17 Oct 2024 18:36:44 +0800	[thread overview]
Message-ID: <20241017-add-performance-tuning-configuration-v3-1-e7289791f523@gmail.com> (raw)
In-Reply-To: <20241017-add-performance-tuning-configuration-v3-0-e7289791f523@gmail.com>

When hardware design introduces significant sensor data noise,
performance can be improved by adjusting register settings.

Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
---
 .../bindings/iio/proximity/tyhx,hx9023s.yaml       | 195 +++++++++++++++++++++
 1 file changed, 195 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml b/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
index 64ce8bc8bd36..af419a3335eb 100644
--- a/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
+++ b/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
@@ -28,6 +28,189 @@ properties:
 
   vdd-supply: true
 
+  tyhx,dither:
+    description: Enable spread spectrum function.
+    type: boolean
+
+  tyhx,chop:
+    description: Enable chop function.
+    type: boolean
+
+  tyhx,odr:
+    description: |
+      Defines the sensor scanning period. The values range from 0x00 to 0x1F,
+      corresponding to the following periods.
+      Val: Period
+      0x00: Min (no idle time)
+      0x01: 2 ms
+      0x02: 4 ms
+      0x03: 6 ms
+      0x04: 8 ms
+      0x05: 10 ms
+      0x06: 14 ms
+      0x07: 18 ms
+      0x08: 22 ms
+      0x09: 26 ms
+      0x0A: 30 ms
+      0x0B: 34 ms
+      0x0C: 38 ms
+      0x0D: 42 ms
+      0x0E: 46 ms
+      0x0F: 50 ms
+      0x10: 56 ms
+      0x11: 62 ms
+      0x12: 68 ms
+      0x13: 74 ms
+      0x14: 80 ms
+      0x15: 90 ms
+      0x16: 100 ms
+      0x17: 200 ms
+      0x18: 300 ms
+      0x19: 400 ms
+      0x1A: 600 ms
+      0x1B: 800 ms
+      0x1C: 1000 ms
+      0x1D: 2000 ms
+      0x1E: 3000 ms
+      0x1F: 4000 ms
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0x00
+    maximum: 0x1F
+
+  tyhx,range:
+    description: |
+      Defines the full-scale range for each channel.
+      The values correspond to the following full-scale ranges.
+      Val: Full Scale
+      0x0: 1.25pF
+      0x1: 2.5pF
+      0x2: 3.75pF
+      0x3: 5pF
+      0x4: 0.625pF
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 5
+    maxItems: 5
+
+  tyhx,avg:
+    description: |
+      Defines the ADC averaging value for each channel.
+      The values correspond to the following averages.
+      Val: Avg Number
+      0x0: 1
+      0x1: 2
+      0x2: 4
+      0x3: 8
+      0x4: 16
+      0x5: 32
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 5
+    maxItems: 5
+
+  tyhx,osr:
+    description: |
+      Defines the ADC oversampling rate (OSR) for each channel.
+      The values correspond to the following OSR.
+      Val: OSR
+      0x0: 16
+      0x1: 32
+      0x2: 64
+      0x3: 128
+      0x4: 256
+      0x5: 512
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 5
+    maxItems: 5
+
+  tyhx,sample-num:
+    description: |
+      Defines the ADC sample frequency.
+      The sample frequency can be calculated with the following formula:
+      Fsample = 1.0 / ( sample_num * 200ns ),
+      where `sample_num` is the value in the register in decimal.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0x00
+    maximum: 0xFF
+
+  tyhx,integration-num:
+    description: The integration number should be the same as the `sample-num` above.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0x00
+    maximum: 0xFF
+
+  tyhx,lp-alpha:
+    description: |
+      Defines the coefficient for the first-order low pass filter for each channel.
+      The values correspond to the following coefficients.
+      Val: Coefficient
+      0x0: 1
+      0x1: 1/2
+      0x2: 1/4
+      0x3: 1/8
+      0x4: 1/16
+      0x5: 1/32
+      0x6: 1/64
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 5
+    maxItems: 5
+
+  tyhx,bl-up-alpha:
+    description: |
+      Defines the up coefficient of the first-order low pass filter for each channel.
+      The values correspond to the following coefficients.
+      Val: Coefficient
+      0x0: 0
+      0x1: 1
+      0x2: 1/2
+      0x3: 1/4
+      0x4: 1/8
+      0x5: 1/16
+      0x6: 1/32
+      0x7: 1/64
+      0x8: 1/128
+      0x9: 1/256
+      0xA: 1/512
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 5
+    maxItems: 5
+
+  tyhx,bl-down-alpha:
+    description: |
+      Defines the down coefficient of the first-order low pass filter for each channel.
+      The values correspond to the following coefficients.
+      Val: Coefficient
+      0x0: 0
+      0x1: 1
+      0x2: 1/2
+      0x3: 1/4
+      0x4: 1/8
+      0x5: 1/16
+      0x6: 1/32
+      0x7: 1/64
+      0x8: 1/128
+      0x9: 1/256
+      0xA: 1/512
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 5
+    maxItems: 5
+
+  tyhx,drdy-interrupt:
+    description: Enable the interrupt function of each channel when the conversion is ready.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0x00
+    maximum: 0x1F
+
+  tyhx,int-high-num:
+    description: Defines the Proximity persistency number (Near).
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0x1
+    maximum: 0xF
+
+  tyhx,int-low-num:
+    description: Defines the Proximity persistency number (Far).
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0x1
+    maximum: 0xF
+
   "#address-cells":
     const: 1
 
@@ -65,6 +248,18 @@ examples:
         interrupt-parent = <&pio>;
         interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
         vdd-supply = <&pp1800_prox>;
+        tyhx,odr = <0x17>;
+        tyhx,range = <0x4 0x4 0x4 0x4 0x4>;
+        tyhx,avg = <0x3 0x3 0x3 0x0 0x0>;
+        tyhx,osr = <0x4 0x4 0x4 0x0 0x0>;
+        tyhx,sample-num = <0x65>;
+        tyhx,integration-num = <0x65>;
+        tyhx,lp-alpha = <0x2 0x2 0x2 0x2 0x2>;
+        tyhx,bl-up-alpha = <0x8 0x8 0x8 0x8 0x8>;
+        tyhx,bl-down-alpha = <0x1 0x1 0x1 0x1 0x1>;
+        tyhx,drdy-interrupt = <0x1F>;
+        tyhx,int-high-num = <0x1>;
+        tyhx,int-low-num = <0x1>;
 
         #address-cells = <1>;
         #size-cells = <0>;

-- 
2.43.0


  reply	other threads:[~2024-10-17 10:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 10:36 [PATCH v3 0/2] iio: proximity: hx9023s: Add performance tuning function Yasin Lee
2024-10-17 10:36 ` Yasin Lee [this message]
2024-10-20 13:06   ` [PATCH v3 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration Jonathan Cameron
2024-11-14 15:16     ` Yasin Lee
2024-11-23 13:21       ` Jonathan Cameron
2024-11-26  8:40         ` Yasin Lee
2024-10-17 10:36 ` [PATCH v3 2/2] iio: proximity: hx9023s: Add performance tuning function Yasin Lee
2024-10-20 13:07   ` 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=20241017-add-performance-tuning-configuration-v3-1-e7289791f523@gmail.com \
    --to=yasin.lee.x@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=yasin.lee.x@outlook.com \
    /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

all inboxes | Powered by JetHome®