• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rfkill_init_sw_state函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中rfkill_init_sw_state函数的典型用法代码示例。如果您正苦于以下问题:C++ rfkill_init_sw_state函数的具体用法?C++ rfkill_init_sw_state怎么用?C++ rfkill_init_sw_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rfkill_init_sw_state函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: rfkill_alloc

/*************************************************
Function:       bluetooth_power_rfkill_probe
Description:    rfkill init function
Calls:              rfkill_alloc()
                    rfkill_init_sw_state()
                    rfkill_register()
                    rfkill_destroy()
Input:          platform_device *pdev
                bluetooth_power_private_data *p_dev_data
Output:         
Return:         int ret
Others:         NA
*************************************************/
static int bluetooth_power_rfkill_probe(struct platform_device *pdev, 
                struct bluetooth_power_private_data *p_dev_data)
{
	int ret = 0;

	printk(KERN_INFO "bluetooth_power_rfkill_probe in \n");

	/* alloc memery for rfkill */
	p_dev_data->rfkill = rfkill_alloc("bt_power", 
	&pdev->dev, RFKILL_TYPE_BLUETOOTH, &bluetooth_power_rfkill_ops, pdev);
	if(!p_dev_data->rfkill){
		dev_err(&pdev->dev,	"bluetooth rfkill allocate failed\n");
		return -ENOMEM;
	}

	/* force Bluetooth off during init to allow	for	user control */
	rfkill_init_sw_state( p_dev_data->rfkill, 1);
	p_dev_data->previous =	1;

	ret	= rfkill_register( p_dev_data->rfkill );
	if (ret) {
		dev_err(&pdev->dev,	"rfkill	register failed=%d\n", ret);
		goto rfkill_failed;
	}

	printk(KERN_INFO "bluetooth_power_rfkill_probe out \n");

	return ret;

rfkill_failed:
	rfkill_destroy( p_dev_data->rfkill );
	return ret;
}
开发者ID:herryfan,项目名称:kernel-huawei-h60,代码行数:46,代码来源:bluetooth_power.c


示例2: bluetooth_power_rfkill_probe

static int bluetooth_power_rfkill_probe(struct platform_device *pdev)
{
	struct rfkill *rfkill;
	int ret;

	 printk("%s\n",__func__);

	rfkill = rfkill_alloc("bt_power", &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			      &bluetooth_power_rfkill_ops,
			      pdev->dev.platform_data);

	if (!rfkill) {
		dev_err(&pdev->dev, "rfkill allocate failed\n");
		return -ENOMEM;
	}

	/* force Bluetooth off during init to allow for user control */
	rfkill_init_sw_state(rfkill, 1);

	ret = rfkill_register(rfkill);
	if (ret) {
		dev_err(&pdev->dev, "rfkill register failed=%d\n", ret);
		rfkill_destroy(rfkill);
		return ret;
	}

	platform_set_drvdata(pdev, rfkill);

#ifdef BTLD_CONTROL_WAKE_GPIO
	bluesleep_rfkill_alloc();
#endif

	return 0;
}
开发者ID:CL0SeY,项目名称:i957kernel,代码行数:34,代码来源:bluetooth-power.c


示例3: rfkill_bluetooth_probe

static int rfkill_bluetooth_probe(struct platform_device *pdev)
{

	int rc = 0;
	bool default_state = true;

	printk(KERN_INFO "-->%s\n", __func__);
	getIoResource(pdev);

	bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
	   &rfkill_bluetooth_ops, NULL);
	if (!bt_rfk) {
	 rc = -ENOMEM;
	 goto err_rfkill_alloc;
	}
        rfkill_gpio_init();
	/* userspace cannot take exclusive control */
	rfkill_init_sw_state(bt_rfk,false);
	rc = rfkill_register(bt_rfk);
	if (rc)
		goto err_rfkill_reg;

	rfkill_set_sw_state(bt_rfk,true);
	bluetooth_set_power(NULL, default_state);

	printk(KERN_INFO "<--%s\n", __func__);
	return 0;

err_rfkill_reg:
	rfkill_destroy(bt_rfk);
err_rfkill_alloc:
	return rc;
}
开发者ID:ItsAnilSingh,项目名称:android_kernel_samsung_logan2g,代码行数:33,代码来源:brcm_rfkill.c


示例4: bluetooth_power_rfkill_probe

