sh_mobile_lcdcfb.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef SH_MOBILE_LCDCFB_H
  2. #define SH_MOBILE_LCDCFB_H
  3. #include <linux/completion.h>
  4. #include <linux/fb.h>
  5. #include <linux/mutex.h>
  6. #include <linux/wait.h>
  7. /* per-channel registers */
  8. enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
  9. LDSM2R, LDSA1R, LDSA2R, LDMLSR, LDHCNR, LDHSYNR, LDVLNR, LDVSYNR, LDPMR,
  10. LDHAJR,
  11. NR_CH_REGS };
  12. #define PALETTE_NR 16
  13. struct backlight_device;
  14. struct fb_info;
  15. struct module;
  16. struct sh_mobile_lcdc_chan;
  17. struct sh_mobile_lcdc_entity;
  18. struct sh_mobile_lcdc_format_info;
  19. struct sh_mobile_lcdc_priv;
  20. #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
  21. #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
  22. struct sh_mobile_lcdc_entity_ops {
  23. /* Display */
  24. int (*display_on)(struct sh_mobile_lcdc_entity *entity);
  25. void (*display_off)(struct sh_mobile_lcdc_entity *entity);
  26. };
  27. enum sh_mobile_lcdc_entity_event {
  28. SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,
  29. SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,
  30. SH_MOBILE_LCDC_EVENT_DISPLAY_MODE,
  31. };
  32. struct sh_mobile_lcdc_entity {
  33. struct module *owner;
  34. const struct sh_mobile_lcdc_entity_ops *ops;
  35. struct sh_mobile_lcdc_chan *lcdc;
  36. struct fb_videomode def_mode;
  37. };
  38. /*
  39. * struct sh_mobile_lcdc_chan - LCDC display channel
  40. *
  41. * @pan_y_offset: Panning linear offset in bytes (luma component)
  42. * @base_addr_y: Frame buffer viewport base address (luma component)
  43. * @base_addr_c: Frame buffer viewport base address (chroma component)
  44. * @pitch: Frame buffer line pitch
  45. */
  46. struct sh_mobile_lcdc_chan {
  47. struct sh_mobile_lcdc_priv *lcdc;
  48. struct sh_mobile_lcdc_entity *tx_dev;
  49. const struct sh_mobile_lcdc_chan_cfg *cfg;
  50. unsigned long *reg_offs;
  51. unsigned long ldmt1r_value;
  52. unsigned long enabled; /* ME and SE in LDCNT2R */
  53. void *cache;
  54. struct mutex open_lock; /* protects the use counter */
  55. int use_count;
  56. void *fb_mem;
  57. unsigned long fb_size;
  58. dma_addr_t dma_handle;
  59. unsigned long pan_y_offset;
  60. unsigned long frame_end;
  61. wait_queue_head_t frame_end_wait;
  62. struct completion vsync_completion;
  63. const struct sh_mobile_lcdc_format_info *format;
  64. u32 colorspace;
  65. unsigned int xres;
  66. unsigned int xres_virtual;
  67. unsigned int yres;
  68. unsigned int yres_virtual;
  69. unsigned int pitch;
  70. unsigned long base_addr_y;
  71. unsigned long base_addr_c;
  72. unsigned int line_size;
  73. int (*notify)(struct sh_mobile_lcdc_chan *ch,
  74. enum sh_mobile_lcdc_entity_event event,
  75. const struct fb_videomode *mode,
  76. const struct fb_monspecs *monspec);
  77. /* Backlight */
  78. struct backlight_device *bl;
  79. unsigned int bl_brightness;
  80. /* FB */
  81. struct fb_info *info;
  82. u32 pseudo_palette[PALETTE_NR];
  83. struct {
  84. unsigned int width;
  85. unsigned int height;
  86. struct fb_videomode mode;
  87. } display;
  88. struct fb_deferred_io defio;
  89. struct scatterlist *sglist;
  90. int blank_status;
  91. };
  92. #endif