drivers/input/keyboard/goldfish_events.c
Source file repositories/reference/linux-study-clean/drivers/input/keyboard/goldfish_events.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/keyboard/goldfish_events.c- Extension
.c- Size
- 4767 bytes
- Lines
- 202
- Domain
- Driver Families
- Bucket
- drivers/input
- 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
linux/module.hlinux/interrupt.hlinux/types.hlinux/input.hlinux/kernel.hlinux/platform_device.hlinux/slab.hlinux/irq.hlinux/io.hlinux/acpi.h
Detected Declarations
struct event_devfunction events_interruptfunction events_import_bitsfunction events_import_abs_paramsfunction events_probe
Annotated Snippet
struct event_dev {
struct input_dev *input;
int irq;
void __iomem *addr;
char name[];
};
static irqreturn_t events_interrupt(int irq, void *dev_id)
{
struct event_dev *edev = dev_id;
unsigned int type, code, value;
type = __raw_readl(edev->addr + REG_READ);
code = __raw_readl(edev->addr + REG_READ);
value = __raw_readl(edev->addr + REG_READ);
input_event(edev->input, type, code, value);
input_sync(edev->input);
return IRQ_HANDLED;
}
static void events_import_bits(struct event_dev *edev,
unsigned long bits[], unsigned int type, size_t count)
{
void __iomem *addr = edev->addr;
int i, j;
size_t size;
uint8_t val;
__raw_writel(PAGE_EVBITS | type, addr + REG_SET_PAGE);
size = __raw_readl(addr + REG_LEN) * 8;
if (size < count)
count = size;
addr += REG_DATA;
for (i = 0; i < count; i += 8) {
val = __raw_readb(addr++);
for (j = 0; j < 8; j++)
if (val & 1 << j)
set_bit(i + j, bits);
}
}
static void events_import_abs_params(struct event_dev *edev)
{
struct input_dev *input_dev = edev->input;
void __iomem *addr = edev->addr;
u32 val[4];
int count;
int i, j;
__raw_writel(PAGE_ABSDATA, addr + REG_SET_PAGE);
count = __raw_readl(addr + REG_LEN) / sizeof(val);
if (count > ABS_MAX)
count = ABS_MAX;
for (i = 0; i < count; i++) {
if (!test_bit(i, input_dev->absbit))
continue;
for (j = 0; j < ARRAY_SIZE(val); j++) {
int offset = (i * ARRAY_SIZE(val) + j) * sizeof(u32);
val[j] = __raw_readl(edev->addr + REG_DATA + offset);
}
input_set_abs_params(input_dev, i,
val[0], val[1], val[2], val[3]);
}
}
static int events_probe(struct platform_device *pdev)
{
struct input_dev *input_dev;
struct event_dev *edev;
struct resource *res;
unsigned int keymapnamelen;
void __iomem *addr;
int irq;
int i;
int error;
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return -EINVAL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
Annotation
- Immediate include surface: `linux/module.h`, `linux/interrupt.h`, `linux/types.h`, `linux/input.h`, `linux/kernel.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/irq.h`.
- Detected declarations: `struct event_dev`, `function events_interrupt`, `function events_import_bits`, `function events_import_abs_params`, `function events_probe`.
- Atlas domain: Driver Families / drivers/input.
- 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.