static int bluetooth_power_rfkill_probe(struct platform_device *pdev)
{
	struct rfkill *rfkill;
	int ret;
#if defined (CONFIG_MACH_LGE_I_BOARD)
		bluetooth_power_rfkill_ops.set_block = bt_platform_data->bluetooth_toggle_radio;
#endif

	rfkill = rfkill_alloc("bt_power", &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			      &bluetooth_power_rfkill_ops,
			      pdev->dev.platform_data);

	if (!rfkill) {
		dev_err(&pdev->dev, "rfkill allocate failed\n");
		return -ENOMEM;
	}

	/* force Bluetooth off during init to allow for user control */
	rfkill_init_sw_state(rfkill, 1);
#if !defined (CONFIG_MACH_LGE_I_BOARD)	
	previous = 1;
#endif

	ret = rfkill_register(rfkill);
	if (ret) {
		dev_err(&pdev->dev, "rfkill register failed=%d\n", ret);
		rfkill_destroy(rfkill);
		return ret;
	}

	platform_set_drvdata(pdev, rfkill);

	return 0;
}
开发者ID:playfulgod,项目名称:kernel_lge_i_vzw,代码行数:34,代码来源:bluetooth-power.c


示例5: bluetooth_power_rfkill_probe

static int bluetooth_power_rfkill_probe(struct platform_device *pdev)
{
	struct rfkill *rfkill;
	int ret;

	rfkill = rfkill_alloc("bt_power", &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			      &bluetooth_power_rfkill_ops,
			      pdev->dev.platform_data);

	if (!rfkill) {
		dev_err(&pdev->dev, "rfkill allocate failed\n");
		return -ENOMEM;
	}

	/* add file into rfkill0 to handle LDO27 */
	ret = device_create_file(&pdev->dev, &dev_attr_extldo);
	if (ret < 0)
		BT_PWR_ERR("device create file error!");

	/* force Bluetooth off during init to allow for user control */
	rfkill_init_sw_state(rfkill, 1);
	previous = 1;

	ret = rfkill_register(rfkill);
	if (ret) {
		dev_err(&pdev->dev, "rfkill register failed=%d\n", ret);
		rfkill_destroy(rfkill);
		return ret;
	}

	platform_set_drvdata(pdev, rfkill);

	return 0;
}
开发者ID:AndroidGX,项目名称:SimpleGX-L-5.0.2_BOD6_G901F,代码行数:34,代码来源:bluetooth-power.c


示例6: wifi_rfkill_probe

static int wifi_rfkill_probe(struct platform_device *pdev)
{
	int ret = -ENOMEM;

	g_WifiRfkill = rfkill_alloc("wifi_ar6k", &pdev->dev, RFKILL_TYPE_WLAN,
			&wifi_power_rfkill_ops,
			NULL);

	if (!g_WifiRfkill) {
		printk(KERN_DEBUG
				"%s: wifi rfkill register failed=%d\n", __func__,
				ret);
		return -ENOMEM;
	}

	/* force Bluetooth off during init to allow for user control */
	rfkill_init_sw_state(g_WifiRfkill, 1);

	ret = rfkill_register(g_WifiRfkill);
	if (ret) {
		printk(KERN_DEBUG
				"%s: rfkill register failed=%d\n", __func__,
				ret);
		rfkill_destroy(g_WifiRfkill);
		return ret;
	}
	return ret;
}
开发者ID:R-N,项目名称:boston-2.6.32.x,代码行数:28,代码来源:bluetooth-power.c


示例7: bcmbt_rfkill_probe

static int bcmbt_rfkill_probe(struct platform_device *pdev)
{
	int rc = 0;
	struct bcmbt_rfkill_platform_data *pdata = pdev->dev.platform_data;

	gpio_request(pdata->vreg_gpio, "rfkill_vreg_gpio");
#if 0
	pr_err("bcmbt_rfkill_probe:  Set vreg_gpio: %d, level: %s\n",
	       pdata->vreg_gpio,
	       gpio_get_value(pdata->vreg_gpio) ? "High" : "Low");
#endif
	gpio_export(pdata->vreg_gpio, false);
	gpio_direction_output(pdata->vreg_gpio, BCMBT_VREG_OFF);

	/* JIRA case --> HW4334-336*/
	gpio_set_value(pdata->vreg_gpio, BCMBT_VREG_ON);
	msleep(REG_ON_SLEEP);
	gpio_set_value(pdata->vreg_gpio, BCMBT_VREG_OFF);

	if (BCMBT_UNUSED_GPIO != pdata->n_reset_gpio) {
		gpio_request(pdata->n_reset_gpio, "rfkill_reset_gpio");
		gpio_direction_output(pdata->n_reset_gpio, BCMBT_N_RESET_ON);
		pr_err("bcmblt_probe: n_reset: %s\n",
		       gpio_get_value(pdata->
				      n_reset_gpio) ? "High [chip out of reset]"
		       : "Low [put into reset]");
	}
	if (BCMBT_UNUSED_GPIO != pdata->aux0_gpio) {	/* CLK32 */
		gpio_request(pdata->aux0_gpio, "rfkill_aux0_gpio");
		gpio_direction_output(pdata->aux0_gpio, BCMBT_AUX0_OFF);
		pr_err("bcmbt_probe:  aux0: %s\n",
		       gpio_get_value(pdata->aux0_gpio) ? "High" : "Low");
	}

	if (BCMBT_UNUSED_GPIO != pdata->aux1_gpio) {	/* UARTB_SEL */
		gpio_request(pdata->aux1_gpio, "rfkill_aux1_gpio");
		gpio_direction_output(pdata->aux1_gpio, BCMBT_AUX1_OFF);
		pr_err("bcmbt_probe:  aux1: %s\n",
		       gpio_get_value(pdata->aux1_gpio) ? "High" : "Low");
	}

	pdata->rfkill =
	    rfkill_alloc("bcmbt", &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			 &bcmbt_rfkill_ops, pdata);

	if (unlikely(!pdata->rfkill))
		return -ENOMEM;

	/* Keep BT Blocked by default as per above init */
	rfkill_init_sw_state(pdata->rfkill, true);

	rc = rfkill_register(pdata->rfkill);

	if (unlikely(rc))
		rfkill_destroy(pdata->rfkill);

	return 0;
}
开发者ID:faizauthar12,项目名称:Hyper_kernel,代码行数:58,代码来源:bcmbt_rfkill.c


