54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include "ls7366r.h"
|
|
#include "trigger.h"
|
|
#include "leds.h"
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_AUTHOR("Wolfgang Hottgenroth");
|
|
MODULE_DESCRIPTION("Driver for the MainsCnt measurement hat");
|
|
|
|
|
|
|
|
/* module loading and unloading */
|
|
static int __init my_init(void) {
|
|
printk("counter - Loading the leds driver...\n");
|
|
if(platform_driver_register(&leds_driver)) {
|
|
printk("counter - Error! Could not load leds driver\n");
|
|
return -1;
|
|
}
|
|
|
|
printk("counter - Loading the ls7366r driver...\n");
|
|
if (spi_register_driver(&ls7366r_driver)) {
|
|
printk("counter - Error! Could not load spi driver\n");
|
|
return -1;
|
|
}
|
|
|
|
printk("counter - Loading the interrupt driver...\n");
|
|
if(platform_driver_register(&interrupt_driver)) {
|
|
printk("counter - Error! Could not load interrupt driver\n");
|
|
return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void __exit my_exit(void) {
|
|
printk("counter - Unloading the leds driver...\n");
|
|
platform_driver_unregister(&leds_driver);
|
|
|
|
printk("counter - Unloading the ls7366r driver...\n");
|
|
spi_unregister_driver(&ls7366r_driver);
|
|
|
|
printk("counter - Unloading the interrupt driver...\n");
|
|
platform_driver_unregister(&interrupt_driver);
|
|
}
|
|
|
|
module_init(my_init);
|
|
module_exit(my_exit);
|
|
|
|
|