void diag_md_close_all()
{
	int i, j;
	unsigned long flags;
	struct diag_md_info *ch = NULL;
	struct diag_buf_tbl_t *entry = NULL;

	for (i = 0; i < NUM_DIAG_MD_DEV; i++) {
		ch = &diag_md[i];
		/*
		 * When we close the Memory device mode, make sure we flush the
		 * internal buffers in the table so that there are no stale
		 * entries.
		 */
		for (j = 0; j < ch->num_tbl_entries; j++) {
			entry = &ch->tbl[j];
			if (entry->len <= 0)
				continue;
			spin_lock_irqsave(&ch->lock, flags);
			if (ch->ops && ch->ops->write_done)
				ch->ops->write_done(entry->buf, entry->len,
						    entry->ctx, ch->ctx);
			entry->buf = NULL;
			entry->len = 0;
			entry->ctx = 0;
			spin_unlock_irqrestore(&ch->lock, flags);
		}
		if (ch->ops && ch->ops->close)
			ch->ops->close(ch->ctx, DIAG_MEMORY_DEVICE_MODE);
	}

	diag_ws_reset(DIAG_WS_MD);
}
void diag_md_close_all()
{
	int i, j;
	unsigned long flags;
	struct diag_md_info *ch = NULL;
	struct diag_buf_tbl_t *entry = NULL;

	for (i = 0; i < NUM_DIAG_MD_DEV; i++) {
		ch = &diag_md[i];

		if (ch->ops && ch->ops->close)
			ch->ops->close(ch->ctx, DIAG_MEMORY_DEVICE_MODE);

		spin_lock_irqsave(&ch->lock, flags);
		for (j = 0; j < ch->num_tbl_entries; j++) {
			entry = &ch->tbl[j];
			if (entry->len <= 0)
				continue;
			if (ch->ops && ch->ops->write_done)
				ch->ops->write_done(entry->buf, entry->len,
						    entry->ctx,
						    DIAG_MEMORY_DEVICE_MODE);
			entry->buf = NULL;
			entry->len = 0;
			entry->ctx = 0;
		}
		spin_unlock_irqrestore(&ch->lock, flags);
	}

	diag_ws_reset(DIAG_WS_MUX);
}
Exemple #3
0
static int lge_dm_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
	unsigned long arg)
{
	short result;
	short modem_number = Primary_modem_chip;
	struct dm_tty *lge_dm_tty_drv = NULL;
	int status, i = 0;
  char rw_buf[300];
    unsigned long flags;

	result = 0;
	lge_dm_tty_drv = lge_dm_tty;
	tty->driver_data = lge_dm_tty_drv;
	lge_dm_tty_drv->tty_str = tty;

	if (_IOC_TYPE(cmd) != DM_TTY_IOCTL_MAGIC)
		return -EINVAL;

	switch (cmd) {
	case DM_TTY_MODEM_OPEN_SDM:
		if(lge_dm_tty_drv->logging_mode == DM_APP_SDM)
		{
			pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
			"already DM_TTY_MODEM_OPEN_SDM\n", __func__);

			result = TRUE;

			if (copy_to_user((void *)arg, (const void *)&result,
				sizeof(result)) == 0)
				pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
					"already DM_TTY_MODEM_OPEN_SDM"
					"result = %d\n", __func__, result);

			break;
		}

		lge_dm_tty_drv->logging_mode = DM_APP_SDM;
		
		pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
		"DM_TTY_MODEM_OPEN_SDM\n", __func__);

		/* change path to DM APP */
		mutex_lock(&driver->diagchar_mutex);
		driver->logging_mode = DM_APP_MODE;
		mutex_unlock(&driver->diagchar_mutex);

		if (modem_number == Primary_modem_chip) {

			for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) {
                spin_lock_irqsave(&driver->smd_data[i].in_busy_lock, flags);
				driver->smd_data[i].in_busy_1 = 0;
				driver->smd_data[i].in_busy_2 = 0;
                spin_unlock_irqrestore(&driver->smd_data[i].in_busy_lock, flags);
				/* Poll SMD channels to check for data*/
				if (driver->smd_data[i].ch)
					queue_work(driver->diag_wq,
						&(driver->smd_data[i].
							diag_read_smd_work));
			}

			for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++) {
                spin_lock_irqsave(&driver->smd_cmd[i].in_busy_lock, flags);
				driver->smd_cmd[i].in_busy_1 = 0;
				driver->smd_cmd[i].in_busy_2 = 0;
                spin_unlock_irqrestore(&driver->smd_cmd[i].in_busy_lock, flags);
				if (driver->smd_cmd[i].ch)
					queue_work(driver->diag_wq,
						&(driver->smd_cmd[i].
							diag_read_smd_work));
			}
		} else if (modem_number == Secondary_modem_chip) {

			//TBD...

		} else {
			pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
				"DM_TTY_MODEM_OPEN_SDM"
				"error modem_number = %d\n",
					__func__, modem_number);
		}

		result = TRUE;

		if (copy_to_user((void *)arg, (const void *)&result,
			sizeof(result)) == 0)
			pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
				"DM_TTY_MODEM_OPEN_SDM"
				"result = %d\n", __func__, result);

		break;

	case DM_TTY_MODEM_CLOSE_SDM:
		lge_dm_tty_drv->logging_mode = DM_APP_ODM;
		pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
		"DM_TTY_MODEM_CLOSE_SDM\n", __func__);
				
		lge_dm_tty_drv->set_logging = 0;
		
		/* change path to USB driver */
		mutex_lock(&driver->diagchar_mutex);
		driver->logging_mode = USB_MODE;
		mutex_unlock(&driver->diagchar_mutex);
		
		if (driver->usb_connected == 0)
			diagfwd_disconnect();
		else
			diagfwd_connect();
		
        diag_ws_reset();

		result = TRUE;

		if (copy_to_user((void *)arg, (const void *)&result,
			sizeof(result)) == 0)
			pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
				"DM_TTY_MODEM_CLOSE_SDM"
				"result = %d\n", __func__, result);

		break;
	case DM_TTY_MODEM_OPEN_ODM:
		lge_dm_tty_drv->logging_mode = DM_APP_ODM;
		pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
		"DM_TTY_MODEM_OPEN_ODM\n", __func__);
		
		/* change path to DM DEV */
		mutex_lock(&driver->diagchar_mutex);
		driver->logging_mode = DM_APP_MODE;
		mutex_unlock(&driver->diagchar_mutex);

		for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) {
            spin_lock_irqsave(&driver->smd_data[i].in_busy_lock, flags);
			driver->smd_data[i].in_busy_1 = 0;
			driver->smd_data[i].in_busy_2 = 0;
            spin_unlock_irqrestore(&driver->smd_data[i].in_busy_lock, flags);
			/* Poll SMD channels to check for data*/
			if (driver->smd_data[i].ch)
				queue_work(driver->diag_wq,
					&(driver->smd_data[i].
						diag_read_smd_work));
		}

		break;

	case DM_TTY_MODEM_CLOSE_ODM:
		lge_dm_tty_drv->logging_mode = DM_APP_ODM;
		pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
		"DM_TTY_MODEM_CLOSE_ODM\n", __func__);
		
		lge_dm_tty_drv->set_logging = 0;

		/* change path to USB driver */
		mutex_lock(&driver->diagchar_mutex);
		driver->logging_mode = USB_MODE;
		mutex_unlock(&driver->diagchar_mutex);

		if (driver->usb_connected == 0)
			diagfwd_disconnect();
		else
			diagfwd_connect();

          diag_ws_reset();

	  break;

	case DM_TTY_MODEM_RESET:
		status = subsys_modem_restart();
		result = TRUE;

		if (copy_to_user((void *)arg, (const void *)&status,
			sizeof(result)) == 0)
			pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
				"DM_TTY_MODEM_RESET"
				"result = %d\n", __func__, result);
		break;

	case DM_TTY_MODEM_CRASH:
