[PATCH V3 1/2] dt-bindings: iio: Add YAML to Awinic proximity sensor

From: wangshuaijie
Date: Fri Jul 12 2024 - 07:37:50 EST


From: shuaijie wang <wangshuaijie@xxxxxxxxxx>

Add the awinic,aw96xxx.yaml file to adapt to the awinic proximity sensor driver.
Addressing the issues raised in the previous version.
1. Add a description about the hardware device.
2. Remove inappropriate configuration items.
3. Modify the formatting issues.

Signed-off-by: shuaijie wang <wangshuaijie@xxxxxxxxxx>
---
.../iio/proximity/awinic,aw96xxx.yaml | 127 ++++++++++++++++++
1 file changed, 127 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/proximity/awinic,aw96xxx.yaml

diff --git a/Documentation/devicetree/bindings/iio/proximity/awinic,aw96xxx.yaml b/Documentation/devicetree/bindings/iio/proximity/awinic,aw96xxx.yaml
new file mode 100644
index 000000000000..459cb1644d3c
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/proximity/awinic,aw96xxx.yaml
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/awinic,aw96xxx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Awinic's AW96XXX capacitive proximity sensor
+
+maintainers:
+ - Shuaijie Wang <wangshuaijie@xxxxxxxxxx>
+
+description: |
+ Awinic's AW96XXX proximity sensor.
+ The specific absorption rate (SAR) is a metric that measures
+ the degree of absorption of electromagnetic radiation emitted by wireless
+ devices, such as mobile phones and tablets, by human tissue.
+ In mobile phone applications, the proximity sensor is primarily used to detect
+ the proximity of the human body to the phone. When the phone approaches the human body,
+ it will actively reduce the transmit power of the antenna to keep the SAR within a safe
+ range. Therefore, we also refer to the proximity sensor as a SAR sensor.
+
+properties:
+ compatible:
+ enum:
+ - awinic,aw96103
+ - awinic,aw96105
+ - awinic,aw96303
+ - awinic,aw96305
+ - awinic,aw96308
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ description:
+ Generated by the device to announce that a close/far
+ proximity event has happened.
+ maxItems: 1
+
+ awinic,sar-num:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Set the number of the SAR(Specific Absorption Rate) sensor.
+ It is set to 0 if one awinic sar chip is used.
+ If two awinic sar chips are used, awinic,sar-label in the first
+ awinic-sar should be set to 0 and awinic,sar-label in the second
+ awinic-sar should be set to 1.
+ In an application where a device utilizes multiple proximity sensors,
+ it is used to retrieve the names of the register configuration files
+ that the drivers need to load. For example: aw963xx_reg_0.bin/aw963xx_reg_1.bin
+
+ awinic,regulator-power-supply:
+ description:
+ Choose if you want to use a regulator to power the chip. Then the
+ vccX-supply has to be set.
+
+ vcc0-supply:
+ description:
+ Optional regulator for chip, 1.7V-3.6V.
+ If two awinic sar chips are used, the first regulator
+ should set the ID to vcc0-supply and the second regulator
+ should set the ID to vcc1-supply.
+
+ awinic,channel-use-mask:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ The mask of channels used.
+ Configure according to the specific chip channel used.
+ Bit[31:0] Each bit represents a channel.
+ If the customer uses ch0 and ch2, then channel_use_mask=<0x05>
+ For a 3-channel chip, the maximum value is 0x07;
+ For a 5-channel chip, the maximum value is 0x1F;
+ For a 8-channel chip, the maximum value is 0xFF;
+
+ awinic,monitor-esd:
+ type: boolean
+ description:
+ Choose if you want to monitor ESD.
+
+ awinic,pin-set-inter-pull-up:
+ type: boolean
+ description:
+ Choose if you want to set the interrupt pin to internal pull-up.
+
+ awinic,using-pm-ops:
+ type: boolean
+ description:
+ Choose if you want to change the chip mode on suppend and resume.
+
+ awinic,use-plug-cail:
+ type: boolean
+ description:
+ Choose If you want to perform calibration when plugging and unplugging the charger.
+
+ awinic,irq-mux:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [2, 5]
+ description:
+ You only need to set this configuration item if you are using AW96308 adn AW96305BFOR.
+ If CS2 is used as the interrupt pin, this item should be set to 2.
+ If CS5 is used as the interrupt pin, this item should be set to 5.
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - awinic,sar-num
+ - awinic,channel-use-mask
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ proximity@12 {
+ compatible = "awinic,aw96308";
+ reg = <0x12>;
+ interrupt-parent = <&gpio>;
+ interrupts = <23 IRQ_TYPE_EDGE_FALLING>;
+ awinic,sar-num = <0>;
+ awinic,channel-use-mask = <0xff>;
+ awinic,irq-mux = <2>;
+ };
+ };
--
2.45.1