Skip to contentSkip to conversation

media: rc: make scancodes 64 bit

PATCH Superseded Sean Young 1 participant 1 message Jan 28, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sean Young

author maintainer
#0 lore raw

PATCH 1/1 media: rc: make scancodes 64 bit

There are many protocols that encode more than 32 bit. We want 64 bit support so that BPF IR decoders can decode more than 32 bit. None of the existing kernel IR decoders/encoders support 64 bit, for now.

---
 drivers/media/rc/bpf-lirc.c |  5 ---
 drivers/media/rc/lirc_dev.c |  5 +--
 drivers/media/rc/rc-main.c  | 66 +++++++++++++++++++++++++++----------
 include/media/rc-core.h     |  8 ++---
 include/media/rc-map.h      |  2 +-
 5 files changed, 55 insertions(+), 31 deletions(-)
drivers/media/rc/bpf-lirc.c +0 -5
index 0a0ce620e4a2..0f3417d161b8 100644
@@ -35,11 +35,6 @@ static const struct bpf_func_proto rc_repeat_proto = {
 	.arg1_type = ARG_PTR_TO_CTX,
 };
 
-/*
- * Currently rc-core does not support 64-bit scancodes, but there are many
- * known protocols with more than 32 bits. So, define the interface as u64
- * as a future-proof.
- */
 BPF_CALL_4(bpf_rc_keydown, u32*, sample, u32, protocol, u64, scancode,
 	   u32, toggle)
 {
drivers/media/rc/lirc_dev.c +1 -4
index 9a8c1cf54ac4..b0a55d1430cc 100644
@@ -270,10 +270,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
 		}
 
 		/*
-		 * The scancode field in lirc_scancode is 64-bit simply
-		 * to future-proof it, since there are IR protocols encode
-		 * use more than 32 bits. For now only 32-bit protocols
-		 * are supported.
+		 * For now, we can only encode 32-bit protocols.
 		 */
 		if (scan.scancode > U32_MAX ||
 		    !rc_validate_scancode(scan.rc_proto, scan.scancode)) {
drivers/media/rc/rc-main.c +49 -17

162 lines not on this page · raw message

include/media/rc-core.h +4 -4
index 1f695d9c200a..d3f85df64bb2 100644
@@ -192,7 +192,7 @@ struct rc_dev {
 	struct timer_list		timer_repeat;
 	u32				last_keycode;
 	enum rc_proto			last_protocol;
-	u32				last_scancode;
+	u64				last_scancode;
 	u8				last_toggle;
 	u32				timeout;
 	u32				min_timeout;
@@ -284,12 +284,12 @@ int devm_rc_register_device(struct device *parent, struct rc_dev *dev);
 void rc_unregister_device(struct rc_dev *dev);
 
 void rc_repeat(struct rc_dev *dev);
-void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u32 scancode,
+void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u64 scancode,
 		u8 toggle);
 void rc_keydown_notimeout(struct rc_dev *dev, enum rc_proto protocol,
-			  u32 scancode, u8 toggle);
+			  u64 scancode, u8 toggle);
 void rc_keyup(struct rc_dev *dev);
-u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode);
+u32 rc_g_keycode_from_table(struct rc_dev *dev, u64 scancode);
 
 /*
  * From rc-raw.c
include/media/rc-map.h +1 -1
index d22810dcd85c..0a9142fa3c80 100644
@@ -90,7 +90,7 @@
  */
 struct rc_map_table {
 	u32	scancode;
-	u32	keycode;
+	u64	keycode;
 };
 
 /**
Signature · 1 line
2.24.1