Пример #1
0
static inline void hw_reboot_bootloader(void)
{
	hw_reboot(true);
}
Пример #2
0
static inline void hw_reboot_normal(void)
{
	hw_reboot(false);
}
Пример #3
0
static int epio_ioctl(struct inode *inode, struct file *filp, \
					unsigned int cmd, unsigned long *arg)
{
	int temp,cp_size;
	char *platform_name = NULL;
	unsigned long long hwconfig;
	int ret = 0;
	switch(cmd)
	{
	        case CM_SETLED:	
			cp_size = copy_from_user(&temp,(int *)arg,sizeof(int));
//			hw_led_onoff(temp);
			hw_led_set_usermode(temp);
			break ;
		case CM_KEY:
			printk("%s:CM_KEY:temp=%d\n", __func__, temp);
			hw_get_key(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break ;
		case CM_USB_STATUS:
			hw_get_usb(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break ;
		case CM_POWER_BTN:
			hw_get_pwbtn(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break ;
		case CM_SD_STATUS:
			hw_get_sd(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break ;
		case CM_AC_IN:
			hw_get_ac(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break ;
		case CM_DEEP_SUSPEND:
			cp_size = copy_from_user(&temp, (int *)arg, sizeof(int));
			printk("%s:CM_DEEP_SUSPEND:temp=%d\n", __func__, temp);
			hw_set_deepsuspend_level(temp);
			break ;
		case CM_KEY_LOCK:
			cp_size = copy_from_user(&temp,(int *)arg,sizeof(int));
			printk("%s:CM_KEY_LOCK:temp=%d\n", __func__, temp);
			hw_key_lock(temp);
//  		hw_ts_lock(temp);
			break ;
		case CM_BATTERY:
			hw_get_batt(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break ;
		case CM_ALARM_WAKEUP:
			cp_size = copy_from_user(&temp,(int*)arg, sizeof(int));
			printk("%s:CM_ALARM_WAKEUP:temp=%d\n", __func__, temp);
			hw_set_alrwkup(temp);
			break ;
		case CM_PLATFORM:
			platform_name = (char *)kzalloc(4 * sizeof(char), GFP_KERNEL);
			hw_set_platform("ep8");
			hw_get_platform(platform_name);
			cp_size = copy_to_user((char *)arg, platform_name, 4 * sizeof(char));
			if (cp_size < 0)
				return cp_size;
			break;
		case CM_HWCONFIG:
			hw_get_config(&hwconfig);
			cp_size = copy_to_user((int*)arg, &hwconfig, sizeof(long long));
			if (cp_size < 0)
				return cp_size;
			break;
		/*case CM_HEADPHONE_STATUS:
			hw_get_hp(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break;
		case CM_WIFI_STATUS:
			hw_get_wfpw(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break;
			*/
		case CM_POWEROFF:
			printk("device is poweroff...\n");
			hw_poweroff();
			ret = -1;
			return ret;
			break;
		case CM_REBOOT:
			printk("device is reboot...\n");
			hw_reboot();
			ret = -1;
			return ret;
			break;
		case CM_WATCHDOG:
			cp_size = copy_from_user(&temp,(int *)arg,sizeof(int));
			printk("%s:CM_WATCHDOG:temp=%d\n", __func__, temp);
			ret = hw_set_wdt(temp);
			if(ret<0)
			return -1;
			break;
		case CM_LOW_BATT:
			hw_get_low_batt(&temp);
			cp_size = copy_to_user((int*)arg, &temp, sizeof(int));
			break;
		default:
			return -EINVAL;
	}

	return ret;
}