Re: [PATCH v6 5/5] v4l: fwnode: Support generic parsing of graph endpoints in a single port
Hi Laurent, On Sat, Sep 02, 2017 at 12:52:47PM +0300, Laurent Pinchart wrote: > Hi Sakari, > > On Saturday, 2 September 2017 01:57:48 EEST Sakari Ailus wrote: > > On Fri, Sep 01, 2017 at 01:28:40PM +0200, Hans Verkuil wrote: > > >> diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h > > >> index d063ab4ff67b..dd13604178b4 100644 > > >> --- a/include/media/v4l2-fwnode.h > > >> +++ b/include/media/v4l2-fwnode.h > > >> @@ -249,4 +249,53 @@ int v4l2_async_notifier_parse_fwnode_endpoints( > > >> struct v4l2_fwnode_endpoint *vep, > > >> struct v4l2_async_subdev *asd)); > > >> > > >> +/** > > >> + * v4l2_async_notifier_parse_fwnode_endpoint - Set up async notifier > > >> for an > > >> + * fwnode based sub-device > > >> + * @dev: @struct device pointer > > >> + * @notifier: pointer to &struct v4l2_async_notifier > > >> + * @port_id: port number > > >> + * @endpoint_id: endpoint number > > >> + * @asd_struct_size: size of the driver's async sub-device struct, > > >> including > > >> + * sizeof(struct v4l2_async_subdev). The &struct > > >> + * v4l2_async_subdev shall be the first member of > > >> + * the driver's async sub-device struct, i.e. both > > >> + * begin at the same memory address. > > >> + * @parse_single: driver's callback function called on each V4L2 fwnode > > >> endpoint > > >> + * > > >> + * Parse the fwnode endpoint of the @dev device corresponding to the > > >> given port > > >> + * and endpoint numbres and populate the async sub- devices array of > > >> the > > > > > > numbers > > > no space after sub- > > > > > > > + * notifier. The @parse_endpoint callback function is called for the > > > > endpoint > > > > > > parse_single, but (as in the previous patch) I actually prefer > > > parse_endpoint. > > > > > >> + * with the corresponding async sub-device pointer to let the caller > > >> initialize > > >> + * the driver-specific part of the async sub-device structure. > > >> + * > > >> + * The notifier memory shall be zeroed before this function is called > > >> on the > > >> + * notifier. > > > > > > Should it? Doesn't this add additional subdevs? > > > > > > I'm lost. What's the relationship between > > > v4l2_async_notifier_parse_fwnode_endpoints and this function? When do you > > > use which? When you should zero the notifier? > > I thought there would be advantages in this approach as it lets you to > > choose which endpoints specifically you want to parse. That said, the > > expectation is that the device has no endpoints that aren't supported in > > hardware either. > > > > Some drivers currently iterate over all the endpoints and then validate > > them whereas others poke for some endpoints only (port 0, endpoint 0, for > > the rcar-vin driver, for instance). In DT binding documentation the > > endpoint numbers are currently not specified nor drivers have checked them. > > Common sense tells to use zero if there's no reason to do otherwise, but > > still this hasn't been documented nor validated in the past. So if we add > > that now, there could be a chance of breaking something. > > > > Additionally, specifying the endpoints to parse explicitly has been seen > > beneficial (or even necessary) in parsing endpoints for devices that have > > both input and output interfaces. Perhaps Niklas can comment on that. > > > > What I though was to introduce a specific error code (EPERM, better > > suggestions are taken) > > Maybe ENOTCONN ? Sounds good to me. > > > for the driver callback function (parse_endpoint) to silently skip endpoints > > the driver doesn't like for reason or another. This lets drivers to use the > > endpoint parser function added by the previous patch and still maintain the > > old behaviour, i.e. ignore endpoints that aren't explicitly recognised by > > the driver. > > > > I'll drop this patch from the next version. > > Parsing a specific endpoint of a specific port is probably indeed a bit too > fine-grained, but I think there are use cases for parsing at the port level > instead of parsing all ports. Could you elaborate? If a driver would be interested in skipping endpoints in a subset of ports, in which case only a single port would be excluded from this? -- Regards, Sakari Ailus e-mail: sakari.ai...@iki.fi
Re: DRM Format Modifiers in v4l2
On Fri, Sep 1, 2017 at 2:43 PM, Rob Clark wrote: > On Fri, Sep 1, 2017 at 3:13 AM, Laurent Pinchart > wrote: >> Hi Nicolas, >> >> On Thursday, 31 August 2017 19:12:58 EEST Nicolas Dufresne wrote: >>> Le jeudi 31 août 2017 à 17:28 +0300, Laurent Pinchart a écrit : >>> >> e.g. if I have two devices which support MODIFIER_FOO, I could attempt >>> >> to share a buffer between them which uses MODIFIER_FOO without >>> >> necessarily knowing exactly what it is/does. >>> > >>> > Userspace could certainly set modifiers blindly, but the point of >>> > modifiers is to generate side effects benefitial to the use case at hand >>> > (for instance by optimizing the memory access pattern). To use them >>> > meaningfully userspace would need to have at least an idea of the side >>> > effects they generate. >>> >>> Generic userspace will basically pick some random combination. >> >> In that case userspace could set no modifier at all by default (except in the >> case where unmodified formats are not supported by the hardware, but I don't >> expect that to be the most common case). >> >>> To allow generically picking the optimal configuration we could indeed rely >>> on the application knowledge, but we could also enhance the spec so that >>> the order in the enumeration becomes meaningful. >> >> I'm not sure how far we should go. I could imagine a system where the API >> would report capabilities for modifiers (e.g. this modifier lowers the >> bandwidth, this one enhances the quality, ...), but going in that direction, >> where do we stop ? In practice I expect userspace to know some information >> about the hardware, so I'd rather avoid over-engineering the API. >> > > I think in the (hopefully not too) long term, something like > https://github.com/cubanismo/allocator/ is the way forward. That > doesn't quite solve how v4l2 kernel part sorts out w/ corresponding > userspace .so what is preferable, but at least that is > compartmentalized to v4l2.. on the gl/vk side of things there will ofc > be a hardware specific userspace part that knows what it prefers. For > v4l2, it probably makes sense to sort out what the userspace level API > is and work backwards from there, rather than risk trying to design a > kernel uapi that might turn out to be the wrong thing. I thought for kms the plan is to make the ordering meaningful, because it doesn't necessarily match the gl/vk one. E.g. on intel gl would prefer Y compressed, Y, X, untiled. Whereas display would be Y compressed, X (much easier to scan out, in many cases allows more planes to be used), Y (is necessary for 90° rotation), untiled. So if drm_hwc really wants to use all the planes, it could prioritize the display over rendering and request X instead of Y tiled. I think the same would go for v4l. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
[PATCH 1/1] staging/atomisp: fix header guards
Files input_formatter_subsystem_defs.h begin with: #ifndef _if_subsystem_defs_h #define _if_subsystem_defs_h__ and end with: #endif /* _if_subsystem_defs_h__ */ The intent seems to have been to use _if_subsystem_defs_h__ everywhere but two underscores are missing in the initial #ifndef. Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2") Signed-off-by: Nicolas Iooss --- .../css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h| 2 +- .../css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h | 2 +- .../css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h| 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h index 16bfe1d80bc9..7766f78cd123 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h @@ -12,7 +12,7 @@ * more details. */ -#ifndef _if_subsystem_defs_h +#ifndef _if_subsystem_defs_h__ #define _if_subsystem_defs_h__ #define HIVE_IFMT_GP_REGS_INPUT_SWITCH_LUT_REG_00 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h index 16bfe1d80bc9..7766f78cd123 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h @@ -12,7 +12,7 @@ * more details. */ -#ifndef _if_subsystem_defs_h +#ifndef _if_subsystem_defs_h__ #define _if_subsystem_defs_h__ #define HIVE_IFMT_GP_REGS_INPUT_SWITCH_LUT_REG_00 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h index 16bfe1d80bc9..7766f78cd123 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h @@ -12,7 +12,7 @@ * more details. */ -#ifndef _if_subsystem_defs_h +#ifndef _if_subsystem_defs_h__ #define _if_subsystem_defs_h__ #define HIVE_IFMT_GP_REGS_INPUT_SWITCH_LUT_REG_00 -- 2.14.1
[PATCH 10/10] staging/atomisp: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro, rather than explicitly coding some variant of it yourself. Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\) /ARRAY_SIZE(\1)/g' and manual check/verification. Signed-off-by: Thomas Meyer --- diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c index a7c6bba7e094..11d3995ba0db 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c @@ -29,6 +29,7 @@ more details. #endif #include "system_global.h" +#include #ifdef USE_INPUT_SYSTEM_VERSION_2 @@ -487,7 +488,7 @@ static void ifmtr_set_if_blocking_mode( { int i; bool block[] = { false, false, false, false }; - assert(N_INPUT_FORMATTER_ID <= (sizeof(block) / sizeof(block[0]))); + assert(N_INPUT_FORMATTER_ID <= (ARRAY_SIZE(block))); #if !defined(IS_ISP_2400_SYSTEM) #error "ifmtr_set_if_blocking_mode: ISP_SYSTEM must be one of {IS_ISP_2400_SYSTEM}"
[PATCH 5/10] [media] lgdt3306a: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro, rather than explicitly coding some variant of it yourself. Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e 's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\) /ARRAY_SIZE(\1)/g' and manual check/verification. Signed-off-by: Thomas Meyer --- diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c index c9b1eb38444e..724e9aac0f11 100644 --- a/drivers/media/dvb-frontends/lgdt3306a.c +++ b/drivers/media/dvb-frontends/lgdt3306a.c @@ -19,6 +19,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include "dvb_math.h" #include "lgdt3306a.h" @@ -2072,7 +2073,7 @@ static const short regtab[] = { 0x30aa, /* MPEGLOCK */ }; -#define numDumpRegs (sizeof(regtab)/sizeof(regtab[0])) +#define numDumpRegs (ARRAY_SIZE(regtab)) static u8 regval1[numDumpRegs] = {0, }; static u8 regval2[numDumpRegs] = {0, };
[PATCH v2] media: net.h: add kernel-doc and use it at Documentation/
As we did with frontend.h, ca.h and dmx.h, move the struct definition to net.h. That should help to keep it updated, as more stuff gets added there. Signed-off-by: Mauro Carvalho Chehab --- v2: - Version 1 was broken: it was missing net-types.rst file and if_num was called "ifnum", causing a warning. Documentation/media/uapi/dvb/net-add-if.rst | 34 - Documentation/media/uapi/dvb/net-types.rst | 9 Documentation/media/uapi/dvb/net.rst| 1 + include/uapi/linux/dvb/net.h| 15 + 4 files changed, 25 insertions(+), 34 deletions(-) create mode 100644 Documentation/media/uapi/dvb/net-types.rst diff --git a/Documentation/media/uapi/dvb/net-add-if.rst b/Documentation/media/uapi/dvb/net-add-if.rst index 1087efb9baa0..6749b70246c5 100644 --- a/Documentation/media/uapi/dvb/net-add-if.rst +++ b/Documentation/media/uapi/dvb/net-add-if.rst @@ -41,40 +41,6 @@ created. The struct :c:type:`dvb_net_if`::ifnum field will be filled with the number of the created interface. -.. c:type:: dvb_net_if - -.. flat-table:: struct dvb_net_if -:header-rows: 1 -:stub-columns: 0 - - -- .. row 1 - - - ID - - - Description - -- .. row 2 - - - pid - - - Packet ID (PID) of the MPEG-TS that contains data - -- .. row 3 - - - ifnum - - - number of the Digital TV interface. - -- .. row 4 - - - feedtype - - - Encapsulation type of the feed. It can be: - ``DVB_NET_FEEDTYPE_MPE`` for MPE encoding or - ``DVB_NET_FEEDTYPE_ULE`` for ULE encoding. - - Return Value diff --git a/Documentation/media/uapi/dvb/net-types.rst b/Documentation/media/uapi/dvb/net-types.rst new file mode 100644 index ..e1177bdcd623 --- /dev/null +++ b/Documentation/media/uapi/dvb/net-types.rst @@ -0,0 +1,9 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _dmx_types: + +** +Net Data Types +** + +.. kernel-doc:: include/uapi/linux/dvb/net.h diff --git a/Documentation/media/uapi/dvb/net.rst b/Documentation/media/uapi/dvb/net.rst index fdb5301a4b1f..e0cd4e402627 100644 --- a/Documentation/media/uapi/dvb/net.rst +++ b/Documentation/media/uapi/dvb/net.rst @@ -35,6 +35,7 @@ Digital TV net Function Calls .. toctree:: :maxdepth: 1 +net-types net-add-if net-remove-if net-get-if diff --git a/include/uapi/linux/dvb/net.h b/include/uapi/linux/dvb/net.h index f451e7eb0b0b..89d805f9a5a6 100644 --- a/include/uapi/linux/dvb/net.h +++ b/include/uapi/linux/dvb/net.h @@ -26,6 +26,21 @@ #include +/** + * struct dvb_net_if - describes a DVB network interface + * + * @pid: Packet ID (PID) of the MPEG-TS that contains data + * @if_num: number of the Digital TV interface. + * @feedtype: Encapsulation type of the feed. + * + * A MPEG-TS stream may contain packet IDs with IP packages on it. + * This struct describes it, and the type of encoding. + * + * @feedtype can be: + * + * - %DVB_NET_FEEDTYPE_MPE for MPE encoding + * - %DVB_NET_FEEDTYPE_ULE for ULE encoding. + */ struct dvb_net_if { __u16 pid; __u16 if_num; -- 2.13.5
[PATCH 0/2] [media] Motion Eye: Adjustments for meye_probe()
From: Markus Elfring Date: Sun, 3 Sep 2017 15:54:45 +0200 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): Delete three error messages for a failed memory allocation Adjust two function calls together with a variable assignment drivers/media/pci/meye/meye.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) -- 2.14.1
[PATCH 1/2] [media] meye: Delete three error messages for a failed memory allocation in meye_probe()
From: Markus Elfring Date: Sun, 3 Sep 2017 15:30:04 +0200 Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/pci/meye/meye.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c index 9c4a024745de..db36040770a6 100644 --- a/drivers/media/pci/meye/meye.c +++ b/drivers/media/pci/meye/meye.c @@ -1626,23 +1626,18 @@ static int meye_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) meye.mchip_dev = pcidev; meye.grab_temp = vmalloc(MCHIP_NB_PAGES_MJPEG * PAGE_SIZE); - if (!meye.grab_temp) { - v4l2_err(v4l2_dev, "grab buffer allocation failed\n"); + if (!meye.grab_temp) goto outvmalloc; - } spin_lock_init(&meye.grabq_lock); if (kfifo_alloc(&meye.grabq, sizeof(int) * MEYE_MAX_BUFNBRS, - GFP_KERNEL)) { - v4l2_err(v4l2_dev, "fifo allocation failed\n"); + GFP_KERNEL)) goto outkfifoalloc1; - } + spin_lock_init(&meye.doneq_lock); if (kfifo_alloc(&meye.doneq, sizeof(int) * MEYE_MAX_BUFNBRS, - GFP_KERNEL)) { - v4l2_err(v4l2_dev, "fifo allocation failed\n"); + GFP_KERNEL)) goto outkfifoalloc2; - } meye.vdev = meye_template; meye.vdev.v4l2_dev = &meye.v4l2_dev; -- 2.14.1
[PATCH 2/2] [media] meye: Adjust two function calls together with a variable assignment
From: Markus Elfring Date: Sun, 3 Sep 2017 15:41:53 +0200 The script "checkpatch.pl" pointed information out like the following. ERROR: do not use assignment in if condition Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/media/pci/meye/meye.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c index db36040770a6..9b69a07c1d5b 100644 --- a/drivers/media/pci/meye/meye.c +++ b/drivers/media/pci/meye/meye.c @@ -1642,14 +1642,15 @@ static int meye_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) meye.vdev = meye_template; meye.vdev.v4l2_dev = &meye.v4l2_dev; - ret = -EIO; - if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) { + ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1); + if (ret) { v4l2_err(v4l2_dev, "meye: unable to power on the camera\n"); v4l2_err(v4l2_dev, "meye: did you enable the camera in sonypi using the module options ?\n"); goto outsonypienable; } - if ((ret = pci_enable_device(meye.mchip_dev))) { + ret = pci_enable_device(meye.mchip_dev); + if (ret) { v4l2_err(v4l2_dev, "meye: pci_enable_device failed\n"); goto outenabledev; } -- 2.14.1
Re: [PATCH] v4l: use struct v4l2_buffer explicitly instead of void *
Hi Mauro, On Sun, 27 Aug 2017, Mauro Carvalho Chehab wrote: > Em Fri, 28 Jul 2017 14:45:37 +0200 (CEST) > Guennadi Liakhovetski escreveu: > > > A number of functions use void * for a struct v4l2_buffer parameter. > > Avoid that to improve compile-time checking. > > Nack. > > The videbuf2-core should be be independent of videobuf2-v4l2. The > plan is to use it for DVB too. There's a patch floating around, > lacking people to take a look. > > I intend to review and merge it when I have some time along > the year. Ok, I thought there would be a reason similar to this, thanks for explaining. Regards Guennadi > > Signed-off-by: Guennadi Liakhovetski > > --- > > > > This probably was done on purpose, maybe to reuse the video buffers by > > other than V4L2 users, but I haven't found any, and the code doesn't seem > > very new... > > > > drivers/media/v4l2-core/videobuf2-core.c | 17 + > > drivers/media/v4l2-core/videobuf2-v4l2.c | 15 +++ > > include/media/videobuf2-core.h | 19 --- > > 3 files changed, 28 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/media/v4l2-core/videobuf2-core.c > > b/drivers/media/v4l2-core/videobuf2-core.c > > index 14f83cec..170a416 100644 > > --- a/drivers/media/v4l2-core/videobuf2-core.c > > +++ b/drivers/media/v4l2-core/videobuf2-core.c > > @@ -958,7 +958,7 @@ void vb2_discard_done(struct vb2_queue *q) > > /** > > * __prepare_mmap() - prepare an MMAP buffer > > */ > > -static int __prepare_mmap(struct vb2_buffer *vb, const void *pb) > > +static int __prepare_mmap(struct vb2_buffer *vb, const struct v4l2_buffer > > *pb) > > { > > int ret = 0; > > > > @@ -971,7 +971,7 @@ static int __prepare_mmap(struct vb2_buffer *vb, const > > void *pb) > > /** > > * __prepare_userptr() - prepare a USERPTR buffer > > */ > > -static int __prepare_userptr(struct vb2_buffer *vb, const void *pb) > > +static int __prepare_userptr(struct vb2_buffer *vb, const struct > > v4l2_buffer *pb) > > { > > struct vb2_plane planes[VB2_MAX_PLANES]; > > struct vb2_queue *q = vb->vb2_queue; > > @@ -1089,7 +1089,7 @@ static int __prepare_userptr(struct vb2_buffer *vb, > > const void *pb) > > /** > > * __prepare_dmabuf() - prepare a DMABUF buffer > > */ > > -static int __prepare_dmabuf(struct vb2_buffer *vb, const void *pb) > > +static int __prepare_dmabuf(struct vb2_buffer *vb, const struct > > v4l2_buffer *pb) > > { > > struct vb2_plane planes[VB2_MAX_PLANES]; > > struct vb2_queue *q = vb->vb2_queue; > > @@ -1236,7 +1236,7 @@ static void __enqueue_in_driver(struct vb2_buffer *vb) > > call_void_vb_qop(vb, buf_queue, vb); > > } > > > > -static int __buf_prepare(struct vb2_buffer *vb, const void *pb) > > +static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer > > *pb) > > { > > struct vb2_queue *q = vb->vb2_queue; > > unsigned int plane; > > @@ -1279,7 +1279,8 @@ static int __buf_prepare(struct vb2_buffer *vb, const > > void *pb) > > return 0; > > } > > > > -int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb) > > +int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, > > +struct v4l2_buffer *pb) > > { > > struct vb2_buffer *vb; > > int ret; > > @@ -1514,7 +1515,7 @@ static int __vb2_wait_for_done_vb(struct vb2_queue > > *q, int nonblocking) > > * Will sleep if required for nonblocking == false. > > */ > > static int __vb2_get_done_vb(struct vb2_queue *q, struct vb2_buffer **vb, > > -void *pb, int nonblocking) > > +struct v4l2_buffer *pb, int nonblocking) > > { > > unsigned long flags; > > int ret = 0; > > @@ -1583,8 +1584,8 @@ static void __vb2_dqbuf(struct vb2_buffer *vb) > > } > > } > > > > -int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb, > > - bool nonblocking) > > +int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, > > + struct v4l2_buffer *pb, bool nonblocking) > > { > > struct vb2_buffer *vb = NULL; > > int ret; > > diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c > > b/drivers/media/v4l2-core/videobuf2-v4l2.c > > index 0c06699..3c425ea 100644 > > --- a/drivers/media/v4l2-core/videobuf2-v4l2.c > > +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c > > @@ -53,7 +53,8 @@ > > * __verify_planes_array() - verify that the planes array passed in struct > > * v4l2_buffer from userspace can be safely used > > */ > > -static int __verify_planes_array(struct vb2_buffer *vb, const struct > > v4l2_buffer *b) > > +static int __verify_planes_array(struct vb2_buffer *vb, > > +const struct v4l2_buffer *b) > > { > > if (!V4L2_TYPE_IS_MULTIPLANAR(b->type)) > > return 0; > > @@ -73,7 +74,8 @@ static int __verify_planes_array(struct vb2_buffer *vb, > > const struct v4l2_buffer > > return 0; > > } > >
Re: UVC property auto update
Hi Edgar, I'm adding UVC maintainer to CC, he might have missed this email. Could you also tell us what cameras have those features? A recent patch from me extends the UVC driver use of the Interrupt endpoint for asynchronous control completion notifications. This would be another extension for the same interface. I guess the way to implement it would be using V4L events. Thanks Guennadi On Mon, 7 Aug 2017, Edgar Thier wrote: > Hi all, > > I have some USB-3.0 cameras that use UVC. > These cameras offer auto updates for various properties. > An example of such a property would be gain, that will be adjusted when > activating the auto-gain > property. These property changes are not queried by the UVC driver, unless it > already has the > property marked as auto update via UVC_CTRL_FLAG_AUTO_UPDATE. > >From what I have seen, it seems that this flag is not checked when indexing > >the camera controls. > However it is checked when using extension units, so all properties loaded > through such a unit are > being updates as one would hope. > > My questions: > > Is it intended that properties cannot mark themselves as autoupdate? > If yes: > Is there a recommended way of working around this? > Do all autoupdate properties have to be in an extension unit? > If no: > What should a fix look like? > > Regards, > > Edgar >
[PATCH v7 02/18] v4l: async: Add V4L2 async documentation to the documentation build
The V4L2 async wasn't part of the documentation build. Fix this. Signed-off-by: Sakari Ailus Reviewed-by: Niklas Söderlund Acked-by: Hans Verkuil --- Documentation/media/kapi/v4l2-async.rst | 3 +++ Documentation/media/kapi/v4l2-core.rst | 1 + 2 files changed, 4 insertions(+) create mode 100644 Documentation/media/kapi/v4l2-async.rst diff --git a/Documentation/media/kapi/v4l2-async.rst b/Documentation/media/kapi/v4l2-async.rst new file mode 100644 index ..523ff9eb09a0 --- /dev/null +++ b/Documentation/media/kapi/v4l2-async.rst @@ -0,0 +1,3 @@ +V4L2 async kAPI +^^^ +.. kernel-doc:: include/media/v4l2-async.h diff --git a/Documentation/media/kapi/v4l2-core.rst b/Documentation/media/kapi/v4l2-core.rst index c7434f38fd9c..5cf292037a48 100644 --- a/Documentation/media/kapi/v4l2-core.rst +++ b/Documentation/media/kapi/v4l2-core.rst @@ -19,6 +19,7 @@ Video4Linux devices v4l2-mc v4l2-mediabus v4l2-mem2mem +v4l2-async v4l2-fwnode v4l2-rect v4l2-tuner -- 2.11.0
[PATCH v7 01/18] v4l: fwnode: Move KernelDoc documentation to the header
In V4L2 the practice is to have the KernelDoc documentation in the header and not in .c source code files. This consequientally makes the V4L2 fwnode function documentation part of the Media documentation build. Also correct the link related function and argument naming in documentation. Signed-off-by: Sakari Ailus Reviewed-by: Niklas Söderlund Acked-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-fwnode.c | 75 include/media/v4l2-fwnode.h | 81 ++- 2 files changed, 80 insertions(+), 76 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 40b2fbfe8865..706f9e7b90f1 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -181,25 +181,6 @@ v4l2_fwnode_endpoint_parse_csi1_bus(struct fwnode_handle *fwnode, vep->bus_type = V4L2_MBUS_CSI1; } -/** - * v4l2_fwnode_endpoint_parse() - parse all fwnode node properties - * @fwnode: pointer to the endpoint's fwnode handle - * @vep: pointer to the V4L2 fwnode data structure - * - * All properties are optional. If none are found, we don't set any flags. This - * means the port has a static configuration and no properties have to be - * specified explicitly. If any properties that identify the bus as parallel - * are found and slave-mode isn't set, we set V4L2_MBUS_MASTER. Similarly, if - * we recognise the bus as serial CSI-2 and clock-noncontinuous isn't set, we - * set the V4L2_MBUS_CSI2_CONTINUOUS_CLOCK flag. The caller should hold a - * reference to @fwnode. - * - * NOTE: This function does not parse properties the size of which is variable - * without a low fixed limit. Please use v4l2_fwnode_endpoint_alloc_parse() in - * new drivers instead. - * - * Return: 0 on success or a negative error code on failure. - */ int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode, struct v4l2_fwnode_endpoint *vep) { @@ -239,14 +220,6 @@ int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode, } EXPORT_SYMBOL_GPL(v4l2_fwnode_endpoint_parse); -/* - * v4l2_fwnode_endpoint_free() - free the V4L2 fwnode acquired by - * v4l2_fwnode_endpoint_alloc_parse() - * @vep - the V4L2 fwnode the resources of which are to be released - * - * It is safe to call this function with NULL argument or on a V4L2 fwnode the - * parsing of which failed. - */ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep) { if (IS_ERR_OR_NULL(vep)) @@ -257,29 +230,6 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep) } EXPORT_SYMBOL_GPL(v4l2_fwnode_endpoint_free); -/** - * v4l2_fwnode_endpoint_alloc_parse() - parse all fwnode node properties - * @fwnode: pointer to the endpoint's fwnode handle - * - * All properties are optional. If none are found, we don't set any flags. This - * means the port has a static configuration and no properties have to be - * specified explicitly. If any properties that identify the bus as parallel - * are found and slave-mode isn't set, we set V4L2_MBUS_MASTER. Similarly, if - * we recognise the bus as serial CSI-2 and clock-noncontinuous isn't set, we - * set the V4L2_MBUS_CSI2_CONTINUOUS_CLOCK flag. The caller should hold a - * reference to @fwnode. - * - * v4l2_fwnode_endpoint_alloc_parse() has two important differences to - * v4l2_fwnode_endpoint_parse(): - * - * 1. It also parses variable size data. - * - * 2. The memory it has allocated to store the variable size data must be freed - *using v4l2_fwnode_endpoint_free() when no longer needed. - * - * Return: Pointer to v4l2_fwnode_endpoint if successful, on an error pointer - * on error. - */ struct v4l2_fwnode_endpoint *v4l2_fwnode_endpoint_alloc_parse( struct fwnode_handle *fwnode) { @@ -322,24 +272,6 @@ struct v4l2_fwnode_endpoint *v4l2_fwnode_endpoint_alloc_parse( } EXPORT_SYMBOL_GPL(v4l2_fwnode_endpoint_alloc_parse); -/** - * v4l2_fwnode_endpoint_parse_link() - parse a link between two endpoints - * @__fwnode: pointer to the endpoint's fwnode at the local end of the link - * @link: pointer to the V4L2 fwnode link data structure - * - * Fill the link structure with the local and remote nodes and port numbers. - * The local_node and remote_node fields are set to point to the local and - * remote port's parent nodes respectively (the port parent node being the - * parent node of the port node if that node isn't a 'ports' node, or the - * grand-parent node of the port node otherwise). - * - * A reference is taken to both the local and remote nodes, the caller must use - * v4l2_fwnode_endpoint_put_link() to drop the references when done with the - * link. - * - * Return: 0 on success, or -ENOLINK if the remote endpoint fwnode can't be - * found. - */ int v4l2_fwnode_parse_link(struct fwnode_handle *__fwnode, struct v4l2_fwnode_link *link) { @@ -374,13 +306,6 @@ int v4l2_fwnode_parse_link(struct fwn
[PATCH v7 07/18] omap3isp: Fix check for our own sub-devices
We only want to link sub-devices that were bound to the async notifier the isp driver registered but there may be other sub-devices in the v4l2_device as well. Check for the correct async notifier. Signed-off-by: Sakari Ailus --- drivers/media/platform/omap3isp/isp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index a546cf774d40..3b1a9cd0e591 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -2155,7 +2155,7 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async) return ret; list_for_each_entry(sd, &v4l2_dev->subdevs, list) { - if (!sd->asd) + if (sd->notifier != &isp->notifier) continue; ret = isp_link_entity(isp, &sd->entity, -- 2.11.0
[PATCH v7 08/18] omap3isp: Print the name of the entity where no source pads could be found
If no source pads are found in an entity, print the name of the entity. Signed-off-by: Sakari Ailus --- drivers/media/platform/omap3isp/isp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 3b1a9cd0e591..9a694924e46e 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -1669,8 +1669,8 @@ static int isp_link_entity( break; } if (i == entity->num_pads) { - dev_err(isp->dev, "%s: no source pad in external entity\n", - __func__); + dev_err(isp->dev, "%s: no source pad in external entity %s\n", + __func__, entity->name); return -EINVAL; } -- 2.11.0
[PATCH v7 06/18] rcar-vin: Use generic parser for parsing fwnode endpoints
Instead of using driver implementation, use v4l2_async_notifier_parse_fwnode_endpoints() to parse the fwnode endpoints of the device. Signed-off-by: Sakari Ailus --- drivers/media/platform/rcar-vin/rcar-core.c | 112 +--- drivers/media/platform/rcar-vin/rcar-dma.c | 10 +-- drivers/media/platform/rcar-vin/rcar-v4l2.c | 14 ++-- drivers/media/platform/rcar-vin/rcar-vin.h | 4 +- 4 files changed, 48 insertions(+), 92 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 142de447..bd551f0be213 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -21,6 +21,7 @@ #include #include +#include #include #include "rcar-vin.h" @@ -77,14 +78,14 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier) int ret; /* Verify subdevices mbus format */ - if (!rvin_mbus_supported(&vin->digital)) { + if (!rvin_mbus_supported(vin->digital)) { vin_err(vin, "Unsupported media bus format for %s\n", - vin->digital.subdev->name); + vin->digital->subdev->name); return -EINVAL; } vin_dbg(vin, "Found media bus format for %s: %d\n", - vin->digital.subdev->name, vin->digital.code); + vin->digital->subdev->name, vin->digital->code); ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); if (ret < 0) { @@ -103,7 +104,7 @@ static void rvin_digital_notify_unbind(struct v4l2_async_notifier *notifier, vin_dbg(vin, "unbind digital subdev %s\n", subdev->name); rvin_v4l2_remove(vin); - vin->digital.subdev = NULL; + vin->digital->subdev = NULL; } static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, @@ -120,117 +121,70 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SOURCE); if (ret < 0) return ret; - vin->digital.source_pad = ret; + vin->digital->source_pad = ret; ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SINK); - vin->digital.sink_pad = ret < 0 ? 0 : ret; + vin->digital->sink_pad = ret < 0 ? 0 : ret; - vin->digital.subdev = subdev; + vin->digital->subdev = subdev; vin_dbg(vin, "bound subdev %s source pad: %u sink pad: %u\n", - subdev->name, vin->digital.source_pad, - vin->digital.sink_pad); + subdev->name, vin->digital->source_pad, + vin->digital->sink_pad); return 0; } -static int rvin_digitial_parse_v4l2(struct rvin_dev *vin, - struct device_node *ep, - struct v4l2_mbus_config *mbus_cfg) +static int rvin_digital_parse_v4l2(struct device *dev, + struct v4l2_fwnode_endpoint *vep, + struct v4l2_async_subdev *asd) { - struct v4l2_fwnode_endpoint v4l2_ep; - int ret; + struct rvin_dev *vin = dev_get_drvdata(dev); + struct rvin_graph_entity *rvge = + container_of(asd, struct rvin_graph_entity, asd); - ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &v4l2_ep); - if (ret) { - vin_err(vin, "Could not parse v4l2 endpoint\n"); - return -EINVAL; - } + if (vep->base.port || vep->base.id) + return -EPERM; - mbus_cfg->type = v4l2_ep.bus_type; + rvge->mbus_cfg.type = vep->bus_type; - switch (mbus_cfg->type) { + switch (rvge->mbus_cfg.type) { case V4L2_MBUS_PARALLEL: vin_dbg(vin, "Found PARALLEL media bus\n"); - mbus_cfg->flags = v4l2_ep.bus.parallel.flags; + rvge->mbus_cfg.flags = vep->bus.parallel.flags; break; case V4L2_MBUS_BT656: vin_dbg(vin, "Found BT656 media bus\n"); - mbus_cfg->flags = 0; + rvge->mbus_cfg.flags = 0; break; default: vin_err(vin, "Unknown media bus type\n"); return -EINVAL; } - return 0; -} - -static int rvin_digital_graph_parse(struct rvin_dev *vin) -{ - struct device_node *ep, *np; - int ret; - - vin->digital.asd.match.fwnode.fwnode = NULL; - vin->digital.subdev = NULL; - - /* -* Port 0 id 0 is local digital input, try to get it. -* Not all instances can or will have this, that is OK -*/ - ep = of_graph_get_endpoint_by_regs(vin->dev->of_node, 0, 0); - if (!ep) - return 0; - - np = of_graph_get_remote_port_parent(ep); - if (!np) { - vin_err(vin, "No remote parent for digital input\n"); - of_node_put(ep); -
[PATCH v7 10/18] v4l: async: Introduce macros for calling async ops callbacks
Add two macros to call async operations callbacks. Besides simplifying callbacks, this allows async notifiers to have no ops set, i.e. it can be left NULL. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-async.c | 19 +++ include/media/v4l2-async.h | 8 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 810f5e0273dc..91d04f00b4e4 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -107,16 +107,13 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, { int ret; - if (notifier->ops->bound) { - ret = notifier->ops->bound(notifier, sd, asd); - if (ret < 0) - return ret; - } + ret = v4l2_async_notifier_call_int_op(notifier, bound, sd, asd); + if (ret < 0) + return ret; ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); if (ret < 0) { - if (notifier->ops->unbind) - notifier->ops->unbind(notifier, sd, asd); + v4l2_async_notifier_call_void_op(notifier, unbind, sd, asd); return ret; } @@ -129,7 +126,7 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, list_move(&sd->async_list, ¬ifier->done); if (list_empty(¬ifier->waiting) && notifier->ops->complete) - return notifier->ops->complete(notifier); + return v4l2_async_notifier_call_int_op(notifier, complete); return 0; } @@ -232,8 +229,7 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) /* If we handled USB devices, we'd have to lock the parent too */ device_release_driver(d); - if (notifier->ops->unbind) - notifier->ops->unbind(notifier, sd, sd->asd); + v4l2_async_notifier_call_void_op(notifier, unbind, sd, sd->asd); /* * Store device at the device cache, in order to call @@ -344,8 +340,7 @@ void v4l2_async_unregister_subdev(struct v4l2_subdev *sd) v4l2_async_cleanup(sd); - if (notifier->ops->unbind) - notifier->ops->unbind(notifier, sd, sd->asd); + v4l2_async_notifier_call_void_op(notifier, unbind, sd, sd->asd); mutex_unlock(&list_lock); } diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h index 3c48f8b66d12..c3e001e0d1f1 100644 --- a/include/media/v4l2-async.h +++ b/include/media/v4l2-async.h @@ -95,6 +95,14 @@ struct v4l2_async_notifier_operations { struct v4l2_async_subdev *asd); }; +#define v4l2_async_notifier_call_int_op(n, op, ...)\ + (((n)->ops && (n)->ops->op) ? (n)->ops->op(n, ## __VA_ARGS__) : 0) +#define v4l2_async_notifier_call_void_op(n, op, ...)\ + do { \ + if ((n)->ops && (n)->ops->op)\ + (n)->ops->op(n, ## __VA_ARGS__); \ + } while (false) + /** * struct v4l2_async_notifier - v4l2_device notifier data * -- 2.11.0
[PATCH v7 11/18] v4l: async: Register sub-devices before calling bound callback
Register the sub-device before calling the notifier's bound callback. Doing this the other way around is problematic as the struct v4l2_device has not assigned for the sub-device yet and may be required by the bound callback. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-async.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 91d04f00b4e4..70d02378b48f 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -107,13 +107,13 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, { int ret; - ret = v4l2_async_notifier_call_int_op(notifier, bound, sd, asd); + ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); if (ret < 0) return ret; - ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); + ret = v4l2_async_notifier_call_int_op(notifier, bound, sd, asd); if (ret < 0) { - v4l2_async_notifier_call_void_op(notifier, unbind, sd, asd); + v4l2_device_unregister_subdev(sd); return ret; } -- 2.11.0
[PATCH v7 05/18] omap3isp: Use generic parser for parsing fwnode endpoints
Instead of using driver implementation, use v4l2_async_notifier_parse_fwnode_endpoints() to parse the fwnode endpoints of the device. Signed-off-by: Sakari Ailus --- drivers/media/platform/omap3isp/isp.c | 115 +++--- drivers/media/platform/omap3isp/isp.h | 5 +- 2 files changed, 37 insertions(+), 83 deletions(-) diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 1a428fe9f070..a546cf774d40 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -2001,6 +2001,7 @@ static int isp_remove(struct platform_device *pdev) __omap3isp_put(isp, false); media_entity_enum_cleanup(&isp->crashed); + v4l2_async_notifier_release(&isp->notifier); return 0; } @@ -2011,44 +2012,41 @@ enum isp_of_phy { ISP_OF_PHY_CSIPHY2, }; -static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, - struct isp_async_subdev *isd) +static int isp_fwnode_parse(struct device *dev, + struct v4l2_fwnode_endpoint *vep, + struct v4l2_async_subdev *asd) { + struct isp_async_subdev *isd = + container_of(asd, struct isp_async_subdev, asd); struct isp_bus_cfg *buscfg = &isd->bus; - struct v4l2_fwnode_endpoint vep; - unsigned int i; - int ret; bool csi1 = false; - - ret = v4l2_fwnode_endpoint_parse(fwnode, &vep); - if (ret) - return ret; + unsigned int i; dev_dbg(dev, "parsing endpoint %pOF, interface %u\n", - to_of_node(fwnode), vep.base.port); + to_of_node(vep->base.local_fwnode), vep->base.port); - switch (vep.base.port) { + switch (vep->base.port) { case ISP_OF_PHY_PARALLEL: buscfg->interface = ISP_INTERFACE_PARALLEL; buscfg->bus.parallel.data_lane_shift = - vep.bus.parallel.data_shift; + vep->bus.parallel.data_shift; buscfg->bus.parallel.clk_pol = - !!(vep.bus.parallel.flags + !!(vep->bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_FALLING); buscfg->bus.parallel.hs_pol = - !!(vep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW); + !!(vep->bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW); buscfg->bus.parallel.vs_pol = - !!(vep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW); + !!(vep->bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW); buscfg->bus.parallel.fld_pol = - !!(vep.bus.parallel.flags & V4L2_MBUS_FIELD_EVEN_LOW); + !!(vep->bus.parallel.flags & V4L2_MBUS_FIELD_EVEN_LOW); buscfg->bus.parallel.data_pol = - !!(vep.bus.parallel.flags & V4L2_MBUS_DATA_ACTIVE_LOW); - buscfg->bus.parallel.bt656 = vep.bus_type == V4L2_MBUS_BT656; + !!(vep->bus.parallel.flags & V4L2_MBUS_DATA_ACTIVE_LOW); + buscfg->bus.parallel.bt656 = vep->bus_type == V4L2_MBUS_BT656; break; case ISP_OF_PHY_CSIPHY1: case ISP_OF_PHY_CSIPHY2: - switch (vep.bus_type) { + switch (vep->bus_type) { case V4L2_MBUS_CCP2: case V4L2_MBUS_CSI1: dev_dbg(dev, "CSI-1/CCP-2 configuration\n"); @@ -2060,11 +2058,11 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, break; default: dev_err(dev, "unsupported bus type %u\n", - vep.bus_type); + vep->bus_type); return -EINVAL; } - switch (vep.base.port) { + switch (vep->base.port) { case ISP_OF_PHY_CSIPHY1: if (csi1) buscfg->interface = ISP_INTERFACE_CCP2B_PHY1; @@ -2080,47 +2078,47 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, } if (csi1) { buscfg->bus.ccp2.lanecfg.clk.pos = - vep.bus.mipi_csi1.clock_lane; + vep->bus.mipi_csi1.clock_lane; buscfg->bus.ccp2.lanecfg.clk.pol = - vep.bus.mipi_csi1.lane_polarity[0]; + vep->bus.mipi_csi1.lane_polarity[0]; dev_dbg(dev, "clock lane polarity %u, pos %u\n", buscfg->bus.ccp2.lanecfg.clk.pol, buscfg->bus.ccp2.lanecfg.clk.pos); buscfg->bus.ccp
[PATCH v7 18/18] arm: dts: omap3: N9/N950: Add flash references to the camera
Add flash and indicator LED phandles to the sensor node. Signed-off-by: Sakari Ailus --- arch/arm/boot/dts/omap3-n9.dts | 1 + arch/arm/boot/dts/omap3-n950-n9.dtsi | 4 ++-- arch/arm/boot/dts/omap3-n950.dts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts index b9e58c536afd..a2944010f62f 100644 --- a/arch/arm/boot/dts/omap3-n9.dts +++ b/arch/arm/boot/dts/omap3-n9.dts @@ -26,6 +26,7 @@ clocks = <&isp 0>; clock-frequency = <960>; nokia,nvm-size = <(16 * 64)>; + flash = <&as3645a_flash &as3645a_indicator>; port { smia_1_1: endpoint { link-frequencies = /bits/ 64 <19920 21000 49920>; diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi index cb47ae79a5f9..92c1a1da28d3 100644 --- a/arch/arm/boot/dts/omap3-n950-n9.dtsi +++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi @@ -269,13 +269,13 @@ as3645a@30 { reg = <0x30>; compatible = "ams,as3645a"; - flash { + as3645a_flash: flash { flash-timeout-us = <15>; flash-max-microamp = <32>; led-max-microamp = <6>; peak-current-limit = <175>; }; - indicator { + as3645a_indicator: indicator { led-max-microamp = <1>; }; }; diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts index 646601a3ebd8..bba5c5a6950c 100644 --- a/arch/arm/boot/dts/omap3-n950.dts +++ b/arch/arm/boot/dts/omap3-n950.dts @@ -60,6 +60,7 @@ clocks = <&isp 0>; clock-frequency = <960>; nokia,nvm-size = <(16 * 64)>; + flash = <&as3645a_flash &as3645a_indicator>; port { smia_1_1: endpoint { link-frequencies = /bits/ 64 <21000 33360 39840>; -- 2.11.0
[PATCH v7 17/18] smiapp: Add support for flash and lens devices
Parse async sub-devices by using v4l2_subdev_fwnode_reference_parse_sensor_common(). These types devices aren't directly related to the sensor, but are nevertheless handled by the smiapp driver due to the relationship of these component to the main part of the camera module --- the sensor. This does not yet address providing the user space with information on how to associate the sensor or lens devices but the kernel now has the necessary information to do that. Signed-off-by: Sakari Ailus --- drivers/media/i2c/smiapp/smiapp-core.c | 29 +++-- drivers/media/i2c/smiapp/smiapp.h | 4 +++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 700f433261d0..34fb5a2f63ce 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -2784,6 +2784,16 @@ static int __maybe_unused smiapp_resume(struct device *dev) return rval; } +static int smiapp_async_complete(struct v4l2_async_notifier *notifier) +{ + return v4l2_device_register_subdev_nodes( + notifier->master->v4l2_dev); +} + +static const struct v4l2_async_notifier_operations smiapp_async_notifier_ops = { + .complete = smiapp_async_complete, +}; + static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev) { struct smiapp_hwconfig *hwcfg; @@ -2887,6 +2897,11 @@ static int smiapp_probe(struct i2c_client *client, v4l2_i2c_subdev_init(&sensor->src->sd, client, &smiapp_ops); sensor->src->sd.internal_ops = &smiapp_internal_src_ops; + rval = v4l2_fwnode_reference_parse_sensor_common( + &client->dev, &sensor->notifier); + if (rval < 0 && rval != -ENOENT) + return rval; + sensor->vana = devm_regulator_get(&client->dev, "vana"); if (IS_ERR(sensor->vana)) { dev_err(&client->dev, "could not get regulator for vana\n"); @@ -3092,9 +3107,15 @@ static int smiapp_probe(struct i2c_client *client, if (rval < 0) goto out_media_entity_cleanup; + sensor->notifier.ops = &smiapp_async_notifier_ops; + rval = v4l2_async_subdev_notifier_register(&sensor->src->sd, + &sensor->notifier); + if (rval) + goto out_media_entity_cleanup; + rval = v4l2_async_register_subdev(&sensor->src->sd); if (rval < 0) - goto out_media_entity_cleanup; + goto out_unregister_async_notifier; pm_runtime_set_active(&client->dev); pm_runtime_get_noresume(&client->dev); @@ -3105,6 +3126,9 @@ static int smiapp_probe(struct i2c_client *client, return 0; +out_unregister_async_notifier: + v4l2_async_notifier_unregister(&sensor->notifier); + out_media_entity_cleanup: media_entity_cleanup(&sensor->src->sd.entity); @@ -3124,6 +3148,7 @@ static int smiapp_remove(struct i2c_client *client) unsigned int i; v4l2_async_unregister_subdev(subdev); + v4l2_async_notifier_unregister(&sensor->notifier); pm_runtime_disable(&client->dev); if (!pm_runtime_status_suspended(&client->dev)) diff --git a/drivers/media/i2c/smiapp/smiapp.h b/drivers/media/i2c/smiapp/smiapp.h index f74d695018b9..be92cb5713f4 100644 --- a/drivers/media/i2c/smiapp/smiapp.h +++ b/drivers/media/i2c/smiapp/smiapp.h @@ -20,9 +20,10 @@ #define __SMIAPP_PRIV_H_ #include +#include +#include #include #include -#include #include "smiapp-pll.h" #include "smiapp-reg.h" @@ -172,6 +173,7 @@ struct smiapp_subdev { * struct smiapp_sensor - Main device structure */ struct smiapp_sensor { + struct v4l2_async_notifier notifier; /* * "mutex" is used to serialise access to all fields here * except v4l2_ctrls at the end of the struct. "mutex" is also -- 2.11.0
[PATCH v7 13/18] dt: bindings: Add a binding for flash devices associated to a sensor
Camera flash drivers (and LEDs) are separate from the sensor devices in DT. In order to make an association between the two, provide the association information to the software. Signed-off-by: Sakari Ailus Acked-by: Rob Herring --- Documentation/devicetree/bindings/media/video-interfaces.txt | 8 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt index 852041a7480c..fee73cf2a714 100644 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt @@ -67,6 +67,14 @@ are required in a relevant parent node: identifier, should be 1. - #size-cells: should be zero. + +Optional properties +--- + +- flash: An array of phandles referring to the flash LED, a sub-node + of the LED driver device node. + + Optional endpoint properties -- 2.11.0
[PATCH v7 15/18] v4l2-fwnode: Add convenience function for parsing generic references
Add function v4l2_fwnode_reference_count() for counting external references and v4l2_fwnode_reference_parse() for parsing them as async sub-devices. This can be done on e.g. flash or lens async sub-devices that are not part of but are associated with a sensor. struct v4l2_async_notifier.max_subdevs field is added to contain the maximum number of sub-devices in a notifier to reflect the memory allocated for the subdevs array. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-fwnode.c | 81 +++ include/media/v4l2-fwnode.h | 28 2 files changed, 109 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index f8c7a9bc6a58..24f8020caf28 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -449,6 +449,87 @@ int v4l2_async_notifier_parse_fwnode_endpoints( } EXPORT_SYMBOL_GPL(v4l2_async_notifier_parse_fwnode_endpoints); +static void v4l2_fwnode_print_args(struct fwnode_reference_args *args) +{ + unsigned int i; + + for (i = 0; i < args->nargs; i++) { + pr_cont(" %u", args->args[i]); + if (i + 1 < args->nargs) + pr_cont(","); + } +} + +int v4l2_fwnode_reference_parse( + struct device *dev, struct v4l2_async_notifier *notifier, + const char *prop, const char *nargs_prop, unsigned int nargs, + size_t asd_struct_size, + int (*parse_single)(struct device *dev, + struct fwnode_reference_args *args, + struct v4l2_async_subdev *asd)) +{ + struct fwnode_reference_args args; + unsigned int index = 0; + int ret = -ENOENT; + + if (asd_struct_size < sizeof(struct v4l2_async_subdev)) + return -EINVAL; + + for (; !fwnode_property_get_reference_args( +dev_fwnode(dev), prop, nargs_prop, nargs, +index, &args); index++) + fwnode_handle_put(args.fwnode); + + ret = v4l2_async_notifier_realloc(notifier, + notifier->num_subdevs + index); + if (ret) + return -ENOMEM; + + for (ret = -ENOENT, index = 0; !fwnode_property_get_reference_args( +dev_fwnode(dev), prop, nargs_prop, nargs, +index, &args); index++) { + struct v4l2_async_subdev *asd; + + if (WARN_ON(notifier->num_subdevs >= notifier->max_subdevs)) + break; + + asd = kzalloc(asd_struct_size, GFP_KERNEL); + if (!asd) { + ret = -ENOMEM; + goto error; + } + + ret = parse_single ? parse_single(dev, &args, asd) : 0; + if (ret == -ENOTCONN) { + dev_dbg(dev, + "ignoring reference prop \"%s\", nargs_prop \"%s\", nargs %u, index %u", + prop, nargs_prop, nargs, index); + v4l2_fwnode_print_args(&args); + pr_cont("\n"); + continue; + } else if (ret < 0) { + dev_warn(dev, +"driver could not parse reference prop \"%s\", nargs_prop \"%s\", nargs %u, index %u", +prop, nargs_prop, nargs, index); + v4l2_fwnode_print_args(&args); + pr_cont("\n"); + goto error; + } + + notifier->subdevs[notifier->num_subdevs] = asd; + asd->match.fwnode.fwnode = args.fwnode; + asd->match_type = V4L2_ASYNC_MATCH_FWNODE; + notifier->num_subdevs++; + } + + return 0; + +error: + fwnode_handle_put(args.fwnode); + return ret; +} +EXPORT_SYMBOL_GPL(v4l2_fwnode_reference_parse); + MODULE_LICENSE("GPL"); MODULE_AUTHOR("Sakari Ailus "); MODULE_AUTHOR("Sylwester Nawrocki "); diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index 6d125f26ec84..52f528162818 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -254,4 +254,32 @@ int v4l2_async_notifier_parse_fwnode_endpoints( struct v4l2_fwnode_endpoint *vep, struct v4l2_async_subdev *asd)); +/** + * v4l2_fwnode_reference_parse - parse references for async sub-devices + * @dev: the device node the properties of which are parsed for references + * @notifier: the async notifier where the async subdevs will be added + * @prop: the name of the property + * @nargs_prop: the name of the property in the remote node that specifies the + * number of integer arguments (may be NULL, in that case nargs + * will be used). + * @nargs: the number of integer arguments after the reference
[PATCH v7 12/18] v4l: async: Allow binding notifiers to sub-devices
Registering a notifier has required the knowledge of struct v4l2_device for the reason that sub-devices generally are registered to the v4l2_device (as well as the media device, also available through v4l2_device). This information is not available for sub-device drivers at probe time. What this patch does is that it allows registering notifiers without having v4l2_device around. Instead the sub-device pointer is stored to the notifier. Once the sub-device of the driver that registered the notifier is registered, the notifier will gain the knowledge of the v4l2_device, and the binding of async sub-devices from the sub-device driver's notifier may proceed. The master notifier's complete callback is only called when all sub-device notifiers are completed. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-async.c | 153 +-- include/media/v4l2-async.h | 19 - 2 files changed, 146 insertions(+), 26 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 70d02378b48f..55d7886103d2 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -25,6 +25,10 @@ #include #include +static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *sd, + struct v4l2_async_subdev *asd); + static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) { #if IS_ENABLED(CONFIG_I2C) @@ -101,14 +105,69 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier * return NULL; } +static bool v4l2_async_subdev_notifiers_complete( + struct v4l2_async_notifier *notifier) +{ + struct v4l2_async_notifier *n; + + list_for_each_entry(n, ¬ifier->notifiers, notifiers) { + if (!n->master) + return false; + } + + return true; +} + +#define notifier_v4l2_dev(n) \ + (!!(n)->v4l2_dev ? (n)->v4l2_dev : \ +!!(n)->master ? (n)->master->v4l2_dev : NULL) + +static struct v4l2_async_notifier *v4l2_async_get_subdev_notifier( + struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd) +{ + struct v4l2_async_notifier *n; + + list_for_each_entry(n, ¬ifier_list, list) { + if (n->sd == sd) + return n; + } + + return NULL; +} + +static int v4l2_async_notifier_test_all_subdevs( + struct v4l2_async_notifier *notifier) +{ + struct v4l2_subdev *sd, *tmp; + + if (!notifier_v4l2_dev(notifier)) + return 0; + + list_for_each_entry_safe(sd, tmp, &subdev_list, async_list) { + struct v4l2_async_subdev *asd; + int ret; + + asd = v4l2_async_belongs(notifier, sd); + if (!asd) + continue; + + ret = v4l2_async_test_notify(notifier, sd, asd); + if (ret < 0) + return ret; + } + + return 0; +} + static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) { + struct v4l2_async_notifier *subdev_notifier; int ret; - ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); - if (ret < 0) + ret = v4l2_device_register_subdev(notifier_v4l2_dev(notifier), sd); + if (ret) return ret; ret = v4l2_async_notifier_call_int_op(notifier, bound, sd, asd); @@ -125,8 +184,26 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, /* Move from the global subdevice list to notifier's done */ list_move(&sd->async_list, ¬ifier->done); - if (list_empty(¬ifier->waiting) && notifier->ops->complete) - return v4l2_async_notifier_call_int_op(notifier, complete); + subdev_notifier = v4l2_async_get_subdev_notifier(notifier, sd); + if (subdev_notifier && !subdev_notifier->master) { + subdev_notifier->master = notifier; + list_add(&subdev_notifier->notifiers, ¬ifier->notifiers); + ret = v4l2_async_notifier_test_all_subdevs(subdev_notifier); + if (ret) + return ret; + } + + if (list_empty(¬ifier->waiting) && + v4l2_async_subdev_notifiers_complete(notifier)) { + ret = v4l2_async_notifier_call_int_op(notifier, complete); + if (ret) + return ret; + } + + if (notifier->master && list_empty(¬ifier->master->waiting) && + v4l2_async_subdev_notifiers_complete(notifier->master)) + return v4l2_async_notifier_call_int_op(notifier->master, + complete); return 0; } @@ -140,18 +217,17 @@
[PATCH v7 09/18] v4l: async: Move async subdev notifier operations to a separate structure
From: Laurent Pinchart The async subdev notifier .bound(), .unbind() and .complete() operations are function pointers stored directly in the v4l2_async_subdev structure. As the structure isn't immutable, this creates a potential security risk as the function pointers are mutable. To fix this, move the function pointers to a new v4l2_async_subdev_operations structure that can be made const in drivers. Signed-off-by: Laurent Pinchart --- drivers/media/platform/am437x/am437x-vpfe.c| 8 +-- drivers/media/platform/atmel/atmel-isc.c | 10 ++--- drivers/media/platform/atmel/atmel-isi.c | 10 ++--- drivers/media/platform/davinci/vpif_capture.c | 8 +-- drivers/media/platform/davinci/vpif_display.c | 8 +-- drivers/media/platform/exynos4-is/media-dev.c | 8 +-- drivers/media/platform/omap3isp/isp.c | 6 +- drivers/media/platform/pxa_camera.c| 8 +-- drivers/media/platform/qcom/camss-8x16/camss.c | 8 +-- drivers/media/platform/rcar-vin/rcar-core.c| 10 ++--- drivers/media/platform/rcar_drif.c | 10 ++--- drivers/media/platform/soc_camera/soc_camera.c | 14 +++-- drivers/media/platform/stm32/stm32-dcmi.c | 10 ++--- drivers/media/platform/ti-vpe/cal.c| 8 +-- drivers/media/platform/xilinx/xilinx-vipp.c| 8 +-- drivers/media/v4l2-core/v4l2-async.c | 20 +- drivers/staging/media/imx/imx-media-dev.c | 8 +-- include/media/v4l2-async.h | 29 +- 18 files changed, 131 insertions(+), 60 deletions(-) diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c index dfcc484cab89..0997c640191d 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.c +++ b/drivers/media/platform/am437x/am437x-vpfe.c @@ -2417,6 +2417,11 @@ static int vpfe_async_complete(struct v4l2_async_notifier *notifier) return vpfe_probe_complete(vpfe); } +static const struct v4l2_async_notifier_operations vpfe_async_ops = { + .bound = vpfe_async_bound, + .complete = vpfe_async_complete, +}; + static struct vpfe_config * vpfe_get_pdata(struct platform_device *pdev) { @@ -2590,8 +2595,7 @@ static int vpfe_probe(struct platform_device *pdev) vpfe->notifier.subdevs = vpfe->cfg->asd; vpfe->notifier.num_subdevs = ARRAY_SIZE(vpfe->cfg->asd); - vpfe->notifier.bound = vpfe_async_bound; - vpfe->notifier.complete = vpfe_async_complete; + vpfe->notifier.ops = &vpfe_async_ops; ret = v4l2_async_notifier_register(&vpfe->v4l2_dev, &vpfe->notifier); if (ret) { diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index d7103c5f92c3..48544c4137cb 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -1639,6 +1639,12 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) return 0; } +static const struct v4l2_async_notifier_operations isc_async_ops = { + .bound = isc_async_bound, + .unbind = isc_async_unbind, + .complete = isc_async_complete, +}; + static void isc_subdev_cleanup(struct isc_device *isc) { struct isc_subdev_entity *subdev_entity; @@ -1851,9 +1857,7 @@ static int atmel_isc_probe(struct platform_device *pdev) list_for_each_entry(subdev_entity, &isc->subdev_entities, list) { subdev_entity->notifier.subdevs = &subdev_entity->asd; subdev_entity->notifier.num_subdevs = 1; - subdev_entity->notifier.bound = isc_async_bound; - subdev_entity->notifier.unbind = isc_async_unbind; - subdev_entity->notifier.complete = isc_async_complete; + subdev_entity->notifier.ops = &isc_async_ops; ret = v4l2_async_notifier_register(&isc->v4l2_dev, &subdev_entity->notifier); diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c index 891fa2505efa..eadbf9def358 100644 --- a/drivers/media/platform/atmel/atmel-isi.c +++ b/drivers/media/platform/atmel/atmel-isi.c @@ -1105,6 +1105,12 @@ static int isi_graph_notify_bound(struct v4l2_async_notifier *notifier, return 0; } +static const struct v4l2_async_notifier_operations isi_graph_notify_ops = { + .bound = isi_graph_notify_bound, + .unbind = isi_graph_notify_unbind, + .complete = isi_graph_notify_complete, +}; + static int isi_graph_parse(struct atmel_isi *isi, struct device_node *node) { struct device_node *ep = NULL; @@ -1152,9 +1158,7 @@ static int isi_graph_init(struct atmel_isi *isi) isi->notifier.subdevs = subdevs; isi->notifier.num_subdevs = 1; - isi->notifier.bound = isi_graph_notify_bound; - isi->notifier.unbind =
[PATCH v7 16/18] v4l2-fwnode: Add convenience function for parsing common external refs
Add v4l2_fwnode_parse_reference_sensor_common for parsing common sensor properties that refer to adjacent devices such as flash or lens driver chips. As this is an association only, there's little a regular driver needs to know about these devices as such. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-fwnode.c | 27 +++ include/media/v4l2-fwnode.h | 3 +++ 2 files changed, 30 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 24f8020caf28..f28be3b751d3 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -530,6 +530,33 @@ int v4l2_fwnode_reference_parse( } EXPORT_SYMBOL_GPL(v4l2_fwnode_reference_parse); +int v4l2_fwnode_reference_parse_sensor_common( + struct device *dev, struct v4l2_async_notifier *notifier) +{ + static const struct { + char *name; + char *cells; + unsigned int nr_cells; + } props[] = { + { "flash", NULL, 0 }, + { "lens-focus", NULL, 0 }, + }; + unsigned int i; + int rval; + + for (i = 0; i < ARRAY_SIZE(props); i++) { + rval = v4l2_fwnode_reference_parse( + dev, notifier, props[i].name, props[i].cells, + props[i].nr_cells, sizeof(struct v4l2_async_subdev), + NULL); + if (rval < 0 && rval != -ENOENT) + return rval; + } + + return rval; +} +EXPORT_SYMBOL_GPL(v4l2_fwnode_reference_parse_sensor_common); + MODULE_LICENSE("GPL"); MODULE_AUTHOR("Sakari Ailus "); MODULE_AUTHOR("Sylwester Nawrocki "); diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index 52f528162818..fd14f1d38966 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -282,4 +282,7 @@ int v4l2_fwnode_reference_parse( struct fwnode_reference_args *args, struct v4l2_async_subdev *asd)); +int v4l2_fwnode_reference_parse_sensor_common( + struct device *dev, struct v4l2_async_notifier *notifier); + #endif /* _V4L2_FWNODE_H */ -- 2.11.0
[PATCH v7 14/18] dt: bindings: Add lens-focus binding for image sensors
The lens-focus property contains a phandle to the lens voice coil driver that is associated to the sensor; typically both are contained in the same camera module. Signed-off-by: Sakari Ailus Acked-by: Pavel Machek Reviewed-by: Sebastian Reichel Acked-by: Rob Herring --- Documentation/devicetree/bindings/media/video-interfaces.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt index fee73cf2a714..73d045127dcf 100644 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt @@ -74,6 +74,8 @@ Optional properties - flash: An array of phandles referring to the flash LED, a sub-node of the LED driver device node. +- lens-focus: A phandle to the node of the focus lens controller. + Optional endpoint properties -- 2.11.0
[PATCH v7 00/18] Unified fwnode endpoint parser, async sub-device notifier support, N9 flash DTS
Hi folks, We have a large influx of new, unmerged, drivers that are now parsing fwnode endpoints and each one of them is doing this a little bit differently. The needs are still exactly the same for the graph data structure is device independent. This is still a non-trivial task and the majority of the driver implementations are buggy, just buggy in different ways. Facilitate parsing endpoints by adding a convenience function for parsing the endpoints, and make the omap3isp and rcar-vin drivers use them as an example. To show where we're getting with this, I've added support for async sub-device notifier support that is notifiers that can be registered by sub-device drivers as well as V4L2 fwnode improvements to make use of them and the DTS changes for the Nokia N9. Some of these patches I've posted previously in this set here: http://www.spinics.net/lists/linux-media/msg118764.html> Since that, the complete callback of the master notifier registering the V4L2 device is only called once all sub-notifiers have been completed as well. This way the device node creation can be postponed until all devices have been successfully initialised. With this, the as3645a driver successfully registers a sub-device to the media device created by the omap3isp driver. The kernel also has the information it's related to the sensor driven by the smiapp driver but we don't have a way to expose that information yet. since v6: - Drop the last patch that added variant for parsing endpoints given specific port and endpoints numbers. - Separate driver changes from the fwnode endpoint parser patch into two patches. rcar-vin driver is now using the name function. - Use -ENOTCONN to tell the parser that and endpoint (or a reference) is to be ignored. - parse_endpoint and parse_single callback functions are now optional and documented as such. - Added Laurent's patch adding notifier operations struct which I rebase on the fwnode parser patchset. I wrote another patch to call the notifier operations through macros. - Add DT bindings for flash and lens devices. - V4L2 fwnode parser for references (such as flash and lens). - Added smiapp driver support for async sub-devices (lens and flash). - Added a few fixes for omap3isp. since v5: - Use v4l2_async_ prefix for static functions as well (4th patch) - Use memcpy() to copy array rather than a loop - Document that the v4l2_async_subdev pointer in driver specific struct must be the first member - Improve documentation of the added functions (4th and 5th patches) - Arguments - More thorough explation of the purpose, usage and object lifetime - Added acks since v4: - Prepend the set with three documentation fixes. - The driver's async struct must begin with struct v4l2_async_subdev. Fix this for omap3isp and document it. - Improve documentation for new functions. - Don't use devm_ family of functions for allocating memory. Introduce v4l2_async_notifier_release() to release memory resources. - Rework both v4l2_async_notifier_fwnode_parse_endpoints() and v4l2_async_notifier_fwnode_parse_endpoint() and the local functions they call. This should make the code cleaner. Despite the name, for linking and typical usage reasons the functions remain in v4l2-fwnode.c. - Convert rcar-vin to use v4l2_async_notifier_fwnode_parse_endpoint(). - Use kvmalloc() for allocating the notifier's subdevs array. - max_subdevs argument for notifier_realloc is now the total maximum number of subdevs, not the number of available subdevs. - Use fwnode_device_is_available() to make sure the device actually exists. - Move the note telling v4l2_async_notifier_fwnode_parse_endpoints() should not be used by new drivers to the last patch adding v4l2_async_notifier_fwnode_parse_endpoint(). since v3: - Rebase on current mediatree master. since v2: - Rebase on CCP2 support patches. - Prepend a patch cleaning up omap3isp driver a little. since v1: - The first patch has been merged (it was a bugfix). - In anticipation that the parsing can take place over several iterations, take the existing number of async sub-devices into account when re-allocating an array of async sub-devices. - Rework the first patch to better anticipate parsing single endpoint at a time by a driver. - Add a second patch that adds a function for parsing endpoints one at a time based on port and endpoint numbers. Laurent Pinchart (1): v4l: async: Move async subdev notifier operations to a separate structure Sakari Ailus (17): v4l: fwnode: Move KernelDoc documentation to the header v4l: async: Add V4L2 async documentation to the documentation build docs-rst: v4l: Include Qualcomm CAMSS in documentation build v4l: fwnode: Support generic parsing of graph endpoints in a device omap3isp: Use generic parser for parsing fwnode endpoints rcar-vin: Use generic parser for parsing fwnode endpoints omap3isp: Fix check for our own sub-devic
[PATCH v7 04/18] v4l: fwnode: Support generic parsing of graph endpoints in a device
The current practice is that drivers iterate over their endpoints and parse each endpoint separately. This is very similar in a number of drivers, implement a generic function for the job. Driver specific matters can be taken into account in the driver specific callback. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-async.c | 16 drivers/media/v4l2-core/v4l2-fwnode.c | 136 ++ include/media/v4l2-async.h| 24 +- include/media/v4l2-fwnode.h | 53 + 4 files changed, 227 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 851f128eba22..6740a241d4a1 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -22,6 +22,7 @@ #include #include +#include #include static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) @@ -278,6 +279,21 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) } EXPORT_SYMBOL(v4l2_async_notifier_unregister); +void v4l2_async_notifier_release(struct v4l2_async_notifier *notifier) +{ + unsigned int i; + + for (i = 0; i < notifier->num_subdevs; i++) + kfree(notifier->subdevs[i]); + + notifier->max_subdevs = 0; + notifier->num_subdevs = 0; + + kvfree(notifier->subdevs); + notifier->subdevs = NULL; +} +EXPORT_SYMBOL_GPL(v4l2_async_notifier_release); + int v4l2_async_register_subdev(struct v4l2_subdev *sd) { struct v4l2_async_notifier *notifier; diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 706f9e7b90f1..f8c7a9bc6a58 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -19,6 +19,7 @@ */ #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include #include +#include #include enum v4l2_fwnode_bus_type { @@ -313,6 +315,140 @@ void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link) } EXPORT_SYMBOL_GPL(v4l2_fwnode_put_link); +static int v4l2_async_notifier_realloc(struct v4l2_async_notifier *notifier, + unsigned int max_subdevs) +{ + struct v4l2_async_subdev **subdevs; + + if (max_subdevs <= notifier->max_subdevs) + return 0; + + subdevs = kvmalloc_array( + max_subdevs, sizeof(*notifier->subdevs), + GFP_KERNEL | __GFP_ZERO); + if (!subdevs) + return -ENOMEM; + + if (notifier->subdevs) { + memcpy(subdevs, notifier->subdevs, + sizeof(*subdevs) * notifier->num_subdevs); + + kvfree(notifier->subdevs); + } + + notifier->subdevs = subdevs; + notifier->max_subdevs = max_subdevs; + + return 0; +} + +static int v4l2_async_notifier_fwnode_parse_endpoint( + struct device *dev, struct v4l2_async_notifier *notifier, + struct fwnode_handle *endpoint, unsigned int asd_struct_size, + int (*parse_endpoint)(struct device *dev, + struct v4l2_fwnode_endpoint *vep, + struct v4l2_async_subdev *asd)) +{ + struct v4l2_async_subdev *asd; + struct v4l2_fwnode_endpoint *vep; + int ret = 0; + + asd = kzalloc(asd_struct_size, GFP_KERNEL); + if (!asd) + return -ENOMEM; + + asd->match.fwnode.fwnode = + fwnode_graph_get_remote_port_parent(endpoint); + if (!asd->match.fwnode.fwnode) { + dev_warn(dev, "bad remote port parent\n"); + ret = -EINVAL; + goto out_err; + } + + /* Ignore endpoints the parsing of which failed. */ + vep = v4l2_fwnode_endpoint_alloc_parse(endpoint); + if (IS_ERR(vep)) { + ret = PTR_ERR(vep); + dev_warn(dev, "unable to parse V4L2 fwnode endpoint (%d)\n", +ret); + goto out_err; + } + + ret = parse_endpoint ? parse_endpoint(dev, vep, asd) : 0; + v4l2_fwnode_endpoint_free(vep); + if (ret == -ENOTCONN) { + dev_dbg(dev, "ignoring endpoint %u,%u\n", vep->base.port, + vep->base.id); + kfree(asd); + return 0; + } else if (ret < 0) { + dev_warn(dev, "driver could not parse endpoint %u,%u (%d)\n", +vep->base.port, vep->base.id, ret); + goto out_err; + } + + asd->match_type = V4L2_ASYNC_MATCH_FWNODE; + notifier->subdevs[notifier->num_subdevs] = asd; + notifier->num_subdevs++; + + return 0; + +out_err: + fwnode_handle_put(asd->match.fwnode.fwnode); + kfree(asd); + + return ret; +} + +int v4l2_async_notifier_parse_fwnode_endpoints( + struct device *dev, struct v4l2_async_notifier *notifier, +
[PATCH v7 03/18] docs-rst: v4l: Include Qualcomm CAMSS in documentation build
Qualcomm CAMSS was left out from documentation build. Fix this. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Acked-by: Hans Verkuil --- Documentation/media/v4l-drivers/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index 10f2ce42ece2..5c202e23616b 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -50,6 +50,7 @@ For more details see the file COPYING in the source distribution of Linux. philips pvrusb2 pxa_camera + qcom_camss radiotrack rcar-fdp1 saa7134 -- 2.11.0
[PATCH 2/7] media: v4l2 uapi book: get rid of driver programming's chapter
It doesn't make any sense having a driver programming's chapter at the uAPI book, as this is related to kernel API. Also, we now have such kAPI book where V4L2 driver programming is covered. So, get rid of this left-over. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/driver.rst | 9 - Documentation/media/uapi/v4l/v4l2.rst | 1 - 2 files changed, 10 deletions(-) delete mode 100644 Documentation/media/uapi/v4l/driver.rst diff --git a/Documentation/media/uapi/v4l/driver.rst b/Documentation/media/uapi/v4l/driver.rst deleted file mode 100644 index 2319b383f0a4.. --- a/Documentation/media/uapi/v4l/driver.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. -*- coding: utf-8; mode: rst -*- - -.. _driver: - -*** -V4L2 Driver Programming -*** - -to do diff --git a/Documentation/media/uapi/v4l/v4l2.rst b/Documentation/media/uapi/v4l/v4l2.rst index 297c293d4c93..2128717299b3 100644 --- a/Documentation/media/uapi/v4l/v4l2.rst +++ b/Documentation/media/uapi/v4l/v4l2.rst @@ -25,7 +25,6 @@ This part describes the Video for Linux API version 2 (V4L2 API) specification. pixfmt io devices -driver libv4l compat user-func -- 2.13.5
[PATCH 4/7] media: vidioc-g-fmt.rst: adjust table format
While doing a visual inspection with Sphinx 1.5, I noticed that one of the columns was smaller than the text written there. As this is the only thing I noticed with Sphinx 1.5, I suspect that this was also a problem with Sphinx 1.4. Yet, I opted to touch it in a way that wouldn't cause backward issues. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst index f598ea9166e3..3ead350e099f 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst @@ -88,7 +88,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical .. c:type:: v4l2_format -.. tabularcolumns:: |p{1.2cm}|p{4.3cm}|p{3.0cm}|p{9.0cm}| +.. tabularcolumns:: |p{1.2cm}|p{4.6cm}|p{3.0cm}|p{8.6cm}| .. flat-table:: struct v4l2_format :header-rows: 0 -- 2.13.5
[PATCH 5/7] media: fix build breakage with Sphinx 1.6
Not sure why, but, on this particular document, on Sphinx 1.4 and 1.5, the usage of \small here causes it to write the table at the same column where the text before it ended, with makes the table to go out of the page. A possible solution would be to add a \newline on latex raw, with was the approach took. Unfortunately, that causes a breakage on Sphinx 1.6. So, we're adding a small dot here, in order to avoid polluting too much the document, while making it compatible with all versions. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-srggb10p.rst | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst index 9e52610aa954..aa3dbf163b97 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst @@ -33,10 +33,22 @@ of a small V4L2_PIX_FMT_SBGGR10P image: **Byte Order.** Each cell is one byte. - .. raw:: latex -\newline\small +\small + +.. HACK: + + On Sphinx 1.4 and 1.5, the usage of \small just before the table + causes it to continue at the same column where the above text ended. + + A possible solution would be to add a \newline on latex raw. + Unfortunately, that causes a breakage on Sphinx 1.6. + + So, we're placing the \small before this note, with should be producing + the same result on all versions + +. .. tabularcolumns:: |p{2.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{10.0cm}| -- 2.13.5
[PATCH 7/7] media: index.rst: don't write "Contents:" on PDF output
Right now, Sphinx unconditionally creates a blank page with just "Contents:" on it, on PDF output. While this makes sense for html, it doesn't o PDF, as LaTeX does what's required automatically. Fix it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/index.rst | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/media/index.rst b/Documentation/media/index.rst index 7d2907d4f8d7..1cf5316c8ff8 100644 --- a/Documentation/media/index.rst +++ b/Documentation/media/index.rst @@ -1,7 +1,11 @@ Linux Media Subsystem Documentation === -Contents: +.. only:: html + + .. class:: toc-title + +Table of Contents .. toctree:: :maxdepth: 2 -- 2.13.5
[PATCH 6/7] media: pixfmt*.rst: replace a two dots by a comma
On several tables, the color sample location table preamble is written as: Color Sample Location.. Instead of: Color Sample Location: I suspect that the repetition of such pattern was due to some copy-and-paste (or perhaps some error during DocBook conversion). Anyway, fix it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-m420.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-nv12.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-nv12m.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-nv16.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-nv16m.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-uyvy.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-vyuy.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-y41p.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-yuv410.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv411p.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv420.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv420m.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv422m.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv422p.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv444m.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuyv.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-yvyu.rst| 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-m420.rst b/Documentation/media/uapi/v4l/pixfmt-m420.rst index 7dd47c071e2f..6703f4079c3e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-m420.rst +++ b/Documentation/media/uapi/v4l/pixfmt-m420.rst @@ -66,7 +66,7 @@ Each cell is one byte. - Cr\ :sub:`11` -**Color Sample Location..** +**Color Sample Location:** diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12.rst b/Documentation/media/uapi/v4l/pixfmt-nv12.rst index 5b45a6d2ac95..2776b41377d5 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12.rst @@ -71,7 +71,7 @@ Each cell is one byte. - Cr\ :sub:`11` -**Color Sample Location..** +**Color Sample Location:** .. flat-table:: :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12m.rst b/Documentation/media/uapi/v4l/pixfmt-nv12m.rst index de3051fd6b50..c1a2779f604c 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12m.rst @@ -83,7 +83,7 @@ Each cell is one byte. - Cr\ :sub:`11` -**Color Sample Location..** +**Color Sample Location:** diff --git a/Documentation/media/uapi/v4l/pixfmt-nv16.rst b/Documentation/media/uapi/v4l/pixfmt-nv16.rst index 8ceba79ff636..f0fdad3006cf 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv16.rst @@ -79,7 +79,7 @@ Each cell is one byte. - Cr\ :sub:`31` -**Color Sample Location..** +**Color Sample Location:** diff --git a/Documentation/media/uapi/v4l/pixfmt-nv16m.rst b/Documentation/media/uapi/v4l/pixfmt-nv16m.rst index 4d46ab39f9f1..c45f036763e7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv16m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv16m.rst @@ -83,7 +83,7 @@ Each cell is one byte. - Cr\ :sub:`32` -**Color Sample Location..** +**Color Sample Location:** diff --git a/Documentation/media/uapi/v4l/pixfmt-uyvy.rst b/Documentation/media/uapi/v4l/pixfmt-uyvy.rst index 30660e04dd0e..ecdc2d94c209 100644 --- a/Documentation/media/uapi/v4l/pixfmt-uyvy.rst +++ b/Documentation/media/uapi/v4l/pixfmt-uyvy.rst @@ -65,7 +65,7 @@ Each cell is one byte. - Y'\ :sub:`33` -**Color Sample Location..** +**Color Sample Location:** diff --git a/Documentation/media/uapi/v4l/pixfmt-vyuy.rst b/Documentation/media/uapi/v4l/pixfmt-vyuy.rst index a3f61f280b94..670c339c1714 100644 --- a/Documentation/media/uapi/v4l/pixfmt-vyuy.rst +++ b/Documentation/media/uapi/v4l/pixfmt-vyuy.rst @@ -65,7 +65,7 @@ Each cell is one byte. - Y'\ :sub:`33` -**Color Sample Location..** +**Color Sample Location:** .. flat-table:: :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y41p.rst b/Documentation/media/uapi/v4l/pixfmt-y41p.rst index 05d040c46a47..e1fe548807a4 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y41p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y41p.rst @@ -88,7 +88,7 @@ Each cell is one byte. - Y'\ :sub:`37` -**Color Sample Location..** +**Color Sample Location:** .. flat-table:: :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv410.rst b/Documentation/media/uapi/v4l/pixfmt-yuv410.rst index 0c49915af850..b51a0d1c6108 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv410.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv410.rst @@ -67,7 +67,7 @@ Each cell is one byte. - Cb\ :sub:`00` -**Color Sample Location..** +**Color Sample Location:** diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst b/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst index 2cf3
[PATCH 0/7] Another set of fixes for PDF output
There are other things that are needed for a proper PDF output, and a fix for yet another Sphinx 1.6 breakage. After this patch series, PDF output now looks OK on Sphinx 1.4 to 1.6. There's, however, one step back on Sphinx 1.6: I couldn't find any way to use a background color for notifications (note, attention, important, etc). In thesis, on Sphinx 1.6, this is natively supported. However, in practice, support for it is broken: if a note is inserted inside a table, it sometimes put at the wrong cell and with the wrong size. I was not able to fix it there. Yet, it fails gracefully, as it will just display those boxes on boring black on white. While, IMHO, it fails to the idea of giving a highlight to the text, it is readable. That is a shame, as, except for this, Sphinx 1.6 seems to produce a better table output than previous versions, when cell span is used. Also, less hacks at the latex_preamble are now required on newer versions. Well, maybe some day we may be able to remove all hacks on newer versions of it... Mauro Carvalho Chehab (7): media: format.rst: use the right markup for important notes media: v4l2 uapi book: get rid of driver programming's chapter media: vivid.rst: add a blank line to correct ReST format media: vidioc-g-fmt.rst: adjust table format media: fix build breakage with Sphinx 1.6 media: pixfmt*.rst: replace a two dots by a comma media: index.rst: don't write "Contents:" on PDF output Documentation/media/index.rst| 6 +- Documentation/media/uapi/v4l/driver.rst | 9 - Documentation/media/uapi/v4l/format.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-m420.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-nv12.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-nv12m.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-nv16.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-nv16m.rst| 2 +- Documentation/media/uapi/v4l/pixfmt-srggb10p.rst | 16 ++-- Documentation/media/uapi/v4l/pixfmt-uyvy.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-vyuy.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-y41p.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv410.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv411p.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv420.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv420m.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv422m.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv422p.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuv444m.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yuyv.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-yvyu.rst | 2 +- Documentation/media/uapi/v4l/v4l2.rst| 1 - Documentation/media/uapi/v4l/vidioc-g-fmt.rst| 2 +- Documentation/media/v4l-drivers/vivid.rst| 1 + 24 files changed, 39 insertions(+), 32 deletions(-) delete mode 100644 Documentation/media/uapi/v4l/driver.rst -- 2.13.5
[PATCH 1/7] media: format.rst: use the right markup for important notes
There's an important note there, but it is not using the ReST markup. So, it doesn't get any visual highlight on the output. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/format.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/format.rst b/Documentation/media/uapi/v4l/format.rst index 452c6d59cad5..3e3efb0e349e 100644 --- a/Documentation/media/uapi/v4l/format.rst +++ b/Documentation/media/uapi/v4l/format.rst @@ -78,7 +78,7 @@ output devices is available. [#f1]_ The :ref:`VIDIOC_ENUM_FMT` ioctl must be supported by all drivers exchanging image data with applications. -**Important** +.. important:: Drivers are not supposed to convert image formats in kernel space. They must enumerate only formats directly supported by the hardware. -- 2.13.5
[PATCH 3/7] media: vivid.rst: add a blank line to correct ReST format
On all vivid parameters, there's an space after the parameter, except for "DV Timings Signal Mode". That makes this single one to be written in bold, and, at PDF output, at the same line as its description. Use the same convention as the other parameters, in order to adjust its output. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/v4l-drivers/vivid.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/media/v4l-drivers/vivid.rst b/Documentation/media/v4l-drivers/vivid.rst index 3e44b2217f2d..089595ce11c5 100644 --- a/Documentation/media/v4l-drivers/vivid.rst +++ b/Documentation/media/v4l-drivers/vivid.rst @@ -829,6 +829,7 @@ The following two controls are only valid for video and vbi capture. The following two controls are only valid for video capture. - DV Timings Signal Mode: + selects the behavior of VIDIOC_QUERY_DV_TIMINGS: what should it return? -- 2.13.5
Re: [PATCH v2 00/26] Improve DVB documentation and reduce its gap
> There is still a gap at the CA API, as there are three ioctls that are used > only by a few drivers and whose structs are not properly documented: > CA_GET_MSG, CA_SEND_MSG and CA_SET_DESCR. > > The first two ones seem to be related to a way that a few drivers > provide to send/receive messages. I never seen usage of such R/W ioctls, all drivers I have access to are using read()/write() variant of communication. Yet, I was unable to get what > "index" and "type" means on those ioctls. The CA_SET_DESCR is > only supported by av7110 driver, and has an even weirder > undocumented struct. I was unable to discover at the Kernel, VDR > or Kaffeine how those structs are filled. I suspect that there's > something wrong there, but I won't risk trying to fix without > knowing more about them. So, let's just document that those > are needing documentation :-) > 1) #define CA_SET_DESCR _IOW('o', 134, ca_descr_t) CA_SET_DESCR is used for feeding descrambler device with correct keys (called here "control words") what allows to get services unscrambled. The best docu is: "Digital Video Broadcasting (DVB); Support for use of the DVB Scrambling Algorithm version 3 within digital broadcasting systems" Defined as DVB Document A125 and publicly available here: https://www.dvb.org/resources/public/standards/a125_dvb-csa3.pdf typedef struct ca_descr { unsigned int index; unsigned int parity;/* 0 == even, 1 == odd */ unsigned char cw[8]; } ca_descr_t; The 'index' is adress of the descrambler instance, as there exist limited number of them (retieved by CA_GET_DESCR_INFO). See below: 2) #define CA_SET_PID_IOW('o', 135, ca_pid_t) === The second ioctl was used to link particular PID with particular descrambler, what means that all such pids (you are allowed to create n-to-1 link), can be descrambled by one descrambler. This is needed in case of multiservice descrambling, when usually exist one key (control word) per one service (so all PIDs for one service have to be linked with one descrambler) Without this ioctl there is no way to address particular descrambler and so no way to use more then ONE descrambler per demux /Honza
[PATCH 1/1] docs-rst: media: Don't use \small for V4L2_PIX_FMT_SRGGB10 documentation
There appears to be an issue in using \small in certain cases on Sphinx 1.4 and 1.5. Other format documents don't use \small either, remove it from here as well. Signed-off-by: Sakari Ailus --- Hi Mauro, What would you think of this as an alternative approach? No hacks needed. Just a recognition \small could have issues. For what it's worth, I couldn't reproduce the issue on Sphinx 1.4.9. Regards, Sakari Documentation/media/uapi/v4l/pixfmt-srggb10p.rst | 11 --- 1 file changed, 11 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst index 86cd07e5bfa3..368ee61ab209 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst @@ -33,13 +33,6 @@ of a small V4L2_PIX_FMT_SBGGR10P image: **Byte Order.** Each cell is one byte. - -.. raw:: latex - -\small - -.. tabularcolumns:: |p{2.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{10.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -73,7 +66,3 @@ Each cell is one byte. - R\ :sub:`33high` - R\ :sub:`33low`\ (bits 7--6) G\ :sub:`32low`\ (bits 5--4) R\ :sub:`31low`\ (bits 3--2) G\ :sub:`30low`\ (bits 1--0) - -.. raw:: latex - -\normalsize -- 2.11.0
[PATCH v7 1/1] dt: bindings: smiapp: Document lens-focus and flash properties
Document optional lens-focus and flash properties for the smiapp driver. Signed-off-by: Sakari Ailus --- Hi all, This should precede the smiapp driver change. Documentation/devicetree/bindings/media/i2c/nokia,smia.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt index 855e1faf73e2..f02178eef84d 100644 --- a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt +++ b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt @@ -27,6 +27,8 @@ Optional properties - nokia,nvm-size: The size of the NVM, in bytes. If the size is not given, the NVM contents will not be read. - reset-gpios: XSHUTDOWN GPIO +- flash: One or more phandles to refer to flash LEDs +- lens-focus: Phandle for lens focus Endpoint node mandatory properties -- 2.11.0
[PATCH 0/7] [media] SAA71..: Adjustments for four function implementations
>From 2f421e83375df1aeef50ce053f1dbcd1366c2365 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sun, 3 Sep 2017 20:50:10 +0200 Subject: [PATCH 0/7] [media] SAA71..: Adjustments for four function implementations Three update suggestions were taken into account from static source code analysis. Markus Elfring (7): Delete an error message for a failed memory allocation in saa7164_buffer_alloc() SAA7164: Improve a size determination in two functions Gemini: Delete an error message for a failed memory allocation in hexium_attach() Gemini: Improve a size determination in hexium_attach() Orion: Delete an error message for a failed memory allocation in hexium_probe() Orion: Improve a size determination in hexium_probe() Orion: Adjust one function call together with a variable assignment drivers/media/pci/saa7146/hexium_gemini.c | 7 +++ drivers/media/pci/saa7146/hexium_orion.c | 10 +- drivers/media/pci/saa7164/saa7164-buffer.c | 8 +++- 3 files changed, 11 insertions(+), 14 deletions(-) -- 2.14.1
[PATCH 1/7] [media] saa7164: Delete an error message for a failed memory allocation in saa7164_buffer_alloc()
From: Markus Elfring Date: Sun, 3 Sep 2017 17:47:41 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/pci/saa7164/saa7164-buffer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/pci/saa7164/saa7164-buffer.c b/drivers/media/pci/saa7164/saa7164-buffer.c index a0d2129c6ca9..6bd665ea190d 100644 --- a/drivers/media/pci/saa7164/saa7164-buffer.c +++ b/drivers/media/pci/saa7164/saa7164-buffer.c @@ -102,7 +102,5 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port, - if (!buf) { - log_warn("%s() SAA_ERR_NO_RESOURCES\n", __func__); + if (!buf) goto ret; - } buf->idx = -1; buf->port = port; -- 2.14.1
Re: [PATCH v2 00/26] Improve DVB documentation and reduce its gap
> There is still a gap at the CA API, as there are three ioctls that are used > only by a few drivers and whose structs are not properly documented: > CA_GET_MSG, CA_SEND_MSG and CA_SET_DESCR. > > The first two ones seem to be related to a way that a few drivers > provide to send/receive messages. Yet, I was unable to get what > "index" and "type" means on those ioctls. The CA_SET_DESCR is > only supported by av7110 driver, and has an even weirder > undocumented struct. I was unable to discover at the Kernel, VDR > or Kaffeine how those structs are filled. I suspect that there's > something wrong there, but I won't risk trying to fix without > knowing more about them. So, let's just document that those > are needing documentation :-) > BTW, I just remembered dvblast app, part of videolan.org: http://www.videolan.org/projects/dvblast.html which is using CA_GET_MSG/CA_SEND_MSG: https://code.videolan.org/videolan/dvblast/blob/master/en50221.c /Honza
[PATCH 2/7] [media] saa7164: Improve a size determination in two functions
From: Markus Elfring Date: Sun, 3 Sep 2017 17:53:05 +0200 Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/pci/saa7164/saa7164-buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/saa7164/saa7164-buffer.c b/drivers/media/pci/saa7164/saa7164-buffer.c index 6bd665ea190d..c83b2e914dcb 100644 --- a/drivers/media/pci/saa7164/saa7164-buffer.c +++ b/drivers/media/pci/saa7164/saa7164-buffer.c @@ -98,5 +98,5 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port, goto ret; } - buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL); + buf = kzalloc(sizeof(*buf), GFP_KERNEL); if (!buf) @@ -281,5 +281,5 @@ struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev, { struct saa7164_user_buffer *buf; - buf = kzalloc(sizeof(struct saa7164_user_buffer), GFP_KERNEL); + buf = kzalloc(sizeof(*buf), GFP_KERNEL); if (!buf) -- 2.14.1
[PATCH 3/7] [media] Hexium Gemini: Delete an error message for a failed memory allocation in hexium_attach()
From: Markus Elfring Date: Sun, 3 Sep 2017 19:23:37 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/pci/saa7146/hexium_gemini.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c index c889ec9f8a5a..694b70fa3baf 100644 --- a/drivers/media/pci/saa7146/hexium_gemini.c +++ b/drivers/media/pci/saa7146/hexium_gemini.c @@ -264,7 +264,6 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d - if (NULL == hexium) { - pr_err("not enough kernel memory in hexium_attach()\n"); + if (!hexium) return -ENOMEM; - } + dev->ext_priv = hexium; /* enable i2c-port pins */ -- 2.14.1
[PATCH 4/7] [media] Hexium Gemini: Improve a size determination in hexium_attach()
From: Markus Elfring Date: Sun, 3 Sep 2017 19:51:46 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/pci/saa7146/hexium_gemini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c index 694b70fa3baf..a0fcf8150291 100644 --- a/drivers/media/pci/saa7146/hexium_gemini.c +++ b/drivers/media/pci/saa7146/hexium_gemini.c @@ -260,5 +260,5 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d DEB_EE("\n"); - hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); + hexium = kzalloc(sizeof(*hexium), GFP_KERNEL); if (!hexium) -- 2.14.1
[PATCH 5/7] [media] Hexium Orion: Delete an error message for a failed memory allocation in hexium_probe()
From: Markus Elfring Date: Sun, 3 Sep 2017 19:55:25 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/pci/saa7146/hexium_orion.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c index c306a92e8909..72fac6a8494a 100644 --- a/drivers/media/pci/saa7146/hexium_orion.c +++ b/drivers/media/pci/saa7146/hexium_orion.c @@ -223,7 +223,5 @@ static int hexium_probe(struct saa7146_dev *dev) - if (NULL == hexium) { - pr_err("hexium_probe: not enough kernel memory\n"); + if (!hexium) return -ENOMEM; - } /* enable i2c-port pins */ saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); -- 2.14.1
[PATCH 6/7] [media] Hexium Orion: Improve a size determination in hexium_probe()
From: Markus Elfring Date: Sun, 3 Sep 2017 20:00:17 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/pci/saa7146/hexium_orion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c index 72fac6a8494a..187e072a3697 100644 --- a/drivers/media/pci/saa7146/hexium_orion.c +++ b/drivers/media/pci/saa7146/hexium_orion.c @@ -219,5 +219,5 @@ static int hexium_probe(struct saa7146_dev *dev) return -EFAULT; } - hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); + hexium = kzalloc(sizeof(*hexium), GFP_KERNEL); if (!hexium) -- 2.14.1
[PATCH 7/7] [media] Hexium Orion: Adjust one function call together with a variable assignment
From: Markus Elfring Date: Sun, 3 Sep 2017 20:12:36 +0200 The script "checkpatch.pl" pointed information out like the following. ERROR: do not use assignment in if condition Thus fix the affected source code place. Signed-off-by: Markus Elfring --- drivers/media/pci/saa7146/hexium_orion.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c index 187e072a3697..691472763696 100644 --- a/drivers/media/pci/saa7146/hexium_orion.c +++ b/drivers/media/pci/saa7146/hexium_orion.c @@ -266,7 +266,9 @@ static int hexium_probe(struct saa7146_dev *dev) /* check if this is an old hexium Orion card by looking at a saa7110 at address 0x4e */ - if (0 == (err = i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_READ, 0x00, I2C_SMBUS_BYTE_DATA, &data))) { + err = i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_READ, +0x00, I2C_SMBUS_BYTE_DATA, &data); + if (err == 0) { pr_info("device is a Hexium HV-PCI6/Orion (old)\n"); /* we store the pointer in our private data field */ dev->ext_priv = hexium; -- 2.14.1
Re: [PATCH v2 00/26] Improve DVB documentation and reduce its gap
Em Sun, 3 Sep 2017 22:05:23 +0200 Honza Petrouš escreveu: > 1) #define CA_SET_DESCR _IOW('o', 134, ca_descr_t) > > > CA_SET_DESCR is used for feeding descrambler device > with correct keys (called here "control words") what > allows to get services unscrambled. > > The best docu is: > > "Digital Video Broadcasting (DVB); > Support for use of the DVB Scrambling Algorithm version 3 > within digital broadcasting systems" > > Defined as DVB Document A125 and publicly > available here: > > https://www.dvb.org/resources/public/standards/a125_dvb-csa3.pdf > > > typedef struct ca_descr { > unsigned int index; > unsigned int parity;/* 0 == even, 1 == odd */ > unsigned char cw[8]; > } ca_descr_t; > > The 'index' is adress of the descrambler instance, as there exist > limited number of them (retieved by CA_GET_DESCR_INFO). Thanks for the info. If I understood well, the enclosed patch should be documenting it. Thanks, Mauro [PATCH] media: ca docs: document CA_SET_DESCR ioctl and structs The av7110 driver uses CA_SET_DESCR to store the descrambler control words at the CA descrambler slots. Document it. Thanks-to: Honza Petrouš Signed-off-by: Mauro Carvalho Chehab diff --git a/Documentation/media/uapi/dvb/ca-set-descr.rst b/Documentation/media/uapi/dvb/ca-set-descr.rst index 9c484317d55c..a6c47205ffd8 100644 --- a/Documentation/media/uapi/dvb/ca-set-descr.rst +++ b/Documentation/media/uapi/dvb/ca-set-descr.rst @@ -28,22 +28,11 @@ Arguments ``msg`` Pointer to struct :c:type:`ca_descr`. -.. c:type:: ca_descr - -.. code-block:: c - -struct ca_descr { - unsigned int index; - unsigned int parity; - unsigned char cw[8]; -}; - - Description --- -.. note:: This ioctl is undocumented. Documentation is welcome. - +CA_SET_DESCR is used for feeding descrambler CA slots with descrambling +keys (refered as control words). Return Value diff --git a/include/uapi/linux/dvb/ca.h b/include/uapi/linux/dvb/ca.h index f66ed53f4dc7..a62ddf0cebcd 100644 --- a/include/uapi/linux/dvb/ca.h +++ b/include/uapi/linux/dvb/ca.h @@ -109,9 +109,16 @@ struct ca_msg { unsigned char msg[256]; }; +/** + * struct ca_descr - CA descrambler control words info + * + * @index: CA Descrambler slot + * @parity: control words parity, where 0 means even and 1 means odd + * @cw: CA Descrambler control words + */ struct ca_descr { unsigned int index; - unsigned int parity;/* 0 == even, 1 == odd */ + unsigned int parity; unsigned char cw[8]; };
Re: [PATCH 00/15] Improve DVB documentation and reduce its gap
Hi Mauro, On 01.09.2017 11:32, Mauro Carvalho Chehab wrote: > Em Fri, 1 Sep 2017 10:40:28 +0200 > Honza Petrouš escreveu: > >> 2017-09-01 1:46 GMT+02:00 Mauro Carvalho Chehab : >>> The DVB documentation was negligected for a long time, with >>> resulted on several gaps between the API description and its >>> documentation. >>> >>> I'm doing a new reading at the documentation. As result of it, >>> this series: >>> >>> - improves the introductory chapter, making it more generic; >>> - Do some adjustments at the frontend API, using kernel-doc >>> when possible. >>> - Remove unused APIs at DVB demux. I suspect that the drivers >>> implementing such APIs were either never merged upstream, >>> or the API itself were never used or was deprecated a long >>> time ago. In any case, it doesn't make any sense to carry >>> on APIs that aren't properly documented, nor are used on the >>> upstream Kernel. >>> >>> With this patch series, the gap between documentation and >>> code is solved for 3 DVB APIs: >>> >>> - Frontend API; >>> - Demux API; >>> - Net API. >>> >>> There is still a gap at the CA API that I'll try to address when I >>> have some time[1]. >>> >>> [1] There's a gap also on the legacy audio, video and OSD APIs, >>> but, as those are used only by a single very old deprecated >>> hardware (av7110), it is probably not worth the efforts. >>> av7110 cards may be old, but there are still users of these cards. For instance I'm watching TV received and decoded with such card in this moment. So what do you mean with "deprecated hardware"? >> I agree that av7110 is very very old piece of hw (but it is already >> in my hall of fame because of its Skystar 1 incarnation as >> first implementation of DVB in Linux) and it is sad that we still >> don't have at least one driver for any SoC with embedded DVB >> devices. > Yeah, av7110 made history. Please notice that this series doesn't > remove any API that it is used by it. All it removes are the APIs > that there's no Kernel driver using. > > Carry on APIs without client is usually a very bad idea, as nobody > could be certain about how to use it. It is even worse when such > APIs are not properly documented (with is the case here). > >> I understand that the main issue is that no any DVB-enabled >> SoC vendor is interested in upstreaming theirs code, but I still hope >> it will change in near future(*) > We have one driver for a SoC DVB hardware at: > drivers/media/platform/sti/c8sectpfe/ > > I guess it still doesn't cover the entire SoC, but this is a WiP. If I > remember well, at the midia part of the SoC, they started by submitting > the Remote Controller code. > >> Without having full-featured DVB device in vanilla, we surely don't >> get some parts of DVB API covered. I can imagine that when >> somebody comes with such full-featured device he wants to reinvent >> just removed bits. > Re-adding the removed bits is easy. However, the API defined for > av7110 is old and it is showing its age: it assumes a limited number > of possible inputs/outputs. Modern SoC has a lot more ways link the > audio/video IP blocks than what the API provides. On a modern SoC, > not only DVB is supported, but also analog inputs (to support things > like composite input), cameras, HDMI inputs and even analog TV. > All of them interconnected to a media ISP. The current FF API can't > represent such hardware. > > The best API to represent those pipelines that exist on SoC for > multimedia is the media controller, where all IP blocks and their > links (whatever they are) can be represented, if needed. > > The audio and video DVB API is also too limited: it hasn't > evolved since when it was added. For audio, the ALSA API > allows a way more control of the hardware; for video, the > V4L2 API nowadays has all the bits to control video decoding > and encoding. Both APIs provide support for audio and video > inputs commonly found on those devices. The real advantage of the DVB audio/video/osd API is the possibility of frame synchronous audio/video/overlay output for high-quality audio/video playback, maybe with picture-in-picture functionality. Especially audio synchronization is not easy when the audio format changes from compressed audio (e.g. AC-3) to PCM (stereo), e.g. on HDMI output. While HDMI output hardware usually takes video frames and audio packets (and AVI info frames for audio/video format signalization) synchronously, V4L2 and ALSA rip these data blocks apart and push these through different pipelines with different buffering properties. This makes it very difficult for userspace applications. With the DVB API the hardware takes care of the synchronisation. > Also, nowadays, video decoding usually happens at the GPU on SoC. So, > in practice, a SoC FF would likely use the DRM subsystem to control the > video codecs. I think this is a common misunderstanding. Video is decoded on separate hardware blocks nowadays, not on a (3D-)GPU. GPU vendors
Re: [PATCH v2 00/26] Improve DVB documentation and reduce its gap
Em Sun, 3 Sep 2017 22:05:23 +0200 Honza Petrouš escreveu: > > There is still a gap at the CA API, as there are three ioctls that are used > > only by a few drivers and whose structs are not properly documented: > > CA_GET_MSG, CA_SEND_MSG and CA_SET_DESCR. > > > > The first two ones seem to be related to a way that a few drivers > > provide to send/receive messages. > > I never seen usage of such R/W ioctls, all drivers I have access to > are using read()/write() variant of communication. Yeah, the normal usage is to use R/W syscalls. > BTW, I just remembered dvblast app, part of videolan.org: > > http://www.videolan.org/projects/dvblast.html > > which is using CA_GET_MSG/CA_SEND_MSG: > > https://code.videolan.org/videolan/dvblast/blob/master/en50221.c >From the ca_msg struct: /* a message to/from a CI-CAM */ struct ca_msg { unsigned int index; unsigned int type; unsigned int length; unsigned char msg[256]; }; It only uses length and msg fields. Describing those seem quite obvious. However, what "index" and "type" means? Within the Kernel, only two drivers implement it: $ git grep -l ca_msg drivers/ drivers/media/firewire/firedtv-ci.c drivers/media/pci/bt8xx/dst_ca.c At the dst_ca driver, checking for those fields don't give any useful result: $ grep index drivers/media/pci/bt8xx/dst_ca.c (nothing) $ grep type drivers/media/pci/bt8xx/dst_ca.c // Copy application_type, application_manufacturer and manufacturer_code p_ca_caps->slot_type = 1; p_ca_caps->descr_type = 1; p_ca_slot_info->type = CA_CI; p_ca_slot_info->type = CA_CI; (btw, using "1" for slot_type and descr_type there seems a very bad thing) The code at ca_get_message(), handle_dst_tag(), ca_set_pmt(), etc also doesn't seem to be using neither one of those fields. The same happens at firedtv-ci: it also doesn't seem to be using none of those fields. It should be noticed that, the dst_ca seems to allow more than one descrambler: p_ca_caps->descr_num = slot_cap[7]; Yet, the index is not used. So, it doesn't seem to be related to the descrambler index (or there's an implementation bug there - and at dvblast - as none uses it). What *I* suspect is that this were meant to be used for either CA index/type or DESCR index/type, but, when this got implemented, people discovered that this would be useless and never actually used those fields. Yet, I may be completely wrong and those were added to mean something else. If so, then we could just change the struct to: struct ca_msg { unsigned int reserved[2]; unsigned int length; unsigned char msg[256]; }; And document just length and msg. Thanks, Mauro
Re: [PATCH 1/1] docs-rst: media: Don't use \small for V4L2_PIX_FMT_SRGGB10 documentation
Em Sun, 3 Sep 2017 23:12:33 +0300 Sakari Ailus escreveu: > There appears to be an issue in using \small in certain cases on Sphinx > 1.4 and 1.5. Other format documents don't use \small either, remove it > from here as well. > > Signed-off-by: Sakari Ailus > --- > Hi Mauro, > > What would you think of this as an alternative approach? No hacks needed. > Just a recognition \small could have issues. For what it's worth, I > couldn't reproduce the issue on Sphinx 1.4.9. Btw, there are other places where \small runs smoothly. It is *just* on this table that it has issues. > > Regards, > Sakari > > Documentation/media/uapi/v4l/pixfmt-srggb10p.rst | 11 --- > 1 file changed, 11 deletions(-) > > diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst > b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst > index 86cd07e5bfa3..368ee61ab209 100644 > --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst > +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst > @@ -33,13 +33,6 @@ of a small V4L2_PIX_FMT_SBGGR10P image: > **Byte Order.** > Each cell is one byte. > > - > -.. raw:: latex > - > -\small Interesting... yeah, that could be possible. > - > -.. tabularcolumns:: |p{2.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{10.0cm}| Nah... Without tabularcolumns, LaTeX usually got sizes wrong and don't always place things at the right positions I'm actually considering adding it to all media tables, in order to be less dependent on LaTex automatic cells resizing - with doesn't seem to work too well. So, better to keep it, even if it works without \small. Btw, tried your patch here (without tabularcolumns) on Sphinx 1.6 (tomorrow, I'll do tests with other version). There, the last "(bits x-y)" ends by being wrapped to the next line. Yet, I guess the enclosed diff (or something like that) would be good enough (applied after my own patch, just to quickly test it). I'll play more with it tomorrow. Thanks, Mauro diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst index aa3dbf163b97..10350f3e4350 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst @@ -33,24 +33,7 @@ of a small V4L2_PIX_FMT_SBGGR10P image: **Byte Order.** Each cell is one byte. -.. raw:: latex - -\small - -.. HACK: - - On Sphinx 1.4 and 1.5, the usage of \small just before the table - causes it to continue at the same column where the above text ended. - - A possible solution would be to add a \newline on latex raw. - Unfortunately, that causes a breakage on Sphinx 1.6. - - So, we're placing the \small before this note, with should be producing - the same result on all versions - -. - -.. tabularcolumns:: |p{2.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{10.0cm}| +.. tabularcolumns:: |p{2.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{6.0cm}| .. flat-table:: :header-rows: 0 @@ -63,6 +46,7 @@ Each cell is one byte. - B\ :sub:`02high` - G\ :sub:`03high` - G\ :sub:`03low`\ (bits 7--6) B\ :sub:`02low`\ (bits 5--4) + G\ :sub:`01low`\ (bits 3--2) B\ :sub:`00low`\ (bits 1--0) * - start + 5: - G\ :sub:`10high` @@ -70,6 +54,7 @@ Each cell is one byte. - G\ :sub:`12high` - R\ :sub:`13high` - R\ :sub:`13low`\ (bits 7--6) G\ :sub:`12low`\ (bits 5--4) + R\ :sub:`11low`\ (bits 3--2) G\ :sub:`10low`\ (bits 1--0) * - start + 10: - B\ :sub:`20high` @@ -77,6 +62,7 @@ Each cell is one byte. - B\ :sub:`22high` - G\ :sub:`23high` - G\ :sub:`23low`\ (bits 7--6) B\ :sub:`22low`\ (bits 5--4) + G\ :sub:`21low`\ (bits 3--2) B\ :sub:`20low`\ (bits 1--0) * - start + 15: - G\ :sub:`30high` @@ -84,8 +70,5 @@ Each cell is one byte. - G\ :sub:`32high` - R\ :sub:`33high` - R\ :sub:`33low`\ (bits 7--6) G\ :sub:`32low`\ (bits 5--4) - R\ :sub:`31low`\ (bits 3--2) G\ :sub:`30low`\ (bits 1--0) - -.. raw:: latex -\normalsize + R\ :sub:`31low`\ (bits 3--2) G\ :sub:`30low`\ (bits 1--0)
cron job: media_tree daily build: WARNINGS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Mon Sep 4 05:00:15 CEST 2017 media-tree git hash:fce4b371fe5c99a9c05db8493d72f0d1a474ab26 media_build git hash: 767234f97b7e967bd0ce362957de82764937951c v4l-utils git hash: 3296adfa7fa169111bf37c041c0ca70ac8506054 gcc version:i686-linux-gcc (GCC) 7.1.0 sparse version: v0.5.0 smatch version: v0.5.0-3553-g78b2ea6 host hardware: x86_64 host os:4.12.0-164 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-multi: OK linux-git-arm-pxa: OK linux-git-arm-stm32: OK linux-git-blackfin-bf561: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.36.4-i686: WARNINGS linux-2.6.37.6-i686: WARNINGS linux-2.6.38.8-i686: WARNINGS linux-2.6.39.4-i686: WARNINGS linux-3.0.60-i686: WARNINGS linux-3.1.10-i686: WARNINGS linux-3.2.37-i686: WARNINGS linux-3.3.8-i686: WARNINGS linux-3.4.27-i686: WARNINGS linux-3.5.7-i686: WARNINGS linux-3.6.11-i686: WARNINGS linux-3.7.4-i686: WARNINGS linux-3.8-i686: WARNINGS linux-3.9.2-i686: WARNINGS linux-3.10.1-i686: WARNINGS linux-3.11.1-i686: WARNINGS linux-3.12.67-i686: WARNINGS linux-3.13.11-i686: WARNINGS linux-3.14.9-i686: WARNINGS linux-3.15.2-i686: WARNINGS linux-3.16.7-i686: WARNINGS linux-3.17.8-i686: WARNINGS linux-3.18.7-i686: WARNINGS linux-3.19-i686: WARNINGS linux-4.0.9-i686: WARNINGS linux-4.1.33-i686: WARNINGS linux-4.2.8-i686: WARNINGS linux-4.3.6-i686: WARNINGS linux-4.4.22-i686: WARNINGS linux-4.5.7-i686: WARNINGS linux-4.6.7-i686: WARNINGS linux-4.7.5-i686: WARNINGS linux-4.8-i686: OK linux-4.9.26-i686: OK linux-4.10.14-i686: OK linux-4.11-i686: OK linux-4.12.1-i686: OK linux-2.6.36.4-x86_64: WARNINGS linux-2.6.37.6-x86_64: WARNINGS linux-2.6.38.8-x86_64: WARNINGS linux-2.6.39.4-x86_64: WARNINGS linux-3.0.60-x86_64: WARNINGS linux-3.1.10-x86_64: WARNINGS linux-3.2.37-x86_64: WARNINGS linux-3.3.8-x86_64: WARNINGS linux-3.4.27-x86_64: WARNINGS linux-3.5.7-x86_64: WARNINGS linux-3.6.11-x86_64: WARNINGS linux-3.7.4-x86_64: WARNINGS linux-3.8-x86_64: WARNINGS linux-3.9.2-x86_64: WARNINGS linux-3.10.1-x86_64: WARNINGS linux-3.11.1-x86_64: WARNINGS linux-3.12.67-x86_64: WARNINGS linux-3.13.11-x86_64: WARNINGS linux-3.14.9-x86_64: WARNINGS linux-3.15.2-x86_64: WARNINGS linux-3.16.7-x86_64: WARNINGS linux-3.17.8-x86_64: WARNINGS linux-3.18.7-x86_64: WARNINGS linux-3.19-x86_64: WARNINGS linux-4.0.9-x86_64: WARNINGS linux-4.1.33-x86_64: WARNINGS linux-4.2.8-x86_64: WARNINGS linux-4.3.6-x86_64: WARNINGS linux-4.4.22-x86_64: WARNINGS linux-4.5.7-x86_64: WARNINGS linux-4.6.7-x86_64: WARNINGS linux-4.7.5-x86_64: WARNINGS linux-4.8-x86_64: WARNINGS linux-4.9.26-x86_64: WARNINGS linux-4.10.14-x86_64: WARNINGS linux-4.11-x86_64: WARNINGS linux-4.12.1-x86_64: WARNINGS apps: WARNINGS spec-git: OK Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/index.html