drivers/media/pci/cx88/cx88-input.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/cx88/cx88-input.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/cx88/cx88-input.c- Extension
.c- Size
- 16936 bytes
- Lines
- 652
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
cx88.hlinux/init.hlinux/hrtimer.hlinux/pci.hlinux/slab.hlinux/module.hmedia/rc-core.h
Detected Declarations
struct cx88_IRfunction cx88_ir_handle_keyfunction cx88_ir_workfunction __cx88_ir_startfunction __cx88_ir_stopfunction cx88_ir_startfunction cx88_ir_stopfunction cx88_ir_openfunction cx88_ir_closefunction cx88_ir_initfunction cx88_ir_finifunction cx88_ir_irqfunction get_key_pvr2000function cx88_i2c_init_irexport cx88_ir_startexport cx88_ir_stop
Annotated Snippet
struct cx88_IR {
struct cx88_core *core;
struct rc_dev *dev;
int users;
char name[32];
char phys[32];
/* sample from gpio pin 16 */
u32 sampling;
/* poll external decoder */
int polling;
struct hrtimer timer;
u32 gpio_addr;
u32 last_gpio;
u32 mask_keycode;
u32 mask_keydown;
u32 mask_keyup;
};
static unsigned int ir_samplerate = 4;
module_param(ir_samplerate, uint, 0444);
MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4");
static int ir_debug;
module_param(ir_debug, int, 0644); /* debug level [IR] */
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
#define ir_dprintk(fmt, arg...) do { \
if (ir_debug) \
printk(KERN_DEBUG "%s IR: " fmt, ir->core->name, ##arg);\
} while (0)
#define dprintk(fmt, arg...) do { \
if (ir_debug) \
printk(KERN_DEBUG "cx88 IR: " fmt, ##arg); \
} while (0)
/* ---------------------------------------------------------------------- */
static void cx88_ir_handle_key(struct cx88_IR *ir)
{
struct cx88_core *core = ir->core;
u32 gpio, data, auxgpio;
/* read gpio value */
gpio = cx_read(ir->gpio_addr);
switch (core->boardnr) {
case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
/*
* This board apparently uses a combination of 2 GPIO
* to represent the keys. Additionally, the second GPIO
* can be used for parity.
*
* Example:
*
* for key "5"
* gpio = 0x758, auxgpio = 0xe5 or 0xf5
* for key "Power"
* gpio = 0x758, auxgpio = 0xed or 0xfd
*/
auxgpio = cx_read(MO_GP1_IO);
/* Take out the parity part */
gpio = (gpio & 0x7fd) + (auxgpio & 0xef);
break;
case CX88_BOARD_WINFAST_DTV1000:
case CX88_BOARD_WINFAST_DTV1800H:
case CX88_BOARD_WINFAST_DTV1800H_XC4000:
case CX88_BOARD_WINFAST_DTV2000H_PLUS:
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F36:
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F43:
gpio = (gpio & 0x6ff) | ((cx_read(MO_GP1_IO) << 8) & 0x900);
auxgpio = gpio;
break;
default:
auxgpio = gpio;
}
if (ir->polling) {
if (ir->last_gpio == auxgpio)
return;
ir->last_gpio = auxgpio;
}
/* extract data */
data = ir_extract_bits(gpio, ir->mask_keycode);
ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n",
Annotation
- Immediate include surface: `cx88.h`, `linux/init.h`, `linux/hrtimer.h`, `linux/pci.h`, `linux/slab.h`, `linux/module.h`, `media/rc-core.h`.
- Detected declarations: `struct cx88_IR`, `function cx88_ir_handle_key`, `function cx88_ir_work`, `function __cx88_ir_start`, `function __cx88_ir_stop`, `function cx88_ir_start`, `function cx88_ir_stop`, `function cx88_ir_open`, `function cx88_ir_close`, `function cx88_ir_init`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.