drivers/media/rc/keymaps/rc-cec.c
Source file repositories/reference/linux-study-clean/drivers/media/rc/keymaps/rc-cec.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/rc/keymaps/rc-cec.c- Extension
.c- Size
- 5987 bytes
- Lines
- 173
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
media/rc-map.hlinux/module.h
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/* Keytable for the CEC remote control
*
* This keymap is unusual in that it can't be built as a module,
* instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC
* is set. This is because it can be called from drm_dp_cec_set_edid() via
* cec_register_adapter() in an asynchronous context, and it is not
* allowed to use request_module() to load rc-cec.ko in that case.
*
* Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we
* just compile this keymap into the rc-core module and never as a
* separate module.
*
* Copyright (c) 2015 by Kamil Debski
*/
#include <media/rc-map.h>
#include <linux/module.h>
/*
* CEC Spec "High-Definition Multimedia Interface Specification" can be obtained
* here: http://xtreamerdev.googlecode.com/files/CEC_Specs.pdf
* The list of control codes is listed in Table 27: User Control Codes p. 95
*/
static struct rc_map_table cec[] = {
{ 0x00, KEY_OK },
{ 0x01, KEY_UP },
{ 0x02, KEY_DOWN },
{ 0x03, KEY_LEFT },
{ 0x04, KEY_RIGHT },
{ 0x05, KEY_RIGHT_UP },
{ 0x06, KEY_RIGHT_DOWN },
{ 0x07, KEY_LEFT_UP },
{ 0x08, KEY_LEFT_DOWN },
{ 0x09, KEY_ROOT_MENU }, /* CEC Spec: Device Root Menu - see Note 2 */
/*
* Note 2: This is the initial display that a device shows. It is
* device-dependent and can be, for example, a contents menu, setup
* menu, favorite menu or other menu. The actual menu displayed
* may also depend on the device's current state.
*/
{ 0x0a, KEY_SETUP },
{ 0x0b, KEY_MENU }, /* CEC Spec: Contents Menu */
{ 0x0c, KEY_FAVORITES }, /* CEC Spec: Favorite Menu */
{ 0x0d, KEY_EXIT },
/* 0x0e-0x0f: Reserved */
{ 0x10, KEY_MEDIA_TOP_MENU },
{ 0x11, KEY_CONTEXT_MENU },
/* 0x12-0x1c: Reserved */
{ 0x1d, KEY_DIGITS }, /* CEC Spec: select/toggle a Number Entry Mode */
{ 0x1e, KEY_NUMERIC_11 },
{ 0x1f, KEY_NUMERIC_12 },
/* 0x20-0x29: Keys 0 to 9 */
{ 0x20, KEY_NUMERIC_0 },
{ 0x21, KEY_NUMERIC_1 },
{ 0x22, KEY_NUMERIC_2 },
{ 0x23, KEY_NUMERIC_3 },
{ 0x24, KEY_NUMERIC_4 },
{ 0x25, KEY_NUMERIC_5 },
{ 0x26, KEY_NUMERIC_6 },
{ 0x27, KEY_NUMERIC_7 },
{ 0x28, KEY_NUMERIC_8 },
{ 0x29, KEY_NUMERIC_9 },
{ 0x2a, KEY_DOT },
{ 0x2b, KEY_ENTER },
{ 0x2c, KEY_CLEAR },
/* 0x2d-0x2e: Reserved */
{ 0x2f, KEY_NEXT_FAVORITE }, /* CEC Spec: Next Favorite */
{ 0x30, KEY_CHANNELUP },
{ 0x31, KEY_CHANNELDOWN },
{ 0x32, KEY_PREVIOUS }, /* CEC Spec: Previous Channel */
{ 0x33, KEY_SOUND }, /* CEC Spec: Sound Select */
{ 0x34, KEY_VIDEO }, /* 0x34: CEC Spec: Input Select */
{ 0x35, KEY_INFO }, /* CEC Spec: Display Information */
{ 0x36, KEY_HELP },
{ 0x37, KEY_PAGEUP },
{ 0x38, KEY_PAGEDOWN },
/* 0x39-0x3f: Reserved */
{ 0x40, KEY_POWER },
{ 0x41, KEY_VOLUMEUP },
{ 0x42, KEY_VOLUMEDOWN },
{ 0x43, KEY_MUTE },
{ 0x44, KEY_PLAYCD },
{ 0x45, KEY_STOPCD },
{ 0x46, KEY_PAUSECD },
{ 0x47, KEY_RECORD },
{ 0x48, KEY_REWIND },
{ 0x49, KEY_FASTFORWARD },
{ 0x4a, KEY_EJECTCD }, /* CEC Spec: Eject */
Annotation
- Immediate include surface: `media/rc-map.h`, `linux/module.h`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.