static void __rfkill_handle_global_op(enum rfkill_sched_op op)
{
	unsigned int i;

	switch (op) {
	case RFKILL_GLOBAL_OP_EPO:
		rfkill_epo();
		break;
	case RFKILL_GLOBAL_OP_RESTORE:
		rfkill_restore_states();
		break;
	case RFKILL_GLOBAL_OP_UNLOCK:
		rfkill_remove_epo_lock();
		break;
	case RFKILL_GLOBAL_OP_UNBLOCK:
		rfkill_remove_epo_lock();
		for (i = 0; i < NUM_RFKILL_TYPES; i++)
			rfkill_switch_all(i, false);
		break;
	default:
		/* memory corruption or bug, fail safely */
		rfkill_epo();
		WARN(1, "Unknown requested operation %d! "
			"rfkill Emergency Power Off activated\n",
			op);
	}
}
static int __init socle_rfkill_probe(struct platform_device *pdev)
{
	int rc = 0;

	/* default to bluetooth off */
	rfkill_switch_all(RFKILL_TYPE_BLUETOOTH, RFKILL_STATE_SOFT_BLOCKED);
	bluetooth_set_power(NULL, RFKILL_STATE_SOFT_BLOCKED);

	bt_rfk = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH);
	if (!bt_rfk)
		return -ENOMEM;

	bt_rfk->name = bt_name;
	bt_rfk->state = RFKILL_STATE_SOFT_BLOCKED;
	/* userspace cannot take exclusive control */
	bt_rfk->user_claim_unsupported = 1;
	bt_rfk->user_claim = 0;
	bt_rfk->data = NULL;  // user data
	bt_rfk->toggle_radio = bluetooth_set_power;

	rc = rfkill_register(bt_rfk);

	if (rc)
		rfkill_free(bt_rfk);
	return rc;
}
Example #3
0
static int __init smdk6410_rfkill_probe(struct platform_device *pdev)
#endif	/* #ifdef CONFIG_MACH_JET */
#endif	/* #ifdef CONFIG_MACH_SPICA */
#endif	/* #ifdef CONFIG_MACH_INSTINCTQ */
{
    int rc = 0;
    int irq,ret;

    //Initialize wake locks
    wake_lock_init(&rfkill_wake_lock, WAKE_LOCK_SUSPEND, "board-rfkill");
    wake_lock_init(&bt_wake_lock, WAKE_LOCK_SUSPEND, "bt-rfkill");

    //BT Host Wake IRQ
    irq = IRQ_BT_HOST_WAKE;

    ret = request_irq(irq, bt_host_wake_irq_handler, 0, "bt_host_wake_irq_handler", NULL);
    if(ret < 0)
#ifdef CONFIG_MACH_INSTINCTQ
        printk("[BT] Request_irq failed \n");
#else
        printk(KERN_DEBUG "[BT] Request_irq failed \n");
#endif	/* #else #ifdef CONFIG_MACH_INSTINCTQ */

    set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
    enable_irq(IRQ_EINT(22));

    //RFKILL init - default to bluetooth off
    rfkill_switch_all(RFKILL_TYPE_BLUETOOTH, RFKILL_STATE_SOFT_BLOCKED);

    bt_rfk = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH);
    if (!bt_rfk)
        return -ENOMEM;

    bt_rfk->name = bt_name;
    bt_rfk->state = RFKILL_STATE_SOFT_BLOCKED;
    /* userspace cannot take exclusive control */
    bt_rfk->user_claim_unsupported = 1;
    bt_rfk->user_claim = 0;
    bt_rfk->data = NULL;  // user data
    bt_rfk->toggle_radio = bluetooth_set_power;

#ifdef CONFIG_MACH_INSTINCTQ
    printk("[BT] rfkill_register(bt_rfk) \n");
#else
    printk(KERN_DEBUG "[BT] rfkill_register(bt_rfk) \n");
