]>
Commit | Line | Data |
---|---|---|
53c43c5c GKH |
1 | #ifndef OLPC_DCON_H_ |
2 | #define OLPC_DCON_H_ | |
3 | ||
4 | #include <linux/notifier.h> | |
5 | #include <linux/workqueue.h> | |
6 | ||
7 | /* DCON registers */ | |
8 | ||
9 | #define DCON_REG_ID 0 | |
10 | #define DCON_REG_MODE 1 | |
11 | ||
12 | #define MODE_PASSTHRU (1<<0) | |
13 | #define MODE_SLEEP (1<<1) | |
14 | #define MODE_SLEEP_AUTO (1<<2) | |
15 | #define MODE_BL_ENABLE (1<<3) | |
16 | #define MODE_BLANK (1<<4) | |
17 | #define MODE_CSWIZZLE (1<<5) | |
18 | #define MODE_COL_AA (1<<6) | |
19 | #define MODE_MONO_LUMA (1<<7) | |
20 | #define MODE_SCAN_INT (1<<8) | |
21 | #define MODE_CLOCKDIV (1<<9) | |
22 | #define MODE_DEBUG (1<<14) | |
23 | #define MODE_SELFTEST (1<<15) | |
24 | ||
25 | #define DCON_REG_HRES 0x2 | |
26 | #define DCON_REG_HTOTAL 0x3 | |
27 | #define DCON_REG_HSYNC_WIDTH 0x4 | |
28 | #define DCON_REG_VRES 0x5 | |
29 | #define DCON_REG_VTOTAL 0x6 | |
30 | #define DCON_REG_VSYNC_WIDTH 0x7 | |
31 | #define DCON_REG_TIMEOUT 0x8 | |
32 | #define DCON_REG_SCAN_INT 0x9 | |
33 | #define DCON_REG_BRIGHT 0xa | |
34 | #define DCON_REG_MEM_OPT_A 0x41 | |
35 | #define DCON_REG_MEM_OPT_B 0x42 | |
36 | ||
37 | /* Load Delay Locked Loop (DLL) settings for clock delay */ | |
38 | #define MEM_DLL_CLOCK_DELAY (1<<0) | |
39 | /* Memory controller power down function */ | |
40 | #define MEM_POWER_DOWN (1<<8) | |
41 | /* Memory controller software reset */ | |
42 | #define MEM_SOFT_RESET (1<<0) | |
43 | ||
44 | /* Status values */ | |
45 | ||
46 | #define DCONSTAT_SCANINT 0 | |
47 | #define DCONSTAT_SCANINT_DCON 1 | |
48 | #define DCONSTAT_DISPLAYLOAD 2 | |
49 | #define DCONSTAT_MISSED 3 | |
50 | ||
51 | /* Source values */ | |
52 | ||
53 | #define DCON_SOURCE_DCON 0 | |
54 | #define DCON_SOURCE_CPU 1 | |
55 | ||
56 | /* Interrupt */ | |
57 | #define DCON_IRQ 6 | |
58 | ||
59 | struct dcon_priv { | |
60 | struct i2c_client *client; | |
61 | struct fb_info *fbinfo; | |
62 | struct backlight_device *bl_dev; | |
63 | ||
64 | wait_queue_head_t waitq; | |
65 | struct work_struct switch_source; | |
66 | struct notifier_block reboot_nb; | |
67 | ||
68 | /* Shadow register for the DCON_REG_MODE register */ | |
69 | u8 disp_mode; | |
70 | ||
71 | /* The current backlight value - this saves us some smbus traffic */ | |
72 | u8 bl_val; | |
73 | ||
74 | /* Current source, initialized at probe time */ | |
75 | int curr_src; | |
76 | ||
77 | /* Desired source */ | |
78 | int pending_src; | |
79 | ||
80 | /* Variables used during switches */ | |
81 | bool switched; | |
82 | ktime_t irq_time; | |
83 | ktime_t load_time; | |
84 | ||
85 | /* Current output type; true == mono, false == color */ | |
86 | bool mono; | |
87 | bool asleep; | |
88 | /* This get set while controlling fb blank state from the driver */ | |
89 | bool ignore_fb_events; | |
90 | }; | |
91 | ||
92 | struct dcon_platform_data { | |
93 | int (*init)(struct dcon_priv *); | |
94 | void (*bus_stabilize_wiggle)(void); | |
95 | void (*set_dconload)(int); | |
96 | int (*read_status)(u8 *); | |
97 | }; | |
98 | ||
99 | #include <linux/interrupt.h> | |
100 | ||
101 | irqreturn_t dcon_interrupt(int irq, void *id); | |
102 | ||
103 | #ifdef CONFIG_FB_OLPC_DCON_1 | |
104 | extern struct dcon_platform_data dcon_pdata_xo_1; | |
105 | #endif | |
106 | ||
107 | #ifdef CONFIG_FB_OLPC_DCON_1_5 | |
108 | extern struct dcon_platform_data dcon_pdata_xo_1_5; | |
109 | #endif | |
110 | ||
111 | #endif |