drivers/media/pci/saa7134/saa7134-input.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/saa7134/saa7134-input.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/saa7134/saa7134-input.c- Extension
.c- Size
- 26874 bytes
- Lines
- 1002
- 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.
- 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
saa7134.hsaa7134-reg.hlinux/module.hlinux/init.hlinux/delay.hlinux/interrupt.hlinux/slab.h
Detected Declarations
function build_keyfunction get_key_flydvb_triofunction get_key_msi_tvanywhere_plusfunction get_key_kworld_pc150ufunction get_key_purpletvfunction get_key_beholdm6xxfunction get_key_pinnaclefunction get_key_pinnacle_greyfunction get_key_pinnacle_colorfunction saa7134_input_irqfunction saa7134_input_timerfunction saa7134_ir_openfunction saa7134_ir_closefunction saa7134_input_init1function saa7134_input_finifunction saa7134_probe_i2c_irfunction saa7134_raw_decode_irq
Annotated Snippet
if ((attempt++) < 10) {
/*
* wait a bit for next attempt -
* I don't know how make it better
*/
msleep(10);
continue;
}
ir_dbg(ir, "send wake up byte to pic16C505 (IR chip)failed %dx\n",
attempt);
return -EIO;
}
rc = i2c_master_recv(ir->c, &b, 1);
if (rc != 1) {
ir_dbg(ir, "read error\n");
if (rc < 0)
return rc;
return -EIO;
}
*protocol = RC_PROTO_UNKNOWN;
*scancode = b;
*toggle = 0;
return 1;
}
static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir,
enum rc_proto *protocol,
u32 *scancode, u8 *toggle)
{
unsigned char b;
int gpio, rc;
/* <dev> is needed to access GPIO. Used by the saa_readl macro. */
struct saa7134_dev *dev = ir->c->adapter->algo_data;
if (dev == NULL) {
ir_dbg(ir, "get_key_msi_tvanywhere_plus: ir->c->adapter->algo_data is NULL!\n");
return -EIO;
}
/* rising SAA7134_GPIO_GPRESCAN reads the status */
saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
/* GPIO&0x40 is pulsed low when a button is pressed. Don't do
I2C receive if gpio&0x40 is not low. */
if (gpio & 0x40)
return 0; /* No button press */
/* GPIO says there is a button press. Get it. */
rc = i2c_master_recv(ir->c, &b, 1);
if (rc != 1) {
ir_dbg(ir, "read error\n");
if (rc < 0)
return rc;
return -EIO;
}
/* No button press */
if (b == 0xff)
return 0;
/* Button pressed */
input_dbg("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b);
*protocol = RC_PROTO_UNKNOWN;
*scancode = b;
*toggle = 0;
return 1;
}
/* copied and modified from get_key_msi_tvanywhere_plus() */
static int get_key_kworld_pc150u(struct IR_i2c *ir, enum rc_proto *protocol,
u32 *scancode, u8 *toggle)
{
unsigned char b;
unsigned int gpio;
int rc;
/* <dev> is needed to access GPIO. Used by the saa_readl macro. */
struct saa7134_dev *dev = ir->c->adapter->algo_data;
if (dev == NULL) {
ir_dbg(ir, "get_key_kworld_pc150u: ir->c->adapter->algo_data is NULL!\n");
return -EIO;
Annotation
- Immediate include surface: `saa7134.h`, `saa7134-reg.h`, `linux/module.h`, `linux/init.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/slab.h`.
- Detected declarations: `function build_key`, `function get_key_flydvb_trio`, `function get_key_msi_tvanywhere_plus`, `function get_key_kworld_pc150u`, `function get_key_purpletv`, `function get_key_beholdm6xx`, `function get_key_pinnacle`, `function get_key_pinnacle_grey`, `function get_key_pinnacle_color`, `function saa7134_input_irq`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.