linux/drivers/media/video/mxc/capture/mxc_v4l2_capture.c File Reference

Mxc Video For Linux 2 driver. More...

Data Structures

struct  video_fmt_t

Defines

#define MXC_V4L2_CAPTURE_NUM_OUTPUTS   6
#define TV_STD_MAX   (TV_NOT_LOCKED + 1)

Enumerations

enum  video_fmt_idx {
  ADV7180_NTSC = 0,
  ADV7180_PAL,
  ADV7180_NOT_LOCKED,
  TV_NTSC = 0,
  TV_PAL,
  TV_NOT_LOCKED
}

Functions

static int mxc_v4l2_master_attach (struct v4l2_int_device *slave)
static void mxc_v4l2_master_detach (struct v4l2_int_device *slave)
static int start_preview (cam_data *cam)
static int stop_preview (cam_data *cam)
static int mxc_free_frame_buf (cam_data *cam)
static int mxc_allocate_frame_buf (cam_data *cam, int count)
static void mxc_free_frames (cam_data *cam)
static int mxc_v4l2_buffer_status (cam_data *cam, struct v4l2_buffer *buf)
static int valid_mode (u32 palette)
static int mxc_streamon (cam_data *cam)
static int mxc_streamoff (cam_data *cam)
static int verify_preview (cam_data *cam, struct v4l2_window *win)
static int mxc_v4l2_g_fmt (cam_data *cam, struct v4l2_format *f)
static int mxc_v4l2_s_fmt (cam_data *cam, struct v4l2_format *f)
static int mxc_v4l2_g_ctrl (cam_data *cam, struct v4l2_control *c)
static int mxc_v4l2_s_ctrl (cam_data *cam, struct v4l2_control *c)
static int mxc_v4l2_s_param (cam_data *cam, struct v4l2_streamparm *parm)
static int mxc_v4l2_s_std (cam_data *cam, v4l2_std_id e)
static int mxc_v4l2_g_std (cam_data *cam, v4l2_std_id *e)
static int mxc_v4l_dqueue (cam_data *cam, struct v4l2_buffer *buf)
static int mxc_v4l_open (struct file *file)
static int mxc_v4l_close (struct file *file)
static long mxc_v4l_do_ioctl (struct file *file, unsigned int ioctlnr, void *arg)
static int mxc_mmap (struct file *file, struct vm_area_struct *vma)
static unsigned int mxc_poll (struct file *file, struct poll_table_struct *wait)
static void camera_platform_release (struct device *device)
static void camera_callback (u32 mask, void *dev)
static void init_camera_struct (cam_data *cam, struct platform_device *pdev)
static int mxc_v4l2_probe (struct platform_device *pdev)
static int mxc_v4l2_remove (struct platform_device *pdev)
static int mxc_v4l2_suspend (struct platform_device *pdev, pm_message_t state)
static int mxc_v4l2_resume (struct platform_device *pdev)
static __init int camera_init (void)
static void __exit camera_exit (void)

Variables

static video_fmt_t video_fmts []
static video_fmt_idx video_index = TV_NOT_LOCKED
static struct v4l2_int_master mxc_v4l2_master
static struct v4l2_file_operations mxc_v4l_fops
static struct platform_driver mxc_v4l2_driver

Detailed Description

Mxc Video For Linux 2 driver.


Define Documentation

#define MXC_V4L2_CAPTURE_NUM_OUTPUTS   6

This data is used for the output to the display.

Referenced by mxc_v4l_do_ioctl().

#define TV_STD_MAX   (TV_NOT_LOCKED + 1)

Number of video standards supported (including 'not locked' signal).


Enumeration Type Documentation

List of TV input video formats supported. The video formats is corresponding to the v4l2_id in video_fmt_t. Currently, only PAL and NTSC is supported. Needs to be expanded in the future.

Enumerator:
ADV7180_NTSC 

Locked on (M) NTSC video signal.

ADV7180_PAL 

(B, G, H, I, N)PAL video signal.

ADV7180_NOT_LOCKED 

Not locked on a signal.

TV_NTSC 

Locked on (M) NTSC video signal.

TV_PAL 

(B, G, H, I, N)PAL video signal.

TV_NOT_LOCKED 

Not locked on a signal.


Function Documentation

