162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * ATI X10 RF remote keytable
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2011 Anssi Hannula <anssi.hannula@?ki.fi>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * This file is based on the static generic keytable previously found in
862306a36Sopenharmony_ci * ati_remote.c, which is
962306a36Sopenharmony_ci * Copyright (c) 2004 Torrey Hoffman <thoffman@arnor.net>
1062306a36Sopenharmony_ci * Copyright (c) 2002 Vladimir Dergachev
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/module.h>
1462306a36Sopenharmony_ci#include <media/rc-map.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/*
1762306a36Sopenharmony_ci * Intended usage comments below are from vendor-supplied
1862306a36Sopenharmony_ci * Source: ATI REMOTE WONDER™ Installation Guide
1962306a36Sopenharmony_ci * http://www2.ati.com/manuals/remctrl.pdf
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci * Scancodes were in strict left-right, top-bottom order on the
2262306a36Sopenharmony_ci * original ATI Remote Wonder, but were moved on later models.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * Keys A-F are intended to be user-programmable.
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistatic struct rc_map_table ati_x10[] = {
2862306a36Sopenharmony_ci	/* keyboard - Above the cursor pad */
2962306a36Sopenharmony_ci	{ 0x00, KEY_A },
3062306a36Sopenharmony_ci	{ 0x01, KEY_B },
3162306a36Sopenharmony_ci	{ 0x02, KEY_POWER },      /* Power */
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	{ 0x03, KEY_TV },         /* TV */
3462306a36Sopenharmony_ci	{ 0x04, KEY_DVD },        /* DVD */
3562306a36Sopenharmony_ci	{ 0x05, KEY_WWW },        /* WEB */
3662306a36Sopenharmony_ci	{ 0x06, KEY_BOOKMARKS },  /* "book": Open Media Library */
3762306a36Sopenharmony_ci	{ 0x07, KEY_EDIT },       /* "hand": Toggle left mouse button (grab) */
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci	/* Mouse emulation pad goes here, handled by driver separately */
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	{ 0x09, KEY_VOLUMEDOWN }, /* VOL + */
4262306a36Sopenharmony_ci	{ 0x08, KEY_VOLUMEUP },   /* VOL - */
4362306a36Sopenharmony_ci	{ 0x0a, KEY_MUTE },       /* MUTE  */
4462306a36Sopenharmony_ci	{ 0x0b, KEY_CHANNELUP },  /* CH + */
4562306a36Sopenharmony_ci	{ 0x0c, KEY_CHANNELDOWN },/* CH - */
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci	/*
4862306a36Sopenharmony_ci	 * We could use KEY_NUMERIC_x for these, but the X11 protocol
4962306a36Sopenharmony_ci	 * has problems with keycodes greater than 255, so avoid those high
5062306a36Sopenharmony_ci	 * keycodes in default maps.
5162306a36Sopenharmony_ci	 */
5262306a36Sopenharmony_ci	{ 0x0d, KEY_NUMERIC_1 },
5362306a36Sopenharmony_ci	{ 0x0e, KEY_NUMERIC_2 },
5462306a36Sopenharmony_ci	{ 0x0f, KEY_NUMERIC_3 },
5562306a36Sopenharmony_ci	{ 0x10, KEY_NUMERIC_4 },
5662306a36Sopenharmony_ci	{ 0x11, KEY_NUMERIC_5 },
5762306a36Sopenharmony_ci	{ 0x12, KEY_NUMERIC_6 },
5862306a36Sopenharmony_ci	{ 0x13, KEY_NUMERIC_7 },
5962306a36Sopenharmony_ci	{ 0x14, KEY_NUMERIC_8 },
6062306a36Sopenharmony_ci	{ 0x15, KEY_NUMERIC_9 },
6162306a36Sopenharmony_ci	{ 0x16, KEY_MENU },       /* "menu": DVD root menu */
6262306a36Sopenharmony_ci				  /* KEY_NUMERIC_STAR? */
6362306a36Sopenharmony_ci	{ 0x17, KEY_NUMERIC_0 },
6462306a36Sopenharmony_ci	{ 0x18, KEY_SETUP },      /* "check": DVD setup menu */
6562306a36Sopenharmony_ci				  /* KEY_NUMERIC_POUND? */
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci	/* DVD navigation buttons */
6862306a36Sopenharmony_ci	{ 0x19, KEY_C },
6962306a36Sopenharmony_ci	{ 0x1a, KEY_UP },         /* up */
7062306a36Sopenharmony_ci	{ 0x1b, KEY_D },
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci	{ 0x1c, KEY_PROPS },      /* "timer" Should be Data On Screen */
7362306a36Sopenharmony_ci				  /* Symbol is "circle nailed to box" */
7462306a36Sopenharmony_ci	{ 0x1d, KEY_LEFT },       /* left */
7562306a36Sopenharmony_ci	{ 0x1e, KEY_OK },         /* "OK" */
7662306a36Sopenharmony_ci	{ 0x1f, KEY_RIGHT },      /* right */
7762306a36Sopenharmony_ci	{ 0x20, KEY_SCREEN },     /* "max" (X11 warning: 0x177) */
7862306a36Sopenharmony_ci				  /* Should be AC View Toggle, but
7962306a36Sopenharmony_ci				     that's not in <input/input.h>.
8062306a36Sopenharmony_ci				     KEY_ZOOM (0x174)? */
8162306a36Sopenharmony_ci	{ 0x21, KEY_E },
8262306a36Sopenharmony_ci	{ 0x22, KEY_DOWN },       /* down */
8362306a36Sopenharmony_ci	{ 0x23, KEY_F },
8462306a36Sopenharmony_ci	/* Play/stop/pause buttons */
8562306a36Sopenharmony_ci	{ 0x24, KEY_REWIND },     /* (<<) Rewind */
8662306a36Sopenharmony_ci	{ 0x25, KEY_PLAY },       /* ( >) Play (KEY_PLAYCD?) */
8762306a36Sopenharmony_ci	{ 0x26, KEY_FASTFORWARD }, /* (>>) Fast forward */
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci	{ 0x27, KEY_RECORD },     /* ( o) red */
9062306a36Sopenharmony_ci	{ 0x28, KEY_STOPCD },     /* ([]) Stop  (KEY_STOP is something else!) */
9162306a36Sopenharmony_ci	{ 0x29, KEY_PAUSE },      /* ('') Pause (KEY_PAUSECD?) */
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci	/* Extra keys, not on the original ATI remote */
9462306a36Sopenharmony_ci	{ 0x2a, KEY_NEXT },       /* (>+) */
9562306a36Sopenharmony_ci	{ 0x2b, KEY_PREVIOUS },   /* (<-) */
9662306a36Sopenharmony_ci	{ 0x2d, KEY_INFO },       /* PLAYING  (X11 warning: 0x166) */
9762306a36Sopenharmony_ci	{ 0x2e, KEY_HOME },       /* TOP */
9862306a36Sopenharmony_ci	{ 0x2f, KEY_END },        /* END */
9962306a36Sopenharmony_ci	{ 0x30, KEY_SELECT },     /* SELECT  (X11 warning: 0x161) */
10062306a36Sopenharmony_ci};
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_cistatic struct rc_map_list ati_x10_map = {
10362306a36Sopenharmony_ci	.map = {
10462306a36Sopenharmony_ci		.scan     = ati_x10,
10562306a36Sopenharmony_ci		.size     = ARRAY_SIZE(ati_x10),
10662306a36Sopenharmony_ci		.rc_proto = RC_PROTO_OTHER,
10762306a36Sopenharmony_ci		.name     = RC_MAP_ATI_X10,
10862306a36Sopenharmony_ci	}
10962306a36Sopenharmony_ci};
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_cistatic int __init init_rc_map_ati_x10(void)
11262306a36Sopenharmony_ci{
11362306a36Sopenharmony_ci	return rc_map_register(&ati_x10_map);
11462306a36Sopenharmony_ci}
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_cistatic void __exit exit_rc_map_ati_x10(void)
11762306a36Sopenharmony_ci{
11862306a36Sopenharmony_ci	rc_map_unregister(&ati_x10_map);
11962306a36Sopenharmony_ci}
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_cimodule_init(init_rc_map_ati_x10)
12262306a36Sopenharmony_cimodule_exit(exit_rc_map_ati_x10)
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ciMODULE_LICENSE("GPL");
12562306a36Sopenharmony_ciMODULE_AUTHOR("Anssi Hannula <anssi.hannula@iki.fi>");
126