Ejemplo n.º 1
0
/**
 * Modify the low-power protocol used by the Host via the proc interface.
 * @param file Not used.
 * @param buffer The buffer to read from.
 * @param count The number of bytes to be written.
 * @param data Not used.
 * @return On success, the number of bytes written. On error, -1, and
 * <code>errno</code> is set appropriately.
 */
static int bluetooth_pm_write_proc_proto(struct file *file, const char *buffer,
					unsigned long count, void *data)
{
	char proto;

	if (count < 1)
		return -EINVAL;

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

	if (proto == '1')
                bluetooth_pm_sleep_start();
	else
		bluetooth_pm_sleep_stop();

	/* claim that we wrote everything */
	return count;
}
Ejemplo n.º 2
0
/**
 * Starts the Sleep-Mode Protocol on the Host.
**/
void brcm_btsleep_start(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_start();
#elif defined(CONFIG_LGE_BLUETOOTH_PM)
        if(bluetooth_pm_sleep_start() != 0)
        {
            // if ret is not 0. fail to start bluetooth_pm sleep
        }
#endif
    }
//BT_E : fix wrong lpm_param issue, [END]
#endif
}
Ejemplo n.º 3
0
static ssize_t proc_bt_proto_write(struct file *file, const char __user *buf,
		       size_t length, loff_t *ppos)
{
	char proto;

	BT_INFO("");

	if (length < 1)
		return -EINVAL;

	if (copy_from_user(&proto, buf, 1))
		return -EFAULT;

	if (proto == '0')
		bluetooth_pm_sleep_stop();
	else
		bluetooth_pm_sleep_start();

	/* claim that we wrote everything */
	return length;

}