2020-11-27 08:48:57

by Christian Hewitt

[permalink] [raw]
Subject: [PATCH v2] media: rc: add keymap for pine64 remote

From: Jonas Karlman <[email protected]>

Add a keymap for the pine64 IR remote [0]. The mouse key has been mapped to
KEY_EPG to provide a more useful remote.

[0] http://files.pine64.org/doc/Pine%20A64%20Schematic/remote-wit-logo.jpg

Signed-off-by: Jonas Karlman <[email protected]>
Signed-off-by: Christian Hewitt <[email protected]>
---
Changes since v1 [1]:
- reorder code to match the physical layout
- assign KEY_EPG instead of KEY_CONTEXT_MENU

KEY_CONTEXT_MENU duplicates KEY_MENU, and while Seans suggestion of BTN_LEFT
visually matches the key, this duplicates KEY_OK in most GUI's designed for
remote naviagation, e.g. Kodi and Plex. I've chosen to map KEY_EPG as this
is a common tweak in user forums to extend IR remote functionality.

[1] https://patchwork.kernel.org/project/linux-media/patch/AM3PR03MB09661A45FEB90FFC3CB44508AC630@AM3PR03MB0966.eurprd03.prod.outlook.com/

.../devicetree/bindings/media/rc.yaml | 1 +
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-pine64.c | 65 +++++++++++++++++++
3 files changed, 67 insertions(+)
create mode 100644 drivers/media/rc/keymaps/rc-pine64.c

diff --git a/Documentation/devicetree/bindings/media/rc.yaml b/Documentation/devicetree/bindings/media/rc.yaml
index 03cf40f91d6c..946441b4e1a5 100644
--- a/Documentation/devicetree/bindings/media/rc.yaml
+++ b/Documentation/devicetree/bindings/media/rc.yaml
@@ -103,6 +103,7 @@ properties:
- rc-npgtech
- rc-odroid
- rc-pctv-sedna
+ - rc-pine64
- rc-pinnacle-color
- rc-pinnacle-grey
- rc-pinnacle-pctv-hd
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 1c4d6bec0ae4..b252a1d2ebd6 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-npgtech.o \
rc-odroid.o \
rc-pctv-sedna.o \
+ rc-pine64.o \
rc-pinnacle-color.o \
rc-pinnacle-grey.o \
rc-pinnacle-pctv-hd.o \
diff --git a/drivers/media/rc/keymaps/rc-pine64.c b/drivers/media/rc/keymaps/rc-pine64.c
new file mode 100644
index 000000000000..9b2bdbbce04e
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-pine64.c
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+// Keytable for the Pine64 IR Remote Controller
+// Copyright (c) 2017 Jonas Karlman
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table pine64[] = {
+ { 0x40404d, KEY_POWER },
+ { 0x40401f, KEY_WWW },
+ { 0x40400a, KEY_MUTE },
+
+ { 0x404017, KEY_VOLUMEDOWN },
+ { 0x404018, KEY_VOLUMEUP },
+
+ { 0x404010, KEY_LEFT },
+ { 0x404011, KEY_RIGHT },
+ { 0x40400b, KEY_UP },
+ { 0x40400e, KEY_DOWN },
+ { 0x40400d, KEY_OK },
+
+ { 0x40401d, KEY_MENU },
+ { 0x40401a, KEY_HOME },
+
+ { 0x404045, KEY_BACK },
+
+ { 0x404001, KEY_NUMERIC_1 },
+ { 0x404002, KEY_NUMERIC_2 },
+ { 0x404003, KEY_NUMERIC_3 },
+ { 0x404004, KEY_NUMERIC_4 },
+ { 0x404005, KEY_NUMERIC_5 },
+ { 0x404006, KEY_NUMERIC_6 },
+ { 0x404007, KEY_NUMERIC_7 },
+ { 0x404008, KEY_NUMERIC_8 },
+ { 0x404009, KEY_NUMERIC_9 },
+ { 0x40400c, KEY_BACKSPACE },
+ { 0x404000, KEY_NUMERIC_0 },
+ { 0x404047, KEY_EPG }, // mouse
+};
+
+static struct rc_map_list pine64_map = {
+ .map = {
+ .scan = pine64,
+ .size = ARRAY_SIZE(pine64),
+ .rc_proto = RC_PROTO_NECX,
+ .name = RC_MAP_PINE64,
+ }
+};
+
+static int __init init_rc_map_pine64(void)
+{
+ return rc_map_register(&pine64_map);
+}
+
+static void __exit exit_rc_map_pine64(void)
+{
+ rc_map_unregister(&pine64_map);
+}
+
+module_init(init_rc_map_pine64)
+module_exit(exit_rc_map_pine64)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jonas Karlman");
--
2.17.1


2020-11-27 08:52:06

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2] media: rc: add keymap for pine64 remote

Hi Christian,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.10-rc5 next-20201126]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Christian-Hewitt/media-rc-add-keymap-for-pine64-remote/20201127-110954
base: git://linuxtv.org/media_tree.git master
config: mips-randconfig-r005-20201127 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f91c9e789bb50680477d0af197fc4d3ccb806c3d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christian-Hewitt/media-rc-add-keymap-for-pine64-remote/20201127-110954
git checkout f91c9e789bb50680477d0af197fc4d3ccb806c3d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/media/rc/keymaps/rc-pine64.c:47:15: error: 'RC_MAP_PINE64' undeclared here (not in a function); did you mean 'RC_MAP_CINERGY'?
47 | .name = RC_MAP_PINE64,
| ^~~~~~~~~~~~~
| RC_MAP_CINERGY

vim +47 drivers/media/rc/keymaps/rc-pine64.c

41
42 static struct rc_map_list pine64_map = {
43 .map = {
44 .scan = pine64,
45 .size = ARRAY_SIZE(pine64),
46 .rc_proto = RC_PROTO_NECX,
> 47 .name = RC_MAP_PINE64,
48 }
49 };
50

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.07 kB)
.config.gz (21.50 kB)
Download all attachments