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

Analog Device ADV7180 video decoder functions. More...

Data Structures

struct  sensor
struct  video_fmt_t

Defines

#define ADV7180_STD_MAX   (ADV7180_PAL + 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 adv7180_probe (struct i2c_client *adapter, const struct i2c_device_id *id)
static int adv7180_detach (struct i2c_client *client)
static DEFINE_MUTEX (mutex)
static int adv7180_read (u8 reg)
static int adv7180_write_reg (u8 reg, u8 val)
static void adv7180_get_std (v4l2_std_id *std)
static int ioctl_g_ifparm (struct v4l2_int_device *s, struct v4l2_ifparm *p)
static int ioctl_s_power (struct v4l2_int_device *s, int on)
static int ioctl_g_parm (struct v4l2_int_device *s, struct v4l2_streamparm *a)
static int ioctl_s_parm (struct v4l2_int_device *s, struct v4l2_streamparm *a)
static int ioctl_g_fmt_cap (struct v4l2_int_device *s, struct v4l2_format *f)
static int ioctl_queryctrl (struct v4l2_int_device *s, struct v4l2_queryctrl *qc)
static int ioctl_g_ctrl (struct v4l2_int_device *s, struct v4l2_control *vc)
static int ioctl_s_ctrl (struct v4l2_int_device *s, struct v4l2_control *vc)
static int ioctl_enum_framesizes (struct v4l2_int_device *s, struct v4l2_frmsizeenum *fsize)
static int ioctl_g_chip_ident (struct v4l2_int_device *s, int *id)
static int ioctl_init (struct v4l2_int_device *s)
static int ioctl_dev_init (struct v4l2_int_device *s)
static void adv7180_hard_reset (bool cvbs)
static __init int adv7180_init (void)
static void __exit adv7180_clean (void)

Variables

struct sensor adv7180_data
static video_fmt_t video_fmts []
static video_fmt_idx video_idx = ADV7180_PAL
static struct v4l2_int_ioctl_desc adv7180_ioctl_desc []

Detailed Description

Analog Device ADV7180 video decoder functions.


Define Documentation

#define ADV7180_STD_MAX   (ADV7180_PAL + 1)

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


Enumeration Type Documentation

List of input video formats supported. The video formats is corresponding with v4l2 id in video_fmt_t

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 __exit adv7180_clean ( void   )  [static]

ADV7180 cleanup function. Called on rmmod.

Returns:
Error code indicating success or failure.

References adv7180_data.

static int adv7180_detach ( struct i2c_client *  client  )  [static]

ADV7180 I2C detach function. Called on rmmod.

Parameters:
*client struct i2c_client*.
Returns:
Error code indicating success or failure.

References adv7180_data, and adv7180_write_reg().

static void adv7180_get_std ( v4l2_std_id *  std  )  [static]

Return attributes of current video standard. Since this device autodetects the current standard, this function also sets the values that need to be changed if the standard changes. There is no set std equivalent function.

Returns:
None.

References adv7180_data, ADV7180_NOT_LOCKED, ADV7180_NTSC, ADV7180_PAL, adv7180_read(), video_fmt_t::raw_height, video_fmt_t::raw_width, and video_idx.

Referenced by ioctl_g_fmt_cap().

static void adv7180_hard_reset ( bool  cvbs  )  [static]

ADV7180 Reset function.

Returns:
None.

References adv7180_data, and adv7180_write_reg().

Referenced by adv7180_probe().

static __init int adv7180_init ( void   )  [static]

ADV7180 init function. Called on insmod.

Returns:
Error code indicating success or failure.
static int adv7180_probe ( struct i2c_client *  client,
const struct i2c_device_id *  id 
) [static]

ADV7180 I2C attach function.

Parameters:
*adapter struct i2c_adapter *.
Returns:
Error code indicating success or failure.

ADV7180 I2C probe function. Function set in i2c_driver struct. Called by insmod.

Parameters:
*adapter I2C adapter descriptor.
Returns:
Error code indicating success or failure.

References adv7180_data, adv7180_hard_reset(), ADV7180_NOT_LOCKED, adv7180_read(), video_fmt_t::raw_height, video_fmt_t::raw_width, and video_idx.

