brintos

brintos / linux-shallow public Read only

0
0
Text · 3.6 KiB · 28cc899 Raw
137 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * ispresizer.h4 *5 * TI OMAP3 ISP - Resizer module6 *7 * Copyright (C) 2010 Nokia Corporation8 * Copyright (C) 2009 Texas Instruments, Inc9 *10 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>11 *	     Sakari Ailus <sakari.ailus@iki.fi>12 */13 14#ifndef OMAP3_ISP_RESIZER_H15#define OMAP3_ISP_RESIZER_H16 17#include <linux/spinlock.h>18#include <linux/types.h>19 20/*21 * Constants for filter coefficients count22 */23#define COEFF_CNT		3224 25/*26 * struct isprsz_coef - Structure for resizer filter coefficients.27 * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap28 *			mode (.5x-4x)29 * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap30 *			mode (.5x-4x)31 * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap32 *			mode (.25x-.5x)33 * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap34 *			mode (.25x-.5x)35 */36struct isprsz_coef {37	u16 h_filter_coef_4tap[32];38	u16 v_filter_coef_4tap[32];39	/* Every 8th value is a dummy value in the following arrays: */40	u16 h_filter_coef_7tap[32];41	u16 v_filter_coef_7tap[32];42};43 44/* Chrominance horizontal algorithm */45enum resizer_chroma_algo {46	RSZ_THE_SAME = 0,	/* Chrominance the same as Luminance */47	RSZ_BILINEAR = 1,	/* Chrominance uses bilinear interpolation */48};49 50/* Resizer input type select */51enum resizer_colors_type {52	RSZ_YUV422 = 0,		/* YUV422 color is interleaved */53	RSZ_COLOR8 = 1,		/* Color separate data on 8 bits */54};55 56/*57 * Structure for horizontal and vertical resizing value58 */59struct resizer_ratio {60	u32 horz;61	u32 vert;62};63 64/*65 * Structure for luminance enhancer parameters.66 */67struct resizer_luma_yenh {68	u8 algo;		/* algorithm select. */69	u8 gain;		/* maximum gain. */70	u8 slope;		/* slope. */71	u8 core;		/* core offset. */72};73 74enum resizer_input_entity {75	RESIZER_INPUT_NONE,76	RESIZER_INPUT_VP,	/* input video port - prev or ccdc */77	RESIZER_INPUT_MEMORY,78};79 80/* Sink and source resizer pads */81#define RESZ_PAD_SINK			082#define RESZ_PAD_SOURCE			183#define RESZ_PADS_NUM			284 85/*86 * struct isp_res_device - OMAP3 ISP resizer module87 * @lock: Protects formats and crop rectangles between set_selection and IRQ88 * @crop.request: Crop rectangle requested by the user89 * @crop.active: Active crop rectangle (based on hardware requirements)90 */91struct isp_res_device {92	struct v4l2_subdev subdev;93	struct media_pad pads[RESZ_PADS_NUM];94	struct v4l2_mbus_framefmt formats[RESZ_PADS_NUM];95 96	enum resizer_input_entity input;97	struct isp_video video_in;98	struct isp_video video_out;99 100	u32 addr_base;   /* stored source buffer address in memory mode */101	u32 crop_offset; /* additional offset for crop in memory mode */102	struct resizer_ratio ratio;103	int pm_state;104	unsigned int applycrop:1;105	enum isp_pipeline_stream_state state;106	wait_queue_head_t wait;107	atomic_t stopping;108	spinlock_t lock;109 110	struct {111		struct v4l2_rect request;112		struct v4l2_rect active;113	} crop;114};115 116struct isp_device;117 118int omap3isp_resizer_init(struct isp_device *isp);119void omap3isp_resizer_cleanup(struct isp_device *isp);120 121int omap3isp_resizer_register_entities(struct isp_res_device *res,122				       struct v4l2_device *vdev);123void omap3isp_resizer_unregister_entities(struct isp_res_device *res);124void omap3isp_resizer_isr_frame_sync(struct isp_res_device *res);125void omap3isp_resizer_isr(struct isp_res_device *isp_res);126 127void omap3isp_resizer_max_rate(struct isp_res_device *res,128			       unsigned int *max_rate);129 130void omap3isp_resizer_suspend(struct isp_res_device *isp_res);131 132void omap3isp_resizer_resume(struct isp_res_device *isp_res);133 134int omap3isp_resizer_busy(struct isp_res_device *isp_res);135 136#endif	/* OMAP3_ISP_RESIZER_H */137