#ifdef CONFIG_DIAG_BRIDGE_CODE
			subsystem_restart("external_modem");
			result = TRUE;
#else
			subsystem_restart("modem");
			result = TRUE;
#endif

		if (copy_to_user((void *)arg, (const void *)&result,
		sizeof(result)) == 0)
		pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
			"DM_TTY_MODEM_CRASH"
			"result = %d\n", __func__, result);
	break;
  case DM_TTY_MODEM_DEBUGGER:
    //                      
    memset(rw_buf, 0, sizeof(rw_buf));
    strcpy(rw_buf,ssr_noti);
    if (copy_to_user((void *)arg, &rw_buf, sizeof(rw_buf))){
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
            "DM_TTY_MODEM_DEBUGGER error! "
            "rw_buf = %s\n", __func__, rw_buf);
            return -EFAULT;
      }

      printk("rw_buf = %s\n", rw_buf);

  break;

	default:
		pr_info(DM_TTY_MODULE_NAME ": %s:"
		"lge_dm_tty_ioctl error\n", __func__);
		break;

	}

	return 0;

}
static int lge_dm_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
    unsigned long arg)
{
    short result;
#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
    short modem_number = Secondary_modem_chip;
#else
    short modem_number = Primary_modem_chip;
#endif /*CONFIG_DIAGFWD_BRIDGE_CODE*/


    struct dm_tty *lge_dm_tty_drv = NULL;
    int status = 0;
    int i = 0;
    unsigned long flags;

#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
    int index=0;
    unsigned long spin_lock_flags;
#endif

    int j = 0;
    struct diag_buf_tbl_t *entry = NULL;

    result = 0;
    lge_dm_tty_drv = lge_dm_tty;
    tty->driver_data = lge_dm_tty_drv;
    lge_dm_tty_drv->tty_str = tty;

    if (_IOC_TYPE(cmd) != DM_TTY_IOCTL_MAGIC)
        return -EINVAL;

    switch (cmd) {
    case DM_TTY_MODEM_OPEN_SDM:
        if(lge_dm_tty_drv->logging_mode == DM_APP_SDM)
        {
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
            "already DM_TTY_MODEM_OPEN_SDM\n", __func__);

            result = TRUE;

            if (copy_to_user((void *)arg, (const void *)&result,
                sizeof(result)) == 0)
                pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                    "already DM_TTY_MODEM_OPEN_SDM"
                    "result = %d\n", __func__, result);

            break;
        }

        lge_dm_tty_drv->logging_mode = DM_APP_SDM;

        pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
        "DM_TTY_MODEM_OPEN_SDM\n", __func__);

#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
        for (index = 0; index < MAX_HSIC_DATA_CH; index++) {
            if ((diag_bridge[index].usb_connected == 1) && (diag_hsic[index].count_hsic_pool == N_MDM_WRITE)) {
                spin_lock_irqsave(&diag_hsic[index].hsic_spinlock,spin_lock_flags);
                diag_hsic[index].count_hsic_pool = 0;
                spin_unlock_irqrestore(&diag_hsic[index].hsic_spinlock,spin_lock_flags);
            }

            diag_hsic[index].num_hsic_buf_tbl_entries = 0;
            for (i = 0; i < diag_hsic[index].poolsize_hsic_write; i++) {
                if (diag_hsic[index].hsic_buf_tbl[index].buf) {
                    /* Return the buffer to the pool */
                    diagmem_free(driver, (unsigned char *)
                        (diag_hsic[index].hsic_buf_tbl[index].buf),
                        index+POOL_TYPE_HSIC);
                    diag_hsic[index].hsic_buf_tbl[index].buf = 0;
                }
                diag_hsic[index].hsic_buf_tbl[index].length = 0;
            }
        }

        diagfwd_cancel_hsic(REOPEN_HSIC); // QCT 161032 migration - NEED TO CHECK
        diagfwd_connect_bridge(0);
