drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
Source file repositories/reference/linux-study-clean/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c- Extension
.c- Size
- 11290 bytes
- Lines
- 328
- 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/hid-sensor-ids.hamd_sfh_interface.h../hid_descriptor/amd_sfh_hid_desc.h../hid_descriptor/amd_sfh_hid_report_desc.h
Detected Declarations
function Copyrightfunction get_common_featuresfunction get_feature_repfunction get_common_inputsfunction amd_sfh_float_to_intfunction get_input_repfunction get_desc_sizefunction amd_sfh1_1_set_desc_ops
Annotated Snippet
if (binfo.sbase.s_prop[ALS_IDX].sf.feat & 0x2) {
als_input.light_color_temp = als_data.light_color_temp;
als_input.chromaticity_x_value =
amd_sfh_float_to_int(als_data.chromaticity_x);
als_input.chromaticity_y_value =
amd_sfh_float_to_int(als_data.chromaticity_y);
}
report_size = sizeof(als_input);
memcpy(input_report, &als_input, sizeof(als_input));
break;
case HPD_IDX:
get_common_inputs(&hpd_input.common_property, report_id);
hpdstatus.val = readl(mp2->mmio + amd_get_c2p_val(mp2, 4));
hpd_input.human_presence = hpdstatus.shpd.presence;
report_size = sizeof(hpd_input);
memcpy(input_report, &hpd_input, sizeof(hpd_input));
break;
}
return report_size;
}
static u32 get_desc_size(int sensor_idx, int descriptor_name)
{
switch (sensor_idx) {
case ACCEL_IDX:
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:
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;
}
return 0;
}
void amd_sfh1_1_set_desc_ops(struct amd_mp2_ops *mp2_ops)
{
mp2_ops->get_rep_desc = get_report_desc;
mp2_ops->get_feat_rep = get_feature_rep;
mp2_ops->get_desc_sz = get_desc_size;
mp2_ops->get_in_rep = get_input_rep;
}
Annotation
- Immediate include surface: `linux/hid-sensor-ids.h`, `amd_sfh_interface.h`, `../hid_descriptor/amd_sfh_hid_desc.h`, `../hid_descriptor/amd_sfh_hid_report_desc.h`.
- Detected declarations: `function Copyright`, `function get_common_features`, `function get_feature_rep`, `function get_common_inputs`, `function amd_sfh_float_to_int`, `function get_input_rep`, `function get_desc_size`, `function amd_sfh1_1_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.