summaryrefslogtreecommitdiff
path: root/drivers/media/pci
diff options
context:
space:
mode:
authorIsmael Luceno <ismael@iodev.co.uk>2016-05-04 19:21:21 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-06-28 14:04:43 +0300
commitf4bca74f3721b8726fe609c22534a3bad90d2790 (patch)
treede922b008493497ba5d9300569b1098c086ede59 /drivers/media/pci
parent9c41e6908660f5d94aac9e63ca673f3fb9ccfc71 (diff)
downloadlinux-f4bca74f3721b8726fe609c22534a3bad90d2790.tar.xz
[media] solo6x10: Simplify solo_enum_ext_input
Additionally, now it specifies which channels it's showing. Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r--drivers/media/pci/solo6x10/solo6x10-v4l2.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2.c b/drivers/media/pci/solo6x10/solo6x10-v4l2.c
index 721ff5320de7..953d6bf22320 100644
--- a/drivers/media/pci/solo6x10/solo6x10-v4l2.c
+++ b/drivers/media/pci/solo6x10/solo6x10-v4l2.c
@@ -386,26 +386,24 @@ static int solo_querycap(struct file *file, void *priv,
static int solo_enum_ext_input(struct solo_dev *solo_dev,
struct v4l2_input *input)
{
- static const char * const dispnames_1[] = { "4UP" };
- static const char * const dispnames_2[] = { "4UP-1", "4UP-2" };
- static const char * const dispnames_5[] = {
- "4UP-1", "4UP-2", "4UP-3", "4UP-4", "16UP"
- };
- const char * const *dispnames;
-
- if (input->index >= (solo_dev->nr_chans + solo_dev->nr_ext))
- return -EINVAL;
-
- if (solo_dev->nr_ext == 5)
- dispnames = dispnames_5;
- else if (solo_dev->nr_ext == 2)
- dispnames = dispnames_2;
- else
- dispnames = dispnames_1;
+ int ext = input->index - solo_dev->nr_chans;
+ unsigned int nup, first;
- snprintf(input->name, sizeof(input->name), "Multi %s",
- dispnames[input->index - solo_dev->nr_chans]);
+ if (ext >= solo_dev->nr_ext)
+ return -EINVAL;
+ nup = (ext == 4) ? 16 : 4;
+ first = (ext & 3) << 2; /* first channel in the n-up */
+ snprintf(input->name, sizeof(input->name),
+ "Multi %d-up (cameras %d-%d)",
+ nup, first + 1, first + nup);
+ /* Possible outputs:
+ * Multi 4-up (cameras 1-4)
+ * Multi 4-up (cameras 5-8)
+ * Multi 4-up (cameras 9-12)
+ * Multi 4-up (cameras 13-16)
+ * Multi 16-up (cameras 1-16)
+ */
return 0;
}