1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * TI OMAP4 ISS V4L2 Driver - ISP RESIZER module
4  *
5  * Copyright (C) 2012 Texas Instruments, Inc.
6  *
7  * Author: Sergio Aguirre <sergio.a.aguirre@gmail.com>
8  */
9 
10 #ifndef OMAP4_ISS_RESIZER_H
11 #define OMAP4_ISS_RESIZER_H
12 
13 #include "iss_video.h"
14 
15 enum resizer_input_entity {
16 	RESIZER_INPUT_NONE,
17 	RESIZER_INPUT_IPIPE,
18 	RESIZER_INPUT_IPIPEIF
19 };
20 
21 #define RESIZER_OUTPUT_MEMORY			BIT(0)
22 
23 /* Sink and source RESIZER pads */
24 #define RESIZER_PAD_SINK			0
25 #define RESIZER_PAD_SOURCE_MEM			1
26 #define RESIZER_PADS_NUM			2
27 
28 /*
29  * struct iss_resizer_device - Structure for the RESIZER module to store its own
30  *			    information
31  * @subdev: V4L2 subdevice
32  * @pads: Sink and source media entity pads
33  * @formats: Active video formats
34  * @input: Active input
35  * @output: Active outputs
36  * @video_out: Output video node
37  * @error: A hardware error occurred during capture
38  * @state: Streaming state
39  * @wait: Wait queue used to stop the module
40  * @stopping: Stopping state
41  */
42 struct iss_resizer_device {
43 	struct v4l2_subdev subdev;
44 	struct media_pad pads[RESIZER_PADS_NUM];
45 	struct v4l2_mbus_framefmt formats[RESIZER_PADS_NUM];
46 
47 	enum resizer_input_entity input;
48 	unsigned int output;
49 	struct iss_video video_out;
50 	unsigned int error;
51 
52 	enum iss_pipeline_stream_state state;
53 	wait_queue_head_t wait;
54 	atomic_t stopping;
55 };
56 
57 struct iss_device;
58 
59 int omap4iss_resizer_init(struct iss_device *iss);
60 int omap4iss_resizer_create_links(struct iss_device *iss);
61 void omap4iss_resizer_cleanup(struct iss_device *iss);
62 int omap4iss_resizer_register_entities(struct iss_resizer_device *resizer,
63 				       struct v4l2_device *vdev);
64 void omap4iss_resizer_unregister_entities(struct iss_resizer_device *resizer);
65 
66 int omap4iss_resizer_busy(struct iss_resizer_device *resizer);
67 void omap4iss_resizer_isr(struct iss_resizer_device *resizer, u32 events);
68 void omap4iss_resizer_restore_context(struct iss_device *iss);
69 void omap4iss_resizer_max_rate(struct iss_resizer_device *resizer,
70 			       unsigned int *max_rate);
71 
72 #endif	/* OMAP4_ISS_RESIZER_H */
73