diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-05 13:24:37 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-10 10:23:42 +0100 |
commit | 8fc3486783f1571c7d836d397c8ff4fa2ca6457c (patch) | |
tree | 22670a3a50fec82c2bf7dd73fc25d973addc6f1b /drivers/media/pci/saa7134/saa7134-video.c | |
parent | [media] add media controller support to videobuf2-dvb (diff) | |
download | linux-8fc3486783f1571c7d836d397c8ff4fa2ca6457c.tar.xz linux-8fc3486783f1571c7d836d397c8ff4fa2ca6457c.zip |
[media] saa7134: use input types, instead of hardcoding strings
Currently, the saa7134 driver is hardcoding input names on each
board entry. More modern drivers define, instead, an enum for each
input type.
While the current logic works, it adds extra complexity at the driver,
as it needs to discover the type of the input using some euristics.
Instead, let's standardize the input types and use a type, instead of
a name on all places.
That will allow further patches to properly report the input type
via VIDIOC_G_INPUT and to remove an extra field from the struct to
identify if the input is for TV.
Please notice that several boards define an input for receiving composite
signals via a S-Video connector. The name of such input was inconsistent,
so this patch cleans it and make it to be properly reported the
same way for all boards.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/pci/saa7134/saa7134-video.c')
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-video.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 7a42d3ae3ac9..ae52ef019e43 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -409,7 +409,8 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) static void video_mux(struct saa7134_dev *dev, int input) { - video_dbg("video input = %d [%s]\n", input, card_in(dev, input).name); + video_dbg("video input = %d [%s]\n", + input, saa7134_input_name[card_in(dev, input).type]); dev->ctl_input = input; set_tvnorm(dev, dev->tvnorm); saa7134_tvaudio_setinput(dev, &card_in(dev, input)); @@ -1381,11 +1382,11 @@ int saa7134_enum_input(struct file *file, void *priv, struct v4l2_input *i) n = i->index; if (n >= SAA7134_INPUT_MAX) return -EINVAL; - if (NULL == card_in(dev, i->index).name) + if (card_in(dev, i->index).type == SAA7134_NO_INPUT) return -EINVAL; i->index = n; i->type = V4L2_INPUT_TYPE_CAMERA; - strcpy(i->name, card_in(dev, n).name); + strcpy(i->name, saa7134_input_name[card_in(dev, n).type]); if (card_in(dev, n).tv) i->type = V4L2_INPUT_TYPE_TUNER; if (n == dev->ctl_input) { @@ -1419,7 +1420,7 @@ int saa7134_s_input(struct file *file, void *priv, unsigned int i) if (i >= SAA7134_INPUT_MAX) return -EINVAL; - if (NULL == card_in(dev, i).name) + if (card_in(dev, i).type == SAA7134_NO_INPUT) return -EINVAL; video_mux(dev, i); return 0; @@ -1661,7 +1662,7 @@ int saa7134_g_tuner(struct file *file, void *priv, } if (n == SAA7134_INPUT_MAX) return -EINVAL; - if (NULL != card_in(dev, n).name) { + if (card_in(dev, n).type != SAA7134_NO_INPUT) { strcpy(t->name, "Television"); t->type = V4L2_TUNER_ANALOG_TV; saa_call_all(dev, tuner, g_tuner, t); |