Skip to contentSkip to conversation

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

PATCH Superseded Michael Klein 1 participant 1 message Nov 4, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: rc: gpio-ir-recv: add recorder timeout property

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.

---
 .../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(-)
Documentation/devicetree/bindings/media/gpio-ir-receiver.txt +3 -0
index 108bf435b933..7aef3fe78322 100644
@@ -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>;
 	};
Documentation/devicetree/bindings/media/rc.yaml +6 -0
index 8ad2cba5f61f..1f3e208a50a1 100644
@@ -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
drivers/media/rc/gpio-ir-recv.c +3 -1
index 22e524b69806..a328b51a53c1 100644
@@ -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);
Signature · 1 line
2.28.0