Beispiel #1
0
static void am_uart_start_tx(struct uart_port *port)
{
    struct am_uart_port * info = &am_ports[port->line];
    am_uart_t *uart = uart_addr[info->line];
//    unsigned long mode;
    struct uart_port * up = &info->port;
    unsigned int ch;
    struct circ_buf *xmit = &up->state->xmit;
    unsigned long flags;
	
#ifdef PRINT_DEBUG
    if(info->line == DEBUG_PORT_ID)
        printk("%s\n", __FUNCTION__);
#endif
#ifdef CONFIG_BT_SLEEP
    if(info->line == 1) // we are now at ttyS1?
        bluesleep_outgoing_data();
#endif
    spin_lock_irqsave(&info->wr_lock,flags);

    while(!uart_circ_empty(xmit))
    {
        if ((readl(&uart->status) & UART_TXFULL) ==0) {
            ch = xmit->buf[xmit->tail];
            writel(ch, &uart->wdata);
            xmit->tail = (xmit->tail+1) & (SERIAL_XMIT_SIZE - 1);
        }
	  else
        {
		break;
	  }
    }
    spin_unlock_irqrestore(&info->wr_lock, flags);
}
/**
 * Handles proper timer action when outgoing data is delivered to the
 * HCI line discipline and wake the chip from sleep.
 **/
void brcm_btsleep_wake( enum sleep_type type)
{
#ifdef LPM_BLUESLEEP
//BT_S : fix wrong lpm_param issue, [START]
    printk("%s - %d\n", __func__, type);
    if(type == SLEEP_BLUESLEEP)
#if defined(CONFIG_BT_MSM_SLEEP)
         bluesleep_outgoing_data();
#elif defined(CONFIG_LGE_BLUETOOTH_PM)
         bluetooth_pm_outgoing_data();
#endif
//BT_E : fix wrong lpm_param issue, [END]
#endif
}
static int bluesleep_write_proc_btwrite(struct file *file, const char *buffer,
					unsigned long count, void *data)
{
	char b;

	if (count < 1)
		return -EINVAL;

	if (copy_from_user(&b, buffer, 1))
		return -EFAULT;

	/* HCI_DEV_WRITE */
	if (b != '0')
		bluesleep_outgoing_data();

	return count;
}
Beispiel #4
0
static ssize_t bluesleep_write_proc_btwrite(struct file *file, const char __user *buffer,
				 size_t count, loff_t *pos)
{
	char b;

	if (count < 1)
		return -EINVAL;

	if (copy_from_user(&b, buffer, 1))
		return -EFAULT;

	/* HCI_DEV_WRITE */
	if (b != '0')
		bluesleep_outgoing_data();

	return count;
}
/**
 *Wake up BT chipset before Tx. 
 */
static ssize_t bluesleep_ap_wakeup_bt(struct file *filp, const char __user *buffer, size_t len, loff_t *off)
{
	char buf;
	unsigned long irq_flags;
	if (len < 1 || (NULL == g_bs_data))
		return -EINVAL;

	pr_info("%s, bluesleep_ap_wakeup_bt \n", __func__);

	if (copy_from_user(&buf, buffer, sizeof(buf)))
		return -EFAULT;

	if (buf == '0') {
		pr_info("%s, ap_wakeup_bt 0 \n", __func__);
		spin_lock_irqsave(&g_bs_data->rw_lock, irq_flags);
		clear_bit(BT_TXDATA, &g_bs_data->flags);
		spin_unlock_irqrestore(&g_bs_data->rw_lock, irq_flags);
	} else
		bluesleep_outgoing_data(g_bs_data);

	return len;
}