#endif /* CONFIG_DIAGFWD_BRIDGE_CODE */

        /* change path to DM APP */
        mutex_lock(&driver->diagchar_mutex);
        driver->logging_mode = DM_APP_MODE;
        mutex_unlock(&driver->diagchar_mutex);

        if (modem_number == Primary_modem_chip) {
            for (j = 0; j < lge_dm_tty->num_tbl_entries; j++) {
                entry = &lge_dm_tty->tbl[j];
                if (entry->len <= 0)
                    continue;

                spin_lock_irqsave(&entry->lock, flags);
                entry->buf = NULL;
                entry->len = 0;
                entry->ctx = 0;
                spin_unlock_irqrestore(&entry->lock, flags);
            }

            diag_ws_reset(DIAG_WS_MD);

            if (driver->rsp_buf_busy) {
                spin_lock_irqsave(&driver->rsp_buf_busy_lock, flags);
                driver->rsp_buf_busy = 0;
                spin_unlock_irqrestore(&driver->rsp_buf_busy_lock, flags);
            }

            for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) {
                spin_lock_irqsave(&driver->smd_data[i].in_busy_lock, flags);
                driver->smd_data[i].in_busy_1 = 0;
                driver->smd_data[i].in_busy_2 = 0;
                spin_unlock_irqrestore(&driver->smd_data[i].in_busy_lock, flags);

                /* Poll SMD data channels to check for data */
                queue_work(driver->smd_data[i].wq,
                    &(driver->smd_data[i].diag_read_smd_work));
            }

            for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++) {
                spin_lock_irqsave(&driver->smd_cmd[i].in_busy_lock, flags);
                driver->smd_cmd[i].in_busy_1 = 0;
                driver->smd_cmd[i].in_busy_2 = 0;
                spin_unlock_irqrestore(&driver->smd_cmd[i].in_busy_lock, flags);

                /* Poll SMD data channels to check for data */
                queue_work(driver->diag_wq,
                    &(driver->smd_cmd[i].diag_read_smd_work));
            }
        } else if (modem_number == Secondary_modem_chip) {
#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
                    for (index = 0; index < MAX_HSIC_DATA_CH; index++) {
                        /* Read data from the hsic */
                        if (diag_hsic[index].hsic_ch)
                            queue_work(diag_bridge[index].wq,
                                   &(diag_hsic[index].
                                     diag_read_hsic_work));
                    }
#endif /* CONFIG_DIAGFWD_BRIDGE_CODE */
        } else {
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                "DM_TTY_MODEM_OPEN_SDM"
                "error modem_number = %d\n",
                    __func__, modem_number);
        }

        result = TRUE;

        if (copy_to_user((void *)arg, (const void *)&result,
            sizeof(result)) == 0)
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                "DM_TTY_MODEM_OPEN_SDM"
                "result = %d\n", __func__, result);

        break;

    case DM_TTY_MODEM_CLOSE_SDM:
        lge_dm_tty_drv->logging_mode = DM_APP_ODM;
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                "DM_TTY_MODEM_CLOSE_SDM, modem_number = %d\n",
                    __func__, modem_number);

        lge_dm_tty_drv->set_logging = 0;

        /* change path to USB driver */
        mutex_lock(&driver->diagchar_mutex);
        driver->logging_mode = USB_MODE;
        mutex_unlock(&driver->diagchar_mutex);

        result = TRUE;

#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
        for (index = 0; index < MAX_HSIC_DATA_CH; index++) {

            diag_hsic[index].num_hsic_buf_tbl_entries = 0;
            for (i = 0; i < diag_hsic[index].poolsize_hsic_write; i++) {
                if (diag_hsic[index].hsic_buf_tbl[index].buf) {
                    /* Return the buffer to the pool */
                    diagmem_free(driver, (unsigned char *)
                        (diag_hsic[index].hsic_buf_tbl[index].buf),
                        index+POOL_TYPE_HSIC);
                    diag_hsic[index].hsic_buf_tbl[index].buf = 0;
                }
                diag_hsic[index].hsic_buf_tbl[index].length = 0;
            }
        }
        diagfwd_cancel_hsic(REOPEN_HSIC); // QCT 161032 migration - NEED TO CHECK
        diagfwd_connect_bridge(0);
