コード例 #1
0
ファイル: aotom_procfs.c プロジェクト: Audioniek/driver
static int wakeup_time_read(char *page, char **start, off_t off, int count, int *eof, void *data)
{
	int len = 0;

	if (NULL != page)
	{
		wakeup_time = YWPANEL_FP_GetPowerOnTime();
		len = sprintf(page, "%u\n", wakeup_time - rtc_offset);
//		len = sprintf(page, "%u\n", wakeup_time); //RTC uses local time?
	}
	return len;
}
コード例 #2
0
ファイル: aotom_main.c プロジェクト: Niptok/tdt-amiko
static int AOTOMdev_ioctl(struct inode *Inode, struct file *File, unsigned int cmd, unsigned long arg)
{
    static int mode = 0;
    struct aotom_ioctl_data * aotom = (struct aotom_ioctl_data *) arg;
    int res = 0;

    dprintk(5, "%s > 0x%.8x\n", __func__, cmd);

    if (down_interruptible(&write_sem))
	return -ERESTARTSYS;

    switch (cmd) {
	case VFDSETMODE:
	    mode = aotom->u.mode.compat;
	    break;
	case VFDSETLED:
	{
	    if (mode_digit != DIGITNO) res = YWPANEL_VFD_SetLed(aotom->u.led.led_nr, aotom->u.led.on);
	    break;
	}
	case VFDICONDISPLAYONOFF:
	{
//	    printk("aotom -->> %d = %d\n", aotom->u.icon.icon_nr, aotom->u.icon.on);
	    if (mode_digit == DIGIT8) {
		res = aotomSetIcon(aotom->u.icon.icon_nr, aotom->u.icon.on);
	    }
	    if (mode_digit == DIGIT4) {
		switch (aotom->u.icon.icon_nr) {
//		    case 0:
//		    {
//			struct vfd_ioctl_data * vfd = (struct vfd_ioctl_data *) arg;
//			if (5 == vfd->length) {
//			    if ((0x1e & 0xf) == vfd->data[0]) {
//				res = YWPANEL_VFD_SetLed(0, vfd->data[4]);
//			    }
//			}
//			break;
//		    }
		    case 35:
			res = YWPANEL_VFD_SetLed(1, aotom->u.led.on);
			break;
		    default:
			break;
		}
	    }
	    mode = 0;
	    break;
	}
	case VFDSTANDBY:
	{
	    if (mode_digit != DIGITNO) {
		u32 uTime = 0;
		u32 uStandByKey = 0;
		u32 uPowerOnTime = 0;
		get_user(uTime, (int *) arg);
		//printk("uTime = %d\n", uTime);

		uPowerOnTime = YWPANEL_FP_GetPowerOnTime();
		//printk("1uPowerOnTime = %d\n", uPowerOnTime);

		YWPANEL_FP_SetPowerOnTime(uTime);

		uPowerOnTime = YWPANEL_FP_GetPowerOnTime();
		//printk("2uPowerOnTime = %d\n", uPowerOnTime);
#if 0
		uStandByKey = YWPANEL_FP_GetStandByKey(0);
		printk("uStandByKey = %d\n", uStandByKey);
		uStandByKey = YWPANEL_FP_GetStandByKey(1);
		printk("uStandByKey = %d\n", uStandByKey);
		uStandByKey = YWPANEL_FP_GetStandByKey(2);
		printk("uStandByKey = %d\n", uStandByKey);
		uStandByKey = YWPANEL_FP_GetStandByKey(3);
		printk("uStandByKey = %d\n", uStandByKey);
		uStandByKey = YWPANEL_FP_GetStandByKey(4);
		printk("uStandByKey = %d\n", uStandByKey);
#endif
		YWPANEL_FP_ControlTimer(true);
		YWPANEL_FP_SetCpuStatus(0x02);
	    }
	    break;
	}
	case VFDSETTIME:
	    res = aotomSetTime((char *) arg);
	    break;
	case VFDGETTIME:
	{
	    if (mode_digit != DIGITNO) {
		u32 uTime = 0;
		char cTime[5];
		uTime = YWPANEL_FP_GetTime();
		//printk("uTime = %d\n", uTime);
		put_user(uTime, (int *) arg);
	    }
	    break;
	}
	case VFDDISPLAYCHARS:
	    if (mode == 0) {
		if (copy_from_user(&vfd_data, (void *) arg, sizeof (vfd_data)))
		    return -EFAULT;
		if (vfd_data.length > sizeof (vfd_data.data))
		    vfd_data.length = sizeof (vfd_data.data);
		while ((vfd_data.length > 0) && (vfd_data.data[vfd_data.length - 1 ] == '\n'))
		    vfd_data.length--;
		res = run_draw_thread(&vfd_data);
	    }
	    mode = 0;
	    break;
	case VFDDISPLAYCLR:
	    vfd_data.length = 0;
	    res = run_draw_thread(&vfd_data);
	    break;
	case 0x5305:
	    if (mode_digit == DIGIT4) {
		dprintk(0, "unknown IOCTL 0x%x\n", cmd);
		mode = 0;
	    }
	    break;
	case VFDBRIGHTNESS:
	    if (mode_digit == DIGIT8) YWPANEL_VFD_SetBrightness(aotom->u.brightness.level);
	    break;
	case VFDGETWAKEUPMODE:
	case VFDDISPLAYWRITEONOFF:
	case 0x5401:
	    break;
	default:
	    dprintk(0, "unknown IOCTL 0x%x\n", cmd);
	    mode = 0;
	    break;
    }

    up(&write_sem);

    dprintk(5, "%s <\n", __func__);
    return res;
}