0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LINUX_LCD_H
0010 #define _LINUX_LCD_H
0011
0012 #include <linux/device.h>
0013 #include <linux/mutex.h>
0014 #include <linux/notifier.h>
0015 #include <linux/fb.h>
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 struct lcd_device;
0033 struct fb_info;
0034
0035 struct lcd_properties {
0036
0037 int max_contrast;
0038 };
0039
0040 struct lcd_ops {
0041
0042
0043 int (*get_power)(struct lcd_device *);
0044
0045 int (*set_power)(struct lcd_device *, int power);
0046
0047 int (*get_contrast)(struct lcd_device *);
0048
0049 int (*set_contrast)(struct lcd_device *, int contrast);
0050
0051 int (*set_mode)(struct lcd_device *, struct fb_videomode *);
0052
0053
0054 int (*check_fb)(struct lcd_device *, struct fb_info *);
0055 };
0056
0057 struct lcd_device {
0058 struct lcd_properties props;
0059
0060
0061
0062 struct mutex ops_lock;
0063
0064 struct lcd_ops *ops;
0065
0066 struct mutex update_lock;
0067
0068 struct notifier_block fb_notif;
0069
0070 struct device dev;
0071 };
0072
0073 struct lcd_platform_data {
0074
0075 int (*reset)(struct lcd_device *ld);
0076
0077
0078 int (*power_on)(struct lcd_device *ld, int enable);
0079
0080
0081
0082 int lcd_enabled;
0083
0084
0085
0086 unsigned int reset_delay;
0087
0088 unsigned int power_on_delay;
0089
0090 unsigned int power_off_delay;
0091
0092
0093 void *pdata;
0094 };
0095
0096 static inline void lcd_set_power(struct lcd_device *ld, int power)
0097 {
0098 mutex_lock(&ld->update_lock);
0099 if (ld->ops && ld->ops->set_power)
0100 ld->ops->set_power(ld, power);
0101 mutex_unlock(&ld->update_lock);
0102 }
0103
0104 extern struct lcd_device *lcd_device_register(const char *name,
0105 struct device *parent, void *devdata, struct lcd_ops *ops);
0106 extern struct lcd_device *devm_lcd_device_register(struct device *dev,
0107 const char *name, struct device *parent,
0108 void *devdata, struct lcd_ops *ops);
0109 extern void lcd_device_unregister(struct lcd_device *ld);
0110 extern void devm_lcd_device_unregister(struct device *dev,
0111 struct lcd_device *ld);
0112
0113 #define to_lcd_device(obj) container_of(obj, struct lcd_device, dev)
0114
0115 static inline void * lcd_get_data(struct lcd_device *ld_dev)
0116 {
0117 return dev_get_drvdata(&ld_dev->dev);
0118 }
0119
0120
0121 #endif