From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dyer Subject: [PATCH v5 1/9] [media] v4l2-core: Add support for touch devices Date: Wed, 22 Jun 2016 23:08:25 +0100 Message-ID: <1466633313-15339-2-git-send-email-nick.dyer@itdev.co.uk> References: <1466633313-15339-1-git-send-email-nick.dyer@itdev.co.uk> Return-path: Received: from kdh-gw.itdev.co.uk ([89.21.227.133]:34421 "EHLO hermes.kdh.itdev.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750833AbcFVWIn (ORCPT ); Wed, 22 Jun 2016 18:08:43 -0400 In-Reply-To: <1466633313-15339-1-git-send-email-nick.dyer@itdev.co.uk> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Dmitry Torokhov , Hans Verkuil Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Benjamin Tissoires , Benson Leung , Alan Bowens , Javier Martinez Canillas , Chris Healy , Henrik Rydberg , Andrew Duggan , James Chen , Dudley Du , Andrew de los Reyes , sheckylin@chromium.org, Peter Hutterer , Florian Echtler , mchehab@osg.samsung.com, nick.dyer@itdev.co.uk Some touch controllers send out touch data in a similar way to a greyscale frame grabber. Use a new device prefix v4l-touch for these devices, to stop generic capture software from treating them as webcams. Add formats: - V4L2_TCH_FMT_DELTA_TD16 for signed 16-bit touch deltas - V4L2_TCH_FMT_DELTA_TD08 for signed 16-bit touch deltas - V4L2_TCH_FMT_TU16 for unsigned 16-bit touch data - V4L2_TCH_FMT_TU08 for unsigned 8-bit touch data This support will be used by: * Atmel maXTouch (atmel_mxt_ts) * Synaptics RMI4. * sur40 Signed-off-by: Nick Dyer --- Documentation/DocBook/media/v4l/dev-touch.xml | 53 ++++++++++++++ Documentation/DocBook/media/v4l/media-types.xml | 5 ++ .../DocBook/media/v4l/pixfmt-tch-td08.xml | 66 +++++++++++++++++ .../DocBook/media/v4l/pixfmt-tch-td16.xml | 82 ++++++++++++++++++++++ .../DocBook/media/v4l/pixfmt-tch-tu08.xml | 66 +++++++++++++++++ .../DocBook/media/v4l/pixfmt-tch-tu16.xml | 81 +++++++++++++++++++++ Documentation/DocBook/media/v4l/pixfmt.xml | 13 ++++ Documentation/DocBook/media/v4l/v4l2.xml | 1 + drivers/media/v4l2-core/v4l2-dev.c | 16 ++++- drivers/media/v4l2-core/v4l2-ioctl.c | 44 ++++++++++++ drivers/media/v4l2-core/videobuf2-v4l2.c | 1 + include/media/v4l2-dev.h | 3 +- include/uapi/linux/media.h | 2 + include/uapi/linux/videodev2.h | 10 +++ 14 files changed, 439 insertions(+), 4 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/dev-touch.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-td16.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-tu08.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-tu16.xml diff --git a/Documentation/DocBook/media/v4l/dev-touch.xml b/Documentation/DocBook/media/v4l/dev-touch.xml new file mode 100644 index 0000000..9e36328 --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-touch.xml @@ -0,0 +1,53 @@ +Touch Devices + +Touch devices are accessed through character device special files + named /dev/v4l-touch0 to + /dev/v4l-touch255 with major number 81 and + dynamically allocated minor numbers 0 to 255. + +
+ Overview + + Sensors may be Optical, or Projected Capacitive touch (PCT). + + Processing is required to analyse the raw data and produce input + events. In some systems, this may be performed on the ASIC and the raw data + is purely a side-channel for diagnostics or tuning. In other systems, the + ASIC is a simple analogue front end device which delivers touch data at + high rate, and any touch processing must be done on the host. + + For capacitive touch sensing, the touchscreen is composed of an array + of horizontal and vertical conductors (alternatively called rows/columns, + X/Y lines, or tx/rx). Mutual Capacitance measured is at the nodes where the + conductors cross. Alternatively, Self Capacitance measures the signal from + each column and row independently. + + A touch input may be determined by comparing the raw capacitance + measurement to a no-touch reference (or "baseline") measurement: + + Delta = Raw - Reference + + The reference measurement takes account of variations in the + capacitance across the touch sensor matrix, for example + manufacturing irregularities, environmental or edge effects. +
+ +
+ Querying Capabilities + + Devices supporting the touch interface set the + V4L2_CAP_VIDEO_CAPTURE flag in the + capabilities field of &v4l2-capability; + returned by the &VIDIOC-QUERYCAP; ioctl. + + At least one of the read/write, streaming or asynchronous I/O methods + must be supported. +
+ +
+ Data Format Negotiation + + A touch device may support read/write + and/or streaming (memory mapping or + user pointer) I/O. +
diff --git a/Documentation/DocBook/media/v4l/media-types.xml b/Documentation/DocBook/media/v4l/media-types.xml index 5e3f20f..fb957c7 100644 --- a/Documentation/DocBook/media/v4l/media-types.xml +++ b/Documentation/DocBook/media/v4l/media-types.xml @@ -202,6 +202,11 @@ typically, /dev/swradio? + MEDIA_INTF_T_V4L_TOUCH + Device node interface for Touch device (V4L) + typically, /dev/v4l-touch? + + MEDIA_INTF_T_ALSA_PCM_CAPTURE Device node interface for ALSA PCM Capture typically, /dev/snd/pcmC?D?c diff --git a/Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml b/Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml new file mode 100644 index 0000000..2483eb0 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml @@ -0,0 +1,66 @@ + + + V4L2_TCH_FMT_DELTA_TD08 ('TD08') + &manvol; + + + V4L2_TCH_FMT_DELTA_TD08 + 8-bit signed Touch Delta + + + Description + + This format represents delta data from a touch controller + + Delta values may range from -128 to 127. Typically the values + will vary through a small range depending on whether the sensor is + touched or not. The full value may be seen if one of the + touchscreen nodes has a fault or the line is not connected. + + + <constant>V4L2_TCH_FMT_DELTA_TD08</constant> 4 × 4 + node matrix + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + D'00 + D'01 + D'02 + D'03 + + + start + 4: + D'10 + D'11 + D'12 + D'13 + + + start + 8: + D'20 + D'21 + D'22 + D'23 + + + start + 12: + D'30 + D'31 + D'32 + D'33 + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-tch-td16.xml b/Documentation/DocBook/media/v4l/pixfmt-tch-td16.xml new file mode 100644 index 0000000..72f6245 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-tch-td16.xml @@ -0,0 +1,82 @@ + + + V4L2_TCH_FMT_DELTA_TD16 ('TD16') + &manvol; + + + V4L2_TCH_FMT_DELTA_TD16 + 16-bit signed Touch Delta + + + Description + + This format represents delta data from a touch controller + + Delta values may range from -32768 to 32767. Typically the values + will vary through a small range depending on whether the sensor is + touched or not. The full value may be seen if one of the + touchscreen nodes has a fault or the line is not connected. + + + <constant>V4L2_TCH_FMT_DELTA_TD16</constant> 4 × 4 + node matrix + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + D'00low + D'00high + D'01low + D'01high + D'02low + D'02high + D'03low + D'03high + + + start + 8: + D'10low + D'10high + D'11low + D'11high + D'12low + D'12high + D'13low + D'13high + + + start + 16: + D'20low + D'20high + D'21low + D'21high + D'22low + D'22high + D'23low + D'23high + + + start + 24: + D'30low + D'30high + D'31low + D'31high + D'32low + D'32high + D'33low + D'33high + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-tch-tu08.xml b/Documentation/DocBook/media/v4l/pixfmt-tch-tu08.xml new file mode 100644 index 0000000..4547670 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-tch-tu08.xml @@ -0,0 +1,66 @@ + + + V4L2_TCH_FMT_TU08 ('TU08') + &manvol; + + + V4L2_TCH_FMT_U08 + 8-bit unsigned raw touch data + + + Description + + This format represents unsigned 8-bit data from a touch + controller. + + This may be used for output for raw and reference data. Values may + range from 0 to 255 + + + <constant>V4L2_TCH_FMT_U08</constant> 4 × 4 + node matrix + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + R'00 + R'01 + R'02 + R'03 + + + start + 4: + R'10 + R'11 + R'12 + R'13 + + + start + 8: + R'20 + R'21 + R'22 + R'23 + + + start + 12: + R'30 + R'31 + R'32 + R'33 + + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt-tch-tu16.xml b/Documentation/DocBook/media/v4l/pixfmt-tch-tu16.xml new file mode 100644 index 0000000..13d9444 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-tch-tu16.xml @@ -0,0 +1,81 @@ + + + V4L2_TCH_FMT_TU16 ('TU16') + &manvol; + + + V4L2_TCH_FMT_U16 + 16-bit unsigned raw touch data + + + Description + + This format represents unsigned 16-bit data from a touch + controller. + + This may be used for output for raw and reference data. Values may + range from 0 to 65535 + + + <constant>V4L2_TCH_FMT_U16</constant> 4 × 4 + node matrix + + + Byte Order. + Each cell is one byte. + + + + + + start + 0: + R'00low + R'00high + R'01low + R'01high + R'02low + R'02high + R'03low + R'03high + + + start + 8: + R'10low + R'10high + R'11low + R'11high + R'12low + R'12high + R'13low + R'13high + + + start + 16: + R'20low + R'20high + R'21low + R'21high + R'22low + R'22high + R'23low + R'23high + + + start + 24: + R'30low + R'30high + R'31low + R'31high + R'32low + R'32high + R'33low + R'33high + + + + + + + + + diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml index 5a08aee..509248a 100644 --- a/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -1754,6 +1754,19 @@ interface only. +
+ Touch Formats + + These formats are used for Touch Sensor +interface only. + + &sub-tch-td16; + &sub-tch-td08; + &sub-tch-tu16; + &sub-tch-tu08; + +
+
Reserved Format Identifiers diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index 42e626d..b577de2 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -605,6 +605,7 @@ and discussions on the V4L mailing list.
&sub-dev-radio;
&sub-dev-rds;
&sub-dev-sdr;
+
&sub-dev-touch;
&sub-dev-event;
&sub-dev-subdev;
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 70b559d..31f34fa 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -529,6 +529,7 @@ static void determine_valid_ioctls(struct video_device *vdev) bool is_sdr = vdev->vfl_type == VFL_TYPE_SDR; bool is_rx = vdev->vfl_dir != VFL_DIR_TX; bool is_tx = vdev->vfl_dir != VFL_DIR_RX; + bool is_touch = vdev->vfl_type == VFL_TYPE_TOUCH; bitmap_zero(valid_ioctls, BASE_VIDIOC_PRIVATE); @@ -573,7 +574,7 @@ static void determine_valid_ioctls(struct video_device *vdev) if (ops->vidioc_enum_freq_bands || ops->vidioc_g_tuner || ops->vidioc_g_modulator) set_bit(_IOC_NR(VIDIOC_ENUM_FREQ_BANDS), valid_ioctls); - if (is_vid) { + if (is_vid || is_touch) { /* video specific ioctls */ if ((is_rx && (ops->vidioc_enum_fmt_vid_cap || ops->vidioc_enum_fmt_vid_cap_mplane || @@ -662,7 +663,7 @@ static void determine_valid_ioctls(struct video_device *vdev) set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls); } - if (is_vid || is_vbi || is_sdr) { + if (is_vid || is_vbi || is_sdr || is_touch) { /* ioctls valid for video, vbi or sdr */ SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs); SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf); @@ -675,7 +676,7 @@ static void determine_valid_ioctls(struct video_device *vdev) SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff); } - if (is_vid || is_vbi) { + if (is_vid || is_vbi || is_touch) { /* ioctls valid for video or vbi */ if (ops->vidioc_s_std) set_bit(_IOC_NR(VIDIOC_ENUMSTD), valid_ioctls); @@ -751,6 +752,10 @@ static int video_register_media_controller(struct video_device *vdev, int type) intf_type = MEDIA_INTF_T_V4L_SWRADIO; vdev->entity.function = MEDIA_ENT_F_IO_SWRADIO; break; + case VFL_TYPE_TOUCH: + intf_type = MEDIA_INTF_T_V4L_TOUCH; + vdev->entity.function = MEDIA_ENT_F_IO_TOUCH; + break; case VFL_TYPE_RADIO: intf_type = MEDIA_INTF_T_V4L_RADIO; /* @@ -845,6 +850,8 @@ static int video_register_media_controller(struct video_device *vdev, int type) * %VFL_TYPE_SUBDEV - A subdevice * * %VFL_TYPE_SDR - Software Defined Radio + * + * %VFL_TYPE_TOUCH - A touch sensor */ int __video_register_device(struct video_device *vdev, int type, int nr, int warn_if_nr_in_use, struct module *owner) @@ -888,6 +895,9 @@ int __video_register_device(struct video_device *vdev, int type, int nr, /* Use device name 'swradio' because 'sdr' was already taken. */ name_base = "swradio"; break; + case VFL_TYPE_TOUCH: + name_base = "v4l-touch"; + break; default: printk(KERN_ERR "%s called with unknown type: %d\n", __func__, type); diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 28e5be2..3f00c67 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -155,6 +155,7 @@ const char *v4l2_type_names[] = { [V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE] = "vid-out-mplane", [V4L2_BUF_TYPE_SDR_CAPTURE] = "sdr-cap", [V4L2_BUF_TYPE_SDR_OUTPUT] = "sdr-out", + [V4L2_BUF_TYPE_TOUCH_CAPTURE] = "tch-cap", }; EXPORT_SYMBOL(v4l2_type_names); @@ -255,6 +256,7 @@ static void v4l_print_format(const void *arg, bool write_only) switch (p->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_OUTPUT: + case V4L2_BUF_TYPE_TOUCH_CAPTURE: pix = &p->fmt.pix; pr_cont(", width=%u, height=%u, " "pixelformat=%c%c%c%c, field=%s, " @@ -924,6 +926,7 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type) bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_vbi = vfd->vfl_type == VFL_TYPE_VBI; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; @@ -981,6 +984,10 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type) if (is_sdr && is_tx && ops->vidioc_g_fmt_sdr_out) return 0; break; + case V4L2_BUF_TYPE_TOUCH_CAPTURE: + if (is_tch && is_rx && ops->vidioc_g_fmt_vid_cap) + return 0; + break; default: break; } @@ -1243,6 +1250,10 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; + case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; + case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; + case V4L2_TCH_FMT_TU08: descr = "8-bit unsigned touch data"; break; default: /* Compressed formats */ @@ -1309,6 +1320,7 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file); bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; int ret = -EINVAL; @@ -1349,6 +1361,11 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops, break; ret = ops->vidioc_enum_fmt_sdr_out(file, fh, arg); break; + case V4L2_BUF_TYPE_TOUCH_CAPTURE: + if (unlikely(!is_rx || !is_tch || !ops->vidioc_enum_fmt_vid_cap)) + break; + ret = ops->vidioc_enum_fmt_vid_cap(file, fh, arg); + break; } if (ret == 0) v4l_fill_fmtdesc(p); @@ -1362,6 +1379,7 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file); bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; int ret; @@ -1447,6 +1465,14 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, if (unlikely(!is_tx || !is_sdr || !ops->vidioc_g_fmt_sdr_out)) break; return ops->vidioc_g_fmt_sdr_out(file, fh, arg); + case V4L2_BUF_TYPE_TOUCH_CAPTURE: + if (unlikely(!is_rx || !is_tch || !ops->vidioc_g_fmt_vid_cap)) + break; + p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; + ret = ops->vidioc_g_fmt_vid_cap(file, fh, arg); + /* just in case the driver zeroed it again */ + p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; + return ret; } return -EINVAL; } @@ -1458,6 +1484,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file); bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; int ret; @@ -1534,6 +1561,14 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, break; CLEAR_AFTER_FIELD(p, fmt.sdr); return ops->vidioc_s_fmt_sdr_out(file, fh, arg); + case V4L2_BUF_TYPE_TOUCH_CAPTURE: + if (unlikely(!is_rx || !is_tch || !ops->vidioc_s_fmt_vid_cap)) + break; + CLEAR_AFTER_FIELD(p, fmt.pix); + ret = ops->vidioc_s_fmt_vid_cap(file, fh, arg); + /* just in case the driver zeroed it again */ + p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; + return ret; } return -EINVAL; } @@ -1545,6 +1580,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file); bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; int ret; @@ -1618,6 +1654,14 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, break; CLEAR_AFTER_FIELD(p, fmt.sdr); return ops->vidioc_try_fmt_sdr_out(file, fh, arg); + case V4L2_BUF_TYPE_TOUCH_CAPTURE: + if (unlikely(!is_rx || !is_tch || !ops->vidioc_try_fmt_vid_cap)) + break; + CLEAR_AFTER_FIELD(p, fmt.pix); + ret = ops->vidioc_try_fmt_vid_cap(file, fh, arg); + /* just in case the driver zeroed it again */ + p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; + return ret; } return -EINVAL; } diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index 0b1b8c7..6221084 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -554,6 +554,7 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create) break; case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_OUTPUT: + case V4L2_BUF_TYPE_TOUCH_CAPTURE: requested_sizes[0] = f->fmt.pix.sizeimage; break; case V4L2_BUF_TYPE_VBI_CAPTURE: diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 25a3190..a2bbf1c 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -25,7 +25,8 @@ #define VFL_TYPE_RADIO 2 #define VFL_TYPE_SUBDEV 3 #define VFL_TYPE_SDR 4 -#define VFL_TYPE_MAX 5 +#define VFL_TYPE_TOUCH 5 +#define VFL_TYPE_MAX 6 /* Is this a receiver, transmitter or mem-to-mem? */ /* Ignored for VFL_TYPE_SUBDEV. */ diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index df59ede..81dbfec 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -77,6 +77,7 @@ struct media_device_info { #define MEDIA_ENT_F_IO_DTV (MEDIA_ENT_F_BASE + 0x01001) #define MEDIA_ENT_F_IO_VBI (MEDIA_ENT_F_BASE + 0x01002) #define MEDIA_ENT_F_IO_SWRADIO (MEDIA_ENT_F_BASE + 0x01003) +#define MEDIA_ENT_F_IO_TOUCH (MEDIA_ENT_F_BASE + 0x01004) /* * Analog TV IF-PLL decoders @@ -297,6 +298,7 @@ struct media_links_enum { #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) +#define MEDIA_INTF_T_V4L_TOUCH (MEDIA_INTF_T_V4L_BASE + 5) #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 8f95191..7e19782 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -143,6 +143,7 @@ enum v4l2_buf_type { V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, V4L2_BUF_TYPE_SDR_CAPTURE = 11, V4L2_BUF_TYPE_SDR_OUTPUT = 12, + V4L2_BUF_TYPE_TOUCH_CAPTURE = 13, /* Deprecated, do not use */ V4L2_BUF_TYPE_PRIVATE = 0x80, }; @@ -440,6 +441,8 @@ struct v4l2_capability { #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ +#define V4L2_CAP_TOUCH 0x00100000 /* Is a touch device */ + #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ /* @@ -633,6 +636,12 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +/* Touch formats - used for Touch devices */ +#define V4L2_TCH_FMT_DELTA_TD16 v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ +#define V4L2_TCH_FMT_DELTA_TD08 v4l2_fourcc('T', 'D', '0', '8') /* 8-bit signed deltas */ +#define V4L2_TCH_FMT_TU16 v4l2_fourcc('T', 'U', '1', '6') /* 16-bit unsigned touch data */ +#define V4L2_TCH_FMT_TU08 v4l2_fourcc('T', 'U', '0', '8') /* 8-bit unsigned touch data */ + /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe @@ -1399,6 +1408,7 @@ struct v4l2_input { /* Values for the 'type' field */ #define V4L2_INPUT_TYPE_TUNER 1 #define V4L2_INPUT_TYPE_CAMERA 2 +#define V4L2_INPUT_TYPE_TOUCH 3 /* field 'status' - general */ #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ -- 2.5.0