1
2
3
4
5
6
7
8#ifndef _LINUX_LCD_H
9#define _LINUX_LCD_H
10
11#include <linux/device.h>
12#include <linux/mutex.h>
13#include <linux/notifier.h>
14#include <linux/fb.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31struct lcd_device;
32struct fb_info;
33
34struct lcd_properties {
35
36 int max_contrast;
37};
38
39struct lcd_ops {
40
41
42 int (*get_power)(struct lcd_device *);
43
44 int (*set_power)(struct lcd_device *, int power);
45
46 int (*get_contrast)(struct lcd_device *);
47
48 int (*set_contrast)(struct lcd_device *, int contrast);
49
50 int (*set_mode)(struct lcd_device *, struct fb_videomode *);
51
52
53 int (*check_fb)(struct lcd_device *, struct fb_info *);
54};
55
56struct lcd_device {
57 struct lcd_properties props;
58
59
60
61 struct mutex ops_lock;
62
63 struct lcd_ops *ops;
64
65 struct mutex update_lock;
66
67 struct notifier_block fb_notif;
68
69 struct device dev;
70};
71
72static inline void lcd_set_power(struct lcd_device *ld, int power)
73{
74 mutex_lock(&ld->update_lock);
75 if (ld->ops && ld->ops->set_power)
76 ld->ops->set_power(ld, power);
77 mutex_unlock(&ld->update_lock);
78}
79
80extern struct lcd_device *lcd_device_register(const char *name,
81 struct device *parent, void *devdata, struct lcd_ops *ops);
82extern void lcd_device_unregister(struct lcd_device *ld);
83
84#define to_lcd_device(obj) container_of(obj, struct lcd_device, dev)
85
86static inline void * lcd_get_data(struct lcd_device *ld_dev)
87{
88 return dev_get_drvdata(&ld_dev->dev);
89}
90
91
92#endif
93