static int rfkill_init(struct platform_device *sdev) { /* add rfkill */ int retval; /* keep the hardware wireless state */ get_wireless_state_ec_standard(); rfk_bluetooth = rfkill_alloc("msi-bluetooth", &sdev->dev, RFKILL_TYPE_BLUETOOTH, &rfkill_bluetooth_ops, NULL); if (!rfk_bluetooth) { retval = -ENOMEM; goto err_bluetooth; } retval = rfkill_register(rfk_bluetooth); if (retval) goto err_bluetooth; rfk_wlan = rfkill_alloc("msi-wlan", &sdev->dev, RFKILL_TYPE_WLAN, &rfkill_wlan_ops, NULL); if (!rfk_wlan) { retval = -ENOMEM; goto err_wlan; } retval = rfkill_register(rfk_wlan); if (retval) goto err_wlan; if (threeg_exists) { rfk_threeg = rfkill_alloc("msi-threeg", &sdev->dev, RFKILL_TYPE_WWAN, &rfkill_threeg_ops, NULL); if (!rfk_threeg) { retval = -ENOMEM; goto err_threeg; } retval = rfkill_register(rfk_threeg); if (retval) goto err_threeg; } /* schedule to run rfkill state initial */ schedule_delayed_work(&msi_rfkill_init, round_jiffies_relative(1 * HZ)); return 0; err_threeg: rfkill_destroy(rfk_threeg); if (rfk_wlan) rfkill_unregister(rfk_wlan); err_wlan: rfkill_destroy(rfk_wlan); if (rfk_bluetooth) rfkill_unregister(rfk_bluetooth); err_bluetooth: rfkill_destroy(rfk_bluetooth); return retval; }
static int rfkill_init(struct platform_device *sdev) { /* add rfkill */ int retval; rfk_bluetooth = rfkill_alloc("msi-bluetooth", &sdev->dev, RFKILL_TYPE_BLUETOOTH, &rfkill_bluetooth_ops, NULL); if (!rfk_bluetooth) { retval = -ENOMEM; goto err_bluetooth; } retval = rfkill_register(rfk_bluetooth); if (retval) goto err_bluetooth; rfk_wlan = rfkill_alloc("msi-wlan", &sdev->dev, RFKILL_TYPE_WLAN, &rfkill_wlan_ops, NULL); if (!rfk_wlan) { retval = -ENOMEM; goto err_wlan; } retval = rfkill_register(rfk_wlan); if (retval) goto err_wlan; if (threeg_exists) { rfk_threeg = rfkill_alloc("msi-threeg", &sdev->dev, RFKILL_TYPE_WWAN, &rfkill_threeg_ops, NULL); if (!rfk_threeg) { retval = -ENOMEM; goto err_threeg; } retval = rfkill_register(rfk_threeg); if (retval) goto err_threeg; } return 0; err_threeg: rfkill_destroy(rfk_threeg); if (rfk_wlan) rfkill_unregister(rfk_wlan); err_wlan: rfkill_destroy(rfk_wlan); if (rfk_bluetooth) rfkill_unregister(rfk_bluetooth); err_bluetooth: rfkill_destroy(rfk_bluetooth); return retval; }
static int __init spica_btsleep_probe(struct platform_device *pdev) { int rc = 0; //bt_sleep = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH); bt_sleep = rfkill_alloc(pdev->name,&pdev->dev,RFKILL_TYPE_BLUETOOTH,NULL,NULL); if (!bt_sleep) return -ENOMEM; bt_sleep->name = bt_name; bt_sleep->state = RFKILL_STATE_UNBLOCKED; //Xmister /* userspace cannot take exclusive control */ //bt_sleep->user_claim_unsupported = 1; //bt_sleep->user_claim = 0; bt_sleep->data = NULL; // user data //bt_sleep->toggle_radio = bluetooth_set_sleep; rc = rfkill_register(bt_sleep); if (rc) //Xmister //rfkill_free(bt_sleep); rfkill_destroy(bt_sleep); printk(KERN_DEBUG "[BT] rfkill_force_state(bt_sleep, RFKILL_STATE_UNBLOCKED) \n"); //Xmister //rfkill_force_state(bt_sleep, RFKILL_STATE_UNBLOCKED); rfkill_set_hw_state(bt_sleep, RFKILL_STATE_UNBLOCKED); bluetooth_set_sleep(NULL, RFKILL_STATE_UNBLOCKED); return rc; }
static int amilo_rfkill_probe(struct platform_device *device) { int rc; const struct dmi_system_id *system_id = dmi_first_match(amilo_rfkill_id_table); if (!system_id) return -ENXIO; amilo_rfkill_dev = rfkill_alloc(KBUILD_MODNAME, &device->dev, RFKILL_TYPE_WLAN, system_id->driver_data, NULL); if (!amilo_rfkill_dev) return -ENOMEM; rc = rfkill_register(amilo_rfkill_dev); if (rc) goto fail; return 0; fail: rfkill_destroy(amilo_rfkill_dev); return rc; }
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; }
static int loox550_rfk_probe(struct platform_device *dev) { int rc; rc = request_gpios_bt(); if (rc) goto err_gpios; bt_rfk = rfkill_alloc("loox550-bt", &dev->dev, RFKILL_TYPE_BLUETOOTH, &loox550_bt_rfkill_ops, NULL); if (!bt_rfk) goto err_rfkill; rfkill_set_led_trigger_name(bt_rfk, "loox550-bt"); rc = rfkill_register(bt_rfk); if (rc) goto err_rfkill; platform_set_drvdata(dev, NULL); return 0; err_rfkill: rfkill_destroy(bt_rfk); err_gpios: free_gpios(); return rc; }
void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) { if (test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state)) return; if (rt2x00rfkill_allocate(rt2x00dev)) { ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n"); return; } if (rfkill_register(rt2x00dev->rfkill)) { ERROR(rt2x00dev, "Failed to register rfkill handler.\n"); rt2x00rfkill_free(rt2x00dev); return; } __set_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state); /* * Force initial poll which will detect the initial device state, * and correctly sends the signal to the rfkill layer about this * state. */ rt2x00rfkill_poll(&rt2x00dev->rfkill_work.work); }
static int legend_rfkill_probe(struct platform_device *pdev) { int rc = 0; enum rfkill_state default_state = RFKILL_STATE_SOFT_BLOCKED; /* off */ /* force BT on and off to do GPIO setting when initiate */ bluetooth_set_power(NULL, RFKILL_STATE_UNBLOCKED); legend_config_bt_init(); /* bt gpio initial config */ rfkill_set_default(RFKILL_TYPE_BLUETOOTH, default_state); bluetooth_set_power(NULL, default_state); bt_rfk = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH); if (!bt_rfk) return -ENOMEM; bt_rfk->name = bt_name; bt_rfk->state = default_state; /* 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; }
static int rfkill_gpio_probe(struct platform_device *pdev) { struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; struct rfkill_gpio_data *rfkill; struct gpio_desc *gpio; int ret; rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); if (!rfkill) return -ENOMEM; if (ACPI_HANDLE(&pdev->dev)) { ret = rfkill_gpio_acpi_probe(&pdev->dev, rfkill); if (ret) return ret; } else if (pdata) { rfkill->name = pdata->name; rfkill->type = pdata->type; } else { return -ENODEV; } rfkill->clk = devm_clk_get(&pdev->dev, NULL); gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); rfkill->reset_gpio = gpio; gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); rfkill->shutdown_gpio = gpio; /* Make sure at-least one of the GPIO is defined and that * a name is specified for this instance */ if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) { dev_err(&pdev->dev, "invalid platform data\n"); return -EINVAL; } rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev, rfkill->type, &rfkill_gpio_ops, rfkill); if (!rfkill->rfkill_dev) return -ENOMEM; ret = rfkill_register(rfkill->rfkill_dev); if (ret < 0) return ret; platform_set_drvdata(pdev, rfkill); dev_info(&pdev->dev, "%s device registered.\n", rfkill->name); return 0; }
static int emev_rfkill_probe(struct platform_device *pdev) { debug_print("Rfkill bt probe\n"); int rc = 0; struct emev_rfkill_platform_data *pdata = pdev->dev.platform_data; bcm2048_hw_init(); pdata->rfkill = rfkill_alloc("emev_bt", &pdev->dev, RFKILL_TYPE_BLUETOOTH, &emev_bt_rfkill_ops, NULL); if (unlikely(!pdata->rfkill)) { return -ENOMEM; } /* set default status */ rfkill_set_states(pdata->rfkill, true, true); rc = rfkill_register(pdata->rfkill); if (unlikely(rc)) { rfkill_destroy(pdata->rfkill); } return 0; }
static int pico_rfkill_probe(struct platform_device *pdev) { int rc = 0; bool default_state = true; /* off */ /* always turn on clock */ htc_wifi_bt_sleep_clk_ctl(CLK_ON, ID_BT); mdelay(2); bluetooth_set_power(NULL, default_state); bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH, &pico_rfkill_ops, NULL); if (!bt_rfk) { rc = -ENOMEM; goto err_rfkill_alloc; } rfkill_set_states(bt_rfk, default_state, false); /* userspace cannot take exclusive control */ rc = rfkill_register(bt_rfk); if (rc) goto err_rfkill_reg; return 0; err_rfkill_reg: rfkill_destroy(bt_rfk); err_rfkill_alloc: return rc; }
static int bluetooth_power_rfkill_probe(struct platform_device *pdev) { struct rfkill *rfkill; int ret; /* force Bluetooth off during init to allow for user control */ ret = rfkill_set_default(RFKILL_TYPE_BLUETOOTH, RFKILL_STATE_SOFT_BLOCKED); if (ret) { printk(KERN_DEBUG "%s: rfkill set default failed=%d\n", __func__, ret); return ret; } rfkill = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH); if (!rfkill) { dev_err(&pdev->dev, "rfkill allocate failed\n"); return -ENOMEM; } rfkill->name = "bt_power"; rfkill->toggle_radio = bluetooth_toggle_radio; rfkill->data = pdev->dev.platform_data; ret = rfkill_register(rfkill); if (ret) { dev_err(&pdev->dev, "rfkill register failed=%d\n", ret); rfkill_free(rfkill); return ret; } platform_set_drvdata(pdev, rfkill); return 0; }
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; }
static int lensl_radio_new_rfkill(struct lensl_radio *radio, struct rfkill **rfk, bool sw_blocked, bool hw_blocked) { int res; *rfk = rfkill_alloc(radio->rfkname, &lensl_pdev->dev, radio->rfktype, &rfkops, radio); if (!*rfk) { vdbg_printk(LENSL_ERR, "Failed to allocate memory for rfkill class\n"); return -ENOMEM; } rfkill_set_hw_state(*rfk, hw_blocked); rfkill_set_sw_state(*rfk, sw_blocked); res = rfkill_register(*rfk); if (res < 0) { vdbg_printk(LENSL_ERR, "Failed to register %s rfkill switch: %d\n", radio->rfkname, res); rfkill_destroy(*rfk); *rfk = NULL; return res; } return 0; }
/************************************************* 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; }
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; }
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; }
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; }
static int __init smdk6410_btsleep_probe(struct platform_device *pdev) #endif /* #ifdef CONFIG_MACH_JET */ #endif /* #ifdef CONFIG_MACH_SPICA */ #endif /* #ifdef CONFIG_MACH_INSTINCTQ */ { int rc = 0; bt_sleep = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH); if (!bt_sleep) return -ENOMEM; bt_sleep->name = bt_name; bt_sleep->state = RFKILL_STATE_UNBLOCKED; /* userspace cannot take exclusive control */ bt_sleep->user_claim_unsupported = 1; bt_sleep->user_claim = 0; bt_sleep->data = NULL; // user data bt_sleep->toggle_radio = bluetooth_set_sleep; rc = rfkill_register(bt_sleep); if (rc) rfkill_free(bt_sleep); #ifdef CONFIG_MACH_INSTINCTQ printk("[BT] rfkill_force_state(bt_sleep, RFKILL_STATE_UNBLOCKED) \n"); #else printk(KERN_DEBUG "[BT] rfkill_force_state(bt_sleep, RFKILL_STATE_UNBLOCKED) \n"); #endif /* #ifdef CONFIG_MACH_INSTINCTQ */ rfkill_force_state(bt_sleep, RFKILL_STATE_UNBLOCKED); bluetooth_set_sleep(NULL, RFKILL_STATE_UNBLOCKED); return rc; }
static int __init bcm4329_rfkill_probe(struct platform_device *pdev) { int rc = 0; bool default_state = true; DBG("Enter::%s,line=%d\n",__FUNCTION__,__LINE__); /* default to bluetooth off */ bcm4329_set_block(NULL, default_state); /* blocked -> bt off */ bt_rfk = rfkill_alloc(bt_name, NULL, RFKILL_TYPE_BLUETOOTH, &bcm4329_rfk_ops, NULL); if (!bt_rfk) { printk("fail to rfkill_allocate************\n"); return -ENOMEM; } rfkill_set_states(bt_rfk, default_state, false); rc = rfkill_register(bt_rfk); if (rc) rfkill_destroy(bt_rfk); printk("rc=0x%x\n", rc); return rc; }
static int bluetooth_power_rfkill_probe(struct platform_device *pdev) { struct rfkill *rfkill; int ret; BT_DBG(""); 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); 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; }
static int m4_rfkill_probe(struct platform_device *pdev) { int rc = 0; bool default_state = true; bluetooth_set_power(NULL, default_state); bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH, &m4_rfkill_ops, NULL); if (!bt_rfk) { rc = -ENOMEM; goto err_rfkill_alloc; } rfkill_set_states(bt_rfk, default_state, false); rc = rfkill_register(bt_rfk); if (rc) goto err_rfkill_reg; return 0; err_rfkill_reg: rfkill_destroy(bt_rfk); err_rfkill_alloc: return rc; }
static int spade_rfkill_probe(struct platform_device *pdev) { int rc = 0; bool default_state = true; /* off */ spade_config_bt_init(); /* bt gpio initial config */ bluetooth_set_power(NULL, default_state); bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH, &spade_rfkill_ops, NULL); if (!bt_rfk) { rc = -ENOMEM; goto err_rfkill_reset; } rfkill_set_states(bt_rfk, default_state, false); /* userspace cannot take exclusive control */ rc = rfkill_register(bt_rfk); if (rc) goto err_rfkill_reg; return 0; err_rfkill_reg: rfkill_destroy(bt_rfk); err_rfkill_reset: return rc; }
static int mogami_rfkill_probe(struct platform_device *pdev) { int rc = 0; bool default_state = true; /* off */ rc = bluetooth_set_power(pdev->dev.platform_data, default_state); if (rc) goto err_rfkill; bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH, &mogami_rfkill_ops, pdev->dev.platform_data); if (!bt_rfk) { rc = -ENOMEM; goto err_rfkill; } rfkill_set_states(bt_rfk, default_state, false); /* userspace cannot take exclusive control */ rc = rfkill_register(bt_rfk); if (rc) goto err_rfkill_reg; platform_set_drvdata(pdev, bt_rfk); return 0; err_rfkill_reg: rfkill_destroy(bt_rfk); err_rfkill: return rc; }
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; }
static int rbtn_rfkill_init(struct acpi_device *device) { struct rbtn_data *rbtn_data = device->driver_data; int ret; if (rbtn_data->rfkill) return 0; /* * NOTE: rbtn controls all radio devices, not only WLAN * but rfkill interface does not support "ANY" type * so "WLAN" type is used */ rbtn_data->rfkill = rfkill_alloc("dell-rbtn", &device->dev, RFKILL_TYPE_WLAN, &rbtn_ops, device); if (!rbtn_data->rfkill) return -ENOMEM; ret = rfkill_register(rbtn_data->rfkill); if (ret) { rfkill_destroy(rbtn_data->rfkill); rbtn_data->rfkill = NULL; return ret; } return 0; }
static int liberty_rfkill_probe(struct platform_device *pdev) { int rc = 0; enum rfkill_state default_state = RFKILL_STATE_SOFT_BLOCKED; liberty_config_bt_init(); /* bt gpio initial config */ rfkill_set_default(RFKILL_TYPE_BLUETOOTH, default_state); bluetooth_set_power(NULL, default_state); bt_rfk = rfkill_allocate(&pdev->dev, RFKILL_TYPE_BLUETOOTH); if (!bt_rfk) return -ENOMEM; bt_rfk->name = bt_name; bt_rfk->state = default_state; /* userspace cannot take exclusive control */ bt_rfk->user_claim_unsupported = 1; bt_rfk->user_claim = 0; bt_rfk->data = NULL; bt_rfk->toggle_radio = bluetooth_set_power; rc = rfkill_register(bt_rfk); if (rc) goto err_rfkill_reg; return 0; err_rfkill_reg: rfkill_free(bt_rfk); return rc; }
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; }
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; }
static int lgps3_rfkill_probe(struct platform_device *pdev) { int rc = 0; bool default_state = true; /* off */ #if defined(CONFIG_BCM4335BT) //+++BRCM 4335 AXI Patch bcm_btlock_init(); //---BRCM #endif // defined(CONFIG_BCM4335BT) printk(KERN_ERR"lgps3_rfkill_probe\n"); rc = gpio_request(LGPS3_GPIO_BT_RESET_N, "bt_reset"); if (rc) { printk(KERN_ERR "GPIO req error no=%d",rc); gpio_free(LGPS3_GPIO_BT_RESET_N); rc = gpio_request(LGPS3_GPIO_BT_RESET_N, "bt_reset"); if(rc) { printk(KERN_ERR "GPIO req error no=%d",rc); goto err_gpio_reset; } } gpio_direction_output(LGPS3_GPIO_BT_RESET_N, 0); bluetooth_set_power(NULL, default_state); bt_rfk = rfkill_alloc(bt_name, &pdev->dev, RFKILL_TYPE_BLUETOOTH, &lgps3_rfkill_ops, NULL); if (!bt_rfk) { printk(KERN_ERR"rfkill alloc failed.\n"); rc = -ENOMEM; goto err_rfkill_alloc; } rfkill_set_states(bt_rfk, default_state, false); /* userspace cannot take exclusive control */ rc = rfkill_register(bt_rfk); if (rc) goto err_rfkill_reg; return 0; err_rfkill_reg: rfkill_destroy(bt_rfk); err_rfkill_alloc: err_gpio_reset: gpio_free(LGPS3_GPIO_BT_RESET_N); printk(KERN_ERR"lgps3_rfkill_probe error!\n"); return rc; }