static void camera_callback ( u32  mask,
void *  dev 
) [static]

Camera V4l2 callback function.

Parameters:
mask u32
dev void device structure
Returns:
status

Referenced by init_camera_struct().

static void __exit camera_exit ( void   )  [static]

Exit and cleanup for the V4L2

static __init int camera_init ( void   )  [static]

Entry point for the V4L2

Returns:
Error code indicating success or failure
static void camera_platform_release ( struct device *  device  )  [static]

This function can be used to release any platform data on closing.

Referenced by mxc_v4l2_probe().

static void init_camera_struct ( cam_data cam,
struct platform_device *  pdev 
) [static]

initialize cam_data structure

Parameters:
cam structure cam_data *
Returns:
status 0 Success

References camera_callback(), ipu_csi_set_window_pos(), ipu_csi_set_window_size(), and mxc_v4l2_master.

Referenced by mxc_v4l2_probe().

static int mxc_allocate_frame_buf ( cam_data cam,
int  count 
) [static]

Allocate frame buffers

Parameters:
cam Structure cam_data*
count int number of buffer need to allocated
Returns:
status -0 Successfully allocated a buffer, -ENOBUFS failed.

References mxc_free_frame_buf().

Referenced by mxc_v4l_do_ioctl().

static int mxc_free_frame_buf ( cam_data cam  )  [static]

Free frame buffers

Parameters:
cam Structure cam_data *
Returns:
status 0 success.

Referenced by mxc_allocate_frame_buf(), mxc_v4l2_remove(), mxc_v4l_close(), and mxc_v4l_do_ioctl().

static void mxc_free_frames ( cam_data cam  )  [static]

Free frame buffers status

Parameters:
cam Structure cam_data *
Returns:
none

Referenced by mxc_streamoff(), and mxc_v4l_close().

static int mxc_mmap ( struct file *  file,
struct vm_area_struct *  vma 
) [static]

V4L interface - mmap function

Parameters:
file structure file *
vma structure vm_area_struct *
Returns:
status 0 Success, EINTR busy lock error, ENOBUFS remap_page error
static unsigned int mxc_poll ( struct file *  file,
struct poll_table_struct *  wait 
) [static]

V4L interface - poll function

Parameters:
file structure file *
wait structure poll_table_struct *
Returns:
status POLLIN | POLLRDNORM
static int mxc_streamoff ( cam_data cam  )  [static]

Shut down the encoder job

Parameters:
cam structure cam_data *
Returns:
status 0 Success

References mxc_free_frames().

Referenced by mxc_v4l_close(), and mxc_v4l_do_ioctl().

static int mxc_streamon ( cam_data cam  )  [static]

Start the encoder job

Parameters:
cam structure cam_data *
Returns:
status 0 Success

References start_preview(), and stop_preview().

Referenced by mxc_v4l2_resume(), and mxc_v4l_do_ioctl().

static int mxc_v4l2_buffer_status ( cam_data cam,
struct v4l2_buffer *  buf 
) [static]

Return the buffer status

Parameters:
cam Structure cam_data *
buf Structure v4l2_buffer *
Returns:
status 0 success, EINVAL failed.

Referenced by mxc_v4l_do_ioctl().

static int mxc_v4l2_g_ctrl ( cam_data cam,
struct v4l2_control *  c 
) [static]

get control param

Parameters:
cam structure cam_data *
c structure v4l2_control *
Returns:
status 0 success, EINVAL failed

Referenced by mxc_v4l_do_ioctl().

static int mxc_v4l2_g_fmt ( cam_data cam,
struct v4l2_format *  f 
) [static]

V4L2 - mxc_v4l2_g_fmt function

Parameters:
cam structure cam_data *
f structure v4l2_format *
Returns:
status 0 success, EINVAL failed

Referenced by mxc_v4l_do_ioctl().

static int mxc_v4l2_g_std ( cam_data cam,
v4l2_std_id *  e 
) [static]

V4L2 - mxc_v4l2_g_std function

Gets the TV standard from the TV input device.

Parameters:
cam structure cam_data *
e structure v4l2_streamparm *
Returns:
status 0 success, EINVAL failed

References mxc_v4l2_s_std().

Referenced by mxc_v4l_do_ioctl().

static int mxc_v4l2_master_attach ( struct v4l2_int_device *  slave  )  [static]

