drivers/platform/x86/hp/hp_accel.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/hp/hp_accel.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/hp/hp_accel.c- Extension
.c- Size
- 11902 bytes
- Lines
- 390
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/init.hlinux/dmi.hlinux/module.hlinux/types.hlinux/platform_device.hlinux/interrupt.hlinux/delay.hlinux/wait.hlinux/poll.hlinux/freezer.hlinux/uaccess.hlinux/leds.hlinux/atomic.hlinux/acpi.hlinux/i8042.hlinux/serio.h../../../misc/lis3lv02d/lis3lv02d.h
Detected Declarations
struct delayed_led_classdevfunction delayed_set_status_workerfunction delayed_sysfs_setfunction lis3lv02d_acpi_initfunction lis3lv02d_acpi_readfunction lis3lv02d_acpi_writefunction lis3lv02d_dmi_matchedfunction DMI_MATCHfunction hpled_setfunction hp_accel_i8042_filterfunction lis3lv02d_probefunction lis3lv02d_removefunction lis3lv02d_suspendfunction lis3lv02d_resume
Annotated Snippet
struct delayed_led_classdev {
struct led_classdev led_classdev;
struct work_struct work;
enum led_brightness new_brightness;
unsigned int led; /* For driver */
void (*set_brightness)(struct delayed_led_classdev *data, enum led_brightness value);
};
static inline void delayed_set_status_worker(struct work_struct *work)
{
struct delayed_led_classdev *data =
container_of(work, struct delayed_led_classdev, work);
data->set_brightness(data, data->new_brightness);
}
static inline void delayed_sysfs_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
struct delayed_led_classdev *data = container_of(led_cdev,
struct delayed_led_classdev, led_classdev);
data->new_brightness = brightness;
schedule_work(&data->work);
}
/* HP-specific accelerometer driver ------------------------------------ */
/* e0 25, e0 26, e0 27, e0 28 are scan codes that the accelerometer with acpi id
* HPQ6000 sends through the keyboard bus */
#define ACCEL_1 0x25
#define ACCEL_2 0x26
#define ACCEL_3 0x27
#define ACCEL_4 0x28
/* For automatic insertion of the module */
static const struct acpi_device_id lis3lv02d_device_ids[] = {
{"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */
{"HPQ6000", 0}, /* HP Mobile Data Protection System PNP */
{"HPQ6007", 0}, /* HP Mobile Data Protection System PNP */
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids);
/**
* lis3lv02d_acpi_init - initialize the device for ACPI
* @lis3: pointer to the device struct
*
* Returns 0 on success.
*/
static int lis3lv02d_acpi_init(struct lis3lv02d *lis3)
{
return 0;
}
/**
* lis3lv02d_acpi_read - ACPI ALRD method: read a register
* @lis3: pointer to the device struct
* @reg: the register to read
* @ret: result of the operation
*
* Returns 0 on success.
*/
static int lis3lv02d_acpi_read(struct lis3lv02d *lis3, int reg, u8 *ret)
{
struct acpi_device *dev = lis3->bus_priv;
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list args = { 1, &arg0 };
unsigned long long lret;
acpi_status status;
arg0.integer.value = reg;
status = acpi_evaluate_integer(dev->handle, "ALRD", &args, &lret);
if (ACPI_FAILURE(status))
return -EINVAL;
*ret = lret;
return 0;
}
/**
* lis3lv02d_acpi_write - ACPI ALWR method: write to a register
* @lis3: pointer to the device struct
* @reg: the register to write to
* @val: the value to write
*
* Returns 0 on success.
*/
static int lis3lv02d_acpi_write(struct lis3lv02d *lis3, int reg, u8 val)
{
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/dmi.h`, `linux/module.h`, `linux/types.h`, `linux/platform_device.h`, `linux/interrupt.h`, `linux/delay.h`.
- Detected declarations: `struct delayed_led_classdev`, `function delayed_set_status_worker`, `function delayed_sysfs_set`, `function lis3lv02d_acpi_init`, `function lis3lv02d_acpi_read`, `function lis3lv02d_acpi_write`, `function lis3lv02d_dmi_matched`, `function DMI_MATCH`, `function hpled_set`, `function hp_accel_i8042_filter`.
- Atlas domain: Driver Families / drivers/platform.
- 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.