diff mbox series

media: rc: gpio-ir-recv: add recorder timeout property

Message ID 20201104112536.GA394971@a98shuttle.de (mailing list archive)
State New, archived
Headers show
Series media: rc: gpio-ir-recv: add recorder timeout property | expand

Commit Message

Michael Klein Nov. 4, 2020, 11:25 a.m. UTC
This optional property allows to set the recorder timeout via the
devicetree:

- linux,timeout-us: set the length of a space at which
   the recorder goes idle, specified in microseconds.

Signed-off-by: Michael Klein <michael@fossekall.de>
---
  .../devicetree/bindings/media/gpio-ir-receiver.txt          | 3 +++
  Documentation/devicetree/bindings/media/rc.yaml             | 6 ++++++
  drivers/media/rc/gpio-ir-recv.c                             | 4 +++-
  3 files changed, 12 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/media/gpio-ir-receiver.txt b/Documentation/devicetree/bindings/media/gpio-ir-receiver.txt
index 108bf435b933..7aef3fe78322 100644
--- a/Documentation/devicetree/bindings/media/gpio-ir-receiver.txt
+++ b/Documentation/devicetree/bindings/media/gpio-ir-receiver.txt
@@ -9,6 +9,8 @@  Optional properties:
  	  directory.
  	- linux,autosuspend-period: autosuspend delay time,
  	  the unit is milisecond.
+	- linux,timeout-us: set the length of a space at which
+	  the recorder goes idle, specified in microseconds.
  
  Example node:
  
@@ -17,4 +19,5 @@  Example node:
  		gpios = <&gpio0 19 1>;
  		linux,rc-map-name = "rc-rc6-mce";
  		linux,autosuspend-period = <125>;
+		linux,timeout-us = <125000>;
  	};
diff --git a/Documentation/devicetree/bindings/media/rc.yaml b/Documentation/devicetree/bindings/media/rc.yaml
index 8ad2cba5f61f..1f3e208a50a1 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -151,4 +151,10 @@  properties:
        - rc-xbox-dvd
        - rc-zx-irdec
  
+  linux,timeout-us:
+    description:
+      Set the length of a space at which the recorder goes idle, specified in
+      microseconds.
+    $ref: '/schemas/types.yaml#/definitions/uint32'
+
  additionalProperties: true
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 22e524b69806..a328b51a53c1 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -99,7 +99,9 @@  static int gpio_ir_recv_probe(struct platform_device *pdev)
  	rcdev->dev.parent = dev;
  	rcdev->driver_name = KBUILD_MODNAME;
  	rcdev->min_timeout = 1;
-	rcdev->timeout = IR_DEFAULT_TIMEOUT;
+	if (of_property_read_u32(np, "linux,timeout-us", &rcdev->timeout)) {
+		rcdev->timeout = IR_DEFAULT_TIMEOUT;
+	}
  	rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
  	rcdev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
  	rcdev->map_name = of_get_property(np, "linux,rc-map-name", NULL);