示例8: bcm4335_bluetooth_probe

static int bcm4335_bluetooth_probe(struct platform_device *pdev)
{
	int rc = 0;

    #ifdef BT_UART_CFG
    int pin = 0;
    #endif

#if defined(CONFIG_BCM4335) || defined(CONFIG_BCM4335_MODULE)
	bt_is_running = 0;
#endif
    /* temporailiy set HOST_WAKE OUT direction until FPGA work finishs */
	/* if setting HOST_WAKE to NO PULL, BT would not be turned on. */
	/* By guideline of BRCM, it is needed to determine pull status */
	#ifndef BT_LPM_ENABLE
	gpio_tlmm_config(GPIO_CFG(get_gpio_hwrev(GPIO_BT_HOST_WAKE), 0, GPIO_CFG_OUTPUT,
		GPIO_CFG_PULL_UP, GPIO_CFG_8MA), GPIO_CFG_ENABLE);
	gpio_set_value(get_gpio_hwrev(GPIO_BT_HOST_WAKE), 1);
	#endif

    #ifdef BT_UART_CFG
    for (pin = 0; pin < ARRAY_SIZE(bt_uart_off_table); pin++) {
        rc = gpio_tlmm_config(bt_uart_off_table[pin], GPIO_CFG_ENABLE);
        if (rc < 0)
            pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
                    __func__, bt_uart_off_table[pin], rc);
    }
    #endif

	bt_rfkill = rfkill_alloc("bcm4335 Bluetooth", &pdev->dev,
				RFKILL_TYPE_BLUETOOTH, &bcm4335_bt_rfkill_ops,
				NULL);

	if (unlikely(!bt_rfkill)) {
		pr_err("[BT] bt_rfkill alloc failed.\n");
		gpio_free(ice_gpiox_get(FPGA_GPIO_BT_EN));
		return -ENOMEM;
	}


	rfkill_init_sw_state(bt_rfkill, 0);

	rc = rfkill_register(bt_rfkill);

	if (unlikely(rc)) {
		pr_err("[BT] bt_rfkill register failed.\n");
		rfkill_destroy(bt_rfkill);
		gpio_free(ice_gpiox_get(FPGA_GPIO_BT_EN));
		return rc;
	}


	rfkill_set_sw_state(bt_rfkill, true);

	return rc;
}
开发者ID:Hybridmax,项目名称:I9505_Hybridmax-Stock_Kernel,代码行数:56,代码来源:board-bluetooth-bcm4335.c


示例9: ste_rfkill_probe

static int ste_rfkill_probe(struct platform_device *pdev)
{
	struct ste_rfkill_data *rfkill;
	struct rfkill *rfkdev;
	int ret = 0;

	dev_dbg(&pdev->dev, "%s\n", __func__);

	rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL);
	if (!rfkill) {
		dev_err(&pdev->dev,
			"%s: no memory to alloc driver data\n", __func__);
		ret = -ENOMEM;
		goto error0;
	}

	platform_set_drvdata(pdev, rfkill);

	/* WWAN rfkill device registration */
	rfkill->rfkdev = rfkill_alloc(pdev->name,
					&pdev->dev,
					RFKILL_TYPE_WWAN,
					&ste_rfkill_ops,
					pdev);
	rfkdev = rfkill->rfkdev;
	if (!rfkdev) {
		dev_err(&pdev->dev,
			"%s: Error allocating modem rfkdev\n", __func__);
		ret = -ENOMEM;
		goto error1;
	}

	/* S/W blocked by default, persistent */
	rfkill_init_sw_state(rfkdev, 1);
	ret = rfkill_register(rfkdev);
	if (ret) {
		dev_err(&pdev->dev,
			"%s: Error registering modem rfkdev: %d\n",
			__func__, ret);
		ret = -EINVAL;
		goto error2;
	}

	/* hardware unblocked */
	if (rfkill->rfkdev)
		rfkill_set_hw_state(rfkdev, 0);

	return 0;

