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 2 26 #define DCON_REG_HTOTAL 3 27 #define DCON_REG_HSYNC_WIDTH 4 28 #define DCON_REG_VRES 5 29 #define DCON_REG_VTOTAL 6 30 #define DCON_REG_VSYNC_WIDTH 7 31 #define DCON_REG_TIMEOUT 8 32 #define DCON_REG_SCAN_INT 9 33 #define DCON_REG_BRIGHT 10 34 35 /* Status values */ 36 37 #define DCONSTAT_SCANINT 0 38 #define DCONSTAT_SCANINT_DCON 1 39 #define DCONSTAT_DISPLAYLOAD 2 40 #define DCONSTAT_MISSED 3 41 42 /* Source values */ 43 44 #define DCON_SOURCE_DCON 0 45 #define DCON_SOURCE_CPU 1 46 47 /* Interrupt */ 48 #define DCON_IRQ 6 49 50 struct dcon_priv { 51 struct i2c_client *client; 52 struct fb_info *fbinfo; 53 struct backlight_device *bl_dev; 54 55 wait_queue_head_t waitq; 56 struct work_struct switch_source; 57 struct notifier_block reboot_nb; 58 59 /* Shadow register for the DCON_REG_MODE register */ 60 u8 disp_mode; 61 62 /* The current backlight value - this saves us some smbus traffic */ 63 u8 bl_val; 64 65 /* Current source, initialized at probe time */ 66 int curr_src; 67 68 /* Desired source */ 69 int pending_src; 70 71 /* Variables used during switches */ 72 bool switched; 73 struct timespec irq_time; 74 struct timespec load_time; 75 76 /* Current output type; true == mono, false == color */ 77 bool mono; 78 bool asleep; 79 /* This get set while controlling fb blank state from the driver */ 80 bool ignore_fb_events; 81 }; 82 83 struct dcon_platform_data { 84 int (*init)(struct dcon_priv *); 85 void (*bus_stabilize_wiggle)(void); 86 void (*set_dconload)(int); 87 int (*read_status)(u8 *); 88 }; 89 90 #include <linux/interrupt.h> 91 92 extern irqreturn_t dcon_interrupt(int irq, void *id); 93 94 #ifdef CONFIG_FB_OLPC_DCON_1 95 extern struct dcon_platform_data dcon_pdata_xo_1; 96 #endif 97 98 #ifdef CONFIG_FB_OLPC_DCON_1_5 99 extern struct dcon_platform_data dcon_pdata_xo_1_5; 100 #endif 101 102 #endif 103