v4l-utils: sync with latest media staging tree

This merges the latest lirc.h changes.

Signed-off-by: Sean Young <sean@mess.org>
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 0c3a514..af474c4 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1342,8 +1342,10 @@
 			/* or valid module BTF object fd or 0 to attach to vmlinux */
 			__u32		attach_btf_obj_fd;
 		};
-		__u32		:32;		/* pad */
+		__u32		core_relo_cnt;	/* number of bpf_core_relo */
 		__aligned_u64	fd_array;	/* array of FDs */
+		__aligned_u64	core_relos;
+		__u32		core_relo_rec_size; /* sizeof(struct bpf_core_relo) */
 	};
 
 	struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -1744,7 +1746,7 @@
  * 		if the maximum number of tail calls has been reached for this
  * 		chain of programs. This limit is defined in the kernel by the
  * 		macro **MAX_TAIL_CALL_CNT** (not accessible to user space),
- * 		which is currently set to 32.
+ *		which is currently set to 33.
  * 	Return
  * 		0 on success, or a negative error in case of failure.
  *
@@ -4938,6 +4940,84 @@
  *		**-ENOENT** if symbol is not found.
  *
  *		**-EPERM** if caller does not have permission to obtain kernel address.
+ *
+ * long bpf_find_vma(struct task_struct *task, u64 addr, void *callback_fn, void *callback_ctx, u64 flags)
+ *	Description
+ *		Find vma of *task* that contains *addr*, call *callback_fn*
+ *		function with *task*, *vma*, and *callback_ctx*.
+ *		The *callback_fn* should be a static function and
+ *		the *callback_ctx* should be a pointer to the stack.
+ *		The *flags* is used to control certain aspects of the helper.
+ *		Currently, the *flags* must be 0.
+ *
+ *		The expected callback signature is
+ *
+ *		long (\*callback_fn)(struct task_struct \*task, struct vm_area_struct \*vma, void \*callback_ctx);
+ *
+ *	Return
+ *		0 on success.
+ *		**-ENOENT** if *task->mm* is NULL, or no vma contains *addr*.
+ *		**-EBUSY** if failed to try lock mmap_lock.
+ *		**-EINVAL** for invalid **flags**.
+ *
+ * long bpf_loop(u32 nr_loops, void *callback_fn, void *callback_ctx, u64 flags)
+ *	Description
+ *		For **nr_loops**, call **callback_fn** function
+ *		with **callback_ctx** as the context parameter.
+ *		The **callback_fn** should be a static function and
+ *		the **callback_ctx** should be a pointer to the stack.
+ *		The **flags** is used to control certain aspects of the helper.
+ *		Currently, the **flags** must be 0. Currently, nr_loops is
+ *		limited to 1 << 23 (~8 million) loops.
+ *
+ *		long (\*callback_fn)(u32 index, void \*ctx);
+ *
+ *		where **index** is the current index in the loop. The index
+ *		is zero-indexed.
+ *
+ *		If **callback_fn** returns 0, the helper will continue to the next
+ *		loop. If return value is 1, the helper will skip the rest of
+ *		the loops and return. Other return values are not used now,
+ *		and will be rejected by the verifier.
+ *
+ *	Return
+ *		The number of loops performed, **-EINVAL** for invalid **flags**,
+ *		**-E2BIG** if **nr_loops** exceeds the maximum number of loops.
+ *
+ * long bpf_strncmp(const char *s1, u32 s1_sz, const char *s2)
+ *	Description
+ *		Do strncmp() between **s1** and **s2**. **s1** doesn't need
+ *		to be null-terminated and **s1_sz** is the maximum storage
+ *		size of **s1**. **s2** must be a read-only string.
+ *	Return
+ *		An integer less than, equal to, or greater than zero
+ *		if the first **s1_sz** bytes of **s1** is found to be
+ *		less than, to match, or be greater than **s2**.
+ *
+ * long bpf_get_func_arg(void *ctx, u32 n, u64 *value)
+ *	Description
+ *		Get **n**-th argument (zero based) of the traced function (for tracing programs)
+ *		returned in **value**.
+ *
+ *	Return
+ *		0 on success.
+ *		**-EINVAL** if n >= arguments count of traced function.
+ *
+ * long bpf_get_func_ret(void *ctx, u64 *value)
+ *	Description
+ *		Get return value of the traced function (for tracing programs)
+ *		in **value**.
+ *
+ *	Return
+ *		0 on success.
+ *		**-EOPNOTSUPP** for tracing programs other than BPF_TRACE_FEXIT or BPF_MODIFY_RETURN.
+ *
+ * long bpf_get_func_arg_cnt(void *ctx)
+ *	Description
+ *		Get number of arguments of the traced function (for tracing programs).
+ *
+ *	Return
+ *		The number of arguments of the traced function.
  */
 #define __BPF_FUNC_MAPPER(FN)		\
 	FN(unspec),			\
