static ssize_t store_control(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { struct modemctl *mc = dev_get_drvdata(d); if (!strncmp(buf, "on", 2)) { modem_on(mc); return count; } if (!strncmp(buf, "off", 3)) { modem_off(mc); return count; } if (!strncmp(buf, "reset", 5)) { modem_reset(mc); return count; } if (!strncmp(buf, "boot", 4)) { modem_boot(mc); return count; } if (!strncmp(buf, "daolpu", 6)) { kernel_upload(mc); return count; } return count; }
static ssize_t modem_write (struct file *filp, const char __user *buffer, size_t count, loff_t *offset) { if(!global_mc) return -1; if(count >= 4 && !strncmp(buffer, "main", 4)) { modem_main_enumeration(global_mc); } if(count >= 5 && !strncmp(buffer, "flash", 5)) { modem_boot_enumeration(global_mc); } if(count >= 3 && !strncmp(buffer, "off", 3)) { modem_on(global_mc); } if(count >= 2 && !strncmp(buffer, "on", 2)) { modem_off(global_mc); } if(count >= 5 && !strncmp(buffer, "reset", 5)) { modem_reset(global_mc); } return count; }
static long modemctl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct modemctl *mc = filp->private_data; int ret; mutex_lock(&mc->ctl_lock); switch (cmd) { case IOCTL_MODEM_RESET: ret = modem_reset(mc); MODEM_COUNT(mc,resets); break; case IOCTL_MODEM_START: ret = modem_start(mc, 0); break; case IOCTL_MODEM_RAMDUMP: ret = modem_start(mc, 1); break; case IOCTL_MODEM_OFF: ret = modem_off(mc); break; default: ret = -EINVAL; } mutex_unlock(&mc->ctl_lock); pr_info("modemctl_ioctl() %d\n", ret); return ret; }
static long modemctl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct modemctl *mc = filp->private_data; struct dpram_firmware fw; struct stat_info *pst; int ret = 0; mutex_lock(&mc->ctl_lock); switch (cmd) { case IOCTL_MODEM_RESET: ret = modem_reset(mc); MODEM_COUNT(mc,resets); break; case IOCTL_MODEM_START: ret = modem_start(mc, 0); break; case IOCTL_MODEM_RAMDUMP: ret = modem_start(mc, 1); break; case IOCTL_MODEM_OFF: ret = modem_off(mc); break; /* CDMA modem update in recovery mode */ case IOCTL_MODEM_FW_UPDATE: pr_info("IOCTL_MODEM_FW_UPDATE\n"); if (arg == '\0') { pr_err("No firmware"); break; } ret = copy_from_user((void *)&fw, (void *)arg, sizeof(fw)); if (ret < 0) { pr_err("copy from user failed!"); ret = -EINVAL; } else if (dpram_process_modem_update(mc, &fw) < 0) { pr_err("firmware write failed\n"); ret = -EIO; } break; case IOCTL_MODEM_CHK_STAT: pst = (struct stat_info *)arg; if (mc->is_modem_delta_update) ret = dpram_chk_delta_update(mc, &(pst->pct), pst->msg); else ret = dpram_chk_full_update(mc, &(pst->pct), pst->msg); break; case IOCTL_MODEM_PWROFF: pr_info("IOCTL_MODEM_PWROFF\n"); dpram_modem_pwroff(mc); break; default: ret = -EINVAL; } mutex_unlock(&mc->ctl_lock); pr_info("modemctl_ioctl() %d\n", ret); return ret; }
static ssize_t store_control(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { struct modemctl *mc = dev_get_drvdata(d); if (!strncmp(buf, "on", 2)) { modem_on(mc); return count; } if (!strncmp(buf, "off", 3)) { modem_off(mc); return count; } if (!strncmp(buf, "reset", 5)) { modem_reset(mc); return count; } if (!strncmp(buf, "boot", 4)) { modem_boot(mc); return count; } if (!strncmp(buf, "renum", 6)) { enumeration(mc); return count; } if (!strncmp(buf, "phon", 4)) { gpio_set_value(mc->gpio_phone_on, 0); mdelay(1); gpio_set_value(mc->gpio_phone_on, 1); return count; } if (!strncmp(buf, "gsw=0", 5)) { gpio_set_value(mc->gpio_ipc_slave_wakeup, 0); return count; } if (!strncmp(buf, "gsw=1", 5)) { gpio_set_value(mc->gpio_ipc_slave_wakeup, 1); return count; } if (!strncmp(buf, "gat=0", 5)) { gpio_set_value(mc->gpio_active_state, 0); return count; } if (!strncmp(buf, "gat=1", 5)) { gpio_set_value(mc->gpio_active_state, 1); return count; } return count; }
static int modem_main_enumeration(struct modemctl *mc) { struct completion done; unsigned long timeout; #if CONFIG_HAS_WAKELOCK wake_lock(&mc->reset_lock); #endif mc->boot_done =0; mc->cpcrash_flag =0; mc->cpreset_flag =0; mc->cpdump_flag =0 ; s3c_otg_device_power_control(0);//haozz for extenal modem power crash s5p_ehci_power(0);//power off hsic and remove modem devices for skip bootrom flash program modem_off(mc); msleep(100); #if 1 // smm6260_set_active_state(1); enable_irq(mc->irq[1]); modem_on_normal(mc);//power on modem msleep(100); //waiting for the first time HSIC_HOST_WAKEUP go high init_completion(&done); mc->l2_done = &done; printk("\n-------%%%%%%% wait no more than 20 s\n"); timeout = wait_for_completion_timeout(&done, 20*HZ);//waiting for the second time HSIC_HOST_WAKEUP go high //wait modem power on mc->l2_done = NULL; // smm6260_set_active_state(0); #else msleep(100); modem_on(mc); s5p_ehci_power(1); msleep(100); s5p_ehci_power(0); #endif //msleep(200); //for ELPM initialization time s5p_ehci_power(1);//power on hsic s3c_otg_device_power_control(1);//haozz for extenal modem power crash if(timeout > 0){ printk("Success: modem OK, time left: %d\n", timeout); mc->boot_done = 1; }else{ printk("Error: fail to boot modem, time left: %d\n", timeout); /*must disable this irq, otherwise CP keeps interrupting AP*/ free_irq(mc->irq[2], mc); } #if CONFIG_HAS_WAKELOCK wake_unlock(&mc->reset_lock); #endif return 0; }
static ssize_t store_control(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { struct modemctl *mc = dev_get_drvdata(d); if (!strncmp(buf, "on", 2)) { modem_on(mc); return count; } if (!strncmp(buf, "off", 3)) { modem_off(mc); return count; } if (!strncmp(buf, "reset", 5)) { modem_reset(mc); return count; } if (!strncmp(buf, "boot", 4)) { //modem_boot(mc); ignore_irq_count = 1; enable_irq(mc->irq[0]); return count; } if (!strncmp(buf, "daolpu", 6)) { kernel_upload(mc); return count; } if (!strncmp(buf, "silent", 6)) { printk(KERN_ERR "%s -LTE Silent Reset!!!\n", __func__); crash_event(1); return count; } return count; }
int modem_ioctl (struct file *filp, unsigned int cmd, unsigned long arg) { if(!global_mc) return -1; switch(cmd) { case MODEM_POWER_MAIN_CMD: modem_main_enumeration(global_mc); break; case MODEM_POWER_FLASH_CMD: modem_boot_enumeration(global_mc); break; case MODEM_POWER_OFF_CMD: modem_off(global_mc); break; case MODEM_POWER_ON_CMD: modem_on(global_mc); break; case MODEM_POWER_RESET_CMD: modem_reset(global_mc); break; } return 0; }