summaryrefslogtreecommitdiff
path: root/drivers/video/sh_mobile_meram.h
blob: 82c54fbce8bdad2cb9cbe07d9840fc1412beeea4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef __sh_mobile_meram_h__
#define __sh_mobile_meram_h__

#include <linux/mutex.h>
#include <video/sh_mobile_meram.h>

/*
 * MERAM private
 */

#define MERAM_ICB_Y 0x1
#define MERAM_ICB_C 0x2

/* MERAM cache size */
#define SH_MOBILE_MERAM_ICB_NUM		32

#define SH_MOBILE_MERAM_CACHE_OFFSET(p)	((p) >> 16)
#define SH_MOBILE_MERAM_CACHE_SIZE(p)	((p) & 0xffff)

struct sh_mobile_meram_priv {
	void __iomem	*base;
	struct mutex	lock;
	unsigned long	used_icb;
	int		used_meram_cache_regions;
	unsigned long	used_meram_cache[SH_MOBILE_MERAM_ICB_NUM];
};

int sh_mobile_meram_alloc_icb(const struct sh_mobile_meram_cfg *cfg,
		   int xres,
		   int yres,
		   unsigned int base_addr,
		   int yuv_mode,
		   int *marker_icb,
		   int *out_pitch);

void sh_mobile_meram_free_icb(int marker_icb);

#define SH_MOBILE_MERAM_START(ind, ab) \
	(0xC0000000 | ((ab & 0x1) << 23) | ((ind & 0x1F) << 24))

#endif /* !__sh_mobile_meram_h__ */