V4L/DVB (11743): Analog Devices ADV7343 video encoder driver
[pandora-kernel.git] / include / media / v4l2-subdev.h
index 9a8535b..a503e1c 100644 (file)
@@ -37,12 +37,6 @@ struct v4l2_decode_vbi_line {
        u32 type;               /* VBI service type (V4L2_SLICED_*). 0 if no service found */
 };
 
-/* s_crystal_freq */
-struct v4l2_crystal_freq {
-       u32 freq;       /* frequency in Hz of the crystal */
-       u32 flags;      /* device specific flags */
-};
-
 /* Sub-devices are devices that are connected somehow to the main bridge
    device. These devices are usually audio/video muxers/encoders/decoders or
    sensors and webcam controllers.
@@ -89,21 +83,21 @@ struct v4l2_crystal_freq {
        values. Do not use for new drivers and should be removed in existing
        drivers.
 
-  reset: generic reset command. The argument selects which subsystems to
+   load_fw: load firmware.
+
+   reset: generic reset command. The argument selects which subsystems to
        reset. Passing 0 will always reset the whole chip. Do not use for new
        drivers without discussing this first on the linux-media mailinglist.
        There should be no reason normally to reset a device.
 
    s_gpio: set GPIO pins. Very simple right now, might need to be extended with
        a direction argument if needed.
-
-   s_standby: puts tuner on powersaving state, disabling it, except for i2c.
  */
 struct v4l2_subdev_core_ops {
        int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
        int (*log_status)(struct v4l2_subdev *sd);
        int (*init)(struct v4l2_subdev *sd, u32 val);
-       int (*s_standby)(struct v4l2_subdev *sd, u32 standby);
+       int (*load_fw)(struct v4l2_subdev *sd);
        int (*reset)(struct v4l2_subdev *sd, u32 val);
        int (*s_gpio)(struct v4l2_subdev *sd, u32 val);
        int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
@@ -113,6 +107,7 @@ struct v4l2_subdev_core_ops {
        int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
        int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
        int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
+       int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
        long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
 #ifdef CONFIG_VIDEO_ADV_DEBUG
        int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
@@ -127,6 +122,8 @@ struct v4l2_subdev_core_ops {
    s_type_addr: sets tuner type and its I2C addr.
 
    s_config: sets tda9887 specific stuff, like port1, port2 and qss
+
+   s_standby: puts tuner on powersaving state, disabling it, except for i2c.
  */
 struct v4l2_subdev_tuner_ops {
        int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
@@ -135,9 +132,9 @@ struct v4l2_subdev_tuner_ops {
        int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
        int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
        int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
-       int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
        int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
        int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
+       int (*s_standby)(struct v4l2_subdev *sd);
 };
 
 /* s_clock_freq: set the frequency (in Hz) of the audio clock output.
@@ -151,7 +148,8 @@ struct v4l2_subdev_tuner_ops {
        board designs. Usual values for the frequency are 1024000 and 2048000.
        If the frequency is not supported, then -EINVAL is returned.
 
-   s_routing: used to define the input and/or output pins of an audio chip.
+   s_routing: used to define the input and/or output pins of an audio chip,
+       and any additional configuration data.
        Never attempt to use user-level input IDs (e.g. Composite, S-Video,
        Tuner) at this level. An i2c device shouldn't know about whether an
        input pin is connected to a Composite connector, become on another
@@ -162,7 +160,7 @@ struct v4l2_subdev_tuner_ops {
 struct v4l2_subdev_audio_ops {
        int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
        int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
-       int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route);
+       int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
 };
 
 /*
@@ -175,36 +173,36 @@ struct v4l2_subdev_audio_ops {
        v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
        type field is set to 0 on return.
 
-  s_vbi_data: used to generate VBI signals on a video signal.
+   s_vbi_data: used to generate VBI signals on a video signal.
        v4l2_sliced_vbi_data is filled with the data packets that should be
        output. Note that if you set the line field to 0, then that VBI signal
        is disabled. If no valid VBI data was found, then the type field is
        set to 0 on return.
 
-  g_vbi_data: used to obtain the sliced VBI packet from a readback register.
+   g_vbi_data: used to obtain the sliced VBI packet from a readback register.
        Not all video decoders support this. If no data is available because
        the readback register contains invalid or erroneous data -EIO is
        returned. Note that you must fill in the 'id' member and the 'field'
        member (to determine whether CC data from the first or second field
        should be obtained).
 
-  s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
+   s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
        video input devices.
 
   s_crystal_freq: sets the frequency of the crystal used to generate the
-       clocks. An extra flags field allows device specific configuration
+       clocks in Hz. An extra flags field allows device specific configuration
        regarding clock frequency dividers, etc. If not used, then set flags
        to 0. If the frequency is not supported, then -EINVAL is returned.
 
-  g_input_status: get input status. Same as the status field in the v4l2_input
+   g_input_status: get input status. Same as the status field in the v4l2_input
        struct.
 
-  s_routing: see s_routing in audio_ops, except this version is for video
+   s_routing: see s_routing in audio_ops, except this version is for video
        devices.
  */
 struct v4l2_subdev_video_ops {
-       int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route);
-       int (*s_crystal_freq)(struct v4l2_subdev *sd, struct v4l2_crystal_freq *freq);
+       int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
+       int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
        int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
        int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
        int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
@@ -232,12 +230,16 @@ struct v4l2_subdev_ops {
 
 #define V4L2_SUBDEV_NAME_SIZE 32
 
+/* Set this flag if this subdev is a i2c device. */
+#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
+
 /* Each instance of a subdev driver should create this struct, either
    stand-alone or embedded in a larger struct.
  */
 struct v4l2_subdev {
        struct list_head list;
        struct module *owner;
+       u32 flags;
        struct v4l2_device *v4l2_dev;
        const struct v4l2_subdev_ops *ops;
        /* name must be unique */
@@ -266,6 +268,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
        BUG_ON(!ops || !ops->core);
        sd->ops = ops;
        sd->v4l2_dev = NULL;
+       sd->flags = 0;
        sd->name[0] = '\0';
        sd->grp_id = 0;
        sd->priv = NULL;