1 /* SPDX-License-Identifier: GPL-2.0-only */
5 * TI OMAP3 ISP - Resizer module
7 * Copyright (C) 2010 Nokia Corporation
8 * Copyright (C) 2009 Texas Instruments, Inc
10 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 * Sakari Ailus <sakari.ailus@iki.fi>
14 #ifndef OMAP3_ISP_RESIZER_H
15 #define OMAP3_ISP_RESIZER_H
17 #include <linux/spinlock.h>
18 #include <linux/types.h>
21 * Constants for filter coefficients count
26 * struct isprsz_coef - Structure for resizer filter coefficients.
27 * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap
29 * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap
31 * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap
33 * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap
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];
44 /* Chrominance horizontal algorithm */
45 enum resizer_chroma_algo
{
46 RSZ_THE_SAME
= 0, /* Chrominance the same as Luminance */
47 RSZ_BILINEAR
= 1, /* Chrominance uses bilinear interpolation */
50 /* Resizer input type select */
51 enum resizer_colors_type
{
52 RSZ_YUV422
= 0, /* YUV422 color is interleaved */
53 RSZ_COLOR8
= 1, /* Color separate data on 8 bits */
57 * Structure for horizontal and vertical resizing value
59 struct resizer_ratio
{
65 * Structure for luminance enhancer parameters.
67 struct resizer_luma_yenh
{
68 u8 algo
; /* algorithm select. */
69 u8 gain
; /* maximum gain. */
70 u8 slope
; /* slope. */
71 u8 core
; /* core offset. */
74 enum resizer_input_entity
{
76 RESIZER_INPUT_VP
, /* input video port - prev or ccdc */
80 /* Sink and source resizer pads */
81 #define RESZ_PAD_SINK 0
82 #define RESZ_PAD_SOURCE 1
83 #define RESZ_PADS_NUM 2
86 * struct isp_res_device - OMAP3 ISP resizer module
87 * @lock: Protects formats and crop rectangles between set_selection and IRQ
88 * @crop.request: Crop rectangle requested by the user
89 * @crop.active: Active crop rectangle (based on hardware requirements)
91 struct 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
];
96 enum resizer_input_entity input
;
97 struct isp_video video_in
;
98 struct isp_video video_out
;
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
;
104 unsigned int applycrop
:1;
105 enum isp_pipeline_stream_state state
;
106 wait_queue_head_t wait
;
111 struct v4l2_rect request
;
112 struct v4l2_rect active
;
118 int omap3isp_resizer_init(struct isp_device
*isp
);
119 void omap3isp_resizer_cleanup(struct isp_device
*isp
);
121 int omap3isp_resizer_register_entities(struct isp_res_device
*res
,
122 struct v4l2_device
*vdev
);
123 void omap3isp_resizer_unregister_entities(struct isp_res_device
*res
);
124 void omap3isp_resizer_isr_frame_sync(struct isp_res_device
*res
);
125 void omap3isp_resizer_isr(struct isp_res_device
*isp_res
);
127 void omap3isp_resizer_max_rate(struct isp_res_device
*res
,
128 unsigned int *max_rate
);
130 void omap3isp_resizer_suspend(struct isp_res_device
*isp_res
);
132 void omap3isp_resizer_resume(struct isp_res_device
*isp_res
);
134 int omap3isp_resizer_busy(struct isp_res_device
*isp_res
);
136 #endif /* OMAP3_ISP_RESIZER_H */