sh_mobile_meram.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __VIDEO_SH_MOBILE_MERAM_H__
  3. #define __VIDEO_SH_MOBILE_MERAM_H__
  4. /* For sh_mobile_meram_info.addr_mode */
  5. enum {
  6. SH_MOBILE_MERAM_MODE0 = 0,
  7. SH_MOBILE_MERAM_MODE1
  8. };
  9. enum {
  10. SH_MOBILE_MERAM_PF_NV = 0,
  11. SH_MOBILE_MERAM_PF_RGB,
  12. SH_MOBILE_MERAM_PF_NV24
  13. };
  14. struct sh_mobile_meram_priv;
  15. /*
  16. * struct sh_mobile_meram_info - MERAM platform data
  17. * @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO)
  18. */
  19. struct sh_mobile_meram_info {
  20. int addr_mode;
  21. u32 reserved_icbs;
  22. struct sh_mobile_meram_priv *priv;
  23. struct platform_device *pdev;
  24. };
  25. /* icb config */
  26. struct sh_mobile_meram_icb_cfg {
  27. unsigned int meram_size; /* MERAM Buffer Size to use */
  28. };
  29. struct sh_mobile_meram_cfg {
  30. struct sh_mobile_meram_icb_cfg icb[2];
  31. };
  32. #if defined(CONFIG_FB_SH_MOBILE_MERAM) || \
  33. defined(CONFIG_FB_SH_MOBILE_MERAM_MODULE)
  34. unsigned long sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev,
  35. size_t size);
  36. void sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
  37. unsigned long mem, size_t size);
  38. void *sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
  39. const struct sh_mobile_meram_cfg *cfg,
  40. unsigned int xres, unsigned int yres,
  41. unsigned int pixelformat,
  42. unsigned int *pitch);
  43. void sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data);
  44. void sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
  45. unsigned long base_addr_y,
  46. unsigned long base_addr_c,
  47. unsigned long *icb_addr_y,
  48. unsigned long *icb_addr_c);
  49. #else
  50. static inline unsigned long
  51. sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev, size_t size)
  52. {
  53. return 0;
  54. }
  55. static inline void
  56. sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
  57. unsigned long mem, size_t size)
  58. {
  59. }
  60. static inline void *
  61. sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
  62. const struct sh_mobile_meram_cfg *cfg,
  63. unsigned int xres, unsigned int yres,
  64. unsigned int pixelformat,
  65. unsigned int *pitch)
  66. {
  67. return ERR_PTR(-ENODEV);
  68. }
  69. static inline void
  70. sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data)
  71. {
  72. }
  73. static inline void
  74. sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
  75. unsigned long base_addr_y,
  76. unsigned long base_addr_c,
  77. unsigned long *icb_addr_y,
  78. unsigned long *icb_addr_c)
  79. {
  80. }
  81. #endif
  82. #endif /* __VIDEO_SH_MOBILE_MERAM_H__ */