2 * Bluetooth PM code for the FIC gta02 GSM Phone
4 * (C) 2007 by Openmoko Inc.
5 * Author: Harald Welte <laforge@openmoko.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/kernel.h>
17 #include <linux/platform_device.h>
19 #include <mach/hardware.h>
20 #include <asm/mach-types.h>
22 #include <mach/gta02.h>
23 #include <linux/mfd/pcf50633/gpio.h>
25 static ssize_t
pm_host_read(struct device
*dev
, struct device_attribute
*attr
,
28 return sprintf(buf
, "%d\n",
29 pcf50633_gpio_get(gta02_pcf
, PCF50633_GPO
)
30 == PCF50633_GPOCFG_GPOSEL_1
);
33 static ssize_t
pm_host_write(struct device
*dev
, struct device_attribute
*attr
,
34 const char *buf
, size_t count
)
36 unsigned long on
= simple_strtoul(buf
, NULL
, 10);
40 val
= PCF50633_GPOCFG_GPOSEL_1
;
42 val
= PCF50633_GPOCFG_GPOSEL_0
;
45 pcf50633_gpio_set(gta02_pcf
, PCF50633_GPO
, val
);
50 static DEVICE_ATTR(hostmode
, 0644, pm_host_read
, pm_host_write
);
52 static struct attribute
*gta02_pm_host_sysfs_entries
[] = {
53 &dev_attr_hostmode
.attr
,
57 static struct attribute_group gta02_pm_host_attr_group
= {
59 .attrs
= gta02_pm_host_sysfs_entries
,
62 static int __init
gta02_pm_host_probe(struct platform_device
*pdev
)
64 dev_info(&pdev
->dev
, "starting\n");
65 return sysfs_create_group(&pdev
->dev
.kobj
, >a02_pm_host_attr_group
);
68 static int gta02_pm_host_remove(struct platform_device
*pdev
)
70 sysfs_remove_group(&pdev
->dev
.kobj
, >a02_pm_host_attr_group
);
74 static struct platform_driver gta02_pm_host_driver
= {
75 .probe
= gta02_pm_host_probe
,
76 .remove
= gta02_pm_host_remove
,
78 .name
= "gta02-pm-host",
82 static int __devinit
gta02_pm_host_init(void)
84 return platform_driver_register(>a02_pm_host_driver
);
87 static void gta02_pm_host_exit(void)
89 platform_driver_unregister(>a02_pm_host_driver
);
92 module_init(gta02_pm_host_init
);
93 module_exit(gta02_pm_host_exit
);
95 MODULE_LICENSE("GPL");
96 MODULE_AUTHOR("Andy Green <andy@openmoko.com>");
97 MODULE_DESCRIPTION("Openmoko Freerunner USB Host Power Management");