[media] v4l: add G2D driver for s5p device family
[deliverable/linux.git] / drivers / media / video / s5p-g2d / g2d.h
CommitLineData
91884734
KD
1/*
2 * Samsung S5P G2D - 2D Graphics Accelerator Driver
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * Kamil Debski, <k.debski@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version
11 */
12
13#include <media/v4l2-device.h>
14#include <media/v4l2-ctrls.h>
15
16#define G2D_NAME "s5p-g2d"
17
18struct g2d_dev {
19 struct v4l2_device v4l2_dev;
20 struct v4l2_m2m_dev *m2m_dev;
21 struct video_device *vfd;
22 struct mutex mutex;
23 spinlock_t irqlock;
24 atomic_t num_inst;
25 struct vb2_alloc_ctx *alloc_ctx;
26 struct resource *res_regs;
27 void __iomem *regs;
28 struct clk *clk;
29 struct clk *gate;
30 struct g2d_ctx *curr;
31 int irq;
32 wait_queue_head_t irq_queue;
33};
34
35struct g2d_frame {
36 /* Original dimensions */
37 u32 width;
38 u32 height;
39 /* Crop size */
40 u32 c_width;
41 u32 c_height;
42 /* Offset */
43 u32 o_width;
44 u32 o_height;
45 /* Image format */
46 struct g2d_fmt *fmt;
47 /* Variables that can calculated once and reused */
48 u32 stride;
49 u32 bottom;
50 u32 right;
51 u32 size;
52};
53
54struct g2d_ctx {
55 struct v4l2_fh fh;
56 struct g2d_dev *dev;
57 struct v4l2_m2m_ctx *m2m_ctx;
58 struct g2d_frame in;
59 struct g2d_frame out;
60 struct v4l2_ctrl_handler ctrl_handler;
61 u32 rop;
62};
63
64struct g2d_fmt {
65 char *name;
66 u32 fourcc;
67 int depth;
68 u32 hw;
69};
70
71
72void g2d_reset(struct g2d_dev *d);
73void g2d_set_src_size(struct g2d_dev *d, struct g2d_frame *f);
74void g2d_set_src_addr(struct g2d_dev *d, dma_addr_t a);
75void g2d_set_dst_size(struct g2d_dev *d, struct g2d_frame *f);
76void g2d_set_dst_addr(struct g2d_dev *d, dma_addr_t a);
77void g2d_start(struct g2d_dev *d);
78void g2d_clear_int(struct g2d_dev *d);
79void g2d_set_rop4(struct g2d_dev *d, u32 r);
80u32 g2d_cmd_stretch(u32 e);
81void g2d_set_cmd(struct g2d_dev *d, u32 c);
82
83
This page took 0.034896 seconds and 5 git commands to generate.