root/drivers/media/platform/s5p-g2d/g2d.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-or-later */
   2 /*
   3  * Samsung S5P G2D - 2D Graphics Accelerator Driver
   4  *
   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 3
  15 #define TYPE_G2D_4X 4
  16 
  17 struct 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 
  32 struct 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 
  51 struct 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 
  63 struct g2d_fmt {
  64         u32     fourcc;
  65         int     depth;
  66         u32     hw;
  67 };
  68 
  69 struct g2d_variant {
  70         unsigned short hw_rev;
  71 };
  72 
  73 void g2d_reset(struct g2d_dev *d);
  74 void g2d_set_src_size(struct g2d_dev *d, struct g2d_frame *f);
  75 void g2d_set_src_addr(struct g2d_dev *d, dma_addr_t a);
  76 void g2d_set_dst_size(struct g2d_dev *d, struct g2d_frame *f);
  77 void g2d_set_dst_addr(struct g2d_dev *d, dma_addr_t a);
  78 void g2d_start(struct g2d_dev *d);
  79 void g2d_clear_int(struct g2d_dev *d);
  80 void g2d_set_rop4(struct g2d_dev *d, u32 r);
  81 void g2d_set_flip(struct g2d_dev *d, u32 r);
  82 void g2d_set_v41_stretch(struct g2d_dev *d,
  83                         struct g2d_frame *src, struct g2d_frame *dst);
  84 void g2d_set_cmd(struct g2d_dev *d, u32 c);

/* [<][>][^][v][top][bottom][index][help] */