mm_camera_interface.h revision 6f83d735d8e3b918da42e6b559fcd0efb78133e5
1/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 *     * Redistributions of source code must retain the above copyright
7 *       notice, this list of conditions and the following disclaimer.
8 *     * Redistributions in binary form must reproduce the above
9 *       copyright notice, this list of conditions and the following
10 *       disclaimer in the documentation and/or other materials provided
11 *       with the distribution.
12 *     * Neither the name of The Linux Foundation nor the names of its
13 *       contributors may be used to endorse or promote products derived
14 *       from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30#ifndef __MM_CAMERA_INTERFACE_H__
31#define __MM_CAMERA_INTERFACE_H__
32#include <linux/msm_ion.h>
33#include <linux/videodev2.h>
34#include <media/msmb_camera.h>
35#include "cam_intf.h"
36#include "cam_queue.h"
37
38#define MM_CAMERA_MAX_NUM_SENSORS MSM_MAX_CAMERA_SENSORS
39#define MM_CAMERA_MAX_NUM_FRAMES CAM_MAX_NUM_BUFS_PER_STREAM
40/* num of channels allowed in a camera obj */
41#define MM_CAMERA_CHANNEL_MAX 16
42
43#define PAD_TO_SIZE(size, padding) ((size + padding - 1) & ~(padding - 1))
44
45/** mm_camera_buf_def_t: structure for stream frame buf
46*    @stream_id : stream handler to uniquely identify a stream
47*               object
48*    @buf_idx : index of the buf within the stream bufs, to be
49*               filled during mem allocation
50*    @timespec_ts : time stamp, to be filled when DQBUF is
51*                 called
52*    @frame_idx : frame sequence num, to be filled when DQBUF
53*    @num_planes : num of planes for the frame buffer, to be
54*               filled during mem allocation
55*    @planes : plane info for the frame buffer, to be filled
56*               during mem allocation
57*    @fd : file descriptor of the frame buffer, to be filled
58*        during mem allocation
59*    @buffer : pointer to the frame buffer, to be filled during
60*            mem allocation
61*    @frame_len : length of the whole frame, to be filled during
62*               mem allocation
63*    @mem_info : user specific pointer to additional mem info
64**/
65typedef struct {
66    uint32_t stream_id;
67    cam_stream_type_t stream_type;
68    int8_t buf_idx;
69    struct timespec ts;
70    uint32_t frame_idx;
71    int8_t num_planes;
72    struct v4l2_plane planes[VIDEO_MAX_PLANES];
73    int fd;
74    void *buffer;
75    uint32_t frame_len;
76    void *mem_info;
77} mm_camera_buf_def_t;
78
79/** mm_camera_super_buf_t: super buf structure for bundled
80*   stream frames
81*    @camera_handle : camera handler to uniquely identify
82*              a camera object
83*    @ch_id : channel handler to uniquely ideentify a channel
84*           object
85*    @num_bufs : number of buffers in the super buf, should not
86*              exceeds MAX_STREAM_NUM_IN_BUNDLE
87*    @bufs : array of buffers in the bundle
88**/
89typedef struct {
90    uint32_t camera_handle;
91    uint32_t ch_id;
92    uint8_t num_bufs;
93    mm_camera_buf_def_t* bufs[MAX_STREAM_NUM_IN_BUNDLE];
94} mm_camera_super_buf_t;
95
96/** mm_camera_event_t: structure for event
97*    @server_event_type : event type from serer
98*    @status : status of an event, value could be
99*              CAM_STATUS_SUCCESS
100*              CAM_STATUS_FAILED
101**/
102typedef struct {
103    cam_event_type_t server_event_type;
104    uint32_t status;
105} mm_camera_event_t;
106
107/** mm_camera_event_notify_t: function definition for event
108*   notify handling
109*    @camera_handle : camera handler
110*    @evt : pointer to an event struct
111*    @user_data: user data pointer
112**/
113typedef void (*mm_camera_event_notify_t)(uint32_t camera_handle,
114                                         mm_camera_event_t *evt,
115                                         void *user_data);
116
117/** mm_camera_buf_notify_t: function definition for frame notify
118*   handling
119*    @mm_camera_super_buf_t : received frame buffers
120*    @user_data: user data pointer
121**/
122typedef void (*mm_camera_buf_notify_t) (mm_camera_super_buf_t *bufs,
123                                        void *user_data);
124
125/** map_stream_buf_op_t: function definition for operation of
126*   mapping stream buffers via domain socket
127*    @frame_idx : buffer index within stream buffers
128*    @plane_idx    : plane index. If all planes share the same
129*                   fd, plane_idx = -1; otherwise, plean_idx is
130*                   the index to plane (0..num_of_planes)
131*    @fd : file descriptor of the stream buffer
132*    @size: size of the stream buffer
133*    @userdata : user data pointer
134**/
135typedef int32_t (*map_stream_buf_op_t) (uint32_t frame_idx,
136                                        int32_t plane_idx,
137                                        int fd,
138                                        uint32_t size,
139                                        void *userdata);
140
141/** unmap_stream_buf_op_t: function definition for operation of
142*                          unmapping stream buffers via domain
143*                          socket
144*    @frame_idx : buffer index within stream buffers
145*    @plane_idx : plane index. If all planes share the same
146*                 fd, plane_idx = -1; otherwise, plean_idx is
147*                 the index to plane (0..num_of_planes)
148*    @userdata : user data pointer
149**/
150typedef int32_t (*unmap_stream_buf_op_t) (uint32_t frame_idx,
151                                          int32_t plane_idx,
152                                          void *userdata);
153
154/** mm_camera_map_unmap_ops_tbl_t: virtual table
155*                      for mapping/unmapping stream buffers via
156*                      domain socket
157*    @map_ops : operation for mapping
158*    @unmap_ops : operation for unmapping
159*    @userdata: user data pointer
160**/
161typedef struct {
162    map_stream_buf_op_t map_ops;
163    unmap_stream_buf_op_t unmap_ops;
164    void *userdata;
165} mm_camera_map_unmap_ops_tbl_t;
166
167/** mm_camera_stream_mem_vtbl_t: virtual table for stream
168*                      memory allocation and deallocation
169*    @get_bufs : function definition for allocating
170*                stream buffers
171*    @put_bufs : function definition for deallocating
172*                stream buffers
173*    @user_data: user data pointer
174**/
175typedef struct {
176  void *user_data;
177  int32_t (*get_bufs) (cam_frame_len_offset_t *offset,
178                       uint8_t *num_bufs,
179                       uint8_t **initial_reg_flag,
180                       mm_camera_buf_def_t **bufs,
181                       mm_camera_map_unmap_ops_tbl_t *ops_tbl,
182                       void *user_data);
183  int32_t (*put_bufs) (mm_camera_map_unmap_ops_tbl_t *ops_tbl,
184                       void *user_data);
185  int32_t (*invalidate_buf)(int index, void *user_data);
186} mm_camera_stream_mem_vtbl_t;
187
188/** mm_camera_stream_config_t: structure for stream
189*                              configuration
190*    @stream_info : pointer to a stream info structure
191*    @padding_info: padding info obtained from querycapability
192*    @mem_tbl : memory operation table for
193*              allocating/deallocating stream buffers
194*    @stream_cb : callback handling stream frame notify
195*    @userdata : user data pointer
196**/
197typedef struct {
198    cam_stream_info_t *stream_info;
199    cam_padding_info_t padding_info;
200    mm_camera_stream_mem_vtbl_t mem_vtbl;
201    mm_camera_buf_notify_t stream_cb;
202    void *userdata;
203} mm_camera_stream_config_t;
204
205/** mm_camera_super_buf_notify_mode_t: enum for super uffer
206*                                      notification mode
207*    @MM_CAMERA_SUPER_BUF_NOTIFY_BURST :
208*       ZSL use case: get burst of frames
209*    @MM_CAMERA_SUPER_BUF_NOTIFY_CONTINUOUS :
210*       get continuous frames: when the super buf is ready
211*       dispatch it to HAL
212**/
213typedef enum {
214    MM_CAMERA_SUPER_BUF_NOTIFY_BURST = 0,
215    MM_CAMERA_SUPER_BUF_NOTIFY_CONTINUOUS,
216    MM_CAMERA_SUPER_BUF_NOTIFY_MAX
217} mm_camera_super_buf_notify_mode_t;
218
219/** mm_camera_super_buf_priority_t: enum for super buffer
220*                                   matching priority
221*    @MM_CAMERA_SUPER_BUF_PRIORITY_NORMAL :
222*       Save the frame no matter focused or not. Currently only
223*       this type is supported.
224*    @MM_CAMERA_SUPER_BUF_PRIORITY_FOCUS :
225*       only queue the frame that is focused. Will enable meta
226*       data header to carry focus info
227*    @MM_CAMERA_SUPER_BUF_PRIORITY_EXPOSURE_BRACKETING :
228*       after shutter, only queue matched exposure index
229**/
230typedef enum {
231    MM_CAMERA_SUPER_BUF_PRIORITY_NORMAL = 0,
232    MM_CAMERA_SUPER_BUF_PRIORITY_FOCUS,
233    MM_CAMERA_SUPER_BUF_PRIORITY_EXPOSURE_BRACKETING,
234    MM_CAMERA_SUPER_BUF_PRIORITY_MAX
235} mm_camera_super_buf_priority_t;
236
237/** mm_camera_channel_attr_t: structure for defining channel
238*                             attributes
239*    @notify_mode : notify mode: burst or continuous
240*    @water_mark : queue depth. Only valid for burst mode
241*    @look_back : look back how many frames from last buf.
242*                 Only valid for burst mode
243*    @post_frame_skip : after send first frame to HAL, how many
244*                     frames needing to be skipped for next
245*                     delivery. Only valid for burst mode
246*    @max_unmatched_frames : max number of unmatched frames in
247*                     queue
248*    @priority : save matched priority frames only
249**/
250typedef struct {
251    mm_camera_super_buf_notify_mode_t notify_mode;
252    uint8_t water_mark;
253    uint8_t look_back;
254    uint8_t post_frame_skip;
255    uint8_t max_unmatched_frames;
256    mm_camera_super_buf_priority_t priority;
257} mm_camera_channel_attr_t;
258
259typedef struct {
260    /** query_capability: fucntion definition for querying static
261     *                    camera capabilities
262     *    @camera_handle : camer handler
263     *  Return value: 0 -- success
264     *                -1 -- failure
265     *  Note: would assume cam_capability_t is already mapped
266     **/
267    int32_t (*query_capability) (uint32_t camera_handle);
268
269    /** register_event_notify: fucntion definition for registering
270     *                         for event notification
271     *    @camera_handle : camer handler
272     *    @evt_cb : callback for event notify
273     *    @user_data : user data poiner
274     *  Return value: 0 -- success
275     *                -1 -- failure
276     **/
277    int32_t (*register_event_notify) (uint32_t camera_handle,
278                                      mm_camera_event_notify_t evt_cb,
279                                      void *user_data);
280
281    /** close_camera: fucntion definition for closing a camera
282     *    @camera_handle : camer handler
283     *  Return value: 0 -- success
284     *                -1 -- failure
285     **/
286    int32_t (*close_camera) (uint32_t camera_handle);
287
288    /** map_buf: fucntion definition for mapping a camera buffer
289     *           via domain socket
290     *    @camera_handle : camer handler
291     *    @buf_type : type of mapping buffers, can be value of
292     *                CAM_MAPPING_BUF_TYPE_CAPABILITY
293     *                CAM_MAPPING_BUF_TYPE_SETPARM_BUF
294     *                CAM_MAPPING_BUF_TYPE_GETPARM_BUF
295     *    @fd : file descriptor of the stream buffer
296     *    @size :  size of the stream buffer
297     *  Return value: 0 -- success
298     *                -1 -- failure
299     **/
300    int32_t (*map_buf) (uint32_t camera_handle,
301                        uint8_t buf_type,
302                        int fd,
303                        uint32_t size);
304
305    /** unmap_buf: fucntion definition for unmapping a camera buffer
306     *           via domain socket
307     *    @camera_handle : camer handler
308     *    @buf_type : type of mapping buffers, can be value of
309     *                CAM_MAPPING_BUF_TYPE_CAPABILITY
310     *                CAM_MAPPING_BUF_TYPE_SETPARM_BUF
311     *                CAM_MAPPING_BUF_TYPE_GETPARM_BUF
312     *  Return value: 0 -- success
313     *                -1 -- failure
314     **/
315    int32_t (*unmap_buf) (uint32_t camera_handle,
316                          uint8_t buf_type);
317
318    /** set_parms: fucntion definition for setting camera
319     *             based parameters to server
320     *    @camera_handle : camer handler
321     *    @parms : batch for parameters to be set, stored in
322     *               parm_buffer_t
323     *  Return value: 0 -- success
324     *                -1 -- failure
325     *  Note: would assume parm_buffer_t is already mapped, and
326     *       according parameter entries to be set are filled in the
327     *       buf before this call
328     **/
329    int32_t (*set_parms) (uint32_t camera_handle,
330                          parm_buffer_t *parms);
331
332    /** get_parms: fucntion definition for querying camera
333     *             based parameters from server
334     *    @camera_handle : camer handler
335     *    @parms : batch for parameters to be queried, stored in
336     *               parm_buffer_t
337     *  Return value: 0 -- success
338     *                -1 -- failure
339     *  Note: would assume parm_buffer_t is already mapped, and
340     *       according parameter entries to be queried are filled in
341     *       the buf before this call
342     **/
343    int32_t (*get_parms) (uint32_t camera_handle,
344                          parm_buffer_t *parms);
345
346    /** do_auto_focus: fucntion definition for performing auto focus
347     *    @camera_handle : camer handler
348     *  Return value: 0 -- success
349     *                -1 -- failure
350     *  Note: if this call success, we will always assume there will
351     *        be an auto_focus event following up.
352     **/
353    int32_t (*do_auto_focus) (uint32_t camera_handle);
354
355    /** cancel_auto_focus: fucntion definition for cancelling
356     *                     previous auto focus request
357     *    @camera_handle : camer handler
358    *  Return value: 0 -- success
359    *                -1 -- failure
360     **/
361    int32_t (*cancel_auto_focus) (uint32_t camera_handle);
362
363    /** prepare_snapshot: fucntion definition for preparing hardware
364     *                    for snapshot.
365     *    @camera_handle : camer handler
366     *    @do_af_flag    : flag indicating if AF needs to be done
367     *                     0 -- no AF needed
368     *                     1 -- AF needed
369     *  Return value: 0 -- success
370     *                -1 -- failure
371     **/
372    int32_t (*prepare_snapshot) (uint32_t camera_handle,
373                                 int32_t do_af_flag);
374
375    /** start_zsl_snapshot: function definition for starting
376     *                    zsl snapshot.
377     *    @camera_handle : camer handler
378     *  Return value: 0 -- success
379     *                -1 -- failure
380     **/
381    int32_t (*start_zsl_snapshot) (uint32_t camera_handle);
382
383    /** stop_zsl_snapshot: function definition for stopping
384     *                    zsl snapshot.
385     *    @camera_handle : camer handler
386     *  Return value: 0 -- success
387     *                -1 -- failure
388     **/
389    int32_t (*stop_zsl_snapshot) (uint32_t camera_handle);
390
391    /** add_channel: fucntion definition for adding a channel
392     *    @camera_handle : camer handler
393     *    @ch_id : channel handler
394     *    @attr : pointer to channel attribute structure
395     *    @channel_cb : callbak to handle bundled super buffer
396     *    @userdata : user data pointer
397     *  Return value: channel id, zero is invalid ch_id
398     * Note: attr, channel_cb, and userdata can be NULL if no
399     *       superbufCB is needed
400     **/
401    uint32_t (*add_channel) (uint32_t camera_handle,
402                             mm_camera_channel_attr_t *attr,
403                             mm_camera_buf_notify_t channel_cb,
404                             void *userdata);
405
406    /** delete_channel: fucntion definition for deleting a channel
407     *    @camera_handle : camer handler
408     *    @ch_id : channel handler
409     *  Return value: 0 -- success
410     *                -1 -- failure
411     **/
412    int32_t (*delete_channel) (uint32_t camera_handle,
413                               uint32_t ch_id);
414
415    /** get_bundle_info: function definition for querying bundle
416     *  info of the channel
417     *    @camera_handle : camera handler
418     *    @ch_id         : channel handler
419     *    @bundle_info   : bundle info to be filled in
420     *  Return value: 0 -- success
421     *                -1 -- failure
422     **/
423    int32_t (*get_bundle_info) (uint32_t camera_handle,
424                                uint32_t ch_id,
425                                cam_bundle_config_t *bundle_info);
426
427    /** add_stream: fucntion definition for adding a stream
428     *    @camera_handle : camer handler
429     *    @ch_id : channel handler
430     *  Return value: stream_id. zero is invalid stream_id
431     **/
432    uint32_t (*add_stream) (uint32_t camera_handle,
433                            uint32_t ch_id);
434
435    /** delete_stream: fucntion definition for deleting a stream
436     *    @camera_handle : camer handler
437     *    @ch_id : channel handler
438     *    @stream_id : stream handler
439     *  Return value: 0 -- success
440     *                -1 -- failure
441     **/
442    int32_t (*delete_stream) (uint32_t camera_handle,
443                              uint32_t ch_id,
444                              uint32_t stream_id);
445
446    /** config_stream: fucntion definition for configuring a stream
447     *    @camera_handle : camer handler
448     *    @ch_id : channel handler
449     *    @stream_id : stream handler
450     *    @confid : pointer to a stream configuration structure
451     *  Return value: 0 -- success
452     *                -1 -- failure
453     **/
454    int32_t (*config_stream) (uint32_t camera_handle,
455                              uint32_t ch_id,
456                              uint32_t stream_id,
457                              mm_camera_stream_config_t *config);
458
459    /** map_stream_buf: fucntion definition for mapping
460     *                 stream buffer via domain socket
461     *    @camera_handle : camer handler
462     *    @ch_id : channel handler
463     *    @stream_id : stream handler
464     *    @buf_type : type of mapping buffers, can be value of
465     *             CAM_MAPPING_BUF_TYPE_STREAM_BUF
466     *             CAM_MAPPING_BUF_TYPE_STREAM_INFO
467     *             CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF
468     *    @buf_idx : buffer index within the stream buffers
469     *    @plane_idx : plane index. If all planes share the same fd,
470     *               plane_idx = -1; otherwise, plean_idx is the
471     *               index to plane (0..num_of_planes)
472     *    @fd : file descriptor of the stream buffer
473     *    @size :  size of the stream buffer
474     *  Return value: 0 -- success
475     *                -1 -- failure
476     **/
477    int32_t (*map_stream_buf) (uint32_t camera_handle,
478                               uint32_t ch_id,
479                               uint32_t stream_id,
480                               uint8_t buf_type,
481                               uint32_t buf_idx,
482                               int32_t plane_idx,
483                               int fd,
484                               uint32_t size);
485
486    /** unmap_stream_buf: fucntion definition for unmapping
487     *                 stream buffer via domain socket
488     *    @camera_handle : camer handler
489     *    @ch_id : channel handler
490     *    @stream_id : stream handler
491     *    @buf_type : type of mapping buffers, can be value of
492     *             CAM_MAPPING_BUF_TYPE_STREAM_BUF
493     *             CAM_MAPPING_BUF_TYPE_STREAM_INFO
494     *             CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF
495     *    @buf_idx : buffer index within the stream buffers
496     *    @plane_idx : plane index. If all planes share the same fd,
497     *               plane_idx = -1; otherwise, plean_idx is the
498     *               index to plane (0..num_of_planes)
499     *  Return value: 0 -- success
500     *                -1 -- failure
501     **/
502    int32_t (*unmap_stream_buf) (uint32_t camera_handle,
503                                 uint32_t ch_id,
504                                 uint32_t stream_id,
505                                 uint8_t buf_type,
506                                 uint32_t buf_idx,
507                                 int32_t plane_idx);
508
509    /** set_stream_parms: fucntion definition for setting stream
510     *                    specific parameters to server
511     *    @camera_handle : camer handler
512     *    @ch_id : channel handler
513     *    @stream_id : stream handler
514     *    @parms : batch for parameters to be set
515     *  Return value: 0 -- success
516     *                -1 -- failure
517     *  Note: would assume parm buffer is already mapped, and
518     *       according parameter entries to be set are filled in the
519     *       buf before this call
520     **/
521    int32_t (*set_stream_parms) (uint32_t camera_handle,
522                                 uint32_t ch_id,
523                                 uint32_t s_id,
524                                 cam_stream_parm_buffer_t *parms);
525
526    /** get_stream_parms: fucntion definition for querying stream
527     *                    specific parameters from server
528     *    @camera_handle : camer handler
529     *    @ch_id : channel handler
530     *    @stream_id : stream handler
531     *    @parms : batch for parameters to be queried
532     *  Return value: 0 -- success
533     *                -1 -- failure
534     *  Note: would assume parm buffer is already mapped, and
535     *       according parameter entries to be queried are filled in
536     *       the buf before this call
537     **/
538    int32_t (*get_stream_parms) (uint32_t camera_handle,
539                                 uint32_t ch_id,
540                                 uint32_t s_id,
541                                 cam_stream_parm_buffer_t *parms);
542
543    /** start_channel: fucntion definition for starting a channel
544     *    @camera_handle : camer handler
545     *    @ch_id : channel handler
546     *  Return value: 0 -- success
547     *                -1 -- failure
548     * This call will start all streams belongs to the channel
549     **/
550    int32_t (*start_channel) (uint32_t camera_handle,
551                              uint32_t ch_id);
552
553    /** stop_channel: fucntion definition for stopping a channel
554     *    @camera_handle : camer handler
555     *    @ch_id : channel handler
556     *  Return value: 0 -- success
557     *                -1 -- failure
558     * This call will stop all streams belongs to the channel
559     **/
560    int32_t (*stop_channel) (uint32_t camera_handle,
561                             uint32_t ch_id);
562
563    /** qbuf: fucntion definition for queuing a frame buffer back to
564     *        kernel for reuse
565     *    @camera_handle : camer handler
566     *    @ch_id : channel handler
567     *    @buf : a frame buffer to be queued back to kernel
568     *  Return value: 0 -- success
569     *                -1 -- failure
570     **/
571    int32_t (*qbuf) (uint32_t camera_handle,
572                     uint32_t ch_id,
573                     mm_camera_buf_def_t *buf);
574
575    /** request_super_buf: fucntion definition for requesting frames
576     *                     from superbuf queue in burst mode
577     *    @camera_handle : camer handler
578     *    @ch_id : channel handler
579     *    @num_buf_requested : number of super buffers requested
580     *  Return value: 0 -- success
581     *                -1 -- failure
582     **/
583    int32_t (*request_super_buf) (uint32_t camera_handle,
584                                  uint32_t ch_id,
585                                  uint32_t num_buf_requested);
586
587    /** cancel_super_buf_request: fucntion definition for canceling
588     *                     frames dispatched from superbuf queue in
589     *                     burst mode
590     *    @camera_handle : camer handler
591     *    @ch_id : channel handler
592     *  Return value: 0 -- success
593     *                -1 -- failure
594     **/
595    int32_t (*cancel_super_buf_request) (uint32_t camera_handle,
596                                         uint32_t ch_id);
597
598    /** flush_super_buf_queue: function definition for flushing out
599     *                     all frames in the superbuf queue up to frame_idx,
600     *                     even if frames with frame_idx come in later than
601     *                     this call.
602     *    @camera_handle : camer handler
603     *    @ch_id : channel handler
604     *    @frame_idx : frame index up until which all superbufs are flushed
605     *  Return value: 0 -- success
606     *                -1 -- failure
607     **/
608    int32_t (*flush_super_buf_queue) (uint32_t camera_handle,
609                                      uint32_t ch_id, uint32_t frame_idx);
610} mm_camera_ops_t;
611
612/** mm_camera_vtbl_t: virtual table for camera operations
613*    @camera_handle : camera handler which uniquely identifies a
614*                   camera object
615*    @ops : API call table
616**/
617typedef struct {
618    uint32_t camera_handle;
619    mm_camera_ops_t *ops;
620} mm_camera_vtbl_t;
621
622/* return number of cameras */
623uint8_t get_num_of_cameras();
624
625/* return reference pointer of camera vtbl */
626mm_camera_vtbl_t * camera_open(uint8_t camera_idx);
627
628#endif /*__MM_CAMERA_INTERFACE_H__*/
629