ASoC: da7219: Correct IRQ level in DT binding example
[linux-2.6-microblaze.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / ia_css_pipe_public.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __IA_CSS_PIPE_PUBLIC_H
16 #define __IA_CSS_PIPE_PUBLIC_H
17
18 /** @file
19  * This file contains the public interface for CSS pipes.
20  */
21
22 #include <type_support.h>
23 #include <ia_css_err.h>
24 #include <ia_css_types.h>
25 #include <ia_css_frame_public.h>
26 #include <ia_css_buffer.h>
27 #ifdef ISP2401
28 #include <ia_css_acc_types.h>
29 #endif
30
31 enum {
32         IA_CSS_PIPE_OUTPUT_STAGE_0 = 0,
33         IA_CSS_PIPE_OUTPUT_STAGE_1,
34         IA_CSS_PIPE_MAX_OUTPUT_STAGE,
35 };
36
37 /** Enumeration of pipe modes. This mode can be used to create
38  *  an image pipe for this mode. These pipes can be combined
39  *  to configure and run streams on the ISP.
40  *
41  *  For example, one can create a preview and capture pipe to
42  *  create a continuous capture stream.
43  */
44 enum ia_css_pipe_mode {
45         IA_CSS_PIPE_MODE_PREVIEW,       /**< Preview pipe */
46         IA_CSS_PIPE_MODE_VIDEO,         /**< Video pipe */
47         IA_CSS_PIPE_MODE_CAPTURE,       /**< Still capture pipe */
48         IA_CSS_PIPE_MODE_ACC,           /**< Accelerated pipe */
49         IA_CSS_PIPE_MODE_COPY,          /**< Copy pipe, only used for embedded/image data copying */
50         IA_CSS_PIPE_MODE_YUVPP,         /**< YUV post processing pipe, used for all use cases with YUV input,
51                                                                         for SoC sensor and external ISP */
52 };
53 /* Temporary define  */
54 #define IA_CSS_PIPE_MODE_NUM (IA_CSS_PIPE_MODE_YUVPP + 1)
55
56 /**
57  * Enumeration of pipe versions.
58  * the order should match with definition in sh_css_defs.h
59  */
60 enum ia_css_pipe_version {
61         IA_CSS_PIPE_VERSION_1 = 1,              /**< ISP1.0 pipe */
62         IA_CSS_PIPE_VERSION_2_2 = 2,            /**< ISP2.2 pipe */
63         IA_CSS_PIPE_VERSION_2_6_1 = 3,          /**< ISP2.6.1 pipe */
64         IA_CSS_PIPE_VERSION_2_7 = 4             /**< ISP2.7 pipe */
65 };
66
67 /**
68  * Pipe configuration structure.
69  * Resolution properties are filled by Driver, kernel configurations are
70  * set by AIC
71  */
72 struct ia_css_pipe_config {
73         enum ia_css_pipe_mode mode;
74         /**< mode, indicates which mode the pipe should use. */
75         enum ia_css_pipe_version isp_pipe_version;
76         /**< pipe version, indicates which imaging pipeline the pipe should use. */
77         struct ia_css_resolution input_effective_res;
78         /**< input effective resolution */
79         struct ia_css_resolution bayer_ds_out_res;
80         /**< bayer down scaling */
81         struct ia_css_resolution capt_pp_in_res;
82 #ifndef ISP2401
83         /**< bayer down scaling */
84 #else
85         /**< capture post processing input resolution */
86 #endif
87         struct ia_css_resolution vf_pp_in_res;
88 #ifndef ISP2401
89         /**< bayer down scaling */
90 #else
91         /**< view finder post processing input resolution */
92         struct ia_css_resolution output_system_in_res;
93         /**< For IPU3 only: use output_system_in_res to specify what input resolution
94              will OSYS receive, this resolution is equal to the output resolution of GDC
95              if not determined CSS will set output_system_in_res with main osys output pin resolution
96              All other IPUs may ignore this property */
97 #endif
98         struct ia_css_resolution dvs_crop_out_res;
99         /**< dvs crop, video only, not in use yet. Use dvs_envelope below. */
100         struct ia_css_frame_info output_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE];
101         /**< output of YUV scaling */
102         struct ia_css_frame_info vf_output_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE];
103         /**< output of VF YUV scaling */
104         struct ia_css_fw_info *acc_extension;
105         /**< Pipeline extension accelerator */
106         struct ia_css_fw_info **acc_stages;
107         /**< Standalone accelerator stages */
108         uint32_t num_acc_stages;
109         /**< Number of standalone accelerator stages */
110         struct ia_css_capture_config default_capture_config;
111         /**< Default capture config for initial capture pipe configuration. */
112         struct ia_css_resolution dvs_envelope; /**< temporary */
113         enum ia_css_frame_delay dvs_frame_delay;
114         /**< indicates the DVS loop delay in frame periods */
115         int acc_num_execs;
116         /**< For acceleration pipes only: determine how many times the pipe
117              should be run. Setting this to -1 means it will run until
118              stopped. */
119         bool enable_dz;
120         /**< Disabling digital zoom for a pipeline, if this is set to false,
121              then setting a zoom factor will have no effect.
122              In some use cases this provides better performance. */
123         bool enable_dpc;
124         /**< Disabling "Defect Pixel Correction" for a pipeline, if this is set
125              to false. In some use cases this provides better performance. */
126         bool enable_vfpp_bci;
127         /**< Enabling BCI mode will cause yuv_scale binary to be picked up
128              instead of vf_pp. This only applies to viewfinder post
129              processing stages. */
130 #ifdef ISP2401
131         bool enable_luma_only;
132         /**< Enabling of monochrome mode for a pipeline. If enabled only luma processing
133              will be done. */
134         bool enable_tnr;
135         /**< Enabling of TNR (temporal noise reduction). This is only applicable to video
136              pipes. Non video-pipes should always set this parameter to false. */
137 #endif
138         struct ia_css_isp_config *p_isp_config;
139         /**< Pointer to ISP configuration */
140         struct ia_css_resolution gdc_in_buffer_res;
141         /**< GDC in buffer resolution. */
142         struct ia_css_point gdc_in_buffer_offset;
143         /**< GDC in buffer offset - indicates the pixel coordinates of the first valid pixel inside the buffer */
144 #ifdef ISP2401
145         struct ia_css_coordinate internal_frame_origin_bqs_on_sctbl;
146         /**< Origin of internal frame positioned on shading table at shading correction in ISP.
147              NOTE: Shading table is larger than or equal to internal frame.
148                    Shading table has shading gains and internal frame has bayer data.
149                    The origin of internal frame is used in shading correction in ISP
150                    to retrieve shading gains which correspond to bayer data. */
151 #endif
152 };
153
154
155 #ifdef ISP2401
156 /**
157  * Default origin of internal frame positioned on shading table.
158  */
159 #define IA_CSS_PIPE_DEFAULT_INTERNAL_FRAME_ORIGIN_BQS_ON_SCTBL \
160 { \
161         0,                                      /* x [bqs] */ \
162         0                                       /* y [bqs] */ \
163 }
164
165 /**
166  * Default settings for newly created pipe configurations.
167  */
168 #define DEFAULT_PIPE_CONFIG \
169 { \
170         IA_CSS_PIPE_MODE_PREVIEW,               /* mode */ \
171         1,                                      /* isp_pipe_version */ \
172         { 0, 0 },                               /* pipe_effective_input_res */ \
173         { 0, 0 },                               /* bayer_ds_out_res */ \
174         { 0, 0 },                               /* vf_pp_in_res */ \
175         { 0, 0 },                               /* capt_pp_in_res */ \
176         { 0, 0 },                               /* output_system_in_res */ \
177         { 0, 0 },                               /* dvs_crop_out_res */ \
178         {IA_CSS_BINARY_DEFAULT_FRAME_INFO},     /* output_info */ \
179         {IA_CSS_BINARY_DEFAULT_FRAME_INFO},     /* vf_output_info */ \
180         NULL,                                   /* acc_extension */ \
181         NULL,                                   /* acc_stages */ \
182         0,                                      /* num_acc_stages */ \
183         DEFAULT_CAPTURE_CONFIG,                 /* default_capture_config */ \
184         { 0, 0 },                               /* dvs_envelope */ \
185         IA_CSS_FRAME_DELAY_1,                   /* dvs_frame_delay */ \
186         -1,                                     /* acc_num_execs */ \
187         false,                                  /* enable_dz */ \
188         false,                                  /* enable_dpc */ \
189         false,                                  /* enable_vfpp_bci */ \
190         false,                                  /* enable_luma_only */ \
191         false,                                  /* enable_tnr */ \
192         NULL,                                   /* p_isp_config */\
193         { 0, 0 },                               /* gdc_in_buffer_res */ \
194         { 0, 0 },                               /* gdc_in_buffer_offset */ \
195         IA_CSS_PIPE_DEFAULT_INTERNAL_FRAME_ORIGIN_BQS_ON_SCTBL  /* internal_frame_origin_bqs_on_sctbl */ \
196 }
197
198 #else
199
200 /**
201  * Default settings for newly created pipe configurations.
202  */
203 #define DEFAULT_PIPE_CONFIG \
204 { \
205         IA_CSS_PIPE_MODE_PREVIEW,               /* mode */ \
206         1,                                      /* isp_pipe_version */ \
207         { 0, 0 },                               /* pipe_effective_input_res */ \
208         { 0, 0 },                               /* bayer_ds_out_res */ \
209         { 0, 0 },                               /* vf_pp_in_res */ \
210         { 0, 0 },                               /* capt_pp_in_res */ \
211         { 0, 0 },                               /* dvs_crop_out_res */ \
212         {IA_CSS_BINARY_DEFAULT_FRAME_INFO},     /* output_info */ \
213         {IA_CSS_BINARY_DEFAULT_FRAME_INFO},     /* vf_output_info */ \
214         NULL,                                   /* acc_extension */ \
215         NULL,                                   /* acc_stages */ \
216         0,                                      /* num_acc_stages */ \
217         DEFAULT_CAPTURE_CONFIG,                 /* default_capture_config */ \
218         { 0, 0 },                               /* dvs_envelope */ \
219         IA_CSS_FRAME_DELAY_1,                   /* dvs_frame_delay */ \
220         -1,                                     /* acc_num_execs */ \
221         false,                                  /* enable_dz */ \
222         false,                                  /* enable_dpc */ \
223         false,                                  /* enable_vfpp_bci */ \
224         NULL,                                   /* p_isp_config */\
225         { 0, 0 },                               /* gdc_in_buffer_res */ \
226         { 0, 0 }                                /* gdc_in_buffer_offset */ \
227 }
228
229 #endif
230
231 /** Pipe info, this struct describes properties of a pipe after it's stream has
232  * been created.
233  * ~~~** DO NOT ADD NEW FIELD **~~~ This structure will be deprecated.
234  *           - On the Behalf of CSS-API Committee.
235  */
236 struct ia_css_pipe_info {
237         struct ia_css_frame_info output_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE];
238         /**< Info about output resolution. This contains the stride which
239              should be used for memory allocation. */
240         struct ia_css_frame_info vf_output_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE];
241         /**< Info about viewfinder output resolution (optional). This contains
242              the stride that should be used for memory allocation. */
243         struct ia_css_frame_info raw_output_info;
244         /**< Raw output resolution. This indicates the resolution of the
245              RAW bayer output for pipes that support this. Currently, only the
246              still capture pipes support this feature. When this resolution is
247              smaller than the input resolution, cropping will be performed by
248              the ISP. The first cropping that will be performed is on the upper
249              left corner where we crop 8 lines and 8 columns to remove the
250              pixels normally used to initialize the ISP filters.
251              This is why the raw output resolution should normally be set to
252              the input resolution - 8x8. */
253 #ifdef ISP2401
254         struct ia_css_resolution output_system_in_res_info;
255         /**< For IPU3 only. Info about output system in resolution which is considered
256              as gdc out resolution. */
257 #endif
258         struct ia_css_shading_info shading_info;
259         /**< After an image pipe is created, this field will contain the info
260              for the shading correction. */
261         struct ia_css_grid_info  grid_info;
262         /**< After an image pipe is created, this field will contain the grid
263              info for 3A and DVS. */
264         int num_invalid_frames;
265         /**< The very first frames in a started stream do not contain valid data.
266              In this field, the CSS-firmware communicates to the host-driver how
267              many initial frames will contain invalid data; this allows the
268              host-driver to discard those initial invalid frames and start it's
269              output at the first valid frame. */
270 };
271
272 /**
273  * Defaults for ia_css_pipe_info structs.
274  */
275 #ifdef ISP2401
276
277 #define DEFAULT_PIPE_INFO \
278 { \
279         {IA_CSS_BINARY_DEFAULT_FRAME_INFO},     /* output_info */ \
280         {IA_CSS_BINARY_DEFAULT_FRAME_INFO},     /* vf_output_info */ \
281         IA_CSS_BINARY_DEFAULT_FRAME_INFO,       /* raw_output_info */ \
282         { 0, 0},                                /* output system in res */ \
283         DEFAULT_SHADING_INFO,                   /* shading_info */ \
284         DEFAULT_GRID_INFO,                      /* grid_info */ \
285         0                                       /* num_invalid_frames */ \
286 }
287
288 #else
289
290 #define DEFAULT_PIPE_INFO \
291 { \
292         {IA_CSS_BINARY_DEFAULT_FRAME_INFO},     /* output_info */ \
293         {IA_CSS_BINARY_DEFAULT_FRAME_INFO},     /* vf_output_info */ \
294         IA_CSS_BINARY_DEFAULT_FRAME_INFO,       /* raw_output_info */ \
295         DEFAULT_SHADING_INFO,                   /* shading_info */ \
296         DEFAULT_GRID_INFO,                      /* grid_info */ \
297         0                                       /* num_invalid_frames */ \
298 }
299
300 #endif
301
302 /** @brief Load default pipe configuration
303  * @param[out]  pipe_config The pipe configuration.
304  * @return      None
305  *
306  * This function will load the default pipe configuration:
307 @code
308         struct ia_css_pipe_config def_config = {
309                 IA_CSS_PIPE_MODE_PREVIEW,  // mode
310                 1,      // isp_pipe_version
311                 {0, 0}, // bayer_ds_out_res
312                 {0, 0}, // capt_pp_in_res
313                 {0, 0}, // vf_pp_in_res
314                 {0, 0}, // dvs_crop_out_res
315                 {{0, 0}, 0, 0, 0, 0}, // output_info
316                 {{0, 0}, 0, 0, 0, 0}, // second_output_info
317                 {{0, 0}, 0, 0, 0, 0}, // vf_output_info
318                 {{0, 0}, 0, 0, 0, 0}, // second_vf_output_info
319                 NULL,   // acc_extension
320                 NULL,   // acc_stages
321                 0,      // num_acc_stages
322                 {
323                         IA_CSS_CAPTURE_MODE_RAW, // mode
324                         false, // enable_xnr
325                         false  // enable_raw_output
326                 },      // default_capture_config
327                 {0, 0}, // dvs_envelope
328                 1,      // dvs_frame_delay
329                 -1,     // acc_num_execs
330                 true,   // enable_dz
331                 NULL,   // p_isp_config
332         };
333 @endcode
334  */
335 void ia_css_pipe_config_defaults(struct ia_css_pipe_config *pipe_config);
336
337 /** @brief Create a pipe
338  * @param[in]   config The pipe configuration.
339  * @param[out]  pipe The pipe.
340  * @return      IA_CSS_SUCCESS or the error code.
341  *
342  * This function will create a pipe with the given
343  * configuration.
344  */
345 enum ia_css_err
346 ia_css_pipe_create(const struct ia_css_pipe_config *config,
347                    struct ia_css_pipe **pipe);
348
349 /** @brief Destroy a pipe
350  * @param[in]   pipe The pipe.
351  * @return      IA_CSS_SUCCESS or the error code.
352  *
353  * This function will destroy a given pipe.
354  */
355 enum ia_css_err
356 ia_css_pipe_destroy(struct ia_css_pipe *pipe);
357
358 /** @brief Provides information about a pipe
359  * @param[in]   pipe The pipe.
360  * @param[out]  pipe_info The pipe information.
361  * @return      IA_CSS_SUCCESS or IA_CSS_ERR_INVALID_ARGUMENTS.
362  *
363  * This function will provide information about a given pipe.
364  */
365 enum ia_css_err
366 ia_css_pipe_get_info(const struct ia_css_pipe *pipe,
367                      struct ia_css_pipe_info *pipe_info);
368
369 /** @brief Configure a pipe with filter coefficients.
370  * @param[in]   pipe    The pipe.
371  * @param[in]   config  The pointer to ISP configuration.
372  * @return              IA_CSS_SUCCESS or error code upon error.
373  *
374  * This function configures the filter coefficients for an image
375  * pipe.
376  */
377 enum ia_css_err
378 ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe,
379                                                    struct ia_css_isp_config *config);
380
381 /** @brief Controls when the Event generator raises an IRQ to the Host.
382  *
383  * @param[in]   pipe    The pipe.
384  * @param[in]   or_mask Binary or of enum ia_css_event_irq_mask_type. Each pipe
385                         related event that is part of this mask will directly
386                         raise an IRQ to the Host when the event occurs in the
387                         CSS.
388  * @param[in]   and_mask Binary or of enum ia_css_event_irq_mask_type. An event
389                         IRQ for the Host is only raised after all pipe related
390                         events have occurred at least once for all the active
391                         pipes. Events are remembered and don't need to occure
392                         at the same moment in time. There is no control over
393                         the order of these events. Once an IRQ has been raised
394                         all remembered events are reset.
395  * @return              IA_CSS_SUCCESS.
396  *
397  Controls when the Event generator in the CSS raises an IRQ to the Host.
398  The main purpose of this function is to reduce the amount of interrupts
399  between the CSS and the Host. This will help saving power as it wakes up the
400  Host less often. In case both or_mask and and_mask are
401  IA_CSS_EVENT_TYPE_NONE for all pipes, no event IRQ's will be raised. An
402  exception holds for IA_CSS_EVENT_TYPE_PORT_EOF, for this event an IRQ is always
403  raised.
404  Note that events are still queued and the Host can poll for them. The
405  or_mask and and_mask may be be active at the same time\n
406  \n
407  Default values, for all pipe id's, after ia_css_init:\n
408  or_mask = IA_CSS_EVENT_TYPE_ALL\n
409  and_mask = IA_CSS_EVENT_TYPE_NONE\n
410  \n
411  Examples\n
412  \code
413  ia_css_pipe_set_irq_mask(h_pipe,
414  IA_CSS_EVENT_TYPE_3A_STATISTICS_DONE |
415  IA_CSS_EVENT_TYPE_DIS_STATISTICS_DONE ,
416  IA_CSS_EVENT_TYPE_NONE);
417  \endcode
418  The event generator will only raise an interrupt to the Host when there are
419  3A or DIS statistics available from the preview pipe. It will not generate
420  an interrupt for any other event of the preview pipe e.g when there is an
421  output frame available.
422
423  \code
424  ia_css_pipe_set_irq_mask(h_pipe_preview,
425         IA_CSS_EVENT_TYPE_NONE,
426         IA_CSS_EVENT_TYPE_OUTPUT_FRAME_DONE |
427         IA_CSS_EVENT_TYPE_3A_STATISTICS_DONE );
428
429  ia_css_pipe_set_irq_mask(h_pipe_capture,
430         IA_CSS_EVENT_TYPE_NONE,
431         IA_CSS_EVENT_TYPE_OUTPUT_FRAME_DONE );
432  \endcode
433  The event generator will only raise an interrupt to the Host when there is
434  both a frame done and 3A event available from the preview pipe AND when there
435  is a frame done available from the capture pipe. Note that these events
436  may occur at different moments in time. Also the order of the events is not
437  relevant.
438
439  \code
440  ia_css_pipe_set_irq_mask(h_pipe_preview,
441         IA_CSS_EVENT_TYPE_OUTPUT_FRAME_DONE,
442         IA_CSS_EVENT_TYPE_ALL );
443
444  ia_css_pipe_set_irq_mask(h_pipe_capture,
445         IA_CSS_EVENT_TYPE_OUTPUT_FRAME_DONE,
446         IA_CSS_EVENT_TYPE_ALL );
447  \endcode
448  The event generator will only raise an interrupt to the Host when there is an
449  output frame from the preview pipe OR an output frame from the capture pipe.
450  All other events (3A, VF output, pipeline done) will not raise an interrupt
451  to the Host. These events are not lost but always stored in the event queue.
452  */
453 enum ia_css_err
454 ia_css_pipe_set_irq_mask(struct ia_css_pipe *pipe,
455                          unsigned int or_mask,
456                          unsigned int and_mask);
457
458 /** @brief Reads the current event IRQ mask from the CSS.
459  *
460  * @param[in]   pipe The pipe.
461  * @param[out]  or_mask Current or_mask. The bits in this mask are a binary or
462                 of enum ia_css_event_irq_mask_type. Pointer may be NULL.
463  * @param[out]  and_mask Current and_mask.The bits in this mask are a binary or
464                 of enum ia_css_event_irq_mask_type. Pointer may be NULL.
465  * @return      IA_CSS_SUCCESS.
466  *
467  Reads the current event IRQ mask from the CSS. Reading returns the actual
468  values as used by the SP and not any mirrored values stored at the Host.\n
469 \n
470 Precondition:\n
471 SP must be running.\n
472
473 */
474 enum ia_css_err
475 ia_css_event_get_irq_mask(const struct ia_css_pipe *pipe,
476                           unsigned int *or_mask,
477                           unsigned int *and_mask);
478
479 /** @brief Queue a buffer for an image pipe.
480  *
481  * @param[in] pipe      The pipe that will own the buffer.
482  * @param[in] buffer    Pointer to the buffer.
483  *                      Note that the caller remains owner of the buffer
484  *                      structure. Only the data pointer within it will
485  *                      be passed into the internal queues.
486  * @return              IA_CSS_INTERNAL_ERROR in case of unexpected errors,
487  *                      IA_CSS_SUCCESS otherwise.
488  *
489  * This function adds a buffer (which has a certain buffer type) to the queue
490  * for this type. This queue is owned by the image pipe. After this function
491  * completes successfully, the buffer is now owned by the image pipe and should
492  * no longer be accessed by any other code until it gets dequeued. The image
493  * pipe will dequeue buffers from this queue, use them and return them to the
494  * host code via an interrupt. Buffers will be consumed in the same order they
495  * get queued, but may be returned to the host out of order.
496  */
497 enum ia_css_err
498 ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,
499                            const struct ia_css_buffer *buffer);
500
501 /** @brief Dequeue a buffer from an image pipe.
502  *
503  * @param[in]    pipe    The pipeline that the buffer queue belongs to.
504  * @param[in,out] buffer The buffer is used to lookup the type which determines
505  *                       which internal queue to use.
506  *                       The resulting buffer pointer is written into the dta
507  *                       field.
508  * @return               IA_CSS_ERR_NO_BUFFER if the queue is empty or
509  *                       IA_CSS_SUCCESS otherwise.
510  *
511  * This function dequeues a buffer from a buffer queue. The queue is indicated
512  * by the buffer type argument. This function can be called after an interrupt
513  * has been generated that signalled that a new buffer was available and can
514  * be used in a polling-like situation where the NO_BUFFER return value is used
515  * to determine whether a buffer was available or not.
516  */
517 enum ia_css_err
518 ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
519                            struct ia_css_buffer *buffer);
520
521
522 /** @brief  Set the state (Enable or Disable) of the Extension stage in the
523  *          given pipe.
524  * @param[in] pipe         Pipe handle.
525  * @param[in] fw_handle    Extension firmware Handle (ia_css_fw_info.handle)
526  * @param[in] enable       Enable Flag (1 to enable ; 0 to disable)
527  *
528  * @return
529  * IA_CSS_SUCCESS                       : Success
530  * IA_CSS_ERR_INVALID_ARGUMENTS         : Invalid Parameters
531  * IA_CSS_ERR_RESOURCE_NOT_AVAILABLE    : Inactive QOS Pipe
532  *                                      (No active stream with this pipe)
533  *
534  * This function will request state change (enable or disable) for the Extension
535  * stage (firmware handle) in the given pipe.
536  *
537  * Note:
538  *      1. Extension can be enabled/disabled only on QOS Extensions
539  *      2. Extension can be enabled/disabled only with an active QOS Pipe
540  *      3. Initial(Default) state of QOS Extensions is Disabled
541  *      4. State change cannot be guaranteed immediately OR on frame boundary
542  *
543  */
544 enum ia_css_err
545 ia_css_pipe_set_qos_ext_state (struct ia_css_pipe *pipe,
546                            uint32_t fw_handle,
547                            bool  enable);
548
549 /** @brief  Get the state (Enable or Disable) of the Extension stage in the
550  *          given pipe.
551  * @param[in]  pipe        Pipe handle.
552  * @param[in]  fw_handle   Extension firmware Handle (ia_css_fw_info.handle)
553  * @param[out] *enable     Enable Flag
554  *
555  * @return
556  * IA_CSS_SUCCESS                       : Success
557  * IA_CSS_ERR_INVALID_ARGUMENTS         : Invalid Parameters
558  * IA_CSS_ERR_RESOURCE_NOT_AVAILABLE    : Inactive QOS Pipe
559  *                                      (No active stream with this pipe)
560  *
561  * This function will query the state of the Extension stage (firmware handle)
562  * in the given Pipe.
563  *
564  * Note:
565  *      1. Extension state can be queried only on QOS Extensions
566  *      2. Extension can be enabled/disabled only with an active QOS Pipe
567  *      3. Initial(Default) state of QOS Extensions is Disabled.
568  *
569  */
570 enum ia_css_err
571 ia_css_pipe_get_qos_ext_state (struct ia_css_pipe *pipe,
572                            uint32_t fw_handle,
573                            bool * enable);
574
575 #ifdef ISP2401
576 /** @brief  Update mapped CSS and ISP arguments for QoS pipe during SP runtime.
577  * @param[in] pipe      Pipe handle.
578  * @param[in] fw_handle Extension firmware Handle (ia_css_fw_info.handle).
579  * @param[in] css_seg   Parameter memory descriptors for CSS segments.
580  * @param[in] isp_seg   Parameter memory descriptors for ISP segments.
581  *
582  * @return
583  * IA_CSS_SUCCESS                       : Success
584  * IA_CSS_ERR_INVALID_ARGUMENTS         : Invalid Parameters
585  * IA_CSS_ERR_RESOURCE_NOT_AVAILABLE    : Inactive QOS Pipe
586  *                                      (No active stream with this pipe)
587  *
588  * \deprecated{This interface is used to temporarily support a late-developed,
589  * specific use-case on a specific IPU2 platform. It will not be supported or
590  * maintained on IPU3 or further.}
591  */
592 enum ia_css_err
593 ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, uint32_t fw_handle,
594                         struct ia_css_isp_param_css_segments *css_seg,
595                         struct ia_css_isp_param_isp_segments *isp_seg);
596
597 #endif
598 /** @brief Get selected configuration settings
599  * @param[in]   pipe    The pipe.
600  * @param[out]  config  Configuration settings.
601  * @return              None
602  */
603 void
604 ia_css_pipe_get_isp_config(struct ia_css_pipe *pipe,
605                              struct ia_css_isp_config *config);
606
607 /** @brief Set the scaler lut on this pipe. A copy of lut is made in the inuit
608  *         address space. So the LUT can be freed by caller.
609  * @param[in]  pipe        Pipe handle.
610  * @param[in]  lut         Look up tabel
611  *
612  * @return
613  * IA_CSS_SUCCESS                       : Success
614  * IA_CSS_ERR_INVALID_ARGUMENTS         : Invalid Parameters
615  *
616  * Note:
617  * 1) Note that both GDC's are programmed with the same table.
618  * 2) Current implementation ignores the pipe and overrides the
619  *    global lut. This will be fixed in the future
620  * 3) This function must be called before stream start
621  *
622  */
623 enum ia_css_err
624 ia_css_pipe_set_bci_scaler_lut( struct ia_css_pipe *pipe,
625                                 const void *lut);
626 /** @brief Checking of DVS statistics ability
627  * @param[in]   pipe_info       The pipe info.
628  * @return              true - has DVS statistics ability
629  *                      false - otherwise
630  */
631 bool ia_css_pipe_has_dvs_stats(struct ia_css_pipe_info *pipe_info);
632
633 #ifdef ISP2401
634 /** @brief Override the frameformat set on the output pins.
635  * @param[in]  pipe        Pipe handle.
636  * @param[in]  output_pin  Pin index to set the format on
637  *                         0 - main output pin
638  *                         1 - display output pin
639  * @param[in]  format      Format to set
640  *
641  * @return
642  * IA_CSS_SUCCESS               : Success
643  * IA_CSS_ERR_INVALID_ARGUMENTS : Invalid Parameters
644  * IA_CSS_ERR_INTERNAL_ERROR    : Pipe misses binary info
645  *
646  * Note:
647  * 1) This is an optional function to override the formats set in the pipe.
648  * 2) Only overriding with IA_CSS_FRAME_FORMAT_NV12_TILEY is currently allowed.
649  * 3) This function is only to be used on pipes that use the output system.
650  * 4) If this function is used, it MUST be called after ia_css_pipe_create.
651  * 5) If this function is used, this function MUST be called before ia_css_stream_start.
652  */
653 enum ia_css_err
654 ia_css_pipe_override_frame_format(struct ia_css_pipe *pipe,
655                                 int output_pin,
656                                 enum ia_css_frame_format format);
657
658 #endif
659 #endif /* __IA_CSS_PIPE_PUBLIC_H */