static ssize_t modem_boot_set(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int state; dev_info(dev, "Power PHY set to %s\n", buf); if (sscanf(buf, "%d", &state) != 1) return -EINVAL; if (state == POWER_SET_ON) { modem_boot_change_state(state); oem_power_on_modem(); } else if (state == 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(); } else if (state == POWER_SET_DEBUGON) { modem_boot_change_state(state); oem_power_on_modem(); } else if (state == POWER_SET_DEBUGOFF) { modem_boot_change_state(state); oem_power_off_modem(); } else { dev_err(dev, "Power PHY error state. %s\n", buf); } return count; }
static irqreturn_t modem_reset_indication_irq(int irq, void *data) { if(GPIO_OEM_VALID(cbp_rst_ind_gpio )){ printk("%s %d oem_gpio_get_value(GPIO_VIATEL_MDM_RST_IND)=%d \n",__func__,__LINE__,oem_gpio_get_value(cbp_rst_ind_gpio)); if(oem_gpio_get_value(cbp_rst_ind_gpio)){ if(first_irq_flag == 1){ printk("%s %d first irq read rest_gpio is high,return. \n",__func__,__LINE__); return IRQ_HANDLED; } wake_lock_timeout(&vmdata->wlock, MDM_RST_LOCK_TIME * HZ); modem_notify_event(MDM_EVT_NOTIFY_RESET_ON); via_modem_state = MODEM_STATE_POWER; via_monitor_uevent_notify(MODEM_STATE_POWER); }else{ if(first_irq_flag == 1){ printk("%s %d set first_irq_flag=0. \n",__func__,__LINE__); first_irq_flag = 0; } modem_notify_event(MDM_EVT_NOTIFY_RESET_OFF); } } irq_set_irq_type(irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING); gpio_irq_cbp_rst_ind(); oem_gpio_irq_unmask(cbp_rst_ind_gpio); return IRQ_HANDLED; }
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 ssize_t modem_state_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int modem_state; dev_info(dev, "set modem_state to %s\n", buf); if (sscanf(buf, "%d", &modem_state) != 1) return -EINVAL; if (modem_state == MODEM_STATE_READY) { via_modem_state = MODEM_STATE_READY; via_monitor_uevent_notify(MODEM_STATE_READY); }else { dev_err(dev, "Power PHY error state. %s\n", buf); } return count; }
static ssize_t modem_state_store(struct device *pdev, struct device_attribute *attr, const char *buf, size_t count) { int modem_state; hwlog_info("set modem_state to %s\n", buf); if ( kstrtoint(buf, 10, &modem_state) ) { hwlog_err("%s:%d kstrtoint %s fail\n", __func__, __LINE__, buf); return -EINVAL; } if (modem_state == MODEM_STATE_READY) { via_modem_state = MODEM_STATE_READY; via_monitor_uevent_notify(MODEM_STATE_READY); }else { hwlog_err("Power PHY error state. %s\n", buf); } return count; }