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