Re: [PATCH v5 1/9] [media] v4l2-core: Add support for touch devices

2016-06-27 Thread Hans Verkuil
On 06/23/2016 12:08 AM, Nick Dyer wrote:
> 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 +

You forgot drivers/media/v4l2-core/v4l2-compat-ioctl32.c.

For the next version, please place the docbook changes in a separate patch.

>  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 000..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

And the V4L2_CAP_TOUCH flag, right?

> +capabilities field of 
> +returned by the  ioctl.
> +
> +  At least one of the read/write, streaming or asynchronous I/O methods

Change to:

"At least one of the read/write or streaming I/O methods"

Asynchronous I/O was never implemented. We really need to remove this old stuff
from the spec.

> +must be supported.
> +
> +
> +
> +  Data Format Negotiation
> +
> +   A touch device may support read/write
> +and/or streaming (memory mapping or
> +user pointer) I/O.

dma-buf isn't mentioned here.

> +
> 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 

Re: [PATCH v5 1/9] [media] v4l2-core: Add support for touch devices

2016-06-24 Thread Nick Dyer


On 22/06/2016 23:08, Nick Dyer wrote:
> 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 
> ---
[...]
> 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_ASYNCIO0x0200  /* async I/O */
>  #define V4L2_CAP_STREAMING  0x0400  /* streaming I/O ioctls 
> */
>  
> +#define V4L2_CAP_TOUCH   0x0010  /* Is a touch 
> device */

Apologies, this should have been
#define V4L2_CAP_TOUCH 0x1000

You will find my changes to v4l2-compliance to support these changes here:
https://github.com/ndyer/v4l-utils

I've tested the atmel_mxt_ts version of this with v4l2-compliance on Pixel 2.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 1/9] [media] v4l2-core: Add support for touch devices

2016-06-23 Thread Dmitry Torokhov
On Wed, Jun 22, 2016 at 11:08:25PM +0100, Nick Dyer wrote:
> 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 

Hans/Mauro, when you merge this can you make a stable branch (maybe
based on 4.6) so I can pull it in as well and then merge the rest?

Thanks!

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html