@@ -5120,6 +5200,12 @@
 	FN(trace_vprintk),		\
 	FN(skc_to_unix_sock),		\
 	FN(kallsyms_lookup_name),	\
+	FN(find_vma),			\
+	FN(loop),			\
+	FN(strncmp),			\
+	FN(get_func_arg),		\
+	FN(get_func_ret),		\
+	FN(get_func_arg_cnt),		\
 	/* */
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
@@ -6296,6 +6382,7 @@
 	__u32 local_ip4;	/* Network byte order */
 	__u32 local_ip6[4];	/* Network byte order */
 	__u32 local_port;	/* Host byte order */
+	__u32 ingress_ifindex;		/* The arriving interface. Determined by inet_iif. */
 };
 
 /*
@@ -6328,4 +6415,78 @@
 	BTF_F_ZERO	=	(1ULL << 3),
 };
 
+/* bpf_core_relo_kind encodes which aspect of captured field/type/enum value
+ * has to be adjusted by relocations. It is emitted by llvm and passed to
+ * libbpf and later to the kernel.
+ */
+enum bpf_core_relo_kind {
+	BPF_CORE_FIELD_BYTE_OFFSET = 0,      /* field byte offset */
+	BPF_CORE_FIELD_BYTE_SIZE = 1,        /* field size in bytes */
+	BPF_CORE_FIELD_EXISTS = 2,           /* field existence in target kernel */
+	BPF_CORE_FIELD_SIGNED = 3,           /* field signedness (0 - unsigned, 1 - signed) */
+	BPF_CORE_FIELD_LSHIFT_U64 = 4,       /* bitfield-specific left bitshift */
+	BPF_CORE_FIELD_RSHIFT_U64 = 5,       /* bitfield-specific right bitshift */
+	BPF_CORE_TYPE_ID_LOCAL = 6,          /* type ID in local BPF object */
+	BPF_CORE_TYPE_ID_TARGET = 7,         /* type ID in target kernel */
+	BPF_CORE_TYPE_EXISTS = 8,            /* type existence in target kernel */
+	BPF_CORE_TYPE_SIZE = 9,              /* type size in bytes */
+	BPF_CORE_ENUMVAL_EXISTS = 10,        /* enum value existence in target kernel */
+	BPF_CORE_ENUMVAL_VALUE = 11,         /* enum value integer value */
+};
+
+/*
+ * "struct bpf_core_relo" is used to pass relocation data form LLVM to libbpf
+ * and from libbpf to the kernel.
+ *
+ * CO-RE relocation captures the following data:
+ * - insn_off - instruction offset (in bytes) within a BPF program that needs
+ *   its insn->imm field to be relocated with actual field info;
+ * - type_id - BTF type ID of the "root" (containing) entity of a relocatable
+ *   type or field;
+ * - access_str_off - offset into corresponding .BTF string section. String
+ *   interpretation depends on specific relocation kind:
+ *     - for field-based relocations, string encodes an accessed field using
+ *       a sequence of field and array indices, separated by colon (:). It's
+ *       conceptually very close to LLVM's getelementptr ([0]) instruction's
+ *       arguments for identifying offset to a field.
+ *     - for type-based relocations, strings is expected to be just "0";
+ *     - for enum value-based relocations, string contains an index of enum
+ *       value within its enum type;
+ * - kind - one of enum bpf_core_relo_kind;
+ *
+ * Example:
+ *   struct sample {
+ *       int a;
+ *       struct {
+ *           int b[10];
+ *       };
+ *   };
+ *
+ *   struct sample *s = ...;
+ *   int *x = &s->a;     // encoded as "0:0" (a is field #0)
+ *   int *y = &s->b[5];  // encoded as "0:1:0:5" (anon struct is field #1,
+ *                       // b is field #0 inside anon struct, accessing elem #5)
+ *   int *z = &s[10]->b; // encoded as "10:1" (ptr is used as an array)
+ *
+ * type_id for all relocs in this example will capture BTF type id of
+ * `struct sample`.
+ *
+ * Such relocation is emitted when using __builtin_preserve_access_index()
+ * Clang built-in, passing expression that captures field address, e.g.:
+ *
+ * bpf_probe_read(&dst, sizeof(dst),
+ *		  __builtin_preserve_access_index(&src->a.b.c));
+ *
+ * In this case Clang will emit field relocation recording necessary data to
+ * be able to find offset of embedded `a.b.c` field within `src` struct.
+ *
+ * [0] https://llvm.org/docs/LangRef.html#getelementptr-instruction
+ */
+struct bpf_core_relo {
+	__u32 insn_off;
+	__u32 type_id;
+	__u32 access_str_off;
+	enum bpf_core_relo_kind kind;
+};
+
 #endif /* __LINUX_BPF_H__ */
