Re: [PATCH v4] dvb-usb/friio, dvb-usb-v2/gl861: decompose friio and merge with gl861
> I don't understand those control message parts and it is bit too hard to > read i2c adapter implementation to get understanding. Could you offer > simple 2 sniff examples, register write to demod and register write to > tuner. Here is the part of a packet log. 1. write to demod (addr:0x18) reg:0x76 val:0c === [46264 ms] >>> URB 146 going down >>> -- URB_FUNCTION_VENDOR_DEVICE: TransferFlags = (USBD_TRANSFER_DIRECTION_OUT, ~USBD_SHORT_TR ANSFER_OK) TransferBufferLength = TransferBuffer = 8609d21e TransferBufferMDL= UrbLink = RequestTypeReservedBits = Request = 0001 Value = 300c Index = 0076 [46266 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b7db0) : fido=, Irp=8 58f2938, Context=858c4ed8, IRQL=2 [46266 ms] <<< URB 146 coming back <<< -- URB_FUNCTION_CONTROL_TRANSFER: PipeHandle = 86239260 TransferFlags= 000a (USBD_TRANSFER_DIRECTION_OUT, USBD_SHORT_TRANS FER_OK) TransferBufferLength = TransferBuffer = 8609d21e TransferBufferMDL= UrbLink = SetupPacket = : 40 01 0c 30 76 00 00 00 === 2. write to tuner (addr:0x60) write [0f 7b b2 08] to addr 0x60 === [47267 ms] >>> URB 147 going down >>> -- URB_FUNCTION_VENDOR_DEVICE: TransferFlags = (USBD_TRANSFER_DIRECTION_OUT, ~USBD_SHORT_TR ANSFER_OK) TransferBufferLength = 0005 TransferBuffer = 8581c7d6 TransferBufferMDL= : c0 0f 7b b2 08 UrbLink = RequestTypeReservedBits = Request = 0003 Value = 3000 Index = 00fe [47270 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b7db0) : fido=, Irp=8 58f2008, Context=86275258, IRQL=2 [47270 ms] <<< URB 147 coming back <<< -- URB_FUNCTION_CONTROL_TRANSFER: PipeHandle = 86239260 TransferFlags= 000a (USBD_TRANSFER_DIRECTION_OUT, USBD_SHORT_TRANS FER_OK) TransferBufferLength = 0005 TransferBuffer = 8581c7d6 TransferBufferMDL= 855f7760 UrbLink = SetupPacket = : 40 03 00 30 fe 00 05 00 === 3. read from tuner read one byte from addr 0x60 (2 USB packets) === [46036 ms] >>> URB 26 going down >>> -- URB_FUNCTION_VENDOR_DEVICE: TransferFlags = (USBD_TRANSFER_DIRECTION_OUT, ~USBD_SHORT_TR ANSFER_OK) TransferBufferLength = 0001 TransferBuffer = 8609d21e TransferBufferMDL= : c1 UrbLink = RequestTypeReservedBits = Request = 0003 Value = 3000 Index = 00fe [46038 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b7db0) : fido=, Irp=8 58f2938, Context=858ccea0, IRQL=2 [46038 ms] <<< URB 26 coming back <<< -- URB_FUNCTION_CONTROL_TRANSFER: PipeHandle = 86239260 TransferFlags= 000a (USBD_TRANSFER_DIRECTION_OUT, USBD_SHORT_TRANS FER_OK) TransferBufferLength = 0001 TransferBuffer = 8609d21e TransferBufferMDL= 855f7760 UrbLink = SetupPacket = : 40 03 00 30 fe 00 01 00 [46038 ms] >>> URB 27 going down >>> -- URB_FUNCTION_VENDOR_DEVICE: TransferFlags = 0001 (USBD_TRANSFER_DIRECTION_IN, ~USBD_SHORT_TRA NSFER_OK) TransferBufferLength = 0001 TransferBuffer = 8609d21e TransferBufferMDL= UrbLink = RequestTypeReservedBits = Request = 0002 Value = 3000 Index = 0100 [46040 ms] UsbSnoop - MyInternalIOCTLCompletion(f79b7db0) : fido=, Irp=8 58f2938, Context=86366778, IRQL=2 [46040 ms] <<< URB 27 coming back <<< -- URB_FUNCTION_CONTROL_TRANSFER: PipeHandle = 86239260 TransferFlags= 000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSF ER_OK) TransferBufferLength = 0001 TransferBuffer = 8609d21e TransferBufferMDL= 855f7760 : 7c UrbLink = SetupPacket = : c0 02 00 30 00 01 01 00 Note: In log 2 & 3, "Request" parameter value is different from log 1. regards, Akihiro
[PATCH v6 0/2] media: video-i2c: add video-i2c driver support
Add support for video-i2c polling driver Changes from v1: * Switch to SPDX tags versus GPLv2 license text * Remove unneeded zeroing of data structures * Add video_i2c_try_fmt_vid_cap call in video_i2c_s_fmt_vid_cap function Changes from v2: * Add missing linux/kthread.h include that broke x86_64 build Changes from v3: * Add devicetree binding documents * snprintf check added * switched to per chip support based on devicetree or i2c client id * add VB2_DMABUF to io_modes * added entry to MAINTAINERS file switched to per chip support based on devicetree or i2c client id Changes from v4: * convert pointer from of_device_get_match_data() to long instead of int to avoid compiler warning Changes from v5: * fix various issues with v4l2-compliance tool run Matt Ranostay (2): media: dt-bindings: Add bindings for panasonic,amg88xx media: video-i2c: add video-i2c driver .../bindings/media/i2c/panasonic,amg88xx.txt | 19 + MAINTAINERS| 6 + drivers/media/i2c/Kconfig | 9 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/video-i2c.c | 562 + 5 files changed, 597 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/panasonic,amg88xx.txt create mode 100644 drivers/media/i2c/video-i2c.c -- 2.14.1
[PATCH v6 2/2] media: video-i2c: add video-i2c driver
There are several thermal sensors that only have a low-speed bus interface but output valid video data. This patchset enables support for the AMG88xx "Grid-Eye" sensor family. Signed-off-by: Matt Ranostay --- MAINTAINERS | 6 + drivers/media/i2c/Kconfig | 9 + drivers/media/i2c/Makefile| 1 + drivers/media/i2c/video-i2c.c | 562 ++ 4 files changed, 578 insertions(+) create mode 100644 drivers/media/i2c/video-i2c.c diff --git a/MAINTAINERS b/MAINTAINERS index 49236216a871..f0262b751d5b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14863,6 +14863,12 @@ L: linux-media@vger.kernel.org S: Maintained F: drivers/media/platform/video-mux.c +VIDEO I2C POLLING DRIVER +M: Matt Ranostay +L: linux-media@vger.kernel.org +S: Maintained +F: drivers/media/i2c/video-i2c.c + VIDEOBUF2 FRAMEWORK M: Pawel Osciak M: Marek Szyprowski diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 541f0d28afd8..122e5047a01e 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -974,6 +974,15 @@ config VIDEO_M52790 To compile this driver as a module, choose M here: the module will be called m52790. + +config VIDEO_I2C + tristate "I2C transport video support" + depends on VIDEO_V4L2 && I2C + select VIDEOBUF2_VMALLOC + ---help--- + Enable the I2C transport video support which supports the + following: + * Panasonic AMG88xx Grid-Eye Sensors endmenu menu "Sensors used on soc_camera driver" diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index ea34aee1a85a..84cc472238ef 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -96,6 +96,7 @@ obj-$(CONFIG_VIDEO_LM3646)+= lm3646.o obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o obj-$(CONFIG_VIDEO_AK881X) += ak881x.o obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o +obj-$(CONFIG_VIDEO_I2C)+= video-i2c.o obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o obj-$(CONFIG_VIDEO_OV2659) += ov2659.o obj-$(CONFIG_VIDEO_TC358743) += tc358743.o diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c new file mode 100644 index ..9fba8a2767c5 --- /dev/null +++ b/drivers/media/i2c/video-i2c.c @@ -0,0 +1,562 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * video-i2c.c - Support for I2C transport video devices + * + * Copyright (C) 2018 Matt Ranostay + * + * Supported: + * - Panasonic AMG88xx Grid-Eye Sensors + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define VIDEO_I2C_DRIVER "video-i2c" + +struct video_i2c_chip; + +struct video_i2c_buffer { + struct vb2_v4l2_buffer vb; + struct list_head list; +}; + +struct video_i2c_data { + struct i2c_client *client; + const struct video_i2c_chip *chip; + struct mutex lock; + spinlock_t slock; + unsigned int sequence; + struct mutex queue_lock; + + struct v4l2_device v4l2_dev; + struct video_device vdev; + struct vb2_queue vb_vidq; + + struct task_struct *kthread_vid_cap; + struct list_head vid_cap_active; +}; + +static struct v4l2_fmtdesc amg88xx_format = { + .pixelformat = V4L2_PIX_FMT_Y12, +}; + +static struct v4l2_frmsize_discrete amg88xx_size = { + .width = 8, + .height = 8, +}; + +struct video_i2c_chip { + /* video dimensions */ + const struct v4l2_fmtdesc *format; + const struct v4l2_frmsize_discrete *size; + + /* max frames per second */ + unsigned int max_fps; + + /* pixel buffer size */ + unsigned int buffer_size; + + /* pixel size in bits */ + unsigned int bpp; + + /* xfer function */ + int (*xfer)(struct video_i2c_data *data, char *buf); +}; + +static int amg88xx_xfer(struct video_i2c_data *data, char *buf) +{ + struct i2c_client *client = data->client; + struct i2c_msg msg[2]; + u8 reg = 0x80; + int ret; + + msg[0].addr = client->addr; + msg[0].flags = 0; + msg[0].len = 1; + msg[0].buf = (char *) ® + + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].len = data->chip->buffer_size; + msg[1].buf = (char *) buf; + + ret = i2c_transfer(client->adapter, msg, 2); + + return (ret == 2) ? 0 : -EIO; +} + +#define AMG88XX0 + +static const struct video_i2c_chip video_i2c_chip[] = { + [AMG88XX] = { + .size = &amg88xx_size, + .format = &amg88xx_format, + .max_fps= 10, + .buffer_size= 128, + .bpp= 16, + .xfer = &amg88xx_xfer, + }, +}; + +static const struct v4l
[PATCH v6 1/2] media: dt-bindings: Add bindings for panasonic,amg88xx
Define the device tree bindings for the panasonic,amg88xx i2c video driver. Cc: devicet...@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: Matt Ranostay --- .../bindings/media/i2c/panasonic,amg88xx.txt | 19 +++ 1 file changed, 19 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/panasonic,amg88xx.txt diff --git a/Documentation/devicetree/bindings/media/i2c/panasonic,amg88xx.txt b/Documentation/devicetree/bindings/media/i2c/panasonic,amg88xx.txt new file mode 100644 index ..4a3181a3dd7e --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/panasonic,amg88xx.txt @@ -0,0 +1,19 @@ +* Panasonic AMG88xx + +The Panasonic family of AMG88xx Grid-Eye sensors allow recording +8x8 10Hz video which consists of thermal datapoints + +Required Properties: + - compatible : Must be "panasonic,amg88xx" + - reg : i2c address of the device + +Example: + + i2c0@1c22000 { + ... + amg88xx@69 { + compatible = "panasonic,amg88xx"; + reg = <0x69>; + }; + ... + }; -- 2.14.1
Re: [PATCH v6 2/2] media: video-i2c: add video-i2c driver
On Sat, Mar 31, 2018 at 5:59 PM, Matt Ranostay wrote: > There are several thermal sensors that only have a low-speed bus > interface but output valid video data. This patchset enables support > for the AMG88xx "Grid-Eye" sensor family. > > Signed-off-by: Matt Ranostay > --- v4l2-compliance SHA : 3dc9af2b54eddb531823b99e77f3f212bdcc9cca Compliance test for device /dev/video0: Driver Info: Driver name : video-i2c Card type: I2C 1-105 Transport Video Bus info : I2C:1-105 Driver version : 4.14.31 Capabilities : 0x8521 Video Capture Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x0521 Video Capture Read/Write Streaming Extended Pix Format Required ioctls: test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second /dev/video0 open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported) Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 1 Audio Inputs: 0 Tuners: 0 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls (Input 0): test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported) test VIDIOC_G/S_CTRL: OK (Not Supported) test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0 Format ioctls (Input 0): test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls (Input 0): test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls (Input 0): test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) Test input 0: Streaming ioctls: test read/write: OK test MMAP: OK test USERPTR: OK test DMABUF: Cannot test, specify --expbuf-device Stream using all formats: test MMAP for Format Y12 , Frame Size 8x8@10.00 Hz: Stride 16, Field None: OK Total: 47, Succeeded: 47, Failed: 0, Warnings: 0 > MAINTAINERS | 6 + > drivers/media/i2c/Kconfig | 9 + > drivers/media/i2c/Makefile| 1 + > drivers/media/i2c/video-i2c.c | 562 > ++ > 4 files changed, 578 insertions(+) > create mode 100644 drivers/media/i2c/video-i2c.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 49236216a871..f0262b751d5b 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -14863,6 +14863,12 @@ L: linux-media@vger.kernel.org > S: Maintained > F: drivers/media/platform/video-mux.c > > +VIDEO I2C POLLING DRIVER > +M: Matt Ranostay > +L: linux-media@vger.kernel.org > +S: Maintained > +F: drivers/media/i2c/video-i2c.c > + > VIDEOBUF2 FRAMEWORK > M: Pawel Osciak > M: Marek Szyprowski > diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig > index 541f0d28afd8..122e5047a01e 100644 > --- a/drivers/media/i2c/Kconfig > +++ b/drivers/media/i2c/Kconfig > @@ -974,6 +974,15 @@ config VIDEO_M52790 > > To compile this driver as a module, choose M here: the > module will be called m52790. > + > +config VIDEO_I2C > + tristate "I2C transport video support" > + depends on VIDEO_V4L2 && I2C > + select VIDEOBUF2_VMALLOC > + ---help--- > + Enable the I2C transport video support which supports the > + following: > + * Panasonic AMG88xx Grid-Eye Sensors > endmenu > > menu "Sensors used on soc_camera driver" > diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile > index ea34aee1a85a..84cc472238ef 100644 > --- a/drivers/media/i2c/Makefile > +++ b/drivers/media/i2c/Makefile > @@ -96,6 +96,7 @@ obj-$(CONFIG_VIDEO_LM3646)+= lm3646.o > obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o > obj-$(CONFIG_VIDEO_AK881X) += ak881x.o > obj-$(CONFIG_VIDEO_IR_I2C)