1 // SPDX-License-Identifier: GPL-2.0+
2 // msi-tvanywhere-plus.h - Keytable for msi_tvanywhere_plus Remote Controller
3 //
4 // keymap imported from ir-keymaps.c
5 //
6 // Copyright (c) 2010 by Mauro Carvalho Chehab
7 
8 #include <media/rc-map.h>
9 #include <linux/module.h>
10 
11 /*
12   Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card
13   is marked "KS003". The controller is I2C at address 0x30, but does not seem
14   to respond to probes until a read is performed from a valid device.
15   I don't know why...
16 
17   Note: This remote may be of similar or identical design to the
18   Pixelview remote (?).  The raw codes and duplicate button codes
19   appear to be the same.
20 
21   Henry Wong <henry@stuffedcow.net>
22   Some changes to formatting and keycodes by Mark Schultz <n9xmj@yahoo.com>
23 */
24 
25 static struct rc_map_table msi_tvanywhere_plus[] = {
26 
27 /*  ---- Remote Button Layout ----
28 
29     POWER   SOURCE  SCAN    MUTE
30     TV/FM   1       2       3
31     |>      4       5       6
32     <|      7       8       9
33     ^^UP    0       +       RECALL
34     vvDN    RECORD  STOP    PLAY
35 
36 	MINIMIZE          ZOOM
37 
38 		  CH+
39       VOL-                   VOL+
40 		  CH-
41 
42 	SNAPSHOT           MTS
43 
44      <<      FUNC    >>     RESET
45 */
46 
47 	{ 0x01, KEY_NUMERIC_1 },	/* 1 */
48 	{ 0x0b, KEY_NUMERIC_2 },	/* 2 */
49 	{ 0x1b, KEY_NUMERIC_3 },	/* 3 */
50 	{ 0x05, KEY_NUMERIC_4 },	/* 4 */
51 	{ 0x09, KEY_NUMERIC_5 },	/* 5 */
52 	{ 0x15, KEY_NUMERIC_6 },	/* 6 */
53 	{ 0x06, KEY_NUMERIC_7 },	/* 7 */
54 	{ 0x0a, KEY_NUMERIC_8 },	/* 8 */
55 	{ 0x12, KEY_NUMERIC_9 },	/* 9 */
56 	{ 0x02, KEY_NUMERIC_0 },	/* 0 */
57 	{ 0x10, KEY_KPPLUS },		/* + */
58 	{ 0x13, KEY_AGAIN },		/* Recall */
59 
60 	{ 0x1e, KEY_POWER },		/* Power */
61 	{ 0x07, KEY_VIDEO },		/* Source */
62 	{ 0x1c, KEY_SEARCH },		/* Scan */
63 	{ 0x18, KEY_MUTE },		/* Mute */
64 
65 	{ 0x03, KEY_RADIO },		/* TV/FM */
66 	/* The next four keys are duplicates that appear to send the
67 	   same IR code as Ch+, Ch-, >>, and << .  The raw code assigned
68 	   to them is the actual code + 0x20 - they will never be
69 	   detected as such unless some way is discovered to distinguish
70 	   these buttons from those that have the same code. */
71 	{ 0x3f, KEY_RIGHT },		/* |> and Ch+ */
72 	{ 0x37, KEY_LEFT },		/* <| and Ch- */
73 	{ 0x2c, KEY_UP },		/* ^^Up and >> */
74 	{ 0x24, KEY_DOWN },		/* vvDn and << */
75 
76 	{ 0x00, KEY_RECORD },		/* Record */
77 	{ 0x08, KEY_STOP },		/* Stop */
78 	{ 0x11, KEY_PLAY },		/* Play */
79 
80 	{ 0x0f, KEY_CLOSE },		/* Minimize */
81 	{ 0x19, KEY_ZOOM },		/* Zoom */
82 	{ 0x1a, KEY_CAMERA },		/* Snapshot */
83 	{ 0x0d, KEY_LANGUAGE },		/* MTS */
84 
85 	{ 0x14, KEY_VOLUMEDOWN },	/* Vol- */
86 	{ 0x16, KEY_VOLUMEUP },		/* Vol+ */
87 	{ 0x17, KEY_CHANNELDOWN },	/* Ch- */
88 	{ 0x1f, KEY_CHANNELUP },	/* Ch+ */
89 
90 	{ 0x04, KEY_REWIND },		/* << */
91 	{ 0x0e, KEY_MENU },		/* Function */
92 	{ 0x0c, KEY_FASTFORWARD },	/* >> */
93 	{ 0x1d, KEY_RESTART },		/* Reset */
94 };
95 
96 static struct rc_map_list msi_tvanywhere_plus_map = {
97 	.map = {
98 		.scan     = msi_tvanywhere_plus,
99 		.size     = ARRAY_SIZE(msi_tvanywhere_plus),
100 		.rc_proto = RC_PROTO_UNKNOWN,	/* Legacy IR type */
101 		.name     = RC_MAP_MSI_TVANYWHERE_PLUS,
102 	}
103 };
104 
init_rc_map_msi_tvanywhere_plus(void)105 static int __init init_rc_map_msi_tvanywhere_plus(void)
106 {
107 	return rc_map_register(&msi_tvanywhere_plus_map);
108 }
109 
exit_rc_map_msi_tvanywhere_plus(void)110 static void __exit exit_rc_map_msi_tvanywhere_plus(void)
111 {
112 	rc_map_unregister(&msi_tvanywhere_plus_map);
113 }
114 
115 module_init(init_rc_map_msi_tvanywhere_plus)
116 module_exit(exit_rc_map_msi_tvanywhere_plus)
117 
118 MODULE_LICENSE("GPL");
119 MODULE_AUTHOR("Mauro Carvalho Chehab");
120