error2:
	rfkill_destroy(rfkdev);
error1:
	kfree(rfkill);
error0:
	return ret;
}
开发者ID:robacklin,项目名称:omap-android,代码行数:56,代码来源:ste-rfkill.c


示例10: gta02_bt_probe

static int __init gta02_bt_probe(struct platform_device *pdev)
{
	struct rfkill *rfkill;
	struct regulator *regulator;
	struct gta02_pm_bt_data *bt_data;
	int ret;

	dev_info(&pdev->dev, DRVMSG ": starting\n");

	bt_data = kzalloc(sizeof(*bt_data), GFP_KERNEL);
	dev_set_drvdata(&pdev->dev, bt_data);

	regulator = regulator_get(&pdev->dev, "BT_3V2");
	if (IS_ERR(regulator))
		return -ENODEV;

	bt_data->regulator = regulator;

	/* this tests the true physical state of the regulator... */
	if (regulator_is_enabled(regulator)) {
		/*
		 * but these only operate on the logical state of the
		 * regulator... so we need to logicaly "adopt" it on
		 * to turn it off
		 */
		regulator_enable(regulator);
		regulator_disable(regulator);
	}

	/* we pull reset to low to make sure that the chip doesn't
	 * drain power through the reset line */
	s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 0);

	rfkill = rfkill_alloc(pdev->name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
                            &gta02_bt_rfkill_ops, &pdev->dev);

	if (!rfkill) {
		dev_err(&pdev->dev, "Failed to allocate rfkill\n");
		return -ENOMEM;
	}

    rfkill_init_sw_state(rfkill, 0);

	ret = rfkill_register(rfkill);
	if (ret) {
		rfkill_destroy(rfkill);
		dev_err(&pdev->dev, "Failed to register rfkill\n");
		return ret;
	}

	bt_data->rfkill = rfkill;

	return sysfs_create_group(&pdev->dev.kobj, &gta02_bt_attr_group);
}
开发者ID:gvsurenderreddy,项目名称:openwrt-9,代码行数:54,代码来源:gta02-pm-bt.c


示例11: jupiter_rfkill_probe

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");
#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;

	s3c_gpio_cfgpin(GPIO_BT_HOST_WAKE, S3C_GPIO_SFN(GPIO_BT_HOST_WAKE_AF));
	s3c_gpio_setpull(S5PV210_GPH2(5), S3C_GPIO_PULL_DOWN);
	set_irq_type(IRQ_EINT(21), IRQ_TYPE_EDGE_BOTH);

	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");

//	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;
}
开发者ID:Smackbox,项目名称:linux-2.6-sgt,代码行数:48,代码来源:p1-rfkill_kor.c


示例12: jupiter_rfkill_probe

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");
#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;
	
	// p9p9 2010.11.12 Merged from Victory [When AP is in sleep, AP is not waken up by BT_HOST_WAKE]
	set_irq_type(irq, IRQ_TYPE_EDGE_BOTH ); //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 ret=%d %d<-->%d\n", ret, IRQ_EINT(4), IRQ_EINT4);

//	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;
}
开发者ID:DRockstar,项目名称:R910_Kernel,代码行数:46,代码来源:aries-rfkill.c


示例13: rfkill_alloc

