Adding multiple input support to soc-camera and tw9910
PATCH 1/1 Adding multiple input support to soc-camera and tw9910
# HG changeset patch
# User Philipp Wiesner <[email protected]>
# Date 1257265069 -3600
# Node ID a5254e7d306a8c1f50aaa7c6e97a4bae236bfd1a # Parent 43878f8dbfb0ad732883efcc3525f868b337e9a2 Added enum_input, g_input & s_input to soc-camera and tw9910
From: Philipp Wiesner <[email protected]>
soc-camera.c:soc_camera_enum_input: capable of handling multiple inputs.soc_camera_g_input: calls icd's g_input if present.soc_camera_s_input: calls icd's s_input if present.tw9910.ctw9910_enum_input: now does what it's supposed to.tw9910_g_input: reads current input from register INFORMtw9910_s_input: writes requested input to register INFORMsoc_camera_ops: added g_input and s_input aliases. I'm not sure if there is a reason the input functions are not usable with v4l2_subdev_ops. Added them to soc_camera_ops for now because enum_input was already defined there. soc-camera.h:
struct soc_camera_ops: Added aliases for g_input and s_input functions here.
Priority: normal
linux/drivers/media/video/soc_camera.c +19 -7
@@ -119,11 +119,10 @@struct soc_camera_device *icd = icf->icd;int ret =0 ; -if (inp->index !=0 ) -return -EINVAL ; -if (icd->ops->enum_input) ret = icd->ops->enum_input (icd, inp); +else if (inp->index !=0 ) +return -EINVAL ;else {/* default is camera */ inp->type =V4L2_INPUT_TYPE_CAMERA ;
@@ -136,17 +135,30 @@static int soc_camera_g_input (struct file *file,void *priv,unsigned int *i) { - *i =0 ; +struct soc_camera_file *icf = file->private_data; +struct soc_camera_device *icd = icf->icd; +int ret =0 ; -return 0 ; +if (icd->ops->g_input) + ret = icd->ops->g_input (icd, i); +else + *i =0 ; + +return ret; }static int soc_camera_s_input (struct file *file,void *priv,unsigned int i) { -if (i >0 ) +struct soc_camera_file *icf = file->private_data; +struct soc_camera_device *icd = icf->icd; +int ret =0 ; + +if (icd->ops->s_input) + ret = icd->ops->s_input (icd, i); +else if (i >0 )return -EINVAL ; -return 0 ; +return ret; }static int soc_camera_s_std (struct file *file,void *priv,v4l2_std_id *a)
linux/drivers/media/video/tw9910.c +43 -3
58 lines not on this page · raw message
linux/include/media/soc_camera.h +2 -0
@@ -197,6 +197,8 @@unsigned long (*query_bus_param)(struct soc_camera_device *);int (*set_bus_param)(struct soc_camera_device *,unsigned long );int (*enum_input)(struct soc_camera_device *,struct v4l2_input *); +int (*g_input)(struct soc_camera_device *,unsigned int *); +int (*s_input)(struct soc_camera_device *,unsigned int );const struct v4l2_queryctrl *controls;int num_controls; };
Signature · 2 lines
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01