Skip to content

Commit 2cbda6f

Browse files
RockShen-ASUSasus-leslieyu
authored andcommitted
rfkill: Do not register rfkill device to control bt power
Blueman will block the rfkill device when disable BT which may lead BT function broken. Do not register rfkill device for RTL8723BS. Change-Id: Ie6492ad8e13ada06c3edafef6a781f15ef6304c5 Signed-off-by: Rock Shen <rock_shen@asus.com>
1 parent 01e4831 commit 2cbda6f

2 files changed

Lines changed: 23 additions & 19 deletions

File tree

net/rfkill/rfkill-bt.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ enum {
6565
struct rfkill_rk_data {
6666
struct rfkill_rk_platform_data *pdata;
6767
struct platform_device *pdev;
68-
struct rfkill *rfkill_dev;
68+
//struct rfkill *rfkill_dev;
6969
struct wake_lock bt_irq_wl;
7070
struct delayed_work bt_sleep_delay_work;
7171
int irq_req;
@@ -256,6 +256,7 @@ void rfkill_rk_sleep_bt(bool sleep)
256256
}
257257
EXPORT_SYMBOL(rfkill_rk_sleep_bt);
258258

259+
/*
259260
static int bt_power_state = 0;
260261
int rfkill_get_bt_power_state(int *power, bool *toggle)
261262
{
@@ -363,6 +364,7 @@ static int rfkill_rk_set_power(void *data, bool blocked)
363364
364365
return 0;
365366
}
367+
*/
366368

367369
static int rfkill_rk_pm_prepare(struct device *dev)
368370
{
@@ -435,9 +437,9 @@ static void rfkill_rk_pm_complete(struct device *dev)
435437
}
436438
}
437439

438-
static const struct rfkill_ops rfkill_rk_ops = {
439-
.set_block = rfkill_rk_set_power,
440-
};
440+
//static const struct rfkill_ops rfkill_rk_ops = {
441+
// .set_block = rfkill_rk_set_power,
442+
//};
441443

442444
#define PROC_DIR "bluetooth/sleep"
443445

@@ -654,16 +656,16 @@ static int rfkill_rk_probe(struct platform_device *pdev)
654656
ret = rfkill_rk_setup_wake_irq(rfkill, 0);
655657
if (ret) goto fail_setup_wake_irq;
656658

657-
DBG("setup rfkill\n");
658-
rfkill->rfkill_dev = rfkill_alloc(pdata->name, &pdev->dev, pdata->type,
659-
&rfkill_rk_ops, rfkill);
660-
if (!rfkill->rfkill_dev)
661-
goto fail_alloc;
659+
//DBG("setup rfkill\n");
660+
//rfkill->rfkill_dev = rfkill_alloc(pdata->name, &pdev->dev, pdata->type,
661+
// &rfkill_rk_ops, rfkill);
662+
//if (!rfkill->rfkill_dev)
663+
// goto fail_alloc;
662664

663-
rfkill_set_states(rfkill->rfkill_dev, BT_BLOCKED, false);
664-
ret = rfkill_register(rfkill->rfkill_dev);
665-
if (ret < 0)
666-
goto fail_rfkill;
665+
//rfkill_set_states(rfkill->rfkill_dev, BT_BLOCKED, false);
666+
//ret = rfkill_register(rfkill->rfkill_dev);
667+
//if (ret < 0)
668+
// goto fail_rfkill;
667669

668670
INIT_DELAYED_WORK(&rfkill->bt_sleep_delay_work, rfkill_rk_delay_sleep_bt);
669671

@@ -684,8 +686,8 @@ static int rfkill_rk_probe(struct platform_device *pdev)
684686

685687
return 0;
686688

687-
fail_rfkill:
688-
rfkill_destroy(rfkill->rfkill_dev);
689+
//fail_rfkill:
690+
// rfkill_destroy(rfkill->rfkill_dev);
689691
fail_alloc:
690692

691693
remove_proc_entry("btwrite", sleep_dir);
@@ -704,8 +706,8 @@ static int rfkill_rk_remove(struct platform_device *pdev)
704706

705707
LOG("Enter %s\n", __func__);
706708

707-
rfkill_unregister(rfkill->rfkill_dev);
708-
rfkill_destroy(rfkill->rfkill_dev);
709+
//rfkill_unregister(rfkill->rfkill_dev);
710+
//rfkill_destroy(rfkill->rfkill_dev);
709711

710712

711713
cancel_delayed_work_sync(&rfkill->bt_sleep_delay_work);

net/rfkill/rfkill-wlan.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ int rockchip_wifi_power(int on)
304304
struct rfkill_wlan_data *mrfkill = g_rfkill;
305305
struct rksdmmc_gpio *poweron, *reset;
306306
struct regulator *ldo = NULL;
307-
int power = 0;
308-
bool toggle = false;
307+
//int power = 0;
308+
//bool toggle = false;
309309

310310
LOG("%s: %d\n", __func__, on);
311311

@@ -322,12 +322,14 @@ int rockchip_wifi_power(int on)
322322
return 0;
323323
} else power_set_time++;
324324

325+
/*
325326
if (!rfkill_get_bt_power_state(&power, &toggle)) {
326327
if (toggle == true && power == 1) {
327328
LOG("%s: wifi shouldn't control the power, it was enabled by BT!\n", __func__);
328329
return 0;
329330
}
330331
}
332+
*/
331333

332334
if (mrfkill->pdata->mregulator.power_ctrl_by_pmu) {
333335
int ret = -1;

0 commit comments

Comments
 (0)