2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
8 hciattach /dev/ttyS1 bcsp 921600
10 #include <linux/module.h>
11 #include <linux/version.h>
13 #include <linux/init.h>
14 #include <linux/device.h>
15 #include <linux/platform_device.h>
17 #include <asm/arch/hardware.h>
18 #include <asm/arch/pxa-regs.h>
19 #include <asm/arch/asus730-gpio.h>
21 static int enabled
= 0;
23 ssize_t
btpwr_show(struct device_driver
* drv
, char* buf
)
25 return sprintf(buf
,"%d\n",enabled
);
28 ssize_t
btpwr_set(struct device_driver
* drv
, const char* buf
, size_t count
)
32 if (sscanf(buf
, "%d", &v
) != 1 || v
== enabled
)
37 printk("changing to %d\n",v
);
38 SET_A730_GPIO(BT_POWER1
, enabled
);
39 SET_A730_GPIO(BT_POWER2
, enabled
);
43 static DRIVER_ATTR(power
, 0644, btpwr_show
, btpwr_set
);
44 /* /sys/devices/platform/a730-bt-power/driver/power */
46 static int bt_probe(struct device
*dev
)
48 printk("%s %p\n",__PRETTY_FUNCTION__
,dev
->driver
);
52 static int bt_resume(struct device
*dev
)
54 // if (level != RESUME_ENABLE) return 0;
55 // printk("%s lvl=%d\n",__PRETTY_FUNCTION__,level);
59 static int bt_remove (struct device
* dev
) {
60 printk("%s %p\n",__PRETTY_FUNCTION__
,dev
->driver
);
64 static int bt_suspend(struct device
*dev
, pm_message_t state
)
66 // printk("%s lvl=%d\n",__PRETTY_FUNCTION__,level);
70 static void bt_shdn(struct device
* dev
)
72 printk("%s\n",__PRETTY_FUNCTION__
);
75 static void bt_rel (struct device
* dev
)
77 printk("%s\n",__PRETTY_FUNCTION__
);
80 static struct device_driver a730_bt_driver
= {
81 .name
= "a730-bt-power", //driver name
82 .bus
= &platform_bus_type
,
87 .suspend
= bt_suspend
,//null, not used
92 static struct platform_device platform_btpwr
= {
93 .name
= "a730-bt-power", //driver name
95 .dev
= { /* struct device */
96 .release
= bt_rel
,//null, not used
101 static int a730_btpwr_init (void)
103 driver_register(&a730_bt_driver
);
104 platform_device_register(&platform_btpwr
);
105 driver_create_file(&a730_bt_driver
, &driver_attr_power
);
109 static void a730_btpwr_exit(void)
111 driver_remove_file(&a730_bt_driver
, &driver_attr_power
);
112 platform_device_unregister(&platform_btpwr
);//remove device
113 driver_unregister(&a730_bt_driver
); //remove driver
116 module_init(a730_btpwr_init
);
117 module_exit(a730_btpwr_exit
);
119 MODULE_LICENSE("GPL");
120 MODULE_AUTHOR("Michal Sroczynski <msroczyn@elka.pw.edu.pl>");
121 MODULE_DESCRIPTION("Bluetooth power control driver for Asus MyPal 730");