sensor_inst       152 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
sensor_inst       154 drivers/hid/hid-sensor-custom.c 	return sprintf(buf, "%d\n", sensor_inst->enable);
sensor_inst       157 drivers/hid/hid-sensor-custom.c static int set_power_report_state(struct hid_sensor_custom *sensor_inst,
sensor_inst       183 drivers/hid/hid-sensor-custom.c 	if (sensor_inst->power_state)
sensor_inst       184 drivers/hid/hid-sensor-custom.c 		power_val = hid_sensor_get_usage_index(sensor_inst->hsdev,
sensor_inst       185 drivers/hid/hid-sensor-custom.c 				sensor_inst->power_state->attribute.report_id,
sensor_inst       186 drivers/hid/hid-sensor-custom.c 				sensor_inst->power_state->attribute.index,
sensor_inst       188 drivers/hid/hid-sensor-custom.c 	if (sensor_inst->report_state)
sensor_inst       189 drivers/hid/hid-sensor-custom.c 		report_val = hid_sensor_get_usage_index(sensor_inst->hsdev,
sensor_inst       190 drivers/hid/hid-sensor-custom.c 				sensor_inst->report_state->attribute.report_id,
sensor_inst       191 drivers/hid/hid-sensor-custom.c 				sensor_inst->report_state->attribute.index,
sensor_inst       196 drivers/hid/hid-sensor-custom.c 			sensor_inst->power_state->attribute.logical_minimum;
sensor_inst       197 drivers/hid/hid-sensor-custom.c 		ret = sensor_hub_set_feature(sensor_inst->hsdev,
sensor_inst       198 drivers/hid/hid-sensor-custom.c 				sensor_inst->power_state->attribute.report_id,
sensor_inst       199 drivers/hid/hid-sensor-custom.c 				sensor_inst->power_state->attribute.index,
sensor_inst       203 drivers/hid/hid-sensor-custom.c 			hid_err(sensor_inst->hsdev->hdev,
sensor_inst       211 drivers/hid/hid-sensor-custom.c 			sensor_inst->report_state->attribute.logical_minimum;
sensor_inst       212 drivers/hid/hid-sensor-custom.c 		ret = sensor_hub_set_feature(sensor_inst->hsdev,
sensor_inst       213 drivers/hid/hid-sensor-custom.c 				sensor_inst->report_state->attribute.report_id,
sensor_inst       214 drivers/hid/hid-sensor-custom.c 				sensor_inst->report_state->attribute.index,
sensor_inst       218 drivers/hid/hid-sensor-custom.c 			hid_err(sensor_inst->hsdev->hdev,
sensor_inst       231 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
sensor_inst       238 drivers/hid/hid-sensor-custom.c 	mutex_lock(&sensor_inst->mutex);
sensor_inst       239 drivers/hid/hid-sensor-custom.c 	if (value && !sensor_inst->enable) {
sensor_inst       240 drivers/hid/hid-sensor-custom.c 		ret = sensor_hub_device_open(sensor_inst->hsdev);
sensor_inst       244 drivers/hid/hid-sensor-custom.c 		ret = set_power_report_state(sensor_inst, true);
sensor_inst       246 drivers/hid/hid-sensor-custom.c 			sensor_hub_device_close(sensor_inst->hsdev);
sensor_inst       249 drivers/hid/hid-sensor-custom.c 		sensor_inst->enable = true;
sensor_inst       250 drivers/hid/hid-sensor-custom.c 	} else if (!value && sensor_inst->enable) {
sensor_inst       251 drivers/hid/hid-sensor-custom.c 		ret = set_power_report_state(sensor_inst, false);
sensor_inst       252 drivers/hid/hid-sensor-custom.c 		sensor_hub_device_close(sensor_inst->hsdev);
sensor_inst       253 drivers/hid/hid-sensor-custom.c 		sensor_inst->enable = false;
sensor_inst       256 drivers/hid/hid-sensor-custom.c 	mutex_unlock(&sensor_inst->mutex);
sensor_inst       276 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
sensor_inst       287 drivers/hid/hid-sensor-custom.c 		field_index = index + sensor_inst->input_field_count;
sensor_inst       299 drivers/hid/hid-sensor-custom.c 		attribute = &sensor_inst->fields[field_index].attribute;
sensor_inst       307 drivers/hid/hid-sensor-custom.c 			ret = sensor_hub_get_feature(sensor_inst->hsdev,
sensor_inst       347 drivers/hid/hid-sensor-custom.c 						sensor_inst->hsdev,
sensor_inst       348 drivers/hid/hid-sensor-custom.c 						sensor_inst->hsdev->usage,
sensor_inst       352 drivers/hid/hid-sensor-custom.c 		value = sensor_inst->fields[field_index].attribute.units;
sensor_inst       354 drivers/hid/hid-sensor-custom.c 		value = sensor_inst->fields[field_index].attribute.unit_expo;
sensor_inst       356 drivers/hid/hid-sensor-custom.c 		value = sensor_inst->fields[field_index].attribute.size;
sensor_inst       358 drivers/hid/hid-sensor-custom.c 		value = sensor_inst->fields[field_index].attribute.
sensor_inst       361 drivers/hid/hid-sensor-custom.c 		value = sensor_inst->fields[field_index].attribute.
sensor_inst       384 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
sensor_inst       391 drivers/hid/hid-sensor-custom.c 		field_index = index + sensor_inst->input_field_count;
sensor_inst       402 drivers/hid/hid-sensor-custom.c 		report_id = sensor_inst->fields[field_index].attribute.
sensor_inst       404 drivers/hid/hid-sensor-custom.c 		ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
sensor_inst       416 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst = platform_get_drvdata(priv);
sensor_inst       420 drivers/hid/hid-sensor-custom.c 	if (sensor_inst->input_skip_sample) {
sensor_inst       421 drivers/hid/hid-sensor-custom.c 		hid_err(sensor_inst->hsdev->hdev, "Skipped remaining data\n");
sensor_inst       425 drivers/hid/hid-sensor-custom.c 	hid_dbg(sensor_inst->hsdev->hdev, "%s received %d of %d\n", __func__,
sensor_inst       426 drivers/hid/hid-sensor-custom.c 		(int) (sensor_inst->input_report_recd_size + raw_len),
sensor_inst       427 drivers/hid/hid-sensor-custom.c 		sensor_inst->input_report_size);
sensor_inst       429 drivers/hid/hid-sensor-custom.c 	if (!test_bit(0, &sensor_inst->misc_opened))
sensor_inst       432 drivers/hid/hid-sensor-custom.c 	if (!sensor_inst->input_report_recd_size) {
sensor_inst       434 drivers/hid/hid-sensor-custom.c 						sensor_inst->input_report_size;
sensor_inst       436 drivers/hid/hid-sensor-custom.c 		header.raw_len = sensor_inst->input_report_size;
sensor_inst       438 drivers/hid/hid-sensor-custom.c 		if (kfifo_avail(&sensor_inst->data_fifo) >= required_size) {
sensor_inst       439 drivers/hid/hid-sensor-custom.c 			kfifo_in(&sensor_inst->data_fifo,
sensor_inst       443 drivers/hid/hid-sensor-custom.c 			sensor_inst->input_skip_sample = true;
sensor_inst       445 drivers/hid/hid-sensor-custom.c 	if (kfifo_avail(&sensor_inst->data_fifo) >= raw_len)
sensor_inst       446 drivers/hid/hid-sensor-custom.c 		kfifo_in(&sensor_inst->data_fifo, (unsigned char *)raw_data,
sensor_inst       449 drivers/hid/hid-sensor-custom.c 	sensor_inst->input_report_recd_size += raw_len;
sensor_inst       457 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst = platform_get_drvdata(priv);
sensor_inst       459 drivers/hid/hid-sensor-custom.c 	if (!test_bit(0, &sensor_inst->misc_opened))
sensor_inst       462 drivers/hid/hid-sensor-custom.c 	sensor_inst->input_report_recd_size = 0;
sensor_inst       463 drivers/hid/hid-sensor-custom.c 	sensor_inst->input_skip_sample = false;
sensor_inst       465 drivers/hid/hid-sensor-custom.c 	wake_up(&sensor_inst->wait);
sensor_inst       470 drivers/hid/hid-sensor-custom.c static int hid_sensor_custom_add_field(struct hid_sensor_custom *sensor_inst,
sensor_inst       478 drivers/hid/hid-sensor-custom.c 	fields = krealloc(sensor_inst->fields,
sensor_inst       479 drivers/hid/hid-sensor-custom.c 			  (sensor_inst->sensor_field_count + 1) *
sensor_inst       482 drivers/hid/hid-sensor-custom.c 		kfree(sensor_inst->fields);
sensor_inst       485 drivers/hid/hid-sensor-custom.c 	sensor_inst->fields = fields;
sensor_inst       486 drivers/hid/hid-sensor-custom.c 	sensor_field = &sensor_inst->fields[sensor_inst->sensor_field_count];
sensor_inst       487 drivers/hid/hid-sensor-custom.c 	sensor_field->attribute.usage_id = sensor_inst->hsdev->usage;
sensor_inst       511 drivers/hid/hid-sensor-custom.c 		sensor_inst->input_field_count++;
sensor_inst       512 drivers/hid/hid-sensor-custom.c 		sensor_inst->input_report_size += (field->report_size *
sensor_inst       518 drivers/hid/hid-sensor-custom.c 	sensor_inst->sensor_field_count++;
sensor_inst       523 drivers/hid/hid-sensor-custom.c static int hid_sensor_custom_add_fields(struct hid_sensor_custom *sensor_inst,
sensor_inst       531 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_hub_device *hsdev = sensor_inst->hsdev;
sensor_inst       542 drivers/hid/hid-sensor-custom.c 				ret = hid_sensor_custom_add_field(sensor_inst,
sensor_inst       558 drivers/hid/hid-sensor-custom.c 								*sensor_inst)
sensor_inst       560 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_hub_device *hsdev = sensor_inst->hsdev;
sensor_inst       569 drivers/hid/hid-sensor-custom.c 		ret = hid_sensor_custom_add_fields(sensor_inst,
sensor_inst       577 drivers/hid/hid-sensor-custom.c 	for (i = 0; i < sensor_inst->sensor_field_count; ++i) {
sensor_inst       583 drivers/hid/hid-sensor-custom.c 			device_attr = &sensor_inst->fields[i].sd_attrs[j];
sensor_inst       585 drivers/hid/hid-sensor-custom.c 			snprintf((char *)&sensor_inst->fields[i].attr_name[j],
sensor_inst       587 drivers/hid/hid-sensor-custom.c 				 sensor_inst->fields[i].group_name,
sensor_inst       591 drivers/hid/hid-sensor-custom.c 				(char *)&sensor_inst->fields[i].attr_name[j];
sensor_inst       596 drivers/hid/hid-sensor-custom.c 			sensor_inst->fields[i].attrs[j] = &device_attr->attr;
sensor_inst       599 drivers/hid/hid-sensor-custom.c 		sensor_inst->fields[i].attrs[j] = NULL;
sensor_inst       600 drivers/hid/hid-sensor-custom.c 		sensor_inst->fields[i].hid_custom_attribute_group.attrs =
sensor_inst       601 drivers/hid/hid-sensor-custom.c 						sensor_inst->fields[i].attrs;
sensor_inst       602 drivers/hid/hid-sensor-custom.c 		sensor_inst->fields[i].hid_custom_attribute_group.name =
sensor_inst       603 drivers/hid/hid-sensor-custom.c 					sensor_inst->fields[i].group_name;
sensor_inst       604 drivers/hid/hid-sensor-custom.c 		ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj,
sensor_inst       605 drivers/hid/hid-sensor-custom.c 					 &sensor_inst->fields[i].
sensor_inst       611 drivers/hid/hid-sensor-custom.c 		if (sensor_inst->fields[i].attribute.attrib_id ==
sensor_inst       613 drivers/hid/hid-sensor-custom.c 			sensor_inst->power_state = &sensor_inst->fields[i];
sensor_inst       614 drivers/hid/hid-sensor-custom.c 		else if (sensor_inst->fields[i].attribute.attrib_id ==
sensor_inst       616 drivers/hid/hid-sensor-custom.c 			sensor_inst->report_state = &sensor_inst->fields[i];
sensor_inst       623 drivers/hid/hid-sensor-custom.c 								sensor_inst)
sensor_inst       627 drivers/hid/hid-sensor-custom.c 	for (i = 0; i < sensor_inst->sensor_field_count; ++i)
sensor_inst       628 drivers/hid/hid-sensor-custom.c 		sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
sensor_inst       629 drivers/hid/hid-sensor-custom.c 				   &sensor_inst->fields[i].
sensor_inst       632 drivers/hid/hid-sensor-custom.c 	kfree(sensor_inst->fields);
sensor_inst       638 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst;
sensor_inst       642 drivers/hid/hid-sensor-custom.c 	sensor_inst = container_of(file->private_data,
sensor_inst       649 drivers/hid/hid-sensor-custom.c 		if (kfifo_is_empty(&sensor_inst->data_fifo)) {
sensor_inst       653 drivers/hid/hid-sensor-custom.c 			ret = wait_event_interruptible(sensor_inst->wait,
sensor_inst       654 drivers/hid/hid-sensor-custom.c 				!kfifo_is_empty(&sensor_inst->data_fifo));
sensor_inst       658 drivers/hid/hid-sensor-custom.c 		ret = kfifo_to_user(&sensor_inst->data_fifo, buf, count,
sensor_inst       670 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst;
sensor_inst       672 drivers/hid/hid-sensor-custom.c 	sensor_inst = container_of(file->private_data,
sensor_inst       675 drivers/hid/hid-sensor-custom.c 	clear_bit(0, &sensor_inst->misc_opened);
sensor_inst       682 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst;
sensor_inst       684 drivers/hid/hid-sensor-custom.c 	sensor_inst = container_of(file->private_data,
sensor_inst       687 drivers/hid/hid-sensor-custom.c 	if (test_and_set_bit(0, &sensor_inst->misc_opened))
sensor_inst       696 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst;
sensor_inst       699 drivers/hid/hid-sensor-custom.c 	sensor_inst = container_of(file->private_data,
sensor_inst       702 drivers/hid/hid-sensor-custom.c 	poll_wait(file, &sensor_inst->wait, wait);
sensor_inst       704 drivers/hid/hid-sensor-custom.c 	if (!kfifo_is_empty(&sensor_inst->data_fifo))
sensor_inst       718 drivers/hid/hid-sensor-custom.c static int hid_sensor_custom_dev_if_add(struct hid_sensor_custom *sensor_inst)
sensor_inst       722 drivers/hid/hid-sensor-custom.c 	ret = kfifo_alloc(&sensor_inst->data_fifo, HID_CUSTOM_FIFO_SIZE,
sensor_inst       727 drivers/hid/hid-sensor-custom.c 	init_waitqueue_head(&sensor_inst->wait);
sensor_inst       729 drivers/hid/hid-sensor-custom.c 	sensor_inst->custom_dev.minor = MISC_DYNAMIC_MINOR;
sensor_inst       730 drivers/hid/hid-sensor-custom.c 	sensor_inst->custom_dev.name = dev_name(&sensor_inst->pdev->dev);
sensor_inst       731 drivers/hid/hid-sensor-custom.c 	sensor_inst->custom_dev.fops = &hid_sensor_custom_fops,
sensor_inst       732 drivers/hid/hid-sensor-custom.c 	ret = misc_register(&sensor_inst->custom_dev);
sensor_inst       734 drivers/hid/hid-sensor-custom.c 		kfifo_free(&sensor_inst->data_fifo);
sensor_inst       741 drivers/hid/hid-sensor-custom.c 								*sensor_inst)
sensor_inst       743 drivers/hid/hid-sensor-custom.c 	wake_up(&sensor_inst->wait);
sensor_inst       744 drivers/hid/hid-sensor-custom.c 	misc_deregister(&sensor_inst->custom_dev);
sensor_inst       745 drivers/hid/hid-sensor-custom.c 	kfifo_free(&sensor_inst->data_fifo);
sensor_inst       751 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst;
sensor_inst       755 drivers/hid/hid-sensor-custom.c 	sensor_inst = devm_kzalloc(&pdev->dev, sizeof(*sensor_inst),
sensor_inst       757 drivers/hid/hid-sensor-custom.c 	if (!sensor_inst)
sensor_inst       760 drivers/hid/hid-sensor-custom.c 	sensor_inst->callbacks.capture_sample = hid_sensor_capture_sample;
sensor_inst       761 drivers/hid/hid-sensor-custom.c 	sensor_inst->callbacks.send_event = hid_sensor_send_event;
sensor_inst       762 drivers/hid/hid-sensor-custom.c 	sensor_inst->callbacks.pdev = pdev;
sensor_inst       763 drivers/hid/hid-sensor-custom.c 	sensor_inst->hsdev = hsdev;
sensor_inst       764 drivers/hid/hid-sensor-custom.c 	sensor_inst->pdev = pdev;
sensor_inst       765 drivers/hid/hid-sensor-custom.c 	mutex_init(&sensor_inst->mutex);
sensor_inst       766 drivers/hid/hid-sensor-custom.c 	platform_set_drvdata(pdev, sensor_inst);
sensor_inst       768 drivers/hid/hid-sensor-custom.c 					   &sensor_inst->callbacks);
sensor_inst       774 drivers/hid/hid-sensor-custom.c 	ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj,
sensor_inst       779 drivers/hid/hid-sensor-custom.c 	ret = hid_sensor_custom_add_attributes(sensor_inst);
sensor_inst       783 drivers/hid/hid-sensor-custom.c 	ret = hid_sensor_custom_dev_if_add(sensor_inst);
sensor_inst       790 drivers/hid/hid-sensor-custom.c 	hid_sensor_custom_remove_attributes(sensor_inst);
sensor_inst       792 drivers/hid/hid-sensor-custom.c 	sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
sensor_inst       802 drivers/hid/hid-sensor-custom.c 	struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
sensor_inst       805 drivers/hid/hid-sensor-custom.c 	hid_sensor_custom_dev_if_remove(sensor_inst);
sensor_inst       806 drivers/hid/hid-sensor-custom.c 	hid_sensor_custom_remove_attributes(sensor_inst);
sensor_inst       807 drivers/hid/hid-sensor-custom.c 	sysfs_remove_group(&sensor_inst->pdev->dev.kobj,