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.

Dependency Surface

Detected Declarations

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

Implementation Notes