Initializes the camera driver.

static void mxc_v4l2_master_detach ( struct v4l2_int_device *  slave  )  [static]

Disconnects the camera driver.

static int mxc_v4l2_probe ( struct platform_device *  pdev  )  [static]

This function is called to probe the devices if registered.

Parameters:
pdev the device structure used to give information on which device to probe
Returns:
The function returns 0 on success and -1 on failure.

References camera_platform_release(), and init_camera_struct().

static int mxc_v4l2_remove ( struct platform_device *  pdev  )  [static]

This function is called to remove the devices when device unregistered.

Parameters:
pdev the device structure used to give information on which device to remove
Returns:
The function returns 0 on success and -1 on failure.

References mxc_free_frame_buf().

static int mxc_v4l2_resume ( struct platform_device *  pdev  )  [static]

This function is called to bring the sensor back from a low power state. Refer to the document driver-model/driver.txt in the kernel source tree for more information.

Parameters:
pdev the device structure
Returns:
The function returns 0 on success and -1 on failure

References mxc_streamon(), and start_preview().

static int mxc_v4l2_s_ctrl ( cam_data cam,
struct v4l2_control *  c 
) [static]

V4L2 - set_control function V4L2_CID_PRIVATE_BASE is the extention for IPU preprocessing. 0 for normal operation 1 for vertical flip 2 for horizontal flip 3 for horizontal and vertical flip 4 for 90 degree rotation

Parameters:
cam structure cam_data *
c structure v4l2_control *
Returns:
status 0 success, EINVAL failed

References ipu_csi_flash_strobe().

Referenced by mxc_v4l_do_ioctl().

static int mxc_v4l2_s_fmt ( cam_data cam,
struct v4l2_format *  f 
) [static]

V4L2 - mxc_v4l2_s_fmt function

Parameters:
cam structure cam_data *
f structure v4l2_format *
Returns:
status 0 success, EINVAL failed

References valid_mode(), and verify_preview().

Referenced by mxc_v4l_do_ioctl().

static int mxc_v4l2_s_param ( cam_data cam,
struct v4l2_streamparm *  parm 
) [static]

V4L2 - mxc_v4l2_s_param function Allows setting of capturemode and frame rate.

Parameters:
cam structure cam_data *
parm structure v4l2_streamparm *
Returns:
status 0 success, EINVAL failed

References ipu_csi_init_interface(), ipu_csi_set_window_pos(), ipu_csi_set_window_size(), start_preview(), and stop_preview().

Referenced by mxc_v4l_do_ioctl().

static int mxc_v4l2_s_std ( cam_data cam,
v4l2_std_id  e 
) [static]

V4L2 - mxc_v4l2_s_std function

Sets the TV standard to be used.

Parameters:
cam structure cam_data *
parm structure v4l2_streamparm *
Returns:
status 0 success, EINVAL failed

References video_fmt_t::active_height, video_fmt_t::active_left, video_fmt_t::active_top, video_fmt_t::active_width, video_fmt_t::name, video_fmt_t::raw_height, video_fmt_t::raw_width, TV_NOT_LOCKED, TV_NTSC, TV_PAL, and video_index.

Referenced by mxc_v4l2_g_std(), and mxc_v4l_do_ioctl().

static int mxc_v4l2_suspend ( struct platform_device *  pdev,
pm_message_t  state 
) [static]

This function is called to put the sensor in a low power state. Refer to the document driver-model/driver.txt in the kernel source tree for more information.

Parameters:
pdev the device structure used to give information on which I2C to suspend
state the power state the device is entering
Returns:
The function returns 0 on success and -1 on failure.

References stop_preview().

static int mxc_v4l_close ( struct file *  file  )  [static]

V4L interface - close function

Parameters:
file struct file *
Returns:
0 success

References csi_enc_deselect(), mxc_free_frame_buf(), mxc_free_frames(), mxc_streamoff(), prp_enc_deselect(), and stop_preview().

static long mxc_v4l_do_ioctl ( struct file *  file,
unsigned int  ioctlnr,
void *  arg 
) [static]
static int mxc_v4l_dqueue ( cam_data cam,
struct v4l2_buffer *  buf 
) [static]

Dequeue one V4L capture buffer

