-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpcd_platform_driver_sysfs.h
57 lines (44 loc) · 1.25 KB
/
pcd_platform_driver_sysfs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/kdev_t.h>
#include <linux/uaccess.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/mod_devicetable.h>
#include "platform.h"
#undef pr_fmt
#define pr_fmt(fmt) "%s :" fmt, __func__
struct device_config {
int config_item1;
int config_item2;
};
enum pcdev_names {
PCDEVA1X,
PCDEVB1X,
PCDEVC1X,
PCDEVD1X
};
/* Private data of a single device */
struct pcdev_private_data {
struct pcdev_platform_data pdata;
char *buffer;
dev_t device_number;
struct cdev pcd_cdev;
struct mutex pcd_lock;
};
/* Private data of the driver */
struct pcdrv_private_data {
int total_devices;
dev_t device_num_base;
struct class *class_pcd;
struct device *device_pcd;
};
int pcd_open(struct inode *inode, struct file *fptr);
u32 check_permission(u32 dev_perm, fmode_t access_mode);
int pcd_release (struct inode *inode, struct file *fptr);
ssize_t pcd_read(struct file *fptr, char __user *buff, size_t count, loff_t *f_pos);
ssize_t pcd_write(struct file *fptr, const char __user *buff, size_t count, loff_t *f_pos);
loff_t pcd_lseek(struct file *fptr, loff_t offset, int whence);