162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+
262306a36Sopenharmony_ci// rc-hauppauge.c - Keytable for Hauppauge Remote Controllers
362306a36Sopenharmony_ci//
462306a36Sopenharmony_ci// keymap imported from ir-keymaps.c
562306a36Sopenharmony_ci//
662306a36Sopenharmony_ci// This map currently contains the code for four different RCs:
762306a36Sopenharmony_ci//	- New Hauppauge Gray;
862306a36Sopenharmony_ci//	- Old Hauppauge Gray (with a golden screen for media keys);
962306a36Sopenharmony_ci//	- Hauppauge Black;
1062306a36Sopenharmony_ci//	- DSR-0112 remote bundled with Haupauge MiniStick.
1162306a36Sopenharmony_ci//
1262306a36Sopenharmony_ci// Copyright (c) 2010-2011 by Mauro Carvalho Chehab
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include <media/rc-map.h>
1562306a36Sopenharmony_ci#include <linux/module.h>
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/*
1862306a36Sopenharmony_ci * Hauppauge:the newer, gray remotes (seems there are multiple
1962306a36Sopenharmony_ci * slightly different versions), shipped with cx88+ivtv cards.
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci * This table contains the complete RC5 code, instead of just the data part
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistatic struct rc_map_table rc5_hauppauge_new[] = {
2562306a36Sopenharmony_ci	/*
2662306a36Sopenharmony_ci	 * Remote Controller Hauppauge Gray found on modern devices
2762306a36Sopenharmony_ci	 * Keycodes start with address = 0x1e
2862306a36Sopenharmony_ci	 */
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci	{ 0x1e3b, KEY_SELECT },		/* GO / house symbol */
3162306a36Sopenharmony_ci	{ 0x1e3d, KEY_POWER2 },		/* system power (green button) */
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	{ 0x1e1c, KEY_TV },
3462306a36Sopenharmony_ci	{ 0x1e18, KEY_VIDEO },		/* Videos */
3562306a36Sopenharmony_ci	{ 0x1e19, KEY_AUDIO },		/* Music */
3662306a36Sopenharmony_ci	{ 0x1e1a, KEY_CAMERA },		/* Pictures */
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci	{ 0x1e1b, KEY_EPG },		/* Guide */
3962306a36Sopenharmony_ci	{ 0x1e0c, KEY_RADIO },
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	{ 0x1e14, KEY_UP },
4262306a36Sopenharmony_ci	{ 0x1e15, KEY_DOWN },
4362306a36Sopenharmony_ci	{ 0x1e16, KEY_LEFT },
4462306a36Sopenharmony_ci	{ 0x1e17, KEY_RIGHT },
4562306a36Sopenharmony_ci	{ 0x1e25, KEY_OK },		/* OK */
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci	{ 0x1e1f, KEY_EXIT },		/* back/exit */
4862306a36Sopenharmony_ci	{ 0x1e0d, KEY_MENU },
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci	{ 0x1e10, KEY_VOLUMEUP },
5162306a36Sopenharmony_ci	{ 0x1e11, KEY_VOLUMEDOWN },
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci	{ 0x1e12, KEY_PREVIOUS },	/* previous channel */
5462306a36Sopenharmony_ci	{ 0x1e0f, KEY_MUTE },
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci	{ 0x1e20, KEY_CHANNELUP },	/* channel / program + */
5762306a36Sopenharmony_ci	{ 0x1e21, KEY_CHANNELDOWN },	/* channel / program - */
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci	{ 0x1e37, KEY_RECORD },		/* recording */
6062306a36Sopenharmony_ci	{ 0x1e36, KEY_STOP },
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci	{ 0x1e32, KEY_REWIND },		/* backward << */
6362306a36Sopenharmony_ci	{ 0x1e35, KEY_PLAY },
6462306a36Sopenharmony_ci	{ 0x1e34, KEY_FASTFORWARD },	/* forward >> */
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci	{ 0x1e24, KEY_PREVIOUSSONG },	/* replay |< */
6762306a36Sopenharmony_ci	{ 0x1e30, KEY_PAUSE },		/* pause */
6862306a36Sopenharmony_ci	{ 0x1e1e, KEY_NEXTSONG },	/* skip >| */
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci	{ 0x1e01, KEY_NUMERIC_1 },
7162306a36Sopenharmony_ci	{ 0x1e02, KEY_NUMERIC_2 },
7262306a36Sopenharmony_ci	{ 0x1e03, KEY_NUMERIC_3 },
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci	{ 0x1e04, KEY_NUMERIC_4 },
7562306a36Sopenharmony_ci	{ 0x1e05, KEY_NUMERIC_5 },
7662306a36Sopenharmony_ci	{ 0x1e06, KEY_NUMERIC_6 },
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci	{ 0x1e07, KEY_NUMERIC_7 },
7962306a36Sopenharmony_ci	{ 0x1e08, KEY_NUMERIC_8 },
8062306a36Sopenharmony_ci	{ 0x1e09, KEY_NUMERIC_9 },
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci	{ 0x1e0a, KEY_TEXT },		/* keypad asterisk as well */
8362306a36Sopenharmony_ci	{ 0x1e00, KEY_NUMERIC_0 },
8462306a36Sopenharmony_ci	{ 0x1e0e, KEY_SUBTITLE },	/* also the Pound key (#) */
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci	{ 0x1e0b, KEY_RED },		/* red button */
8762306a36Sopenharmony_ci	{ 0x1e2e, KEY_GREEN },		/* green button */
8862306a36Sopenharmony_ci	{ 0x1e38, KEY_YELLOW },		/* yellow key */
8962306a36Sopenharmony_ci	{ 0x1e29, KEY_BLUE },		/* blue key */
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci	/*
9262306a36Sopenharmony_ci	 * Old Remote Controller Hauppauge Gray with a golden screen
9362306a36Sopenharmony_ci	 * Keycodes start with address = 0x1f
9462306a36Sopenharmony_ci	 */
9562306a36Sopenharmony_ci	{ 0x1f3d, KEY_POWER2 },		/* system power (green button) */
9662306a36Sopenharmony_ci	{ 0x1f3b, KEY_SELECT },		/* GO */
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci	/* Keys 0 to 9 */
9962306a36Sopenharmony_ci	{ 0x1f00, KEY_NUMERIC_0 },
10062306a36Sopenharmony_ci	{ 0x1f01, KEY_NUMERIC_1 },
10162306a36Sopenharmony_ci	{ 0x1f02, KEY_NUMERIC_2 },
10262306a36Sopenharmony_ci	{ 0x1f03, KEY_NUMERIC_3 },
10362306a36Sopenharmony_ci	{ 0x1f04, KEY_NUMERIC_4 },
10462306a36Sopenharmony_ci	{ 0x1f05, KEY_NUMERIC_5 },
10562306a36Sopenharmony_ci	{ 0x1f06, KEY_NUMERIC_6 },
10662306a36Sopenharmony_ci	{ 0x1f07, KEY_NUMERIC_7 },
10762306a36Sopenharmony_ci	{ 0x1f08, KEY_NUMERIC_8 },
10862306a36Sopenharmony_ci	{ 0x1f09, KEY_NUMERIC_9 },
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci	{ 0x1f1f, KEY_EXIT },		/* back/exit */
11162306a36Sopenharmony_ci	{ 0x1f0d, KEY_MENU },
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci	{ 0x1f10, KEY_VOLUMEUP },
11462306a36Sopenharmony_ci	{ 0x1f11, KEY_VOLUMEDOWN },
11562306a36Sopenharmony_ci	{ 0x1f20, KEY_CHANNELUP },	/* channel / program + */
11662306a36Sopenharmony_ci	{ 0x1f21, KEY_CHANNELDOWN },	/* channel / program - */
11762306a36Sopenharmony_ci	{ 0x1f25, KEY_ENTER },		/* OK */
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci	{ 0x1f0b, KEY_RED },		/* red button */
12062306a36Sopenharmony_ci	{ 0x1f2e, KEY_GREEN },		/* green button */
12162306a36Sopenharmony_ci	{ 0x1f38, KEY_YELLOW },		/* yellow key */
12262306a36Sopenharmony_ci	{ 0x1f29, KEY_BLUE },		/* blue key */
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci	{ 0x1f0f, KEY_MUTE },
12562306a36Sopenharmony_ci	{ 0x1f0c, KEY_RADIO },		/* There's no indicator on this key */
12662306a36Sopenharmony_ci	{ 0x1f3c, KEY_ZOOM },		/* full */
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci	{ 0x1f32, KEY_REWIND },		/* backward << */
12962306a36Sopenharmony_ci	{ 0x1f35, KEY_PLAY },
13062306a36Sopenharmony_ci	{ 0x1f34, KEY_FASTFORWARD },	/* forward >> */
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci	{ 0x1f37, KEY_RECORD },		/* recording */
13362306a36Sopenharmony_ci	{ 0x1f36, KEY_STOP },
13462306a36Sopenharmony_ci	{ 0x1f30, KEY_PAUSE },		/* pause */
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci	{ 0x1f24, KEY_PREVIOUSSONG },	/* replay |< */
13762306a36Sopenharmony_ci	{ 0x1f1e, KEY_NEXTSONG },	/* skip >| */
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci	/*
14062306a36Sopenharmony_ci	 * Keycodes for DSR-0112 remote bundled with Haupauge MiniStick
14162306a36Sopenharmony_ci	 * Keycodes start with address = 0x1d
14262306a36Sopenharmony_ci	 */
14362306a36Sopenharmony_ci	{ 0x1d00, KEY_NUMERIC_0 },
14462306a36Sopenharmony_ci	{ 0x1d01, KEY_NUMERIC_1 },
14562306a36Sopenharmony_ci	{ 0x1d02, KEY_NUMERIC_2 },
14662306a36Sopenharmony_ci	{ 0x1d03, KEY_NUMERIC_3 },
14762306a36Sopenharmony_ci	{ 0x1d04, KEY_NUMERIC_4 },
14862306a36Sopenharmony_ci	{ 0x1d05, KEY_NUMERIC_5 },
14962306a36Sopenharmony_ci	{ 0x1d06, KEY_NUMERIC_6 },
15062306a36Sopenharmony_ci	{ 0x1d07, KEY_NUMERIC_7 },
15162306a36Sopenharmony_ci	{ 0x1d08, KEY_NUMERIC_8 },
15262306a36Sopenharmony_ci	{ 0x1d09, KEY_NUMERIC_9 },
15362306a36Sopenharmony_ci	{ 0x1d0a, KEY_TEXT },
15462306a36Sopenharmony_ci	{ 0x1d0d, KEY_MENU },
15562306a36Sopenharmony_ci	{ 0x1d0f, KEY_MUTE },
15662306a36Sopenharmony_ci	{ 0x1d10, KEY_VOLUMEUP },
15762306a36Sopenharmony_ci	{ 0x1d11, KEY_VOLUMEDOWN },
15862306a36Sopenharmony_ci	{ 0x1d12, KEY_PREVIOUS },        /* Prev.Ch .. ??? */
15962306a36Sopenharmony_ci	{ 0x1d14, KEY_UP },
16062306a36Sopenharmony_ci	{ 0x1d15, KEY_DOWN },
16162306a36Sopenharmony_ci	{ 0x1d16, KEY_LEFT },
16262306a36Sopenharmony_ci	{ 0x1d17, KEY_RIGHT },
16362306a36Sopenharmony_ci	{ 0x1d1c, KEY_TV },
16462306a36Sopenharmony_ci	{ 0x1d1e, KEY_NEXT },           /* >|             */
16562306a36Sopenharmony_ci	{ 0x1d1f, KEY_EXIT },
16662306a36Sopenharmony_ci	{ 0x1d20, KEY_CHANNELUP },
16762306a36Sopenharmony_ci	{ 0x1d21, KEY_CHANNELDOWN },
16862306a36Sopenharmony_ci	{ 0x1d24, KEY_LAST },           /* <|             */
16962306a36Sopenharmony_ci	{ 0x1d25, KEY_OK },
17062306a36Sopenharmony_ci	{ 0x1d30, KEY_PAUSE },
17162306a36Sopenharmony_ci	{ 0x1d32, KEY_REWIND },
17262306a36Sopenharmony_ci	{ 0x1d34, KEY_FASTFORWARD },
17362306a36Sopenharmony_ci	{ 0x1d35, KEY_PLAY },
17462306a36Sopenharmony_ci	{ 0x1d36, KEY_STOP },
17562306a36Sopenharmony_ci	{ 0x1d37, KEY_RECORD },
17662306a36Sopenharmony_ci	{ 0x1d3b, KEY_GOTO },
17762306a36Sopenharmony_ci	{ 0x1d3d, KEY_POWER },
17862306a36Sopenharmony_ci	{ 0x1d3f, KEY_HOME },
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	/*
18162306a36Sopenharmony_ci	 * Keycodes for PT# R-005 remote bundled with Haupauge HVR-930C
18262306a36Sopenharmony_ci	 * Keycodes start with address = 0x1c
18362306a36Sopenharmony_ci	 */
18462306a36Sopenharmony_ci	{ 0x1c3b, KEY_GOTO },
18562306a36Sopenharmony_ci	{ 0x1c3d, KEY_POWER },
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci	{ 0x1c14, KEY_UP },
18862306a36Sopenharmony_ci	{ 0x1c15, KEY_DOWN },
18962306a36Sopenharmony_ci	{ 0x1c16, KEY_LEFT },
19062306a36Sopenharmony_ci	{ 0x1c17, KEY_RIGHT },
19162306a36Sopenharmony_ci	{ 0x1c25, KEY_OK },
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci	{ 0x1c00, KEY_NUMERIC_0 },
19462306a36Sopenharmony_ci	{ 0x1c01, KEY_NUMERIC_1 },
19562306a36Sopenharmony_ci	{ 0x1c02, KEY_NUMERIC_2 },
19662306a36Sopenharmony_ci	{ 0x1c03, KEY_NUMERIC_3 },
19762306a36Sopenharmony_ci	{ 0x1c04, KEY_NUMERIC_4 },
19862306a36Sopenharmony_ci	{ 0x1c05, KEY_NUMERIC_5 },
19962306a36Sopenharmony_ci	{ 0x1c06, KEY_NUMERIC_6 },
20062306a36Sopenharmony_ci	{ 0x1c07, KEY_NUMERIC_7 },
20162306a36Sopenharmony_ci	{ 0x1c08, KEY_NUMERIC_8 },
20262306a36Sopenharmony_ci	{ 0x1c09, KEY_NUMERIC_9 },
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci	{ 0x1c1f, KEY_EXIT },	/* BACK */
20562306a36Sopenharmony_ci	{ 0x1c0d, KEY_MENU },
20662306a36Sopenharmony_ci	{ 0x1c1c, KEY_TV },
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci	{ 0x1c10, KEY_VOLUMEUP },
20962306a36Sopenharmony_ci	{ 0x1c11, KEY_VOLUMEDOWN },
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci	{ 0x1c20, KEY_CHANNELUP },
21262306a36Sopenharmony_ci	{ 0x1c21, KEY_CHANNELDOWN },
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci	{ 0x1c0f, KEY_MUTE },
21562306a36Sopenharmony_ci	{ 0x1c12, KEY_PREVIOUS }, /* Prev */
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci	{ 0x1c36, KEY_STOP },
21862306a36Sopenharmony_ci	{ 0x1c37, KEY_RECORD },
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci	{ 0x1c24, KEY_LAST },           /* <|             */
22162306a36Sopenharmony_ci	{ 0x1c1e, KEY_NEXT },           /* >|             */
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci	{ 0x1c0a, KEY_TEXT },
22462306a36Sopenharmony_ci	{ 0x1c0e, KEY_SUBTITLE },	/* CC */
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci	{ 0x1c32, KEY_REWIND },
22762306a36Sopenharmony_ci	{ 0x1c30, KEY_PAUSE },
22862306a36Sopenharmony_ci	{ 0x1c35, KEY_PLAY },
22962306a36Sopenharmony_ci	{ 0x1c34, KEY_FASTFORWARD },
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci	/*
23262306a36Sopenharmony_ci	 * Keycodes for the old Black Remote Controller
23362306a36Sopenharmony_ci	 * This one also uses RC-5 protocol
23462306a36Sopenharmony_ci	 * Keycodes start with address = 0x00
23562306a36Sopenharmony_ci	 */
23662306a36Sopenharmony_ci	{ 0x000f, KEY_TV },
23762306a36Sopenharmony_ci	{ 0x001f, KEY_TV },
23862306a36Sopenharmony_ci	{ 0x0020, KEY_CHANNELUP },
23962306a36Sopenharmony_ci	{ 0x000c, KEY_RADIO },
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci	{ 0x0011, KEY_VOLUMEDOWN },
24262306a36Sopenharmony_ci	{ 0x002e, KEY_ZOOM },		/* full screen */
24362306a36Sopenharmony_ci	{ 0x0010, KEY_VOLUMEUP },
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci	{ 0x000d, KEY_MUTE },
24662306a36Sopenharmony_ci	{ 0x0021, KEY_CHANNELDOWN },
24762306a36Sopenharmony_ci	{ 0x0022, KEY_VIDEO },		/* source */
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci	{ 0x0001, KEY_NUMERIC_1 },
25062306a36Sopenharmony_ci	{ 0x0002, KEY_NUMERIC_2 },
25162306a36Sopenharmony_ci	{ 0x0003, KEY_NUMERIC_3 },
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci	{ 0x0004, KEY_NUMERIC_4 },
25462306a36Sopenharmony_ci	{ 0x0005, KEY_NUMERIC_5 },
25562306a36Sopenharmony_ci	{ 0x0006, KEY_NUMERIC_6 },
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci	{ 0x0007, KEY_NUMERIC_7 },
25862306a36Sopenharmony_ci	{ 0x0008, KEY_NUMERIC_8 },
25962306a36Sopenharmony_ci	{ 0x0009, KEY_NUMERIC_9 },
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	{ 0x001e, KEY_RED },	/* Reserved */
26262306a36Sopenharmony_ci	{ 0x0000, KEY_NUMERIC_0 },
26362306a36Sopenharmony_ci	{ 0x0026, KEY_SLEEP },	/* Minimize */
26462306a36Sopenharmony_ci};
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_cistatic struct rc_map_list rc5_hauppauge_new_map = {
26762306a36Sopenharmony_ci	.map = {
26862306a36Sopenharmony_ci		.scan     = rc5_hauppauge_new,
26962306a36Sopenharmony_ci		.size     = ARRAY_SIZE(rc5_hauppauge_new),
27062306a36Sopenharmony_ci		.rc_proto = RC_PROTO_RC5,
27162306a36Sopenharmony_ci		.name     = RC_MAP_HAUPPAUGE,
27262306a36Sopenharmony_ci	}
27362306a36Sopenharmony_ci};
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_cistatic int __init init_rc_map_rc5_hauppauge_new(void)
27662306a36Sopenharmony_ci{
27762306a36Sopenharmony_ci	return rc_map_register(&rc5_hauppauge_new_map);
27862306a36Sopenharmony_ci}
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_cistatic void __exit exit_rc_map_rc5_hauppauge_new(void)
28162306a36Sopenharmony_ci{
28262306a36Sopenharmony_ci	rc_map_unregister(&rc5_hauppauge_new_map);
28362306a36Sopenharmony_ci}
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_cimodule_init(init_rc_map_rc5_hauppauge_new)
28662306a36Sopenharmony_cimodule_exit(exit_rc_map_rc5_hauppauge_new)
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_ciMODULE_LICENSE("GPL");
28962306a36Sopenharmony_ciMODULE_AUTHOR("Mauro Carvalho Chehab");
290