aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/tosa-bt.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/tosa-bt.c')
-rw-r--r--arch/arm/mach-pxa/tosa-bt.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/arm/mach-pxa/tosa-bt.c b/arch/arm/mach-pxa/tosa-bt.c
index bde42aa29374..c31e601eb49c 100644
--- a/arch/arm/mach-pxa/tosa-bt.c
+++ b/arch/arm/mach-pxa/tosa-bt.c
@@ -35,21 +35,25 @@ static void tosa_bt_off(struct tosa_bt_data *data)
35 gpio_set_value(data->gpio_reset, 0); 35 gpio_set_value(data->gpio_reset, 0);
36} 36}
37 37
38static int tosa_bt_toggle_radio(void *data, enum rfkill_state state) 38static int tosa_bt_set_block(void *data, bool blocked)
39{ 39{
40 pr_info("BT_RADIO going: %s\n", 40 pr_info("BT_RADIO going: %s\n", blocked ? "off" : "on");
41 state == RFKILL_STATE_UNBLOCKED ? "on" : "off");
42 41
43 if (state == RFKILL_STATE_UNBLOCKED) { 42 if (!blocked) {
44 pr_info("TOSA_BT: going ON\n"); 43 pr_info("TOSA_BT: going ON\n");
45 tosa_bt_on(data); 44 tosa_bt_on(data);
46 } else { 45 } else {
47 pr_info("TOSA_BT: going OFF\n"); 46 pr_info("TOSA_BT: going OFF\n");
48 tosa_bt_off(data); 47 tosa_bt_off(data);
49 } 48 }
49
50 return 0; 50 return 0;
51} 51}
52 52
53static const struct rfkill_ops tosa_bt_rfkill_ops = {
54 .set_block = tosa_bt_set_block,
55};
56
53static int tosa_bt_probe(struct platform_device *dev) 57static int tosa_bt_probe(struct platform_device *dev)
54{ 58{
55 int rc; 59 int rc;
@@ -70,18 +74,14 @@ static int tosa_bt_probe(struct platform_device *dev)
70 if (rc) 74 if (rc)
71 goto err_pwr_dir; 75 goto err_pwr_dir;
72 76
73 rfk = rfkill_allocate(&dev->dev, RFKILL_TYPE_BLUETOOTH); 77 rfk = rfkill_alloc("tosa-bt", &dev->dev, RFKILL_TYPE_BLUETOOTH,
78 &tosa_bt_rfkill_ops, data);
74 if (!rfk) { 79 if (!rfk) {
75 rc = -ENOMEM; 80 rc = -ENOMEM;
76 goto err_rfk_alloc; 81 goto err_rfk_alloc;
77 } 82 }
78 83
79 rfk->name = "tosa-bt"; 84 rfkill_set_led_trigger_name(rfk, "tosa-bt");
80 rfk->toggle_radio = tosa_bt_toggle_radio;
81 rfk->data = data;
82#ifdef CONFIG_RFKILL_LEDS
83 rfk->led_trigger.name = "tosa-bt";
84#endif
85 85
86 rc = rfkill_register(rfk); 86 rc = rfkill_register(rfk);
87 if (rc) 87 if (rc)
@@ -92,9 +92,7 @@ static int tosa_bt_probe(struct platform_device *dev)
92 return 0; 92 return 0;
93 93
94err_rfkill: 94err_rfkill:
95 if (rfk) 95 rfkill_destroy(rfk);
96 rfkill_free(rfk);
97 rfk = NULL;
98err_rfk_alloc: 96err_rfk_alloc:
99 tosa_bt_off(data); 97 tosa_bt_off(data);
100err_pwr_dir: 98err_pwr_dir:
@@ -113,8 +111,10 @@ static int __devexit tosa_bt_remove(struct platform_device *dev)
113 111
114 platform_set_drvdata(dev, NULL); 112 platform_set_drvdata(dev, NULL);
115 113
116 if (rfk) 114 if (rfk) {
117 rfkill_unregister(rfk); 115 rfkill_unregister(rfk);
116 rfkill_destroy(rfk);
117 }
118 rfk = NULL; 118 rfk = NULL;
119 119
120 tosa_bt_off(data); 120 tosa_bt_off(data);