drivers/hid/hid-nvidia-shield.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-nvidia-shield.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-nvidia-shield.c- Extension
.c- Size
- 31715 bytes
- Lines
- 1135
- Domain
- Driver Families
- Bucket
- drivers/hid
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/hid.hlinux/idr.hlinux/input-event-codes.hlinux/input.hlinux/jiffies.hlinux/leds.hlinux/module.hlinux/power_supply.hlinux/spinlock.hlinux/timer.hlinux/workqueue.hhid-ids.h
Detected Declarations
struct power_supply_devstruct thunderstrike_psy_prop_valuesstruct thunderstrike_hostcmd_batterystruct thunderstrike_hostcmd_chargerstruct thunderstrike_hostcmd_board_infostruct thunderstrike_hostcmd_hapticsstruct thunderstrike_hostcmd_resp_reportstruct thunderstrike_hostcmd_req_reportstruct __packedstruct __packedstruct shield_devicestruct thunderstrikeenum thunderstrike_led_stateenum thunderstrike_charger_typeenum thunderstrike_charger_statefunction thunderstrike_hostcmd_req_report_initfunction shield_strrevfunction thunderstrike_send_hostcmd_requestfunction thunderstrike_hostcmd_req_work_handlerfunction thunderstrike_request_firmware_versionfunction thunderstrike_request_board_infofunction thunderstrike_update_hapticsfunction thunderstrike_play_effectfunction thunderstrike_led_get_brightnessfunction thunderstrike_led_set_brightnessfunction thunderstrike_battery_get_propertyfunction thunderstrike_request_psy_statsfunction thunderstrike_psy_stats_timer_handlerfunction thunderstrike_parse_fw_version_payloadfunction thunderstrike_parse_board_info_payloadfunction thunderstrike_parse_haptics_payloadfunction thunderstrike_parse_led_payloadfunction thunderstrike_parse_battery_payloadfunction thunderstrike_parse_charger_payloadfunction thunderstrike_device_init_infofunction thunderstrike_parse_reportfunction thunderstrike_led_createfunction thunderstrike_psy_createfunction thunderstrike_destroyfunction android_input_mappingfunction firmware_version_showfunction hardware_version_showfunction serial_number_showfunction shield_raw_eventfunction shield_probefunction shield_remove
Annotated Snippet
struct power_supply_dev {
struct power_supply *psy;
struct power_supply_desc desc;
};
struct thunderstrike_psy_prop_values {
int voltage_min;
int voltage_now;
int voltage_avg;
int voltage_boot;
int capacity;
int status;
int charge_type;
int temp;
};
static const enum power_supply_property thunderstrike_battery_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_CHARGE_TYPE,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_VOLTAGE_MIN,
POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_VOLTAGE_AVG,
POWER_SUPPLY_PROP_VOLTAGE_BOOT,
POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_SCOPE,
POWER_SUPPLY_PROP_TEMP,
POWER_SUPPLY_PROP_TEMP_MIN,
POWER_SUPPLY_PROP_TEMP_MAX,
POWER_SUPPLY_PROP_TEMP_ALERT_MIN,
POWER_SUPPLY_PROP_TEMP_ALERT_MAX,
};
enum thunderstrike_led_state {
THUNDERSTRIKE_LED_OFF = 1,
THUNDERSTRIKE_LED_ON = 8,
} __packed;
static_assert(sizeof(enum thunderstrike_led_state) == 1);
struct thunderstrike_hostcmd_battery {
__le16 voltage_avg;
u8 reserved_at_10;
__le16 thermistor;
__le16 voltage_min;
__le16 voltage_boot;
__le16 voltage_now;
u8 capacity;
} __packed;
enum thunderstrike_charger_type {
THUNDERSTRIKE_CHARGER_TYPE_NONE = 0,
THUNDERSTRIKE_CHARGER_TYPE_TRICKLE,
THUNDERSTRIKE_CHARGER_TYPE_NORMAL,
} __packed;
static_assert(sizeof(enum thunderstrike_charger_type) == 1);
enum thunderstrike_charger_state {
THUNDERSTRIKE_CHARGER_STATE_UNKNOWN = 0,
THUNDERSTRIKE_CHARGER_STATE_DISABLED,
THUNDERSTRIKE_CHARGER_STATE_CHARGING,
THUNDERSTRIKE_CHARGER_STATE_FULL,
THUNDERSTRIKE_CHARGER_STATE_FAILED = 8,
} __packed;
static_assert(sizeof(enum thunderstrike_charger_state) == 1);
struct thunderstrike_hostcmd_charger {
u8 connected;
enum thunderstrike_charger_type type;
enum thunderstrike_charger_state state;
} __packed;
struct thunderstrike_hostcmd_board_info {
__le16 revision;
__le16 serial[7];
} __packed;
struct thunderstrike_hostcmd_haptics {
u8 motor_left;
u8 motor_right;
} __packed;
struct thunderstrike_hostcmd_resp_report {
u8 report_id; /* THUNDERSTRIKE_HOSTCMD_RESP_REPORT_ID */
u8 cmd_id;
u8 reserved_at_10;
union {
struct thunderstrike_hostcmd_board_info board_info;
Annotation
- Immediate include surface: `linux/hid.h`, `linux/idr.h`, `linux/input-event-codes.h`, `linux/input.h`, `linux/jiffies.h`, `linux/leds.h`, `linux/module.h`, `linux/power_supply.h`.
- Detected declarations: `struct power_supply_dev`, `struct thunderstrike_psy_prop_values`, `struct thunderstrike_hostcmd_battery`, `struct thunderstrike_hostcmd_charger`, `struct thunderstrike_hostcmd_board_info`, `struct thunderstrike_hostcmd_haptics`, `struct thunderstrike_hostcmd_resp_report`, `struct thunderstrike_hostcmd_req_report`, `struct __packed`, `struct __packed`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.