static int adv7180_read ( u8  reg  )  [inline, static]

Read one register from a ADV7180 i2c slave device.

Parameters:
*reg register in the device we wish to access.
Returns:
0 if success, an error code otherwise.

References adv7180_data.

Referenced by adv7180_get_std(), adv7180_probe(), and ioctl_g_ctrl().

static int adv7180_write_reg ( u8  reg,
u8  val 
) [static]

Write one register of a ADV7180 i2c slave device.

Parameters:
*reg register in the device we wish to access.
Returns:
0 if success, an error code otherwise.

References adv7180_data.

Referenced by adv7180_detach(), adv7180_hard_reset(), ioctl_s_ctrl(), and ioctl_s_power().

static DEFINE_MUTEX ( mutex   )  [static]

This mutex is used to provide mutual exclusion.

Create a mutex that can be used to provide mutually exclusive read/write access to the globally accessible data structures and variables that were defined above.

static int ioctl_dev_init ( struct v4l2_int_device *  s  )  [static]

ioctl_dev_init - V4L2 sensor interface handler for vidioc_int_dev_init_num : pointer to standard V4L2 device structure

Initialise the device when slave attaches to the master.

References adv7180_data.

static int ioctl_enum_framesizes ( struct v4l2_int_device *  s,
struct v4l2_frmsizeenum *  fsize 
) [static]

ioctl_enum_framesizes - V4L2 sensor interface handler for VIDIOC_ENUM_FRAMESIZES ioctl : pointer to standard V4L2 device structure : standard V4L2 VIDIOC_ENUM_FRAMESIZES ioctl structure

Return 0 if successful, otherwise -EINVAL.

References video_fmt_t::active_height, video_fmt_t::active_width, and video_idx.

static int ioctl_g_chip_ident ( struct v4l2_int_device *  s,
int *  id 
) [static]

ioctl_g_chip_ident - V4L2 sensor interface handler for VIDIOC_DBG_G_CHIP_IDENT ioctl : pointer to standard V4L2 device structure : pointer to int

Return 0.

static int ioctl_g_ctrl ( struct v4l2_int_device *  s,
struct v4l2_control *  vc 
) [static]

ioctl_g_ctrl - V4L2 sensor interface handler for VIDIOC_G_CTRL ioctl : pointer to standard V4L2 device structure : standard V4L2 VIDIOC_G_CTRL ioctl structure

If the requested control is supported, returns the control's current value from the video_control[] array. Otherwise, returns -EINVAL if the control is not supported.

References adv7180_data, and adv7180_read().

static int ioctl_g_fmt_cap ( struct v4l2_int_device *  s,
struct v4l2_format *  f 
) [static]

ioctl_g_fmt_cap - V4L2 sensor interface handler for ioctl_g_fmt_cap : pointer to standard V4L2 device structure : pointer to standard V4L2 v4l2_format structure

Returns the sensor's current pixel format in the v4l2_format parameter.

References adv7180_data, and adv7180_get_std().

static int ioctl_g_ifparm ( struct v4l2_int_device *  s,
struct v4l2_ifparm *  p 
) [static]

ioctl_g_ifparm - V4L2 sensor interface handler for vidioc_int_g_ifparm_num s: pointer to standard V4L2 device structure p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure

Gets slave interface parameters. Calculates the required xclk value to support the requested clock parameters in p. This value is returned in the p parameter.

vidioc_int_g_ifparm returns platform-specific information about the interface settings used by the sensor.

Called on open.

References adv7180_data.

static int ioctl_g_parm ( struct v4l2_int_device *  s,
struct v4l2_streamparm *  a 
) [static]

ioctl_g_parm - V4L2 sensor interface handler for VIDIOC_G_PARM ioctl : pointer to standard V4L2 device structure : pointer to standard V4L2 VIDIOC_G_PARM ioctl structure

Returns the sensor's video CAPTURE parameters.

References adv7180_data.

static int ioctl_init ( struct v4l2_int_device *  s  )  [static]

ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT : pointer to standard V4L2 device structure

References adv7180_data.

