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