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