Commit | Line | Data |
---|---|---|
eecb3e4e AS |
1 | #ifndef OLPC_DCON_H_ |
2 | #define OLPC_DCON_H_ | |
3 | ||
bbe963f1 AS |
4 | #include <linux/notifier.h> |
5 | #include <linux/workqueue.h> | |
6 | ||
eecb3e4e AS |
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 | ||
98d4f93c JF |
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 | |
9467d11b | 33 | #define DCON_REG_BRIGHT 0xa |
98d4f93c JF |
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 */ | |
55567349 | 40 | #define MEM_POWER_DOWN (1<<8) |
98d4f93c JF |
41 | /* Memory controller software reset */ |
42 | #define MEM_SOFT_RESET (1<<0) | |
eecb3e4e | 43 | |
eecb3e4e AS |
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 | ||
eecb3e4e AS |
56 | /* Interrupt */ |
57 | #define DCON_IRQ 6 | |
58 | ||
bbe963f1 AS |
59 | struct dcon_priv { |
60 | struct i2c_client *client; | |
61 | struct fb_info *fbinfo; | |
c59eef17 | 62 | struct backlight_device *bl_dev; |
bbe963f1 | 63 | |
c40f20da | 64 | wait_queue_head_t waitq; |
bbe963f1 AS |
65 | struct work_struct switch_source; |
66 | struct notifier_block reboot_nb; | |
bbe963f1 AS |
67 | |
68 | /* Shadow register for the DCON_REG_MODE register */ | |
69 | u8 disp_mode; | |
70 | ||
c59eef17 AS |
71 | /* The current backlight value - this saves us some smbus traffic */ |
72 | u8 bl_val; | |
73 | ||
bbe963f1 AS |
74 | /* Current source, initialized at probe time */ |
75 | int curr_src; | |
76 | ||
77 | /* Desired source */ | |
78 | int pending_src; | |
79 | ||
309ef2a2 AS |
80 | /* Variables used during switches */ |
81 | bool switched; | |
82 | struct timespec irq_time; | |
83 | struct timespec load_time; | |
84 | ||
bbe963f1 AS |
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 | ||
097cd83a | 92 | struct dcon_platform_data { |
bbe963f1 | 93 | int (*init)(struct dcon_priv *); |
097cd83a AS |
94 | void (*bus_stabilize_wiggle)(void); |
95 | void (*set_dconload)(int); | |
91762057 | 96 | int (*read_status)(u8 *); |
097cd83a AS |
97 | }; |
98 | ||
99 | #include <linux/interrupt.h> | |
100 | ||
097cd83a | 101 | extern irqreturn_t dcon_interrupt(int irq, void *id); |
097cd83a AS |
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 | ||
eecb3e4e | 111 | #endif |