~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/mti-sead3/leds-sead3.c

Version: ~ [ linux-5.5-rc1 ] ~ [ linux-5.4.2 ] ~ [ linux-5.3.15 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.88 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.158 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.206 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.206 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.78 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * This file is subject to the terms and conditions of the GNU General Public
  3  * License.  See the file "COPYING" in the main directory of this archive
  4  * for more details.
  5  *
  6  * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved.
  7  */
  8 #include <linux/kernel.h>
  9 #include <linux/module.h>
 10 #include <linux/init.h>
 11 #include <linux/platform_device.h>
 12 #include <linux/leds.h>
 13 #include <linux/err.h>
 14 #include <linux/io.h>
 15 
 16 #define DRVNAME "sead3-led"
 17 
 18 static struct platform_device *pdev;
 19 
 20 static void sead3_pled_set(struct led_classdev *led_cdev,
 21                 enum led_brightness value)
 22 {
 23         pr_debug("sead3_pled_set\n");
 24         writel(value, (void __iomem *)0xBF000210);      /* FIXME */
 25 }
 26 
 27 static void sead3_fled_set(struct led_classdev *led_cdev,
 28                 enum led_brightness value)
 29 {
 30         pr_debug("sead3_fled_set\n");
 31         writel(value, (void __iomem *)0xBF000218);      /* FIXME */
 32 }
 33 
 34 static struct led_classdev sead3_pled = {
 35         .name           = "sead3::pled",
 36         .brightness_set = sead3_pled_set,
 37 };
 38 
 39 static struct led_classdev sead3_fled = {
 40         .name           = "sead3::fled",
 41         .brightness_set = sead3_fled_set,
 42 };
 43 
 44 #ifdef CONFIG_PM
 45 static int sead3_led_suspend(struct platform_device *dev,
 46                 pm_message_t state)
 47 {
 48         led_classdev_suspend(&sead3_pled);
 49         led_classdev_suspend(&sead3_fled);
 50         return 0;
 51 }
 52 
 53 static int sead3_led_resume(struct platform_device *dev)
 54 {
 55         led_classdev_resume(&sead3_pled);
 56         led_classdev_resume(&sead3_fled);
 57         return 0;
 58 }
 59 #else
 60 #define sead3_led_suspend NULL
 61 #define sead3_led_resume NULL
 62 #endif
 63 
 64 static int sead3_led_probe(struct platform_device *pdev)
 65 {
 66         int ret;
 67 
 68         ret = led_classdev_register(&pdev->dev, &sead3_pled);
 69         if (ret < 0)
 70                 return ret;
 71 
 72         ret = led_classdev_register(&pdev->dev, &sead3_fled);
 73         if (ret < 0)
 74                 led_classdev_unregister(&sead3_pled);
 75 
 76         return ret;
 77 }
 78 
 79 static int sead3_led_remove(struct platform_device *pdev)
 80 {
 81         led_classdev_unregister(&sead3_pled);
 82         led_classdev_unregister(&sead3_fled);
 83         return 0;
 84 }
 85 
 86 static struct platform_driver sead3_led_driver = {
 87         .probe          = sead3_led_probe,
 88         .remove         = sead3_led_remove,
 89         .suspend        = sead3_led_suspend,
 90         .resume         = sead3_led_resume,
 91         .driver         = {
 92                 .name           = DRVNAME,
 93                 .owner          = THIS_MODULE,
 94         },
 95 };
 96 
 97 static int __init sead3_led_init(void)
 98 {
 99         int ret;
100 
101         ret = platform_driver_register(&sead3_led_driver);
102         if (ret < 0)
103                 goto out;
104 
105         pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
106         if (IS_ERR(pdev)) {
107                 ret = PTR_ERR(pdev);
108                 platform_driver_unregister(&sead3_led_driver);
109                 goto out;
110         }
111 
112 out:
113         return ret;
114 }
115 
116 static void __exit sead3_led_exit(void)
117 {
118         platform_device_unregister(pdev);
119         platform_driver_unregister(&sead3_led_driver);
120 }
121 
122 module_init(sead3_led_init);
123 module_exit(sead3_led_exit);
124 
125 MODULE_AUTHOR("Kristian Kielhofner <kris@krisk.org>");
126 MODULE_DESCRIPTION("SEAD3 LED driver");
127 MODULE_LICENSE("GPL");
128 
129 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp