Lines Matching +full:1 +full:st

22 		HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD, 1, 0},
28 HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD, 1, 0},
34 HID_USAGE_SENSOR_UNITS_RADIANS_PER_SECOND, 1, 0},
39 {HID_USAGE_SENSOR_COMPASS_3D, HID_USAGE_SENSOR_UNITS_GAUSS, 1, 0},
45 HID_USAGE_SENSOR_UNITS_RADIANS, 1, 0},
47 {HID_USAGE_SENSOR_ALS, 0, 1, 0},
48 {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0},
57 {HID_USAGE_SENSOR_DEVICE_ORIENTATION, 0, 1, 0},
59 {HID_USAGE_SENSOR_RELATIVE_ORIENTATION, 0, 1, 0},
61 {HID_USAGE_SENSOR_GEOMAGNETIC_ORIENTATION, 0, 1, 0},
70 {HID_USAGE_SENSOR_HUMAN_PRESENCE, 0, 1, 0},
71 {HID_USAGE_SENSOR_HUMAN_PROXIMITY, 0, 1, 0},
72 {HID_USAGE_SENSOR_HUMAN_ATTENTION, 0, 1, 0},
116 int sign = 1; in convert_from_vtf_format()
118 if (value & BIT(size*8 - 1)) { in convert_from_vtf_format()
119 value = ((1LL << (size * 8)) - value); in convert_from_vtf_format()
120 sign = -1; in convert_from_vtf_format()
139 int sign = 1; in convert_to_vtf_format()
142 sign = -1; in convert_to_vtf_format()
153 value = ((1LL << (size * 8)) - value); in convert_to_vtf_format()
158 s32 hid_sensor_read_poll_value(struct hid_sensor_common *st) in hid_sensor_read_poll_value() argument
163 ret = sensor_hub_get_feature(st->hsdev, in hid_sensor_read_poll_value()
164 st->poll.report_id, in hid_sensor_read_poll_value()
165 st->poll.index, sizeof(value), &value); in hid_sensor_read_poll_value()
170 if (st->poll.units == HID_USAGE_SENSOR_UNITS_SECOND) in hid_sensor_read_poll_value()
178 int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, in hid_sensor_read_samp_freq_value() argument
184 ret = sensor_hub_get_feature(st->hsdev, in hid_sensor_read_samp_freq_value()
185 st->poll.report_id, in hid_sensor_read_samp_freq_value()
186 st->poll.index, sizeof(value), &value); in hid_sensor_read_samp_freq_value()
191 if (st->poll.units == HID_USAGE_SENSOR_UNITS_MILLISECOND) in hid_sensor_read_samp_freq_value()
193 else if (st->poll.units == HID_USAGE_SENSOR_UNITS_SECOND) in hid_sensor_read_samp_freq_value()
194 simple_div(1, value, val1, val2); in hid_sensor_read_samp_freq_value()
205 int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st, in hid_sensor_write_samp_freq_value() argument
216 if (st->poll.units == HID_USAGE_SENSOR_UNITS_MILLISECOND) in hid_sensor_write_samp_freq_value()
218 else if (st->poll.units == HID_USAGE_SENSOR_UNITS_SECOND) in hid_sensor_write_samp_freq_value()
223 ret = sensor_hub_set_feature(st->hsdev, st->poll.report_id, in hid_sensor_write_samp_freq_value()
224 st->poll.index, sizeof(value), &value); in hid_sensor_write_samp_freq_value()
228 ret = sensor_hub_get_feature(st->hsdev, in hid_sensor_write_samp_freq_value()
229 st->poll.report_id, in hid_sensor_write_samp_freq_value()
230 st->poll.index, sizeof(value), &value); in hid_sensor_write_samp_freq_value()
234 st->poll_interval = value; in hid_sensor_write_samp_freq_value()
240 int hid_sensor_read_raw_hyst_value(struct hid_sensor_common *st, in hid_sensor_read_raw_hyst_value() argument
246 ret = sensor_hub_get_feature(st->hsdev, in hid_sensor_read_raw_hyst_value()
247 st->sensitivity.report_id, in hid_sensor_read_raw_hyst_value()
248 st->sensitivity.index, sizeof(value), in hid_sensor_read_raw_hyst_value()
254 convert_from_vtf_format(value, st->sensitivity.size, in hid_sensor_read_raw_hyst_value()
255 st->sensitivity.unit_expo, in hid_sensor_read_raw_hyst_value()
263 int hid_sensor_read_raw_hyst_rel_value(struct hid_sensor_common *st, int *val1, in hid_sensor_read_raw_hyst_rel_value() argument
269 ret = sensor_hub_get_feature(st->hsdev, in hid_sensor_read_raw_hyst_rel_value()
270 st->sensitivity_rel.report_id, in hid_sensor_read_raw_hyst_rel_value()
271 st->sensitivity_rel.index, sizeof(value), in hid_sensor_read_raw_hyst_rel_value()
278 convert_from_vtf_format(value, st->sensitivity_rel.size, in hid_sensor_read_raw_hyst_rel_value()
279 st->sensitivity_rel.unit_expo, val1, val2); in hid_sensor_read_raw_hyst_rel_value()
286 int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st, in hid_sensor_write_raw_hyst_value() argument
295 value = convert_to_vtf_format(st->sensitivity.size, in hid_sensor_write_raw_hyst_value()
296 st->sensitivity.unit_expo, in hid_sensor_write_raw_hyst_value()
298 ret = sensor_hub_set_feature(st->hsdev, st->sensitivity.report_id, in hid_sensor_write_raw_hyst_value()
299 st->sensitivity.index, sizeof(value), in hid_sensor_write_raw_hyst_value()
304 ret = sensor_hub_get_feature(st->hsdev, in hid_sensor_write_raw_hyst_value()
305 st->sensitivity.report_id, in hid_sensor_write_raw_hyst_value()
306 st->sensitivity.index, sizeof(value), in hid_sensor_write_raw_hyst_value()
311 st->raw_hystersis = value; in hid_sensor_write_raw_hyst_value()
317 int hid_sensor_write_raw_hyst_rel_value(struct hid_sensor_common *st, in hid_sensor_write_raw_hyst_rel_value() argument
326 value = convert_to_vtf_format(st->sensitivity_rel.size, in hid_sensor_write_raw_hyst_rel_value()
327 st->sensitivity_rel.unit_expo, in hid_sensor_write_raw_hyst_rel_value()
329 ret = sensor_hub_set_feature(st->hsdev, st->sensitivity_rel.report_id, in hid_sensor_write_raw_hyst_rel_value()
330 st->sensitivity_rel.index, sizeof(value), in hid_sensor_write_raw_hyst_rel_value()
335 ret = sensor_hub_get_feature(st->hsdev, in hid_sensor_write_raw_hyst_rel_value()
336 st->sensitivity_rel.report_id, in hid_sensor_write_raw_hyst_rel_value()
337 st->sensitivity_rel.index, sizeof(value), in hid_sensor_write_raw_hyst_rel_value()
342 st->raw_hystersis = value; in hid_sensor_write_raw_hyst_rel_value()
354 * 1.001745329 ->exp:0-> val0[1]val1[1745329]
378 res += int_pow(10, exp - 1 - i) * x; in adjust_exponent_nano()
413 *val0 = 1; in hid_sensor_format_scale()
432 int64_t hid_sensor_convert_timestamp(struct hid_sensor_common *st, in hid_sensor_convert_timestamp() argument
435 return st->timestamp_ns_scale * raw_value; in hid_sensor_convert_timestamp()
442 struct hid_sensor_common *st) in hid_sensor_get_reporting_interval() argument
447 &st->poll); in hid_sensor_get_reporting_interval()
449 if (st->poll.units == 0) in hid_sensor_get_reporting_interval()
450 st->poll.units = HID_USAGE_SENSOR_UNITS_MILLISECOND; in hid_sensor_get_reporting_interval()
452 st->poll_interval = -1; in hid_sensor_get_reporting_interval()
460 struct hid_sensor_common *st) in hid_sensor_get_report_latency_info() argument
465 &st->report_latency); in hid_sensor_get_report_latency_info()
468 st->report_latency.index, st->report_latency.report_id); in hid_sensor_get_report_latency_info()
471 int hid_sensor_get_report_latency(struct hid_sensor_common *st) in hid_sensor_get_report_latency() argument
476 ret = sensor_hub_get_feature(st->hsdev, st->report_latency.report_id, in hid_sensor_get_report_latency()
477 st->report_latency.index, sizeof(value), in hid_sensor_get_report_latency()
486 int hid_sensor_set_report_latency(struct hid_sensor_common *st, int latency_ms) in hid_sensor_set_report_latency() argument
488 return sensor_hub_set_feature(st->hsdev, st->report_latency.report_id, in hid_sensor_set_report_latency()
489 st->report_latency.index, in hid_sensor_set_report_latency()
494 bool hid_sensor_batch_mode_supported(struct hid_sensor_common *st) in hid_sensor_batch_mode_supported() argument
496 return st->report_latency.index > 0 && st->report_latency.report_id > 0; in hid_sensor_batch_mode_supported()
502 struct hid_sensor_common *st, in hid_sensor_parse_common_attributes() argument
512 hid_sensor_get_reporting_interval(hsdev, usage_id, st); in hid_sensor_parse_common_attributes()
517 &st->report_state); in hid_sensor_parse_common_attributes()
522 &st->power_state); in hid_sensor_parse_common_attributes()
524 st->power_state.logical_minimum = 1; in hid_sensor_parse_common_attributes()
525 st->report_state.logical_minimum = 1; in hid_sensor_parse_common_attributes()
530 &st->sensitivity); in hid_sensor_parse_common_attributes()
535 &st->sensitivity_rel); in hid_sensor_parse_common_attributes()
541 if (st->sensitivity.index < 0) in hid_sensor_parse_common_attributes()
546 &st->sensitivity); in hid_sensor_parse_common_attributes()
548 if (st->sensitivity_rel.index < 0) in hid_sensor_parse_common_attributes()
553 &st->sensitivity_rel); in hid_sensor_parse_common_attributes()
556 st->raw_hystersis = -1; in hid_sensor_parse_common_attributes()
567 st->timestamp_ns_scale = val0; in hid_sensor_parse_common_attributes()
569 st->timestamp_ns_scale = 1000000000; in hid_sensor_parse_common_attributes()
571 hid_sensor_get_report_latency_info(hsdev, usage_id, st); in hid_sensor_parse_common_attributes()
574 st->poll.index, st->poll.report_id, in hid_sensor_parse_common_attributes()
575 st->report_state.index, st->report_state.report_id, in hid_sensor_parse_common_attributes()
576 st->power_state.index, st->power_state.report_id, in hid_sensor_parse_common_attributes()
577 st->sensitivity.index, st->sensitivity.report_id, in hid_sensor_parse_common_attributes()
581 st->power_state.report_id, in hid_sensor_parse_common_attributes()
582 st->power_state.index, sizeof(value), &value); in hid_sensor_parse_common_attributes()