#endif

        if (copy_to_user((void *)arg, (const void *)&result,
            sizeof(result)) == 0)
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                "DM_TTY_MODEM_CLOSE_SDM"
                "result = %d\n", __func__, result);

        break;
    case DM_TTY_MODEM_OPEN_ODM:
        lge_dm_tty_drv->logging_mode = DM_APP_ODM;

        pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                        "DM_TTY_MODEM_OPEN_ODM, modem_number = %d\n", __func__, modem_number);

#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
        for (index = 0; index < MAX_HSIC_DATA_CH; index++) {
            if ((diag_bridge[index].usb_connected == 1) && (diag_hsic[index].count_hsic_pool == N_MDM_WRITE)) {
                spin_lock_irqsave(&diag_hsic[index].hsic_spinlock,spin_lock_flags);
                diag_hsic[index].count_hsic_pool = 0;
                spin_unlock_irqrestore(&diag_hsic[index].hsic_spinlock,spin_lock_flags);
            }

            diag_hsic[index].num_hsic_buf_tbl_entries = 0;
            for (i = 0; i < diag_hsic[index].poolsize_hsic_write; i++) {
                if (diag_hsic[index].hsic_buf_tbl[index].buf) {
                    /* Return the buffer to the pool */
                    diagmem_free(driver, (unsigned char *)
                        (diag_hsic[index].hsic_buf_tbl[index].buf),
                        index+POOL_TYPE_HSIC);
                    diag_hsic[index].hsic_buf_tbl[index].buf = 0;
                }
                diag_hsic[index].hsic_buf_tbl[index].length = 0;
            }
        }

        diagfwd_cancel_hsic(REOPEN_HSIC); // QCT 161032 migration - NEED TO CHECK
        diagfwd_connect_bridge(0);
