Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: synaptics-rmi4 - fix enum_fmt

Do not enumerate all formats, some of which the device may not even
support. Instead, only report the one fixed format of the currently
selected input that will survive try_fmt/s_fmt.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Philipp Zabel and committed by
Dmitry Torokhov
9a952206 9f6da5d4

+5 -15
+5 -15
drivers/input/rmi4/rmi_f54.c
··· 456 456 static int rmi_f54_vidioc_enum_fmt(struct file *file, void *priv, 457 457 struct v4l2_fmtdesc *fmt) 458 458 { 459 + struct f54_data *f54 = video_drvdata(file); 460 + 459 461 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 460 462 return -EINVAL; 461 463 462 - switch (fmt->index) { 463 - case 0: 464 - fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; 465 - break; 466 - 467 - case 1: 468 - fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD08; 469 - break; 470 - 471 - case 2: 472 - fmt->pixelformat = V4L2_TCH_FMT_TU16; 473 - break; 474 - 475 - default: 464 + if (fmt->index) 476 465 return -EINVAL; 477 - } 466 + 467 + fmt->pixelformat = f54->format.pixelformat; 478 468 479 469 return 0; 480 470 }