• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * TI OMAP4 ISS V4L2 Driver - ISP IPIPEIF 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_IPIPEIF_H
15 #define OMAP4_ISS_IPIPEIF_H
16 
17 #include "iss_video.h"
18 
19 enum ipipeif_input_entity {
20 	IPIPEIF_INPUT_NONE,
21 	IPIPEIF_INPUT_CSI2A,
22 	IPIPEIF_INPUT_CSI2B
23 };
24 
25 #define IPIPEIF_OUTPUT_MEMORY			BIT(0)
26 #define IPIPEIF_OUTPUT_VP			BIT(1)
27 
28 /* Sink and source IPIPEIF pads */
29 #define IPIPEIF_PAD_SINK			0
30 #define IPIPEIF_PAD_SOURCE_ISIF_SF		1
31 #define IPIPEIF_PAD_SOURCE_VP			2
32 #define IPIPEIF_PADS_NUM			3
33 
34 /*
35  * struct iss_ipipeif_device - Structure for the IPIPEIF module to store its own
36  *			    information
37  * @subdev: V4L2 subdevice
38  * @pads: Sink and source media entity pads
39  * @formats: Active video formats
40  * @input: Active input
41  * @output: Active outputs
42  * @video_out: Output video node
43  * @error: A hardware error occurred during capture
44  * @alaw: A-law compression enabled (1) or disabled (0)
45  * @lpf: Low pass filter enabled (1) or disabled (0)
46  * @obclamp: Optical-black clamp enabled (1) or disabled (0)
47  * @fpc_en: Faulty pixels correction enabled (1) or disabled (0)
48  * @blcomp: Black level compensation configuration
49  * @clamp: Optical-black or digital clamp configuration
50  * @fpc: Faulty pixels correction configuration
51  * @lsc: Lens shading compensation configuration
52  * @update: Bitmask of controls to update during the next interrupt
53  * @shadow_update: Controls update in progress by userspace
54  * @syncif: Interface synchronization configuration
55  * @vpcfg: Video port configuration
56  * @underrun: A buffer underrun occurred and a new buffer has been queued
57  * @state: Streaming state
58  * @lock: Serializes shadow_update with interrupt handler
59  * @wait: Wait queue used to stop the module
60  * @stopping: Stopping state
61  * @ioctl_lock: Serializes ioctl calls and LSC requests freeing
62  */
63 struct iss_ipipeif_device {
64 	struct v4l2_subdev subdev;
65 	struct media_pad pads[IPIPEIF_PADS_NUM];
66 	struct v4l2_mbus_framefmt formats[IPIPEIF_PADS_NUM];
67 
68 	enum ipipeif_input_entity input;
69 	unsigned int output;
70 	struct iss_video video_out;
71 	unsigned int error;
72 
73 	enum iss_pipeline_stream_state state;
74 	wait_queue_head_t wait;
75 	atomic_t stopping;
76 };
77 
78 struct iss_device;
79 
80 int omap4iss_ipipeif_init(struct iss_device *iss);
81 int omap4iss_ipipeif_create_links(struct iss_device *iss);
82 void omap4iss_ipipeif_cleanup(struct iss_device *iss);
83 int omap4iss_ipipeif_register_entities(struct iss_ipipeif_device *ipipeif,
84 				       struct v4l2_device *vdev);
85 void omap4iss_ipipeif_unregister_entities(struct iss_ipipeif_device *ipipeif);
86 
87 int omap4iss_ipipeif_busy(struct iss_ipipeif_device *ipipeif);
88 void omap4iss_ipipeif_isr(struct iss_ipipeif_device *ipipeif, u32 events);
89 void omap4iss_ipipeif_restore_context(struct iss_device *iss);
90 void omap4iss_ipipeif_max_rate(struct iss_ipipeif_device *ipipeif,
91 			       unsigned int *max_rate);
92 
93 #endif	/* OMAP4_ISS_IPIPEIF_H */
94