[MIPS] Nuke redeclarations of board_time_init.
[linux-2.6/linux-loongson.git] / drivers / leds / leds-net48xx.c
blob35ee52f9b79ebf5d9c4574dd8b47bf41b8ef4cad
1 /*
2 * LEDs driver for Soekris net48xx
4 * Copyright (C) 2006 Chris Boot <bootc@bootc.net>
6 * Based on leds-ams-delta.c
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.
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/leds.h>
17 #include <linux/err.h>
18 #include <asm/io.h>
19 #include <linux/scx200_gpio.h>
21 #define NET48XX_ERROR_LED_GPIO 20
23 static struct platform_device *pdev;
25 static void net48xx_error_led_set(struct led_classdev *led_cdev,
26 enum led_brightness value)
28 if (value)
29 scx200_gpio_set_high(NET48XX_ERROR_LED_GPIO);
30 else
31 scx200_gpio_set_low(NET48XX_ERROR_LED_GPIO);
34 static struct led_classdev net48xx_error_led = {
35 .name = "net48xx:error",
36 .brightness_set = net48xx_error_led_set,
39 #ifdef CONFIG_PM
40 static int net48xx_led_suspend(struct platform_device *dev,
41 pm_message_t state)
43 led_classdev_suspend(&net48xx_error_led);
44 return 0;
47 static int net48xx_led_resume(struct platform_device *dev)
49 led_classdev_resume(&net48xx_error_led);
50 return 0;
52 #else
53 #define net48xx_led_suspend NULL
54 #define net48xx_led_resume NULL
55 #endif
57 static int net48xx_led_probe(struct platform_device *pdev)
59 return led_classdev_register(&pdev->dev, &net48xx_error_led);
62 static int net48xx_led_remove(struct platform_device *pdev)
64 led_classdev_unregister(&net48xx_error_led);
65 return 0;
68 static struct platform_driver net48xx_led_driver = {
69 .driver.owner = THIS_MODULE,
70 .probe = net48xx_led_probe,
71 .remove = net48xx_led_remove,
72 .suspend = net48xx_led_suspend,
73 .resume = net48xx_led_resume,
74 .driver = {
75 .name = "net48xx-led",
79 static int __init net48xx_led_init(void)
81 int ret;
83 if (!scx200_gpio_present()) {
84 ret = -ENODEV;
85 goto out;
88 ret = platform_driver_register(&net48xx_led_driver);
89 if (ret < 0)
90 goto out;
92 pdev = platform_device_register_simple("net48xx-led", -1, NULL, 0);
93 if (IS_ERR(pdev)) {
94 ret = PTR_ERR(pdev);
95 platform_driver_unregister(&net48xx_led_driver);
96 goto out;
99 out:
100 return ret;
103 static void __exit net48xx_led_exit(void)
105 platform_device_unregister(pdev);
106 platform_driver_unregister(&net48xx_led_driver);
109 module_init(net48xx_led_init);
110 module_exit(net48xx_led_exit);
112 MODULE_AUTHOR("Chris Boot <bootc@bootc.net>");
113 MODULE_DESCRIPTION("Soekris net48xx LED driver");
114 MODULE_LICENSE("GPL");