本文整理汇总了C++中rfkill_init_sw_state函数的典型用法代码示例。如果您正苦于以下问题:C++ rfkill_init_sw_state函数的具体用法?C++ rfkill_init_sw_state怎么用?C++ rfkill_init_sw_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rfkill_init_sw_state函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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,
>a02_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, >a02_bt_attr_group);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}