diff options
Diffstat (limited to 'include/media/v4l2-subdev.h')
| -rw-r--r-- | include/media/v4l2-subdev.h | 65 | 
1 files changed, 43 insertions, 22 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index bfda0fe9aeb..d7465725773 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -159,9 +159,11 @@ 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 (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm); -	int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);  	long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); +#ifdef CONFIG_COMPAT +	long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd, +			       unsigned long arg); +#endif  #ifdef CONFIG_VIDEO_ADV_DEBUG  	int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);  	int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg); @@ -192,6 +194,7 @@ struct v4l2_subdev_tuner_ops {  	int (*s_radio)(struct v4l2_subdev *sd);  	int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency *freq);  	int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); +	int (*enum_freq_bands)(struct v4l2_subdev *sd, struct v4l2_frequency_band *band);  	int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);  	int (*s_tuner)(struct v4l2_subdev *sd, const struct v4l2_tuner *vt);  	int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); @@ -229,15 +232,18 @@ struct v4l2_subdev_audio_ops {  /* Indicates the @length field specifies maximum data length. */  #define V4L2_MBUS_FRAME_DESC_FL_LEN_MAX		(1U << 0) -/* Indicates user defined data format, i.e. non standard frame format. */ +/* + * Indicates that the format does not have line offsets, i.e. the + * receiver should use 1D DMA. + */  #define V4L2_MBUS_FRAME_DESC_FL_BLOB		(1U << 1)  /**   * struct v4l2_mbus_frame_desc_entry - media bus frame description structure   * @flags: V4L2_MBUS_FRAME_DESC_FL_* flags   * @pixelcode: media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set - * @length: number of octets per frame, valid for compressed or unspecified - *          formats + * @length: number of octets per frame, valid if V4L2_MBUS_FRAME_DESC_FL_BLOB + *	    is set   */  struct v4l2_mbus_frame_desc_entry {  	u16 flags; @@ -264,8 +270,11 @@ struct v4l2_mbus_frame_desc {     g_std_output: get current standard for video OUTPUT devices. This is ignored  	by video input devices. -   g_tvnorms_output: get v4l2_std_id with all standards supported by video -	OUTPUT device. This is ignored by video input devices. +   g_tvnorms: get v4l2_std_id with all standards supported by the video +	CAPTURE device. This is ignored by video output devices. + +   g_tvnorms_output: get v4l2_std_id with all standards supported by the video +	OUTPUT device. This is ignored by video capture devices.     s_crystal_freq: sets the frequency of the crystal used to generate the  	clocks in Hz. An extra flags field allows device specific configuration @@ -305,9 +314,12 @@ struct v4l2_mbus_frame_desc {  struct v4l2_subdev_video_ops {  	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 (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm); +	int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);  	int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);  	int (*g_std_output)(struct v4l2_subdev *sd, v4l2_std_id *std);  	int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); +	int (*g_tvnorms)(struct v4l2_subdev *sd, v4l2_std_id *std);  	int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std);  	int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);  	int (*s_stream)(struct v4l2_subdev *sd, int enable); @@ -326,12 +338,8 @@ struct v4l2_subdev_video_ops {  			struct v4l2_dv_timings *timings);  	int (*g_dv_timings)(struct v4l2_subdev *sd,  			struct v4l2_dv_timings *timings); -	int (*enum_dv_timings)(struct v4l2_subdev *sd, -			struct v4l2_enum_dv_timings *timings);  	int (*query_dv_timings)(struct v4l2_subdev *sd,  			struct v4l2_dv_timings *timings); -	int (*dv_timings_cap)(struct v4l2_subdev *sd, -			struct v4l2_dv_timings_cap *cap);  	int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,  			     enum v4l2_mbus_pixelcode *code);  	int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, @@ -503,8 +511,12 @@ struct v4l2_subdev_pad_ops {  			     struct v4l2_subdev_selection *sel);  	int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,  			     struct v4l2_subdev_selection *sel); -	int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid); -	int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid); +	int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); +	int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); +	int (*dv_timings_cap)(struct v4l2_subdev *sd, +			      struct v4l2_dv_timings_cap *cap); +	int (*enum_dv_timings)(struct v4l2_subdev *sd, +			       struct v4l2_enum_dv_timings *timings);  #ifdef CONFIG_MEDIA_CONTROLLER  	int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,  			     struct v4l2_subdev_format *source_fmt, @@ -559,6 +571,17 @@ struct v4l2_subdev_internal_ops {  /* Set this flag if this subdev generates events. */  #define V4L2_SUBDEV_FL_HAS_EVENTS		(1U << 3) +struct regulator_bulk_data; + +struct v4l2_subdev_platform_data { +	/* Optional regulators uset to power on/off the subdevice */ +	struct regulator_bulk_data *regulators; +	int num_regulators; + +	/* Per-subdevice data, specific for a certain video host device */ +	void *host_priv; +}; +  /* Each instance of a subdev driver should create this struct, either     stand-alone or embedded in a larger struct.   */ @@ -568,6 +591,7 @@ struct v4l2_subdev {  #endif  	struct list_head list;  	struct module *owner; +	bool owner_v4l2_dev;  	u32 flags;  	struct v4l2_device *v4l2_dev;  	const struct v4l2_subdev_ops *ops; @@ -592,6 +616,8 @@ struct v4l2_subdev {  	struct v4l2_async_subdev *asd;  	/* Pointer to the managing notifier. */  	struct v4l2_async_notifier *notifier; +	/* common part of subdevice platform data */ +	struct v4l2_subdev_platform_data *pdata;  };  #define media_entity_to_v4l2_subdev(ent) \ @@ -622,13 +648,13 @@ struct v4l2_subdev_fh {  	v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh,	\  				       unsigned int pad)		\  	{								\ -		BUG_ON(unlikely(pad >= vdev_to_v4l2_subdev(		\ -					fh->vfh.vdev)->entity.num_pads)); \ +		BUG_ON(pad >= vdev_to_v4l2_subdev(			\ +					fh->vfh.vdev)->entity.num_pads); \  		return &fh->pad[pad].field_name;			\  	}  __V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, format, try_fmt) -__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_compose) +__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_crop)  __V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose)  #endif @@ -667,17 +693,12 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,  /* Call an ops of a v4l2_subdev, doing the right checks against     NULL pointers. -   Example: err = v4l2_subdev_call(sd, core, s_std, norm); +   Example: err = v4l2_subdev_call(sd, video, s_std, norm);   */  #define v4l2_subdev_call(sd, o, f, args...)				\  	(!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ?	\  		(sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) -/* Send a notification to v4l2_device. */ -#define v4l2_subdev_notify(sd, notification, arg)			   \ -	((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \ -	 (sd)->v4l2_dev->notify((sd), (notification), (arg))) -  #define v4l2_subdev_has_op(sd, o, f) \  	((sd)->ops->o && (sd)->ops->o->f)  | 
