Пример #1
0
static void rmi_f21_free_memory(struct rmi_function_dev *fn_dev)
{
	struct rmi_fn_21_data *f21 = fn_dev->data;
	u8 int_num = f21->query.max_force_sensor_count;
	sysfs_remove_group(&fn_dev->dev.kobj, &attrs_query);
	sysfs_remove_group(&fn_dev->dev.kobj, &attrs_control);
	switch (int_num) {
	case 7:
		sysfs_remove_file(&fn_dev->dev.kobj, attrify(int_en_force_6));
	case 6:
		sysfs_remove_file(&fn_dev->dev.kobj, attrify(int_en_force_5));
	case 5:
		sysfs_remove_file(&fn_dev->dev.kobj, attrify(int_en_force_4));
	case 4:
		sysfs_remove_file(&fn_dev->dev.kobj, attrify(int_en_force_3));
	case 3:
		sysfs_remove_file(&fn_dev->dev.kobj, attrify(int_en_force_2));
	case 2:
		sysfs_remove_file(&fn_dev->dev.kobj, attrify(int_en_force_1));
	case 1:
		sysfs_remove_file(&fn_dev->dev.kobj, attrify(int_en_force_0));
	default:
		break;
	}
	sysfs_remove_group(&fn_dev->dev.kobj, &attrs_data);
	sysfs_remove_group(&fn_dev->dev.kobj, &attrs_command);

}
Пример #2
0
static int rmi_f21_create_sysfs(struct rmi_function_container *fc)
{
	struct rmi_fn_21_data *f21 = fc->data;
	u8 int_num = f21->query.max_force_sensor_count;
	int rc;

	if (int_num > 7)
		int_num = 7;
	dev_dbg(&fc->dev, "Creating sysfs files.");

	/* Set up sysfs device attributes. */
	if (sysfs_create_group(&fc->dev.kobj, &attrs_query) < 0) {
		dev_err(&fc->dev, "Failed to create query sysfs files.");
		return -ENODEV;
	}
	if (sysfs_create_group(&fc->dev.kobj, &attrs_control) < 0) {
		dev_err(&fc->dev, "Failed to create control sysfs files.");
		return -ENODEV;
	}
	switch (int_num) {
	case 7:
		rc = sysfs_create_file(&fc->dev.kobj, attrify(int_en_force_6));
		break;
	case 6:
		rc = sysfs_create_file(&fc->dev.kobj, attrify(int_en_force_5));
		break;
	case 5:
		rc = sysfs_create_file(&fc->dev.kobj, attrify(int_en_force_4));
		break;
	case 4:
		rc = sysfs_create_file(&fc->dev.kobj, attrify(int_en_force_3));
		break;
	case 3:
		rc = sysfs_create_file(&fc->dev.kobj, attrify(int_en_force_2));
		break;
	case 2:
		rc = sysfs_create_file(&fc->dev.kobj, attrify(int_en_force_1));
		break;
	case 1:
		rc = sysfs_create_file(&fc->dev.kobj, attrify(int_en_force_0));
		break;
	default:
		rc = 0;
		break;
	}
	if (rc < 0) {
		dev_err(&fc->dev, "Failed to create control sysfs files.\n");
		return rc;
	}
	if (sysfs_create_group(&fc->dev.kobj, &attrs_data) < 0) {
		dev_err(&fc->dev, "Failed to create data sysfs files.\n");
		return -ENODEV;
	}
	if (sysfs_create_group(&fc->dev.kobj, &attrs_command) < 0) {
		dev_err(&fc->dev, "Failed to create command sysfs files.\n");
		return -ENODEV;
	}
	return 0;
}
Пример #3
0
static void rmi_f21_free_memory(struct rmi_function_container *fc)
{
	struct rmi_fn_21_data *f21 = fc->data;
	u8 int_num = f21->query.max_force_sensor_count;
	sysfs_remove_group(&fc->dev.kobj, &attrs_query);
	sysfs_remove_group(&fc->dev.kobj, &attrs_control);
	switch (int_num) {
	case 7:
		sysfs_remove_file(&fc->dev.kobj, attrify(int_en_force_6));
	case 6:
		sysfs_remove_file(&fc->dev.kobj, attrify(int_en_force_5));
	case 5:
		sysfs_remove_file(&fc->dev.kobj, attrify(int_en_force_4));
	case 4:
		sysfs_remove_file(&fc->dev.kobj, attrify(int_en_force_3));
	case 3:
		sysfs_remove_file(&fc->dev.kobj, attrify(int_en_force_2));
	case 2:
		sysfs_remove_file(&fc->dev.kobj, attrify(int_en_force_1));
	case 1:
		sysfs_remove_file(&fc->dev.kobj, attrify(int_en_force_0));
	default:
		break;
	}
	sysfs_remove_group(&fc->dev.kobj, &attrs_data);
	sysfs_remove_group(&fc->dev.kobj, &attrs_command);
	if (f21) {
		kfree(f21->control.reg_0__3);
		kfree(f21->control.reg_4->regs);
		kfree(f21->control.reg_4);
		kfree(f21->control.reg_5->regs);
		kfree(f21->control.reg_5);
		kfree(f21->control.reg_6->regs);
		kfree(f21->control.reg_6);
		kfree(f21->control.reg_7->regs);
		kfree(f21->control.reg_7);
		kfree(f21->control.reg_8->regs);
		kfree(f21->control.reg_8);
		kfree(f21);
		fc->data = NULL;
	}
}
Пример #4
0
	struct f21_2df_data data;

	struct mutex control_mutex;
	struct mutex data_mutex;
};

/* Sysfs files */

/* Query sysfs files */


show_union_struct_prototype(max_force_sensor_count)
show_union_struct_prototype(has_high_resolution)

static struct attribute *attrs[] = {
	attrify(max_force_sensor_count),
	attrify(has_high_resolution),
	NULL
};
static struct attribute_group attrs_query = GROUP(attrs);
/* Control sysfs files */

show_store_union_struct_prototype(reporting_mode)
show_store_union_struct_prototype(no_rezero)
show_store_union_struct_prototype(force_click_threshold)
show_store_union_struct_prototype(int_en_force_0)
show_store_union_struct_prototype(int_en_force_1)
show_store_union_struct_prototype(int_en_force_2)
show_store_union_struct_prototype(int_en_force_3)
show_store_union_struct_prototype(int_en_force_4)
show_store_union_struct_prototype(int_en_force_5)
Пример #5
0
	struct gpio_chip gpio;
	struct mutex gpio_mutex;
	u8 suppress;
};

/* Query sysfs files */
show_union_struct_prototype(extended_patterns)
show_union_struct_prototype(has_mappable_buttons)
show_union_struct_prototype(has_led)
show_union_struct_prototype(has_gpio)
show_union_struct_prototype(has_haptic)
show_union_struct_prototype(has_gpio_driver_control)
show_union_struct_prototype(gpio_led_count)

static struct attribute *attrs1[] = {
	attrify(extended_patterns),
	attrify(has_mappable_buttons),
	attrify(has_led),
	attrify(has_gpio),
	attrify(has_haptic),
	attrify(has_gpio_driver_control),
	attrify(gpio_led_count),
	NULL
};

static struct attribute_group attrs_query = GROUP(attrs1);

/* Control sysfs files */

show_store_union_struct_prototype(led_sel)
show_store_union_struct_prototype(gpio_debounce)