static int __init sec_misc_init(void)
{
	int ret=0;
	klogi("started!");
	printk("[denis]sec_misc_init!\n");

	ret = misc_register(&sec_misc_device);
	if (ret<0) {
		kloge("misc_register failed!");
		return ret;
	}

	//sec_switch_class = class_create(THIS_MODULE, "sec");
	//if (IS_ERR(sec_switch_class))
		//pr_err("Failed to create class named \"sec\"!\n");
	//sec_misc_dev = device_create(sec_class, NULL, 0, NULL, "switch");
	sec_misc_dev = device_create(sec_class, NULL, 0, NULL, "sec_misc");		//EUR
	if (IS_ERR(sec_misc_dev)) {
		kloge("failed to create device!");
		return -1;
	}

	if (device_create_file(sec_misc_dev, &dev_attr_uartsel) < 0) {
		kloge("failed to create device file!(%s)!\n", dev_attr_uartsel.attr.name);
		return -1;
	}

	if (device_create_file(sec_misc_dev, &dev_attr_usbsel) < 0) {
		kloge("failed to create device file!(%s)!\n", dev_attr_usbsel.attr.name);
		return -1;
	}

	if (device_create_file(sec_misc_dev, &dev_attr_usb_state) < 0)		//EUR
		pr_err("Failed to create device file(%s)!\n", dev_attr_usb_state.attr.name);		//EUR
	
	if (device_create_file(sec_misc_dev, &dev_attr_emmc_checksum_done) < 0)
		pr_err("failed to create device file - %s\n", dev_attr_emmc_checksum_done.attr.name);

	if (device_create_file(sec_misc_dev, &dev_attr_emmc_checksum_pass) < 0)
		pr_err("failed to create device file - %s\n", dev_attr_emmc_checksum_pass.attr.name);

	wake_lock_init(&sec_misc_wake_lock, WAKE_LOCK_SUSPEND, "sec_misc");

	p3_uart_path_init();
	p3_usb_path_init();
	p3_set_usb_path(USB_SEL_AP_USB);
	init_jig_on();
	
	return 0;
}
Ejemplo n.º 2
0
static int __init sec_misc_init(void)
{
	int ret=0;
	pr_info("%s\n", __func__);

	ret = misc_register(&sec_misc_device);
	if (ret<0) {
		pr_err("misc_register failed!\n");
		return ret;
	}

	sec_misc_dev = device_create(sec_class, NULL, 0, NULL, "sec_misc");
	if (IS_ERR(sec_misc_dev)) {
		pr_err("failed to create device!\n");
		return -ENODEV;
	}

	if (device_create_file(sec_misc_dev, &dev_attr_uartsel) < 0)
		pr_err("failed to create device file!(%s)!\n", dev_attr_uartsel.attr.name);

	if (device_create_file(sec_misc_dev, &dev_attr_usbsel) < 0)
		pr_err("failed to create device file!(%s)!\n", dev_attr_usbsel.attr.name);

	if (device_create_file(sec_misc_dev, &dev_attr_usb_state) < 0)
		pr_err("Failed to create device file(%s)!\n", dev_attr_usb_state.attr.name);
	
	if (device_create_file(sec_misc_dev, &dev_attr_emmc_checksum_done) < 0)
		pr_err("failed to create device file - %s\n", dev_attr_emmc_checksum_done.attr.name);

	if (device_create_file(sec_misc_dev, &dev_attr_emmc_checksum_pass) < 0)
		pr_err("failed to create device file - %s\n", dev_attr_emmc_checksum_pass.attr.name);

	wake_lock_init(&sec_misc_wake_lock, WAKE_LOCK_SUSPEND, "sec_misc");

	p3_uart_path_init();
	p3_usb_path_init();
	//p3_set_usb_path(USB_SEL_AP_USB);
	init_jig_on();
	
	return 0;
}