Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1384007 > unrolled thread
| Started by | Nick Dyer <nick.dyer@itdev.co.uk> |
|---|---|
| First post | 2016-04-21 11:40 +0200 |
| Last post | 2016-04-21 13:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/8] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device Nick Dyer <nick.dyer@itdev.co.uk> - 2016-04-21 11:40 +0200
Re: [PATCH 2/8] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device kbuild test robot <lkp@intel.com> - 2016-04-21 13:10 +0200
Re: [PATCH 2/8] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device kbuild test robot <lkp@intel.com> - 2016-04-21 13:30 +0200
| From | Nick Dyer <nick.dyer@itdev.co.uk> |
|---|---|
| Date | 2016-04-21 11:40 +0200 |
| Subject | [PATCH 2/8] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device |
| Message-ID | <rqjfz-70c-13@gated-at.bofh.it> |
---
drivers/input/touchscreen/atmel_mxt_ts.c | 270 +++++++++++++++++++++++++++++++
1 file changed, 270 insertions(+)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 0784a18..81eecf1 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -28,6 +28,10 @@
#include <linux/of.h>
#include <linux/slab.h>
#include <asm/unaligned.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-ioctl.h>
+#include <media/videobuf2-v4l2.h>
+#include <media/videobuf2-vmalloc.h>
/* Firmware files */
#define MXT_FW_NAME "maxtouch.fw"
@@ -222,6 +226,23 @@ struct mxt_dbg {
struct t37_debug *t37_buf;
unsigned int t37_pages;
unsigned int t37_nodes;
+
+ struct v4l2_device v4l2;
+ struct v4l2_pix_format format;
+ struct video_device vdev;
+ struct vb2_queue queue;
+ struct mutex lock;
+ int input;
+};
+
+static const struct v4l2_file_operations mxt_video_fops = {
+ .owner = THIS_MODULE,
+ .open = v4l2_fh_open,
+ .release = vb2_fop_release,
+ .unlocked_ioctl = video_ioctl2,
+ .read = vb2_fop_read,
+ .mmap = vb2_fop_mmap,
+ .poll = vb2_fop_poll,
};
/* Each client has this additional data */
@@ -277,6 +298,11 @@ struct mxt_data {
struct completion crc_completion;
};
+struct mxt_vb2_buffer {
+ struct vb2_buffer vb;
+ struct list_head list;
+};
+
static size_t mxt_obj_size(const struct mxt_object *obj)
{
return obj->size_minus_one + 1;
@@ -1523,6 +1549,9 @@ static void mxt_free_input_device(struct mxt_data *data)
static void mxt_free_object_table(struct mxt_data *data)
{
+ video_unregister_device(&data->dbg.vdev);
+ v4l2_device_unregister(&data->dbg.v4l2);
+
kfree(data->object_table);
data->object_table = NULL;
kfree(data->msg_buf);
@@ -2154,10 +2183,215 @@ wait_cmd:
return mxt_convert_debug_pages(data, outbuf);
}
+static int mxt_queue_setup(struct vb2_queue *q,
+ unsigned int *nbuffers, unsigned int *nplanes,
+ unsigned int sizes[], void *alloc_ctxs[])
+{
+ struct mxt_data *data = q->drv_priv;
+
+ *nbuffers = 1;
+ *nplanes = 1;
+ sizes[0] = data->dbg.t37_nodes * sizeof(u16);
+
+ return 0;
+}
+
+static int mxt_buffer_prepare(struct vb2_buffer *vb)
+{
+ return 0;
+}
+
+static void mxt_buffer_queue(struct vb2_buffer *vb)
+{
+ struct mxt_data *data = vb2_get_drv_priv(vb->vb2_queue);
+ u16 *ptr;
+ int ret;
+
+ ptr = vb2_plane_vaddr(vb, 0);
+ if (!ptr) {
+ dev_err(&data->client->dev, "Error acquiring frame ptr\n");
+ goto fault;
+ }
+
+ ret = mxt_read_diagnostic_debug(data, MXT_DIAGNOSTIC_DELTAS, ptr);
+ if (ret)
+ goto fault;
+
+ vb2_set_plane_payload(vb, 0, data->dbg.t37_nodes * sizeof(u16));
+ vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
+ return;
+
+fault:
+ vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
+}
+
+/* V4L2 structures */
+static const struct vb2_ops mxt_queue_ops = {
+ .queue_setup = mxt_queue_setup,
+ .buf_prepare = mxt_buffer_prepare,
+ .buf_queue = mxt_buffer_queue,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
+};
+
+static const struct vb2_queue mxt_queue = {
+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ .io_modes = VB2_MMAP,
+ .buf_struct_size = sizeof(struct mxt_vb2_buffer),
+ .ops = &mxt_queue_ops,
+ .mem_ops = &vb2_vmalloc_memops,
+ .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
+ .min_buffers_needed = 1,
+};
+
+static int mxt_vidioc_querycap(struct file *file, void *priv,
+ struct v4l2_capability *cap)
+{
+ struct mxt_data *data = video_drvdata(file);
+
+ strlcpy(cap->driver, "atmel_mxt_ts", sizeof(cap->driver));
+ strlcpy(cap->card, "atmel_mxt_ts touch", sizeof(cap->card));
+ strlcpy(cap->bus_info, data->phys, sizeof(cap->bus_info));
+ cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
+ V4L2_CAP_READWRITE |
+ V4L2_CAP_STREAMING;
+ cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
+
+ return 0;
+}
+
+static int mxt_vidioc_enum_input(struct file *file, void *priv,
+ struct v4l2_input *i)
+{
+ if (i->index > 0)
+ return -EINVAL;
+
+ i->type = V4L2_INPUT_TYPE_CAMERA;
+ i->std = V4L2_STD_UNKNOWN;
+ i->capabilities = 0;
+ strlcpy(i->name, "Mutual References", sizeof(i->name));
+ return 0;
+}
+
+static int mxt_set_input(struct mxt_data *data, unsigned int i)
+{
+ struct v4l2_pix_format *f = &data->dbg.format;
+
+ if (i > 0)
+ return -EINVAL;
+
+ f->width = data->info.matrix_xsize;
+ f->height = data->info.matrix_ysize;
+ f->pixelformat = V4L2_PIX_FMT_Y16;
+ f->field = V4L2_FIELD_NONE;
+ f->colorspace = V4L2_COLORSPACE_SRGB;
+ f->bytesperline = f->width * sizeof(u16);
+ f->sizeimage = f->width * f->height * sizeof(u16);
+
+ data->dbg.input = i;
+
+ return 0;
+}
+
+static int mxt_vidioc_s_input(struct file *file, void *priv, unsigned int i)
+{
+ return mxt_set_input(video_drvdata(file), i);
+}
+
+static int mxt_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
+{
+ struct mxt_data *data = video_drvdata(file);
+
+ *i = data->dbg.input;
+
+ return 0;
+}
+
+static int mxt_vidioc_fmt(struct file *file, void *priv, struct v4l2_format *f)
+{
+ struct mxt_data *data = video_drvdata(file);
+
+ f->fmt.pix = data->dbg.format;
+
+ return 0;
+}
+
+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)
+ return -EINVAL;
+
+ fmt->pixelformat = V4L2_PIX_FMT_Y16;
+ strlcpy(fmt->description, "16-bit raw debug data",
+ sizeof(fmt->description));
+ fmt->flags = 0;
+ return 0;
+}
+
+static int mxt_vidioc_enum_framesizes(struct file *file, void *priv,
+ struct v4l2_frmsizeenum *f)
+{
+ struct mxt_data *data = video_drvdata(file);
+
+ if (f->index > 0)
+ return -EINVAL;
+
+ f->discrete.width = data->info.matrix_xsize;
+ f->discrete.height = data->info.matrix_ysize;
+ f->type = V4L2_FRMSIZE_TYPE_DISCRETE;
+ return 0;
+}
+
+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))
+ return -EINVAL;
+
+ f->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+ f->discrete.denominator = 10;
+ f->discrete.numerator = 1;
+ return 0;
+}
+
+static const struct v4l2_ioctl_ops mxt_video_ioctl_ops = {
+ .vidioc_querycap = mxt_vidioc_querycap,
+
+ .vidioc_enum_fmt_vid_cap = mxt_vidioc_enum_fmt,
+ .vidioc_s_fmt_vid_cap = mxt_vidioc_fmt,
+ .vidioc_g_fmt_vid_cap = mxt_vidioc_fmt,
+
+ .vidioc_enum_framesizes = mxt_vidioc_enum_framesizes,
+ .vidioc_enum_frameintervals = mxt_vidioc_enum_frameintervals,
+
+ .vidioc_enum_input = mxt_vidioc_enum_input,
+ .vidioc_g_input = mxt_vidioc_g_input,
+ .vidioc_s_input = mxt_vidioc_s_input,
+
+ .vidioc_reqbufs = vb2_ioctl_reqbufs,
+ .vidioc_create_bufs = vb2_ioctl_create_bufs,
+ .vidioc_querybuf = vb2_ioctl_querybuf,
+ .vidioc_qbuf = vb2_ioctl_qbuf,
+ .vidioc_dqbuf = vb2_ioctl_dqbuf,
+ .vidioc_expbuf = vb2_ioctl_expbuf,
+
+ .vidioc_streamon = vb2_ioctl_streamon,
+ .vidioc_streamoff = vb2_ioctl_streamoff,
+};
+
+static const struct video_device mxt_video_device = {
+ .name = "Atmel maxTouch",
+ .fops = &mxt_video_fops,
+ .ioctl_ops = &mxt_video_ioctl_ops,
+ .release = video_device_release_empty,
+};
+
static void mxt_debug_init(struct mxt_data *data)
{
struct mxt_dbg *dbg = &data->dbg;
struct mxt_object *object;
+ int error;
object = mxt_get_object(data, MXT_GEN_COMMAND_T6);
if (!object)
@@ -2187,8 +2421,44 @@ static void mxt_debug_init(struct mxt_data *data)
if (!dbg->t37_buf)
goto error;
+ /* init channel to zero */
+ mxt_set_input(data, 0);
+
+ /* register video device */
+ snprintf(dbg->v4l2.name, sizeof(dbg->v4l2.name), "%s", "atmel_mxt_ts");
+ error = v4l2_device_register(&data->client->dev, &dbg->v4l2);
+ if (error) {
+ dev_err(&data->client->dev, "Unable to register video master device.");
+ goto error;
+ }
+
+ /* initialize the queue */
+ mutex_init(&dbg->lock);
+ dbg->queue = mxt_queue;
+ dbg->queue.drv_priv = data;
+ dbg->queue.lock = &dbg->lock;
+
+ error = vb2_queue_init(&dbg->queue);
+ if (error)
+ goto error_unreg_v4l2;
+
+ dbg->vdev = mxt_video_device;
+ dbg->vdev.v4l2_dev = &dbg->v4l2;
+ dbg->vdev.lock = &dbg->lock;
+ dbg->vdev.queue = &dbg->queue;
+ video_set_drvdata(&dbg->vdev, data);
+
+ error = video_register_device(&dbg->vdev, VFL_TYPE_GRABBER, -1);
+ if (error) {
+ dev_err(&data->client->dev,
+ "Unable to register video subdevice.");
+ goto error_unreg_v4l2;
+ }
+
return;
+error_unreg_v4l2:
+ v4l2_device_unregister(&dbg->v4l2);
error:
dev_err(&data->client->dev, "Error initialising T37 diagnostic data\n");
}
--
2.5.0
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-04-21 13:10 +0200 |
| Subject | Re: [PATCH 2/8] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device |
| Message-ID | <rqkEH-8dU-39@gated-at.bofh.it> |
| In reply to | #1384007 |
[Multipart message — attachments visible in raw view] — view raw
Hi,
[auto build test ERROR on input/next]
[also build test ERROR on v4.6-rc4 next-20160420]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Nick-Dyer/Input-atmel_mxt_ts-output-raw-touch-diagnostic-data-via-V4L/20160421-174351
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: x86_64-randconfig-b0-04211643 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
>> ERROR: "vb2_fop_release" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "v4l2_fh_open" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_fop_mmap" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "video_ioctl2" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_fop_poll" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_fop_read" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ops_wait_finish" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ops_wait_prepare" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ioctl_streamoff" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ioctl_streamon" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ioctl_create_bufs" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ioctl_dqbuf" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ioctl_expbuf" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ioctl_qbuf" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ioctl_querybuf" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_ioctl_reqbufs" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "__video_register_device" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "video_device_release_empty" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_queue_init" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
>> ERROR: "vb2_vmalloc_memops" [drivers/input/touchscreen/atmel_mxt_ts.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-04-21 13:30 +0200 |
| Subject | Re: [PATCH 2/8] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device |
| Message-ID | <rqkY2-8lx-21@gated-at.bofh.it> |
| In reply to | #1384007 |
[Multipart message — attachments visible in raw view] — view raw
Hi,
[auto build test ERROR on input/next]
[also build test ERROR on v4.6-rc4 next-20160420]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Nick-Dyer/Input-atmel_mxt_ts-output-raw-touch-diagnostic-data-via-V4L/20160421-174351
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: arm-exynos_defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm
All errors (new ones prefixed by >>):
drivers/built-in.o: In function `video_drvdata':
>> include/media/v4l2-dev.h:224: undefined reference to `video_devdata'
>> include/media/v4l2-dev.h:224: undefined reference to `video_devdata'
>> include/media/v4l2-dev.h:224: undefined reference to `video_devdata'
>> include/media/v4l2-dev.h:224: undefined reference to `video_devdata'
>> include/media/v4l2-dev.h:224: undefined reference to `video_devdata'
drivers/built-in.o: In function `mxt_free_object_table':
>> drivers/input/touchscreen/atmel_mxt_ts.c:1552: undefined reference to `video_unregister_device'
>> drivers/input/touchscreen/atmel_mxt_ts.c:1553: undefined reference to `v4l2_device_unregister'
drivers/built-in.o: In function `mxt_buffer_queue':
>> drivers/input/touchscreen/atmel_mxt_ts.c:2210: undefined reference to `vb2_plane_vaddr'
>> drivers/input/touchscreen/atmel_mxt_ts.c:2225: undefined reference to `vb2_buffer_done'
drivers/input/touchscreen/atmel_mxt_ts.c:2221: undefined reference to `vb2_buffer_done'
drivers/built-in.o: In function `mxt_debug_init':
>> drivers/input/touchscreen/atmel_mxt_ts.c:2429: undefined reference to `v4l2_device_register'
>> drivers/input/touchscreen/atmel_mxt_ts.c:2437: undefined reference to `vb2_vmalloc_memops'
>> drivers/input/touchscreen/atmel_mxt_ts.c:2437: undefined reference to `vb2_vmalloc_memops'
>> drivers/input/touchscreen/atmel_mxt_ts.c:2441: undefined reference to `vb2_queue_init'
>> drivers/input/touchscreen/atmel_mxt_ts.c:2445: undefined reference to `video_device_release_empty'
>> drivers/input/touchscreen/atmel_mxt_ts.c:2445: undefined reference to `video_device_release_empty'
drivers/built-in.o: In function `video_register_device':
>> include/media/v4l2-dev.h:160: undefined reference to `__video_register_device'
drivers/built-in.o: In function `mxt_debug_init':
drivers/input/touchscreen/atmel_mxt_ts.c:2461: undefined reference to `v4l2_device_unregister'
drivers/built-in.o: In function `.LANCHOR1':
>> :(.rodata+0x3a090): undefined reference to `vb2_ops_wait_prepare'
>> :(.rodata+0x3a094): undefined reference to `vb2_ops_wait_finish'
>> :(.rodata+0x3a0b8): undefined reference to `vb2_fop_read'
>> :(.rodata+0x3a0c0): undefined reference to `vb2_fop_poll'
vim +1552 drivers/input/touchscreen/atmel_mxt_ts.c
1546 data->input_dev = NULL;
1547 }
1548 }
1549
1550 static void mxt_free_object_table(struct mxt_data *data)
1551 {
> 1552 video_unregister_device(&data->dbg.vdev);
> 1553 v4l2_device_unregister(&data->dbg.v4l2);
1554
1555 kfree(data->object_table);
1556 data->object_table = NULL;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web