summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-04-25 12:19:02 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-05-01 08:24:44 -0300
commitc34b7ef551a37d899d3e896fd2b72f83b820a574 (patch)
tree513074c668fd084ff31cd9fb21228cc508e3d532 /drivers
parent44a38dfb6a00dcc4ef6010b39bc4dfc6a54263d8 (diff)
[media] dt3155v4l: support inputs VID0-3
The dt3155 together with the J1 breakout cable supports 4 inputs. Add support for all inputs VID0 - VID3. Note that input VID0 is shared with input J2. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/media/dt3155v4l/dt3155v4l.c18
-rw-r--r--drivers/staging/media/dt3155v4l/dt3155v4l.h2
2 files changed, 16 insertions, 4 deletions
diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c
index 450728f7ff83..43c9e0f97876 100644
--- a/drivers/staging/media/dt3155v4l/dt3155v4l.c
+++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c
@@ -370,9 +370,12 @@ static int dt3155_s_std(struct file *filp, void *p, v4l2_std_id norm)
static int dt3155_enum_input(struct file *filp, void *p, struct v4l2_input *input)
{
- if (input->index)
+ if (input->index > 3)
return -EINVAL;
- strcpy(input->name, "Coax in");
+ if (input->index)
+ snprintf(input->name, sizeof(input->name), "VID%d", input->index);
+ else
+ strlcpy(input->name, "J2/VID0", sizeof(input->name));
input->type = V4L2_INPUT_TYPE_CAMERA;
input->std = V4L2_STD_ALL;
input->status = 0;
@@ -381,14 +384,21 @@ static int dt3155_enum_input(struct file *filp, void *p, struct v4l2_input *inpu
static int dt3155_g_input(struct file *filp, void *p, unsigned int *i)
{
- *i = 0;
+ struct dt3155_priv *pd = video_drvdata(filp);
+
+ *i = pd->input;
return 0;
}
static int dt3155_s_input(struct file *filp, void *p, unsigned int i)
{
- if (i)
+ struct dt3155_priv *pd = video_drvdata(filp);
+
+ if (i > 3)
return -EINVAL;
+ pd->input = i;
+ write_i2c_reg(pd->regs, AD_ADDR, AD_CMD_REG);
+ write_i2c_reg(pd->regs, AD_CMD, (i << 6) | (i << 4) | SYNC_LVL_3);
return 0;
}
diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.h b/drivers/staging/media/dt3155v4l/dt3155v4l.h
index 75c7281efb03..bcf7b5ef75e6 100644
--- a/drivers/staging/media/dt3155v4l/dt3155v4l.h
+++ b/drivers/staging/media/dt3155v4l/dt3155v4l.h
@@ -168,6 +168,7 @@
* @std: input standard
* @width: frame width
* @height: frame height
+ * @input: current input
* @sequence: frame counter
* @stats: statistics structure
* @regs: local copy of mmio base register
@@ -186,6 +187,7 @@ struct dt3155_priv {
spinlock_t lock;
v4l2_std_id std;
unsigned width, height;
+ unsigned input;
unsigned int sequence;
void __iomem *regs;
u8 csr2, config;