sdum.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * Copyright (C) 2005 Philips Semiconductors
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2, or (at your option)
  7. * any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; see the file COPYING. If not, write to
  16. * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA, or http://www.gnu.org/licenses/gpl.html
  18. */
  19. #define MAX_DUM_CHANNELS 64
  20. #define RGB_MEM_WINDOW(x) (0x10000000 + (x)*0x00100000)
  21. #define QCIF_OFFSET(x) (((x) == 0) ? 0x00000: ((x) == 1) ? 0x30000: -1)
  22. #define CIF_OFFSET(x) (((x) == 0) ? 0x00000: ((x) == 1) ? 0x60000: -1)
  23. #define CTRL_SETDIRTY (0x00000001)
  24. #define CONF_DIRTYENABLE (0x00000020)
  25. #define CONF_SYNCENABLE (0x00000004)
  26. #define DIRTY_ENABLED(conf) ((conf) & 0x0020)
  27. #define SYNC_ENABLED(conf) ((conf) & 0x0004)
  28. /* Display 1 & 2 Write Timing Configuration */
  29. #define PNX4008_DUM_WT_CFG 0x00372000
  30. /* Display 1 & 2 Read Timing Configuration */
  31. #define PNX4008_DUM_RT_CFG 0x00003A47
  32. /* DUM Transit State Timing Configuration */
  33. #define PNX4008_DUM_T_CFG 0x1D /* 29 HCLK cycles */
  34. /* DUM Sync count clock divider */
  35. #define PNX4008_DUM_CLK_DIV 0x02DD
  36. /* Memory size for framebuffer, allocated through dma_alloc_writecombine().
  37. * Must be PAGE aligned
  38. */
  39. #define FB_DMA_SIZE (PAGE_ALIGN(SZ_1M + PAGE_SIZE))
  40. #define OFFSET_RGBBUFFER (0xB0000)
  41. #define OFFSET_YUVBUFFER (0x00000)
  42. #define YUVBUFFER (lcd_video_start + OFFSET_YUVBUFFER)
  43. #define RGBBUFFER (lcd_video_start + OFFSET_RGBBUFFER)
  44. #define CMDSTRING_BASEADDR (0x00C000) /* iram */
  45. #define BYTES_PER_CMDSTRING (0x80)
  46. #define NR_OF_CMDSTRINGS (64)
  47. #define MAX_NR_PRESTRINGS (0x40)
  48. #define MAX_NR_POSTSTRINGS (0x40)
  49. /* various mask definitions */
  50. #define DUM_CLK_ENABLE 0x01
  51. #define DUM_CLK_DISABLE 0
  52. #define DUM_DECODE_MASK 0x1FFFFFFF
  53. #define DUM_CHANNEL_CFG_MASK 0x01FF
  54. #define DUM_CHANNEL_CFG_SYNC_MASK 0xFFFE00FF
  55. #define DUM_CHANNEL_CFG_SYNC_MASK_SET 0x0CA00
  56. #define SDUM_RETURNVAL_BASE (0x500)
  57. #define CONF_SYNC_OFF (0x602)
  58. #define CONF_SYNC_ON (0x603)
  59. #define CONF_DIRTYDETECTION_OFF (0x600)
  60. #define CONF_DIRTYDETECTION_ON (0x601)
  61. struct dumchannel_uf {
  62. int channelnr;
  63. u32 *dirty;
  64. u32 *source;
  65. u32 x_offset;
  66. u32 y_offset;
  67. u32 width;
  68. u32 height;
  69. };
  70. enum {
  71. FB_TYPE_YUV,
  72. FB_TYPE_RGB
  73. };
  74. struct cmdstring {
  75. int channelnr;
  76. uint16_t prestringlen;
  77. uint16_t poststringlen;
  78. uint16_t format;
  79. uint16_t reserved;
  80. uint16_t startaddr_low;
  81. uint16_t startaddr_high;
  82. uint16_t pixdatlen_low;
  83. uint16_t pixdatlen_high;
  84. u32 precmd[MAX_NR_PRESTRINGS];
  85. u32 postcmd[MAX_NR_POSTSTRINGS];
  86. };
  87. struct dumchannel {
  88. int channelnr;
  89. int dum_ch_min;
  90. int dum_ch_max;
  91. int dum_ch_conf;
  92. int dum_ch_stat;
  93. int dum_ch_ctrl;
  94. };
  95. int pnx4008_alloc_dum_channel(int dev_id);
  96. int pnx4008_free_dum_channel(int channr, int dev_id);
  97. int pnx4008_get_dum_channel_uf(struct dumchannel_uf *pChan_uf, int dev_id);
  98. int pnx4008_put_dum_channel_uf(struct dumchannel_uf chan_uf, int dev_id);
  99. int pnx4008_set_dum_channel_sync(int channr, int val, int dev_id);
  100. int pnx4008_set_dum_channel_dirty_detect(int channr, int val, int dev_id);
  101. int pnx4008_force_dum_update_channel(int channr, int dev_id);
  102. int pnx4008_get_dum_channel_config(int channr, int dev_id);
  103. int pnx4008_sdum_mmap(struct fb_info *info, struct vm_area_struct *vma, struct device *dev);
  104. int pnx4008_set_dum_exit_notification(int dev_id);
  105. int pnx4008_get_fb_addresses(int fb_type, void **virt_addr,
  106. dma_addr_t * phys_addr, int *fb_length);