blob: 062e6e7f955c42ebfc8d8d98bfc17e8e2755d031 [file] [log] [blame]
Damian7caa4342011-05-18 11:10:07 +00001#ifndef __VIDEO_SH_MOBILE_MERAM_H__
2#define __VIDEO_SH_MOBILE_MERAM_H__
3
4/* For sh_mobile_meram_info.addr_mode */
5enum {
6 SH_MOBILE_MERAM_MODE0 = 0,
7 SH_MOBILE_MERAM_MODE1
8};
9
10enum {
11 SH_MOBILE_MERAM_PF_NV = 0,
Damian3fedd2a2011-05-18 11:10:08 +000012 SH_MOBILE_MERAM_PF_RGB,
13 SH_MOBILE_MERAM_PF_NV24
Damian7caa4342011-05-18 11:10:07 +000014};
15
16
17struct sh_mobile_meram_priv;
Damian7caa4342011-05-18 11:10:07 +000018
Laurent Pinchart48110052011-12-12 16:36:13 +010019/*
20 * struct sh_mobile_meram_info - MERAM platform data
21 * @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO)
22 */
Damian7caa4342011-05-18 11:10:07 +000023struct sh_mobile_meram_info {
24 int addr_mode;
Laurent Pinchart48110052011-12-12 16:36:13 +010025 u32 reserved_icbs;
Damian7caa4342011-05-18 11:10:07 +000026 struct sh_mobile_meram_priv *priv;
27 struct platform_device *pdev;
28};
29
30/* icb config */
Laurent Pinchartd272f422011-09-19 11:40:31 +020031struct sh_mobile_meram_icb_cfg {
Laurent Pinchartd272f422011-09-19 11:40:31 +020032 unsigned int meram_size; /* MERAM Buffer Size to use */
Damian7caa4342011-05-18 11:10:07 +000033};
34
35struct sh_mobile_meram_cfg {
Laurent Pinchart2a618e02011-09-19 11:40:31 +020036 struct sh_mobile_meram_icb_cfg icb[2];
Damian7caa4342011-05-18 11:10:07 +000037};
38
Laurent Pinchart6e729b42012-03-15 12:40:47 +010039#if defined(CONFIG_FB_SH_MOBILE_MERAM) || \
40 defined(CONFIG_FB_SH_MOBILE_MERAM_MODULE)
Laurent Pinchart239921e2012-03-15 13:18:17 +010041unsigned long sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev,
42 size_t size);
43void sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
44 unsigned long mem, size_t size);
Laurent Pinchart6e729b42012-03-15 12:40:47 +010045void *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);
50void sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data);
51void 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 Pinchart239921e2012-03-15 13:18:17 +010057static inline unsigned long
58sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev, size_t size)
59{
60 return 0;
61}
62
63static inline void
64sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
65 unsigned long mem, size_t size)
66{
67}
68
Laurent Pinchart6e729b42012-03-15 12:40:47 +010069static inline void *
70sh_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}
Damian7caa4342011-05-18 11:10:07 +000078
Laurent Pinchart6e729b42012-03-15 12:40:47 +010079static inline void
80sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data)
81{
82}
83
84static inline void
85sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
Laurent Pinchartcdf88b92011-11-22 00:56:58 +010086 unsigned long base_addr_y,
87 unsigned long base_addr_c,
88 unsigned long *icb_addr_y,
Laurent Pinchart6e729b42012-03-15 12:40:47 +010089 unsigned long *icb_addr_c)
90{
91}
92#endif
Damian7caa4342011-05-18 11:10:07 +000093
94#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */