Exemple #1
0
static long misc_modem_ioctl(struct file *file, unsigned int
		cmd, unsigned long arg)
{
    void __user *argp = (void __user *) arg;
    int flag;

    switch (cmd) {
        case VMDM_IOCTL_RESET:
            oem_reset_modem();
            break;
        case VMDM_IOCTL_POWER:
            if (copy_from_user(&flag, argp, sizeof(flag)))
                return -EFAULT;
            if (flag < 0 || flag > 1)
                return -EINVAL;
            if(flag){
                oem_power_on_modem();
            }else{
                oem_power_off_modem();
            }
            break;
        default:
            break;
    }

    return 0;
}
Exemple #2
0
ssize_t modem_reset_store(
	struct kobject *kobj, struct kobj_attribute *attr,
	const char *buf, size_t n)
{
    /* reset the modem */
    oem_reset_modem();
    return n;
}
Exemple #3
0
static long misc_modem_ioctl(struct file *file, unsigned int
		cmd, unsigned long arg)
{
    void __user *argp = (void __user *) arg;
    int flag,ret=-1;

    switch (cmd) {
        case VMDM_IOCTL_RESET:
            oem_reset_modem();
            break;
        case VMDM_IOCTL_POWER:
            if (copy_from_user(&flag, argp, sizeof(flag)))
                return -EFAULT;
            if (flag < 0 || flag > 1)
                return -EINVAL;
            if(flag){
                oem_power_on_modem();
            }else{
                oem_power_off_modem();
            }
            break;
	case VMDM_IOCTL_CRL:
		if (copy_from_user(&flag, argp, sizeof(flag)))
				return -EFAULT;
		if (flag < 0 || flag > 1)
			return -EINVAL;
		if(flag){
			ret=modem_on_off_ctrl_chan(1);
		}else{
			ret=modem_on_off_ctrl_chan(0);
		}
		break;
	case VMDM_IOCTL_DIE:
		oem_let_cbp_die();
		break;
	case VMDM_IOCTL_WAKE:
		if (copy_from_user(&flag, argp, sizeof(flag)))
			return -EFAULT;
		if (flag < 0 || flag > 1)
			return -EINVAL;
		if(flag){
            printk("hold on wakelock.\n");
			wake_lock(&vmdata->wlock);
		}else{
            printk("release wakelock.\n");
			wake_unlock(&vmdata->wlock);
		}
		break;
    default:
        break;
			
    }

    return 0;
}
ssize_t modem_via_rst_mdm_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
    if( !strncmp(buf, "1", strlen("1"))){
        oem_reset_modem();
    }else if( !strncmp(buf, "0", strlen("0"))){
        oem_gpio_direction_output(cbp_rst_gpio, 0);
    }else{
        hwlog_info("Unknow command.\n");
    }
        return count;
}
static ssize_t modem_boot_set(struct device *pdev, struct device_attribute *attr, const char *buf, size_t count)
{
    int state;

    hwlog_info("Power PHY set to %s\n", buf);

    if (kstrtoint(buf, 10, &state)) {
        hwlog_err("%s:%d kstrtoint %s fail\n", __func__, __LINE__, buf);
        return -EINVAL;
    }

	switch(state){
		case POWER_SET_DEBUGOFF:
			modem_boot_change_state(state);
			oem_power_off_modem();
			break;
		case POWER_SET_DEBUGON:
			modem_boot_change_state(state);
			oem_power_on_modem();
			break;
		case POWER_SET_OFF:
			modem_boot_change_state(state);
			via_modem_state = MODEM_STATE_OFF;
			via_monitor_uevent_notify(MODEM_STATE_OFF);
			oem_power_off_modem();
			break;
		case POWER_SET_ON:
			modem_boot_change_state(state);
			oem_power_on_modem();
			break;
		case MODEM_CTRL_RESET:
			oem_reset_modem();
			break;
		case MODEM_CTRL_DIE:
			oem_let_cbp_die();
			break;
		case MODEM_CTRL_WAKE_LOCK:
			hwlog_info("hold on wakelock.\n");
			wake_lock(&vmdata->wlock);
			break;
		case MODEM_CTRL_WAKE_LOCK_RELEASE:
			hwlog_info("release wakelock.\n");
			wake_unlock(&vmdata->wlock);
			break;
		default:
			hwlog_info("default: do nothing!\n");
			break;
	}

    return count;
}
static void cbp_backup_check_ramdump_timer(unsigned long data)
{
    char rst_buf[CBP_EXCEPT_STACK_LEN]={0};

    atomic_set(&cbp_backup_timer_started, 0);
    snprintf(rst_buf, CBP_EXCEPT_STACK_LEN, "%s %d: VIA CBP can not produce ramdump by AP pull backup GPIO!\n", __func__,__LINE__);
    if(via_resetinfo_write(rst_buf, VIA_RESETINFO_WR_APPEND)) {
        hwlog_err("%s %d:via_resetinfo_write write failed!\n", __func__,__LINE__);
    }
    hwlog_info("%s", rst_buf);

    oem_reset_modem();
    hwlog_err("%s %d: finish hardware reset VIA CBP.\n", __func__, __LINE__);
}