Lines Matching +full:fraction +full:- +full:z

1 // SPDX-License-Identifier: GPL-2.0-or-later
11 #include <linux/hid-sensor-ids.h>
63 common->report_id = report_id; in get_common_features()
64 common->connection_type = HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_ENUM; in get_common_features()
65 common->report_state = SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM; in get_common_features()
66 common->power_state = SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM; in get_common_features()
67 common->sensor_state = HID_USAGE_SENSOR_STATE_INITIALIZING_ENUM; in get_common_features()
68 common->report_interval = HID_DEFAULT_REPORT_INTERVAL; in get_common_features()
130 common->report_id = report_id; in get_common_inputs()
131 common->sensor_state = HID_USAGE_SENSOR_STATE_READY_ENUM; in get_common_inputs()
132 common->event_type = HID_USAGE_SENSOR_EVENT_DATA_UPDATED_ENUM; in get_common_inputs()
137 int fraction, shift, mantissa, sign, exp, zeropre; in amd_sfh_float_to_int() local
140 sign = (flt32_val & BIT(31)) ? -1 : 1; in amd_sfh_float_to_int()
147 * Calculate the exponent and fraction part of floating in amd_sfh_float_to_int()
150 exp -= 127; in amd_sfh_float_to_int()
152 exp = -exp; in amd_sfh_float_to_int()
159 shift = 23 - exp; in amd_sfh_float_to_int()
164 shift = -shift; in amd_sfh_float_to_int()
171 fraction = (shift == 0) ? 0 : mantissa & GENMASK(shift - 1, 0); in amd_sfh_float_to_int()
173 return (((fraction * 100) >> shift) >= 50) ? sign * (flt32_val + 1) : sign * flt32_val; in amd_sfh_float_to_int()
180 u8 *input_report = in_data->input_report[current_index]; in get_input_rep()
200 sensoraddr = mp2->vsbase + (ACCEL_IDX * SENSOR_DATA_MEM_SIZE_DEFAULT) + in get_input_rep()
206 acc_input.in_accel_z_value = amd_sfh_float_to_int(accel_data.acceldata.z) / 100; in get_input_rep()
211 sensoraddr = mp2->vsbase + (GYRO_IDX * SENSOR_DATA_MEM_SIZE_DEFAULT) + in get_input_rep()
217 gyro_input.in_angel_z_value = amd_sfh_float_to_int(gyro_data.gyrodata.z) / 1000; in get_input_rep()
222 sensoraddr = mp2->vsbase + (MAG_IDX * SENSOR_DATA_MEM_SIZE_DEFAULT) + in get_input_rep()
228 magno_input.in_magno_z = amd_sfh_float_to_int(mag_data.magdata.z) / 100; in get_input_rep()
234 sensoraddr = mp2->vsbase + (ALS_IDX * SENSOR_DATA_MEM_SIZE_DEFAULT) + in get_input_rep()
240 memcpy_fromio(&binfo, mp2->vsbase, sizeof(struct sfh_base_info)); in get_input_rep()
254 hpdstatus.val = readl(mp2->mmio + amd_get_c2p_val(mp2, 4)); in get_input_rep()
323 mp2_ops->get_rep_desc = get_report_desc; in amd_sfh1_1_set_desc_ops()
324 mp2_ops->get_feat_rep = get_feature_rep; in amd_sfh1_1_set_desc_ops()
325 mp2_ops->get_desc_sz = get_desc_size; in amd_sfh1_1_set_desc_ops()
326 mp2_ops->get_in_rep = get_input_rep; in amd_sfh1_1_set_desc_ops()