summaryrefstree
path: root/kernel/drivers/media/platform/exynos/scaler/scaler-ext.h
blob: 9ac9f9696b2fcb8f65ddf68a1c4e6244d4ba0235 (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
/*
 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 *
 * Header file for Exynos Scaler 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 SCALER_EXT_H_
#define SCALER_EXT_H_

#include <linux/completion.h>
#include <linux/dma-direction.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/miscdevice.h>

#include "scaler.h"

#define SC_EXT_DEV_NAME	"scaler_ext"

enum sc_ext_task_state {
	SC_EXT_BUFSTATE_READY,
	SC_EXT_BUFSTATE_PROCESSING,
	SC_EXT_BUFSTATE_DONE,
	SC_EXT_BUFSTATE_ERROR,
};

struct sc_ext_dma {
	struct dma_buf *dmabuf;
	struct dma_buf_attachment *attachment;
	struct sg_table *sgt;
	dma_addr_t dma_addr;
	int offset;
};

struct sc_ext_format {
	int format;
	int plane_num;
	int vshift;	/* log2(horizontal chroma subsampling factor) */
	int hshift;	/* log2(vertical chroma subsampling factor) */
	int nr_chroma[3];
	const char *name;
};

struct sc_ext_buf {
	uint32_t count;
	const struct sc_ext_format *fmt;
	struct sc_ext_dma dma[MSCL_MAX_PLANES];
};

struct sc_ext_task_data {
	uint32_t cmd[MSCL_NR_CMDS];
	struct sc_ext_buf buf[MSCL_NR_DIRS];
};

struct sc_ext_task {
	uint32_t task_count;
	uint32_t curr_count;
	struct sc_ext_task_data *data;
	struct sc_ext_ctx *xctx;
	struct completion complete;
	enum sc_ext_task_state state;
};

struct sc_ext_dev {
	struct miscdevice misc;
	struct list_head contexts;
	struct device *dev;
	spinlock_t lock_task;
	spinlock_t lock_ctx;
	struct mutex lock_ioctl;
	struct sc_ext_task *current_task;
};

struct sc_ext_ctx {
	struct sc_ctx sc_ctx;
	struct list_head node;
	struct sc_ext_dev *xdev;
	struct sc_ext_task *task;
};

#endif /* SCALER_EXT_H_ */