aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/samsung/mfc5x/mfc_dev.h
blob: bb2095cdb5bfb4c6eb5ea8d99859fd6a5759b0fc (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
 * linux/drivers/media/video/samsung/mfc5x/mfc_dev.h
 *
 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * Driver interface for Samsung MFC (Multi Function Codec - FIMV) driver
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef __MFC_DEV_H
#define __MFC_DEV_H __FILE__

#include <linux/mutex.h>
#include <linux/firmware.h>

#include "mfc_inst.h"

#define MFC_DEV_NAME	"s3c-mfc"
#define MFC_NAME_LEN	16

struct mfc_reg {
	resource_size_t	rsrc_start;
	resource_size_t	rsrc_len;
	void __iomem	*base;
};

struct mfc_pm {
	char		pd_name[MFC_NAME_LEN];
	char		clk_name[MFC_NAME_LEN];
	struct clk	*clock;
	atomic_t	power;
#ifdef CONFIG_PM_RUNTIME
	struct device	*device;
#endif
};

#ifdef CONFIG_VIDEO_MFC_VCM_UMP
struct mfc_vcm {
	struct vcm	*sysmmu_vcm;
	unsigned long	*sysmmu_pgd;
};
#endif

struct mfc_mem {
	unsigned long	base;	/* phys. or virt. addr for MFC	*/
	size_t		size;	/* total size			*/
	unsigned char	*addr;	/* kernel virtual address space */
#if (defined(SYSMMU_MFC_ON) && !defined(CONFIG_VIDEO_MFC_VCM_UMP) && !defined(CONFIG_S5P_VMEM))
	void		*vmalloc_addr;	/* not aligned vmalloc alloc. addr */
#endif
#ifdef CONFIG_VIDEO_MFC_VCM_UMP
	struct vcm_res	*vcm_s;
#endif
};

struct mfc_fw {
	const struct firmware	*info;
	int			requesting;
	int			state;
	int			ver;
#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
	struct vcm_mmu_res	*vcm_s;
	struct vcm_res		*vcm_k;
#elif defined(CONFIG_S5P_VMEM)
	int			vmem_cookie;
#endif
};

struct mfc_dev {
	char			name[MFC_NAME_LEN];
	struct mfc_reg		reg;
	int			irq;
	struct mfc_pm		pm;

#ifdef CONFIG_VIDEO_MFC_VCM_UMP
	struct mfc_vcm		vcm_info;
#endif
	int			mem_ports;
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
	struct mfc_mem		mem_infos[MFC_MAX_MEM_CHUNK_NUM];
	struct mfc_mem		drm_info;
#else
	struct mfc_mem		mem_infos[MFC_MAX_MEM_PORT_NUM];
#endif

	atomic_t		inst_cnt;
	struct mfc_inst_ctx	*inst_ctx[MFC_MAX_INSTANCE_NUM];

	struct mutex		lock;
	wait_queue_head_t	wait_sys;
	int			irq_sys;
	/* FIXME: remove or use 2 codec channel */
	wait_queue_head_t	wait_codec[2];
	int			irq_codec[2];

	struct mfc_fw		fw;

#if defined(CONFIG_DMA_CMA) && defined(CONFIG_USE_MFC_CMA)
	/* NEW CMA */
	void            *cma_vaddr;
	dma_addr_t      cma_dma_addr;
#endif

	struct s5p_vcm_mmu	*_vcm_mmu;

	struct device		*device;
#if defined(CONFIG_BUSFREQ_OPP) || defined(CONFIG_BUSFREQ_LOCK_WRAPPER)
	struct device           *bus_dev;
#endif
#if defined(CONFIG_BUSFREQ)
	atomic_t		busfreq_lock_cnt; /* Bus frequency Lock count */
#endif
#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_EXYNOS4_CPUFREQ)
	atomic_t		cpufreq_lock_cnt; /* CPU frequency Lock count */
	int				cpufreq_level; /* CPU frequency leve */
#endif
#ifdef CONFIG_BUSFREQ_OPP
	atomic_t  dmcthreshold_lock_cnt; /* dmc max threshold Lock count */
#endif
#if SUPPORT_SLICE_ENCODING
	int			slice_encoding_flag;
	wait_queue_head_t	wait_slice;
	int			slice_sys;
	int			wait_slice_timeout;
	int			frame_working_flag;
	wait_queue_head_t	wait_frame;
	int			frame_sys;
	int			wait_frame_timeout;
#endif
};

#endif /* __MFC_DEV_H */