162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
262306a36Sopenharmony_ci/* rc-tivo.c - Keytable for TiVo remotes
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (c) 2011 by Jarod Wilson <jarod@redhat.com>
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#include <media/rc-map.h>
862306a36Sopenharmony_ci#include <linux/module.h>
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci/*
1162306a36Sopenharmony_ci * Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle,
1262306a36Sopenharmony_ci * which also ships with a TiVo-branded IR transceiver, supported by the mceusb
1362306a36Sopenharmony_ci * driver. Note that the remote uses an NEC-ish protocol, but instead of having
1462306a36Sopenharmony_ci * a command/not_command pair, it has a vendor ID of 0x3085, but some keys, the
1562306a36Sopenharmony_ci * NEC extended checksums do pass, so the table presently has the intended
1662306a36Sopenharmony_ci * values and the checksum-passed versions for those keys.
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_cistatic struct rc_map_table tivo[] = {
1962306a36Sopenharmony_ci	{ 0x3085f009, KEY_MEDIA },	/* TiVo Button */
2062306a36Sopenharmony_ci	{ 0x3085e010, KEY_POWER2 },	/* TV Power */
2162306a36Sopenharmony_ci	{ 0x3085e011, KEY_TV },		/* Live TV/Swap */
2262306a36Sopenharmony_ci	{ 0x3085c034, KEY_VIDEO_NEXT },	/* TV Input */
2362306a36Sopenharmony_ci	{ 0x3085e013, KEY_INFO },
2462306a36Sopenharmony_ci	{ 0x3085a05f, KEY_CYCLEWINDOWS }, /* Window */
2562306a36Sopenharmony_ci	{ 0x0085305f, KEY_CYCLEWINDOWS },
2662306a36Sopenharmony_ci	{ 0x3085c036, KEY_EPG },	/* Guide */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci	{ 0x3085e014, KEY_UP },
2962306a36Sopenharmony_ci	{ 0x3085e016, KEY_DOWN },
3062306a36Sopenharmony_ci	{ 0x3085e017, KEY_LEFT },
3162306a36Sopenharmony_ci	{ 0x3085e015, KEY_RIGHT },
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	{ 0x3085e018, KEY_SCROLLDOWN },	/* Red Thumbs Down */
3462306a36Sopenharmony_ci	{ 0x3085e019, KEY_SELECT },
3562306a36Sopenharmony_ci	{ 0x3085e01a, KEY_SCROLLUP },	/* Green Thumbs Up */
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci	{ 0x3085e01c, KEY_VOLUMEUP },
3862306a36Sopenharmony_ci	{ 0x3085e01d, KEY_VOLUMEDOWN },
3962306a36Sopenharmony_ci	{ 0x3085e01b, KEY_MUTE },
4062306a36Sopenharmony_ci	{ 0x3085d020, KEY_RECORD },
4162306a36Sopenharmony_ci	{ 0x3085e01e, KEY_CHANNELUP },
4262306a36Sopenharmony_ci	{ 0x3085e01f, KEY_CHANNELDOWN },
4362306a36Sopenharmony_ci	{ 0x0085301f, KEY_CHANNELDOWN },
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci	{ 0x3085d021, KEY_PLAY },
4662306a36Sopenharmony_ci	{ 0x3085d023, KEY_PAUSE },
4762306a36Sopenharmony_ci	{ 0x3085d025, KEY_SLOW },
4862306a36Sopenharmony_ci	{ 0x3085d022, KEY_REWIND },
4962306a36Sopenharmony_ci	{ 0x3085d024, KEY_FASTFORWARD },
5062306a36Sopenharmony_ci	{ 0x3085d026, KEY_PREVIOUS },
5162306a36Sopenharmony_ci	{ 0x3085d027, KEY_NEXT },	/* ->| */
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci	{ 0x3085b044, KEY_ZOOM },	/* Aspect */
5462306a36Sopenharmony_ci	{ 0x3085b048, KEY_STOP },
5562306a36Sopenharmony_ci	{ 0x3085b04a, KEY_DVD },	/* DVD Menu */
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	{ 0x3085d028, KEY_NUMERIC_1 },
5862306a36Sopenharmony_ci	{ 0x3085d029, KEY_NUMERIC_2 },
5962306a36Sopenharmony_ci	{ 0x3085d02a, KEY_NUMERIC_3 },
6062306a36Sopenharmony_ci	{ 0x3085d02b, KEY_NUMERIC_4 },
6162306a36Sopenharmony_ci	{ 0x3085d02c, KEY_NUMERIC_5 },
6262306a36Sopenharmony_ci	{ 0x3085d02d, KEY_NUMERIC_6 },
6362306a36Sopenharmony_ci	{ 0x3085d02e, KEY_NUMERIC_7 },
6462306a36Sopenharmony_ci	{ 0x3085d02f, KEY_NUMERIC_8 },
6562306a36Sopenharmony_ci	{ 0x0085302f, KEY_NUMERIC_8 },
6662306a36Sopenharmony_ci	{ 0x3085c030, KEY_NUMERIC_9 },
6762306a36Sopenharmony_ci	{ 0x3085c031, KEY_NUMERIC_0 },
6862306a36Sopenharmony_ci	{ 0x3085c033, KEY_ENTER },
6962306a36Sopenharmony_ci	{ 0x3085c032, KEY_CLEAR },
7062306a36Sopenharmony_ci};
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_cistatic struct rc_map_list tivo_map = {
7362306a36Sopenharmony_ci	.map = {
7462306a36Sopenharmony_ci		.scan     = tivo,
7562306a36Sopenharmony_ci		.size     = ARRAY_SIZE(tivo),
7662306a36Sopenharmony_ci		.rc_proto = RC_PROTO_NEC32,
7762306a36Sopenharmony_ci		.name     = RC_MAP_TIVO,
7862306a36Sopenharmony_ci	}
7962306a36Sopenharmony_ci};
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_cistatic int __init init_rc_map_tivo(void)
8262306a36Sopenharmony_ci{
8362306a36Sopenharmony_ci	return rc_map_register(&tivo_map);
8462306a36Sopenharmony_ci}
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_cistatic void __exit exit_rc_map_tivo(void)
8762306a36Sopenharmony_ci{
8862306a36Sopenharmony_ci	rc_map_unregister(&tivo_map);
8962306a36Sopenharmony_ci}
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_cimodule_init(init_rc_map_tivo)
9262306a36Sopenharmony_cimodule_exit(exit_rc_map_tivo)
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ciMODULE_LICENSE("GPL");
9562306a36Sopenharmony_ciMODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");
96