#endif /* CONFIG_DIAGFWD_BRIDGE_CODE */
        /* change path to DM DEV */
        mutex_lock(&driver->diagchar_mutex);
        driver->logging_mode = DM_APP_MODE;
        mutex_unlock(&driver->diagchar_mutex);

        if (modem_number == Primary_modem_chip) {
            for (j = 0; j < lge_dm_tty->num_tbl_entries; j++) {
                entry = &lge_dm_tty->tbl[j];
                if (entry->len <= 0)
                    continue;

                spin_lock_irqsave(&entry->lock, flags);
                entry->buf = NULL;
                entry->len = 0;
                entry->ctx = 0;
                spin_unlock_irqrestore(&entry->lock, flags);
            }

            diag_ws_reset(DIAG_WS_MD);

            if (driver->rsp_buf_busy) {
                spin_lock_irqsave(&driver->rsp_buf_busy_lock, flags);
                driver->rsp_buf_busy = 0;
                spin_unlock_irqrestore(&driver->rsp_buf_busy_lock, flags);
            }

            for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) {
                spin_lock_irqsave(&driver->smd_data[i].in_busy_lock, flags);
                driver->smd_data[i].in_busy_1 = 0;
                driver->smd_data[i].in_busy_2 = 0;
                spin_unlock_irqrestore(&driver->smd_data[i].in_busy_lock, flags);

                /* Poll SMD data channels to check for data */
                queue_work(driver->smd_data[i].wq,
                    &(driver->smd_data[i].diag_read_smd_work));
            }

            for (i = 0; i < NUM_SMD_CMD_CHANNELS; i++) {
                spin_lock_irqsave(&driver->smd_cmd[i].in_busy_lock, flags);
                driver->smd_cmd[i].in_busy_1 = 0;
                driver->smd_cmd[i].in_busy_2 = 0;
                spin_unlock_irqrestore(&driver->smd_cmd[i].in_busy_lock, flags);

                /* Poll SMD data channels to check for data */
                queue_work(driver->diag_wq,
                    &(driver->smd_cmd[i].diag_read_smd_work));
            }
        } else if (modem_number == Secondary_modem_chip) {

#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
                    for (index = 0; index < MAX_HSIC_DATA_CH; index++) {
                        /* Read data from the hsic */
                        if (diag_hsic[index].hsic_ch)
                            queue_work(diag_bridge[index].wq,
                                   &(diag_hsic[index].
                                     diag_read_hsic_work));
                    }
#endif /* CONFIG_DIAGFWD_BRIDGE_CODE */


        } else {
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                "DM_TTY_IOCTL_MODEM_OPEN"
                "error modem_number = %d\n",
                    __func__, modem_number);
        }

        break;

    case DM_TTY_MODEM_CLOSE_ODM:
        lge_dm_tty_drv->logging_mode = DM_APP_ODM;

        pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
            "DM_TTY_MODEM_CLOSE_ODM, modem_number = %d\n",
                __func__, modem_number);
        result = TRUE;

        lge_dm_tty_drv->set_logging = 0;

        /* change path to USB driver */
        mutex_lock(&driver->diagchar_mutex);
        driver->logging_mode = USB_MODE;
        mutex_unlock(&driver->diagchar_mutex);

        if (modem_number == Primary_modem_chip) {

        } else if (modem_number == Secondary_modem_chip) {
#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
        for (index = 0; index < MAX_HSIC_DATA_CH; index++) {
            diag_hsic[index].num_hsic_buf_tbl_entries = 0;
            for (i = 0; i < diag_hsic[index].poolsize_hsic_write; i++) {
                if (diag_hsic[index].hsic_buf_tbl[index].buf) {
                    /* Return the buffer to the pool */
                    diagmem_free(driver, (unsigned char *)
                        (diag_hsic[index].hsic_buf_tbl[index].buf),
                        index+POOL_TYPE_HSIC);
                    diag_hsic[index].hsic_buf_tbl[index].buf = 0;
                }
                diag_hsic[index].hsic_buf_tbl[index].length = 0;
            }
        }
        diagfwd_cancel_hsic(REOPEN_HSIC); // QCT 161032 migration - NEED TO CHECK
        diagfwd_connect_bridge(0);
#endif
        }

        if (copy_to_user((void *)arg, (const void *)&result,
            sizeof(result)) == 0)
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                "DM_TTY_MODEM_CLOSE_ODM"
                "result = %d\n", __func__, result);

      break;

    case DM_TTY_MODEM_RESET:
        // not supported
        //status = subsys_modem_restart();
        result = TRUE;

        if (copy_to_user((void *)arg, (const void *)&status,
            sizeof(result)) == 0)
            pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
                "DM_TTY_MODEM_RESET"
                "result = %d\n", __func__, result);
        break;

    case DM_TTY_MODEM_CRASH:
#ifdef CONFIG_DIAG_BRIDGE_CODE
            subsystem_restart("external_modem");
            result = TRUE;
#else
            subsystem_restart("modem");
            result = TRUE;
#endif

        if (copy_to_user((void *)arg, (const void *)&result,
        sizeof(result)) == 0)
        pr_info(DM_TTY_MODULE_NAME ": %s: lge_dm_tty_ioctl "
            "DM_TTY_MODEM_CRASH"
            "result = %d\n", __func__, result);
    break;
  case DM_TTY_MODEM_DEBUGGER:
/*
                                      
                            
                                                            
                                                                
                                           
                                               
                           
       

                                      
*/
  break;

    default:
        pr_info(DM_TTY_MODULE_NAME ": %s:"
        "lge_dm_tty_ioctl error\n", __func__);
        break;

    }

    return 0;

}