drivers/input/keyboard/qt1050.c
Source file repositories/reference/linux-study-clean/drivers/input/keyboard/qt1050.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/keyboard/qt1050.c- Extension
.c- Size
- 15062 bytes
- Lines
- 598
- 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/delay.hlinux/i2c.hlinux/input.hlinux/interrupt.hlinux/kernel.hlinux/log2.hlinux/module.hlinux/of.hlinux/regmap.h
Detected Declarations
struct qt1050_key_regsstruct qt1050_keystruct qt1050_privfunction qt1050_volatile_regfunction qt1050_identifyfunction qt1050_irq_threadedfunction qt1050_set_keyfunction qt1050_apply_fw_datafunction qt1050_parse_fwfunction device_for_each_child_node_scopedfunction qt1050_probefunction qt1050_suspendfunction qt1050_resume
Annotated Snippet
struct qt1050_key_regs {
unsigned int nthr;
unsigned int pulse_scale;
unsigned int di_aks;
unsigned int csd;
};
struct qt1050_key {
u32 num;
u32 charge_delay;
u32 thr_cnt;
u32 samples;
u32 scale;
u32 keycode;
};
struct qt1050_priv {
struct i2c_client *client;
struct input_dev *input;
struct regmap *regmap;
struct qt1050_key keys[QT1050_MAX_KEYS];
unsigned short keycodes[QT1050_MAX_KEYS];
u8 reg_keys;
u8 last_keys;
};
static const struct qt1050_key_regs qt1050_key_regs_data[] = {
{
.nthr = QT1050_NTHR_0,
.pulse_scale = QT1050_PULSE_SCALE_0,
.di_aks = QT1050_DI_AKS_0,
.csd = QT1050_CSD_0,
}, {
.nthr = QT1050_NTHR_1,
.pulse_scale = QT1050_PULSE_SCALE_1,
.di_aks = QT1050_DI_AKS_1,
.csd = QT1050_CSD_1,
}, {
.nthr = QT1050_NTHR_2,
.pulse_scale = QT1050_PULSE_SCALE_2,
.di_aks = QT1050_DI_AKS_2,
.csd = QT1050_CSD_2,
}, {
.nthr = QT1050_NTHR_3,
.pulse_scale = QT1050_PULSE_SCALE_3,
.di_aks = QT1050_DI_AKS_3,
.csd = QT1050_CSD_3,
}, {
.nthr = QT1050_NTHR_4,
.pulse_scale = QT1050_PULSE_SCALE_4,
.di_aks = QT1050_DI_AKS_4,
.csd = QT1050_CSD_4,
}
};
static bool qt1050_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case QT1050_DET_STATUS:
case QT1050_KEY_STATUS:
case QT1050_KEY_SIGNAL_0_MSB:
case QT1050_KEY_SIGNAL_0_LSB:
case QT1050_KEY_SIGNAL_1_MSB:
case QT1050_KEY_SIGNAL_1_LSB:
case QT1050_KEY_SIGNAL_2_MSB:
case QT1050_KEY_SIGNAL_2_LSB:
case QT1050_KEY_SIGNAL_3_MSB:
case QT1050_KEY_SIGNAL_3_LSB:
case QT1050_KEY_SIGNAL_4_MSB:
case QT1050_KEY_SIGNAL_4_LSB:
return true;
default:
return false;
}
}
static const struct regmap_range qt1050_readable_ranges[] = {
regmap_reg_range(QT1050_CHIP_ID, QT1050_KEY_STATUS),
regmap_reg_range(QT1050_KEY_SIGNAL_0_MSB, QT1050_KEY_SIGNAL_1_LSB),
regmap_reg_range(QT1050_KEY_SIGNAL_2_MSB, QT1050_KEY_SIGNAL_4_LSB),
regmap_reg_range(QT1050_REF_DATA_0_MSB, QT1050_REF_DATA_1_LSB),
regmap_reg_range(QT1050_REF_DATA_2_MSB, QT1050_REF_DATA_4_LSB),
regmap_reg_range(QT1050_NTHR_0, QT1050_NTHR_1),
regmap_reg_range(QT1050_NTHR_2, QT1050_NTHR_4),
regmap_reg_range(QT1050_PULSE_SCALE_0, QT1050_PULSE_SCALE_1),
regmap_reg_range(QT1050_PULSE_SCALE_2, QT1050_PULSE_SCALE_4),
regmap_reg_range(QT1050_DI_AKS_0, QT1050_DI_AKS_1),
regmap_reg_range(QT1050_DI_AKS_2, QT1050_DI_AKS_4),
regmap_reg_range(QT1050_CSD_0, QT1050_CSD_1),
regmap_reg_range(QT1050_CSD_2, QT1050_RES_CAL),
Annotation
- Immediate include surface: `linux/delay.h`, `linux/i2c.h`, `linux/input.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/log2.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct qt1050_key_regs`, `struct qt1050_key`, `struct qt1050_priv`, `function qt1050_volatile_reg`, `function qt1050_identify`, `function qt1050_irq_threaded`, `function qt1050_set_key`, `function qt1050_apply_fw_data`, `function qt1050_parse_fw`, `function device_for_each_child_node_scoped`.
- 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.