diff options
author | Srikant Patnaik | 2015-01-11 12:28:04 +0530 |
---|---|---|
committer | Srikant Patnaik | 2015-01-11 12:28:04 +0530 |
commit | 871480933a1c28f8a9fed4c4d34d06c439a7a422 (patch) | |
tree | 8718f573808810c2a1e8cb8fb6ac469093ca2784 /drivers/leds/leds-wmt.c | |
parent | 9d40ac5867b9aefe0722bc1f110b965ff294d30d (diff) | |
download | FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.gz FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.bz2 FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.zip |
Moved, renamed, and deleted files
The original directory structure was scattered and unorganized.
Changes are basically to make it look like kernel structure.
Diffstat (limited to 'drivers/leds/leds-wmt.c')
-rwxr-xr-x | drivers/leds/leds-wmt.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/leds/leds-wmt.c b/drivers/leds/leds-wmt.c new file mode 100755 index 00000000..ca68f671 --- /dev/null +++ b/drivers/leds/leds-wmt.c @@ -0,0 +1,63 @@ + +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/leds.h> +#include <linux/gpio.h> +#include <linux/gpio.h> +#include <mach/wmt_iomux.h> +#include <mach/wmt_env.h> + +static struct gpio_led gpio_leds[] = { + { + .name = "green", + .default_trigger = "timer", + .gpio = WMT_PIN_GP62_WAKEUP3, + .active_low = 0, + .default_state = LEDS_GPIO_DEFSTATE_OFF, + }, +}; + +static struct gpio_led_platform_data gpio_led_info = { + .leds = gpio_leds, + .num_leds = ARRAY_SIZE(gpio_leds), +}; + +static struct platform_device wmt_leds = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &gpio_led_info, + } +}; + +static int parse_charger_param(void) +{ + static const char uboot_env[] = "wmt.led.param"; + char buf[64]; + size_t l = sizeof(buf); + int gpio; + + if (wmt_getsyspara((char *)uboot_env, buf, &l)) + return -ENODEV; + + sscanf(buf, "%d", &gpio); + + if (!gpio_is_valid(gpio)) + return -EINVAL; + + gpio_leds[0].gpio = gpio; + return 0; +} + +static int __init wmt_leds_init(void) +{ + if (parse_charger_param()) + return -EINVAL; + + return platform_device_register(&wmt_leds); +} + +module_init(wmt_leds_init); + +MODULE_LICENSE("GPL"); + |