1 /* 2 * linux-5.4/drivers/media/platform/sunxi-vin/vin-vipp/sunxi_scaler.h 3 * 4 * Copyright (c) 2007-2017 Allwinnertech Co., Ltd. 5 * 6 * This software is licensed under the terms of the GNU General Public 7 * License version 2, as published by the Free Software Foundation, and 8 * may be copied, distributed, and modified under those terms. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 */ 16 17 #ifndef _SUNXI_SCALER_H_ 18 #define _SUNXI_SCALER_H_ 19 #include <linux/videodev2.h> 20 #include <media/v4l2-ctrls.h> 21 #include <media/v4l2-subdev.h> 22 #include "vipp_reg.h" 23 24 #define VIPP_ONLY_SHRINK 1 25 26 enum scaler_pad { 27 SCALER_PAD_SINK, 28 SCALER_PAD_SOURCE, 29 SCALER_PAD_NUM, 30 }; 31 32 struct scaler_para { 33 u32 xratio; 34 u32 yratio; 35 u32 w_shift; 36 u32 width; 37 u32 height; 38 }; 39 40 struct scaler_dev { 41 struct v4l2_subdev subdev; 42 struct media_pad scaler_pads[SCALER_PAD_NUM]; 43 struct v4l2_mbus_framefmt formats[SCALER_PAD_NUM]; 44 struct platform_device *pdev; 45 struct mutex subdev_lock; 46 struct vin_mm vipp_reg; 47 struct vin_mm osd_para; 48 struct vin_mm osd_stat; 49 struct { 50 struct v4l2_rect request; 51 struct v4l2_rect active; 52 } crop; 53 struct scaler_para para; 54 void __iomem *base; 55 unsigned char is_empty; 56 unsigned char id; 57 }; 58 59 struct v4l2_subdev *sunxi_scaler_get_subdev(int id); 60 int sunxi_vipp_get_osd_stat(int id, unsigned int *stat); 61 int sunxi_scaler_platform_register(void); 62 void sunxi_scaler_platform_unregister(void); 63 64 #endif /*_SUNXI_SCALER_H_*/ 65