Parameters:
cam structure cam_data *
buf structure v4l2_buffer *
Returns:
status 0 success, EINVAL invalid frame number, ETIME timeout, ERESTARTSYS interrupted by user

Referenced by mxc_v4l_do_ioctl().

static int mxc_v4l_open ( struct file *  file  )  [static]

V4L interface - open function

Parameters:
file structure file *
Returns:
status 0 success, ENODEV invalid device instance, ENODEV timeout, ERESTARTSYS interrupted by user

References csi_enc_select(), ipu_csi_init_interface(), ipu_csi_set_window_pos(), ipu_csi_set_window_size(), and prp_enc_select().

static int start_preview ( cam_data cam  )  [static]

start the viewfinder job

Parameters:
cam structure cam_data *
Returns:
status 0 Success

References prp_vf_sdc_select(), and prp_vf_sdc_select_bg().

Referenced by mxc_streamon(), mxc_v4l2_resume(), mxc_v4l2_s_param(), and mxc_v4l_do_ioctl().

static int stop_preview ( cam_data cam  )  [static]

shut down the viewfinder job

Parameters:
cam structure cam_data *
Returns:
status 0 Success

References prp_vf_sdc_deselect(), and prp_vf_sdc_deselect_bg().

Referenced by mxc_streamon(), mxc_v4l2_s_param(), mxc_v4l2_suspend(), mxc_v4l_close(), and mxc_v4l_do_ioctl().

static int valid_mode ( u32  palette  )  [inline, static]

Indicates whether the palette is supported.

Parameters:
palette V4L2_PIX_FMT_RGB565, V4L2_PIX_FMT_BGR24 or V4L2_PIX_FMT_BGR32
Returns:
0 if failed

Referenced by mxc_v4l2_s_fmt().

static int verify_preview ( cam_data cam,
struct v4l2_window *  win 
) [static]

Valid and adjust the overlay window size, position

Parameters:
cam structure cam_data *
win struct v4l2_window *
Returns:
0

Referenced by mxc_v4l2_s_fmt().


Variable Documentation

struct platform_driver mxc_v4l2_driver [static]
Initial value:
 {
        .driver = {
                   .name = "mxc_v4l2_capture",
                   },
        .probe = mxc_v4l2_probe,
        .remove = mxc_v4l2_remove,
        .suspend = mxc_v4l2_suspend,
        .resume = mxc_v4l2_resume,
        .shutdown = NULL,
}

This structure contains pointers to the power management callback functions.

struct v4l2_int_master mxc_v4l2_master [static]
Initial value:

Information about this driver.

Referenced by init_camera_struct().

struct v4l2_file_operations mxc_v4l_fops [static]
Initial value:
 {
        .owner = THIS_MODULE,
        .open = mxc_v4l_open,
        .release = mxc_v4l_close,
        .read = mxc_v4l_read,
        .ioctl = mxc_v4l_ioctl,
        .mmap = mxc_mmap,
        .poll = mxc_poll,
}

This structure defines the functions to be called in this driver.

video_fmt_t video_fmts[] [static]
Initial value:
 {
        {                       
         .v4l2_id = V4L2_STD_NTSC,
         .name = "NTSC",
         .raw_width = 720,              
         .raw_height = 525,             
         .active_width = 720,           
         .active_height = 480,          
         .active_top = 13,
         .active_left = 0,
         },
        {                       
         .v4l2_id = V4L2_STD_PAL,
         .name = "PAL",
         .raw_width = 720,
         .raw_height = 625,
         .active_width = 720,
         .active_height = 576,
         .active_top = 0,
         .active_left = 0,
         },
        {                       
         .v4l2_id = V4L2_STD_ALL,
         .name = "Autodetect",
         .raw_width = 720,
         .raw_height = 625,
         .active_width = 720,
         .active_height = 576,
         .active_top = 0,
         .active_left = 0,
         },
}

Description of video formats supported.

PAL: raw=720x625, active=720x576. NTSC: raw=720x525, active=720x480.

video_fmt_idx video_index = TV_NOT_LOCKED [static]

* Standard index of TV.

Referenced by mxc_v4l2_s_std().

footer
©  Freescale Semiconductor, Inc., 2007.  All rights reserved.
Freescale Confidential Proprietary
NDA Required
doxygen