#ifndef __SCALE_H__ #define __SCALE_H__ #include #include typedef unsigned char u8_t; typedef unsigned short u16_t; typedef unsigned int u32_t; #define AXI_SCALE_EN 0x0 #define AXI_SCALE_WB_START 0x4 #define AXI_SCALE_CONTROL 0x8 #define AXI_SCALE_VIDEO_ADDR1 0xC #define AXI_SCALE_VIDEO_ADDR2 0x10 #define AXI_SCALE_VIDEO_ADDR3 0x14 #define AXI_SCALE_VIDEO_SOURCE_SIZE 0x18 #define AXI_SCALE_VIDEO_WINDOW_POINT 0x1c #define AXI_SCALE_VIDEO_WINDOW_SIZE 0x20 #define AXI_SCALE_VIDEO_SIZE 0x24 #define AXI_SCALE_SCALE_CTL 0x28 #define AXI_SCALE_SCALE_VXMOD 0x2c #define AXI_SCALE_SCALE_CTL0 0x30 #define AXI_SCALE_SCALE_CTL1 0x34 #define AXI_SCALE_RIGHT_BOTTOM_CUT_NUM 0x38 #define AXI_SCALE_SCALE_CTL2 0x3c #define AXI_SCALE_SCALE_CTL3 0x40 #define AXI_SCALE_SCALE_CTL4 0x44 #define AXI_SCALE_HSCAL_COS_VALUE 0x48 #define AXI_SCALE_WB_DEST_YADDR 0x4c #define AXI_SCALE_WB_DEST_UADDR 0x50 #define AXI_SCALE_WB_DEST_VADDR 0x54 #define AXI_SCALE_WB_DATA_HSIZE_RAM 0x58 #define AXI_SCALE_RESERVED 0x5c #define AXI_SCALE_INT_CTL 0x60 #define AXI_SCALE_INT_STATUS 0x64 #define AXI_SCALE_CLCD_INT_CLR 0x68 //#define AXI_SCALE_WR_Y_VCNT 0x6C //#define AXI_SCALE_WR_UV_VCNT 0x70 #define AXI_SCALE_VFILTER_CLR 0x70 #define AXI_SCALE_VFILTER_COEFF 0x74 #define AXI_SCALE_VBY_SEL 0x78 struct ark_scale_context { int irq; struct device *dev; void __iomem *mmio_base; void __iomem *sys_base; struct clk *clk; spinlock_t lock; wait_queue_head_t waitq; int busy; }; struct ark_scale_device { const char *driver_name; const char *name; int major; int minor_start; int minor_num; int num; int irq; struct cdev cdev; struct class *scale_class; struct device *scale_device; struct fasync_struct *async_queue_wb; struct ark_scale_context context; }; struct ark_scale_param { unsigned int iyaddr; unsigned int iuaddr; unsigned int ivaddr; unsigned int iformat; unsigned int iwidth; unsigned int iheight; unsigned int ix; unsigned int iy; unsigned int iwinwidth; unsigned int iwinheight; unsigned int left_cut; unsigned int right_cut; unsigned int up_cut; unsigned int bottom_cut; unsigned int owidth; unsigned int oheight; unsigned int oyaddr; unsigned int ouaddr; unsigned int ovaddr; }; enum scale_result { SCALE_RET_OK = 0, SCALE_RET_TIMEOUT = 1, SCALE_RET_INV_PARA = 2, SCALE_RET_DATA_ERROR = 2, SCALE_RET_HW_ERROR = 4, SCALE_RET_SYSTEM_ERROR = 5, SCALE_RET_HW_RESET = 6, SCALE_RET_FAILED = 7, SCALE_RET_MALLOC_FAILED = 8, SCALE_RET_COMPARE_NG = 9 }; enum scale_format { SCALE_FORMAT_YUV422 = 0, SCALE_FORMAT_Y_UV422 = (1 << 8) | SCALE_FORMAT_YUV422, SCALE_FORMAT_YUV420 = 1, SCALE_FORMAT_Y_UV420 = (1 << 8) | SCALE_FORMAT_YUV420, SCALE_FORMAT_YUYV = 2, SCALE_FORMAT_YVYU = (1 << 8) | SCALE_FORMAT_YUYV, SCALE_FORMAT_UYVY = (2 << 8) | SCALE_FORMAT_YUYV, SCALE_FORMAT_VYUY = (3 << 8) | SCALE_FORMAT_YUYV, SCALE_FORMAT_YUV = 3, }; /************************************************************************* * Ioctl command definition *************************************************************************/ #define SCALE_IOCTL_BASE 0x99 #define SCALE_IOCTL_START _IOW(SCALE_IOCTL_BASE, 0, struct ark_scale_param) #define SCALE_IOCTL_START_NO_WAIT _IOW(SCALE_IOCTL_BASE, 1, struct ark_scale_param) #define SCALE_IOCTL_WAIT_IDLE _IO(SCALE_IOCTL_BASE, 2) #define SCALE_IOCTL_START_4CH_DISPLAY _IOW(SCALE_IOCTL_BASE, 3, struct ark_scale_param) void scale_softreset(struct ark_scale_context *context); int ark_scale_start(struct ark_scale_context *context, struct ark_scale_param *param); int ark_scale_start_nowait(struct ark_scale_context *context, struct ark_scale_param *param); int ark_scale_4ch_display(struct ark_scale_context *context, struct ark_scale_param *param, int display_width); int ark_scale_wait_idle(struct ark_scale_context *context); int ark_scale_dev_init(struct ark_scale_context *context); irqreturn_t ark_scale_intr_handler(int irq, void *dev_id); #endif