static int ioctl_queryctrl ( struct v4l2_int_device *  s,
struct v4l2_queryctrl *  qc 
) [static]

ioctl_queryctrl - V4L2 sensor interface handler for VIDIOC_QUERYCTRL ioctl : pointer to standard V4L2 device structure : standard V4L2 VIDIOC_QUERYCTRL ioctl structure

If the requested control is supported, returns the control information from the video_control[] array. Otherwise, returns -EINVAL if the control is not supported.

References adv7180_data.

static int ioctl_s_ctrl ( struct v4l2_int_device *  s,
struct v4l2_control *  vc 
) [static]

ioctl_s_ctrl - V4L2 sensor interface handler for VIDIOC_S_CTRL ioctl : pointer to standard V4L2 device structure : standard V4L2 VIDIOC_S_CTRL ioctl structure

If the requested control is supported, sets the control's current value in HW (and updates the video_control[] array). Otherwise, returns -EINVAL if the control is not supported.

References adv7180_data, and adv7180_write_reg().

static int ioctl_s_parm ( struct v4l2_int_device *  s,
struct v4l2_streamparm *  a 
) [static]

ioctl_s_parm - V4L2 sensor interface handler for VIDIOC_S_PARM ioctl : pointer to standard V4L2 device structure : pointer to standard V4L2 VIDIOC_S_PARM ioctl structure

Configures the sensor to use the input parameters, if possible. If not possible, reverts to the old parameters and returns the appropriate error code.

This driver cannot change these settings.

References adv7180_data.

static int ioctl_s_power ( struct v4l2_int_device *  s,
int  on 
) [static]

Sets the camera power.

s pointer to the camera device on if 1, power is to be turned on. 0 means power is to be turned off

ioctl_s_power - V4L2 sensor interface handler for vidioc_int_s_power_num : pointer to standard V4L2 device structure : power state to which device is to be set

Sets devices power state to requrested state, if possible. This is called on open, close, suspend and resume.

References adv7180_data, and adv7180_write_reg().


Variable Documentation

struct v4l2_int_ioctl_desc adv7180_ioctl_desc[] [static]
Initial value:
 {

        {vidioc_int_dev_init_num, (v4l2_int_ioctl_func*)ioctl_dev_init},

        


        {vidioc_int_s_power_num, (v4l2_int_ioctl_func*)ioctl_s_power},
        {vidioc_int_g_ifparm_num, (v4l2_int_ioctl_func*)ioctl_g_ifparm},


        {vidioc_int_init_num, (v4l2_int_ioctl_func*)ioctl_init},

        


        


        {vidioc_int_g_fmt_cap_num, (v4l2_int_ioctl_func*)ioctl_g_fmt_cap},

        


        {vidioc_int_g_parm_num, (v4l2_int_ioctl_func*)ioctl_g_parm},
        {vidioc_int_s_parm_num, (v4l2_int_ioctl_func*)ioctl_s_parm},
        {vidioc_int_queryctrl_num, (v4l2_int_ioctl_func*)ioctl_queryctrl},
        {vidioc_int_g_ctrl_num, (v4l2_int_ioctl_func*)ioctl_g_ctrl},
        {vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func*)ioctl_s_ctrl},
        {vidioc_int_enum_framesizes_num,
                                (v4l2_int_ioctl_func *) ioctl_enum_framesizes},
        {vidioc_int_g_chip_ident_num,
                                (v4l2_int_ioctl_func *)ioctl_g_chip_ident},
}

This structure defines all the ioctls for this module.

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,  
         },
        {                       
         .v4l2_id = V4L2_STD_PAL,
         .name = "PAL",
         .raw_width = 720,
         .raw_height = 625,
         .active_width = 720,
         .active_height = 576,
         },
        {                       
         .v4l2_id = V4L2_STD_ALL,
         .name = "Autodetect",
         .raw_width = 720,
         .raw_height = 625,
         .active_width = 720,
         .active_height = 576,
         },
}

Description of video formats supported.

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

video_fmt_idx video_idx = ADV7180_PAL [static]

* Standard index of ADV7180.

Referenced by adv7180_get_std(), adv7180_probe(), and ioctl_enum_framesizes().

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