static void ghsuart_send_cbits_tomodem(void *gptr, u8 portno, int cbits) { struct ghsuart_ctrl_port *port; if (portno >= num_ctrl_ports || !gptr) { pr_err("%s: Invalid portno#%d\n", __func__, portno); return; } port = ghsuart_ctrl_ports[portno].port; if (!port) { pr_err("%s: port is null\n", __func__); return; } if (cbits == port->cbits_tomodem) return; port->cbits_tomodem = cbits; if (!test_bit(CH_CONNECTED, &port->channel_sts)) return; pr_debug("%s: ctrl_tomodem:%d\n", __func__, cbits); /* Send the control bits to the Modem */ msm_smux_tiocm_set(port->ch_id, cbits, ~cbits); }
static int smux_open(int id) { int err = 0; struct diag_smux_info *ch = NULL; if (id < 0 || id >= NUM_SMUX_DEV) return -EINVAL; ch = &diag_smux[id]; if (ch->opened) { DIAGFWD_DBUG("diag: SMUX channel %d is already connected\n", ch->id); return 0; } err = diag_smux_init_ch(ch); if (err) { pr_err("diag: Unable to initialize SMUX channel %d, err: %d\n", ch->id, err); return err; } err = msm_smux_open(ch->lcid, (void *)ch->id, diag_smux_event, smux_get_rx_buffer); if (err) { pr_err("diag: failed to open SMUX ch %d, err: %d\n", ch->id, err); return err; } msm_smux_tiocm_set(ch->lcid, TIOCM_DTR, 0); ch->opened = 1; pr_info("diag: SMUX ch %d is connected\n", ch->id); return 0; }
int diagfwd_connect_smux(void) { void *priv = NULL; int ret = 0; if (driver->lcid == LCID_INVALID) { ret = msm_smux_open(LCID_VALID, priv, diag_smux_event, diag_get_rx_buffer); if (!ret) { driver->lcid = LCID_VALID; msm_smux_tiocm_set(driver->lcid, TIOCM_DTR, 0); pr_info("diag: open SMUX ch, r = %d\n", ret); } else { pr_err("diag: failed to open SMUX ch, r = %d\n", ret); return ret; } } /* Poll USB channel to check for data*/ queue_work(diag_bridge[SMUX].wq, &(diag_bridge[SMUX].diag_read_work)); return ret; }