brintos

brintos / linux-shallow public Read only

0
0
Text · 1.8 KiB · c2309c1 Raw
85 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 * Samsung S5P G2D - 2D Graphics Accelerator Driver4 *5 * Copyright (c) 2011 Samsung Electronics Co., Ltd.6 * Kamil Debski, <k.debski@samsung.com>7 */8 9#include <linux/platform_device.h>10#include <media/v4l2-device.h>11#include <media/v4l2-ctrls.h>12 13#define G2D_NAME "s5p-g2d"14#define TYPE_G2D_3X 315#define TYPE_G2D_4X 416 17struct g2d_dev {18	struct v4l2_device	v4l2_dev;19	struct v4l2_m2m_dev	*m2m_dev;20	struct video_device	*vfd;21	struct mutex		mutex;22	spinlock_t		ctrl_lock;23	atomic_t		num_inst;24	void __iomem		*regs;25	struct clk		*clk;26	struct clk		*gate;27	struct g2d_ctx		*curr;28	struct g2d_variant	*variant;29	int irq;30};31 32struct g2d_frame {33	/* Original dimensions */34	u32	width;35	u32	height;36	/* Crop size */37	u32	c_width;38	u32	c_height;39	/* Offset */40	u32	o_width;41	u32	o_height;42	/* Image format */43	struct g2d_fmt *fmt;44	/* Variables that can calculated once and reused */45	u32	stride;46	u32	bottom;47	u32	right;48	u32	size;49};50 51struct g2d_ctx {52	struct v4l2_fh fh;53	struct g2d_dev		*dev;54	struct g2d_frame	in;55	struct g2d_frame	out;56	struct v4l2_ctrl	*ctrl_hflip;57	struct v4l2_ctrl	*ctrl_vflip;58	struct v4l2_ctrl_handler ctrl_handler;59	u32 rop;60	u32 flip;61};62 63struct g2d_fmt {64	u32	fourcc;65	int	depth;66	u32	hw;67};68 69struct g2d_variant {70	unsigned short hw_rev;71};72 73void g2d_reset(struct g2d_dev *d);74void g2d_set_src_size(struct g2d_dev *d, struct g2d_frame *f);75void g2d_set_src_addr(struct g2d_dev *d, dma_addr_t a);76void g2d_set_dst_size(struct g2d_dev *d, struct g2d_frame *f);77void g2d_set_dst_addr(struct g2d_dev *d, dma_addr_t a);78void g2d_start(struct g2d_dev *d);79void g2d_clear_int(struct g2d_dev *d);80void g2d_set_rop4(struct g2d_dev *d, u32 r);81void g2d_set_flip(struct g2d_dev *d, u32 r);82void g2d_set_v41_stretch(struct g2d_dev *d,83			struct g2d_frame *src, struct g2d_frame *dst);84void g2d_set_cmd(struct g2d_dev *d, u32 c);85