drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
Source file repositories/reference/linux-study-clean/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c- Extension
.c- Size
- 10284 bytes
- Lines
- 290
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/string.hlinux/slab.hamd_sfh_pcie.hamd_sfh_hid_desc.hamd_sfh_hid_report_desc.hamd_sfh_hid.h
Detected Declarations
function get_report_descriptorfunction get_descr_szfunction get_common_featuresfunction get_feature_reportfunction get_common_inputsfunction get_input_reportfunction amd_sfh_set_desc_ops
Annotated Snippet
switch (descriptor_name) {
case descr_size:
return sizeof(accel3_report_descriptor);
case input_size:
return sizeof(struct accel3_input_report);
case feature_size:
return sizeof(struct accel3_feature_report);
}
break;
case gyro_idx:
switch (descriptor_name) {
case descr_size:
return sizeof(gyro3_report_descriptor);
case input_size:
return sizeof(struct gyro_input_report);
case feature_size:
return sizeof(struct gyro_feature_report);
}
break;
case mag_idx:
switch (descriptor_name) {
case descr_size:
return sizeof(comp3_report_descriptor);
case input_size:
return sizeof(struct magno_input_report);
case feature_size:
return sizeof(struct magno_feature_report);
}
break;
case als_idx:
case ACS_IDX: /* ambient color sensor */
switch (descriptor_name) {
case descr_size:
return sizeof(als_report_descriptor);
case input_size:
return sizeof(struct als_input_report);
case feature_size:
return sizeof(struct als_feature_report);
}
break;
case HPD_IDX:
switch (descriptor_name) {
case descr_size:
return sizeof(hpd_report_descriptor);
case input_size:
return sizeof(struct hpd_input_report);
case feature_size:
return sizeof(struct hpd_feature_report);
}
break;
default:
break;
}
return 0;
}
static void get_common_features(struct common_feature_property *common, int report_id)
{
common->report_id = report_id;
common->connection_type = HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_ENUM;
common->report_state = HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM;
common->power_state = HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM;
common->sensor_state = HID_USAGE_SENSOR_STATE_INITIALIZING_ENUM;
common->report_interval = HID_DEFAULT_REPORT_INTERVAL;
}
static u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report)
{
struct accel3_feature_report acc_feature;
struct gyro_feature_report gyro_feature;
struct magno_feature_report magno_feature;
struct hpd_feature_report hpd_feature;
struct als_feature_report als_feature;
u8 report_size = 0;
if (!feature_report)
return report_size;
switch (sensor_idx) {
case accel_idx: /* accel */
get_common_features(&acc_feature.common_property, report_id);
acc_feature.accel_change_sesnitivity = HID_DEFAULT_SENSITIVITY;
acc_feature.accel_sensitivity_min = HID_DEFAULT_MIN_VALUE;
acc_feature.accel_sensitivity_max = HID_DEFAULT_MAX_VALUE;
memcpy(feature_report, &acc_feature, sizeof(acc_feature));
report_size = sizeof(acc_feature);
break;
case gyro_idx: /* gyro */
get_common_features(&gyro_feature.common_property, report_id);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/string.h`, `linux/slab.h`, `amd_sfh_pcie.h`, `amd_sfh_hid_desc.h`, `amd_sfh_hid_report_desc.h`, `amd_sfh_hid.h`.
- Detected declarations: `function get_report_descriptor`, `function get_descr_sz`, `function get_common_features`, `function get_feature_report`, `function get_common_inputs`, `function get_input_report`, `function amd_sfh_set_desc_ops`.
- Atlas domain: Driver Families / drivers/hid.
- 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.