From: Nick Dyer <nick.dyer@itdev.co.uk>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Benson Leung <bleung@chromium.org>,
Alan Bowens <Alan.Bowens@atmel.com>,
Javier Martinez Canillas <javier@osg.samsung.com>,
Chris Healy <cphealy@gmail.com>,
Henrik Rydberg <rydberg@bitmath.org>,
Andrew Duggan <aduggan@synaptics.com>,
James Chen <james.chen@emc.com.tw>, Dudley Du <dudl@cypress.com>,
Andrew de los Reyes <adlr@chromium.org>,
sheckylin@chromium.org, Peter Hutterer <peter.hutterer@who-t.net>,
Florian Echtler <floe@butterbrot.org>,
Nick Dyer <nick.dyer@itdev.co.uk>
Subject: [PATCH 8/8] Input: atmel_mxt_ts - add v4l pixelformat definition for touch refs output
Date: Thu, 21 Apr 2016 10:31:41 +0100 [thread overview]
Message-ID: <1461231101-1237-9-git-send-email-nick.dyer@itdev.co.uk> (raw)
In-Reply-To: <1461231101-1237-1-git-send-email-nick.dyer@itdev.co.uk>
---
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
next prev parent reply other threads:[~2016-04-21 9:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 9:31 [PATCH 0/8] Input: atmel_mxt_ts - output raw touch diagnostic data via V4L Nick Dyer
2016-04-21 9:31 ` [PATCH 1/8] Input: atmel_mxt_ts - add support for T37 diagnostic data Nick Dyer
2016-04-21 9:31 ` [PATCH 2/8] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device Nick Dyer
2016-04-21 11:04 ` kbuild test robot
2016-04-21 11:23 ` kbuild test robot
2016-04-21 11:43 ` kbuild test robot
2016-04-21 9:31 ` [PATCH 3/8] Input: atmel_mxt_ts - read touchscreen size Nick Dyer
2016-04-21 9:31 ` [PATCH 4/8] Input: atmel_mxt_ts - handle diagnostic data orientation Nick Dyer
2016-04-21 9:31 ` [PATCH 5/8] Input: atmel_mxt_ts - add diagnostic data support for mXT1386 Nick Dyer
2016-04-21 9:31 ` [PATCH 6/8] Input: atmel_mxt_ts - add support for reference data Nick Dyer
2016-04-21 9:31 ` [PATCH 7/8] Input: atmel_mxt_ts - single node diagnostic data support Nick Dyer
2016-04-21 9:31 ` Nick Dyer [this message]
2016-04-22 8:26 ` [PATCH 0/8] Input: atmel_mxt_ts - output raw touch diagnostic data via V4L Hans Verkuil
2016-04-22 14:45 ` Mauro Carvalho Chehab
2016-04-22 15:07 ` Nick Dyer
2016-04-22 15:18 ` Hans Verkuil
2016-04-22 15:44 ` Mauro Carvalho Chehab
2016-04-29 12:14 ` Nick Dyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461231101-1237-9-git-send-email-nick.dyer@itdev.co.uk \
--to=nick.dyer@itdev.co.uk \
--cc=Alan.Bowens@atmel.com \
--cc=adlr@chromium.org \
--cc=aduggan@synaptics.com \
--cc=benjamin.tissoires@redhat.com \
--cc=bleung@chromium.org \
--cc=cphealy@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dudl@cypress.com \
--cc=floe@butterbrot.org \
--cc=james.chen@emc.com.tw \
--cc=javier@osg.samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
--cc=rydberg@bitmath.org \
--cc=sheckylin@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox