drivers/input/misc/cs40l50-vibra.c
Source file repositories/reference/linux-study-clean/drivers/input/misc/cs40l50-vibra.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/misc/cs40l50-vibra.c- Extension
.c- Size
- 14294 bytes
- Lines
- 555
- 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.
- 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/bitfield.hlinux/input.hlinux/mfd/cs40l50.hlinux/platform_device.hlinux/pm_runtime.h
Detected Declarations
struct cs40l50_bankstruct cs40l50_effectstruct cs40l50_vibra_dspstruct cs40l50_vibrastruct cs40l50_workstruct cs40l50_owt_headerenum cs40l50_bank_typefunction cs40l50_effect_bank_setfunction cs40l50_effect_index_setfunction cs40l50_effect_gpio_mapping_setfunction cs40l50_upload_owtfunction cs40l50_add_workerfunction cs40l50_addfunction cs40l50_start_workerfunction cs40l50_stop_workerfunction cs40l50_playbackfunction cs40l50_erase_workerfunction cs40l50_erasefunction cs40l50_remove_wqfunction cs40l50_vibra_probe
Annotated Snippet
struct cs40l50_bank {
enum cs40l50_bank_type type;
u32 base_index;
u32 max_index;
};
struct cs40l50_effect {
enum cs40l50_bank_type type;
struct list_head list;
u32 gpio_reg;
u32 index;
int id;
};
/* Describes haptic interface of loaded DSP firmware */
struct cs40l50_vibra_dsp {
struct cs40l50_bank *banks;
u32 gpio_base_reg;
u32 owt_offset_reg;
u32 owt_size_reg;
u32 owt_base_reg;
u32 push_owt_cmd;
u32 delete_owt_cmd;
u32 stop_cmd;
int (*write)(struct device *dev, struct regmap *regmap, u32 val);
};
/* Describes configuration and state of haptic operations */
struct cs40l50_vibra {
struct device *dev;
struct regmap *regmap;
struct input_dev *input;
struct workqueue_struct *vib_wq;
struct list_head effect_head;
struct cs40l50_vibra_dsp dsp;
};
struct cs40l50_work {
struct cs40l50_vibra *vib;
struct ff_effect *effect;
struct work_struct work;
s16 *custom_data;
int custom_len;
int count;
int error;
};
static struct cs40l50_bank cs40l50_banks[] = {
{
.type = CS40L50_WVFRM_BANK_RAM,
.base_index = CS40L50_RAM_INDEX_START,
.max_index = CS40L50_RAM_INDEX_END,
},
{
.type = CS40L50_WVFRM_BANK_ROM,
.base_index = CS40L50_ROM_INDEX_START,
.max_index = CS40L50_ROM_INDEX_END,
},
{
.type = CS40L50_WVFRM_BANK_OWT,
.base_index = CS40L50_RTH_INDEX_START,
.max_index = CS40L50_RTH_INDEX_END,
},
};
static struct cs40l50_vibra_dsp cs40l50_dsp = {
.banks = cs40l50_banks,
.gpio_base_reg = CS40L50_GPIO_BASE,
.owt_base_reg = CS40L50_OWT_BASE,
.owt_offset_reg = CS40L50_OWT_NEXT,
.owt_size_reg = CS40L50_OWT_SIZE,
.push_owt_cmd = CS40L50_OWT_PUSH,
.delete_owt_cmd = CS40L50_OWT_DELETE,
.stop_cmd = CS40L50_STOP_PLAYBACK,
.write = cs40l50_dsp_write,
};
static struct cs40l50_effect *cs40l50_find_effect(int id, struct list_head *effect_head)
{
struct cs40l50_effect *effect;
list_for_each_entry(effect, effect_head, list)
if (effect->id == id)
return effect;
return NULL;
}
static int cs40l50_effect_bank_set(struct cs40l50_work *work_data,
struct cs40l50_effect *effect)
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/input.h`, `linux/mfd/cs40l50.h`, `linux/platform_device.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct cs40l50_bank`, `struct cs40l50_effect`, `struct cs40l50_vibra_dsp`, `struct cs40l50_vibra`, `struct cs40l50_work`, `struct cs40l50_owt_header`, `enum cs40l50_bank_type`, `function cs40l50_effect_bank_set`, `function cs40l50_effect_index_set`, `function cs40l50_effect_gpio_mapping_set`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: source implementation candidate.
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.