1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (c) 2021 Emanuel Strobel <emanuel.strobel@yahoo.com>
4  */
5 
6 #include <media/rc-map.h>
7 #include <linux/module.h>
8 
9 /*
10  * Keytable for Dreambox RC10/RC0 and RC20/RC-BT remote controls
11  *
12  * Keys that are not IR addressable:
13  *
14  * // DREAM switches to STB control mode
15  * // TV switches to TV control mode
16  * // MODE toggles STB/TV/BT control modes
17  *
18  */
19 
20 static struct rc_map_table dreambox[] = {
21 	/* Dreambox RC10/RC0/RCU-BT remote */
22 	{ 0x3200, KEY_POWER },
23 
24 	// DREAM
25 	{ 0x3290, KEY_HELP },
26 	// TV
27 
28 	{ 0x3201, KEY_1 },
29 	{ 0x3202, KEY_2 },
30 	{ 0x3203, KEY_3 },
31 	{ 0x3204, KEY_4 },
32 	{ 0x3205, KEY_5 },
33 	{ 0x3206, KEY_6 },
34 	{ 0x3207, KEY_7 },
35 	{ 0x3208, KEY_8 },
36 	{ 0x3209, KEY_9 },
37 	{ 0x320a, KEY_PREVIOUS },
38 	{ 0x320b, KEY_0 },
39 	{ 0x320c, KEY_NEXT },
40 
41 	{ 0x321f, KEY_RED },
42 	{ 0x3220, KEY_GREEN },
43 	{ 0x3221, KEY_YELLOW },
44 	{ 0x3222, KEY_BLUE },
45 
46 	{ 0x3210, KEY_INFO },
47 	{ 0x3212, KEY_MENU },
48 	{ 0x320e, KEY_AUDIO },
49 	{ 0x3218, KEY_PVR },
50 
51 	{ 0x3213, KEY_LEFT },
52 	{ 0x3211, KEY_UP },
53 	{ 0x3215, KEY_RIGHT },
54 	{ 0x3217, KEY_DOWN },
55 	{ 0x3214, KEY_OK },
56 
57 	{ 0x3219, KEY_VOLUMEUP },
58 	{ 0x321c, KEY_VOLUMEDOWN },
59 
60 	{ 0x321d, KEY_ESC }, // EXIT
61 	{ 0x321a, KEY_MUTE },
62 
63 	{ 0x321b, KEY_PAGEUP },
64 	{ 0x321e, KEY_PAGEDOWN },
65 
66 	{ 0x3223, KEY_PREVIOUSSONG },
67 	{ 0x3224, KEY_PLAYPAUSE },
68 	{ 0x3225, KEY_STOP },
69 	{ 0x3226, KEY_NEXTSONG },
70 
71 	{ 0x3227, KEY_TV },
72 	{ 0x3228, KEY_RADIO },
73 	{ 0x3229, KEY_TEXT },
74 	{ 0x322a, KEY_RECORD },
75 
76 	/* Dreambox RC20/RC-BT */
77 	{ 0x3407, KEY_MUTE },
78 	// MODE
79 	{ 0x3401, KEY_POWER },
80 
81 	{ 0x3432, KEY_PREVIOUSSONG },
82 	{ 0x3433, KEY_PLAYPAUSE },
83 	{ 0x3435, KEY_NEXTSONG },
84 
85 	{ 0x3436, KEY_RECORD },
86 	{ 0x3434, KEY_STOP },
87 	{ 0x3425, KEY_TEXT },
88 
89 	{ 0x341f, KEY_RED },
90 	{ 0x3420, KEY_GREEN },
91 	{ 0x3421, KEY_YELLOW },
92 	{ 0x3422, KEY_BLUE },
93 
94 	{ 0x341b, KEY_INFO },
95 	{ 0x341c, KEY_MENU },
96 	{ 0x3430, KEY_AUDIO },
97 	{ 0x3431, KEY_PVR },
98 
99 	{ 0x3414, KEY_LEFT },
100 	{ 0x3411, KEY_UP },
101 	{ 0x3416, KEY_RIGHT },
102 	{ 0x3419, KEY_DOWN },
103 	{ 0x3415, KEY_OK },
104 
105 	{ 0x3413, KEY_VOLUMEUP },
106 	{ 0x3418, KEY_VOLUMEDOWN },
107 
108 	{ 0x3412, KEY_ESC }, // EXIT
109 	{ 0x3426, KEY_HELP }, // MIC
110 
111 	{ 0x3417, KEY_PAGEUP },
112 	{ 0x341a, KEY_PAGEDOWN },
113 
114 	{ 0x3404, KEY_1 },
115 	{ 0x3405, KEY_2 },
116 	{ 0x3406, KEY_3 },
117 	{ 0x3408, KEY_4 },
118 	{ 0x3409, KEY_5 },
119 	{ 0x340a, KEY_6 },
120 	{ 0x340c, KEY_7 },
121 	{ 0x340d, KEY_8 },
122 	{ 0x340e, KEY_9 },
123 	{ 0x340b, KEY_PREVIOUS },
124 	{ 0x3410, KEY_0 },
125 	{ 0x340f, KEY_NEXT },
126 };
127 
128 static struct rc_map_list dreambox_map = {
129 	.map = {
130 		.scan     = dreambox,
131 		.size     = ARRAY_SIZE(dreambox),
132 		.rc_proto = RC_PROTO_NEC,
133 		.name     = RC_MAP_DREAMBOX,
134 	}
135 };
136 
137 static int __init init_rc_map_dreambox(void)
138 {
139 	return rc_map_register(&dreambox_map);
140 }
141 
142 static void __exit exit_rc_map_dreambox(void)
143 {
144 	rc_map_unregister(&dreambox_map);
145 }
146 
147 module_init(init_rc_map_dreambox)
148 module_exit(exit_rc_map_dreambox)
149 
150 MODULE_LICENSE("GPL");
151 MODULE_AUTHOR("Emanuel Strobel <emanuel.strobel@yahoo.com>");
152