#endif	/* #ifdef CONFIG_MACH_INSTINCTQ */
    rc = rfkill_register(bt_rfk);
    if (rc)
        rfkill_free(bt_rfk);

    bluetooth_set_power(NULL, RFKILL_STATE_SOFT_BLOCKED);

    return rc;
}
static void __rfkill_handle_normal_op(const enum rfkill_type type,
				      const bool complement)
{
	bool blocked;

	blocked = rfkill_get_global_sw_state(type);
	if (complement)
		blocked = !blocked;

	rfkill_switch_all(type, blocked);
}
Example #5
0
static int __init jupiter_rfkill_probe(struct platform_device *pdev)
{
	int rc = 0;
	int irq,ret;

	//Initialize wake locks
	wake_lock_init(&rfkill_wake_lock, WAKE_LOCK_SUSPEND, "board-rfkill");
	wake_lock_init(&bt_wake_lock, WAKE_LOCK_SUSPEND, "bt-rfkill");

	//BT Host Wake IRQ
	irq = IRQ_BT_HOST_WAKE;

	set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
	ret = request_irq(irq, bt_host_wake_irq_handler, 0, "bt_host_wake_irq_handler", NULL);
	if(ret < 0)
		printk(KERN_ERR "[BT] Request_irq failed \n");

	set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
//	enable_irq(IRQ_EINT(22));

	//RFKILL init - default to bluetooth off
	rfkill_switch_all(RFKILL_TYPE_BLUETOOTH, RFKILL_STATE_SOFT_BLOCKED);

	bt_rfk = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH);
	if (!bt_rfk)
		return -ENOMEM;

	bt_rfk->name = bt_name;
	bt_rfk->state = RFKILL_STATE_SOFT_BLOCKED;
	/* userspace cannot take exclusive control */
	bt_rfk->user_claim_unsupported = 1;
	bt_rfk->user_claim = 0;
	bt_rfk->data = NULL;  // user data
	bt_rfk->toggle_radio = bluetooth_set_power;

	printk(KERN_DEBUG "[BT] rfkill_register(bt_rfk) \n");

	rc = rfkill_register(bt_rfk);
	if (rc)
	{
		printk (KERN_ERR "***********ERROR IN REGISTERING THE RFKILL***********\n");
		rfkill_free(bt_rfk);
	}

	bluetooth_set_power(NULL, RFKILL_STATE_SOFT_BLOCKED);
	rfkill_force_state(bt_rfk, RFKILL_STATE_SOFT_BLOCKED);

	return rc;
}
Example #6
0
static int __init infobowlq_rfkill_probe(struct platform_device *pdev)
{
	int rc = 0;
	int irq,ret;

	//Initialize wake locks
	wake_lock_init(&rfkill_wake_lock, WAKE_LOCK_SUSPEND, "board-rfkill");
#ifdef BT_SLEEP_ENABLER
	wake_lock_init(&bt_wake_lock, WAKE_LOCK_SUSPEND, "bt-rfkill");
#endif

	//BT Host Wake IRQ
	irq = IRQ_BT_HOST_WAKE;

//	set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
	ret = request_irq(irq, bt_host_wake_irq_handler, 0, "bt_host_wake_irq_handler", NULL);
	if(ret < 0)
		printk(KERN_ERR "[BT] Request_irq failed \n");
	set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
	enable_irq(IRQ_BT_HOST_WAKE);

	//RFKILL init - default to bluetooth off
	rfkill_switch_all(RFKILL_TYPE_BLUETOOTH, RFKILL_USER_STATE_SOFT_BLOCKED);

	bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH, &bt_rfkill_ops, NULL);
	if (!bt_rfk)
		return -ENOMEM;

	rfkill_init_sw_state(bt_rfk, 0);

	printk(KERN_DEBUG "[BT] rfkill_register(bt_rfk) \n");

	rc = rfkill_register(bt_rfk);
	if (rc)
	{
		printk ("***********ERROR IN REGISTERING THE RFKILL***********\n");
		rfkill_destroy(bt_rfk);
	}

	rfkill_set_sw_state(bt_rfk, 1);
	bluetooth_set_power(NULL, RFKILL_USER_STATE_SOFT_BLOCKED);

	return rc;
}