Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /* Keytable for the CEC remote control
0003  *
0004  * This keymap is unusual in that it can't be built as a module,
0005  * instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC
0006  * is set. This is because it can be called from drm_dp_cec_set_edid() via
0007  * cec_register_adapter() in an asynchronous context, and it is not
0008  * allowed to use request_module() to load rc-cec.ko in that case.
0009  *
0010  * Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we
0011  * just compile this keymap into the rc-core module and never as a
0012  * separate module.
0013  *
0014  * Copyright (c) 2015 by Kamil Debski
0015  */
0016 
0017 #include <media/rc-map.h>
0018 #include <linux/module.h>
0019 
0020 /*
0021  * CEC Spec "High-Definition Multimedia Interface Specification" can be obtained
0022  * here: http://xtreamerdev.googlecode.com/files/CEC_Specs.pdf
0023  * The list of control codes is listed in Table 27: User Control Codes p. 95
0024  */
0025 
0026 static struct rc_map_table cec[] = {
0027     { 0x00, KEY_OK },
0028     { 0x01, KEY_UP },
0029     { 0x02, KEY_DOWN },
0030     { 0x03, KEY_LEFT },
0031     { 0x04, KEY_RIGHT },
0032     { 0x05, KEY_RIGHT_UP },
0033     { 0x06, KEY_RIGHT_DOWN },
0034     { 0x07, KEY_LEFT_UP },
0035     { 0x08, KEY_LEFT_DOWN },
0036     { 0x09, KEY_ROOT_MENU }, /* CEC Spec: Device Root Menu - see Note 2 */
0037     /*
0038      * Note 2: This is the initial display that a device shows. It is
0039      * device-dependent and can be, for example, a contents menu, setup
0040      * menu, favorite menu or other menu. The actual menu displayed
0041      * may also depend on the device's current state.
0042      */
0043     { 0x0a, KEY_SETUP },
0044     { 0x0b, KEY_MENU }, /* CEC Spec: Contents Menu */
0045     { 0x0c, KEY_FAVORITES }, /* CEC Spec: Favorite Menu */
0046     { 0x0d, KEY_EXIT },
0047     /* 0x0e-0x0f: Reserved */
0048     { 0x10, KEY_MEDIA_TOP_MENU },
0049     { 0x11, KEY_CONTEXT_MENU },
0050     /* 0x12-0x1c: Reserved */
0051     { 0x1d, KEY_DIGITS }, /* CEC Spec: select/toggle a Number Entry Mode */
0052     { 0x1e, KEY_NUMERIC_11 },
0053     { 0x1f, KEY_NUMERIC_12 },
0054     /* 0x20-0x29: Keys 0 to 9 */
0055     { 0x20, KEY_NUMERIC_0 },
0056     { 0x21, KEY_NUMERIC_1 },
0057     { 0x22, KEY_NUMERIC_2 },
0058     { 0x23, KEY_NUMERIC_3 },
0059     { 0x24, KEY_NUMERIC_4 },
0060     { 0x25, KEY_NUMERIC_5 },
0061     { 0x26, KEY_NUMERIC_6 },
0062     { 0x27, KEY_NUMERIC_7 },
0063     { 0x28, KEY_NUMERIC_8 },
0064     { 0x29, KEY_NUMERIC_9 },
0065     { 0x2a, KEY_DOT },
0066     { 0x2b, KEY_ENTER },
0067     { 0x2c, KEY_CLEAR },
0068     /* 0x2d-0x2e: Reserved */
0069     { 0x2f, KEY_NEXT_FAVORITE }, /* CEC Spec: Next Favorite */
0070     { 0x30, KEY_CHANNELUP },
0071     { 0x31, KEY_CHANNELDOWN },
0072     { 0x32, KEY_PREVIOUS }, /* CEC Spec: Previous Channel */
0073     { 0x33, KEY_SOUND }, /* CEC Spec: Sound Select */
0074     { 0x34, KEY_VIDEO }, /* 0x34: CEC Spec: Input Select */
0075     { 0x35, KEY_INFO }, /* CEC Spec: Display Information */
0076     { 0x36, KEY_HELP },
0077     { 0x37, KEY_PAGEUP },
0078     { 0x38, KEY_PAGEDOWN },
0079     /* 0x39-0x3f: Reserved */
0080     { 0x40, KEY_POWER },
0081     { 0x41, KEY_VOLUMEUP },
0082     { 0x42, KEY_VOLUMEDOWN },
0083     { 0x43, KEY_MUTE },
0084     { 0x44, KEY_PLAYCD },
0085     { 0x45, KEY_STOPCD },
0086     { 0x46, KEY_PAUSECD },
0087     { 0x47, KEY_RECORD },
0088     { 0x48, KEY_REWIND },
0089     { 0x49, KEY_FASTFORWARD },
0090     { 0x4a, KEY_EJECTCD }, /* CEC Spec: Eject */
0091     { 0x4b, KEY_FORWARD },
0092     { 0x4c, KEY_BACK },
0093     { 0x4d, KEY_STOP_RECORD }, /* CEC Spec: Stop-Record */
0094     { 0x4e, KEY_PAUSE_RECORD }, /* CEC Spec: Pause-Record */
0095     /* 0x4f: Reserved */
0096     { 0x50, KEY_ANGLE },
0097     { 0x51, KEY_TV2 },
0098     { 0x52, KEY_VOD }, /* CEC Spec: Video on Demand */
0099     { 0x53, KEY_EPG },
0100     { 0x54, KEY_TIME }, /* CEC Spec: Timer */
0101     { 0x55, KEY_CONFIG },
0102     /*
0103      * The following codes are hard to implement at this moment, as they
0104      * carry an additional additional argument. Most likely changes to RC
0105      * framework are necessary.
0106      * For now they are interpreted by the CEC framework as non keycodes
0107      * and are passed as messages enabling user application to parse them.
0108      */
0109     /* 0x56: CEC Spec: Select Broadcast Type */
0110     /* 0x57: CEC Spec: Select Sound presentation */
0111     { 0x58, KEY_AUDIO_DESC }, /* CEC 2.0 and up */
0112     { 0x59, KEY_WWW }, /* CEC 2.0 and up */
0113     { 0x5a, KEY_3D_MODE }, /* CEC 2.0 and up */
0114     /* 0x5b-0x5f: Reserved */
0115     { 0x60, KEY_PLAYCD }, /* CEC Spec: Play Function */
0116     { 0x6005, KEY_FASTFORWARD },
0117     { 0x6006, KEY_FASTFORWARD },
0118     { 0x6007, KEY_FASTFORWARD },
0119     { 0x6015, KEY_SLOW },
0120     { 0x6016, KEY_SLOW },
0121     { 0x6017, KEY_SLOW },
0122     { 0x6009, KEY_FASTREVERSE },
0123     { 0x600a, KEY_FASTREVERSE },
0124     { 0x600b, KEY_FASTREVERSE },
0125     { 0x6019, KEY_SLOWREVERSE },
0126     { 0x601a, KEY_SLOWREVERSE },
0127     { 0x601b, KEY_SLOWREVERSE },
0128     { 0x6020, KEY_REWIND },
0129     { 0x6024, KEY_PLAYCD },
0130     { 0x6025, KEY_PAUSECD },
0131     { 0x61, KEY_PLAYPAUSE }, /* CEC Spec: Pause-Play Function */
0132     { 0x62, KEY_RECORD }, /* Spec: Record Function */
0133     { 0x63, KEY_PAUSE_RECORD }, /* CEC Spec: Pause-Record Function */
0134     { 0x64, KEY_STOPCD }, /* CEC Spec: Stop Function */
0135     { 0x65, KEY_MUTE }, /* CEC Spec: Mute Function */
0136     { 0x66, KEY_UNMUTE }, /* CEC Spec: Restore the volume */
0137     /*
0138      * The following codes are hard to implement at this moment, as they
0139      * carry an additional additional argument. Most likely changes to RC
0140      * framework are necessary.
0141      * For now they are interpreted by the CEC framework as non keycodes
0142      * and are passed as messages enabling user application to parse them.
0143      */
0144     /* 0x67: CEC Spec: Tune Function */
0145     /* 0x68: CEC Spec: Seleect Media Function */
0146     /* 0x69: CEC Spec: Select A/V Input Function */
0147     /* 0x6a: CEC Spec: Select Audio Input Function */
0148     { 0x6b, KEY_POWER }, /* CEC Spec: Power Toggle Function */
0149     { 0x6c, KEY_SLEEP }, /* CEC Spec: Power Off Function */
0150     { 0x6d, KEY_WAKEUP }, /* CEC Spec: Power On Function */
0151     /* 0x6e-0x70: Reserved */
0152     { 0x71, KEY_BLUE }, /* CEC Spec: F1 (Blue) */
0153     { 0x72, KEY_RED }, /* CEC Spec: F2 (Red) */
0154     { 0x73, KEY_GREEN }, /* CEC Spec: F3 (Green) */
0155     { 0x74, KEY_YELLOW }, /* CEC Spec: F4 (Yellow) */
0156     { 0x75, KEY_F5 },
0157     { 0x76, KEY_DATA }, /* CEC Spec: Data - see Note 3 */
0158     /*
0159      * Note 3: This is used, for example, to enter or leave a digital TV
0160      * data broadcast application.
0161      */
0162     /* 0x77-0xff: Reserved */
0163 };
0164 
0165 struct rc_map_list cec_map = {
0166     .map = {
0167         .scan       = cec,
0168         .size       = ARRAY_SIZE(cec),
0169         .rc_proto   = RC_PROTO_CEC,
0170         .name       = RC_MAP_CEC,
0171     }
0172 };