diff --git a/include/linux/lirc.h b/include/linux/lirc.h
index 9919f20..21c69a6 100644
--- a/include/linux/lirc.h
+++ b/include/linux/lirc.h
@@ -16,14 +16,16 @@
 #define LIRC_MODE2_PULSE     0x01000000
 #define LIRC_MODE2_FREQUENCY 0x02000000
 #define LIRC_MODE2_TIMEOUT   0x03000000
+#define LIRC_MODE2_OVERFLOW  0x04000000
 
 #define LIRC_VALUE_MASK      0x00FFFFFF
 #define LIRC_MODE2_MASK      0xFF000000
 
-#define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE)
-#define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE)
-#define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY)
-#define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT)
+#define LIRC_SPACE(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_SPACE)
+#define LIRC_PULSE(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_PULSE)
+#define LIRC_FREQUENCY(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY)
+#define LIRC_TIMEOUT(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT)
+#define LIRC_OVERFLOW(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_OVERFLOW)
 
 #define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK)
 #define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK)
@@ -32,6 +34,7 @@
 #define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE)
 #define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY)
 #define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT)
+#define LIRC_IS_OVERFLOW(val) (LIRC_MODE2(val) == LIRC_MODE2_OVERFLOW)
 
 /* used heavily by lirc userspace */
 #define lirc_t int
@@ -72,11 +75,9 @@
 #define LIRC_CAN_SET_REC_CARRIER       (LIRC_CAN_SET_SEND_CARRIER << 16)
 #define LIRC_CAN_SET_REC_DUTY_CYCLE    (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16)
 
-#define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000
 #define LIRC_CAN_SET_REC_CARRIER_RANGE    0x80000000
 #define LIRC_CAN_GET_REC_RESOLUTION       0x20000000
 #define LIRC_CAN_SET_REC_TIMEOUT          0x10000000
-#define LIRC_CAN_SET_REC_FILTER           0x08000000
 
 #define LIRC_CAN_MEASURE_CARRIER          0x02000000
 #define LIRC_CAN_USE_WIDEBAND_RECEIVER    0x04000000
@@ -84,8 +85,6 @@
 #define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
 #define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
 
-#define LIRC_CAN_NOTIFY_DECODE            0x01000000
-
 /*** IOCTL commands for lirc driver ***/
 
 #define LIRC_GET_FEATURES              _IOR('i', 0x00000000, __u32)
