diff mbox

[v5,9/9] Input: sur40 - use new V4L2 touch input type

Message ID 1466633313-15339-10-git-send-email-nick.dyer@itdev.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Nick Dyer June 22, 2016, 10:08 p.m. UTC
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
---
 drivers/input/touchscreen/sur40.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Florian Echtler June 23, 2016, 6:41 a.m. UTC | #1
On 23.06.2016 00:08, Nick Dyer wrote:
> diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
> index 880c40b..841e045 100644
> --- a/drivers/input/touchscreen/sur40.c
> +++ b/drivers/input/touchscreen/sur40.c
> @@ -599,7 +599,7 @@ static int sur40_probe(struct usb_interface *interface,
>  	sur40->vdev.queue = &sur40->queue;
>  	video_set_drvdata(&sur40->vdev, sur40);
>  
> -	error = video_register_device(&sur40->vdev, VFL_TYPE_GRABBER, -1);
> +	error = video_register_device(&sur40->vdev, VFL_TYPE_TOUCH, -1);
>  	if (error) {
>  		dev_err(&interface->dev,
>  			"Unable to register video subdevice.");

As far as I could tell from looking at patch 1/9, the only visible
change for userspace will be the device name, so I'd be fine with this.

> @@ -794,7 +794,7 @@ static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
>  	if (f->index != 0)
>  		return -EINVAL;
>  	strlcpy(f->description, "8-bit greyscale", sizeof(f->description));
> -	f->pixelformat = V4L2_PIX_FMT_GREY;
> +	f->pixelformat = V4L2_TCH_FMT_TU08;

I would suggest to leave the pixel format as it is. Rationale: the data
really is greyscale image intensity data (as also evidenced by [1]), not
just a synthetic image, and changing the pixel format would break all
userspace tools.

[1] https://github.com/mkalten/reacTIVision/issues/3#issuecomment-99931807

Best, Florian
Hans Verkuil June 27, 2016, 11:06 a.m. UTC | #2
On 06/23/2016 12:08 AM, Nick Dyer wrote:
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
> ---
>  drivers/input/touchscreen/sur40.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
> index 880c40b..841e045 100644
> --- a/drivers/input/touchscreen/sur40.c
> +++ b/drivers/input/touchscreen/sur40.c
> @@ -599,7 +599,7 @@ static int sur40_probe(struct usb_interface *interface,
>  	sur40->vdev.queue = &sur40->queue;
>  	video_set_drvdata(&sur40->vdev, sur40);
>  
> -	error = video_register_device(&sur40->vdev, VFL_TYPE_GRABBER, -1);
> +	error = video_register_device(&sur40->vdev, VFL_TYPE_TOUCH, -1);
>  	if (error) {
>  		dev_err(&interface->dev,
>  			"Unable to register video subdevice.");
> @@ -763,7 +763,7 @@ static int sur40_vidioc_enum_input(struct file *file, void *priv,
>  {
>  	if (i->index != 0)
>  		return -EINVAL;
> -	i->type = V4L2_INPUT_TYPE_CAMERA;
> +	i->type = V4L2_INPUT_TYPE_TOUCH;
>  	i->std = V4L2_STD_UNKNOWN;
>  	strlcpy(i->name, "In-Cell Sensor", sizeof(i->name));
>  	i->capabilities = 0;
> @@ -794,7 +794,7 @@ static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
>  	if (f->index != 0)
>  		return -EINVAL;
>  	strlcpy(f->description, "8-bit greyscale", sizeof(f->description));
> -	f->pixelformat = V4L2_PIX_FMT_GREY;
> +	f->pixelformat = V4L2_TCH_FMT_TU08;

I suggest supporting both formats, with a note that support for GREY is needed for
backwards compatibility reasons.

Regards,

	Hans

>  	f->flags = 0;
>  	return 0;
>  }
> @@ -802,7 +802,7 @@ static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
>  static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
>  					struct v4l2_frmsizeenum *f)
>  {
> -	if ((f->index != 0) || (f->pixel_format != V4L2_PIX_FMT_GREY))
> +	if ((f->index != 0) || (f->pixel_format != V4L2_TCH_FMT_TU08))
>  		return -EINVAL;
>  
>  	f->type = V4L2_FRMSIZE_TYPE_DISCRETE;
> @@ -814,7 +814,7 @@ static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
>  static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv,
>  					    struct v4l2_frmivalenum *f)
>  {
> -	if ((f->index > 1) || (f->pixel_format != V4L2_PIX_FMT_GREY)
> +	if ((f->index > 1) || (f->pixel_format != V4L2_TCH_FMT_TU08)
>  		|| (f->width  != sur40_video_format.width)
>  		|| (f->height != sur40_video_format.height))
>  			return -EINVAL;
> @@ -903,7 +903,7 @@ static const struct video_device sur40_video_device = {
>  };
>  
>  static const struct v4l2_pix_format sur40_video_format = {
> -	.pixelformat = V4L2_PIX_FMT_GREY,
> +	.pixelformat = V4L2_TCH_FMT_TU08,
>  	.width  = SENSOR_RES_X / 2,
>  	.height = SENSOR_RES_Y / 2,
>  	.field = V4L2_FIELD_NONE,
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index 880c40b..841e045 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -599,7 +599,7 @@  static int sur40_probe(struct usb_interface *interface,
 	sur40->vdev.queue = &sur40->queue;
 	video_set_drvdata(&sur40->vdev, sur40);
 
-	error = video_register_device(&sur40->vdev, VFL_TYPE_GRABBER, -1);
+	error = video_register_device(&sur40->vdev, VFL_TYPE_TOUCH, -1);
 	if (error) {
 		dev_err(&interface->dev,
 			"Unable to register video subdevice.");
@@ -763,7 +763,7 @@  static int sur40_vidioc_enum_input(struct file *file, void *priv,
 {
 	if (i->index != 0)
 		return -EINVAL;
-	i->type = V4L2_INPUT_TYPE_CAMERA;
+	i->type = V4L2_INPUT_TYPE_TOUCH;
 	i->std = V4L2_STD_UNKNOWN;
 	strlcpy(i->name, "In-Cell Sensor", sizeof(i->name));
 	i->capabilities = 0;
@@ -794,7 +794,7 @@  static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
 	if (f->index != 0)
 		return -EINVAL;
 	strlcpy(f->description, "8-bit greyscale", sizeof(f->description));
-	f->pixelformat = V4L2_PIX_FMT_GREY;
+	f->pixelformat = V4L2_TCH_FMT_TU08;
 	f->flags = 0;
 	return 0;
 }
@@ -802,7 +802,7 @@  static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
 static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
 					struct v4l2_frmsizeenum *f)
 {
-	if ((f->index != 0) || (f->pixel_format != V4L2_PIX_FMT_GREY))
+	if ((f->index != 0) || (f->pixel_format != V4L2_TCH_FMT_TU08))
 		return -EINVAL;
 
 	f->type = V4L2_FRMSIZE_TYPE_DISCRETE;
@@ -814,7 +814,7 @@  static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
 static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv,
 					    struct v4l2_frmivalenum *f)
 {
-	if ((f->index > 1) || (f->pixel_format != V4L2_PIX_FMT_GREY)
+	if ((f->index > 1) || (f->pixel_format != V4L2_TCH_FMT_TU08)
 		|| (f->width  != sur40_video_format.width)
 		|| (f->height != sur40_video_format.height))
 			return -EINVAL;
@@ -903,7 +903,7 @@  static const struct video_device sur40_video_device = {
 };
 
 static const struct v4l2_pix_format sur40_video_format = {
-	.pixelformat = V4L2_PIX_FMT_GREY,
+	.pixelformat = V4L2_TCH_FMT_TU08,
 	.width  = SENSOR_RES_X / 2,
 	.height = SENSOR_RES_Y / 2,
 	.field = V4L2_FIELD_NONE,