1// SPDX-License-Identifier: GPL-2.0-or-later
2/* rc-tivo.c - Keytable for TiVo remotes
3 *
4 * Copyright (c) 2011 by Jarod Wilson <jarod@redhat.com>
5 */
6
7#include <media/rc-map.h>
8#include <linux/module.h>
9
10/*
11 * Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle,
12 * which also ships with a TiVo-branded IR transceiver, supported by the mceusb
13 * driver. Note that the remote uses an NEC-ish protocol, but instead of having
14 * a command/not_command pair, it has a vendor ID of 0x3085, but some keys, the
15 * NEC extended checksums do pass, so the table presently has the intended
16 * values and the checksum-passed versions for those keys.
17 */
18static struct rc_map_table tivo[] = {
19	{ 0x3085f009, KEY_MEDIA },	/* TiVo Button */
20	{ 0x3085e010, KEY_POWER2 },	/* TV Power */
21	{ 0x3085e011, KEY_TV },		/* Live TV/Swap */
22	{ 0x3085c034, KEY_VIDEO_NEXT },	/* TV Input */
23	{ 0x3085e013, KEY_INFO },
24	{ 0x3085a05f, KEY_CYCLEWINDOWS }, /* Window */
25	{ 0x0085305f, KEY_CYCLEWINDOWS },
26	{ 0x3085c036, KEY_EPG },	/* Guide */
27
28	{ 0x3085e014, KEY_UP },
29	{ 0x3085e016, KEY_DOWN },
30	{ 0x3085e017, KEY_LEFT },
31	{ 0x3085e015, KEY_RIGHT },
32
33	{ 0x3085e018, KEY_SCROLLDOWN },	/* Red Thumbs Down */
34	{ 0x3085e019, KEY_SELECT },
35	{ 0x3085e01a, KEY_SCROLLUP },	/* Green Thumbs Up */
36
37	{ 0x3085e01c, KEY_VOLUMEUP },
38	{ 0x3085e01d, KEY_VOLUMEDOWN },
39	{ 0x3085e01b, KEY_MUTE },
40	{ 0x3085d020, KEY_RECORD },
41	{ 0x3085e01e, KEY_CHANNELUP },
42	{ 0x3085e01f, KEY_CHANNELDOWN },
43	{ 0x0085301f, KEY_CHANNELDOWN },
44
45	{ 0x3085d021, KEY_PLAY },
46	{ 0x3085d023, KEY_PAUSE },
47	{ 0x3085d025, KEY_SLOW },
48	{ 0x3085d022, KEY_REWIND },
49	{ 0x3085d024, KEY_FASTFORWARD },
50	{ 0x3085d026, KEY_PREVIOUS },
51	{ 0x3085d027, KEY_NEXT },	/* ->| */
52
53	{ 0x3085b044, KEY_ZOOM },	/* Aspect */
54	{ 0x3085b048, KEY_STOP },
55	{ 0x3085b04a, KEY_DVD },	/* DVD Menu */
56
57	{ 0x3085d028, KEY_NUMERIC_1 },
58	{ 0x3085d029, KEY_NUMERIC_2 },
59	{ 0x3085d02a, KEY_NUMERIC_3 },
60	{ 0x3085d02b, KEY_NUMERIC_4 },
61	{ 0x3085d02c, KEY_NUMERIC_5 },
62	{ 0x3085d02d, KEY_NUMERIC_6 },
63	{ 0x3085d02e, KEY_NUMERIC_7 },
64	{ 0x3085d02f, KEY_NUMERIC_8 },
65	{ 0x0085302f, KEY_NUMERIC_8 },
66	{ 0x3085c030, KEY_NUMERIC_9 },
67	{ 0x3085c031, KEY_NUMERIC_0 },
68	{ 0x3085c033, KEY_ENTER },
69	{ 0x3085c032, KEY_CLEAR },
70};
71
72static struct rc_map_list tivo_map = {
73	.map = {
74		.scan     = tivo,
75		.size     = ARRAY_SIZE(tivo),
76		.rc_proto = RC_PROTO_NEC32,
77		.name     = RC_MAP_TIVO,
78	}
79};
80
81static int __init init_rc_map_tivo(void)
82{
83	return rc_map_register(&tivo_map);
84}
85
86static void __exit exit_rc_map_tivo(void)
87{
88	rc_map_unregister(&tivo_map);
89}
90
91module_init(init_rc_map_tivo)
92module_exit(exit_rc_map_tivo)
93
94MODULE_LICENSE("GPL");
95MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");
96MODULE_DESCRIPTION("TiVo remote controller keytable");
97