more separation

This commit is contained in:
2025-06-13 12:56:21 +01:00
parent 46acdf410e
commit 738d2ffa8e
6 changed files with 26 additions and 9 deletions

View File

@ -3,21 +3,21 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include "ls7366r.h"
#include "trigger.h"
#include "leds.h"
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Wolfgang Hottgenroth"); MODULE_AUTHOR("Wolfgang Hottgenroth");
MODULE_DESCRIPTION("Driver for the MainsCnt measurement hat"); MODULE_DESCRIPTION("Driver for the MainsCnt measurement hat");
extern struct platform_driver leds_driver;
extern struct spi_driver ls7366r_driver;
extern struct platform_driver interrupt_driver;
/* module loading and unloading */ /* module loading and unloading */
static int __init my_init(void) { static int __init my_init(void) {
printk("counter - Loading the leds driver...\n"); printk("counter - Loading the leds driver...\n");
if(platform_driver_register(&leds_driver)) { if(platform_driver_register(&leds_driver)) {
printk("dt_gpio - Error! Could not load leds driver\n"); printk("counter - Error! Could not load leds driver\n");
return -1; return -1;
} }
@ -29,7 +29,7 @@ static int __init my_init(void) {
printk("counter - Loading the interrupt driver...\n"); printk("counter - Loading the interrupt driver...\n");
if(platform_driver_register(&interrupt_driver)) { if(platform_driver_register(&interrupt_driver)) {
printk("dt_gpio - Error! Could not load interrupt driver\n"); printk("counter - Error! Could not load interrupt driver\n");
return -1; return -1;
} }

View File

@ -0,0 +1,8 @@
#ifndef _LEDS_H_
#define _LEDS_H_
#include <linux/platform_device.h>
extern struct platform_driver leds_driver;
#endif /* _LEDS_H_ */

View File

@ -6,9 +6,6 @@
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/interrupt.h>
#include <linux/of_irq.h>
#include <linux/workqueue.h>
#include "ls7366r_registers.h" #include "ls7366r_registers.h"
#include "ls7366r.h" #include "ls7366r.h"

View File

@ -1,6 +1,11 @@
#ifndef _LS7366R_H_ #ifndef _LS7366R_H_
#define _LS7366R_H_ #define _LS7366R_H_
#include <linux/spi/spi.h>
extern struct spi_driver ls7366r_driver;
extern struct spi_device *ls7366r_spi_client;
int read_otr(struct spi_device *client, u32 *r); int read_otr(struct spi_device *client, u32 *r);
#endif /* _LS7366R_H_ */ #endif /* _LS7366R_H_ */

View File

@ -14,7 +14,6 @@
extern struct spi_device *ls7366r_spi_client;
/* interrupt stuff */ /* interrupt stuff */

8
driver/trigger.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef _TRIGGER_H_
#define _TRIGGER_H_
#include <linux/platform_device.h>
extern struct platform_driver interrupt_driver;
#endif /* _TRIGGER_H_ */