drivers/input/keyboard/cap11xx.c
Source file repositories/reference/linux-study-clean/drivers/input/keyboard/cap11xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/keyboard/cap11xx.c- Extension
.c- Size
- 18749 bytes
- Lines
- 679
- 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/kernel.hlinux/module.hlinux/interrupt.hlinux/input.hlinux/leds.hlinux/of.hlinux/regmap.hlinux/i2c.hlinux/gpio/consumer.hlinux/bitfield.h
Detected Declarations
struct cap11xx_ledstruct cap11xx_privstruct cap11xx_hw_modelfunction cap11xx_volatile_regfunction cap11xx_write_calib_sens_config_1function cap11xx_write_calib_sens_config_2function cap11xx_init_keysfunction cap11xx_thread_funcfunction cap11xx_set_sleepfunction cap11xx_input_openfunction cap11xx_input_closefunction cap11xx_led_setfunction cap11xx_init_ledsfunction for_each_child_of_node_scopedfunction cap11xx_init_ledsfunction cap11xx_i2c_probe
Annotated Snippet
struct cap11xx_led {
struct cap11xx_priv *priv;
struct led_classdev cdev;
u32 reg;
};
#endif
struct cap11xx_priv {
struct regmap *regmap;
struct device *dev;
struct input_dev *idev;
const struct cap11xx_hw_model *model;
struct cap11xx_led *leds;
int num_leds;
/* config */
u8 analog_gain;
u8 sensitivity_delta_sense;
u8 signal_guard_inputs_mask;
u32 thresholds[8];
u32 calib_sensitivities[8];
u32 keycodes[];
};
struct cap11xx_hw_model {
u8 product_id;
unsigned int num_channels;
unsigned int num_leds;
bool has_gain;
bool has_irq_config;
bool has_sensitivity_control;
bool has_signal_guard;
};
static const struct reg_default cap11xx_reg_defaults[] = {
{ CAP11XX_REG_MAIN_CONTROL, 0x00 },
{ CAP11XX_REG_GENERAL_STATUS, 0x00 },
{ CAP11XX_REG_SENSOR_INPUT, 0x00 },
{ CAP11XX_REG_NOISE_FLAG_STATUS, 0x00 },
{ CAP11XX_REG_SENSITIVITY_CONTROL, 0x2f },
{ CAP11XX_REG_CONFIG, 0x20 },
{ CAP11XX_REG_SENSOR_ENABLE, 0x3f },
{ CAP11XX_REG_SENSOR_CONFIG, 0xa4 },
{ CAP11XX_REG_SENSOR_CONFIG2, 0x07 },
{ CAP11XX_REG_SAMPLING_CONFIG, 0x39 },
{ CAP11XX_REG_CALIBRATION, 0x00 },
{ CAP11XX_REG_INT_ENABLE, 0x3f },
{ CAP11XX_REG_REPEAT_RATE, 0x3f },
{ CAP11XX_REG_MT_CONFIG, 0x80 },
{ CAP11XX_REG_MT_PATTERN_CONFIG, 0x00 },
{ CAP11XX_REG_MT_PATTERN, 0x3f },
{ CAP11XX_REG_RECALIB_CONFIG, 0x8a },
{ CAP11XX_REG_SENSOR_THRESH(0), 0x40 },
{ CAP11XX_REG_SENSOR_THRESH(1), 0x40 },
{ CAP11XX_REG_SENSOR_THRESH(2), 0x40 },
{ CAP11XX_REG_SENSOR_THRESH(3), 0x40 },
{ CAP11XX_REG_SENSOR_THRESH(4), 0x40 },
{ CAP11XX_REG_SENSOR_THRESH(5), 0x40 },
{ CAP11XX_REG_SENSOR_NOISE_THRESH, 0x01 },
{ CAP11XX_REG_STANDBY_CHANNEL, 0x00 },
{ CAP11XX_REG_STANDBY_CONFIG, 0x39 },
{ CAP11XX_REG_STANDBY_SENSITIVITY, 0x02 },
{ CAP11XX_REG_STANDBY_THRESH, 0x40 },
{ CAP11XX_REG_CONFIG2, 0x40 },
{ CAP11XX_REG_LED_POLARITY, 0x00 },
{ CAP11XX_REG_SENSOR_CALIB_LSB1, 0x00 },
{ CAP11XX_REG_SENSOR_CALIB_LSB2, 0x00 },
};
static bool cap11xx_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case CAP11XX_REG_MAIN_CONTROL:
case CAP11XX_REG_SENSOR_INPUT:
case CAP11XX_REG_SENOR_DELTA(0):
case CAP11XX_REG_SENOR_DELTA(1):
case CAP11XX_REG_SENOR_DELTA(2):
case CAP11XX_REG_SENOR_DELTA(3):
case CAP11XX_REG_SENOR_DELTA(4):
case CAP11XX_REG_SENOR_DELTA(5):
return true;
}
return false;
}
static const struct regmap_config cap11xx_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/interrupt.h`, `linux/input.h`, `linux/leds.h`, `linux/of.h`, `linux/regmap.h`, `linux/i2c.h`.
- Detected declarations: `struct cap11xx_led`, `struct cap11xx_priv`, `struct cap11xx_hw_model`, `function cap11xx_volatile_reg`, `function cap11xx_write_calib_sens_config_1`, `function cap11xx_write_calib_sens_config_2`, `function cap11xx_init_keys`, `function cap11xx_thread_func`, `function cap11xx_set_sleep`, `function cap11xx_input_open`.
- 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.