lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Apr 2016 10:31:41 +0100
From:	Nick Dyer <nick.dyer@...ev.co.uk>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-media@...r.kernel.org,
	Benjamin Tissoires <benjamin.tissoires@...hat.com>,
	Benson Leung <bleung@...omium.org>,
	Alan Bowens <Alan.Bowens@...el.com>,
	Javier Martinez Canillas <javier@....samsung.com>,
	Chris Healy <cphealy@...il.com>,
	Henrik Rydberg <rydberg@...math.org>,
	Andrew Duggan <aduggan@...aptics.com>,
	James Chen <james.chen@....com.tw>,
	Dudley Du <dudl@...ress.com>,
	Andrew de los Reyes <adlr@...omium.org>,
	sheckylin@...omium.org, Peter Hutterer <peter.hutterer@...-t.net>,
	Florian Echtler <floe@...terbrot.org>,
	Nick Dyer <nick.dyer@...ev.co.uk>
Subject: [PATCH 8/8] Input: atmel_mxt_ts - add v4l pixelformat definition for touch refs output

---
 drivers/input/touchscreen/atmel_mxt_ts.c | 33 ++++++++++++++++++++++++--------
 include/uapi/linux/videodev2.h           |  1 +
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 3bb1179..94ed8bd 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2396,21 +2396,24 @@ static int mxt_set_input(struct mxt_data *data, unsigned int i)
 	if (i >= MXT_V4L_INPUT_MAX)
 		return -EINVAL;
 
+	f->pixelformat = V4L2_PIX_FMT_Y16;
+
 	switch (i) {
-	case MXT_V4L_INPUT_REFS:
 	case MXT_V4L_INPUT_DELTAS:
+		f->pixelformat = V4L2_PIX_FMT_YS16; /* fall-through */
+	case MXT_V4L_INPUT_REFS:
 		f->width = data->xy_switch ? data->ysize : data->xsize;
 		f->height = data->xy_switch ? data->xsize : data->ysize;
 		break;
 
-	case MXT_V4L_INPUT_REFS_SINGLE:
 	case MXT_V4L_INPUT_DELTAS_SINGLE:
+		f->pixelformat = V4L2_PIX_FMT_YS16; /* fall-through */
+	case MXT_V4L_INPUT_REFS_SINGLE:
 		f->width = 1;
 		f->height = 1;
 		break;
 	}
 
-	f->pixelformat = V4L2_PIX_FMT_Y16;
 	f->field = V4L2_FIELD_NONE;
 	f->colorspace = V4L2_COLORSPACE_SRGB;
 	f->bytesperline = f->width * sizeof(u16);
@@ -2447,12 +2450,26 @@ static int mxt_vidioc_fmt(struct file *file, void *priv, struct v4l2_format *f)
 static int mxt_vidioc_enum_fmt(struct file *file, void *priv,
 				 struct v4l2_fmtdesc *fmt)
 {
-	if (fmt->index > 0 || fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+	if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
 		return -EINVAL;
 
-	fmt->pixelformat = V4L2_PIX_FMT_Y16;
-	strlcpy(fmt->description, "16-bit raw debug data",
-		sizeof(fmt->description));
+	switch (fmt->index) {
+	case 0:
+		fmt->pixelformat = V4L2_PIX_FMT_Y16;
+		strlcpy(fmt->description, "16-bit unsigned raw debug data",
+			sizeof(fmt->description));
+		break;
+
+	case 1:
+		fmt->pixelformat = V4L2_PIX_FMT_YS16;
+		strlcpy(fmt->description, "16-bit signed raw debug data",
+			sizeof(fmt->description));
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
 	fmt->flags = 0;
 	return 0;
 }
@@ -2484,7 +2501,7 @@ static int mxt_vidioc_enum_framesizes(struct file *file, void *priv,
 static int mxt_vidioc_enum_frameintervals(struct file *file, void *priv,
 					  struct v4l2_frmivalenum *f)
 {
-	if ((f->index > 0) || (f->pixel_format != V4L2_PIX_FMT_Y16))
+	if (f->index > 0)
 		return -EINVAL;
 
 	f->type = V4L2_FRMIVAL_TYPE_DISCRETE;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 14cd5eb..ab577dd 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -496,6 +496,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_Y12     v4l2_fourcc('Y', '1', '2', ' ') /* 12  Greyscale     */
 #define V4L2_PIX_FMT_Y16     v4l2_fourcc('Y', '1', '6', ' ') /* 16  Greyscale     */
 #define V4L2_PIX_FMT_Y16_BE  v4l2_fourcc_be('Y', '1', '6', ' ') /* 16  Greyscale BE  */
+#define V4L2_PIX_FMT_YS16    v4l2_fourcc('Y', 'S', '1', '6') /* signed 16-bit Greyscale */
 
 /* Grey bit-packed formats */
 #define V4L2_PIX_FMT_Y10BPACK    v4l2_fourcc('Y', '1', '0', 'B') /* 10  Greyscale bit-packed */
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