diff --git a/utils/keytable/rc_keymaps/ct_90405.toml b/utils/keytable/rc_keymaps/ct_90405.toml
new file mode 100644
index 0000000..116f1ae
--- /dev/null
+++ b/utils/keytable/rc_keymaps/ct_90405.toml
@@ -0,0 +1,55 @@
+# Generated with gen_keytables.pl from drivers/media/rc/keymaps/rc-ct-90405.c
+[[protocols]]
+name = "ct_90405"
+protocol = "nec"
+variant = "nec"
+[protocols.scancodes]
+0x4014 = "KEY_SWITCHVIDEOMODE"
+0x4012 = "KEY_POWER"
+0x4044 = "KEY_TV"
+0x40be43 = "KEY_3D_MODE"
+0x400c = "KEY_SUBTITLE"
+0x4001 = "KEY_NUMERIC_1"
+0x4002 = "KEY_NUMERIC_2"
+0x4003 = "KEY_NUMERIC_3"
+0x4004 = "KEY_NUMERIC_4"
+0x4005 = "KEY_NUMERIC_5"
+0x4006 = "KEY_NUMERIC_6"
+0x4007 = "KEY_NUMERIC_7"
+0x4008 = "KEY_NUMERIC_8"
+0x4009 = "KEY_NUMERIC_9"
+0x4062 = "KEY_AUDIO_DESC"
+0x4000 = "KEY_NUMERIC_0"
+0x401a = "KEY_VOLUMEUP"
+0x401e = "KEY_VOLUMEDOWN"
+0x4016 = "KEY_INFO"
+0x4010 = "KEY_MUTE"
+0x401b = "KEY_CHANNELUP"
+0x401f = "KEY_CHANNELDOWN"
+0x40da = "KEY_VENDOR"
+0x4066 = "KEY_PLAYER"
+0x4017 = "KEY_TEXT"
+0x4047 = "KEY_LIST"
+0x4073 = "KEY_PAGEUP"
+0x4045 = "KEY_PROGRAM"
+0x4043 = "KEY_EXIT"
+0x4074 = "KEY_PAGEDOWN"
+0x4064 = "KEY_BACK"
+0x405b = "KEY_MENU"
+0x4019 = "KEY_UP"
+0x4040 = "KEY_RIGHT"
+0x401d = "KEY_DOWN"
+0x4042 = "KEY_LEFT"
+0x4021 = "KEY_OK"
+0x4053 = "KEY_REWIND"
+0x4067 = "KEY_PLAY"
+0x400d = "KEY_FASTFORWARD"
+0x4054 = "KEY_PREVIOUS"
+0x4068 = "KEY_STOP"
+0x406a = "KEY_PAUSE"
+0x4015 = "KEY_NEXT"
+0x4048 = "KEY_RED"
+0x4049 = "KEY_GREEN"
+0x404a = "KEY_YELLOW"
+0x404b = "KEY_BLUE"
+0x406f = "KEY_RECORD"
diff --git a/utils/keytable/rc_keymaps/mecool_kii_pro.toml b/utils/keytable/rc_keymaps/mecool_kii_pro.toml
new file mode 100644
index 0000000..bb68b05
--- /dev/null
+++ b/utils/keytable/rc_keymaps/mecool_kii_pro.toml
@@ -0,0 +1,51 @@
+# Generated with gen_keytables.pl from drivers/media/rc/keymaps/rc-mecool-kii-pro.c
+[[protocols]]
+name = "mecool_kii_pro"
+protocol = "nec"
+variant = "nec"
+[protocols.scancodes]
+0x59 = "KEY_POWER"
+0x19 = "KEY_MUTE"
+0x42 = "KEY_RED"
+0x40 = "KEY_GREEN"
+0x00 = "KEY_YELLOW"
+0x03 = "KEY_BLUE"
+0x4a = "KEY_REWIND"
+0x48 = "KEY_FORWARD"
+0x08 = "KEY_PREVIOUSSONG"
+0x0b = "KEY_NEXTSONG"
+0x46 = "KEY_PLAYPAUSE"
+0x44 = "KEY_STOP"
+0x1f = "KEY_FAVORITES"
+0x04 = "KEY_PVR"
+0x4d = "KEY_EPG"
+0x02 = "KEY_INFO"
+0x09 = "KEY_SUBTITLE"
+0x01 = "KEY_LANGUAGE"
+0x0d = "KEY_HOME"
+0x11 = "KEY_TV"
+0x45 = "KEY_MENU"
+0x05 = "KEY_EXIT"
+0x5a = "KEY_LEFT"
+0x1b = "KEY_RIGHT"
+0x06 = "KEY_UP"
+0x16 = "KEY_DOWN"
+0x1a = "KEY_OK"
+0x13 = "KEY_VOLUMEUP"
+0x17 = "KEY_VOLUMEDOWN"
+0x58 = "KEY_APPSELECT"
+0x12 = "KEY_CONTEXT_MENU"
+0x55 = "KEY_CHANNELUP"
+0x15 = "KEY_CHANNELDOWN"
+0x52 = "KEY_1"
+0x50 = "KEY_2"
+0x10 = "KEY_3"
+0x56 = "KEY_4"
+0x54 = "KEY_5"
+0x14 = "KEY_6"
+0x4e = "KEY_7"
+0x4c = "KEY_8"
+0x0c = "KEY_9"
+0x18 = "KEY_WWW"
+0x0f = "KEY_0"
+0x51 = "KEY_DELETE"
diff --git a/utils/keytable/rc_keymaps/mecool_kiii_pro.toml b/utils/keytable/rc_keymaps/mecool_kiii_pro.toml
new file mode 100644
index 0000000..b52a7ac
--- /dev/null
+++ b/utils/keytable/rc_keymaps/mecool_kiii_pro.toml
@@ -0,0 +1,49 @@
+# Generated with gen_keytables.pl from drivers/media/rc/keymaps/rc-mecool-kiii-pro.c
+[[protocols]]
+name = "mecool_kiii_pro"
+protocol = "nec"
+variant = "nec"
+[protocols.scancodes]
+0x59 = "KEY_POWER"
+0x52 = "KEY_1"
+0x50 = "KEY_2"
+0x10 = "KEY_3"
+0x56 = "KEY_4"
+0x54 = "KEY_5"
+0x14 = "KEY_6"
+0x4e = "KEY_7"
+0x4c = "KEY_8"
+0x0c = "KEY_9"
+0x02 = "KEY_INFO"
+0x0f = "KEY_0"
+0x51 = "KEY_DELETE"
+0x1f = "KEY_FAVORITES"
+0x09 = "KEY_SUBTITLE"
+0x01 = "KEY_LANGUAGE"
+0x42 = "KEY_RED"
+0x40 = "KEY_GREEN"
+0x00 = "KEY_YELLOW"
+0x03 = "KEY_BLUE"
+0x0d = "KEY_HOME"
+0x4d = "KEY_EPG"
+0x45 = "KEY_MENU"
+0x05 = "KEY_EXIT"
+0x5a = "KEY_LEFT"
+0x1b = "KEY_RIGHT"
+0x06 = "KEY_UP"
+0x16 = "KEY_DOWN"
+0x1a = "KEY_OK"
+0x13 = "KEY_VOLUMEUP"
+0x17 = "KEY_VOLUMEDOWN"
+0x19 = "KEY_MUTE"
+0x12 = "KEY_CONTEXT_MENU"
+0x55 = "KEY_CHANNELUP"
+0x15 = "KEY_CHANNELDOWN"
+0x4a = "KEY_REWIND"
+0x48 = "KEY_FORWARD"
+0x46 = "KEY_PLAYPAUSE"
+0x44 = "KEY_STOP"
+0x08 = "KEY_PREVIOUSSONG"
+0x0b = "KEY_NEXTSONG"
+0x04 = "KEY_PVR"
+0x64 = "KEY_RECORD"