mm_camera_interface.h revision 744f5403bebb0e27140d16a5df7a341713c24a13
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  int32_t (*clean_invalidate_buf)(int index, void *user_data);
187} mm_camera_stream_mem_vtbl_t;
188
189/** mm_camera_stream_config_t: structure for stream
190*                              configuration
191*    @stream_info : pointer to a stream info structure
192*    @padding_info: padding info obtained from querycapability
193*    @mem_tbl : memory operation table for
194*              allocating/deallocating stream buffers
195*    @stream_cb : callback handling stream frame notify
196*    @userdata : user data pointer
197**/
198typedef struct {
199    cam_stream_info_t *stream_info;
200    cam_padding_info_t padding_info;
201    mm_camera_stream_mem_vtbl_t mem_vtbl;
202    mm_camera_buf_notify_t stream_cb;
203    void *userdata;
204} mm_camera_stream_config_t;
205
206/** mm_camera_super_buf_notify_mode_t: enum for super uffer
207*                                      notification mode
208*    @MM_CAMERA_SUPER_BUF_NOTIFY_BURST :
209*       ZSL use case: get burst of frames
210*    @MM_CAMERA_SUPER_BUF_NOTIFY_CONTINUOUS :
211*       get continuous frames: when the super buf is ready
212*       dispatch it to HAL
213**/
214typedef enum {
215    MM_CAMERA_SUPER_BUF_NOTIFY_BURST = 0,
216    MM_CAMERA_SUPER_BUF_NOTIFY_CONTINUOUS,
217    MM_CAMERA_SUPER_BUF_NOTIFY_MAX
218} mm_camera_super_buf_notify_mode_t;
219
220/** mm_camera_super_buf_priority_t: enum for super buffer
221*                                   matching priority
222*    @MM_CAMERA_SUPER_BUF_PRIORITY_NORMAL :
223*       Save the frame no matter focused or not. Currently only
224*       this type is supported.
225*    @MM_CAMERA_SUPER_BUF_PRIORITY_FOCUS :
226*       only queue the frame that is focused. Will enable meta
227*       data header to carry focus info
228*    @MM_CAMERA_SUPER_BUF_PRIORITY_EXPOSURE_BRACKETING :
229*       after shutter, only queue matched exposure index
230**/
231typedef enum {
232    MM_CAMERA_SUPER_BUF_PRIORITY_NORMAL = 0,
233    MM_CAMERA_SUPER_BUF_PRIORITY_FOCUS,
234    MM_CAMERA_SUPER_BUF_PRIORITY_EXPOSURE_BRACKETING,
235    MM_CAMERA_SUPER_BUF_PRIORITY_MAX
236} mm_camera_super_buf_priority_t;
237
238/** mm_camera_channel_attr_t: structure for defining channel
239*                             attributes
240*    @notify_mode : notify mode: burst or continuous
241*    @water_mark : queue depth. Only valid for burst mode
242*    @look_back : look back how many frames from last buf.
243*                 Only valid for burst mode
244*    @post_frame_skip : after send first frame to HAL, how many
245*                     frames needing to be skipped for next
246*                     delivery. Only valid for burst mode
247*    @max_unmatched_frames : max number of unmatched frames in
248*                     queue
249*    @priority : save matched priority frames only
250**/
251typedef struct {
252    mm_camera_super_buf_notify_mode_t notify_mode;
253    uint8_t water_mark;
254    uint8_t look_back;
255    uint8_t post_frame_skip;
256    uint8_t max_unmatched_frames;
257    mm_camera_super_buf_priority_t priority;
258} mm_camera_channel_attr_t;
259
260typedef struct {
261    /** query_capability: fucntion definition for querying static
262     *                    camera capabilities
263     *    @camera_handle : camer handler
264     *  Return value: 0 -- success
265     *                -1 -- failure
266     *  Note: would assume cam_capability_t is already mapped
267     **/
268    int32_t (*query_capability) (uint32_t camera_handle);
269
270    /** register_event_notify: fucntion definition for registering
271     *                         for event notification
272     *    @camera_handle : camer handler
273     *    @evt_cb : callback for event notify
274     *    @user_data : user data poiner
275     *  Return value: 0 -- success
276     *                -1 -- failure
277     **/
278    int32_t (*register_event_notify) (uint32_t camera_handle,
279                                      mm_camera_event_notify_t evt_cb,
280                                      void *user_data);
281
282    /** close_camera: fucntion definition for closing a camera
283     *    @camera_handle : camer handler
284     *  Return value: 0 -- success
285     *                -1 -- failure
286     **/
287    int32_t (*close_camera) (uint32_t camera_handle);
288
289    /** map_buf: fucntion definition for mapping a camera buffer
290     *           via domain socket
291     *    @camera_handle : camer handler
292     *    @buf_type : type of mapping buffers, can be value of
293     *                CAM_MAPPING_BUF_TYPE_CAPABILITY
294     *                CAM_MAPPING_BUF_TYPE_SETPARM_BUF
295     *                CAM_MAPPING_BUF_TYPE_GETPARM_BUF
296     *    @fd : file descriptor of the stream buffer
297     *    @size :  size of the stream buffer
298     *  Return value: 0 -- success
299     *                -1 -- failure
300     **/
301    int32_t (*map_buf) (uint32_t camera_handle,
302                        uint8_t buf_type,
303                        int fd,
304                        uint32_t size);
305
306    /** unmap_buf: fucntion definition for unmapping a camera buffer
307     *           via domain socket
308     *    @camera_handle : camer handler
309     *    @buf_type : type of mapping buffers, can be value of
310     *                CAM_MAPPING_BUF_TYPE_CAPABILITY
311     *                CAM_MAPPING_BUF_TYPE_SETPARM_BUF
312     *                CAM_MAPPING_BUF_TYPE_GETPARM_BUF
313     *  Return value: 0 -- success
314     *                -1 -- failure
315     **/
316    int32_t (*unmap_buf) (uint32_t camera_handle,
317                          uint8_t buf_type);
318
319    /** set_parms: fucntion definition for setting camera
320     *             based parameters to server
321     *    @camera_handle : camer handler
322     *    @parms : batch for parameters to be set, stored in
323     *               parm_buffer_t
324     *  Return value: 0 -- success
325     *                -1 -- failure
326     *  Note: would assume parm_buffer_t is already mapped, and
327     *       according parameter entries to be set are filled in the
328     *       buf before this call
329     **/
330    int32_t (*set_parms) (uint32_t camera_handle,
331                          parm_buffer_t *parms);
332
333    /** get_parms: fucntion definition for querying camera
334     *             based parameters from server
335     *    @camera_handle : camer handler
336     *    @parms : batch for parameters to be queried, stored in
337     *               parm_buffer_t
338     *  Return value: 0 -- success
339     *                -1 -- failure
340     *  Note: would assume parm_buffer_t is already mapped, and
341     *       according parameter entries to be queried are filled in
342     *       the buf before this call
343     **/
344    int32_t (*get_parms) (uint32_t camera_handle,
345                          parm_buffer_t *parms);
346
347    /** do_auto_focus: fucntion definition for performing auto focus
348     *    @camera_handle : camer handler
349     *  Return value: 0 -- success
350     *                -1 -- failure
351     *  Note: if this call success, we will always assume there will
352     *        be an auto_focus event following up.
353     **/
354    int32_t (*do_auto_focus) (uint32_t camera_handle);
355
356    /** cancel_auto_focus: fucntion definition for cancelling
357     *                     previous auto focus request
358     *    @camera_handle : camer handler
359    *  Return value: 0 -- success
360    *                -1 -- failure
361     **/
362    int32_t (*cancel_auto_focus) (uint32_t camera_handle);
363
364    /** prepare_snapshot: fucntion definition for preparing hardware
365     *                    for snapshot.
366     *    @camera_handle : camer handler
367     *    @do_af_flag    : flag indicating if AF needs to be done
368     *                     0 -- no AF needed
369     *                     1 -- AF needed
370     *  Return value: 0 -- success
371     *                -1 -- failure
372     **/
373    int32_t (*prepare_snapshot) (uint32_t camera_handle,
374                                 int32_t do_af_flag);
375
376    /** start_zsl_snapshot: function definition for starting
377     *                    zsl snapshot.
378     *    @camera_handle : camer handler
379     *  Return value: 0 -- success
380     *                -1 -- failure
381     **/
382    int32_t (*start_zsl_snapshot) (uint32_t camera_handle);
383
384    /** stop_zsl_snapshot: function definition for stopping
385     *                    zsl snapshot.
386     *    @camera_handle : camer handler
387     *  Return value: 0 -- success
388     *                -1 -- failure
389     **/
390    int32_t (*stop_zsl_snapshot) (uint32_t camera_handle);
391
392    /** add_channel: fucntion definition for adding a channel
393     *    @camera_handle : camer handler
394     *    @ch_id : channel handler
395     *    @attr : pointer to channel attribute structure
396     *    @channel_cb : callbak to handle bundled super buffer
397     *    @userdata : user data pointer
398     *  Return value: channel id, zero is invalid ch_id
399     * Note: attr, channel_cb, and userdata can be NULL if no
400     *       superbufCB is needed
401     **/
402    uint32_t (*add_channel) (uint32_t camera_handle,
403                             mm_camera_channel_attr_t *attr,
404                             mm_camera_buf_notify_t channel_cb,
405                             void *userdata);
406
407    /** delete_channel: fucntion definition for deleting a channel
408     *    @camera_handle : camer handler
409     *    @ch_id : channel handler
410     *  Return value: 0 -- success
411     *                -1 -- failure
412     **/
413    int32_t (*delete_channel) (uint32_t camera_handle,
414                               uint32_t ch_id);
415
416    /** get_bundle_info: function definition for querying bundle
417     *  info of the channel
418     *    @camera_handle : camera handler
419     *    @ch_id         : channel handler
420     *    @bundle_info   : bundle info to be filled in
421     *  Return value: 0 -- success
422     *                -1 -- failure
423     **/
424    int32_t (*get_bundle_info) (uint32_t camera_handle,
425                                uint32_t ch_id,
426                                cam_bundle_config_t *bundle_info);
427
428    /** add_stream: fucntion definition for adding a stream
429     *    @camera_handle : camer handler
430     *    @ch_id : channel handler
431     *  Return value: stream_id. zero is invalid stream_id
432     **/
433    uint32_t (*add_stream) (uint32_t camera_handle,
434                            uint32_t ch_id);
435
436    /** delete_stream: fucntion definition for deleting a stream
437     *    @camera_handle : camer handler
438     *    @ch_id : channel handler
439     *    @stream_id : stream handler
440     *  Return value: 0 -- success
441     *                -1 -- failure
442     **/
443    int32_t (*delete_stream) (uint32_t camera_handle,
444                              uint32_t ch_id,
445                              uint32_t stream_id);
446
447    /** config_stream: fucntion definition for configuring a stream
448     *    @camera_handle : camer handler
449     *    @ch_id : channel handler
450     *    @stream_id : stream handler
451     *    @confid : pointer to a stream configuration structure
452     *  Return value: 0 -- success
453     *                -1 -- failure
454     **/
455    int32_t (*config_stream) (uint32_t camera_handle,
456                              uint32_t ch_id,
457                              uint32_t stream_id,
458                              mm_camera_stream_config_t *config);
459
460    /** map_stream_buf: fucntion definition for mapping
461     *                 stream buffer via domain socket
462     *    @camera_handle : camer handler
463     *    @ch_id : channel handler
464     *    @stream_id : stream handler
465     *    @buf_type : type of mapping buffers, can be value of
466     *             CAM_MAPPING_BUF_TYPE_STREAM_BUF
467     *             CAM_MAPPING_BUF_TYPE_STREAM_INFO
468     *             CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF
469     *    @buf_idx : buffer index within the stream buffers
470     *    @plane_idx : plane index. If all planes share the same fd,
471     *               plane_idx = -1; otherwise, plean_idx is the
472     *               index to plane (0..num_of_planes)
473     *    @fd : file descriptor of the stream buffer
474     *    @size :  size of the stream buffer
475     *  Return value: 0 -- success
476     *                -1 -- failure
477     **/
478    int32_t (*map_stream_buf) (uint32_t camera_handle,
479                               uint32_t ch_id,
480                               uint32_t stream_id,
481                               uint8_t buf_type,
482                               uint32_t buf_idx,
483                               int32_t plane_idx,
484                               int fd,
485                               uint32_t size);
486
487    /** unmap_stream_buf: fucntion definition for unmapping
488     *                 stream buffer via domain socket
489     *    @camera_handle : camer handler
490     *    @ch_id : channel handler
491     *    @stream_id : stream handler
492     *    @buf_type : type of mapping buffers, can be value of
493     *             CAM_MAPPING_BUF_TYPE_STREAM_BUF
494     *             CAM_MAPPING_BUF_TYPE_STREAM_INFO
495     *             CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF
496     *    @buf_idx : buffer index within the stream buffers
497     *    @plane_idx : plane index. If all planes share the same fd,
498     *               plane_idx = -1; otherwise, plean_idx is the
499     *               index to plane (0..num_of_planes)
500     *  Return value: 0 -- success
501     *                -1 -- failure
502     **/
503    int32_t (*unmap_stream_buf) (uint32_t camera_handle,
504                                 uint32_t ch_id,
505                                 uint32_t stream_id,
506                                 uint8_t buf_type,
507                                 uint32_t buf_idx,
508                                 int32_t plane_idx);
509
510    /** set_stream_parms: fucntion definition for setting stream
511     *                    specific parameters to server
512     *    @camera_handle : camer handler
513     *    @ch_id : channel handler
514     *    @stream_id : stream handler
515     *    @parms : batch for parameters to be set
516     *  Return value: 0 -- success
517     *                -1 -- failure
518     *  Note: would assume parm buffer is already mapped, and
519     *       according parameter entries to be set are filled in the
520     *       buf before this call
521     **/
522    int32_t (*set_stream_parms) (uint32_t camera_handle,
523                                 uint32_t ch_id,
524                                 uint32_t s_id,
525                                 cam_stream_parm_buffer_t *parms);
526
527    /** get_stream_parms: fucntion definition for querying stream
528     *                    specific parameters from server
529     *    @camera_handle : camer handler
530     *    @ch_id : channel handler
531     *    @stream_id : stream handler
532     *    @parms : batch for parameters to be queried
533     *  Return value: 0 -- success
534     *                -1 -- failure
535     *  Note: would assume parm buffer is already mapped, and
536     *       according parameter entries to be queried are filled in
537     *       the buf before this call
538     **/
539    int32_t (*get_stream_parms) (uint32_t camera_handle,
540                                 uint32_t ch_id,
541                                 uint32_t s_id,
542                                 cam_stream_parm_buffer_t *parms);
543
544    /** start_channel: fucntion definition for starting a channel
545     *    @camera_handle : camer handler
546     *    @ch_id : channel handler
547     *  Return value: 0 -- success
548     *                -1 -- failure
549     * This call will start all streams belongs to the channel
550     **/
551    int32_t (*start_channel) (uint32_t camera_handle,
552                              uint32_t ch_id);
553
554    /** stop_channel: fucntion definition for stopping a channel
555     *    @camera_handle : camer handler
556     *    @ch_id : channel handler
557     *  Return value: 0 -- success
558     *                -1 -- failure
559     * This call will stop all streams belongs to the channel
560     **/
561    int32_t (*stop_channel) (uint32_t camera_handle,
562                             uint32_t ch_id);
563
564    /** qbuf: fucntion definition for queuing a frame buffer back to
565     *        kernel for reuse
566     *    @camera_handle : camer handler
567     *    @ch_id : channel handler
568     *    @buf : a frame buffer to be queued back to kernel
569     *  Return value: 0 -- success
570     *                -1 -- failure
571     **/
572    int32_t (*qbuf) (uint32_t camera_handle,
573                     uint32_t ch_id,
574                     mm_camera_buf_def_t *buf);
575
576    /** request_super_buf: fucntion definition for requesting frames
577     *                     from superbuf queue in burst mode
578     *    @camera_handle : camer handler
579     *    @ch_id : channel handler
580     *    @num_buf_requested : number of super buffers requested
581     *  Return value: 0 -- success
582     *                -1 -- failure
583     **/
584    int32_t (*request_super_buf) (uint32_t camera_handle,
585                                  uint32_t ch_id,
586                                  uint32_t num_buf_requested);
587
588    /** cancel_super_buf_request: fucntion definition for canceling
589     *                     frames dispatched from superbuf queue in
590     *                     burst mode
591     *    @camera_handle : camer handler
592     *    @ch_id : channel handler
593     *  Return value: 0 -- success
594     *                -1 -- failure
595     **/
596    int32_t (*cancel_super_buf_request) (uint32_t camera_handle,
597                                         uint32_t ch_id);
598
599    /** flush_super_buf_queue: function definition for flushing out
600     *                     all frames in the superbuf queue up to frame_idx,
601     *                     even if frames with frame_idx come in later than
602     *                     this call.
603     *    @camera_handle : camer handler
604     *    @ch_id : channel handler
605     *    @frame_idx : frame index up until which all superbufs are flushed
606     *  Return value: 0 -- success
607     *                -1 -- failure
608     **/
609    int32_t (*flush_super_buf_queue) (uint32_t camera_handle,
610                                      uint32_t ch_id, uint32_t frame_idx);
611
612    /** configure_notify_mode: function definition for configuring the
613     *                         notification mode of channel
614     *    @camera_handle : camera handler
615     *    @ch_id : channel handler
616     *    @notify_mode : notification mode
617     *  Return value: 0 -- success
618     *                -1 -- failure
619     **/
620    int32_t (*configure_notify_mode) (uint32_t camera_handle,
621                                      uint32_t ch_id,
622                                      mm_camera_super_buf_notify_mode_t notify_mode);
623} mm_camera_ops_t;
624
625/** mm_camera_vtbl_t: virtual table for camera operations
626*    @camera_handle : camera handler which uniquely identifies a
627*                   camera object
628*    @ops : API call table
629**/
630typedef struct {
631    uint32_t camera_handle;
632    mm_camera_ops_t *ops;
633} mm_camera_vtbl_t;
634
635/* return number of cameras */
636uint8_t get_num_of_cameras();
637
638/* return reference pointer of camera vtbl */
639mm_camera_vtbl_t * camera_open(uint8_t camera_idx);
640
641#endif /*__MM_CAMERA_INTERFACE_H__*/
642