blob: f4efc21e205d3567018de73ec3f2680e38bacee5 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Damian7caa4342011-05-18 11:10:07 +00002#ifndef __VIDEO_SH_MOBILE_MERAM_H__
3#define __VIDEO_SH_MOBILE_MERAM_H__
4
5/* For sh_mobile_meram_info.addr_mode */
6enum {
7 SH_MOBILE_MERAM_MODE0 = 0,
8 SH_MOBILE_MERAM_MODE1
9};
10
11enum {
12 SH_MOBILE_MERAM_PF_NV = 0,
Damian3fedd2a2011-05-18 11:10:08 +000013 SH_MOBILE_MERAM_PF_RGB,
14 SH_MOBILE_MERAM_PF_NV24
Damian7caa4342011-05-18 11:10:07 +000015};
16
17
18struct sh_mobile_meram_priv;
Damian7caa4342011-05-18 11:10:07 +000019
Laurent Pinchart48110052011-12-12 16:36:13 +010020/*
21 * struct sh_mobile_meram_info - MERAM platform data
22 * @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO)
23 */
Damian7caa4342011-05-18 11:10:07 +000024struct sh_mobile_meram_info {
25 int addr_mode;
Laurent Pinchart48110052011-12-12 16:36:13 +010026 u32 reserved_icbs;
Damian7caa4342011-05-18 11:10:07 +000027 struct sh_mobile_meram_priv *priv;
28 struct platform_device *pdev;
29};
30
31/* icb config */
Laurent Pinchartd272f422011-09-19 11:40:31 +020032struct sh_mobile_meram_icb_cfg {
Laurent Pinchartd272f422011-09-19 11:40:31 +020033 unsigned int meram_size; /* MERAM Buffer Size to use */
Damian7caa4342011-05-18 11:10:07 +000034};
35
36struct sh_mobile_meram_cfg {
Laurent Pinchart2a618e02011-09-19 11:40:31 +020037 struct sh_mobile_meram_icb_cfg icb[2];
Damian7caa4342011-05-18 11:10:07 +000038};
39
Laurent Pinchart6e729b42012-03-15 12:40:47 +010040#if defined(CONFIG_FB_SH_MOBILE_MERAM) || \
41 defined(CONFIG_FB_SH_MOBILE_MERAM_MODULE)
Laurent Pinchart239921e2012-03-15 13:18:17 +010042unsigned long sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev,
43 size_t size);
44void sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
45 unsigned long mem, size_t size);
Laurent Pinchart6e729b42012-03-15 12:40:47 +010046void *sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
47 const struct sh_mobile_meram_cfg *cfg,
48 unsigned int xres, unsigned int yres,
49 unsigned int pixelformat,
50 unsigned int *pitch);
51void sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data);
52void sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
53 unsigned long base_addr_y,
54 unsigned long base_addr_c,
55 unsigned long *icb_addr_y,
56 unsigned long *icb_addr_c);
57#else
Laurent Pinchart239921e2012-03-15 13:18:17 +010058static inline unsigned long
59sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev, size_t size)
60{
61 return 0;
62}
63
64static inline void
65sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
66 unsigned long mem, size_t size)
67{
68}
69
Laurent Pinchart6e729b42012-03-15 12:40:47 +010070static inline void *
71sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
72 const struct sh_mobile_meram_cfg *cfg,
73 unsigned int xres, unsigned int yres,
74 unsigned int pixelformat,
75 unsigned int *pitch)
76{
77 return ERR_PTR(-ENODEV);
78}
Damian7caa4342011-05-18 11:10:07 +000079
Laurent Pinchart6e729b42012-03-15 12:40:47 +010080static inline void
81sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data)
82{
83}
84
85static inline void
86sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
Laurent Pinchartcdf88b92011-11-22 00:56:58 +010087 unsigned long base_addr_y,
88 unsigned long base_addr_c,
89 unsigned long *icb_addr_y,
Laurent Pinchart6e729b42012-03-15 12:40:47 +010090 unsigned long *icb_addr_c)
91{
92}
93#endif
Damian7caa4342011-05-18 11:10:07 +000094
95#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */