Lakka-LibreELEC/projects/Amlogic/devices/AMLGX/patches/linux/amlogic-0066-WIP-media-rc-add-keymap-for-MeCool-M8S-Pro-W-remote.patch
2023-01-16 08:26:11 +00:00

138 lines
4.2 KiB
Diff

From 4193b220c01c63ace1e117133388f5e13a2365d0 Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Sun, 16 Jan 2022 08:48:02 +0000
Subject: [PATCH 66/92] WIP: media: rc: add keymap for MeCool M8S Pro W remote
Add a keymap and bindings for the simple IR (NEC) remote used with
the MeCool M8S Pro W Android STB device.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
.../devicetree/bindings/media/rc.yaml | 1 +
drivers/media/rc/keymaps/Makefile | 2 +
.../media/rc/keymaps/rc-mecool-m8s-pro-w.c | 75 +++++++++++++++++++
include/media/rc-map.h | 1 +
4 files changed, 79 insertions(+)
create mode 100644 drivers/media/rc/keymaps/rc-mecool-m8s-pro-w.c
diff --git a/Documentation/devicetree/bindings/media/rc.yaml b/Documentation/devicetree/bindings/media/rc.yaml
index 4f53fea766c6..6578a2328ec5 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -94,6 +94,7 @@ properties:
- rc-manli
- rc-mecool-kii-pro
- rc-mecool-kiii-pro
+ - rc-mecool-m8s-pro-w
- rc-medion-x10
- rc-medion-x10-digitainer
- rc-medion-x10-or2x
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index f3bf9878d72c..ef48a6bbeca4 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -75,6 +75,8 @@ obj-$(CONFIG_RC_MAP) += \
rc-manli.o \
rc-mecool-kiii-pro.o \
rc-mecool-kii-pro.o \
+ rc-mecool-m8s-pro-w.o \
+ rc-medion-x10.o \
rc-medion-x10-digitainer.o \
rc-medion-x10.o \
rc-medion-x10-or2x.o \
diff --git a/drivers/media/rc/keymaps/rc-mecool-m8s-pro-w.c b/drivers/media/rc/keymaps/rc-mecool-m8s-pro-w.c
new file mode 100644
index 000000000000..9024b999d5a9
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-mecool-m8s-pro-w.c
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2022 Christian Hewitt <christianshewitt@gmail.com>
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+//
+// Keytable for the MeCool M8S Pro W remote control
+//
+
+static struct rc_map_table mecool_m8s_pro_w[] = {
+
+ { 0x59, KEY_POWER },
+
+ // TV CONTROLS
+
+ { 0x08, KEY_PREVIOUS },
+ { 0x0b, KEY_NEXT },
+ { 0x18, KEY_TEXT }, // INTERNET
+ { 0x19, KEY_MUTE },
+ { 0x13, KEY_VOLUMEUP },
+ { 0x17, KEY_VOLUMEDOWN },
+
+ { 0x0d, KEY_HOME },
+ { 0x05, KEY_BACK },
+
+ { 0x06, KEY_UP },
+ { 0x5a, KEY_LEFT },
+ { 0x1b, KEY_RIGHT },
+ { 0x1a, KEY_ENTER },
+ { 0x16, KEY_DOWN },
+
+ { 0x45, KEY_MENU },
+ { 0x12, KEY_CONTEXT_MENU }, // MOUSE
+
+ { 0x52, KEY_NUMERIC_1 },
+ { 0x50, KEY_NUMERIC_2 },
+ { 0x10, KEY_NUMERIC_3 },
+ { 0x56, KEY_NUMERIC_4 },
+ { 0x54, KEY_NUMERIC_5 },
+ { 0x14, KEY_NUMERIC_6 },
+ { 0x4e, KEY_NUMERIC_7 },
+ { 0x4c, KEY_NUMERIC_8 },
+ { 0x0c, KEY_NUMERIC_9 },
+ { 0x22, KEY_INFO }, // SEARCH
+ { 0x0f, KEY_NUMERIC_0 },
+ { 0x51, KEY_BACKSPACE },
+
+};
+
+static struct rc_map_list mecool_m8s_pro_w_map = {
+ .map = {
+ .scan = mecool_m8s_pro_w,
+ .size = ARRAY_SIZE(mecool_m8s_pro_w),
+ .rc_proto = RC_PROTO_NEC,
+ .name = RC_MAP_MECOOL_M8S_PRO_W,
+ }
+};
+
+static int __init init_rc_map_mecool_m8s_pro_w(void)
+{
+ return rc_map_register(&mecool_m8s_pro_w_map);
+}
+
+static void __exit exit_rc_map_mecool_m8s_pro_w(void)
+{
+ rc_map_unregister(&mecool_m8s_pro_w_map);
+}
+
+module_init(init_rc_map_mecool_m8s_pro_w)
+module_exit(exit_rc_map_mecool_m8s_pro_w)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt <christianshewitt@gmail.com");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e4ddb3586d05..9b6f09a6fd3a 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -281,6 +281,7 @@ struct rc_map *rc_map_get(const char *name);
#define RC_MAP_MANLI "rc-manli"
#define RC_MAP_MECOOL_KII_PRO "rc-mecool-kii-pro"
#define RC_MAP_MECOOL_KIII_PRO "rc-mecool-kiii-pro"
+#define RC_MAP_MECOOL_M8S_PRO_W "rc-mecool-m8s-pro-w"
#define RC_MAP_MEDION_X10 "rc-medion-x10"
#define RC_MAP_MEDION_X10_DIGITAINER "rc-medion-x10-digitainer"
#define RC_MAP_MEDION_X10_OR2X "rc-medion-x10-or2x"
--
2.34.1