~ubuntu-branches/ubuntu/lucid/linux-rt/lucid

« back to all changes in this revision

Viewing changes to arch/arm/mach-pxa/tosa-bt.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-08-05 23:00:52 UTC
  • Revision ID: james.westby@ubuntu.com-20090805230052-7xedvqcyk9dnnxb2
Tags: 2.6.31-1.1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
        gpio_set_value(data->gpio_reset, 0);
36
36
}
37
37
 
38
 
static int tosa_bt_toggle_radio(void *data, enum rfkill_state state)
 
38
static int tosa_bt_set_block(void *data, bool blocked)
39
39
{
40
 
        pr_info("BT_RADIO going: %s\n",
41
 
                        state == RFKILL_STATE_ON ? "on" : "off");
 
40
        pr_info("BT_RADIO going: %s\n", blocked ? "off" : "on");
42
41
 
43
 
        if (state == RFKILL_STATE_ON) {
 
42
        if (!blocked) {
44
43
                pr_info("TOSA_BT: going ON\n");
45
44
                tosa_bt_on(data);
46
45
        } else {
47
46
                pr_info("TOSA_BT: going OFF\n");
48
47
                tosa_bt_off(data);
49
48
        }
 
49
 
50
50
        return 0;
51
51
}
52
52
 
 
53
static const struct rfkill_ops tosa_bt_rfkill_ops = {
 
54
        .set_block = tosa_bt_set_block,
 
55
};
 
56
 
53
57
static int tosa_bt_probe(struct platform_device *dev)
54
58
{
55
59
        int rc;
70
74
        if (rc)
71
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
79
        if (!rfk) {
75
80
                rc = -ENOMEM;
76
81
                goto err_rfk_alloc;
77
82
        }
78
83
 
79
 
        rfk->name = "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
 
84
        rfkill_set_led_trigger_name(rfk, "tosa-bt");
85
85
 
86
86
        rc = rfkill_register(rfk);
87
87
        if (rc)
92
92
        return 0;
93
93
 
94
94
err_rfkill:
95
 
        if (rfk)
96
 
                rfkill_free(rfk);
97
 
        rfk = NULL;
 
95
        rfkill_destroy(rfk);
98
96
err_rfk_alloc:
99
97
        tosa_bt_off(data);
100
98
err_pwr_dir:
113
111
 
114
112
        platform_set_drvdata(dev, NULL);
115
113
 
116
 
        if (rfk)
 
114
        if (rfk) {
117
115
                rfkill_unregister(rfk);
 
116
                rfkill_destroy(rfk);
 
117
        }
118
118
        rfk = NULL;
119
119
 
120
120
        tosa_bt_off(data);