diff mbox series

[v4,1/2] media: rc: meson-ir-tx: document device tree bindings

Message ID 20210712201732.31808-2-viktor.prutyanov@phystech.edu (mailing list archive)
State Superseded
Headers show
Series media: rc: add support for Amlogic Meson IR blaster | expand

Commit Message

Viktor Prutyanov July 12, 2021, 8:17 p.m. UTC
This patch adds binding documentation for the IR transmitter
available in Amlogic Meson SoCs.

Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
---
 changes in v2:
   - compatible = "amlogic,meson-g12a-irblaster" added
   - clocks, clock-names and mod-clock updated
 changes in v3:
   - mod-clock removed
   - max-fifo-level added
 changes in v4:
   - irblaster -> ir-tx renaming

 .../bindings/media/amlogic,meson-ir-tx.yaml   | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/amlogic,meson-ir-tx.yaml

Comments

Martin Blumenstingl July 13, 2021, 2:53 p.m. UTC | #1
Hi Viktor,

On Mon, Jul 12, 2021 at 10:17 PM Viktor Prutyanov
<viktor.prutyanov@phystech.edu> wrote:
[...]
> +  max-fifo-level:
> +    maxItems: 1
> +    description:
> +      Maximum IR TX FIFO fill level
From Documentation/devicetree/bindings/writing-bindings.rst:
"DO use a vendor prefix on device specific property names. Consider if
properties could be common among devices of the same class. Check
other existing bindings for similar devices."
I am not sure if there's a "common" fifo size property for IR
transmitters though.

Also in general I think it's good to write the schema for properties
in a way so the binding validation can detect issues.
For "common" properties (like clocks, interrupts, etc.) this is
inherited by default
However, for custom properties this needs to be defined manually.
For this property I would add:
  $ref: /schemas/types.yaml#/definitions/uint32
(I think this can replace maxItems)
And I would define the allowed value, from what I have seen in the
vendor driver (which I am not sure about though!) that would be:
  const: 1024


Best regards,
Martin
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/media/amlogic,meson-ir-tx.yaml b/Documentation/devicetree/bindings/media/amlogic,meson-ir-tx.yaml
new file mode 100644
index 000000000000..f9f20e30be2f
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/amlogic,meson-ir-tx.yaml
@@ -0,0 +1,65 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/media/amlogic,meson-ir-tx.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Amlogic Meson IR transmitter
+
+maintainers:
+  - Viktor Prutyanov <viktor.prutyanov@phystech.edu>
+
+description: |
+  Some Amlogic SoCs such as A311D and T950D4 have IR transmitter
+  (also called blaster) controller onboard. It is capable of
+  sending IR signals with arbitrary carrier frequency and duty cycle.
+
+properties:
+  compatible:
+    oneOf:
+      - const: amlogic,meson-ir-tx
+      - items:
+          - const: amlogic,meson-g12a-ir-tx
+          - const: amlogic,meson-ir-tx
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: sysclk
+      - const: xtal
+
+  max-fifo-level:
+    maxItems: 1
+    description:
+      Maximum IR TX FIFO fill level
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/clock/g12a-clkc.h>
+
+    ir@ff80014c {
+      compatible = "amlogic,meson-g12a-ir-tx", "amlogic,meson-ir-tx";
+      reg = <0xff80014c 0x10>;
+      interrupts = <0 198 IRQ_TYPE_EDGE_RISING>;
+      clocks = <&clkc CLKID_CLK81>, <&xtal>;
+      clock-names = "sysclk", "xtal";
+    };