sh_mobile_lcdcfb.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef SH_MOBILE_LCDCFB_H
  3. #define SH_MOBILE_LCDCFB_H
  4. #include <linux/completion.h>
  5. #include <linux/fb.h>
  6. #include <linux/mutex.h>
  7. #include <linux/wait.h>
  8. /* per-channel registers */
  9. enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
  10. LDSM2R, LDSA1R, LDSA2R, LDMLSR, LDHCNR, LDHSYNR, LDVLNR, LDVSYNR, LDPMR,
  11. LDHAJR,
  12. NR_CH_REGS };
  13. #define PALETTE_NR 16
  14. struct backlight_device;
  15. struct fb_info;
  16. struct module;
  17. struct sh_mobile_lcdc_chan;
  18. struct sh_mobile_lcdc_entity;
  19. struct sh_mobile_lcdc_format_info;
  20. struct sh_mobile_lcdc_priv;
  21. #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
  22. #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
  23. struct sh_mobile_lcdc_entity_ops {
  24. /* Display */
  25. int (*display_on)(struct sh_mobile_lcdc_entity *entity);
  26. void (*display_off)(struct sh_mobile_lcdc_entity *entity);
  27. };
  28. enum sh_mobile_lcdc_entity_event {
  29. SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,
  30. SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,
  31. SH_MOBILE_LCDC_EVENT_DISPLAY_MODE,
  32. };
  33. struct sh_mobile_lcdc_entity {
  34. struct module *owner;
  35. const struct sh_mobile_lcdc_entity_ops *ops;
  36. struct sh_mobile_lcdc_chan *lcdc;
  37. struct fb_videomode def_mode;
  38. };
  39. /*
  40. * struct sh_mobile_lcdc_chan - LCDC display channel
  41. *
  42. * @pan_y_offset: Panning linear offset in bytes (luma component)
  43. * @base_addr_y: Frame buffer viewport base address (luma component)
  44. * @base_addr_c: Frame buffer viewport base address (chroma component)
  45. * @pitch: Frame buffer line pitch
  46. */
  47. struct sh_mobile_lcdc_chan {
  48. struct sh_mobile_lcdc_priv *lcdc;
  49. struct sh_mobile_lcdc_entity *tx_dev;
  50. const struct sh_mobile_lcdc_chan_cfg *cfg;
  51. unsigned long *reg_offs;
  52. unsigned long ldmt1r_value;
  53. unsigned long enabled; /* ME and SE in LDCNT2R */
  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. /* Backlight */
  74. struct backlight_device *bl;
  75. unsigned int bl_brightness;
  76. /* FB */
  77. struct fb_info *info;
  78. u32 pseudo_palette[PALETTE_NR];
  79. struct {
  80. unsigned int width;
  81. unsigned int height;
  82. struct fb_videomode mode;
  83. } display;
  84. struct fb_deferred_io defio;
  85. struct scatterlist *sglist;
  86. int blank_status;
  87. };
  88. #endif