static struct rfkill *oaktrail_rfkill_new(char *name, enum rfkill_type type,
					  unsigned long mask)
{
	struct rfkill *rfkill_dev;
	u8 value;
	int err;

	rfkill_dev = rfkill_alloc(name, &oaktrail_device->dev, type,
				  &oaktrail_rfkill_ops, (void *)mask);
	if (!rfkill_dev)
		return ERR_PTR(-ENOMEM);

	ec_read(OT_EC_DEVICE_STATE_ADDRESS, &value);
	rfkill_init_sw_state(rfkill_dev, (value & mask) != 1);

	err = rfkill_register(rfkill_dev);
	if (err) {
		rfkill_destroy(rfkill_dev);
		return ERR_PTR(err);
	}

	return rfkill_dev;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:23,代码来源:intel_oaktrail.c


示例14: kzalloc

static struct rfkill *sd8x_rfkill_register(struct device *parent,
					   enum rfkill_type type, char *name,
					   struct sd8x_rfkill_platform_data
					   *pdata)
{
	int err;
	struct rfkill *dev = NULL;
	struct rfkill_ops *ops = NULL;

	ops = kzalloc(sizeof(struct rfkill_ops), GFP_KERNEL);
	if (!ops)
		goto err_out;
	ops->set_block = sd8x_set_block;

	local_sd8x_data->type = type;
	local_sd8x_data->blocked = true;
	local_sd8x_data->pdata = pdata;

	dev = rfkill_alloc(name, parent, type, ops, local_sd8x_data);
	if (!dev)
		goto err_out;

	/* init device software states, and block it by default */
	rfkill_init_sw_state(dev, true);

	err = rfkill_register(dev);
	if (err)
		goto err_out;

	return dev;

err_out:
	kfree(ops);
	if (dev)
		rfkill_destroy(dev);
	return 0;
}
开发者ID:AlexGreg,项目名称:android_kernel_samsung_lt02,代码行数:37,代码来源:sd8x_rfkill.c


示例15: wimax_rfkill_add

/*
 * Register a new WiMAX device's RF Kill support
 *
 * WARNING: wimax_dev->mutex must be unlocked
 */
int wimax_rfkill_add(struct wimax_dev *wimax_dev)
{
	int result;
	struct rfkill *rfkill;
	struct device *dev = wimax_dev_to_dev(wimax_dev);

	d_fnstart(3, dev, "(wimax_dev %p)\n", wimax_dev);
	/* Initialize RF Kill */
	result = -ENOMEM;
	rfkill = rfkill_alloc(wimax_dev->name, dev, RFKILL_TYPE_WIMAX,
			      &wimax_rfkill_ops, wimax_dev);
	if (rfkill == NULL)
		goto error_rfkill_allocate;

	d_printf(1, dev, "rfkill %p\n", rfkill);

	wimax_dev->rfkill = rfkill;

	rfkill_init_sw_state(rfkill, 1);
	result = rfkill_register(wimax_dev->rfkill);
	if (result < 0)
		goto error_rfkill_register;

	/* If there is no SW toggle op, SW RFKill is always on */
	if (wimax_dev->op_rfkill_sw_toggle == NULL)
		wimax_dev->rf_sw = WIMAX_RF_ON;

	d_fnend(3, dev, "(wimax_dev %p) = 0\n", wimax_dev);
	return 0;

error_rfkill_register:
	rfkill_destroy(wimax_dev->rfkill);
error_rfkill_allocate:
	d_fnend(3, dev, "(wimax_dev %p) = %d\n", wimax_dev, result);
	return result;
}
开发者ID:7799,项目名称:linux,代码行数:41,代码来源:op-rfkill.c


示例16: bt_ctr_probe

static int  bt_ctr_probe(struct platform_device *pdev)
{
	int irq;
	int ret;

	struct bt_gpio_info *bt_info;
	
	/* Initialize wake locks */
	wake_lock_init(&rfkill_wake_lock, WAKE_LOCK_SUSPEND, "bt_host_wake");

	/* request gpio */
	ret = gpio_request(BT_POWER, "GPB");
	if (ret < 0) {
		pr_err("[BT] Failed to request BT_POWER!\n");
		goto err_req_bt_power;
	}

	ret = gpio_request(BT_RESET, "GPB");
	if (ret < 0) {
		pr_err("[BT] Failed to request BT_RESET!\n");
		goto err_req_bt_reset;
	}

	/* BT Host Wake IRQ */
	irq = gpio_to_irq(BT_HOST_WAKE);
	
	ret = request_irq(irq, bt_host_wake_irq_handler,
			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
			"bt_host_wake_irq_handler", NULL);

	if (ret < 0) {
		pr_err("[BT] Request_irq failed\n");
		goto err_req_irq;
	}

	disable_irq(irq);

	/* init rfkill */
	bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			&bt_rfkill_ops, NULL);

	if (!bt_rfk) {
		pr_err("[BT] bt_rfk : rfkill_alloc is failed\n");
		ret = -ENOMEM;
		goto err_alloc;
	}

	rfkill_init_sw_state(bt_rfk, 0);	

	ret = rfkill_register(bt_rfk);
	if (ret) {
		pr_debug("********ERROR IN REGISTERING THE RFKILL********\n");
		goto err_register;
	}

	rfkill_set_sw_state(bt_rfk, 1);
	
	/* init low power state*/
	ret = bt_lpm_init();
	if (ret < 0) {
		pr_debug("[BT]  set low power failed\n");
		goto err_register;
	}

	/* create sysfs attributes */
	bt_info = kzalloc(sizeof(struct bt_gpio_info), GFP_KERNEL);
	if(!bt_info) {
		pr_debug("[BT]  sysfs_create_group failed\n");
		goto err_register;
	}

	bt_info->bt_test_mode =0;     //bt   in normal mode
	bt_info->bt_enable = 0;
	bt_info->bt_wake = 0;
	mutex_init(&bt_info->bt_lock);	
	
	bt_info->dev = &pdev->dev;
	platform_set_drvdata(pdev, bt_info);

	ret = sysfs_create_group(&pdev->dev.kobj, &bcm_attribute_group);
	if (ret < 0) {
		pr_debug("[BT]  sysfs_create_group failed\n");
		goto err_register;
	}

	device_init_wakeup(&pdev->dev, 1);

	/* set init power state*/
	bt_set_power(NULL, RFKILL_USER_STATE_SOFT_BLOCKED);

	return ret;

 err_register:
	rfkill_destroy(bt_rfk);

 err_alloc:
	free_irq(irq, NULL);

 err_req_irq:
	gpio_free(BT_RESET);
//.........这里部分代码省略.........
开发者ID:DijonLin,项目名称:meizu-m9-kernel,代码行数:101,代码来源:m9w-rfkill.c


示例17: bcm43xx_bluetooth_probe

static int bcm43xx_bluetooth_probe(struct platform_device *pdev)
{
	bool default_state = true;	/* off */
	int ret = 0;

	int_handler_enabled = false;

#ifdef CONFIG_ACPI
	if (ACPI_HANDLE(&pdev->dev)) {
		/*
		 * acpi specific probe
		 */
		pr_debug("%s for ACPI device %s\n", __func__,
							dev_name(&pdev->dev));
		if (bcm_bt_lpm_acpi_probe(pdev) < 0)
			ret = -EINVAL;
	} else
		ret = -ENODEV;
#else
	ret = bcm43xx_bluetooth_pdata_probe(pdev);
#endif

	if (ret < 0) {
		pr_err("%s: Cannot register platform data\n", __func__);
		goto err_data_probe;
	}

	ret = gpio_request(bt_lpm.gpio_enable_bt, pdev->name);
	if (ret < 0) {
		pr_err("%s: Unable to request gpio %d\n", __func__,
							bt_lpm.gpio_enable_bt);
		goto err_gpio_enable_req;
	}

	ret = gpio_direction_output(bt_lpm.gpio_enable_bt, 0);
	if (ret < 0) {
		pr_err("%s: Unable to set int direction for gpio %d\n",
					__func__, bt_lpm.gpio_enable_bt);
		goto err_gpio_enable_dir;
	}

#ifdef LPM_ON
	ret = gpio_request(bt_lpm.gpio_host_wake, pdev->name);
	if (ret < 0) {
		pr_err("%s: Unable to request gpio %d\n",
					__func__, bt_lpm.gpio_host_wake);
		goto err_gpio_host_wake_req;
	}

	ret = gpio_direction_input(bt_lpm.gpio_host_wake);
	if (ret < 0) {
		pr_err("%s: Unable to set direction for gpio %d\n", __func__,
							bt_lpm.gpio_host_wake);
		goto err_gpio_host_wake_dir;
	}

	ret = gpio_request(bt_lpm.gpio_wake, pdev->name);
	if (ret < 0) {
		pr_err("%s: Unable to request gpio %d\n", __func__,
							bt_lpm.gpio_wake);
		goto err_gpio_wake_req;
	}

	ret =  gpio_direction_output(bt_lpm.gpio_wake, 0);
	if (ret < 0) {
		pr_err("%s: Unable to set direction for gpio %d\n", __func__,
							bt_lpm.gpio_wake);
		goto err_gpio_wake_dir;
	}

	pr_debug("%s: gpio_enable=%d, gpio_wake=%d, gpio_host_wake=%d\n",
							__func__,
							bt_lpm.gpio_enable_bt,
							bt_lpm.gpio_wake,
							bt_lpm.gpio_host_wake);
#endif

	bt_rfkill = rfkill_alloc("bcm43xx Bluetooth", &pdev->dev,
				RFKILL_TYPE_BLUETOOTH, &bcm43xx_bt_rfkill_ops,
				NULL);
	if (unlikely(!bt_rfkill)) {
		ret = -ENOMEM;
		goto err_rfkill_alloc;
	}

	bcm43xx_bt_rfkill_set_power(NULL, default_state);
	rfkill_init_sw_state(bt_rfkill, default_state);

	ret = rfkill_register(bt_rfkill);
	if (unlikely(ret))
		goto err_rfkill_register;

#ifdef LPM_ON
	ret = bcm_bt_lpm_init(pdev);
	if (ret)
		goto err_lpm_init;
#endif

	return ret;

//.........这里部分代码省略.........
开发者ID:AirShark,项目名称:android_kernel_lenovo_redhookbay,代码行数:101,代码来源:bcm_bt_lpm.c


示例18: smba_gsm_probe

static int __init smba_gsm_probe(struct platform_device *pdev)
{
	struct rfkill *rfkill;
	struct regulator *regulator[2];
	struct smba_pm_gsm_data *gsm_data;
	int ret;

	gsm_data = kzalloc(sizeof(*gsm_data), GFP_KERNEL);
	if (!gsm_data) {
		dev_err(&pdev->dev, "no memory for context\n");
		return -ENOMEM;
	}
	dev_set_drvdata(&pdev->dev, gsm_data);

	regulator[0] = regulator_get(&pdev->dev, "avdd_usb_pll");
	if (IS_ERR(regulator[0])) {
		dev_err(&pdev->dev, "unable to get regulator for usb pll\n");
		kfree(gsm_data);
		dev_set_drvdata(&pdev->dev, NULL);
		return -ENODEV;
	}
	gsm_data->regulator[0] = regulator[0];

	regulator[1] = regulator_get(&pdev->dev, "avdd_usb");
	if (IS_ERR(regulator[1])) {
		dev_err(&pdev->dev, "unable to get regulator for usb\n");
		regulator_put(regulator[0]);
		gsm_data->regulator[0] = NULL;
		kfree(gsm_data);
		dev_set_drvdata(&pdev->dev, NULL);
		return -ENODEV;
	}
	gsm_data->regulator[1] = regulator[1];
	
	/* Init control pins */
	gpio_request(SMBA9701_3G_DISABLE, "gsm_disable");
	gpio_direction_output(SMBA9701_3G_DISABLE, 1);
//	smba_3g_gps_init();

	/* register rfkill interface */
	rfkill = rfkill_alloc(pdev->name, &pdev->dev, RFKILL_TYPE_WWAN,
                            &smba_gsm_rfkill_ops, &pdev->dev);

	if (!rfkill) {
		dev_err(&pdev->dev, "Failed to allocate rfkill\n");
		regulator_put(regulator[1]);
		gsm_data->regulator[1] = NULL;
		regulator_put(regulator[0]);
		gsm_data->regulator[0] = NULL;
		kfree(gsm_data);
		dev_set_drvdata(&pdev->dev, NULL);
		return -ENOMEM;
	}
	gsm_data->rfkill = rfkill;

	/* Disable bluetooth */
    rfkill_init_sw_state(rfkill, 0);

	ret = rfkill_register(rfkill);
	if (ret) {
		rfkill_destroy(rfkill);
		dev_err(&pdev->dev, "Failed to register rfkill\n");
		return ret;
	}

	dev_info(&pdev->dev, "GSM/UMTS RFKill driver loaded\n");
	
	return sysfs_create_group(&pdev->dev.kobj, &smba_gsm_attr_group);
}
开发者ID:TeamDRH,项目名称:android-tegra-nv-2.6.39-rel-14r7,代码行数:69,代码来源:board-smba9701-pm-gsm.c


示例19: aries_rfkill_probe

static int __init aries_rfkill_probe(struct platform_device *pdev)
{

	int irq,ret;

	/* Initialize wake locks */
	wake_lock_init(&rfkill_wake_lock, WAKE_LOCK_SUSPEND, "bt_host_wake");

	ret = gpio_request(GPIO_WLAN_BT_EN, "GPB");
	if (ret < 0) {
		pr_err("[BT] Failed to request GPIO_WLAN_BT_EN!\n");
		goto err_req_gpio_wlan_bt_en;
	}

	ret = gpio_request(GPIO_BT_nRST, "GPB");
	if (ret < 0) {
		pr_err("[BT] Failed to request GPIO_BT_nRST!\n");
		goto err_req_gpio_bt_nrst;
	}
	//BT Host Wake IRQ
	irq = IRQ_BT_HOST_WAKE;

	ret = request_irq(irq, bt_host_wake_irq_handler,
			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
			"bt_host_wake_irq_handler", NULL);

	if (ret < 0) {
		pr_err("[BT] Request_irq failed\n");
		goto err_req_irq;
	}

	disable_irq(irq);

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

	if (!bt_rfk) {
		pr_err("[BT] bt_rfk : rfkill_alloc is failed\n");
		ret = -ENOMEM;
		goto err_alloc;
	}

	rfkill_init_sw_state(bt_rfk, 0);

	pr_debug("[BT] rfkill_register(bt_rfk)\n");

	ret = rfkill_register(bt_rfk);
	if (ret) {
		pr_debug("********ERROR IN REGISTERING THE RFKILL********\n");
		goto err_register;
	}

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

#ifdef BT_SLEEP_ENABLER
	wake_lock_init(&bt_wake_lock, WAKE_LOCK_SUSPEND, "bt_wake");

	ret = gpio_request(GPIO_BT_WAKE, "gpio_bt_wake");
	if (ret < 0) {
		pr_err("[BT] Failed to request GPIO_BT_WAKE\n");
		goto err_req_gpio_bt_wake;
	}

	gpio_direction_output(GPIO_BT_WAKE, GPIO_LEVEL_LOW);

	bt_sleep_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			&btsleep_rfkill_ops, NULL);

	if (!bt_sleep_rfk) {
		pr_err("[BT] bt_sleep_rfk : rfkill_alloc is failed\n");
		ret = -ENOMEM;
		goto err_sleep_alloc;
	}

	rfkill_set_sw_state(bt_sleep_rfk, 1);

	pr_debug("[BT] rfkill_register(bt_sleep_rfk)\n");

	ret = rfkill_register(bt_sleep_rfk);
	if (ret) {
		pr_err("********ERROR IN REGISTERING THE bt_sleep_rfk********\n");
		goto err_sleep_register;
	}
#endif

#ifdef USE_LOCK_DVFS
	bt_lock_dvfs_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			&bt_lock_dvfs_rfkill_ops, NULL);

	if (!bt_lock_dvfs_rfk) {
		pr_err("[BT] bt_lock_dvfs_rfk : rfkill_alloc is failed\n");
		ret = -ENOMEM;
		goto err_dvfs_lock_alloc;
	}

	pr_debug("[BT] rfkill_register(bt_lock_dvfs_rfk)\n");

	ret = rfkill_register(bt_lock_dvfs_rfk);
	if (ret) {
//.........这里部分代码省略.........
开发者ID:Jocala,项目名称:jocalaROM,代码行数:101,代码来源:aries-rfkill.c


示例20: bt_probe

static int __devinit bt_probe(struct platform_device *pdev)
{
	int ret = 0;
	struct bt_rfkill_info *bt_info;
	struct mx_rfkill_pd *pdata = pdev->dev.platform_data;

	if (pdata == NULL) {
		dev_err(&pdev->dev,"Failed to get platform data\n");
		return -ENOENT;
	}
	bt_info = kzalloc(sizeof(struct bt_rfkill_info), GFP_KERNEL);
	if(!bt_info) {
		ret = -ENOMEM;
		pr_debug("[BT]  sysfs_create_group failed\n");
		goto err_req_bt_mem;
	}

	bt_info->name = pdata->name;
	bt_info->gpio_bt_power = pdata->bt_power;
	bt_info->gpio_bt_reset = pdata->bt_reset;
	bt_info->gpio_bt_wake = pdata->bt_wake;
	bt_info->gpio_bt_host_wake = pdata->bt_host_wake;
	bt_info->gpio_wifi_power = pdata->wifi_power;
	bt_info->gpio_wifi_reset = pdata->wifi_reset;
	bt_info->dev = &pdev->dev;
	
	/* Initialize wake locks */
	wake_lock_init(&bt_info->rfk_lock, WAKE_LOCK_SUSPEND, "bt_host_wake");

	/* BT Host Wake IRQ */
	bt_info->wake_irq = gpio_to_irq(bt_info->gpio_bt_host_wake);
	ret = request_threaded_irq(bt_info->wake_irq, NULL, bt_host_wake_irq_handler,
			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
			"bt_host_wake_irq_handler", bt_info);

	if (ret < 0) {
		pr_err("[BT] Request_irq failed\n");
		goto err_req_irq;
	}

	disable_irq(bt_info->wake_irq);

	/* init rfkill */
	bt_info->bt_rfk = rfkill_alloc(bt_info->name, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			&bt_rfkill_ops, bt_info);

	if (!bt_info->bt_rfk) {
		pr_err("[BT] bt_rfk : rfkill_alloc is failed\n");
		ret = -ENOMEM;
		goto err_rfkill_alloc;
	}

	rfkill_init_sw_state(bt_info->bt_rfk, 0);	

	ret = rfkill_register(bt_info->bt_rfk);
	if (ret) {
		pr_debug("********ERROR IN REGISTERING THE RFKILL********\n");
		goto err_register;
	}

	rfkill_set_sw_state(bt_info->bt_rfk, 1);
	
	/* init low power state*/
	ret = bt_lpm_init(bt_info);
	if (ret < 0) {
		pr_debug("[BT]  set low power failed\n");
		goto err_register;
	}

	bt_info->bt_test_mode =0;     //bt   in normal mode
	bt_info->bt_enable = 0;
	bt_info->bt_wake = 0;
	mutex_init(&bt_info->bt_lock);

	/* create sysfs attributes */
	ret = sysfs_create_group(&pdev->dev.kobj, &bcm_attribute_group);
	if (ret < 0) {
		pr_debug("[BT]  sysfs_create_group failed\n");
		goto err_register;
	}

	device_init_wakeup(&pdev->dev, 1);

	/* set init power state*/
	bt_set_power(bt_info, RFKILL_USER_STATE_SOFT_BLOCKED);

	platform_set_drvdata(pdev, bt_info);
	g_bt_info = bt_info;

	pr_info("[BT] driver loaded!\n");
	return ret;

err_register:
	rfkill_destroy(bt_info->bt_rfk);

err_rfkill_alloc:
	free_irq(bt_info->wake_irq, NULL);

err_req_irq:
	wake_lock_destroy(&bt_info->rfk_lock);
//.........这里部分代码省略.........
开发者ID:Abioy,项目名称:meizu-mx-kernel,代码行数:101,代码来源:mx-rfkill.c



注:本文中的rfkill_init_sw_state函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rfkill_register函数代码示例发布时间:2022-05-30
下一篇:
C++ rfind函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap