cron job: media_tree daily build: ERRORS

2017-09-01 Thread Hans Verkuil
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:   Sat Sep  2 05:00:17 CEST 2017
media-tree git hash:fce4b371fe5c99a9c05db8493d72f0d1a474ab26
media_build git hash:   c7f37c31f76a1a4928046aa2e6cca40a49480912
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: ERRORS
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: ERRORS
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/Saturday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html


Re: [PATCH v6 5/5] v4l: fwnode: Support generic parsing of graph endpoints in a single port

2017-09-01 Thread Sakari Ailus
Hi Hans,

Thanks for the review.

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  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 
> > + *  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) 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.

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi


[PATCH v1] media: ov5670: Fix not streaming issue after resume.

2017-09-01 Thread Chiranjeevi Rapolu
Previously, the sensor was not streaming after resume from suspend,
i.e. on S0->S3->S0 transition. Due to this, camera app preview appeared
as stuck.

Now, handle streaming state correctly in case of suspend-resume.

Signed-off-by: Chiranjeevi Rapolu 
---
 drivers/media/i2c/ov5670.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
index 6f7a1d6..bdfb5b9 100644
--- a/drivers/media/i2c/ov5670.c
+++ b/drivers/media/i2c/ov5670.c
@@ -2323,8 +2323,6 @@ static int ov5670_start_streaming(struct ov5670 *ov5670)
return ret;
}
 
-   ov5670->streaming = true;
-
return 0;
 }
 
@@ -2338,8 +2336,6 @@ static int ov5670_stop_streaming(struct ov5670 *ov5670)
if (ret)
dev_err(>dev, "%s failed to set stream\n", __func__);
 
-   ov5670->streaming = false;
-
/* Return success even if it was an error, as there is nothing the
 * caller can do about it.
 */
@@ -2370,6 +2366,7 @@ static int ov5670_set_stream(struct v4l2_subdev *sd, int 
enable)
ret = ov5670_stop_streaming(ov5670);
pm_runtime_put(>dev);
}
+   ov5670->streaming = enable;
goto unlock_and_return;
 
 error:
-- 
1.9.1



Re: [PATCH v6.1 4/5] v4l: fwnode: Support generic parsing of graph endpoints in a device

2017-09-01 Thread Sakari Ailus
Hi Hans,

Thanks for the review!

On Fri, Sep 01, 2017 at 01:18:55PM +0200, Hans Verkuil wrote:
> Hi Sakari,
> 
> On 30/08/17 14:45, Sakari Ailus wrote:
> > 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.
> > 
> > Convert the omap3isp as an example.
> 
> It would be much easier to review if the omap3isp conversion was done in a
> separate patch. Ditto for the rcar conversion, and I prefer to have both
> at the end of the patch series, after the core code patches.

Ack, I'll split them for v7.

> 
> > 
> > Signed-off-by: Sakari Ailus 
> > ---
> > since v6:
> > 
> > - Set notifier->subdevs NULL and notifier->num_subdevs 0 in
> >   v4l2_async_notifier_release().
> > 
> >  drivers/media/platform/omap3isp/isp.c | 115 ++---
> >  drivers/media/platform/omap3isp/isp.h |   5 +-
> >  drivers/media/v4l2-core/v4l2-async.c  |  16 +
> >  drivers/media/v4l2-core/v4l2-fwnode.c | 131 
> > ++
> >  include/media/v4l2-async.h|  24 ++-
> >  include/media/v4l2-fwnode.h   |  48 +
> >  6 files changed, 254 insertions(+), 85 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(>crashed);
> > +   v4l2_async_notifier_release(>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 = >bus;
> > -   struct v4l2_fwnode_endpoint vep;
> > -   unsigned int i;
> > -   int ret;
> > bool csi1 = false;
> > -
> > -   ret = v4l2_fwnode_endpoint_parse(fwnode, );
> > -   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",
> > -   

[PATCH v4 1/2] media:imx274 device tree binding file

2017-09-01 Thread Leon Luo
The binding file for imx274 CMOS sensor V4l2 driver

Signed-off-by: Leon Luo 
---
v4:
 - no changes
v3:
 - remove redundant properties and references
 - document 'reg' property
v2:
 - no changes
---
 .../devicetree/bindings/media/i2c/imx274.txt   | 32 ++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/imx274.txt

diff --git a/Documentation/devicetree/bindings/media/i2c/imx274.txt 
b/Documentation/devicetree/bindings/media/i2c/imx274.txt
new file mode 100644
index ..1f03256b35db
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/imx274.txt
@@ -0,0 +1,32 @@
+* Sony 1/2.5-Inch 8.51Mp CMOS Digital Image Sensor
+
+The Sony imx274 is a 1/2.5-inch CMOS active pixel digital image sensor with
+an active array size of 3864H x 2202V. It is programmable through I2C
+interface. The I2C address is fixed to 0x1a as per sensor data sheet.
+Image data is sent through MIPI CSI-2, which is configured as 4 lanes
+at 1440 Mbps.
+
+
+Required Properties:
+- compatible: value should be "sony,imx274" for imx274 sensor
+- reg: I2C bus address of the device
+
+Optional Properties:
+- reset-gpios: Sensor reset GPIO
+
+For further reading on port node refer to
+Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+   sensor@1a {
+   compatible = "sony,imx274";
+   reg = <0x1a>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reset-gpios = <_sensor 0 0>;
+   port {
+   sensor_out: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
-- 
2.14.1.145.gb3622a4



[PATCH v4 2/2] media:imx274 V4l2 driver for Sony imx274 CMOS sensor

2017-09-01 Thread Leon Luo
The imx274 is a Sony CMOS image sensor that has 1/2.5 image size.
It supports up to 3840x2160 (4K) 60fps, 1080p 120fps. The interface
is 4-lane MIPI CSI-2 running at 1.44Gbps each.

This driver has been tested on Xilinx ZCU102 platform with a Leopard
LI-IMX274MIPI-FMC camera board.

Support for the following features:
-Resolutions: 3840x2160, 1920x1080, 1280x720
-Frame rate: 3840x2160 : 5 – 60fps
1920x1080 : 5 – 120fps
1280x720 : 5 – 120fps
-Exposure time: 16 – (frame interval) micro-seconds
-Gain: 1x - 180x
-VFLIP: enable/disabledrivers/media/i2c/imx274.c
-Test pattern: 12 test patterns

Signed-off-by: Leon Luo 
Tested-by: Sören Brinkmann 
---
v4:
 - use 32-bit data type to avoid __divdi3 compile error for i386
 - clean up OR together error codes
v3:
 - clean up header files
 - use struct directly instead of alias #define
 - use v4l2_ctrl_s_ctrl instead of v4l2_s_ctrl
 - revise debug output
 - move static helpers closer to their call site
 - don't OR toegether error codes
 - use closest valid gain value instead of erroring out
 - assigne lock to the control handler and omit explicit locking
 - acquire mutex lock for imx274_get_fmt
 - remove format->pad check in imx274_set_fmt since the pad is always 0
 - pass struct v4l2_ctrl pointer in gain/exposure/vlip/test pattern controls
 - remove priv->ctrls.vflip->val = val in imx274_set_vflip()
 - remove priv->ctrls.test_pattern->val = val in imx274_set_test_pattern()
 - remove empty open/close callbacks
 - remove empty core ops
 - add more error labels in probe
 - use v4l2_async_unregister_subdev instead of v4l2_device_unregister_subdev
 - use dynamic debug
 - split start_stream to two steps: imx274_mode_regs() and imx274_start_stream()
   frame rate & exposure can be updated
   between imx274_mode_regs() & imx274_start_stream()

v2:
 - Fix Kconfig to not remove existing options
---
 drivers/media/i2c/Kconfig  |7 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/imx274.c | 1808 
 3 files changed, 1816 insertions(+)
 create mode 100644 drivers/media/i2c/imx274.c

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 94153895fcd4..ad2e70a02363 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -547,6 +547,13 @@ config VIDEO_APTINA_PLL
 config VIDEO_SMIAPP_PLL
tristate
 
+config VIDEO_IMX274
+   tristate "Sony IMX274 sensor support"
+   depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+   ---help---
+ This is a V4L2 sensor-level driver for the Sony IMX274
+ CMOS image sensor.
+
 config VIDEO_OV2640
tristate "OmniVision OV2640 sensor support"
depends on VIDEO_V4L2 && I2C
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index c843c181dfb9..f8d57e453936 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -92,5 +92,6 @@ obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
 obj-$(CONFIG_VIDEO_ML86V7667)  += ml86v7667.o
 obj-$(CONFIG_VIDEO_OV2659) += ov2659.o
 obj-$(CONFIG_VIDEO_TC358743)   += tc358743.o
+obj-$(CONFIG_VIDEO_IMX274) += imx274.o
 
 obj-$(CONFIG_SDR_MAX2175) += max2175.o
diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
new file mode 100644
index ..66cbfa81c030
--- /dev/null
+++ b/drivers/media/i2c/imx274.c
@@ -0,0 +1,1808 @@
+/*
+ * imx274.c - IMX274 CMOS Image Sensor driver
+ *
+ * Copyright (C) 2017, Leopard Imaging, Inc.
+ *
+ * Leon Luo 
+ * Edwin Zou 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * See "SHR, SVR Setting" in datasheet
+ */
+#define IMX274_DEFAULT_FRAME_LENGTH(4550)
+#define IMX274_MAX_FRAME_LENGTH(0x000f)
+
+/*
+ * See "Frame Rate Adjustment" in datasheet
+ */
+#define IMX274_PIXCLK_CONST1   (7200)
+#define IMX274_PIXCLK_CONST2   (100)
+
+/*
+ * The input gain is shifted by IMX274_GAIN_SHIFT to get
+ * decimal number. The real gain is
+ * (float)input_gain_value / (1 << IMX274_GAIN_SHIFT)
+ */
+#define IMX274_GAIN_SHIFT  (8)
+#define 

[PATCH] media: net.h: add kernel-doc and use it at Documentation/

2017-09-01 Thread Mauro Carvalho Chehab
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 
---
 Documentation/media/uapi/dvb/net-add-if.rst | 34 -
 Documentation/media/uapi/dvb/net.rst|  1 +
 include/uapi/linux/dvb/net.h| 15 +
 3 files changed, 16 insertions(+), 34 deletions(-)

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.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..90dd207f63ad 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
+ * @ifnum: 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 4/4] [media] sp2: Adjust three null pointer checks in sp2_exit()

2017-09-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Sep 2017 21:16:06 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring 
---
 drivers/media/dvb-frontends/sp2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/sp2.c 
b/drivers/media/dvb-frontends/sp2.c
index b2a7a54174ae..9bd71ba36d86 100644
--- a/drivers/media/dvb-frontends/sp2.c
+++ b/drivers/media/dvb-frontends/sp2.c
@@ -357,14 +357,14 @@ static int sp2_exit(struct i2c_client *client)
 
dev_dbg(>dev, "\n");
 
-   if (client == NULL)
+   if (!client)
return 0;
 
s = i2c_get_clientdata(client);
-   if (s == NULL)
+   if (!s)
return 0;
 
-   if (s->ca.data == NULL)
+   if (!s->ca.data)
return 0;
 
dvb_ca_en50221_release(>ca);
-- 
2.14.1



[PATCH 3/4] [media] sp2: Adjust a jump target in sp2_probe()

2017-09-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Sep 2017 21:08:38 +0200

* Adjust a jump target so that a null pointer will not be passed to a call
  of the function "kfree".

* Move this function call into an if branch.

Signed-off-by: Markus Elfring 
---
 drivers/media/dvb-frontends/sp2.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/media/dvb-frontends/sp2.c 
b/drivers/media/dvb-frontends/sp2.c
index dd556012ceb6..b2a7a54174ae 100644
--- a/drivers/media/dvb-frontends/sp2.c
+++ b/drivers/media/dvb-frontends/sp2.c
@@ -384,7 +384,7 @@ static int sp2_probe(struct i2c_client *client,
s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s) {
ret = -ENOMEM;
-   goto err;
+   goto report_failure;
}
 
s->client = client;
@@ -395,15 +395,16 @@ static int sp2_probe(struct i2c_client *client,
i2c_set_clientdata(client, s);
 
ret = sp2_init(s);
-   if (ret)
-   goto err;
+   if (ret) {
+   kfree(s);
+   goto report_failure;
+   }
 
dev_info(>client->dev, "CIMaX SP2 successfully attached\n");
return 0;
-err:
-   dev_dbg(>dev, "init failed=%d\n", ret);
-   kfree(s);
 
+report_failure:
+   dev_dbg(>dev, "init failed=%d\n", ret);
return ret;
 }
 
-- 
2.14.1



[PATCH 2/4] [media] sp2: Improve a size determination in sp2_probe()

2017-09-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Sep 2017 20:46:18 +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/dvb-frontends/sp2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/sp2.c 
b/drivers/media/dvb-frontends/sp2.c
index d3b4f8822096..dd556012ceb6 100644
--- a/drivers/media/dvb-frontends/sp2.c
+++ b/drivers/media/dvb-frontends/sp2.c
@@ -381,6 +381,6 @@ static int sp2_probe(struct i2c_client *client,
 
dev_dbg(>dev, "\n");
 
-   s = kzalloc(sizeof(struct sp2), GFP_KERNEL);
+   s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s) {
ret = -ENOMEM;
-- 
2.14.1



[PATCH] [media] dvb-frontends/mxl5xx: declare LIST_HEAD(mxllist) static

2017-09-01 Thread Daniel Scheller
From: Daniel Scheller 

Fixes one sparse warning:
  mxl5xx.c:46:1: warning: symbol 'mxllist' was not declared. Should it be 
static?

Signed-off-by: Daniel Scheller 
---
 drivers/media/dvb-frontends/mxl5xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/mxl5xx.c 
b/drivers/media/dvb-frontends/mxl5xx.c
index 676c96c216c3..53064e11f5f1 100644
--- a/drivers/media/dvb-frontends/mxl5xx.c
+++ b/drivers/media/dvb-frontends/mxl5xx.c
@@ -43,7 +43,7 @@
 #define BYTE2(v) ((v >> 16) & 0xff)
 #define BYTE3(v) ((v >> 24) & 0xff)
 
-LIST_HEAD(mxllist);
+static LIST_HEAD(mxllist);
 
 struct mxl_base {
struct list_head mxllist;
-- 
2.13.5



[PATCH 09/14] media: dvbapi.rst: add an entry to DVB revision history

2017-09-01 Thread Mauro Carvalho Chehab
There are several missing items at the API history. Yet,
as we're doing a significant change there, add a new entry.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/dvbapi.rst | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/media/uapi/dvb/dvbapi.rst 
b/Documentation/media/uapi/dvb/dvbapi.rst
index 268bf69db281..7d26e98e5a41 100644
--- a/Documentation/media/uapi/dvb/dvbapi.rst
+++ b/Documentation/media/uapi/dvb/dvbapi.rst
@@ -66,12 +66,17 @@ Authors:
 
 **Copyright** |copy| 2002-2003 : Convergence GmbH
 
-**Copyright** |copy| 2009-2016 : Mauro Carvalho Chehab
+**Copyright** |copy| 2009-2017 : Mauro Carvalho Chehab
 
 
 Revision History
 
 
+:revision: 2.2.0 / 2017-09-01 (*mcc*)
+
+Most gaps between the uAPI document and the Kernel implementation
+got fixed for the non-legacy API.
+
 :revision: 2.1.0 / 2015-05-29 (*mcc*)
 
 DocBook improvements and cleanups, in order to document the system calls
-- 
2.13.5



[PATCH 1/4] [media] sp2: Delete an error message for a failed memory allocation in sp2_probe()

2017-09-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Sep 2017 20:44:05 +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/dvb-frontends/sp2.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/sp2.c 
b/drivers/media/dvb-frontends/sp2.c
index 43d47dfcc7b8..d3b4f8822096 100644
--- a/drivers/media/dvb-frontends/sp2.c
+++ b/drivers/media/dvb-frontends/sp2.c
@@ -385,6 +385,5 @@ static int sp2_probe(struct i2c_client *client,
if (!s) {
ret = -ENOMEM;
-   dev_err(>dev, "kzalloc() failed\n");
goto err;
}
 
-- 
2.14.1



[PATCH 00/14] Another set of DVB documentation patches

2017-09-01 Thread Mauro Carvalho Chehab
This series should come after this series: 
[PATCH v2 00/26] Improve DVB documentation and reduce its gap
(with actually has 27 patches :-p )

It adds documentation for a dmx.h ioctl (DMX_GET_PES_PIDS) and do
a cleanup at the documentation, to make it more coherent with the other
media uAPI docs. In particular, it fixes the error codes for ioctls, removing
redundant and non-existing error codes.

It also fixes some random other problems I found while re-reading the
documentation.

Mauro Carvalho Chehab (14):
  media: dvb uapi docs: better organize header files
  media: gen-errors.rst: remove row number comments
  media: gen-errors.rst: document ENXIO error code
  media: dvb uAPI docs: adjust return value ioctl descriptions
  media: ca-fopen.rst: Fixes the device node name for CA
  media: dvb uAPI docs: Prefer use "Digital TV instead of "DVB"
  media: dmx-fread.rst: specify how DMX_CHECK_CRC works
  media: dvb-frontend-parameters.rst: fix the name of a struct
  media: dvbapi.rst: add an entry to DVB revision history
  media: dvb uAPI docs: minor editorial changes
  media: dmx-get-pes-pids.rst: document the ioctl
  media: dvbstb.svg: use dots for the optional parts of the hardware
  media: intro.rst: don't assume audio and video codecs to be MPEG2
  media: frontend.h: Avoid the term DVB when doesn't refer to a delivery
system

 .../media/uapi/dvb/audio-channel-select.rst|  2 +-
 Documentation/media/uapi/dvb/audio-fclose.rst  |  8 +--
 Documentation/media/uapi/dvb/audio-fopen.rst   |  8 +--
 Documentation/media/uapi/dvb/audio-fwrite.rst  |  8 +--
 Documentation/media/uapi/dvb/audio-set-av-sync.rst |  2 +-
 .../media/uapi/dvb/audio-set-bypass-mode.rst   |  6 +-
 Documentation/media/uapi/dvb/audio-set-mute.rst|  2 +-
 Documentation/media/uapi/dvb/audio.rst | 13 ++--
 Documentation/media/uapi/dvb/audio_h.rst   |  9 ---
 Documentation/media/uapi/dvb/ca-fclose.rst | 21 +++---
 Documentation/media/uapi/dvb/ca-fopen.rst  | 71 +++-
 Documentation/media/uapi/dvb/ca-get-cap.rst|  4 +-
 Documentation/media/uapi/dvb/ca-get-msg.rst|  9 ++-
 Documentation/media/uapi/dvb/ca-get-slot-info.rst  | 10 ++-
 Documentation/media/uapi/dvb/ca-reset.rst  |  8 ++-
 Documentation/media/uapi/dvb/ca-send-msg.rst   |  8 ++-
 Documentation/media/uapi/dvb/ca-set-descr.rst  |  8 ++-
 Documentation/media/uapi/dvb/ca.rst| 11 +--
 Documentation/media/uapi/dvb/ca_h.rst  |  9 ---
 Documentation/media/uapi/dvb/demux.rst | 13 ++--
 Documentation/media/uapi/dvb/dmx-add-pid.rst   | 12 ++--
 Documentation/media/uapi/dvb/dmx-fclose.rst| 26 
 Documentation/media/uapi/dvb/dmx-fopen.rst | 66 --
 Documentation/media/uapi/dvb/dmx-fread.rst | 78 +-
 Documentation/media/uapi/dvb/dmx-fwrite.rst| 41 ++--
 Documentation/media/uapi/dvb/dmx-get-pes-pids.rst  | 30 +++--
 Documentation/media/uapi/dvb/dmx-get-stc.rst   | 28 +---
 Documentation/media/uapi/dvb/dmx-remove-pid.rst| 12 ++--
 .../media/uapi/dvb/dmx-set-buffer-size.rst | 11 ++-
 Documentation/media/uapi/dvb/dmx-set-filter.rst| 13 ++--
 .../media/uapi/dvb/dmx-set-pes-filter.rst  | 12 +++-
 Documentation/media/uapi/dvb/dmx-start.rst | 15 +++--
 Documentation/media/uapi/dvb/dmx-stop.rst  | 12 ++--
 Documentation/media/uapi/dvb/dmx_h.rst |  9 ---
 .../media/uapi/dvb/dvb-fe-read-status.rst  |  2 +-
 .../media/uapi/dvb/dvb-frontend-parameters.rst |  2 +-
 Documentation/media/uapi/dvb/dvbapi.rst| 39 +++
 Documentation/media/uapi/dvb/dvbproperty.rst   |  4 +-
 Documentation/media/uapi/dvb/dvbstb.svg| 31 +
 Documentation/media/uapi/dvb/examples.rst  |  4 +-
 .../media/uapi/dvb/fe-diseqc-recv-slave-reply.rst  |  8 ++-
 .../media/uapi/dvb/fe-diseqc-reset-overload.rst| 10 ++-
 .../media/uapi/dvb/fe-diseqc-send-burst.rst|  8 ++-
 .../media/uapi/dvb/fe-diseqc-send-master-cmd.rst   | 11 ++-
 .../uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst|  8 ++-
 .../media/uapi/dvb/fe-enable-high-lnb-voltage.rst  |  8 ++-
 Documentation/media/uapi/dvb/fe-get-event.rst  |  9 ++-
 Documentation/media/uapi/dvb/fe-get-frontend.rst   | 10 +--
 Documentation/media/uapi/dvb/fe-get-info.rst   | 15 +++--
 Documentation/media/uapi/dvb/fe-get-property.rst   | 10 ++-
 Documentation/media/uapi/dvb/fe-read-ber.rst   |  8 ++-
 .../media/uapi/dvb/fe-read-signal-strength.rst |  8 ++-
 Documentation/media/uapi/dvb/fe-read-snr.rst   |  8 ++-
 Documentation/media/uapi/dvb/fe-read-status.rst| 10 ++-
 .../media/uapi/dvb/fe-read-uncorrected-blocks.rst  |  8 ++-
 .../media/uapi/dvb/fe-set-frontend-tune-mode.rst   | 12 ++--
 Documentation/media/uapi/dvb/fe-set-frontend.rst   | 15 +++--
 Documentation/media/uapi/dvb/fe-set-tone.rst   |  8 

[PATCH 0/4] [media] SP2: Adjustments for two function implementations

2017-09-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Sep 2017 21:31:23 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (4):
  Delete an error message for a failed memory allocation
  Improve a size determination
  Adjust a jump target
  Adjust three null pointer checks

 drivers/media/dvb-frontends/sp2.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

-- 
2.14.1



[PATCH 11/14] media: dmx-get-pes-pids.rst: document the ioctl

2017-09-01 Thread Mauro Carvalho Chehab
This ioctl is supported by the DVB core, but was never
documented.

Add a documentation for it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/dmx-get-pes-pids.rst | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst 
b/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst
index 20288c11d279..fbdbc12869d1 100644
--- a/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst
+++ b/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst
@@ -25,13 +25,31 @@ Arguments
 File descriptor returned by :c:func:`open() `.
 
 ``pids``
-Undocumented.
+Array used to store 5 Program IDs.
 
 
 Description
 ---
 
-.. note:: This ioctl is undocumented. Documentation is welcome.
+This ioctl allows to query a DVB device to return the first PID used
+by audio, video, textext, subtitle and PCR programs on a given service.
+They're stored as:
+
+===
===
+PID  element   positioncontent
+===
===
+pids[DMX_PES_AUDIO]0   first audio PID
+pids[DMX_PES_VIDEO]1   first video PID
+pids[DMX_PES_TELETEXT] 2   first teletext PID
+pids[DMX_PES_SUBTITLE] 3   first subtitle PID
+pids[DMX_PES_PCR]  4   first Program Clock Reference PID
+===
===
+
+
+.. note::
+
+   A value equal to 0x means that the PID was not filled by the
+   Kernel.
 
 
 Return Value
-- 
2.13.5



[PATCH 05/14] media: ca-fopen.rst: Fixes the device node name for CA

2017-09-01 Thread Mauro Carvalho Chehab
The device node name for CA is wrong since ever. I suspect
that the name there was before DVBv3 (with was the first API
introduced at the Kernel).

Anyway, use the right name there.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca-fopen.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/dvb/ca-fopen.rst 
b/Documentation/media/uapi/dvb/ca-fopen.rst
index c974a212b618..51ac27dfec75 100644
--- a/Documentation/media/uapi/dvb/ca-fopen.rst
+++ b/Documentation/media/uapi/dvb/ca-fopen.rst
@@ -49,8 +49,8 @@ Arguments
 Description
 ---
 
-This system call opens a named ca device (e.g. /dev/ost/ca) for
-subsequent use.
+This system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``)
+for subsequent use.
 
 When an open() call has succeeded, the device will be ready for use. The
 significance of blocking or non-blocking mode is described in the
-- 
2.13.5



[PATCH 13/14] media: intro.rst: don't assume audio and video codecs to be MPEG2

2017-09-01 Thread Mauro Carvalho Chehab
Originally, when DVB was introduced, all codecs would be part of
MPEG2 standard. That's not true anymore, as there are a large
number of codec standards used on digital TV nowadays.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/intro.rst | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Documentation/media/uapi/dvb/intro.rst 
b/Documentation/media/uapi/dvb/intro.rst
index fbae687414ce..79b4d0e4e920 100644
--- a/Documentation/media/uapi/dvb/intro.rst
+++ b/Documentation/media/uapi/dvb/intro.rst
@@ -94,11 +94,10 @@ Demultiplexer which filters the incoming Digital TV MPEG-TS 
stream
streams it also contains data streams with information about the
programs offered in this or other streams of the same provider.
 
-MPEG2 audio and video decoder
-   The main targets of the demultiplexer are the MPEG2 audio and video
-   decoders. After decoding they pass on the uncompressed audio and
-   video to the computer screen or (through a PAL/NTSC encoder) to a TV
-   set.
+Audio and video decoder
+   The main targets of the demultiplexer are audio and video
+   decoders. After decoding, they pass on the uncompressed audio and
+   video to the computer screen or to a TV set.
 
.. note::
 
-- 
2.13.5



[PATCH 06/14] media: dvb uAPI docs: Prefer use "Digital TV instead of "DVB"

2017-09-01 Thread Mauro Carvalho Chehab
The usage of the term "DVB" at the dvb API docs is confusing,
as, right now, it can refer to either the European digital TV
standard or to the subsystem.

So, prefer calling it as "Digital TV" on most places, to avoid
ambiguity.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../media/uapi/dvb/audio-channel-select.rst|  2 +-
 Documentation/media/uapi/dvb/audio-fclose.rst  |  8 +++
 Documentation/media/uapi/dvb/audio-fopen.rst   |  8 +++
 Documentation/media/uapi/dvb/audio-fwrite.rst  |  8 +++
 Documentation/media/uapi/dvb/audio-set-av-sync.rst |  2 +-
 .../media/uapi/dvb/audio-set-bypass-mode.rst   |  6 +++---
 Documentation/media/uapi/dvb/audio-set-mute.rst|  2 +-
 Documentation/media/uapi/dvb/audio.rst | 13 +--
 Documentation/media/uapi/dvb/ca-fclose.rst |  8 +++
 Documentation/media/uapi/dvb/ca-fopen.rst  | 10 -
 Documentation/media/uapi/dvb/ca.rst| 11 +-
 Documentation/media/uapi/dvb/demux.rst | 13 +++
 Documentation/media/uapi/dvb/dmx-fclose.rst|  8 +++
 Documentation/media/uapi/dvb/dmx-fopen.rst | 10 -
 Documentation/media/uapi/dvb/dmx-fread.rst |  8 +++
 Documentation/media/uapi/dvb/dmx-fwrite.rst|  8 +++
 Documentation/media/uapi/dvb/dvbapi.rst| 25 --
 Documentation/media/uapi/dvb/dvbproperty.rst   |  4 ++--
 Documentation/media/uapi/dvb/examples.rst  |  4 ++--
 .../media/uapi/dvb/fe-diseqc-reset-overload.rst|  2 +-
 Documentation/media/uapi/dvb/fe-get-info.rst   |  5 +++--
 Documentation/media/uapi/dvb/fe-get-property.rst   |  2 +-
 Documentation/media/uapi/dvb/fe-read-status.rst|  2 +-
 .../media/uapi/dvb/fe_property_parameters.rst  |  4 ++--
 .../dvb/frontend-property-terrestrial-systems.rst  |  2 +-
 Documentation/media/uapi/dvb/frontend.rst  | 10 -
 Documentation/media/uapi/dvb/frontend_f_close.rst  |  6 +++---
 Documentation/media/uapi/dvb/frontend_f_open.rst   |  6 +++---
 .../media/uapi/dvb/frontend_legacy_dvbv3_api.rst   |  6 +++---
 Documentation/media/uapi/dvb/intro.rst | 18 
 Documentation/media/uapi/dvb/legacy_dvb_apis.rst   |  6 +++---
 Documentation/media/uapi/dvb/net-add-if.rst|  2 +-
 Documentation/media/uapi/dvb/net.rst   | 13 +--
 .../media/uapi/dvb/query-dvb-frontend-info.rst |  4 ++--
 Documentation/media/uapi/dvb/video-continue.rst|  2 +-
 Documentation/media/uapi/dvb/video-freeze.rst  |  4 ++--
 Documentation/media/uapi/dvb/video-get-event.rst   |  2 +-
 Documentation/media/uapi/dvb/video-play.rst|  2 +-
 .../media/uapi/dvb/video-select-source.rst |  2 +-
 Documentation/media/uapi/dvb/video-stop.rst|  2 +-
 Documentation/media/uapi/dvb/video.rst | 15 +++--
 41 files changed, 149 insertions(+), 126 deletions(-)

diff --git a/Documentation/media/uapi/dvb/audio-channel-select.rst 
b/Documentation/media/uapi/dvb/audio-channel-select.rst
index 2ceb4efebdf0..8cab3d7abff5 100644
--- a/Documentation/media/uapi/dvb/audio-channel-select.rst
+++ b/Documentation/media/uapi/dvb/audio-channel-select.rst
@@ -44,7 +44,7 @@ Arguments
 Description
 ---
 
-This ioctl is for DVB devices only. To control a V4L2 decoder use the
+This ioctl is for Digital TV devices only. To control a V4L2 decoder use the
 V4L2 ``V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK`` control instead.
 
 This ioctl call asks the Audio Device to select the requested channel if
diff --git a/Documentation/media/uapi/dvb/audio-fclose.rst 
b/Documentation/media/uapi/dvb/audio-fclose.rst
index 4df24c8d74ed..58d351a3af4b 100644
--- a/Documentation/media/uapi/dvb/audio-fclose.rst
+++ b/Documentation/media/uapi/dvb/audio-fclose.rst
@@ -2,14 +2,14 @@
 
 .. _audio_fclose:
 
-=
-DVB audio close()
-=
+
+Digital TV audio close()
+
 
 Name
 
 
-DVB audio close()
+Digital TV audio close()
 
 .. attention:: This ioctl is deprecated
 
diff --git a/Documentation/media/uapi/dvb/audio-fopen.rst 
b/Documentation/media/uapi/dvb/audio-fopen.rst
index a802c2e0dc6a..4a174640bf11 100644
--- a/Documentation/media/uapi/dvb/audio-fopen.rst
+++ b/Documentation/media/uapi/dvb/audio-fopen.rst
@@ -2,14 +2,14 @@
 
 .. _audio_fopen:
 
-
-DVB audio open()
-
+===
+Digital TV audio open()
+===
 
 Name
 
 
-DVB audio open()
+Digital TV audio open()
 
 .. attention:: This ioctl is deprecated
 
diff --git a/Documentation/media/uapi/dvb/audio-fwrite.rst 
b/Documentation/media/uapi/dvb/audio-fwrite.rst
index 8882cad7d165..4980ae7953ef 100644
--- a/Documentation/media/uapi/dvb/audio-fwrite.rst
+++ b/Documentation/media/uapi/dvb/audio-fwrite.rst
@@ -2,14 +2,14 @@
 
 .. _audio_fwrite:
 
-=
-DVB audio write()

[PATCH 01/14] media: dvb uapi docs: better organize header files

2017-09-01 Thread Mauro Carvalho Chehab
Instead of having one chapter per file, place all of them at
the same chapter. That better organize the chapters at the uAPI
documentation.

As a side effect, now all uAPI headers are at the same page,
at the html output, with makes easier to use it as a reference
index for the spec.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/audio_h.rst|  9 -
 Documentation/media/uapi/dvb/ca_h.rst   |  9 -
 Documentation/media/uapi/dvb/dmx_h.rst  |  9 -
 Documentation/media/uapi/dvb/dvbapi.rst |  7 +--
 Documentation/media/uapi/dvb/frontend_h.rst |  9 -
 Documentation/media/uapi/dvb/headers.rst| 21 +
 Documentation/media/uapi/dvb/net_h.rst  |  9 -
 Documentation/media/uapi/dvb/video_h.rst|  9 -
 8 files changed, 22 insertions(+), 60 deletions(-)
 delete mode 100644 Documentation/media/uapi/dvb/audio_h.rst
 delete mode 100644 Documentation/media/uapi/dvb/ca_h.rst
 delete mode 100644 Documentation/media/uapi/dvb/dmx_h.rst
 delete mode 100644 Documentation/media/uapi/dvb/frontend_h.rst
 create mode 100644 Documentation/media/uapi/dvb/headers.rst
 delete mode 100644 Documentation/media/uapi/dvb/net_h.rst
 delete mode 100644 Documentation/media/uapi/dvb/video_h.rst

diff --git a/Documentation/media/uapi/dvb/audio_h.rst 
b/Documentation/media/uapi/dvb/audio_h.rst
deleted file mode 100644
index e00c3010fdf9..
--- a/Documentation/media/uapi/dvb/audio_h.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _audio_h:
-
-*
-DVB Audio Header File
-*
-
-.. kernel-include:: $BUILDDIR/audio.h.rst
diff --git a/Documentation/media/uapi/dvb/ca_h.rst 
b/Documentation/media/uapi/dvb/ca_h.rst
deleted file mode 100644
index f513592ef529..
--- a/Documentation/media/uapi/dvb/ca_h.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _ca_h:
-
-**
-DVB Conditional Access Header File
-**
-
-.. kernel-include:: $BUILDDIR/ca.h.rst
diff --git a/Documentation/media/uapi/dvb/dmx_h.rst 
b/Documentation/media/uapi/dvb/dmx_h.rst
deleted file mode 100644
index 4fd1704a0833..
--- a/Documentation/media/uapi/dvb/dmx_h.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _dmx_h:
-
-*
-DVB Demux Header File
-*
-
-.. kernel-include:: $BUILDDIR/dmx.h.rst
diff --git a/Documentation/media/uapi/dvb/dvbapi.rst 
b/Documentation/media/uapi/dvb/dvbapi.rst
index 37680137e3f2..9ca3dd24bd7d 100644
--- a/Documentation/media/uapi/dvb/dvbapi.rst
+++ b/Documentation/media/uapi/dvb/dvbapi.rst
@@ -30,12 +30,7 @@ Part II - Digital TV API
 net
 legacy_dvb_apis
 examples
-audio_h
-ca_h
-dmx_h
-frontend_h
-net_h
-video_h
+headers
 
 
 **
diff --git a/Documentation/media/uapi/dvb/frontend_h.rst 
b/Documentation/media/uapi/dvb/frontend_h.rst
deleted file mode 100644
index 15fca04d1c32..
--- a/Documentation/media/uapi/dvb/frontend_h.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _frontend_h:
-
-
-DVB Frontend Header File
-
-
-.. kernel-include:: $BUILDDIR/frontend.h.rst
diff --git a/Documentation/media/uapi/dvb/headers.rst 
b/Documentation/media/uapi/dvb/headers.rst
new file mode 100644
index ..c13fd537fbff
--- /dev/null
+++ b/Documentation/media/uapi/dvb/headers.rst
@@ -0,0 +1,21 @@
+
+Digital TV uAPI header files
+
+
+Digital TV uAPI headers
+***
+
+.. kernel-include:: $BUILDDIR/frontend.h.rst
+
+.. kernel-include:: $BUILDDIR/dmx.h.rst
+
+.. kernel-include:: $BUILDDIR/ca.h.rst
+
+.. kernel-include:: $BUILDDIR/net.h.rst
+
+Legacy uAPI
+***
+
+.. kernel-include:: $BUILDDIR/audio.h.rst
+
+.. kernel-include:: $BUILDDIR/video.h.rst
diff --git a/Documentation/media/uapi/dvb/net_h.rst 
b/Documentation/media/uapi/dvb/net_h.rst
deleted file mode 100644
index 7bcf5ba9d1eb..
--- a/Documentation/media/uapi/dvb/net_h.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _net_h:
-
-***
-DVB Network Header File
-***
-
-.. kernel-include:: $BUILDDIR/net.h.rst
diff --git a/Documentation/media/uapi/dvb/video_h.rst 
b/Documentation/media/uapi/dvb/video_h.rst
deleted file mode 100644
index 3f39b0c4879c..
--- a/Documentation/media/uapi/dvb/video_h.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _video_h:
-
-*
-DVB Video Header File
-*
-
-.. kernel-include:: $BUILDDIR/video.h.rst
-- 
2.13.5



[PATCH 04/14] media: dvb uAPI docs: adjust return value ioctl descriptions

2017-09-01 Thread Mauro Carvalho Chehab
There are several issues on the return value for ioctls:

- Text is confusing;
- Some error codes don't exist;
- The non-generic error codes should come before the text
  that points to the generic error codes;
- Tables don't contain column size hints;
- Some references are not marked as such.

Correct them.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca-fclose.rst | 13 ++---
 Documentation/media/uapi/dvb/ca-fopen.rst  | 32 ++---
 Documentation/media/uapi/dvb/ca-get-cap.rst|  4 +-
 Documentation/media/uapi/dvb/ca-get-msg.rst|  9 +++-
 Documentation/media/uapi/dvb/ca-get-slot-info.rst  | 10 +++-
 Documentation/media/uapi/dvb/ca-reset.rst  |  8 +++-
 Documentation/media/uapi/dvb/ca-send-msg.rst   |  8 +++-
 Documentation/media/uapi/dvb/ca-set-descr.rst  |  8 +++-
 Documentation/media/uapi/dvb/dmx-add-pid.rst   |  8 +++-
 Documentation/media/uapi/dvb/dmx-fclose.rst| 13 ++---
 Documentation/media/uapi/dvb/dmx-fopen.rst | 33 +
 Documentation/media/uapi/dvb/dmx-fread.rst | 55 +++---
 Documentation/media/uapi/dvb/dmx-fwrite.rst| 29 +---
 Documentation/media/uapi/dvb/dmx-get-pes-pids.rst  |  8 +++-
 Documentation/media/uapi/dvb/dmx-get-stc.rst   | 15 --
 Documentation/media/uapi/dvb/dmx-remove-pid.rst|  8 +++-
 .../media/uapi/dvb/dmx-set-buffer-size.rst |  9 +++-
 Documentation/media/uapi/dvb/dmx-set-filter.rst|  9 +++-
 .../media/uapi/dvb/dmx-set-pes-filter.rst  | 12 +++--
 Documentation/media/uapi/dvb/dmx-start.rst | 15 --
 Documentation/media/uapi/dvb/dmx-stop.rst  |  8 +++-
 .../media/uapi/dvb/fe-diseqc-recv-slave-reply.rst  |  8 +++-
 .../media/uapi/dvb/fe-diseqc-reset-overload.rst|  8 +++-
 .../media/uapi/dvb/fe-diseqc-send-burst.rst|  8 +++-
 .../media/uapi/dvb/fe-diseqc-send-master-cmd.rst   |  8 +++-
 .../uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst|  8 +++-
 .../media/uapi/dvb/fe-enable-high-lnb-voltage.rst  |  8 +++-
 Documentation/media/uapi/dvb/fe-get-event.rst  |  9 ++--
 Documentation/media/uapi/dvb/fe-get-frontend.rst   | 10 ++--
 Documentation/media/uapi/dvb/fe-get-info.rst   |  8 +++-
 Documentation/media/uapi/dvb/fe-get-property.rst   |  8 +++-
 Documentation/media/uapi/dvb/fe-read-ber.rst   |  8 +++-
 .../media/uapi/dvb/fe-read-signal-strength.rst |  8 +++-
 Documentation/media/uapi/dvb/fe-read-snr.rst   |  8 +++-
 Documentation/media/uapi/dvb/fe-read-status.rst|  8 +++-
 .../media/uapi/dvb/fe-read-uncorrected-blocks.rst  |  8 +++-
 .../media/uapi/dvb/fe-set-frontend-tune-mode.rst   |  8 +++-
 Documentation/media/uapi/dvb/fe-set-frontend.rst   | 15 --
 Documentation/media/uapi/dvb/fe-set-tone.rst   |  8 +++-
 Documentation/media/uapi/dvb/fe-set-voltage.rst|  8 +++-
 Documentation/media/uapi/dvb/frontend_f_close.rst  | 10 ++--
 Documentation/media/uapi/dvb/frontend_f_open.rst   | 38 +--
 Documentation/media/uapi/dvb/net-add-if.rst|  8 +++-
 Documentation/media/uapi/dvb/net-get-if.rst|  8 +++-
 Documentation/media/uapi/dvb/net-remove-if.rst |  8 +++-
 45 files changed, 327 insertions(+), 221 deletions(-)

diff --git a/Documentation/media/uapi/dvb/ca-fclose.rst 
b/Documentation/media/uapi/dvb/ca-fclose.rst
index 5ecefa4abc3d..d97c1957aad5 100644
--- a/Documentation/media/uapi/dvb/ca-fclose.rst
+++ b/Documentation/media/uapi/dvb/ca-fclose.rst
@@ -34,13 +34,10 @@ This system call closes a previously opened CA device.
 Return Value
 
 
-.. flat-table::
-:header-rows:  0
-:stub-columns: 0
+On success 0 is returned.
 
+On error -1 is returned, and the ``errno`` variable is set
+appropriately.
 
--  .. row 1
-
-   -  ``EBADF``
-
-   -  fd is not a valid open file descriptor.
+Generic error codes are described at the
+:ref:`Generic Error Codes ` chapter.
diff --git a/Documentation/media/uapi/dvb/ca-fopen.rst 
b/Documentation/media/uapi/dvb/ca-fopen.rst
index 3d2819751446..c974a212b618 100644
--- a/Documentation/media/uapi/dvb/ca-fopen.rst
+++ b/Documentation/media/uapi/dvb/ca-fopen.rst
@@ -66,33 +66,11 @@ the device in this mode will fail, and an error code will 
be returned.
 Return Value
 
 
-.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
 
-.. flat-table::
-:header-rows:  0
-:stub-columns: 0
+On success 0 is returned.
 
+On error -1 is returned, and the ``errno`` variable is set
+appropriately.
 
--  .. row 1
-
-   -  ``ENODEV``
-
-   -  Device driver not loaded/available.
-
--  .. row 2
-
-   -  ``EINTERNAL``
-
-   -  Internal error.
-
--  .. row 3
-
-   -  ``EBUSY``
-
-   -  Device or resource busy.
-
--  .. row 4
-
-   -  ``EINVAL``
-
-   -  Invalid argument.
+Generic error codes are described at the
+:ref:`Generic Error Codes ` chapter.
diff --git a/Documentation/media/uapi/dvb/ca-get-cap.rst 

[PATCH 03/14] media: gen-errors.rst: document ENXIO error code

2017-09-01 Thread Mauro Carvalho Chehab
This error can be produced at least at the DVB subsystem.

As it is generic enough, document it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/gen-errors.rst | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/media/uapi/gen-errors.rst 
b/Documentation/media/uapi/gen-errors.rst
index d51f672021c4..689d3b101ede 100644
--- a/Documentation/media/uapi/gen-errors.rst
+++ b/Documentation/media/uapi/gen-errors.rst
@@ -80,6 +80,11 @@ Generic Error Codes
   a hardware device. This could indicate broken or flaky hardware.
  It's a 'Something is wrong, I give up!' type of error.
 
+-  - ``ENXIO``
+
+   -  No device corresponding to this device special file exists.
+
+
 .. note::
 
   #. This list is not exhaustive; ioctls may return other error codes.
-- 
2.13.5



[PATCH 10/14] media: dvb uAPI docs: minor editorial changes

2017-09-01 Thread Mauro Carvalho Chehab
Do minor editorial changes to improve documentation readability:

- mark literals as such;
- add table markups to hint sizes;
- define what PES means;
- instead of hardcoding devnode numbers to zero (like adapter0/) use a
  question mark, to indicate that multiple devnodes may exist;
- add cross-references where useful.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca-fopen.rst  | 25 +++---
 Documentation/media/uapi/dvb/dmx-add-pid.rst   |  4 ++--
 Documentation/media/uapi/dvb/dmx-fclose.rst|  5 +++--
 Documentation/media/uapi/dvb/dmx-fopen.rst | 23 +++-
 Documentation/media/uapi/dvb/dmx-fread.rst |  8 +++
 Documentation/media/uapi/dvb/dmx-fwrite.rst|  4 ++--
 Documentation/media/uapi/dvb/dmx-get-stc.rst   | 13 +--
 Documentation/media/uapi/dvb/dmx-remove-pid.rst|  4 ++--
 .../media/uapi/dvb/dmx-set-buffer-size.rst |  2 +-
 Documentation/media/uapi/dvb/dmx-set-filter.rst|  4 ++--
 Documentation/media/uapi/dvb/dmx-stop.rst  |  4 ++--
 .../media/uapi/dvb/dvb-fe-read-status.rst  |  2 +-
 .../media/uapi/dvb/fe-diseqc-send-master-cmd.rst   |  3 ++-
 Documentation/media/uapi/dvb/fe-get-info.rst   |  4 ++--
 .../media/uapi/dvb/fe-set-frontend-tune-mode.rst   |  4 ++--
 Documentation/media/uapi/dvb/fe-type-t.rst |  2 +-
 16 files changed, 59 insertions(+), 52 deletions(-)

diff --git a/Documentation/media/uapi/dvb/ca-fopen.rst 
b/Documentation/media/uapi/dvb/ca-fopen.rst
index a03a01abf3da..056c71b53a70 100644
--- a/Documentation/media/uapi/dvb/ca-fopen.rst
+++ b/Documentation/media/uapi/dvb/ca-fopen.rst
@@ -28,20 +28,20 @@ Arguments
 ``flags``
   A bit-wise OR of the following flags:
 
+.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
+
 .. flat-table::
 :header-rows:  0
 :stub-columns: 0
+:widths: 1 16
 
--
-   - O_RDONLY
+-  - ``O_RDONLY``
- read-only access
 
--
-   - O_RDWR
+-  - ``O_RDWR``
- read/write access
 
--
-   - O_NONBLOCK
+-  - ``O_NONBLOCK``
- open in non-blocking mode
  (blocking mode is the default)
 
@@ -52,15 +52,16 @@ Description
 This system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``)
 for subsequent use.
 
-When an open() call has succeeded, the device will be ready for use. The
+When an ``open()`` call has succeeded, the device will be ready for use. The
 significance of blocking or non-blocking mode is described in the
 documentation for functions where there is a difference. It does not
-affect the semantics of the open() call itself. A device opened in
+affect the semantics of the ``open()`` call itself. A device opened in
 blocking mode can later be put into non-blocking mode (and vice versa)
-using the F_SETFL command of the fcntl system call. This is a standard
-system call, documented in the Linux manual page for fcntl. Only one
-user can open the CA Device in O_RDWR mode. All other attempts to open
-the device in this mode will fail, and an error code will be returned.
+using the ``F_SETFL`` command of the ``fcntl`` system call. This is a
+standard system call, documented in the Linux manual page for fcntl.
+Only one user can open the CA Device in ``O_RDWR`` mode. All other
+attempts to open the device in this mode will fail, and an error code
+will be returned.
 
 
 Return Value
diff --git a/Documentation/media/uapi/dvb/dmx-add-pid.rst 
b/Documentation/media/uapi/dvb/dmx-add-pid.rst
index 0aab2fcaacab..4d5632dfb43e 100644
--- a/Documentation/media/uapi/dvb/dmx-add-pid.rst
+++ b/Documentation/media/uapi/dvb/dmx-add-pid.rst
@@ -33,8 +33,8 @@ Description
 ---
 
 This ioctl call allows to add multiple PIDs to a transport stream filter
-previously set up with DMX_SET_PES_FILTER and output equal to
-DMX_OUT_TSDEMUX_TAP.
+previously set up with :ref:`DMX_SET_PES_FILTER` and output equal to
+:c:type:`DMX_OUT_TSDEMUX_TAP `.
 
 
 Return Value
diff --git a/Documentation/media/uapi/dvb/dmx-fclose.rst 
b/Documentation/media/uapi/dvb/dmx-fclose.rst
index 8693501dbd4d..578e929f4bde 100644
--- a/Documentation/media/uapi/dvb/dmx-fclose.rst
+++ b/Documentation/media/uapi/dvb/dmx-fclose.rst
@@ -23,13 +23,14 @@ Arguments
 -
 
 ``fd``
-  File descriptor returned by a previous call to :c:func:`open() 
`.
+  File descriptor returned by a previous call to
+  :c:func:`open() `.
 
 Description
 ---
 
 This system call deactivates and deallocates a filter that was
-previously allocated via the open() call.
+previously allocated via the :c:func:`open() ` call.
 
 
 Return Value
diff --git a/Documentation/media/uapi/dvb/dmx-fopen.rst 
b/Documentation/media/uapi/dvb/dmx-fopen.rst
index 3dee019522db..55628a18ba67 100644
--- a/Documentation/media/uapi/dvb/dmx-fopen.rst
+++ b/Documentation/media/uapi/dvb/dmx-fopen.rst
@@ -27,20 +27,23 @@ Arguments
 ``flags``
   A bit-wise OR of the following flags:
 
+.. 

[PATCH 08/14] media: dvb-frontend-parameters.rst: fix the name of a struct

2017-09-01 Thread Mauro Carvalho Chehab
The struct that contains an union of DVB parameters is
called dvb_frontend_parameters (and not FrontendParameters).

Fix it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/dvb-frontend-parameters.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/media/uapi/dvb/dvb-frontend-parameters.rst 
b/Documentation/media/uapi/dvb/dvb-frontend-parameters.rst
index 899fd5c3545e..b152166f8fa7 100644
--- a/Documentation/media/uapi/dvb/dvb-frontend-parameters.rst
+++ b/Documentation/media/uapi/dvb/dvb-frontend-parameters.rst
@@ -24,7 +24,7 @@ instead, in order to be able to support the newer System 
Delivery like
 DVB-S2, DVB-T2, DVB-C2, ISDB, etc.
 
 All kinds of parameters are combined as a union in the
-FrontendParameters structure:
+``dvb_frontend_parameters`` structure:
 
 
 .. code-block:: c
-- 
2.13.5



[PATCH 12/14] media: dvbstb.svg: use dots for the optional parts of the hardware

2017-09-01 Thread Mauro Carvalho Chehab
The hardware description mentions that some parts are optional.
Make it clearer at the drawing.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/dvbstb.svg | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/Documentation/media/uapi/dvb/dvbstb.svg 
b/Documentation/media/uapi/dvb/dvbstb.svg
index 4effe45b448d..f6fe2f837373 100644
--- a/Documentation/media/uapi/dvb/dvbstb.svg
+++ b/Documentation/media/uapi/dvb/dvbstb.svg
@@ -1,17 +1,16 @@
 
-http://www.w3.org/2000/svg; xmlns:cc="http://creativecommons.org/ns#; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;>image/svg+xmlhttp://purl.org/dc/dcmitype/StillImage"/>Antena
-Frontend
-CA
-Demux
-SEC
-Audio
-Video
-TV
-
+http://www.w3.org/2000/svg; xmlns:cc="http://creativecommons.org/ns#; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;>image/svg+xmlhttp://purl.org/dc/dcmitype/StillImage"/>Antena
+Frontend
+CA
+Demux
+SEC
+Audio
+Video
+TV
+Decoder
+Decoder
+
-- 
2.13.5



[PATCH 02/14] media: gen-errors.rst: remove row number comments

2017-09-01 Thread Mauro Carvalho Chehab
Those are introduced by the conversion scripts and don't
really help. Get rid of them.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/gen-errors.rst | 44 +
 1 file changed, 11 insertions(+), 33 deletions(-)

diff --git a/Documentation/media/uapi/gen-errors.rst 
b/Documentation/media/uapi/gen-errors.rst
index d39e34d1b19d..d51f672021c4 100644
--- a/Documentation/media/uapi/gen-errors.rst
+++ b/Documentation/media/uapi/gen-errors.rst
@@ -17,9 +17,7 @@ Generic Error Codes
 :widths: 1 16
 
 
--  .. row 1
-
-   -  ``EAGAIN`` (aka ``EWOULDBLOCK``)
+-  -  ``EAGAIN`` (aka ``EWOULDBLOCK``)
 
-  The ioctl can't be handled because the device is in state where it
  can't perform it. This could happen for example in case where
@@ -27,15 +25,11 @@ Generic Error Codes
  is also returned when the ioctl would need to wait for an event,
  but the device was opened in non-blocking mode.
 
--  .. row 2
-
-   -  ``EBADF``
+-  -  ``EBADF``
 
-  The file descriptor is not a valid.
 
--  .. row 3
-
-   -  ``EBUSY``
+-  -  ``EBUSY``
 
-  The ioctl can't be handled because the device is busy. This is
  typically return while device is streaming, and an ioctl tried to
@@ -44,59 +38,43 @@ Generic Error Codes
  ioctl must not be retried without performing another action to fix
  the problem first (typically: stop the stream before retrying).
 
--  .. row 4
-
-   -  ``EFAULT``
+-  -  ``EFAULT``
 
-  There was a failure while copying data from/to userspace, probably
  caused by an invalid pointer reference.
 
--  .. row 5
-
-   -  ``EINVAL``
+-  -  ``EINVAL``
 
-  One or more of the ioctl parameters are invalid or out of the
  allowed range. This is a widely used error code. See the
  individual ioctl requests for specific causes.
 
--  .. row 6
-
-   -  ``ENODEV``
+-  -  ``ENODEV``
 
-  Device not found or was removed.
 
--  .. row 7
-
-   -  ``ENOMEM``
+-  -  ``ENOMEM``
 
-  There's not enough memory to handle the desired operation.
 
--  .. row 8
-
-   -  ``ENOTTY``
+-  -  ``ENOTTY``
 
-  The ioctl is not supported by the driver, actually meaning that
  the required functionality is not available, or the file
  descriptor is not for a media device.
 
--  .. row 9
-
-   -  ``ENOSPC``
+-  -  ``ENOSPC``
 
-  On USB devices, the stream ioctl's can return this error, meaning
  that this request would overcommit the usb bandwidth reserved for
  periodic transfers (up to 80% of the USB bandwidth).
 
--  .. row 10
-
-   -  ``EPERM``
+-  -  ``EPERM``
 
-  Permission denied. Can be returned if the device needs write
  permission, or some special capabilities is needed (e. g. root)
 
--  .. row 11
-
-   -  ``EIO``
+-  -  ``EIO``
 
-  I/O error. Typically used when there are problems communicating with
   a hardware device. This could indicate broken or flaky hardware.
-- 
2.13.5



[PATCH 07/14] media: dmx-fread.rst: specify how DMX_CHECK_CRC works

2017-09-01 Thread Mauro Carvalho Chehab
In the past, the documentation used to say that, if a CRC error
was found, a "-ECRC" error would be returned. That's not true:
the DVB core will just silently ignore such errors.

So, add an explicit note about that.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/dmx-fread.rst | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/media/uapi/dvb/dmx-fread.rst 
b/Documentation/media/uapi/dvb/dmx-fread.rst
index cb6cedbb47f6..36ba851bc0af 100644
--- a/Documentation/media/uapi/dvb/dmx-fread.rst
+++ b/Documentation/media/uapi/dvb/dmx-fread.rst
@@ -38,6 +38,13 @@ data. The filtered data is transferred from the driver’s 
internal
 circular buffer to buf. The maximum amount of data to be transferred is
 implied by count.
 
+.. note::
+
+   if a section filter created with
+   :c:type:`DMX_CHECK_CRC ` flag set,
+   data that fails on CRC check will be silently ignored.
+
+
 Return Value
 
 
-- 
2.13.5



[PATCH 14/14] media: frontend.h: Avoid the term DVB when doesn't refer to a delivery system

2017-09-01 Thread Mauro Carvalho Chehab
The DVB term can either refer to the subsystem or to a delivery
system. Avoid it in the first case at the kernel-doc markups.

Signed-off-by: Mauro Carvalho Chehab 
---
 include/uapi/linux/dvb/frontend.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/dvb/frontend.h 
b/include/uapi/linux/dvb/frontend.h
index 8c5191f74bd4..b81b74efbd02 100644
--- a/include/uapi/linux/dvb/frontend.h
+++ b/include/uapi/linux/dvb/frontend.h
@@ -239,11 +239,11 @@ enum fe_sec_mini_cmd {
  * @FE_NONE:   The frontend doesn't have any kind of lock.
  * That's the initial frontend status
  * @FE_HAS_SIGNAL: Has found something above the noise level.
- * @FE_HAS_CARRIER:Has found a DVB signal.
+ * @FE_HAS_CARRIER:Has found a signal.
  * @FE_HAS_VITERBI:FEC inner coding (Viterbi, LDPC or other inner code).
  * is stable.
  * @FE_HAS_SYNC:   Synchronization bytes was found.
- * @FE_HAS_LOCK:   DVB were locked and everything is working.
+ * @FE_HAS_LOCK:   Digital TV were locked and everything is working.
  * @FE_TIMEDOUT:   Fo lock within the last about 2 seconds.
  * @FE_REINIT: Frontend was reinitialized, application is recommended
  * to reset DiSEqC, tone and parameters.
@@ -269,7 +269,7 @@ enum fe_status {
  * This parameter indicates if spectral inversion should be presumed or
  * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try
  * to figure out the correct setting by itself. If the hardware doesn't
- * support, the DVB core will try to lock at the carrier first with
+ * support, the %dvb_frontend will try to lock at the carrier first with
  * inversion off. If it fails, it will try to enable inversion.
  */
 enum fe_spectral_inversion {
-- 
2.13.5



Re: [PATCH v2 14/14] [media] v4l: Document explicit synchronization behaviour

2017-09-01 Thread Gustavo Padovan
Hi Hans,

2017-09-01 Hans Verkuil :

> Hi Gustavo,
> 
> I think I concentrate on this last patch first. Once I fully understand this
> I can review the code. Remember, it's been a while for me since I last looked
> at fences, so forgive me if I ask stupid questions. On the other hand, others
> with a similar lack of understanding of fences probably have similar 
> questions,
> so it is a good indication where the documentation needs improvement :-)

Please ask as many as you want, those are the best questions. :)

> 
> On 01/09/17 03:50, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > Add section to VIDIOC_QBUF about it
> > 
> > Signed-off-by: Gustavo Padovan 
> > ---q
> >  Documentation/media/uapi/v4l/vidioc-qbuf.rst | 30 
> > 
> >  1 file changed, 30 insertions(+)
> > 
> > diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst 
> > b/Documentation/media/uapi/v4l/vidioc-qbuf.rst
> > index 1f3612637200..6bd960d3972b 100644
> > --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst
> > +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst
> > @@ -117,6 +117,36 @@ immediately with an ``EAGAIN`` error code when no 
> > buffer is available.
> >  The struct :c:type:`v4l2_buffer` structure is specified in
> >  :ref:`buffer`.
> >  
> > +Explicit Synchronization
> > +
> > +
> > +Explicit Synchronization allows us to control the synchronization of
> > +shared buffers from userspace by passing fences to the kernel and/or
> > +receiving them from it. Fences passed to the kernel are named in-fences and
> > +the kernel should wait them to signal before using the buffer, i.e., 
> > queueing
> > +it to the driver. On the other side, the kernel can create out-fences for 
> > the
> > +buffers it queues to the drivers, out-fences signal when the driver is
> > +finished with buffer, that is the buffer is ready.
> 
> This should add a line explaining that fences are represented by file 
> descriptors.

Okay.

> 
> > +
> > +The in-fences and out-fences are communicated at the ``VIDIOC_QBUF`` ioctl
> > +using the ``V4L2_BUF_FLAG_IN_FENCE`` and ``V4L2_BUF_FLAG_OUT_FENCE`` buffer
> > +flags and the `fence_fd` field. If an in-fence needs to be passed to the 
> > kernel,
> > +`fence_fd` should be set to the fence file descriptor number and the
> > +``V4L2_BUF_FLAG_IN_FENCE`` should be set as well.
> 
> Is it possible to have both flags at the same time? Or are they mutually 
> exclusive?
> 
> If only V4L2_BUF_FLAG_IN_FENCE is set, then what is the value of fence_fd 
> after
> the QBUF call? -1?

Yes, it is -1.

> 
> > +
> > +To get a out-fence back from V4L2 the ``V4L2_BUF_FLAG_OUT_FENCE`` flag 
> > should
> > +be set and the `fence_fd` field will be returned with the out-fence file
> > +descriptor related to the next buffer to be queued internally to the V4L2
> > +driver. That means the out-fence may not be associated with the buffer in 
> > the
> > +current ``VIDIOC_QBUF`` ioctl call because the ordering in which videobuf2 
> > core
> > +queues the buffers to the drivers can't be guaranteed. To become aware of 
> > the
> > +buffer with which the out-fence will be attached the 
> > ``V4L2_EVENT_BUF_QUEUED``
> > +should be used. It will trigger an event for every buffer queued to the 
> > V4L2
> > +driver.
> 
> General question: does it even make sense to use an out-fence if you don't 
> know with
> what buffer is it associated? I mean, QBUF returns an out fence, but only some
> time later are you informed about a buffer being queued. It also looks like 
> userspace
> has to keep track of the issued out-fences and the queued buffers and map them
> accordingly.
> 
> If the out-fence cannot be used until you know the buffer as well, then 
> wouldn't
> it make more sense if the out-fence and the buffer index are both sent by the
> event? Of course, in that case the event can only be sent to the owner file 
> handle
> of the streaming device node, but that's OK, we have that.
> 
> Setting the OUT_FENCE flag will just cause this event to be sent whenever that
> buffer is queued internally.
> 
> Sorry if this just shows a complete lack of understanding of fences on my 
> side,
> that's perfectly possible.

Right, I can not think of anything that prevents what you are saying to
work. I built it this way initially because on my lack of understanding
of V4L2 (seems we complement each other here :) because I thought we
needed to keep the QBUF ordering. In the last review you talked me away
of this misconception but I really didn't took that to the
implementation.

If there is no care about ordering, there is no need to receive the
fence before and we could just do as you say. That makes sense to me.
We could do it that way but I have one question, maybe a stupid one. :)

If a specific driver can guarantee the ordering of vb2 buffer, and
userspace has a way to become aware of that. In this case we will

[PATCH] [media] si2168: Delete an error message for a failed memory allocation in si2168_probe()

2017-09-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Fri, 1 Sep 2017 19:50:45 +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/dvb-frontends/si2168.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 172fc367ccaa..41d9c513b7e8 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -697,6 +697,5 @@ static int si2168_probe(struct i2c_client *client,
if (!dev) {
ret = -ENOMEM;
-   dev_err(>dev, "kzalloc() failed\n");
goto err;
}
 
-- 
2.14.1



v4l2_ioctl vidioc_s_fmt/vidioc_try_fmt pix <--> pix_mp conversion

2017-09-01 Thread Rafal

Could somebody explain to me some strange behavior of v4l2_ioctl call?

When a device supports |V4L2_CAP_VIDEO_OUTPUT_MPLANE capability but does 
not support ||V4L2_CAP_VIDEO_OUTPUT, the |v4l2_ioctl function converts 
VIDIOC_S_FMT ioctl call: for example, when the specified buffer type is 
V4L2_BUF_TYPE_VIDEO_OUTPUT, it is changed to 
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE. But the num_planes value is not 
checked after the ioctl call, like after VIDIOC_G_FMT ioctl call is 
made. Device may change the num_planes value in call, especially since 
number of planes is determined by pixelformat. For example, V4L2 
distinguishes single-plane variant of YUV420 format 
(V4L2_PIX_FMT_YUV420) from multi-plane one (V4L2_PIX_FMT_YUV420M). If 
the number of planes is not checked, program may select multi-plane 
variant, which will not handle correctly. Shouldn't the library check 
the number of planes after ioctl call?



Rafal



[PATCH] [media] rtl28xxu: make array rc_nec_tab static const

2017-09-01 Thread Colin King
From: Colin Ian King 

Don't populate the array rc_nec_tab on the stack, instead make it
static const. Makes the object code smaller by over 620 bytes:

Before:
   textdata bss dec hex filename
  49511   17040  64   66615   10437 rtl28xxu.o

After:
   textdata bss dec hex filename
  48825   17104  64   65993   101c9 rtl28xxu.o

Signed-off-by: Colin Ian King 
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 95a7b9123f8e..c76e78f9638a 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1598,7 +1598,7 @@ static int rtl2831u_rc_query(struct dvb_usb_device *d)
struct rtl28xxu_dev *dev = d->priv;
u8 buf[5];
u32 rc_code;
-   struct rtl28xxu_reg_val rc_nec_tab[] = {
+   static const struct rtl28xxu_reg_val rc_nec_tab[] = {
{ 0x3033, 0x80 },
{ 0x3020, 0x43 },
{ 0x3021, 0x16 },
-- 
2.14.1



[PATCH v2 03/27] media: dvb/intro: use the term Digital TV to refer to the system

2017-09-01 Thread Mauro Carvalho Chehab
On several places at the introduction, a digital TV board and its
kernel support is called as DVB. The reason is simple: by the
time the document was written, there were no other digital TV
standards :-)

Modernize the specs by referring to them as Digital TV.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/intro.rst | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/Documentation/media/uapi/dvb/intro.rst 
b/Documentation/media/uapi/dvb/intro.rst
index 20bd7aec2665..de432ffcba50 100644
--- a/Documentation/media/uapi/dvb/intro.rst
+++ b/Documentation/media/uapi/dvb/intro.rst
@@ -13,7 +13,7 @@ What you need to know
 =
 
 The reader of this document is required to have some knowledge in the
-area of digital video broadcasting (DVB) and should be familiar with
+area of digital video broadcasting (Digital TV) and should be familiar with
 part I of the MPEG2 specification ISO/IEC 13818 (aka ITU-T H.222), i.e
 you should know what a program/transport stream (PS/TS) is and what is
 meant by a packetized elementary stream (PES) or an I-frame.
@@ -59,14 +59,14 @@ Overview
 :alt:   dvbstb.svg
 :align: center
 
-Components of a DVB card/STB
+Components of a Digital TV card/STB
 
-A DVB PCI card or DVB set-top-box (STB) usually consists of the
+A Digital TV card or set-top-box (STB) usually consists of the
 following main hardware components:
 
--  Frontend consisting of tuner and DVB demodulator
+-  Frontend consisting of tuner and digital TV demodulator
 
-   Here the raw signal reaches the DVB hardware from a satellite dish or
+   Here the raw signal reaches the digital TV hardware from a satellite dish or
antenna or directly from cable. The frontend down-converts and
demodulates this signal into an MPEG transport stream (TS). In case
of a satellite frontend, this includes a facility for satellite
@@ -105,10 +105,10 @@ conditional access hardware.
 
 .. _dvb_devices:
 
-Linux DVB Devices
-=
+Linux Digital TV Devices
+
 
-The Linux DVB API lets you control these hardware components through
+The Linux Digital TV API lets you control these hardware components through
 currently six Unix-style character devices for video, audio, frontend,
 demux, CA and IP-over-DVB networking. The video and audio devices
 control the MPEG2 decoder hardware, the frontend device the tuner and
@@ -137,8 +137,8 @@ individual devices are called:
 
 -  ``/dev/dvb/adapterN/caM``,
 
-where ``N`` enumerates the DVB PCI cards in a system starting from 0, and ``M``
-enumerates the devices of each type within each adapter, starting
+where ``N`` enumerates the Digital TV cards in a system starting from 0, and
+``M`` enumerates the devices of each type within each adapter, starting
 from 0, too. We will omit the “``/dev/dvb/adapterN/``\ ” in the further
 discussion of these devices.
 
@@ -151,8 +151,8 @@ devices are described in the following chapters.
 API include files
 =
 
-For each of the DVB devices a corresponding include file exists. The DVB
-API include files should be included in application sources with a
+For each of the Digital TV devices a corresponding include file exists. The
+Digital TV API include files should be included in application sources with a
 partial path like:
 
 
-- 
2.13.5



[PATCH v2 27/27] media: dst_ca: remove CA_SET_DESCR boilerplate

2017-09-01 Thread Mauro Carvalho Chehab
This ioctl is not implemented at dst_ca driver. There's just
a boilerplate code there. Remove it, as it is unlikely that
anyone would implement it those days.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/pci/bt8xx/dst_ca.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/media/pci/bt8xx/dst_ca.c b/drivers/media/pci/bt8xx/dst_ca.c
index 5ebb86f22935..530b3e9764ce 100644
--- a/drivers/media/pci/bt8xx/dst_ca.c
+++ b/drivers/media/pci/bt8xx/dst_ca.c
@@ -57,13 +57,6 @@ static unsigned int verbose = 5;
 module_param(verbose, int, 0644);
 MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)");
 
-/* Need some more work */
-static int ca_set_slot_descr(void)
-{
-   /*  We could make this more graceful ?  */
-   return -EOPNOTSUPP;
-}
-
 static void put_command_and_length(u8 *data, int command, int length)
 {
data[0] = (command >> 16) & 0xff;
@@ -615,16 +608,6 @@ static long dst_ca_ioctl(struct file *file, unsigned int 
cmd, unsigned long ioct
}
dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_DESCR_INFO Success 
!");
break;
-   case CA_SET_DESCR:
-   dprintk(verbose, DST_CA_INFO, 1, " Setting descrambler");
-   result = ca_set_slot_descr();
-   if (result < 0) {
-   dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SET_DESCR 
Failed !");
-   result = -1;
-   goto free_mem_and_exit;
-   }
-   dprintk(verbose, DST_CA_INFO, 1, " -->CA_SET_DESCR Success !");
-   break;
default:
result = -EOPNOTSUPP;
}
-- 
2.13.5



[PATCH v2 21/27] media: ca-reset.rst: add some description to this ioctl

2017-09-01 Thread Mauro Carvalho Chehab
While we don't have any documentation for it, based on what's
there at Kaffeine and VDR, it seems that this command should
be issued before start using CA. So, document it as such.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca-reset.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/media/uapi/dvb/ca-reset.rst 
b/Documentation/media/uapi/dvb/ca-reset.rst
index 477313121a65..a5dd2797a92f 100644
--- a/Documentation/media/uapi/dvb/ca-reset.rst
+++ b/Documentation/media/uapi/dvb/ca-reset.rst
@@ -28,7 +28,8 @@ Arguments
 Description
 ---
 
-.. note:: This ioctl is undocumented. Documentation is welcome.
+Puts the Conditional Access hardware on its initial state. It should
+be called before start using the CA hardware.
 
 
 Return Value
-- 
2.13.5



[PATCH v2 15/27] media: dmx.h: get rid of GET_DMX_EVENT

2017-09-01 Thread Mauro Carvalho Chehab
This seems to be a pure fictional API :-)

It only exists at the DVB book, with no code implemeting it.

So, just get rid of it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/dmx-get-event.rst | 60 --
 Documentation/media/uapi/dvb/dmx_fcalls.rst|  1 -
 Documentation/media/uapi/dvb/dmx_types.rst | 19 
 3 files changed, 80 deletions(-)
 delete mode 100644 Documentation/media/uapi/dvb/dmx-get-event.rst

diff --git a/Documentation/media/uapi/dvb/dmx-get-event.rst 
b/Documentation/media/uapi/dvb/dmx-get-event.rst
deleted file mode 100644
index 8be626c29158..
--- a/Documentation/media/uapi/dvb/dmx-get-event.rst
+++ /dev/null
@@ -1,60 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _DMX_GET_EVENT:
-
-=
-DMX_GET_EVENT
-=
-
-Name
-
-
-DMX_GET_EVENT
-
-
-Synopsis
-
-
-.. c:function:: int ioctl( int fd, DMX_GET_EVENT, struct dmx_event *ev)
-:name: DMX_GET_EVENT
-
-
-Arguments
--
-
-``fd``
-File descriptor returned by :c:func:`open() `.
-
-``ev``
-Pointer to the location where the event is to be stored.
-
-
-Description

-
-This ioctl call returns an event if available. If an event is not
-available, the behavior depends on whether the device is in blocking or
-non-blocking mode. In the latter case, the call fails immediately with
-errno set to ``EWOULDBLOCK``. In the former case, the call blocks until an
-event becomes available.
-
-
-Return Value
-
-
-On success 0 is returned, on error -1 and the ``errno`` variable is set
-appropriately. The generic error codes are described at the
-:ref:`Generic Error Codes ` chapter.
-
-
-
-.. flat-table::
-:header-rows:  0
-:stub-columns: 0
-
-
--  .. row 1
-
-   -  ``EWOULDBLOCK``
-
-   -  There is no event pending, and the device is in non-blocking mode.
diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
b/Documentation/media/uapi/dvb/dmx_fcalls.rst
index be98d60877f2..a17289143220 100644
--- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
+++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
@@ -18,7 +18,6 @@ Demux Function Calls
 dmx-set-filter
 dmx-set-pes-filter
 dmx-set-buffer-size
-dmx-get-event
 dmx-get-stc
 dmx-get-pes-pids
 dmx-add-pid
diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
b/Documentation/media/uapi/dvb/dmx_types.rst
index a205c02ccdc1..171205ed86a4 100644
--- a/Documentation/media/uapi/dvb/dmx_types.rst
+++ b/Documentation/media/uapi/dvb/dmx_types.rst
@@ -166,25 +166,6 @@ struct dmx_pes_filter_params
__u32  flags;
 };
 
-
-struct dmx_event
-
-
-.. c:type:: dmx_event
-
-.. code-block:: c
-
- struct dmx_event
- {
-dmx_event_t  event;
-time_t   timeStamp;
-union
-{
-dmx_scrambling_status_t scrambling;
-} u;
- };
-
-
 struct dmx_stc
 ==
 
-- 
2.13.5



[PATCH v1 5/7] staging: atomisp: Move to upstream IOSF MBI API

2017-09-01 Thread Andy Shevchenko
There is a common for x86 IOSF MBI API. Move atomisp code to use it.

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/media/atomisp/pci/Kconfig  |  1 +
 .../media/atomisp/pci/atomisp2/atomisp_cmd.c   | 20 +++-
 .../media/atomisp/pci/atomisp2/atomisp_v4l2.c  | 38 ++
 3 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/Kconfig 
b/drivers/staging/media/atomisp/pci/Kconfig
index a72421431c7a..fb66fc9d6952 100644
--- a/drivers/staging/media/atomisp/pci/Kconfig
+++ b/drivers/staging/media/atomisp/pci/Kconfig
@@ -5,6 +5,7 @@
 config VIDEO_ATOMISP
tristate "Intel Atom Image Signal Processor Driver"
depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+   select IOSF_MBI
select VIDEOBUF_VMALLOC
 ---help---
   Say Y here if your platform supports Intel Atom SoC
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index f48bf451c1f5..73e15dd9d4d6 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -27,7 +27,9 @@
 #include 
 #include 
 #include 
+
 #include 
+#include 
 
 #include 
 #include 
@@ -143,36 +145,36 @@ static int write_target_freq_to_hw(struct atomisp_device 
*isp,
unsigned int ratio, timeout, guar_ratio;
u32 isp_sspm1 = 0;
int i;
+
if (!isp->hpll_freq) {
dev_err(isp->dev, "failed to get hpll_freq. no change to 
freq\n");
return -EINVAL;
}
 
-   isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1);
+   iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, _sspm1);
if (isp_sspm1 & ISP_FREQ_VALID_MASK) {
dev_dbg(isp->dev, "clearing ISPSSPM1 valid bit.\n");
-   intel_mid_msgbus_write32(PUNIT_PORT, ISPSSPM1,
+   iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, ISPSSPM1,
isp_sspm1 & ~(1 << ISP_FREQ_VALID_OFFSET));
}
 
ratio = (2 * isp->hpll_freq + new_freq / 2) / new_freq - 1;
guar_ratio = (2 * isp->hpll_freq + 200 / 2) / 200 - 1;
 
-   isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1);
+   iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, _sspm1);
isp_sspm1 &= ~(0x1F << ISP_REQ_FREQ_OFFSET);
 
for (i = 0; i < ISP_DFS_TRY_TIMES; i++) {
-   intel_mid_msgbus_write32(PUNIT_PORT, ISPSSPM1,
+   iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, ISPSSPM1,
   isp_sspm1
   | ratio << ISP_REQ_FREQ_OFFSET
   | 1 << ISP_FREQ_VALID_OFFSET
   | guar_ratio << ISP_REQ_GUAR_FREQ_OFFSET);
 
-   isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1);
-
+   iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, 
_sspm1);
timeout = 20;
while ((isp_sspm1 & ISP_FREQ_VALID_MASK) && timeout) {
-   isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, 
ISPSSPM1);
+   iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, 
_sspm1);
dev_dbg(isp->dev, "waiting for ISPSSPM1 valid bit to be 
0.\n");
udelay(100);
timeout--;
@@ -187,10 +189,10 @@ static int write_target_freq_to_hw(struct atomisp_device 
*isp,
return -EINVAL;
}
 
-   isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1);
+   iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, _sspm1);
timeout = 10;
while (((isp_sspm1 >> ISP_FREQ_STAT_OFFSET) != ratio) && timeout) {
-   isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1);
+   iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, 
_sspm1);
dev_dbg(isp->dev, "waiting for ISPSSPM1 status bit to be 
0x%x.\n",
new_freq);
udelay(100);
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
index 663aa916e3ca..0896f5ea7e4e 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
@@ -28,6 +28,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include "../../include/linux/atomisp_gmin_platform.h"
 
 #include "atomisp_cmd.h"
@@ -46,7 +49,6 @@
 #include "hrt/hive_isp_css_mm_hrt.h"
 
 #include "device_access.h"
-#include 
 
 /* G-Min addition: pull this in from intel_mid_pm.h */
 #define CSTATE_EXIT_LATENCY_C1  1
@@ -386,28 +388,23 @@ static int atomisp_mrfld_pre_power_down(struct 
atomisp_device *isp)
  */
 static void punit_ddr_dvfs_enable(bool enable)
 {
-   int reg = 

[PATCH v1 3/7] staging: atomisp: Remove dead code for MID (#2)

2017-09-01 Thread Andy Shevchenko
intel_mid_soc_stepping() is not used anywhere.

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h   | 1 -
 .../media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c| 7 ---
 2 files changed, 8 deletions(-)

diff --git a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h 
b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
index 0d7f5c618b56..5d8451ee391e 100644
--- a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
+++ b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
@@ -24,4 +24,3 @@ void intel_mid_msgbus_write32_raw(u32 cmd, u32 data);
 void intel_mid_msgbus_write32(u8 port, u32 addr, u32 data);
 u32 intel_mid_msgbus_read32_raw_ext(u32 cmd, u32 cmd_ext);
 void intel_mid_msgbus_write32_raw_ext(u32 cmd, u32 cmd_ext, u32 data);
-u32 intel_mid_soc_stepping(void);
diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c 
b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
index 341bfd3ab313..c34f461653db 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
@@ -154,10 +154,3 @@ void intel_mid_msgbus_write32(u8 port, u32 addr, u32 data)
spin_unlock_irqrestore(_lock, irq_flags);
 }
 EXPORT_SYMBOL(intel_mid_msgbus_write32);
-
-/* called only from where is later then fs_initcall */
-u32 intel_mid_soc_stepping(void)
-{
-   return pci_root->revision;
-}
-EXPORT_SYMBOL(intel_mid_soc_stepping);
-- 
2.14.1



[PATCH v1 7/7] staging: atomisp: Remove unneeded intel-mid.h inclusion

2017-09-01 Thread Andy Shevchenko
In many files in the driver the intel-mid.h header inclusion is redundant.

Signed-off-by: Andy Shevchenko 
---
 drivers/staging/media/atomisp/i2c/imx/drv201.c| 1 -
 drivers/staging/media/atomisp/i2c/imx/dw9714.c| 1 -
 drivers/staging/media/atomisp/i2c/imx/imx.c   | 1 -
 drivers/staging/media/atomisp/i2c/imx/otp_imx.c   | 1 -
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c  | 1 -
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h | 2 --
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c| 1 -
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c   | 1 -
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c | 1 -
 drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h | 1 -
 10 files changed, 11 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/imx/drv201.c 
b/drivers/staging/media/atomisp/i2c/imx/drv201.c
index 6d9d4c968722..532af7da3158 100644
--- a/drivers/staging/media/atomisp/i2c/imx/drv201.c
+++ b/drivers/staging/media/atomisp/i2c/imx/drv201.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "drv201.h"
 
diff --git a/drivers/staging/media/atomisp/i2c/imx/dw9714.c 
b/drivers/staging/media/atomisp/i2c/imx/dw9714.c
index 6397a7ee0af6..7e58fb3589cc 100644
--- a/drivers/staging/media/atomisp/i2c/imx/dw9714.c
+++ b/drivers/staging/media/atomisp/i2c/imx/dw9714.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "dw9714.h"
 
diff --git a/drivers/staging/media/atomisp/i2c/imx/imx.c 
b/drivers/staging/media/atomisp/i2c/imx/imx.c
index 49ab0af87096..71b688970822 100644
--- a/drivers/staging/media/atomisp/i2c/imx/imx.c
+++ b/drivers/staging/media/atomisp/i2c/imx/imx.c
@@ -18,7 +18,6 @@
  * 02110-1301, USA.
  *
  */
-#include 
 #include "../../include/linux/atomisp_platform.h"
 #include 
 #include 
diff --git a/drivers/staging/media/atomisp/i2c/imx/otp_imx.c 
b/drivers/staging/media/atomisp/i2c/imx/otp_imx.c
index 1ca27c26ef75..279784cab6c3 100644
--- a/drivers/staging/media/atomisp/i2c/imx/otp_imx.c
+++ b/drivers/staging/media/atomisp/i2c/imx/otp_imx.c
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include "common.h"
 
 /* Defines for OTP Data Registers */
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index 73e15dd9d4d6..b0c647f4d250 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 
-#include 
 #include 
 
 #include 
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
index 1fe1711387a2..6c1eb417361d 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
@@ -29,8 +29,6 @@
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
index 717647951fb6..dd59167237c1 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 
-#include 
 
 #include 
 #include 
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c
index 744ab6eb42a0..d27a50e66be2 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
index 0896f5ea7e4e..e85b3819bffa 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 
-#include 
 #include 
 
 #include "../../include/linux/atomisp_gmin_platform.h"
diff --git 
a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h 
b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
index b730ab0e8223..3bc0de129780 100644
--- a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
+++ b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h
@@ -20,7 +20,6 @@
 #define _PLATFORM_VLV2_PLAT_CLK_H_
 
 #include 
-#include 
 
 extern void __init *vlv2_plat_clk_device_platform_data(
void *info) __attribute__((weak));
-- 
2.14.1



[PATCH v1 6/7] staging: atomisp: Remove dead code for MID (#4)

2017-09-01 Thread Andy Shevchenko
Since we switched to upstream IOSF MBI API the custom code become not in
use anymore.

Signed-off-by: Andy Shevchenko 
---
 .../atomisp/include/asm/intel_mid_pcihelpers.h | 22 -
 .../media/atomisp/pci/atomisp2/atomisp_internal.h  |  1 -
 .../media/atomisp/platform/intel-mid/Makefile  |  1 -
 .../platform/intel-mid/intel_mid_pcihelpers.c  | 98 --
 4 files changed, 122 deletions(-)
 delete mode 100644 
drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
 delete mode 100644 
drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c

diff --git a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h 
b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
deleted file mode 100644
index bf39f42c1c96..
--- a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Access to message bus through three registers
- * in CUNIT(0:0:0) PCI configuration space.
- * MSGBUS_CTRL_REG(0xD0):
- *   31:24  = message bus opcode
- *   23:16  = message bus port
- *   15:8   = message bus address, low 8 bits.
- *   7:4= message bus byte enables
- * MSGBUS_CTRL_EXT_REG(0xD8):
- *   31:8   = message bus address, high 24 bits.
- * MSGBUS_DATA_REG(0xD4):
- *   hold the data for write or read
- */
-#define PCI_ROOT_MSGBUS_CTRL_REG0xD0
-#define PCI_ROOT_MSGBUS_DATA_REG0xD4
-#define PCI_ROOT_MSGBUS_CTRL_EXT_REG0xD8
-#define PCI_ROOT_MSGBUS_READ0x10
-#define PCI_ROOT_MSGBUS_WRITE   0x11
-#define PCI_ROOT_MSGBUS_DWORD_ENABLE0xf0
-
-u32 intel_mid_msgbus_read32(u8 port, u32 addr);
-void intel_mid_msgbus_write32(u8 port, u32 addr, u32 data);
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
index 7542a72f1d0f..1fe1711387a2 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h
@@ -30,7 +30,6 @@
 #include 
 
 #include 
-#include "../../include/asm/intel_mid_pcihelpers.h"
 
 #include 
 #include 
diff --git a/drivers/staging/media/atomisp/platform/intel-mid/Makefile 
b/drivers/staging/media/atomisp/platform/intel-mid/Makefile
index 4621261c35db..c53db1364e21 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/Makefile
+++ b/drivers/staging/media/atomisp/platform/intel-mid/Makefile
@@ -1,5 +1,4 @@
 #
 # Makefile for intel-mid devices.
 #
-obj-$(CONFIG_INTEL_ATOMISP) += intel_mid_pcihelpers.o
 obj-$(CONFIG_INTEL_ATOMISP) += atomisp_gmin_platform.o
diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c 
b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
deleted file mode 100644
index 4ed3268c4e63..
--- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
+++ /dev/null
@@ -1,98 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-/* G-Min addition: "platform_is()" lives in intel_mid_pm.h in the MCG
- * tree, but it's just platform ID info and we don't want to pull in
- * the whole SFI-based PM architecture.
- */
-#define INTEL_ATOM_MRST 0x26
-#define INTEL_ATOM_MFLD 0x27
-#define INTEL_ATOM_CLV 0x35
-#define INTEL_ATOM_MRFLD 0x4a
-#define INTEL_ATOM_BYT 0x37
-#define INTEL_ATOM_MOORFLD 0x5a
-#define INTEL_ATOM_CHT 0x4c
-static inline int platform_is(u8 model)
-{
-   return (boot_cpu_data.x86_model == model);
-}
-
-#include "../../include/asm/intel_mid_pcihelpers.h"
-
-/* Unified message bus read/write operation */
-static DEFINE_SPINLOCK(msgbus_lock);
-
-static struct pci_dev *pci_root;
-static struct pm_qos_request pm_qos;
-
-#define DW_I2C_NEED_QOS(platform_is(INTEL_ATOM_BYT))
-
-static int intel_mid_msgbus_init(void)
-{
-   pci_root = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
-   if (!pci_root) {
-   pr_err("%s: Error: msgbus PCI handle NULL\n", __func__);
-   return -ENODEV;
-   }
-
-   if (DW_I2C_NEED_QOS) {
-   pm_qos_add_request(_qos,
-   PM_QOS_CPU_DMA_LATENCY,
-   PM_QOS_DEFAULT_VALUE);
-   }
-   return 0;
-}
-fs_initcall(intel_mid_msgbus_init);
-
-u32 intel_mid_msgbus_read32(u8 port, u32 addr)
-{
-   unsigned long irq_flags;
-   u32 data;
-   u32 cmd;
-   u32 cmdext;
-
-   cmd = (PCI_ROOT_MSGBUS_READ << 24) | (port << 16) |
-   ((addr & 0xff) << 8) | PCI_ROOT_MSGBUS_DWORD_ENABLE;
-   cmdext = addr & 0xff00;
-
-   spin_lock_irqsave(_lock, irq_flags);
-
-   if (cmdext) {
-   /* This resets to 0 automatically, no need to write 0 */
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_EXT_REG,
-   cmdext);
-   }
-
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd);
-   

[PATCH v1 1/7] staging: atomisp: Remove dead code for MID (#1)

2017-09-01 Thread Andy Shevchenko
Remove dead code. If someone needs it the P-Unit semaphore is handled by
I2C DesignWare driver (drivers/i2c/busses/i2c-designware-baytrail.c).

Signed-off-by: Andy Shevchenko 
---
 .../atomisp/include/asm/intel_mid_pcihelpers.h |   2 -
 .../platform/intel-mid/intel_mid_pcihelpers.c  | 101 -
 2 files changed, 103 deletions(-)

diff --git a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h 
b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
index c5e22bba455a..b7c079f3630a 100644
--- a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
+++ b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
@@ -33,5 +33,3 @@ void intel_mid_msgbus_write32(u8 port, u32 addr, u32 data);
 u32 intel_mid_msgbus_read32_raw_ext(u32 cmd, u32 cmd_ext);
 void intel_mid_msgbus_write32_raw_ext(u32 cmd, u32 cmd_ext, u32 data);
 u32 intel_mid_soc_stepping(void);
-int intel_mid_dw_i2c_acquire_ownership(void);
-int intel_mid_dw_i2c_release_ownership(void);
diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c 
b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
index cd452cc20fea..0d01a269989d 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
@@ -14,13 +14,6 @@
 #define INTEL_ATOM_BYT 0x37
 #define INTEL_ATOM_MOORFLD 0x5a
 #define INTEL_ATOM_CHT 0x4c
-/* synchronization for sharing the I2C controller */
-#define PUNIT_PORT 0x04
-#define PUNIT_DOORBELL_OPCODE  (0xE0)
-#define PUNIT_DOORBELL_REG (0x0)
-#ifndef CSTATE_EXIT_LATENCY
-#define CSTATE_EXIT_LATENCY_C1 1
-#endif
 static inline int platform_is(u8 model)
 {
return (boot_cpu_data.x86_model == model);
@@ -201,97 +194,3 @@ static void pci_d3_delay_fixup(struct pci_dev *dev)
}
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_d3_delay_fixup);
-
-#define PUNIT_SEMAPHORE(platform_is(INTEL_ATOM_BYT) ? 0x7 : 0x10E)
-#define GET_SEM() (intel_mid_msgbus_read32(PUNIT_PORT, PUNIT_SEMAPHORE) & 0x1)
-
-static void reset_semaphore(void)
-{
-   u32 data;
-
-   data = intel_mid_msgbus_read32(PUNIT_PORT, PUNIT_SEMAPHORE);
-   smp_mb();
-   data = data & 0xfffc;
-   intel_mid_msgbus_write32(PUNIT_PORT, PUNIT_SEMAPHORE, data);
-   smp_mb();
-
-}
-
-int intel_mid_dw_i2c_acquire_ownership(void)
-{
-   u32 ret = 0;
-   u32 data = 0; /* data sent to PUNIT */
-   u32 cmd;
-   u32 cmdext;
-   int timeout = 1000;
-
-   if (DW_I2C_NEED_QOS)
-   pm_qos_update_request(_qos, CSTATE_EXIT_LATENCY_C1 - 1);
-
-   /*
-* We need disable irq. Otherwise, the main thread
-* might be preempted and the other thread jumps to
-* disable irq for a long time. Another case is
-* some irq handlers might trigger power voltage change
-*/
-   BUG_ON(irqs_disabled());
-   local_irq_disable();
-
-   /* host driver writes 0x2 to side band register 0x7 */
-   intel_mid_msgbus_write32(PUNIT_PORT, PUNIT_SEMAPHORE, 0x2);
-   smp_mb();
-
-   /* host driver sends 0xE0 opcode to PUNIT and writes 0 register */
-   cmd = (PUNIT_DOORBELL_OPCODE << 24) | (PUNIT_PORT << 16) |
-   ((PUNIT_DOORBELL_REG & 0xFF) << 8) | PCI_ROOT_MSGBUS_DWORD_ENABLE;
-   cmdext = PUNIT_DOORBELL_REG & 0xff00;
-
-   if (cmdext)
-   intel_mid_msgbus_write32_raw_ext(cmd, cmdext, data);
-   else
-   intel_mid_msgbus_write32_raw(cmd, data);
-
-   /* host driver waits for bit 0 to be set in side band 0x7 */
-   while (GET_SEM() != 0x1) {
-   udelay(100);
-   timeout--;
-   if (timeout <= 0) {
-   pr_err("Timeout: semaphore timed out, reset sem\n");
-   ret = -ETIMEDOUT;
-   reset_semaphore();
-   /*Delay 1ms in case race with punit*/
-   udelay(1000);
-   if (GET_SEM() != 0) {
-   /*Reset again as kernel might race with punit*/
-   reset_semaphore();
-   }
-   pr_err("PUNIT SEM: %d\n",
-   intel_mid_msgbus_read32(PUNIT_PORT,
-   PUNIT_SEMAPHORE));
-   local_irq_enable();
-
-   if (DW_I2C_NEED_QOS) {
-   pm_qos_update_request(_qos,
-PM_QOS_DEFAULT_VALUE);
-   }
-
-   return ret;
-   }
-   }
-   smp_mb();
-
-   return ret;
-}
-EXPORT_SYMBOL(intel_mid_dw_i2c_acquire_ownership);
-
-int intel_mid_dw_i2c_release_ownership(void)
-{
-   reset_semaphore();
-   

[PATCH v1 4/7] staging: atomisp: Remove dead code for MID (#3)

2017-09-01 Thread Andy Shevchenko
intel_mid_msgbus_*_raw*() are not used anywhere.

Signed-off-by: Andy Shevchenko 
---
 .../atomisp/include/asm/intel_mid_pcihelpers.h |  4 --
 .../platform/intel-mid/intel_mid_pcihelpers.c  | 58 --
 2 files changed, 62 deletions(-)

diff --git a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h 
b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
index 5d8451ee391e..bf39f42c1c96 100644
--- a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
+++ b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
@@ -18,9 +18,5 @@
 #define PCI_ROOT_MSGBUS_WRITE   0x11
 #define PCI_ROOT_MSGBUS_DWORD_ENABLE0xf0
 
-u32 intel_mid_msgbus_read32_raw(u32 cmd);
 u32 intel_mid_msgbus_read32(u8 port, u32 addr);
-void intel_mid_msgbus_write32_raw(u32 cmd, u32 data);
 void intel_mid_msgbus_write32(u8 port, u32 addr, u32 data);
-u32 intel_mid_msgbus_read32_raw_ext(u32 cmd, u32 cmd_ext);
-void intel_mid_msgbus_write32_raw_ext(u32 cmd, u32 cmd_ext, u32 data);
diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c 
b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
index c34f461653db..4ed3268c4e63 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
@@ -46,64 +46,6 @@ static int intel_mid_msgbus_init(void)
 }
 fs_initcall(intel_mid_msgbus_init);
 
-u32 intel_mid_msgbus_read32_raw(u32 cmd)
-{
-   unsigned long irq_flags;
-   u32 data;
-
-   spin_lock_irqsave(_lock, irq_flags);
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd);
-   pci_read_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, );
-   spin_unlock_irqrestore(_lock, irq_flags);
-
-   return data;
-}
-EXPORT_SYMBOL(intel_mid_msgbus_read32_raw);
-
-/*
- * GU: this function is only used by the VISA and 'VXD' drivers.
- */
-u32 intel_mid_msgbus_read32_raw_ext(u32 cmd, u32 cmd_ext)
-{
-   unsigned long irq_flags;
-   u32 data;
-
-   spin_lock_irqsave(_lock, irq_flags);
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_EXT_REG, cmd_ext);
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd);
-   pci_read_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, );
-   spin_unlock_irqrestore(_lock, irq_flags);
-
-   return data;
-}
-EXPORT_SYMBOL(intel_mid_msgbus_read32_raw_ext);
-
-void intel_mid_msgbus_write32_raw(u32 cmd, u32 data)
-{
-   unsigned long irq_flags;
-
-   spin_lock_irqsave(_lock, irq_flags);
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, data);
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd);
-   spin_unlock_irqrestore(_lock, irq_flags);
-}
-EXPORT_SYMBOL(intel_mid_msgbus_write32_raw);
-
-/*
- * GU: this function is only used by the VISA and 'VXD' drivers.
- */
-void intel_mid_msgbus_write32_raw_ext(u32 cmd, u32 cmd_ext, u32 data)
-{
-   unsigned long irq_flags;
-
-   spin_lock_irqsave(_lock, irq_flags);
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, data);
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_EXT_REG, cmd_ext);
-   pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd);
-   spin_unlock_irqrestore(_lock, irq_flags);
-}
-EXPORT_SYMBOL(intel_mid_msgbus_write32_raw_ext);
-
 u32 intel_mid_msgbus_read32(u8 port, u32 addr)
 {
unsigned long irq_flags;
-- 
2.14.1



[PATCH v1 2/7] staging: atomisp: Don't override D3 delay settings here

2017-09-01 Thread Andy Shevchenko
The d3_delay parameter is set by arch/x86/pci/intel_mid_pci.c and
drivers/pci/quirks.c.

No need to override that settings in unrelated driver.

Signed-off-by: Andy Shevchenko 
---
 .../atomisp/include/asm/intel_mid_pcihelpers.h |  8 --
 .../platform/intel-mid/intel_mid_pcihelpers.c  | 33 --
 2 files changed, 41 deletions(-)

diff --git a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h 
b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
index b7c079f3630a..0d7f5c618b56 100644
--- a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
+++ b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h
@@ -18,14 +18,6 @@
 #define PCI_ROOT_MSGBUS_WRITE   0x11
 #define PCI_ROOT_MSGBUS_DWORD_ENABLE0xf0
 
-/* In BYT platform for all internal PCI devices d3 delay
- * of 3 ms is sufficient. Default value of 10 ms is overkill.
- */
-#define INTERNAL_PCI_PM_D3_WAIT3
-
-#define ISP_SUB_CLASS  0x80
-#define SUB_CLASS_MASK 0xFF00
-
 u32 intel_mid_msgbus_read32_raw(u32 cmd);
 u32 intel_mid_msgbus_read32(u8 port, u32 addr);
 void intel_mid_msgbus_write32_raw(u32 cmd, u32 data);
diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c 
b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
index 0d01a269989d..341bfd3ab313 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c
@@ -161,36 +161,3 @@ u32 intel_mid_soc_stepping(void)
return pci_root->revision;
 }
 EXPORT_SYMBOL(intel_mid_soc_stepping);
-
-static bool is_south_complex_device(struct pci_dev *dev)
-{
-   unsigned int base_class = dev->class >> 16;
-   unsigned int sub_class  = (dev->class & SUB_CLASS_MASK) >> 8;
-
-   /* other than camera, pci bridges and display,
-* everything else are south complex devices.
-*/
-   if (((base_class == PCI_BASE_CLASS_MULTIMEDIA) &&
-(sub_class == ISP_SUB_CLASS)) ||
-   (base_class == PCI_BASE_CLASS_BRIDGE) ||
-   ((base_class == PCI_BASE_CLASS_DISPLAY) && !sub_class))
-   return false;
-   else
-   return true;
-}
-
-/* In BYT platform, d3_delay for internal south complex devices,
- * they are not subject to 10 ms d3 to d0 delay required by pci spec.
- */
-static void pci_d3_delay_fixup(struct pci_dev *dev)
-{
-   if (platform_is(INTEL_ATOM_BYT) ||
-   platform_is(INTEL_ATOM_CHT)) {
-   /* All internal devices are in bus 0. */
-   if (dev->bus->number == 0 && is_south_complex_device(dev)) {
-   dev->d3_delay = INTERNAL_PCI_PM_D3_WAIT;
-   dev->d3cold_delay = INTERNAL_PCI_PM_D3_WAIT;
-   }
-   }
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_d3_delay_fixup);
-- 
2.14.1



[PATCH v2 17/27] media: net.rst: Fix the level of a section of the net chapter

2017-09-01 Thread Mauro Carvalho Chehab
Due to a mistake, the DVB net chapter was actually broken
into two different chapters. Fix it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/net.rst | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/media/uapi/dvb/net.rst 
b/Documentation/media/uapi/dvb/net.rst
index eca42dd53261..00ae5df0c321 100644
--- a/Documentation/media/uapi/dvb/net.rst
+++ b/Documentation/media/uapi/dvb/net.rst
@@ -28,7 +28,6 @@ header.
 
 .. _net_fcalls:
 
-##
 DVB net Function Calls
 ##
 
-- 
2.13.5



[PATCH v2 11/27] media: fe_property_parameters.rst: better document bandwidth

2017-09-01 Thread Mauro Carvalho Chehab
Use a table to document the supported bandwidths. That makes
it clearer to readers.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../media/uapi/dvb/fe_property_parameters.rst  | 44 +-
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/Documentation/media/uapi/dvb/fe_property_parameters.rst 
b/Documentation/media/uapi/dvb/fe_property_parameters.rst
index e085e84fef38..49470f7dda02 100644
--- a/Documentation/media/uapi/dvb/fe_property_parameters.rst
+++ b/Documentation/media/uapi/dvb/fe_property_parameters.rst
@@ -116,30 +116,38 @@ Should be set only for terrestrial delivery systems.
 Possible values: ``1712000``, ``500``, ``600``, ``700``,
 ``800``, ``1000``.
 
+=== ===
+Terrestrial Standard   Possible values for bandwidth
+=== ===
+ATSC (version 1)   No need to set. It is always 6MHz.
+DMTB   No need to set. It is always 8MHz.
+DVB-T  6MHz, 7MHz and 8MHz.
+DVB-T2 1.172 MHz, 5MHz, 6MHz, 7MHz, 8MHz and 10MHz
+ISDB-T 5MHz, 6MHz, 7MHz and 8MHz, although most places
+   use 6MHz.
+=== ===
+
+
 .. note::
 
-  #. DVB-T supports 6, 7 and 8MHz.
 
-  #. DVB-T2 supports 1.172, 5, 6, 7, 8 and 10MHz.
+  #. For ISDB-Tsb, the bandwidth can vary depending on the number of
+ connected segments.
 
-  #. ISDB-T supports 5MHz, 6MHz, 7MHz and 8MHz, although most
- places use 6MHz.
-
-  #. On DVB-C and DVB-S/S2, the bandwidth depends on the symbol rate.
- So, the Kernel will silently ignore setting :ref:`DTV-BANDWIDTH-HZ`.
-
-  #. For DVB-C and DVB-S/S2, the Kernel will return an estimation of the
- bandwidth, calculated from :ref:`DTV-SYMBOL-RATE` and from
- the rolloff, with is fixed for DVB-C and DVB-S.
-
-  #. For DVB-S2, the bandwidth estimation will use :ref:`DTV-ROLLOFF`.
-
-  #. For ISDB-Tsb, it can vary depending on the number of connected
- segments.
-
-  #. Bandwidth in ISDB-Tsb can be easily derived from other parameters
+ It can be easily derived from other parameters
  (DTV_ISDBT_SB_SEGMENT_IDX, DTV_ISDBT_SB_SEGMENT_COUNT).
 
+  #. On Satellite and Cable delivery systems, the bandwidth depends on
+ the symbol rate. So, the Kernel will silently ignore any setting
+ :ref:`DTV-BANDWIDTH-HZ`. I will however fill it back with a
+ bandwidth estimation.
+
+ Such bandwidth estimation takes into account the symbol rate set with
+ :ref:`DTV-SYMBOL-RATE`, and the rolloff factor, with is fixed for
+ DVB-C and DVB-S.
+
+ For DVB-S2, the rolloff should also be set via :ref:`DTV-ROLLOFF`.
+
 
 .. _DTV-INVERSION:
 
-- 
2.13.5



[PATCH v2 02/27] media: dmx.h: split typedefs from structs

2017-09-01 Thread Mauro Carvalho Chehab
Using typedefs inside the Kernel is against CodingStyle, and
there's no good usage here.

Just like we did at frontend.h, at changeset 0df289a209e0
("[media] dvb: Get rid of typedev usage for enums"), let's keep
those typedefs only to provide userspace backward compatibility.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/dvb-core/dmxdev.c |  4 +--
 include/uapi/linux/dvb/dmx.h| 56 -
 2 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
index 45e91add73ba..16b0b74c3114 100644
--- a/drivers/media/dvb-core/dmxdev.c
+++ b/drivers/media/dvb-core/dmxdev.c
@@ -562,7 +562,7 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev,
 {
ktime_t timeout = 0;
struct dmx_pes_filter_params *para = >params.pes;
-   dmx_output_t otype;
+   enum dmx_output otype;
int ret;
int ts_type;
enum dmx_ts_pes ts_pes;
@@ -787,7 +787,7 @@ static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev,
return 0;
 }
 
-static inline void invert_mode(dmx_filter_t *filter)
+static inline void invert_mode(struct dmx_filter *filter)
 {
int i;
 
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
index 427e4899ed69..1bc4d6fb0f01 100644
--- a/include/uapi/linux/dvb/dmx.h
+++ b/include/uapi/linux/dvb/dmx.h
@@ -43,16 +43,14 @@ enum dmx_output
DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */
 };
 
-typedef enum dmx_output dmx_output_t;
-
-typedef enum dmx_input
+enum dmx_input
 {
DMX_IN_FRONTEND, /* Input from a front-end device.  */
DMX_IN_DVR   /* Input from the logical DVR device.  */
-} dmx_input_t;
+};
 
 
-typedef enum dmx_ts_pes
+enum dmx_ts_pes
 {
DMX_PES_AUDIO0,
DMX_PES_VIDEO0,
@@ -79,7 +77,7 @@ typedef enum dmx_ts_pes
DMX_PES_PCR3,
 
DMX_PES_OTHER
-} dmx_pes_type_t;
+};
 
 #define DMX_PES_AUDIODMX_PES_AUDIO0
 #define DMX_PES_VIDEODMX_PES_VIDEO0
@@ -88,20 +86,20 @@ typedef enum dmx_ts_pes
 #define DMX_PES_PCR  DMX_PES_PCR0
 
 
-typedef struct dmx_filter
+struct dmx_filter
 {
__u8  filter[DMX_FILTER_SIZE];
__u8  mask[DMX_FILTER_SIZE];
__u8  mode[DMX_FILTER_SIZE];
-} dmx_filter_t;
+};
 
 
 struct dmx_sct_filter_params
 {
-   __u16  pid;
-   dmx_filter_t   filter;
-   __u32  timeout;
-   __u32  flags;
+   __u16 pid;
+   struct dmx_filter filter;
+   __u32 timeout;
+   __u32 flags;
 #define DMX_CHECK_CRC   1
 #define DMX_ONESHOT 2
 #define DMX_IMMEDIATE_START 4
@@ -111,19 +109,19 @@ struct dmx_sct_filter_params
 
 struct dmx_pes_filter_params
 {
-   __u16  pid;
-   dmx_input_tinput;
-   dmx_output_t   output;
-   dmx_pes_type_t pes_type;
-   __u32  flags;
+   __u16   pid;
+   enum dmx_input  input;
+   enum dmx_output output;
+   enum dmx_ts_pes pes_type;
+   __u32   flags;
 };
 
-typedef struct dmx_caps {
+struct dmx_caps {
__u32 caps;
int num_decoders;
-} dmx_caps_t;
+};
 
-typedef enum dmx_source {
+enum dmx_source {
DMX_SOURCE_FRONT0 = 0,
DMX_SOURCE_FRONT1,
DMX_SOURCE_FRONT2,
@@ -132,7 +130,7 @@ typedef enum dmx_source {
DMX_SOURCE_DVR1,
DMX_SOURCE_DVR2,
DMX_SOURCE_DVR3
-} dmx_source_t;
+};
 
 struct dmx_stc {
unsigned int num;   /* input : which STC? 0..N */
@@ -146,10 +144,22 @@ struct dmx_stc {
 #define DMX_SET_PES_FILTER   _IOW('o', 44, struct dmx_pes_filter_params)
 #define DMX_SET_BUFFER_SIZE  _IO('o', 45)
 #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
-#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
-#define DMX_SET_SOURCE   _IOW('o', 49, dmx_source_t)
+#define DMX_GET_CAPS _IOR('o', 48, struct dmx_caps)
+#define DMX_SET_SOURCE   _IOW('o', 49, enum dmx_source)
 #define DMX_GET_STC  _IOWR('o', 50, struct dmx_stc)
 #define DMX_ADD_PID  _IOW('o', 51, __u16)
 #define DMX_REMOVE_PID   _IOW('o', 52, __u16)
 
+#if !defined (__KERNEL__)
+
+/* This is needed for legacy userspace support */
+typedef enum dmx_output dmx_output_t;
+typedef enum dmx_input dmx_input_t;
+typedef enum dmx_ts_pes dmx_pes_type_t;
+typedef struct dmx_filter dmx_filter_t;
+typedef struct dmx_caps dmx_caps_t;
+typedef enum dmx_source  dmx_source_t;
+
+#endif
+
 #endif /* _UAPI_DVBDMX_H_ */
-- 
2.13.5



[PATCH v2 10/27] media: fe_property_parameters.rst: better define properties usage

2017-09-01 Thread Mauro Carvalho Chehab
Several frontend properties are specific to a subset of the
delivery systems. Make it clearer when describing each
property.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../media/uapi/dvb/fe_property_parameters.rst  | 82 --
 1 file changed, 75 insertions(+), 7 deletions(-)

diff --git a/Documentation/media/uapi/dvb/fe_property_parameters.rst 
b/Documentation/media/uapi/dvb/fe_property_parameters.rst
index c6eb74f59b00..e085e84fef38 100644
--- a/Documentation/media/uapi/dvb/fe_property_parameters.rst
+++ b/Documentation/media/uapi/dvb/fe_property_parameters.rst
@@ -111,6 +111,8 @@ DTV_BANDWIDTH_HZ
 
 Bandwidth for the channel, in HZ.
 
+Should be set only for terrestrial delivery systems.
+
 Possible values: ``1712000``, ``500``, ``600``, ``700``,
 ``800``, ``1000``.
 
@@ -148,6 +150,7 @@ Specifies if the frontend should do spectral inversion or 
not.
 
 The acceptable values are defined by :c:type:`fe_spectral_inversion`.
 
+
 .. _DTV-DISEQC-MASTER:
 
 DTV_DISEQC_MASTER
@@ -161,8 +164,9 @@ Currently not implemented.
 DTV_SYMBOL_RATE
 ===
 
-Digital TV symbol rate, in bauds (symbols/second). Used on cable
-standards.
+Used on cable and satellite delivery systems.
+
+Digital TV symbol rate, in bauds (symbols/second).
 
 
 .. _DTV-INNER-FEC:
@@ -170,7 +174,7 @@ standards.
 DTV_INNER_FEC
 =
 
-Used cable/satellite transmissions.
+Used on cable and satellite delivery systems.
 
 The acceptable values are defined by :c:type:`fe_code_rate`.
 
@@ -180,6 +184,8 @@ The acceptable values are defined by :c:type:`fe_code_rate`.
 DTV_VOLTAGE
 ===
 
+Used on satellite delivery systems.
+
 The voltage is usually used with non-DiSEqC capable LNBs to switch the
 polarzation (horizontal/vertical). When using DiSEqC epuipment this
 voltage has to be switched consistently to the DiSEqC commands as
@@ -201,6 +207,8 @@ Currently not used.
 DTV_PILOT
 =
 
+Used on DVB-S2.
+
 Sets DVB-S2 pilot.
 
 The acceptable values are defined by :c:type:`fe_pilot`.
@@ -211,7 +219,9 @@ The acceptable values are defined by :c:type:`fe_pilot`.
 DTV_ROLLOFF
 ===
 
-Sets DVB-S2 rolloff
+Used on DVB-S2.
+
+Sets DVB-S2 rolloff.
 
 The acceptable values are defined by :c:type:`fe_rolloff`.
 
@@ -245,7 +255,7 @@ Currently not implemented.
 DTV_DELIVERY_SYSTEM
 ===
 
-Specifies the type of Delivery system.
+Specifies the type of the delivery system.
 
 The acceptable values are defined by :c:type:`fe_delivery_system`.
 
@@ -255,6 +265,8 @@ The acceptable values are defined by 
:c:type:`fe_delivery_system`.
 DTV_ISDBT_PARTIAL_RECEPTION
 ===
 
+Used only on ISDB.
+
 If ``DTV_ISDBT_SOUND_BROADCASTING`` is '0' this bit-field represents
 whether the channel is in partial reception mode or not.
 
@@ -273,6 +285,8 @@ Possible values: 0, 1, -1 (AUTO)
 DTV_ISDBT_SOUND_BROADCASTING
 
 
+Used only on ISDB.
+
 This field represents whether the other DTV_ISDBT_*-parameters are
 referring to an ISDB-T and an ISDB-Tsb channel. (See also
 ``DTV_ISDBT_PARTIAL_RECEPTION``).
@@ -285,6 +299,8 @@ Possible values: 0, 1, -1 (AUTO)
 DTV_ISDBT_SB_SUBCHANNEL_ID
 ==
 
+Used only on ISDB.
+
 This field only applies if ``DTV_ISDBT_SOUND_BROADCASTING`` is '1'.
 
 (Note of the author: This might not be the correct description of the
@@ -320,6 +336,8 @@ Possible values: 0 .. 41, -1 (AUTO)
 DTV_ISDBT_SB_SEGMENT_IDX
 
 
+Used only on ISDB.
+
 This field only applies if ``DTV_ISDBT_SOUND_BROADCASTING`` is '1'.
 
 ``DTV_ISDBT_SB_SEGMENT_IDX`` gives the index of the segment to be
@@ -336,6 +354,8 @@ Note: This value cannot be determined by an automatic 
channel search.
 DTV_ISDBT_SB_SEGMENT_COUNT
 ==
 
+Used only on ISDB.
+
 This field only applies if ``DTV_ISDBT_SOUND_BROADCASTING`` is '1'.
 
 ``DTV_ISDBT_SB_SEGMENT_COUNT`` gives the total count of connected
@@ -351,6 +371,8 @@ Note: This value cannot be determined by an automatic 
channel search.
 DTV-ISDBT-LAYER[A-C] parameters
 ===
 
+Used only on ISDB.
+
 ISDB-T channels can be coded hierarchically. As opposed to DVB-T in
 ISDB-T hierarchical layers can be decoded simultaneously. For that
 reason a ISDB-T demodulator has 3 Viterbi and 3 Reed-Solomon decoders.
@@ -367,6 +389,8 @@ There are 3 parameter sets, for Layers A, B and C.
 DTV_ISDBT_LAYER_ENABLED
 ---
 
+Used only on ISDB.
+
 Hierarchical reception in ISDB-T is achieved by enabling or disabling
 layers in the decoding process. Setting all bits of
 ``DTV_ISDBT_LAYER_ENABLED`` to '1' forces all layers (if applicable) to
@@ -397,6 +421,8 @@ Only the values of the first 3 bits are used. Other bits 
will be silently ignore
 DTV_ISDBT_LAYER[A-C]_FEC
 
 
+Used only on ISDB.
+
 The Forward Error Correction mechanism used by a given ISDB Layer, as
 defined by 

[PATCH v2 23/27] media: ca-get-slot-info.rst: document this ioctl

2017-09-01 Thread Mauro Carvalho Chehab
Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca-get-slot-info.rst | 98 +++
 1 file changed, 11 insertions(+), 87 deletions(-)

diff --git a/Documentation/media/uapi/dvb/ca-get-slot-info.rst 
b/Documentation/media/uapi/dvb/ca-get-slot-info.rst
index 54e5dc78a2dc..d7e41e038ca7 100644
--- a/Documentation/media/uapi/dvb/ca-get-slot-info.rst
+++ b/Documentation/media/uapi/dvb/ca-get-slot-info.rst
@@ -26,100 +26,24 @@ Arguments
   File descriptor returned by a previous call to :c:func:`open() `.
 
 ``info``
-  Pointer to struct c:type:`ca_slot_info`.
-
-.. _ca_slot_info_type:
-
-.. flat-table:: ca_slot_info types
-:header-rows:  1
-:stub-columns: 0
-
--
-  - type
-  - name
-  - description
--
-   - CA_CI
-   - 1
-   - CI high level interface
-
--
-   - CA_CI_LINK
-   - 2
-   - CI link layer level interface
-
--
-   - CA_CI_PHYS
-   - 4
-   - CI physical layer level interface
-
--
-   - CA_DESCR
-   - 8
-   - built-in descrambler
-
--
-   - CA_SC
-   - 128
-   - simple smart card interface
-
-.. _ca_slot_info_flag:
-
-.. flat-table:: ca_slot_info flags
-:header-rows:  1
-:stub-columns: 0
-
--
-  - type
-  - name
-  - description
-
--
-   - CA_CI_MODULE_PRESENT
-   - 1
-   - module (or card) inserted
-
--
-   - CA_CI_MODULE_READY
-   - 2
-   -
-
-.. c:type:: ca_slot_info
-
-.. flat-table:: struct ca_slot_info
-:header-rows:  1
-:stub-columns: 0
-
--
-  - type
-  - name
-  - description
-
--
-   - int
-   - num
-   - slot number
-
--
-   - int
-   - type
-   - CA interface this slot supports, as defined at 
:ref:`ca_slot_info_type`.
-
--
-   - unsigned int
-   - flags
-   - flags as defined at :ref:`ca_slot_info_flag`.
-
+  Pointer to struct :c:type:`ca_slot_info`.
 
 Description
 ---
 
-.. note:: This ioctl is undocumented. Documentation is welcome.
+Returns information about a CA slot identified by
+:c:type:`ca_slot_info`.slot_num.
 
 
 Return Value
 
 
-On success 0 is returned, on error -1 and the ``errno`` variable is set
-appropriately. The generic error codes are described at the
+On success 0 is returned, and :c:type:`ca_slot_info` is filled.
+
+On error -1 is returned, and the ``errno`` variable is set
+appropriately.
+
+If the slot is not available, ``errno`` will contain ``-EINVAL``.
+
+The generic error codes are described at the
 :ref:`Generic Error Codes ` chapter.
-- 
2.13.5



[PATCH v2 12/27] media: dmx.h: get rid of unused DMX_KERNEL_CLIENT

2017-09-01 Thread Mauro Carvalho Chehab
There's a flag defined for Digital TV demux that is not used
anywhere, called DMX_KERNEL_CLIENT. Get rid of it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/dmx.h.rst.exceptions   | 1 -
 Documentation/media/uapi/dvb/dmx_types.rst | 1 -
 include/uapi/linux/dvb/dmx.h   | 1 -
 3 files changed, 3 deletions(-)

diff --git a/Documentation/media/dmx.h.rst.exceptions 
b/Documentation/media/dmx.h.rst.exceptions
index 2fdb458564ba..933ca5a61ce1 100644
--- a/Documentation/media/dmx.h.rst.exceptions
+++ b/Documentation/media/dmx.h.rst.exceptions
@@ -56,7 +56,6 @@ replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source`
 replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
 replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
 replace define DMX_IMMEDIATE_START :c:type:`dmx_sct_filter_params`
-replace define DMX_KERNEL_CLIENT :c:type:`dmx_sct_filter_params`
 
 # some typedefs should point to struct/enums
 replace typedef dmx_caps_t :c:type:`dmx_caps`
diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
b/Documentation/media/uapi/dvb/dmx_types.rst
index 80dd659860d7..0f0113205c94 100644
--- a/Documentation/media/uapi/dvb/dmx_types.rst
+++ b/Documentation/media/uapi/dvb/dmx_types.rst
@@ -147,7 +147,6 @@ struct dmx_sct_filter_params
 #define DMX_CHECK_CRC   1
 #define DMX_ONESHOT 2
 #define DMX_IMMEDIATE_START 4
-#define DMX_KERNEL_CLIENT   0x8000
 };
 
 
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
index 1bc4d6fb0f01..1702f923d425 100644
--- a/include/uapi/linux/dvb/dmx.h
+++ b/include/uapi/linux/dvb/dmx.h
@@ -103,7 +103,6 @@ struct dmx_sct_filter_params
 #define DMX_CHECK_CRC   1
 #define DMX_ONESHOT 2
 #define DMX_IMMEDIATE_START 4
-#define DMX_KERNEL_CLIENT   0x8000
 };
 
 
-- 
2.13.5



[PATCH v2 18/27] media: ca.h: get rid of CA_SET_PID

2017-09-01 Thread Mauro Carvalho Chehab
This ioctl seems to be some attempt to support a feature
at the bt8xx dst_ca driver. Yet, as said there, it
"needs more work". Right now, the code there is just
a boilerplate.

At the end of the day, no driver uses this ioctl, nor it is
documented anywhere (except for "needs more work").

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/ca.h.rst.exceptions|  1 -
 Documentation/media/dvb-drivers/ci.rst |  1 -
 Documentation/media/uapi/dvb/ca-set-pid.rst| 60 --
 Documentation/media/uapi/dvb/ca_data_types.rst | 14 -
 Documentation/media/uapi/dvb/ca_function_calls.rst |  1 -
 drivers/media/pci/bt8xx/dst_ca.c   | 16 --
 include/uapi/linux/dvb/ca.h|  7 ---
 7 files changed, 100 deletions(-)
 delete mode 100644 Documentation/media/uapi/dvb/ca-set-pid.rst

diff --git a/Documentation/media/ca.h.rst.exceptions 
b/Documentation/media/ca.h.rst.exceptions
index d7c9fed8c004..553559cc6ad7 100644
--- a/Documentation/media/ca.h.rst.exceptions
+++ b/Documentation/media/ca.h.rst.exceptions
@@ -16,7 +16,6 @@ replace define CA_NDS :c:type:`ca_descr_info`
 replace define CA_DSS :c:type:`ca_descr_info`
 
 # some typedefs should point to struct/enums
-replace typedef ca_pid_t :c:type:`ca_pid`
 replace typedef ca_slot_info_t :c:type:`ca_slot_info`
 replace typedef ca_descr_info_t :c:type:`ca_descr_info`
 replace typedef ca_caps_t :c:type:`ca_caps`
diff --git a/Documentation/media/dvb-drivers/ci.rst 
b/Documentation/media/dvb-drivers/ci.rst
index 69b07e9d1816..87f3748c49b9 100644
--- a/Documentation/media/dvb-drivers/ci.rst
+++ b/Documentation/media/dvb-drivers/ci.rst
@@ -143,7 +143,6 @@ All these ioctls are also valid for the High level CI 
interface
 #define CA_GET_MSG_IOR('o', 132, ca_msg_t)
 #define CA_SEND_MSG   _IOW('o', 133, ca_msg_t)
 #define CA_SET_DESCR  _IOW('o', 134, ca_descr_t)
-#define CA_SET_PID_IOW('o', 135, ca_pid_t)
 
 
 On querying the device, the device yields information thus:
diff --git a/Documentation/media/uapi/dvb/ca-set-pid.rst 
b/Documentation/media/uapi/dvb/ca-set-pid.rst
deleted file mode 100644
index 891c1c72ef24..
--- a/Documentation/media/uapi/dvb/ca-set-pid.rst
+++ /dev/null
@@ -1,60 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _CA_SET_PID:
-
-==
-CA_SET_PID
-==
-
-Name
-
-
-CA_SET_PID
-
-
-Synopsis
-
-
-.. c:function:: int ioctl(fd, CA_SET_PID, struct ca_pid *pid)
-:name: CA_SET_PID
-
-
-Arguments
--
-
-``fd``
-  File descriptor returned by a previous call to :c:func:`open() 
`.
-
-``pid``
-  Pointer to struct :c:type:`ca_pid`.
-
-.. c:type:: ca_pid
-
-.. flat-table:: struct ca_pid
-:header-rows:  1
-:stub-columns: 0
-
--
-   - unsigned int
-   - pid
-   - Program ID
-
--
-   - int
-   - index
-   - PID index. Use -1 to disable.
-
-
-
-Description

-
-.. note:: This ioctl is undocumented. Documentation is welcome.
-
-
-Return Value
-
-
-On success 0 is returned, on error -1 and the ``errno`` variable is set
-appropriately. The generic error codes are described at the
-:ref:`Generic Error Codes ` chapter.
diff --git a/Documentation/media/uapi/dvb/ca_data_types.rst 
b/Documentation/media/uapi/dvb/ca_data_types.rst
index d9e27c77426c..555b5137936b 100644
--- a/Documentation/media/uapi/dvb/ca_data_types.rst
+++ b/Documentation/media/uapi/dvb/ca_data_types.rst
@@ -94,17 +94,3 @@ ca_descr_t
unsigned int parity;
unsigned char cw[8];
 } ca_descr_t;
-
-
-.. c:type:: ca_pid
-
-ca-pid
-==
-
-
-.. code-block:: c
-
-typedef struct ca_pid {
-   unsigned int pid;
-   int index;  /* -1 == disable*/
-} ca_pid_t;
diff --git a/Documentation/media/uapi/dvb/ca_function_calls.rst 
b/Documentation/media/uapi/dvb/ca_function_calls.rst
index c085a0ebbc05..87d697851e82 100644
--- a/Documentation/media/uapi/dvb/ca_function_calls.rst
+++ b/Documentation/media/uapi/dvb/ca_function_calls.rst
@@ -18,4 +18,3 @@ CA Function Calls
 ca-get-msg
 ca-send-msg
 ca-set-descr
-ca-set-pid
diff --git a/drivers/media/pci/bt8xx/dst_ca.c b/drivers/media/pci/bt8xx/dst_ca.c
index 90f4263452d3..7db47d8bbe15 100644
--- a/drivers/media/pci/bt8xx/dst_ca.c
+++ b/drivers/media/pci/bt8xx/dst_ca.c
@@ -64,13 +64,6 @@ static int ca_set_slot_descr(void)
return -EOPNOTSUPP;
 }
 
-/* Need some more work */
-static int ca_set_pid(void)
-{
-   /*  We could make this more graceful ?  */
-   return -EOPNOTSUPP;
-}
-
 static void put_command_and_length(u8 *data, int command, int length)
 {
data[0] = (command >> 16) & 0xff;
@@ -629,15 +622,6 @@ static long dst_ca_ioctl(struct file *file, unsigned int 
cmd, unsigned long ioct
}
dprintk(verbose, DST_CA_INFO, 1, " -->CA_SET_DESCR Success !");
break;
-   case 

[PATCH v2 16/27] media: dmx.h: add kernel-doc markups and use it at Documentation/

2017-09-01 Thread Mauro Carvalho Chehab
The demux documentation is pretty poor nowadays: most of the
structs and enums aren't documented at all.

Add proper kernel-doc markups for them and use it.

Now, the demux API is fully documented :-)

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/dmx.h.rst.exceptions   |   5 +
 Documentation/media/uapi/dvb/dmx_types.rst | 173 +
 include/uapi/linux/dvb/dmx.h   | 139 ++-
 3 files changed, 120 insertions(+), 197 deletions(-)

diff --git a/Documentation/media/dmx.h.rst.exceptions 
b/Documentation/media/dmx.h.rst.exceptions
index d2dac35bb84b..629db384104a 100644
--- a/Documentation/media/dmx.h.rst.exceptions
+++ b/Documentation/media/dmx.h.rst.exceptions
@@ -49,3 +49,8 @@ replace define DMX_IMMEDIATE_START 
:c:type:`dmx_sct_filter_params`
 replace typedef dmx_filter_t :c:type:`dmx_filter`
 replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
 replace typedef dmx_input_t :c:type:`dmx_input`
+
+ignore symbol DMX_OUT_DECODER
+ignore symbol DMX_OUT_TAP
+ignore symbol DMX_OUT_TS_TAP
+ignore symbol DMX_OUT_TSDEMUX_TAP
diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
b/Documentation/media/uapi/dvb/dmx_types.rst
index 171205ed86a4..2a023a4f516c 100644
--- a/Documentation/media/uapi/dvb/dmx_types.rst
+++ b/Documentation/media/uapi/dvb/dmx_types.rst
@@ -6,175 +6,4 @@
 Demux Data Types
 
 
-Output for the demux
-
-
-.. c:type:: dmx_output
-
-.. tabularcolumns:: |p{5.0cm}|p{12.5cm}|
-
-.. flat-table:: enum dmx_output
-:header-rows:  1
-:stub-columns: 0
-
-
--  .. row 1
-
-   -  ID
-
-   -  Description
-
--  .. row 2
-
-   -  .. _DMX-OUT-DECODER:
-
- DMX_OUT_DECODER
-
-   -  Streaming directly to decoder.
-
--  .. row 3
-
-   -  .. _DMX-OUT-TAP:
-
- DMX_OUT_TAP
-
-   -  Output going to a memory buffer (to be retrieved via the read
- command). Delivers the stream output to the demux device on which
- the ioctl is called.
-
--  .. row 4
-
-   -  .. _DMX-OUT-TS-TAP:
-
- DMX_OUT_TS_TAP
-
-   -  Output multiplexed into a new TS (to be retrieved by reading from
- the logical DVR device). Routes output to the logical DVR device
- ``/dev/dvb/adapter?/dvr?``, which delivers a TS multiplexed from
- all filters for which ``DMX_OUT_TS_TAP`` was specified.
-
--  .. row 5
-
-   -  .. _DMX-OUT-TSDEMUX-TAP:
-
- DMX_OUT_TSDEMUX_TAP
-
-   -  Like :ref:`DMX_OUT_TS_TAP ` but retrieved
- from the DMX device.
-
-
-dmx_input_t
-===
-
-.. c:type:: dmx_input
-
-.. code-block:: c
-
-typedef enum
-{
-   DMX_IN_FRONTEND, /* Input from a front-end device.  */
-   DMX_IN_DVR   /* Input from the logical DVR device.  */
-} dmx_input_t;
-
-
-dmx_pes_type_t
-==
-
-.. c:type:: dmx_pes_type
-
-
-.. code-block:: c
-
-typedef enum
-{
-   DMX_PES_AUDIO0,
-   DMX_PES_VIDEO0,
-   DMX_PES_TELETEXT0,
-   DMX_PES_SUBTITLE0,
-   DMX_PES_PCR0,
-
-   DMX_PES_AUDIO1,
-   DMX_PES_VIDEO1,
-   DMX_PES_TELETEXT1,
-   DMX_PES_SUBTITLE1,
-   DMX_PES_PCR1,
-
-   DMX_PES_AUDIO2,
-   DMX_PES_VIDEO2,
-   DMX_PES_TELETEXT2,
-   DMX_PES_SUBTITLE2,
-   DMX_PES_PCR2,
-
-   DMX_PES_AUDIO3,
-   DMX_PES_VIDEO3,
-   DMX_PES_TELETEXT3,
-   DMX_PES_SUBTITLE3,
-   DMX_PES_PCR3,
-
-   DMX_PES_OTHER
-} dmx_pes_type_t;
-
-
-struct dmx_filter
-=
-
-.. c:type:: dmx_filter
-
-.. code-block:: c
-
- typedef struct dmx_filter
-{
-   __u8  filter[DMX_FILTER_SIZE];
-   __u8  mask[DMX_FILTER_SIZE];
-   __u8  mode[DMX_FILTER_SIZE];
-} dmx_filter_t;
-
-
-.. c:type:: dmx_sct_filter_params
-
-struct dmx_sct_filter_params
-
-
-
-.. code-block:: c
-
-struct dmx_sct_filter_params
-{
-   __u16  pid;
-   dmx_filter_t   filter;
-   __u32  timeout;
-   __u32  flags;
-#define DMX_CHECK_CRC   1
-#define DMX_ONESHOT 2
-#define DMX_IMMEDIATE_START 4
-};
-
-
-struct dmx_pes_filter_params
-
-
-.. c:type:: dmx_pes_filter_params
-
-.. code-block:: c
-
-struct dmx_pes_filter_params
-{
-   __u16  pid;
-   dmx_input_tinput;
-   dmx_output_t   output;
-   dmx_pes_type_t pes_type;
-   __u32  flags;
-};
-
-struct dmx_stc
-==
-
-.. c:type:: dmx_stc
-
-.. code-block:: c
-
-struct dmx_stc {
-   unsigned int num;   /* input : which STC? 0..N */
-   unsigned int base;  /* output: divisor for stc to get 90 kHz clock */
-   __u64 stc;  /* output: stc in 'base'*90 kHz units */
-};
+.. kernel-doc:: include/uapi/linux/dvb/dmx.h
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
index 08dc17060321..867177b62d68 100644
--- 

[PATCH v2 09/27] media: dvb frontend docs: use kernel-doc documentation

2017-09-01 Thread Mauro Carvalho Chehab
Now that frontend.h contains most documentation for the frontend,
remove the duplicated information from Documentation/ and use the
kernel-doc auto-generated one instead.

That should simplify maintainership of DVB frontend uAPI, as most
of the documentation will stick with the header file.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/frontend.h.rst.exceptions  |  185 ++-
 Documentation/media/uapi/dvb/dtv-fe-stats.rst  |   17 -
 Documentation/media/uapi/dvb/dtv-properties.rst|   15 -
 Documentation/media/uapi/dvb/dtv-property.rst  |   31 -
 Documentation/media/uapi/dvb/dtv-stats.rst |   18 -
 Documentation/media/uapi/dvb/dvbproperty-006.rst   |   12 -
 Documentation/media/uapi/dvb/dvbproperty.rst   |   28 +-
 .../media/uapi/dvb/fe-diseqc-recv-slave-reply.rst  |   40 +-
 .../media/uapi/dvb/fe-diseqc-send-burst.rst|   31 +-
 .../media/uapi/dvb/fe-diseqc-send-master-cmd.rst   |   29 +-
 Documentation/media/uapi/dvb/fe-get-info.rst   |  370 +-
 Documentation/media/uapi/dvb/fe-get-property.rst   |2 +-
 Documentation/media/uapi/dvb/fe-read-status.rst|   83 --
 Documentation/media/uapi/dvb/fe-set-tone.rst   |   30 -
 .../media/uapi/dvb/fe_property_parameters.rst  | 1277 ++--
 Documentation/media/uapi/dvb/frontend-header.rst   |4 +
 include/uapi/linux/dvb/frontend.h  |8 +-
 17 files changed, 317 insertions(+), 1863 deletions(-)
 delete mode 100644 Documentation/media/uapi/dvb/dtv-fe-stats.rst
 delete mode 100644 Documentation/media/uapi/dvb/dtv-properties.rst
 delete mode 100644 Documentation/media/uapi/dvb/dtv-property.rst
 delete mode 100644 Documentation/media/uapi/dvb/dtv-stats.rst
 delete mode 100644 Documentation/media/uapi/dvb/dvbproperty-006.rst
 create mode 100644 Documentation/media/uapi/dvb/frontend-header.rst

diff --git a/Documentation/media/frontend.h.rst.exceptions 
b/Documentation/media/frontend.h.rst.exceptions
index 7656770f1936..f7c4df620a52 100644
--- a/Documentation/media/frontend.h.rst.exceptions
+++ b/Documentation/media/frontend.h.rst.exceptions
@@ -25,19 +25,9 @@ ignore define DTV_MAX_COMMAND
 ignore define MAX_DTV_STATS
 ignore define DTV_IOCTL_MAX_MSGS
 
-# Stats enum is documented altogether
-replace enum fecap_scale_params :ref:`frontend-stat-properties`
-replace symbol FE_SCALE_COUNTER frontend-stat-properties
-replace symbol FE_SCALE_DECIBEL frontend-stat-properties
-replace symbol FE_SCALE_NOT_AVAILABLE frontend-stat-properties
-replace symbol FE_SCALE_RELATIVE frontend-stat-properties
-
 # the same reference is used for both get and set ioctls
 replace ioctl FE_SET_PROPERTY :c:type:`FE_GET_PROPERTY`
 
-# Ignore struct used only internally at Kernel
-ignore struct dtv_cmds_h
-
 # Typedefs that use the enum reference
 replace typedef fe_sec_voltage_t :c:type:`fe_sec_voltage`
 
@@ -45,3 +35,178 @@ replace typedef fe_sec_voltage_t :c:type:`fe_sec_voltage`
 replace define FE_TUNE_MODE_ONESHOT :c:func:`FE_SET_FRONTEND_TUNE_MODE`
 replace define LNA_AUTO dtv-lna
 replace define NO_STREAM_ID_FILTER dtv-stream-id
+
+# Those enums are defined at the frontend.h header, and not externally
+
+ignore symbol FE_IS_STUPID
+ignore symbol FE_CAN_INVERSION_AUTO
+ignore symbol FE_CAN_FEC_1_2
+ignore symbol FE_CAN_FEC_2_3
+ignore symbol FE_CAN_FEC_3_4
+ignore symbol FE_CAN_FEC_4_5
+ignore symbol FE_CAN_FEC_5_6
+ignore symbol FE_CAN_FEC_6_7
+ignore symbol FE_CAN_FEC_7_8
+ignore symbol FE_CAN_FEC_8_9
+ignore symbol FE_CAN_FEC_AUTO
+ignore symbol FE_CAN_QPSK
+ignore symbol FE_CAN_QAM_16
+ignore symbol FE_CAN_QAM_32
+ignore symbol FE_CAN_QAM_64
+ignore symbol FE_CAN_QAM_128
+ignore symbol FE_CAN_QAM_256
+ignore symbol FE_CAN_QAM_AUTO
+ignore symbol FE_CAN_TRANSMISSION_MODE_AUTO
+ignore symbol FE_CAN_BANDWIDTH_AUTO
+ignore symbol FE_CAN_GUARD_INTERVAL_AUTO
+ignore symbol FE_CAN_HIERARCHY_AUTO
+ignore symbol FE_CAN_8VSB
+ignore symbol FE_CAN_16VSB
+ignore symbol FE_HAS_EXTENDED_CAPS
+ignore symbol FE_CAN_MULTISTREAM
+ignore symbol FE_CAN_TURBO_FEC
+ignore symbol FE_CAN_2G_MODULATION
+ignore symbol FE_NEEDS_BENDING
+ignore symbol FE_CAN_RECOVER
+ignore symbol FE_CAN_MUTE_TS
+
+ignore symbol QPSK
+ignore symbol QAM_16
+ignore symbol QAM_32
+ignore symbol QAM_64
+ignore symbol QAM_128
+ignore symbol QAM_256
+ignore symbol QAM_AUTO
+ignore symbol VSB_8
+ignore symbol VSB_16
+ignore symbol PSK_8
+ignore symbol APSK_16
+ignore symbol APSK_32
+ignore symbol DQPSK
+ignore symbol QAM_4_NR
+
+ignore symbol SEC_VOLTAGE_13
+ignore symbol SEC_VOLTAGE_18
+ignore symbol SEC_VOLTAGE_OFF
+
+ignore symbol SEC_TONE_ON
+ignore symbol SEC_TONE_OFF
+
+ignore symbol SEC_MINI_A
+ignore symbol SEC_MINI_B
+
+ignore symbol FE_NONE
+ignore symbol FE_HAS_SIGNAL
+ignore symbol FE_HAS_CARRIER
+ignore symbol FE_HAS_VITERBI
+ignore symbol FE_HAS_SYNC
+ignore symbol FE_HAS_LOCK
+ignore symbol FE_REINIT
+ignore symbol FE_TIMEDOUT
+
+ignore symbol FEC_NONE
+ignore symbol FEC_1_2
+ignore symbol 

[PATCH v2 07/27] media: dvb/frontend.h: move out a private internal structure

2017-09-01 Thread Mauro Carvalho Chehab
struct dtv_cmds_h is just an ancillary struct used by the
dvb_frontend.c to internally store frontend commands.

It doesn't belong to the userspace header, nor it is used anywhere,
except inside the DVB core. So, remove it from the header.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/dvb-core/dvb_frontend.c | 11 +++
 include/uapi/linux/dvb/frontend.h | 11 ---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index 114994ca0929..2fcba1616168 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -1000,6 +1000,17 @@ static int dvb_frontend_clear_cache(struct dvb_frontend 
*fe)
.buffer = b \
 }
 
+struct dtv_cmds_h {
+   char*name;  /* A display name for debugging purposes */
+
+   __u32   cmd;/* A unique ID */
+
+   /* Flags */
+   __u32   set:1;  /* Either a set or get property */
+   __u32   buffer:1;   /* Does this property use the buffer? */
+   __u32   reserved:30;/* Align */
+};
+
 static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_TUNE, 1, 0),
_DTV_CMD(DTV_CLEAR, 1, 0),
diff --git a/include/uapi/linux/dvb/frontend.h 
b/include/uapi/linux/dvb/frontend.h
index afc3972b0879..3a80f3d1da1c 100644
--- a/include/uapi/linux/dvb/frontend.h
+++ b/include/uapi/linux/dvb/frontend.h
@@ -384,17 +384,6 @@ enum atscmh_rs_code_mode {
 #define NO_STREAM_ID_FILTER(~0U)
 #define LNA_AUTO(~0U)
 
-struct dtv_cmds_h {
-   char*name;  /* A display name for debugging purposes */
-
-   __u32   cmd;/* A unique ID */
-
-   /* Flags */
-   __u32   set:1;  /* Either a set or get property */
-   __u32   buffer:1;   /* Does this property use the buffer? */
-   __u32   reserved:30;/* Align */
-};
-
 /**
  * Scale types for the quality parameters.
  * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
-- 
2.13.5



[PATCH v2 26/27] media: dvb rst: identify the documentation gap at the API

2017-09-01 Thread Mauro Carvalho Chehab
Now that DVB spec is almost in sync, document what's missing.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca.rst  | 5 +
 Documentation/media/uapi/dvb/legacy_dvb_apis.rst | 5 +
 2 files changed, 10 insertions(+)

diff --git a/Documentation/media/uapi/dvb/ca.rst 
b/Documentation/media/uapi/dvb/ca.rst
index 14b14abda1ae..e3de778a5678 100644
--- a/Documentation/media/uapi/dvb/ca.rst
+++ b/Documentation/media/uapi/dvb/ca.rst
@@ -10,6 +10,11 @@ accessed through ``/dev/dvb/adapter?/ca?``. Data types and 
and ioctl
 definitions can be accessed by including ``linux/dvb/ca.h`` in your
 application.
 
+.. note::
+
+   There are three ioctls at this API that aren't documented:
+   :ref:`CA_GET_MSG`, :ref:`CA_SEND_MSG` and :ref:`CA_SET_DESCR`.
+   Documentation for them are welcome.
 
 .. toctree::
 :maxdepth: 1
diff --git a/Documentation/media/uapi/dvb/legacy_dvb_apis.rst 
b/Documentation/media/uapi/dvb/legacy_dvb_apis.rst
index 2957f5a988b0..dac349a1bb27 100644
--- a/Documentation/media/uapi/dvb/legacy_dvb_apis.rst
+++ b/Documentation/media/uapi/dvb/legacy_dvb_apis.rst
@@ -12,6 +12,11 @@ drivers should use it. Instead, audio and video should be 
using the V4L2
 and ALSA APIs, and the pipelines should be set using the Media
 Controller API
 
+.. note::
+
+   The APIs described here doesn't necessarily reflect the current
+   code implementation.
+
 
 .. toctree::
 :maxdepth: 1
-- 
2.13.5



[PATCH v2 20/27] media: dst_ca: return a proper error code from CA errors

2017-09-01 Thread Mauro Carvalho Chehab
Right now, on several places, the driver is returning a
"-1" error to userspace, instead of a proper error code.

Fix it.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/pci/bt8xx/dst_ca.c | 41 +---
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/media/pci/bt8xx/dst_ca.c b/drivers/media/pci/bt8xx/dst_ca.c
index 7db47d8bbe15..5ebb86f22935 100644
--- a/drivers/media/pci/bt8xx/dst_ca.c
+++ b/drivers/media/pci/bt8xx/dst_ca.c
@@ -137,7 +137,7 @@ static int dst_put_ci(struct dst_state *state, u8 *data, 
int len, u8 *ca_string,
}
 
if(dst_ca_comm_err == RETRIES)
-   return -1;
+   return -EIO;
 
return 0;
 }
@@ -152,7 +152,7 @@ static int ca_get_app_info(struct dst_state *state)
put_checksum([0], command[0]);
if ((dst_put_ci(state, command, sizeof(command), state->messages, 
GET_REPLY)) < 0) {
dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
-   return -1;
+   return -EIO;
}
dprintk(verbose, DST_CA_INFO, 1, " -->dst_put_ci SUCCESS !");
dprintk(verbose, DST_CA_INFO, 1, "  CI 
Module Application Info ==");
@@ -191,7 +191,7 @@ static int ca_get_ca_info(struct dst_state *state)
put_checksum(_command[0], slot_command[0]);
if ((dst_put_ci(state, slot_command, sizeof (slot_command), 
state->messages, GET_REPLY)) < 0) {
dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
-   return -1;
+   return -EIO;
}
dprintk(verbose, DST_CA_INFO, 1, " -->dst_put_ci SUCCESS !");
 
@@ -235,7 +235,7 @@ static int ca_get_slot_caps(struct dst_state *state, struct 
ca_caps *p_ca_caps,
put_checksum(_command[0], slot_command[0]);
if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_cap, 
GET_REPLY)) < 0) {
dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
-   return -1;
+   return -EIO;
}
dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !");
 
@@ -275,7 +275,7 @@ static int ca_get_slot_info(struct dst_state *state, struct 
ca_slot_info *p_ca_s
put_checksum(_command[0], 7);
if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_info, 
GET_REPLY)) < 0) {
dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !");
-   return -1;
+   return -EIO;
}
dprintk(verbose, DST_CA_INFO, 1, " -->dst_put_ci SUCCESS !");
 
@@ -347,7 +347,7 @@ static int handle_dst_tag(struct dst_state *state, struct 
ca_msg *p_ca_message,
} else {
if (length > 247) {
dprintk(verbose, DST_CA_ERROR, 1, " Message too long ! 
*** Bailing Out *** !");
-   return -1;
+   return -EIO;
}
hw_buffer->msg[0] = (length & 0xff) + 7;
hw_buffer->msg[1] = 0x40;
@@ -373,7 +373,7 @@ static int write_to_8820(struct dst_state *state, struct 
ca_msg *hw_buffer, u8 l
dprintk(verbose, DST_CA_ERROR, 1, " DST-CI Command failed.");
dprintk(verbose, DST_CA_NOTICE, 1, " Resetting DST.");
rdc_reset_state(state);
-   return -1;
+   return -EIO;
}
dprintk(verbose, DST_CA_NOTICE, 1, " DST-CI Command success.");
 
@@ -446,7 +446,7 @@ static int dst_check_ca_pmt(struct dst_state *state, struct 
ca_msg *p_ca_message
if (ca_pmt_reply_test) {
if ((ca_set_pmt(state, p_ca_message, hw_buffer, 1, GET_REPLY)) 
< 0) {
dprintk(verbose, DST_CA_ERROR, 1, " ca_set_pmt.. failed 
!");
-   return -1;
+   return -EIO;
}
 
/*  Process CA PMT Reply*/
@@ -457,7 +457,7 @@ static int dst_check_ca_pmt(struct dst_state *state, struct 
ca_msg *p_ca_message
if (!ca_pmt_reply_test) {
if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, NO_REPLY)) < 
0) {
dprintk(verbose, DST_CA_ERROR, 1, " ca_set_pmt.. failed 
!");
-   return -1;
+   return -EIO;
}
dprintk(verbose, DST_CA_NOTICE, 1, " ca_set_pmt.. success !");
/*  put a dummy message */
@@ -566,17 +566,18 @@ static long dst_ca_ioctl(struct file *file, unsigned int 
cmd, unsigned long ioct
switch (cmd) {
case CA_SEND_MSG:
dprintk(verbose, DST_CA_INFO, 1, " Sending message");
-   if ((ca_send_message(state, p_ca_message, arg)) < 0) {
+   result = ca_send_message(state, p_ca_message, arg);
+
+   if (result < 0) {
dprintk(verbose, DST_CA_ERROR, 

[PATCH v2 06/27] media: dvb/intro: adjust the notices about optional hardware

2017-09-01 Thread Mauro Carvalho Chehab
Both CA and decoders are optional. Also, the presence or
absence has nothing to do on being a PCI card or not.

Nowadays, most hardware leaves the decoders to either the
GPU or to some ISP inside the SoC, instead of implementing
it inside the Digital TV part of the device.

So, change the wording to reflect the hardware changes.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/intro.rst | 29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/Documentation/media/uapi/dvb/intro.rst 
b/Documentation/media/uapi/dvb/intro.rst
index 4e1594816ef4..aeafc9ab96c1 100644
--- a/Documentation/media/uapi/dvb/intro.rst
+++ b/Documentation/media/uapi/dvb/intro.rst
@@ -71,8 +71,7 @@ Overview
 A Digital TV card or set-top-box (STB) usually consists of the
 following main hardware components:
 
--  Frontend consisting of tuner and digital TV demodulator
-
+Frontend consisting of tuner and digital TV demodulator
Here the raw signal reaches the digital TV hardware from a satellite dish or
antenna or directly from cable. The frontend down-converts and
demodulates this signal into an MPEG transport stream (TS). In case
@@ -80,34 +79,40 @@ following main hardware components:
equipment control (SEC), which allows control of LNB polarization,
multi feed switches or dish rotors.
 
--  Conditional Access (CA) hardware like CI adapters and smartcard slots
-
+Conditional Access (CA) hardware like CI adapters and smartcard slots
The complete TS is passed through the CA hardware. Programs to which
the user has access (controlled by the smart card) are decoded in
real time and re-inserted into the TS.
 
--  Demultiplexer which filters the incoming DVB stream
+   .. note::
 
+  Not every digital TV hardware provides conditional access hardware.
+
+Demultiplexer which filters the incoming DVB stream
The demultiplexer splits the TS into its components like audio and
video streams. Besides usually several of such audio and video
streams it also contains data streams with information about the
programs offered in this or other streams of the same provider.
 
--  MPEG2 audio and video decoder
-
+MPEG2 audio and video decoder
The main targets of the demultiplexer are the MPEG2 audio and video
decoders. After decoding they pass on the uncompressed audio and
video to the computer screen or (through a PAL/NTSC encoder) to a TV
set.
 
+   .. note::
+
+  Modern hardware usually doesn't have a separate decoder hardware, as
+  such functionality can be provided by the main CPU, by the graphics
+  adapter of the system or by a signal processing hardware embedded on
+  a Systems on a Chip (SoC) integrated circuit.
+
+  It may also not be needed for certain usages (e.g. for data-only
+  uses like “internet over satellite”).
+
 :ref:`stb_components` shows a crude schematic of the control and data
 flow between those components.
 
-On a DVB PCI card not all of these have to be present since some
-functionality can be provided by the main CPU of the PC (e.g. MPEG
-picture and sound decoding) or is not needed (e.g. for data-only uses
-like “internet over satellite”). Also not every card or STB provides
-conditional access hardware.
 
 
 .. _dvb_devices:
-- 
2.13.5



[PATCH v2 13/27] media: dmx.h: get rid of DMX_GET_CAPS

2017-09-01 Thread Mauro Carvalho Chehab
There's no driver currently using it; it is also not
documented about what it would be supposed to do.

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/dmx.h.rst.exceptions  |  1 -
 Documentation/media/uapi/dvb/dmx-get-caps.rst | 41 ---
 Documentation/media/uapi/dvb/dmx_fcalls.rst   |  1 -
 Documentation/media/uapi/dvb/dmx_types.rst| 12 
 include/uapi/linux/dvb/dmx.h  |  7 -
 5 files changed, 62 deletions(-)
 delete mode 100644 Documentation/media/uapi/dvb/dmx-get-caps.rst

diff --git a/Documentation/media/dmx.h.rst.exceptions 
b/Documentation/media/dmx.h.rst.exceptions
index 933ca5a61ce1..5572d2dc9d0e 100644
--- a/Documentation/media/dmx.h.rst.exceptions
+++ b/Documentation/media/dmx.h.rst.exceptions
@@ -58,7 +58,6 @@ replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
 replace define DMX_IMMEDIATE_START :c:type:`dmx_sct_filter_params`
 
 # some typedefs should point to struct/enums
-replace typedef dmx_caps_t :c:type:`dmx_caps`
 replace typedef dmx_filter_t :c:type:`dmx_filter`
 replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
 replace typedef dmx_input_t :c:type:`dmx_input`
diff --git a/Documentation/media/uapi/dvb/dmx-get-caps.rst 
b/Documentation/media/uapi/dvb/dmx-get-caps.rst
deleted file mode 100644
index 145fb520d779..
--- a/Documentation/media/uapi/dvb/dmx-get-caps.rst
+++ /dev/null
@@ -1,41 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _DMX_GET_CAPS:
-
-
-DMX_GET_CAPS
-
-
-Name
-
-
-DMX_GET_CAPS
-
-
-Synopsis
-
-
-.. c:function:: int ioctl(fd, DMX_GET_CAPS, struct dmx_caps *caps)
-:name: DMX_GET_CAPS
-
-Arguments
--
-
-``fd``
-File descriptor returned by :c:func:`open() `.
-
-``caps``
-Pointer to struct :c:type:`dmx_caps`
-
-
-Description

-
-.. note:: This ioctl is undocumented. Documentation is welcome.
-
-Return Value
-
-
-On success 0 is returned, on error -1 and the ``errno`` variable is set
-appropriately. The generic error codes are described at the
-:ref:`Generic Error Codes ` chapter.
diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
b/Documentation/media/uapi/dvb/dmx_fcalls.rst
index 77a1554d9834..49e013d4540f 100644
--- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
+++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
@@ -21,7 +21,6 @@ Demux Function Calls
 dmx-get-event
 dmx-get-stc
 dmx-get-pes-pids
-dmx-get-caps
 dmx-set-source
 dmx-add-pid
 dmx-remove-pid
diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
b/Documentation/media/uapi/dvb/dmx_types.rst
index 0f0113205c94..9e907b85cf16 100644
--- a/Documentation/media/uapi/dvb/dmx_types.rst
+++ b/Documentation/media/uapi/dvb/dmx_types.rst
@@ -199,18 +199,6 @@ struct dmx_stc
 };
 
 
-struct dmx_caps
-===
-
-.. c:type:: dmx_caps
-
-.. code-block:: c
-
- typedef struct dmx_caps {
-   __u32 caps;
-   int num_decoders;
-} dmx_caps_t;
-
 
 enum dmx_source
 ===
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
index 1702f923d425..db8bd00c93de 100644
--- a/include/uapi/linux/dvb/dmx.h
+++ b/include/uapi/linux/dvb/dmx.h
@@ -115,11 +115,6 @@ struct dmx_pes_filter_params
__u32   flags;
 };
 
-struct dmx_caps {
-   __u32 caps;
-   int num_decoders;
-};
-
 enum dmx_source {
DMX_SOURCE_FRONT0 = 0,
DMX_SOURCE_FRONT1,
@@ -143,7 +138,6 @@ struct dmx_stc {
 #define DMX_SET_PES_FILTER   _IOW('o', 44, struct dmx_pes_filter_params)
 #define DMX_SET_BUFFER_SIZE  _IO('o', 45)
 #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
-#define DMX_GET_CAPS _IOR('o', 48, struct dmx_caps)
 #define DMX_SET_SOURCE   _IOW('o', 49, enum dmx_source)
 #define DMX_GET_STC  _IOWR('o', 50, struct dmx_stc)
 #define DMX_ADD_PID  _IOW('o', 51, __u16)
@@ -156,7 +150,6 @@ typedef enum dmx_output dmx_output_t;
 typedef enum dmx_input dmx_input_t;
 typedef enum dmx_ts_pes dmx_pes_type_t;
 typedef struct dmx_filter dmx_filter_t;
-typedef struct dmx_caps dmx_caps_t;
 typedef enum dmx_source  dmx_source_t;
 
 #endif
-- 
2.13.5



[PATCH v2 04/27] media: dvb/intro: update references for TV standards

2017-09-01 Thread Mauro Carvalho Chehab
The references there are only for DVB. Add missing references for
ATSC and ISDB standards.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/intro.rst | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/media/uapi/dvb/intro.rst 
b/Documentation/media/uapi/dvb/intro.rst
index de432ffcba50..991643d3b461 100644
--- a/Documentation/media/uapi/dvb/intro.rst
+++ b/Documentation/media/uapi/dvb/intro.rst
@@ -18,10 +18,13 @@ part I of the MPEG2 specification ISO/IEC 13818 (aka ITU-T 
H.222), i.e
 you should know what a program/transport stream (PS/TS) is and what is
 meant by a packetized elementary stream (PES) or an I-frame.
 
-Various DVB standards documents are available from http://www.dvb.org
-and/or http://www.etsi.org.
+Various Digital TV standards documents are available for download at:
 
-It is also necessary to know how to access unix/linux devices and how to
+- European standards (DVB): http://www.dvb.org and/or http://www.etsi.org.
+- American standards (ATSC): https://www.atsc.org/standards/
+- Japanese standards (ISDB): http://www.dibeg.org/
+
+It is also necessary to know how to access Linux devices and how to
 use ioctl calls. This also includes the knowledge of C or C++.
 
 
-- 
2.13.5



[PATCH v2 24/27] media: ca-get-descr-info.rst: document this ioctl

2017-09-01 Thread Mauro Carvalho Chehab
Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca-get-descr-info.rst | 29 +++---
 1 file changed, 4 insertions(+), 25 deletions(-)

diff --git a/Documentation/media/uapi/dvb/ca-get-descr-info.rst 
b/Documentation/media/uapi/dvb/ca-get-descr-info.rst
index 7bf327a3d0e3..e564fbb8d524 100644
--- a/Documentation/media/uapi/dvb/ca-get-descr-info.rst
+++ b/Documentation/media/uapi/dvb/ca-get-descr-info.rst
@@ -27,37 +27,16 @@ Arguments
 ``desc``
   Pointer to struct :c:type:`ca_descr_info`.
 
-.. c:type:: struct ca_descr_info
-
-.. flat-table:: struct ca_descr_info
-:header-rows:  1
-:stub-columns: 0
-
--
-  - type
-  - name
-  - description
-
--
-  - unsigned int
-  - num
-  - number of available descramblers (keys)
--
-  - unsigned int
-  - type
-  - type of supported scrambling system. Valid values are:
-   ``CA_ECD``, ``CA_NDS`` and ``CA_DSS``.
-
-
 Description
 ---
 
-.. note:: This ioctl is undocumented. Documentation is welcome.
-
+Returns information about all descrambler slots.
 
 Return Value
 
 
-On success 0 is returned, on error -1 and the ``errno`` variable is set
+On success 0 is returned, and :c:type:`ca_descr_info` is filled.
+
+On error -1 is returned, and the ``errno`` variable is set
 appropriately. The generic error codes are described at the
 :ref:`Generic Error Codes ` chapter.
-- 
2.13.5



[PATCH v2 25/27] media: dvb CA docs: place undocumented data together with ioctls

2017-09-01 Thread Mauro Carvalho Chehab
Right now, the same undocumented structs are on two places:
at ca_data_types.rst and together with their ioctls.

Move them to just one place and use the standard way to
represent them.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca-get-msg.rst| 38 ++
 Documentation/media/uapi/dvb/ca-set-descr.rst  | 10 +++
 Documentation/media/uapi/dvb/ca_data_types.rst | 32 --
 3 files changed, 19 insertions(+), 61 deletions(-)

diff --git a/Documentation/media/uapi/dvb/ca-get-msg.rst 
b/Documentation/media/uapi/dvb/ca-get-msg.rst
index 121588da3ef1..1ee9d667c901 100644
--- a/Documentation/media/uapi/dvb/ca-get-msg.rst
+++ b/Documentation/media/uapi/dvb/ca-get-msg.rst
@@ -28,37 +28,17 @@ Arguments
 ``msg``
   Pointer to struct :c:type:`ca_msg`.
 
+.. c:type:: ca_msg
 
-.. c:type:: struct ca_msg
-
-.. flat-table:: struct ca_msg
-:header-rows:  1
-:stub-columns: 0
-
--
-  - type
-  - name
-  - description
--
-   - unsigned int
-   - index
-   -
-
--
-   - unsigned int
-   - type
-   -
-
--
-   - unsigned int
-   - length
-   -
-
--
-   - unsigned char
-   - msg[256]
-   -
+.. code-block:: c
 
+/* a message to/from a CI-CAM */
+struct ca_msg {
+   unsigned int index;
+   unsigned int type;
+   unsigned int length;
+   unsigned char msg[256];
+};
 
 Description
 ---
diff --git a/Documentation/media/uapi/dvb/ca-set-descr.rst 
b/Documentation/media/uapi/dvb/ca-set-descr.rst
index 70f7b3cf12ad..95de34cf74ba 100644
--- a/Documentation/media/uapi/dvb/ca-set-descr.rst
+++ b/Documentation/media/uapi/dvb/ca-set-descr.rst
@@ -28,6 +28,16 @@ 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
 ---
diff --git a/Documentation/media/uapi/dvb/ca_data_types.rst 
b/Documentation/media/uapi/dvb/ca_data_types.rst
index aa57dd176825..ac7cbd76ddd5 100644
--- a/Documentation/media/uapi/dvb/ca_data_types.rst
+++ b/Documentation/media/uapi/dvb/ca_data_types.rst
@@ -7,35 +7,3 @@ CA Data Types
 *
 
 .. kernel-doc:: include/uapi/linux/dvb/ca.h
-
-.. c:type:: ca_msg
-
-Undocumented data types
-===
-
-.. note::
-
-   Those data types are undocumented. Documentation is welcome.
-
-.. c:type:: ca_msg
-
-.. code-block:: c
-
-/* a message to/from a CI-CAM */
-struct ca_msg {
-   unsigned int index;
-   unsigned int type;
-   unsigned int length;
-   unsigned char msg[256];
-};
-
-
-.. c:type:: ca_descr
-
-.. code-block:: c
-
-struct ca_descr {
-   unsigned int index;
-   unsigned int parity;
-   unsigned char cw[8];
-};
-- 
2.13.5



[PATCH v2 01/27] media: ca.h: split typedefs from structs

2017-09-01 Thread Mauro Carvalho Chehab
Using typedefs inside the Kernel is against CodingStyle, and
there's no good usage here.

Just like we did at frontend.h, at changeset 0df289a209e0
("[media] dvb: Get rid of typedev usage for enums"), let's keep
those typedefs only to provide userspace backward compatibility.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/pci/ttpci/av7110.h|  2 +-
 drivers/media/pci/ttpci/av7110_ca.c | 12 -
 include/uapi/linux/dvb/ca.h | 51 +++--
 3 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/drivers/media/pci/ttpci/av7110.h b/drivers/media/pci/ttpci/av7110.h
index 824c1e262fbb..347827925c14 100644
--- a/drivers/media/pci/ttpci/av7110.h
+++ b/drivers/media/pci/ttpci/av7110.h
@@ -177,7 +177,7 @@ struct av7110 {
 
/* CA */
 
-   ca_slot_info_t  ci_slot[2];
+   struct ca_slot_info ci_slot[2];
 
enum av7110_video_mode  vidmode;
struct dmxdev   dmxdev;
diff --git a/drivers/media/pci/ttpci/av7110_ca.c 
b/drivers/media/pci/ttpci/av7110_ca.c
index f64723aea56b..1fe49171d823 100644
--- a/drivers/media/pci/ttpci/av7110_ca.c
+++ b/drivers/media/pci/ttpci/av7110_ca.c
@@ -119,7 +119,7 @@ static void ci_ll_release(struct dvb_ringbuffer *cirbuf, 
struct dvb_ringbuffer *
 }
 
 static int ci_ll_reset(struct dvb_ringbuffer *cibuf, struct file *file,
-  int slots, ca_slot_info_t *slot)
+  int slots, struct ca_slot_info *slot)
 {
int i;
int len = 0;
@@ -264,7 +264,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int 
cmd, void *parg)
break;
case CA_GET_CAP:
{
-   ca_caps_t cap;
+   struct ca_caps cap;
 
cap.slot_num = 2;
cap.slot_type = (FW_CI_LL_SUPPORT(av7110->arm_app) ?
@@ -277,7 +277,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int 
cmd, void *parg)
 
case CA_GET_SLOT_INFO:
{
-   ca_slot_info_t *info=(ca_slot_info_t *)parg;
+   struct ca_slot_info *info=(struct ca_slot_info *)parg;
 
if (info->num < 0 || info->num > 1) {
mutex_unlock(>ioctl_mutex);
@@ -286,7 +286,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int 
cmd, void *parg)
av7110->ci_slot[info->num].num = info->num;
av7110->ci_slot[info->num].type = 
FW_CI_LL_SUPPORT(av7110->arm_app) ?
CA_CI_LINK : CA_CI;
-   memcpy(info, >ci_slot[info->num], 
sizeof(ca_slot_info_t));
+   memcpy(info, >ci_slot[info->num], sizeof(struct 
ca_slot_info));
break;
}
 
@@ -298,7 +298,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int 
cmd, void *parg)
 
case CA_GET_DESCR_INFO:
{
-   ca_descr_info_t info;
+   struct ca_descr_info info;
 
info.num = 16;
info.type = CA_ECD;
@@ -308,7 +308,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int 
cmd, void *parg)
 
case CA_SET_DESCR:
{
-   ca_descr_t *descr = (ca_descr_t*) parg;
+   struct ca_descr *descr = (struct ca_descr*) parg;
 
if (descr->index >= 16 || descr->parity > 1) {
mutex_unlock(>ioctl_mutex);
diff --git a/include/uapi/linux/dvb/ca.h b/include/uapi/linux/dvb/ca.h
index c18537f3e449..00cf24587bea 100644
--- a/include/uapi/linux/dvb/ca.h
+++ b/include/uapi/linux/dvb/ca.h
@@ -26,7 +26,7 @@
 
 /* slot interface types and info */
 
-typedef struct ca_slot_info {
+struct ca_slot_info {
int num;   /* slot number */
 
int type;  /* CA interface this slot supports */
@@ -39,52 +39,65 @@ typedef struct ca_slot_info {
unsigned int flags;
 #define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */
 #define CA_CI_MODULE_READY   2
-} ca_slot_info_t;
+};
 
 
 /* descrambler types and info */
 
-typedef struct ca_descr_info {
+struct ca_descr_info {
unsigned int num;  /* number of available descramblers (keys) */
unsigned int type; /* type of supported scrambling system */
 #define CA_ECD   1
 #define CA_NDS   2
 #define CA_DSS   4
-} ca_descr_info_t;
+};
 
-typedef struct ca_caps {
+struct ca_caps {
unsigned int slot_num; /* total number of CA card and module slots 
*/
unsigned int slot_type;/* OR of all supported types */
unsigned int descr_num;/* total number of descrambler slots (keys) 
*/
unsigned int descr_type;   /* OR of all supported types */
-} ca_caps_t;
+};
 
 /* a message to/from a CI-CAM */
-typedef struct ca_msg {
+struct ca_msg {
unsigned int index;
unsigned int type;
unsigned int length;
unsigned char msg[256];
-} ca_msg_t;
+};
 

[PATCH v2 14/27] media: dmx.h: get rid of DMX_SET_SOURCE

2017-09-01 Thread Mauro Carvalho Chehab
No driver uses this ioctl, nor it is documented anywhere.

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/dmx.h.rst.exceptions| 13 
 Documentation/media/uapi/dvb/dmx-set-source.rst | 44 -
 Documentation/media/uapi/dvb/dmx_fcalls.rst |  1 -
 Documentation/media/uapi/dvb/dmx_types.rst  | 20 ---
 include/uapi/linux/dvb/dmx.h| 12 ---
 5 files changed, 90 deletions(-)
 delete mode 100644 Documentation/media/uapi/dvb/dmx-set-source.rst

diff --git a/Documentation/media/dmx.h.rst.exceptions 
b/Documentation/media/dmx.h.rst.exceptions
index 5572d2dc9d0e..d2dac35bb84b 100644
--- a/Documentation/media/dmx.h.rst.exceptions
+++ b/Documentation/media/dmx.h.rst.exceptions
@@ -40,18 +40,6 @@ replace enum dmx_input :c:type:`dmx_input`
 replace symbol DMX_IN_FRONTEND :c:type:`dmx_input`
 replace symbol DMX_IN_DVR :c:type:`dmx_input`
 
-# dmx_source_t symbols
-replace enum dmx_source :c:type:`dmx_source`
-replace symbol DMX_SOURCE_FRONT0 :c:type:`dmx_source`
-replace symbol DMX_SOURCE_FRONT1 :c:type:`dmx_source`
-replace symbol DMX_SOURCE_FRONT2 :c:type:`dmx_source`
-replace symbol DMX_SOURCE_FRONT3 :c:type:`dmx_source`
-replace symbol DMX_SOURCE_DVR0 :c:type:`dmx_source`
-replace symbol DMX_SOURCE_DVR1 :c:type:`dmx_source`
-replace symbol DMX_SOURCE_DVR2 :c:type:`dmx_source`
-replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source`
-
-
 # Flags for struct dmx_sct_filter_params
 replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
 replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
@@ -61,4 +49,3 @@ replace define DMX_IMMEDIATE_START 
:c:type:`dmx_sct_filter_params`
 replace typedef dmx_filter_t :c:type:`dmx_filter`
 replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
 replace typedef dmx_input_t :c:type:`dmx_input`
-replace typedef dmx_source_t :c:type:`dmx_source`
diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst 
b/Documentation/media/uapi/dvb/dmx-set-source.rst
deleted file mode 100644
index ac7f77b25e06..
--- a/Documentation/media/uapi/dvb/dmx-set-source.rst
+++ /dev/null
@@ -1,44 +0,0 @@
-.. -*- coding: utf-8; mode: rst -*-
-
-.. _DMX_SET_SOURCE:
-
-==
-DMX_SET_SOURCE
-==
-
-Name
-
-
-DMX_SET_SOURCE
-
-
-Synopsis
-
-
-.. c:function:: int ioctl(fd, DMX_SET_SOURCE, struct dmx_source *src)
-:name: DMX_SET_SOURCE
-
-
-Arguments
--
-
-
-``fd``
-File descriptor returned by :c:func:`open() `.
-
-``src``
-   Undocumented.
-
-
-Description

-
-.. note:: This ioctl is undocumented. Documentation is welcome.
-
-
-Return Value
-
-
-On success 0 is returned, on error -1 and the ``errno`` variable is set
-appropriately. The generic error codes are described at the
-:ref:`Generic Error Codes ` chapter.
diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
b/Documentation/media/uapi/dvb/dmx_fcalls.rst
index 49e013d4540f..be98d60877f2 100644
--- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
+++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
@@ -21,6 +21,5 @@ Demux Function Calls
 dmx-get-event
 dmx-get-stc
 dmx-get-pes-pids
-dmx-set-source
 dmx-add-pid
 dmx-remove-pid
diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
b/Documentation/media/uapi/dvb/dmx_types.rst
index 9e907b85cf16..a205c02ccdc1 100644
--- a/Documentation/media/uapi/dvb/dmx_types.rst
+++ b/Documentation/media/uapi/dvb/dmx_types.rst
@@ -197,23 +197,3 @@ struct dmx_stc
unsigned int base;  /* output: divisor for stc to get 90 kHz clock */
__u64 stc;  /* output: stc in 'base'*90 kHz units */
 };
-
-
-
-enum dmx_source
-===
-
-.. c:type:: dmx_source
-
-.. code-block:: c
-
-typedef enum dmx_source {
-   DMX_SOURCE_FRONT0 = 0,
-   DMX_SOURCE_FRONT1,
-   DMX_SOURCE_FRONT2,
-   DMX_SOURCE_FRONT3,
-   DMX_SOURCE_DVR0   = 16,
-   DMX_SOURCE_DVR1,
-   DMX_SOURCE_DVR2,
-   DMX_SOURCE_DVR3
-} dmx_source_t;
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
index db8bd00c93de..08dc17060321 100644
--- a/include/uapi/linux/dvb/dmx.h
+++ b/include/uapi/linux/dvb/dmx.h
@@ -115,16 +115,6 @@ struct dmx_pes_filter_params
__u32   flags;
 };
 
-enum dmx_source {
-   DMX_SOURCE_FRONT0 = 0,
-   DMX_SOURCE_FRONT1,
-   DMX_SOURCE_FRONT2,
-   DMX_SOURCE_FRONT3,
-   DMX_SOURCE_DVR0   = 16,
-   DMX_SOURCE_DVR1,
-   DMX_SOURCE_DVR2,
-   DMX_SOURCE_DVR3
-};
 
 struct dmx_stc {
unsigned int num;   /* input : which STC? 0..N */
@@ -138,7 +128,6 @@ struct dmx_stc {
 #define DMX_SET_PES_FILTER   _IOW('o', 44, struct dmx_pes_filter_params)
 #define DMX_SET_BUFFER_SIZE  _IO('o', 45)
 #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
-#define DMX_SET_SOURCE   _IOW('o', 49, enum dmx_source)
 #define DMX_GET_STC  _IOWR('o', 50, struct 

[PATCH v2 22/27] media: ca-get-cap.rst: document this ioctl

2017-09-01 Thread Mauro Carvalho Chehab
Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca-get-cap.rst | 36 -
 1 file changed, 5 insertions(+), 31 deletions(-)

diff --git a/Documentation/media/uapi/dvb/ca-get-cap.rst 
b/Documentation/media/uapi/dvb/ca-get-cap.rst
index fbf7e359cb8a..02d64acfb087 100644
--- a/Documentation/media/uapi/dvb/ca-get-cap.rst
+++ b/Documentation/media/uapi/dvb/ca-get-cap.rst
@@ -28,43 +28,17 @@ Arguments
 ``caps``
   Pointer to struct :c:type:`ca_caps`.
 
-.. c:type:: struct ca_caps
-
-.. flat-table:: struct ca_caps
-:header-rows:  1
-:stub-columns: 0
-
--
-  - type
-  - name
-  - description
--
-  -unsigned int
-  - slot_num
-  - total number of CA card and module slots
--
-  - unsigned int
-  - slot_type
-  - bitmask with all supported slot types
--
-  - unsigned int
-  - descr_num
-  - total number of descrambler slots (keys)
--
-  - unsigned int
-  - descr_type
-  - bit mask with all supported descr types
-
-
 Description
 ---
 
-.. note:: This ioctl is undocumented. Documentation is welcome.
-
+Queries the Kernel for information about the available CA and descrambler
+slots, and their types.
 
 Return Value
 
 
-On success 0 is returned, on error -1 and the ``errno`` variable is set
+On success 0 is returned and :c:type:`ca_caps` is filled.
+
+On error, -1 is returned and the ``errno`` variable is set
 appropriately. The generic error codes are described at the
 :ref:`Generic Error Codes ` chapter.
-- 
2.13.5



[PATCH v2 05/27] media: dvb/intro: update the history part of the document

2017-09-01 Thread Mauro Carvalho Chehab
Convergence doesn't exist anymore. The community itself maintains
the spec. Update accordingly.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/intro.rst | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/Documentation/media/uapi/dvb/intro.rst 
b/Documentation/media/uapi/dvb/intro.rst
index 991643d3b461..4e1594816ef4 100644
--- a/Documentation/media/uapi/dvb/intro.rst
+++ b/Documentation/media/uapi/dvb/intro.rst
@@ -39,15 +39,19 @@ grabber cards. As such it was not really well suited to be 
used for DVB
 cards and their new features like recording MPEG streams and filtering
 several section and PES data streams at the same time.
 
-In early 2000, we were approached by Nokia with a proposal for a new
+In early 2000, Convergence was approached by Nokia with a proposal for a new
 standard Linux DVB API. As a commitment to the development of terminals
 based on open standards, Nokia and Convergence made it available to all
 Linux developers and published it on https://linuxtv.org in September
-2000. Convergence is the maintainer of the Linux DVB API. Together with
-the LinuxTV community (i.e. you, the reader of this document), the Linux
-DVB API will be constantly reviewed and improved. With the Linux driver
-for the Siemens/Hauppauge DVB PCI card Convergence provides a first
-implementation of the Linux DVB API.
+2000. With the Linux driver for the Siemens/Hauppauge DVB PCI card,
+Convergence provided a first implementation of the Linux DVB API.
+Convergence was the maintainer of the Linux DVB API in the early
+days.
+
+Now, the API is maintained by the LinuxTV community (i.e. you, the reader
+of this document). The Linux  Digital TV API is constantly reviewed and
+improved together with the improvements at the subsystem's core at the
+Kernel.
 
 
 .. _overview:
-- 
2.13.5



[PATCH v2 08/27] media: dvb/frontend.h: document the uAPI file

2017-09-01 Thread Mauro Carvalho Chehab
Most of the stuff at the Digital TV frontend header file
are documented only at the Documentation. However, a few
kernel-doc markups are there, several of them with parsing
issues.

Add the missing documentation, copying definitions from the
Documentation when it applies, fixing some bugs.

Please notice that DVBv3 stuff that were deprecated weren't
commented by purpose. Instead, they were clearly tagged as
such.

This patch prepares to move part of the documentation from
Documentation/ to kernel-doc comments.

Signed-off-by: Mauro Carvalho Chehab 
---
 include/uapi/linux/dvb/frontend.h | 580 --
 1 file changed, 498 insertions(+), 82 deletions(-)

diff --git a/include/uapi/linux/dvb/frontend.h 
b/include/uapi/linux/dvb/frontend.h
index 3a80f3d1da1c..a383c87256f3 100644
--- a/include/uapi/linux/dvb/frontend.h
+++ b/include/uapi/linux/dvb/frontend.h
@@ -28,13 +28,46 @@
 
 #include 
 
-enum fe_type {
-   FE_QPSK,
-   FE_QAM,
-   FE_OFDM,
-   FE_ATSC
-};
-
+/**
+ * enum fe_caps - Frontend capabilities
+ *
+ * @FE_IS_STUPID:  There's something wrong at the
+ * frontend, and it can't report its
+ * capabilities.
+ * @FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral
+ * band inversion
+ * @FE_CAN_FEC_1_2:Supports FEC 1/2
+ * @FE_CAN_FEC_2_3:Supports FEC 2/3
+ * @FE_CAN_FEC_3_4:Supports FEC 3/4
+ * @FE_CAN_FEC_4_5:Supports FEC 4/5
+ * @FE_CAN_FEC_5_6:Supports FEC 5/6
+ * @FE_CAN_FEC_6_7:Supports FEC 6/7
+ * @FE_CAN_FEC_7_8:Supports FEC 7/8
+ * @FE_CAN_FEC_8_9:Supports FEC 8/9
+ * @FE_CAN_FEC_AUTO:   Can auto-detect FEC
+ * @FE_CAN_QPSK:   Supports QPSK modulation
+ * @FE_CAN_QAM_16: Supports 16-QAM modulation
+ * @FE_CAN_QAM_32: Supports 32-QAM modulation
+ * @FE_CAN_QAM_64: Supports 64-QAM modulation
+ * @FE_CAN_QAM_128:Supports 128-QAM modulation
+ * @FE_CAN_QAM_256:Supports 256-QAM modulation
+ * @FE_CAN_QAM_AUTO:   Can auto-detect QAM modulation
+ * @FE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission mode
+ * @FE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidth
+ * @FE_CAN_GUARD_INTERVAL_AUTO:Can auto-detect guard interval
+ * @FE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchy
+ * @FE_CAN_8VSB:   Supports 8-VSB modulation
+ * @FE_CAN_16VSB:  Supporta 16-VSB modulation
+ * @FE_HAS_EXTENDED_CAPS:  Unused
+ * @FE_CAN_MULTISTREAM:Supports multistream filtering
+ * @FE_CAN_TURBO_FEC:  Supports "turbo FEC" modulation
+ * @FE_CAN_2G_MODULATION:  Supports "2nd generation" modulation,
+ * e. g. DVB-S2, DVB-T2, DVB-C2
+ * @FE_NEEDS_BENDING:  Unused
+ * @FE_CAN_RECOVER:Can recover from a cable unplug
+ * automatically
+ * @FE_CAN_MUTE_TS:Can stop spurious TS data output
+ */
 enum fe_caps {
FE_IS_STUPID= 0,
FE_CAN_INVERSION_AUTO   = 0x1,
@@ -60,15 +93,55 @@ enum fe_caps {
FE_CAN_HIERARCHY_AUTO   = 0x10,
FE_CAN_8VSB = 0x20,
FE_CAN_16VSB= 0x40,
-   FE_HAS_EXTENDED_CAPS= 0x80,   /* We need more bitspace 
for newer APIs, indicate this. */
-   FE_CAN_MULTISTREAM  = 0x400,  /* frontend supports 
multistream filtering */
-   FE_CAN_TURBO_FEC= 0x800,  /* frontend supports 
"turbo fec modulation" */
-   FE_CAN_2G_MODULATION= 0x1000, /* frontend supports "2nd 
generation modulation" (DVB-S2) */
-   FE_NEEDS_BENDING= 0x2000, /* not supported anymore, 
don't use (frontend requires frequency bending) */
-   FE_CAN_RECOVER  = 0x4000, /* frontend can recover 
from a cable unplug automatically */
-   FE_CAN_MUTE_TS  = 0x8000  /* frontend can stop 
spurious TS data output */
+   FE_HAS_EXTENDED_CAPS= 0x80,
+   FE_CAN_MULTISTREAM  = 0x400,
+   FE_CAN_TURBO_FEC= 0x800,
+   FE_CAN_2G_MODULATION= 0x1000,
+   FE_NEEDS_BENDING= 0x2000,
+   FE_CAN_RECOVER  = 0x4000,
+   FE_CAN_MUTE_TS  = 0x8000
 };
 
+/*
+ * DEPRECATED: Should be kept just due to backward compatibility.
+ */
+enum fe_type {
+   FE_QPSK,

[PATCH v2 19/27] media: ca.h: document most CA data types

2017-09-01 Thread Mauro Carvalho Chehab
For most of the stuff there, documenting is easy, as the
header file contains information.

Yet, I was unable to document two data structs:
ca_msg and ca_descr

As those two structs are used by a few drivers, keep them.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/dvb/ca_data_types.rst | 75 -
 include/uapi/linux/dvb/ca.h| 78 --
 2 files changed, 70 insertions(+), 83 deletions(-)

diff --git a/Documentation/media/uapi/dvb/ca_data_types.rst 
b/Documentation/media/uapi/dvb/ca_data_types.rst
index 555b5137936b..aa57dd176825 100644
--- a/Documentation/media/uapi/dvb/ca_data_types.rst
+++ b/Documentation/media/uapi/dvb/ca_data_types.rst
@@ -6,91 +6,36 @@
 CA Data Types
 *
 
+.. kernel-doc:: include/uapi/linux/dvb/ca.h
 
-.. c:type:: ca_slot_info
-
-ca_slot_info_t
-==
-
-
-.. code-block:: c
-
-typedef struct ca_slot_info {
-   int num;   /* slot number */
-
-   int type;  /* CA interface this slot supports */
-#define CA_CI1 /* CI high level interface */
-#define CA_CI_LINK   2 /* CI link layer level interface */
-#define CA_CI_PHYS   4 /* CI physical layer level interface */
-#define CA_DESCR 8 /* built-in descrambler */
-#define CA_SC  128 /* simple smart card interface */
-
-   unsigned int flags;
-#define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */
-#define CA_CI_MODULE_READY   2
-} ca_slot_info_t;
-
-
-.. c:type:: ca_descr_info
-
-ca_descr_info_t
-===
-
-
-.. code-block:: c
-
-typedef struct ca_descr_info {
-   unsigned int num;  /* number of available descramblers (keys) */
-   unsigned int type; /* type of supported scrambling system */
-#define CA_ECD   1
-#define CA_NDS   2
-#define CA_DSS   4
-} ca_descr_info_t;
-
-
-.. c:type:: ca_caps
-
-ca_caps_t
-=
-
+.. c:type:: ca_msg
 
-.. code-block:: c
+Undocumented data types
+===
 
-typedef struct ca_caps {
-   unsigned int slot_num;  /* total number of CA card and module slots */
-   unsigned int slot_type; /* OR of all supported types */
-   unsigned int descr_num; /* total number of descrambler slots (keys) */
-   unsigned int descr_type;/* OR of all supported types */
- } ca_cap_t;
+.. note::
 
+   Those data types are undocumented. Documentation is welcome.
 
 .. c:type:: ca_msg
 
-ca_msg_t
-
-
-
 .. code-block:: c
 
 /* a message to/from a CI-CAM */
-typedef struct ca_msg {
+struct ca_msg {
unsigned int index;
unsigned int type;
unsigned int length;
unsigned char msg[256];
-} ca_msg_t;
+};
 
 
 .. c:type:: ca_descr
 
-ca_descr_t
-==
-
-
 .. code-block:: c
 
-typedef struct ca_descr {
+struct ca_descr {
unsigned int index;
unsigned int parity;
unsigned char cw[8];
-} ca_descr_t;
+};
diff --git a/include/uapi/linux/dvb/ca.h b/include/uapi/linux/dvb/ca.h
index 859f6c0c4751..f66ed53f4dc7 100644
--- a/include/uapi/linux/dvb/ca.h
+++ b/include/uapi/linux/dvb/ca.h
@@ -24,39 +24,81 @@
 #ifndef _DVBCA_H_
 #define _DVBCA_H_
 
-/* slot interface types and info */
+/**
+ * struct ca_slot_info - CA slot interface types and info.
+ *
+ * @num:   slot number.
+ * @type:  slot type.
+ * @flags: flags applicable to the slot.
+ *
+ * This struct stores the CA slot information.
+ *
+ * @type can be:
+ *
+ * - %CA_CI - CI high level interface;
+ * - %CA_CI_LINK - CI link layer level interface;
+ * - %CA_CI_PHYS - CI physical layer level interface;
+ * - %CA_DESCR - built-in descrambler;
+ * - %CA_SC -simple smart card interface.
+ *
+ * @flags can be:
+ *
+ * - %CA_CI_MODULE_PRESENT - module (or card) inserted;
+ * - %CA_CI_MODULE_READY - module is ready for usage.
+ */
 
 struct ca_slot_info {
-   int num;   /* slot number */
-
-   int type;  /* CA interface this slot supports */
-#define CA_CI1 /* CI high level interface */
-#define CA_CI_LINK   2 /* CI link layer level interface */
-#define CA_CI_PHYS   4 /* CI physical layer level interface */
-#define CA_DESCR 8 /* built-in descrambler */
-#define CA_SC  128 /* simple smart card interface */
+   int num;
+   int type;
+#define CA_CI1
+#define CA_CI_LINK   2
+#define CA_CI_PHYS   4
+#define CA_DESCR 8
+#define CA_SC  128
 
unsigned int flags;
-#define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */
+#define CA_CI_MODULE_PRESENT 1
 #define CA_CI_MODULE_READY   2
 };
 
 
-/* descrambler types and info */
-
+/**
+ * struct ca_descr_info - descrambler types and info.
+ *
+ * @num:   number of available descramblers (keys).
+ * 

[PATCH v2 00/26] Improve DVB documentation and reduce its gap

2017-09-01 Thread 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, 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 :-)

---

v2: Added CA API patches at the end and verified that everything
compiles after each patch. Also do some fixes at dst_ca for it
to report the error code to userspace and remove boilerplate
code there.

Mauro Carvalho Chehab (27):
  media: ca.h: split typedefs from structs
  media: dmx.h: split typedefs from structs
  media: dvb/intro: use the term Digital TV to refer to the system
  media: dvb/intro: update references for TV standards
  media: dvb/intro: update the history part of the document
  media: dvb/intro: adjust the notices about optional hardware
  media: dvb/frontend.h: move out a private internal structure
  media: dvb/frontend.h: document the uAPI file
  media: dvb frontend docs: use kernel-doc documentation
  media: fe_property_parameters.rst: better define properties usage
  media: fe_property_parameters.rst: better document bandwidth
  media: dmx.h: get rid of unused DMX_KERNEL_CLIENT
  media: dmx.h: get rid of DMX_GET_CAPS
  media: dmx.h: get rid of DMX_SET_SOURCE
  media: dmx.h: get rid of GET_DMX_EVENT
  media: dmx.h: add kernel-doc markups and use it at Documentation/
  media: net.rst: Fix the level of a section of the net chapter
  media: ca.h: get rid of CA_SET_PID
  media: ca.h: document most CA data types
  media: dst_ca: return a proper error code from CA errors
  media: ca-reset.rst: add some description to this ioctl
  media: ca-get-cap.rst: document this ioctl
  media: ca-get-slot-info.rst: document this ioctl
  media: ca-get-descr-info.rst: document this ioctl
  media: dvb CA docs: place undocumented data together with ioctls
  media: dvb rst: identify the documentation gap at the API
  media: dst_ca: remove CA_SET_DESCR boilerplate

 Documentation/media/ca.h.rst.exceptions|1 -
 Documentation/media/dmx.h.rst.exceptions   |   20 +-
 Documentation/media/dvb-drivers/ci.rst |1 -
 Documentation/media/frontend.h.rst.exceptions  |  185 ++-
 Documentation/media/uapi/dvb/ca-get-cap.rst|   36 +-
 Documentation/media/uapi/dvb/ca-get-descr-info.rst |   29 +-
 Documentation/media/uapi/dvb/ca-get-msg.rst|   38 +-
 Documentation/media/uapi/dvb/ca-get-slot-info.rst  |   98 +-
 Documentation/media/uapi/dvb/ca-reset.rst  |3 +-
 Documentation/media/uapi/dvb/ca-set-descr.rst  |   10 +
 Documentation/media/uapi/dvb/ca-set-pid.rst|   60 -
 Documentation/media/uapi/dvb/ca.rst|5 +
 Documentation/media/uapi/dvb/ca_data_types.rst |  103 +-
 Documentation/media/uapi/dvb/ca_function_calls.rst |1 -
 Documentation/media/uapi/dvb/dmx-get-caps.rst  |   41 -
 Documentation/media/uapi/dvb/dmx-get-event.rst |   60 -
 Documentation/media/uapi/dvb/dmx-set-source.rst|   44 -
 Documentation/media/uapi/dvb/dmx_fcalls.rst|3 -
 Documentation/media/uapi/dvb/dmx_types.rst |  225 +---
 Documentation/media/uapi/dvb/dtv-fe-stats.rst  |   17 -
 Documentation/media/uapi/dvb/dtv-properties.rst|   15 -
 Documentation/media/uapi/dvb/dtv-property.rst  |   31 -
 Documentation/media/uapi/dvb/dtv-stats.rst |   18 -
 Documentation/media/uapi/dvb/dvbproperty-006.rst   |   12 -
 Documentation/media/uapi/dvb/dvbproperty.rst   |   28 +-
 .../media/uapi/dvb/fe-diseqc-recv-slave-reply.rst  |   40 +-
 .../media/uapi/dvb/fe-diseqc-send-burst.rst|   31 +-
 .../media/uapi/dvb/fe-diseqc-send-master-cmd.rst   |   29 +-
 

Re: [PATCH 12/15] media: dmx.h: get rid of DMX_SET_SOURCE

2017-09-01 Thread Mauro Carvalho Chehab
Em Fri, 1 Sep 2017 13:14:04 +0200
Honza Petrouš  escreveu:

> 2017-09-01 12:45 GMT+02:00 Mauro Carvalho Chehab :
> > Em Fri, 1 Sep 2017 11:53:11 +0200
> > Honza Petrouš  escreveu:
> >  
> >> 2017-09-01 11:37 GMT+02:00 Mauro Carvalho Chehab 
> >> :  
> >> > Em Fri, 1 Sep 2017 08:28:20 +0200
> >> > Honza Petrouš  escreveu:
> >> >  
> >> >> 2017-09-01 1:46 GMT+02:00 Mauro Carvalho Chehab 
> >> >> :  
> >> >> > No driver uses this ioctl, nor it is documented anywhere.
> >> >> >
> >> >> > So, get rid of it.
> >> >> >
> >> >> > Signed-off-by: Mauro Carvalho Chehab 
> >> >> > ---
> >> >> >  Documentation/media/dmx.h.rst.exceptions| 13 
> >> >> >  Documentation/media/uapi/dvb/dmx-set-source.rst | 44 
> >> >> > -
> >> >> >  Documentation/media/uapi/dvb/dmx_fcalls.rst |  1 -
> >> >> >  Documentation/media/uapi/dvb/dmx_types.rst  | 20 ---
> >> >> >  include/uapi/linux/dvb/dmx.h| 12 ---
> >> >> >  5 files changed, 90 deletions(-)
> >> >> >  delete mode 100644 Documentation/media/uapi/dvb/dmx-set-source.rst
> >> >> >
> >> >> > diff --git a/Documentation/media/dmx.h.rst.exceptions 
> >> >> > b/Documentation/media/dmx.h.rst.exceptions
> >> >> > index 5572d2dc9d0e..d2dac35bb84b 100644
> >> >> > --- a/Documentation/media/dmx.h.rst.exceptions
> >> >> > +++ b/Documentation/media/dmx.h.rst.exceptions
> >> >> > @@ -40,18 +40,6 @@ replace enum dmx_input :c:type:`dmx_input`
> >> >> >  replace symbol DMX_IN_FRONTEND :c:type:`dmx_input`
> >> >> >  replace symbol DMX_IN_DVR :c:type:`dmx_input`
> >> >> >
> >> >> > -# dmx_source_t symbols
> >> >> > -replace enum dmx_source :c:type:`dmx_source`
> >> >> > -replace symbol DMX_SOURCE_FRONT0 :c:type:`dmx_source`
> >> >> > -replace symbol DMX_SOURCE_FRONT1 :c:type:`dmx_source`
> >> >> > -replace symbol DMX_SOURCE_FRONT2 :c:type:`dmx_source`
> >> >> > -replace symbol DMX_SOURCE_FRONT3 :c:type:`dmx_source`
> >> >> > -replace symbol DMX_SOURCE_DVR0 :c:type:`dmx_source`
> >> >> > -replace symbol DMX_SOURCE_DVR1 :c:type:`dmx_source`
> >> >> > -replace symbol DMX_SOURCE_DVR2 :c:type:`dmx_source`
> >> >> > -replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source`
> >> >> > -
> >> >> > -
> >> >> >  # Flags for struct dmx_sct_filter_params
> >> >> >  replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
> >> >> >  replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
> >> >> > @@ -61,4 +49,3 @@ replace define DMX_IMMEDIATE_START 
> >> >> > :c:type:`dmx_sct_filter_params`
> >> >> >  replace typedef dmx_filter_t :c:type:`dmx_filter`
> >> >> >  replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
> >> >> >  replace typedef dmx_input_t :c:type:`dmx_input`
> >> >> > -replace typedef dmx_source_t :c:type:`dmx_source`
> >> >> > diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst 
> >> >> > b/Documentation/media/uapi/dvb/dmx-set-source.rst
> >> >> > deleted file mode 100644
> >> >> > index ac7f77b25e06..
> >> >> > --- a/Documentation/media/uapi/dvb/dmx-set-source.rst
> >> >> > +++ /dev/null
> >> >> > @@ -1,44 +0,0 @@
> >> >> > -.. -*- coding: utf-8; mode: rst -*-
> >> >> > -
> >> >> > -.. _DMX_SET_SOURCE:
> >> >> > -
> >> >> > -==
> >> >> > -DMX_SET_SOURCE
> >> >> > -==
> >> >> > -
> >> >> > -Name
> >> >> > -
> >> >> > -
> >> >> > -DMX_SET_SOURCE
> >> >> > -
> >> >> > -
> >> >> > -Synopsis
> >> >> > -
> >> >> > -
> >> >> > -.. c:function:: int ioctl(fd, DMX_SET_SOURCE, struct dmx_source *src)
> >> >> > -:name: DMX_SET_SOURCE
> >> >> > -
> >> >> > -
> >> >> > -Arguments
> >> >> > --
> >> >> > -
> >> >> > -
> >> >> > -``fd``
> >> >> > -File descriptor returned by :c:func:`open() `.
> >> >> > -
> >> >> > -``src``
> >> >> > -   Undocumented.
> >> >> > -
> >> >> > -
> >> >> > -Description
> >> >> > 
> >> >> > -
> >> >> > -.. note:: This ioctl is undocumented. Documentation is welcome.
> >> >> > -
> >> >> > -
> >> >> > -Return Value
> >> >> > -
> >> >> > -
> >> >> > -On success 0 is returned, on error -1 and the ``errno`` variable is 
> >> >> > set
> >> >> > -appropriately. The generic error codes are described at the
> >> >> > -:ref:`Generic Error Codes ` chapter.
> >> >> > diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
> >> >> > b/Documentation/media/uapi/dvb/dmx_fcalls.rst
> >> >> > index 49e013d4540f..be98d60877f2 100644
> >> >> > --- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
> >> >> > +++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
> >> >> > @@ -21,6 +21,5 @@ Demux Function Calls
> >> >> >  dmx-get-event
> >> >> >  dmx-get-stc
> >> >> >  dmx-get-pes-pids
> >> >> > -dmx-set-source
> >> >> >  dmx-add-pid
> >> >> >  dmx-remove-pid
> >> >> > diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
> >> >> > 

Re: [PATCH v2 14/14] [media] v4l: Document explicit synchronization behaviour

2017-09-01 Thread Hans Verkuil
Hi Gustavo,

I think I concentrate on this last patch first. Once I fully understand this
I can review the code. Remember, it's been a while for me since I last looked
at fences, so forgive me if I ask stupid questions. On the other hand, others
with a similar lack of understanding of fences probably have similar questions,
so it is a good indication where the documentation needs improvement :-)

On 01/09/17 03:50, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Add section to VIDIOC_QBUF about it
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  Documentation/media/uapi/v4l/vidioc-qbuf.rst | 30 
> 
>  1 file changed, 30 insertions(+)
> 
> diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst 
> b/Documentation/media/uapi/v4l/vidioc-qbuf.rst
> index 1f3612637200..6bd960d3972b 100644
> --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst
> +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst
> @@ -117,6 +117,36 @@ immediately with an ``EAGAIN`` error code when no buffer 
> is available.
>  The struct :c:type:`v4l2_buffer` structure is specified in
>  :ref:`buffer`.
>  
> +Explicit Synchronization
> +
> +
> +Explicit Synchronization allows us to control the synchronization of
> +shared buffers from userspace by passing fences to the kernel and/or
> +receiving them from it. Fences passed to the kernel are named in-fences and
> +the kernel should wait them to signal before using the buffer, i.e., queueing
> +it to the driver. On the other side, the kernel can create out-fences for the
> +buffers it queues to the drivers, out-fences signal when the driver is
> +finished with buffer, that is the buffer is ready.

This should add a line explaining that fences are represented by file 
descriptors.

> +
> +The in-fences and out-fences are communicated at the ``VIDIOC_QBUF`` ioctl
> +using the ``V4L2_BUF_FLAG_IN_FENCE`` and ``V4L2_BUF_FLAG_OUT_FENCE`` buffer
> +flags and the `fence_fd` field. If an in-fence needs to be passed to the 
> kernel,
> +`fence_fd` should be set to the fence file descriptor number and the
> +``V4L2_BUF_FLAG_IN_FENCE`` should be set as well.

Is it possible to have both flags at the same time? Or are they mutually 
exclusive?

If only V4L2_BUF_FLAG_IN_FENCE is set, then what is the value of fence_fd after
the QBUF call? -1?

> +
> +To get a out-fence back from V4L2 the ``V4L2_BUF_FLAG_OUT_FENCE`` flag should
> +be set and the `fence_fd` field will be returned with the out-fence file
> +descriptor related to the next buffer to be queued internally to the V4L2
> +driver. That means the out-fence may not be associated with the buffer in the
> +current ``VIDIOC_QBUF`` ioctl call because the ordering in which videobuf2 
> core
> +queues the buffers to the drivers can't be guaranteed. To become aware of the
> +buffer with which the out-fence will be attached the 
> ``V4L2_EVENT_BUF_QUEUED``
> +should be used. It will trigger an event for every buffer queued to the V4L2
> +driver.

General question: does it even make sense to use an out-fence if you don't know 
with
what buffer is it associated? I mean, QBUF returns an out fence, but only some
time later are you informed about a buffer being queued. It also looks like 
userspace
has to keep track of the issued out-fences and the queued buffers and map them
accordingly.

If the out-fence cannot be used until you know the buffer as well, then wouldn't
it make more sense if the out-fence and the buffer index are both sent by the
event? Of course, in that case the event can only be sent to the owner file 
handle
of the streaming device node, but that's OK, we have that.

Setting the OUT_FENCE flag will just cause this event to be sent whenever that
buffer is queued internally.

Sorry if this just shows a complete lack of understanding of fences on my side,
that's perfectly possible.

It could be that when the out-fence triggers the listener is informed about the
associated buffer information, and in that case it makes a bit more sense.
Although in that case I don't see the reason for the event. Regardless, this
should be documented better.

This documentation should also clarify what happens with fences if the streaming
stops, either by a STREAMOFF, closing the filehandle or a crash or whatever.
Do they signal? What about out-fences not yet associated with a buffer?

> +
> +Note that the `fence_fd` field is both an input and output argument here with
> +different meaning on each direction. As input argument it carries an in-fence
> +and as output argument it carries an out-fence.
>  
>  Return Value
>  
> 

Regards,

Hans


Re: DRM Format Modifiers in v4l2

2017-09-01 Thread Rob Clark
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.

BR,
-R


Re: [PATCH v6 5/5] v4l: fwnode: Support generic parsing of graph endpoints in a single port

2017-09-01 Thread Hans Verkuil
On 30/08/17 13:49, Sakari Ailus wrote:
> This is the preferred way to parse the endpoints.
> 
> Comment rcar-vin as an example.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/platform/rcar-vin/rcar-core.c | 111 
> 
>  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 +-
>  drivers/media/v4l2-core/v4l2-fwnode.c   |  47 
>  include/media/v4l2-fwnode.h |  49 
>  6 files changed, 142 insertions(+), 93 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
> b/drivers/media/platform/rcar-vin/rcar-core.c
> index 142de447..4378806be1d4 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(>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(>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,67 @@ 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;
> -
> - ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), _ep);
> - if (ret) {
> - vin_err(vin, "Could not parse v4l2 endpoint\n");
> - return -EINVAL;
> - }
> + struct rvin_dev *vin = dev_get_drvdata(dev);
> + struct rvin_graph_entity *rvge =
> + container_of(asd, struct rvin_graph_entity, asd);
>  
> - 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;
> -
> 

Re: [PATCH v6.1 4/5] v4l: fwnode: Support generic parsing of graph endpoints in a device

2017-09-01 Thread Hans Verkuil
Hi Sakari,

On 30/08/17 14:45, Sakari Ailus wrote:
> 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.
> 
> Convert the omap3isp as an example.

It would be much easier to review if the omap3isp conversion was done in a
separate patch. Ditto for the rcar conversion, and I prefer to have both
at the end of the patch series, after the core code patches.

> 
> Signed-off-by: Sakari Ailus 
> ---
> since v6:
> 
> - Set notifier->subdevs NULL and notifier->num_subdevs 0 in
>   v4l2_async_notifier_release().
> 
>  drivers/media/platform/omap3isp/isp.c | 115 ++---
>  drivers/media/platform/omap3isp/isp.h |   5 +-
>  drivers/media/v4l2-core/v4l2-async.c  |  16 +
>  drivers/media/v4l2-core/v4l2-fwnode.c | 131 
> ++
>  include/media/v4l2-async.h|  24 ++-
>  include/media/v4l2-fwnode.h   |  48 +
>  6 files changed, 254 insertions(+), 85 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(>crashed);
> + v4l2_async_notifier_release(>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 = >bus;
> - struct v4l2_fwnode_endpoint vep;
> - unsigned int i;
> - int ret;
>   bool csi1 = false;
> -
> - ret = v4l2_fwnode_endpoint_parse(fwnode, );
> - 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:

Re: [PATCH 12/15] media: dmx.h: get rid of DMX_SET_SOURCE

2017-09-01 Thread Honza Petrouš
2017-09-01 12:45 GMT+02:00 Mauro Carvalho Chehab :
> Em Fri, 1 Sep 2017 11:53:11 +0200
> Honza Petrouš  escreveu:
>
>> 2017-09-01 11:37 GMT+02:00 Mauro Carvalho Chehab :
>> > Em Fri, 1 Sep 2017 08:28:20 +0200
>> > Honza Petrouš  escreveu:
>> >
>> >> 2017-09-01 1:46 GMT+02:00 Mauro Carvalho Chehab 
>> >> :
>> >> > No driver uses this ioctl, nor it is documented anywhere.
>> >> >
>> >> > So, get rid of it.
>> >> >
>> >> > Signed-off-by: Mauro Carvalho Chehab 
>> >> > ---
>> >> >  Documentation/media/dmx.h.rst.exceptions| 13 
>> >> >  Documentation/media/uapi/dvb/dmx-set-source.rst | 44 
>> >> > -
>> >> >  Documentation/media/uapi/dvb/dmx_fcalls.rst |  1 -
>> >> >  Documentation/media/uapi/dvb/dmx_types.rst  | 20 ---
>> >> >  include/uapi/linux/dvb/dmx.h| 12 ---
>> >> >  5 files changed, 90 deletions(-)
>> >> >  delete mode 100644 Documentation/media/uapi/dvb/dmx-set-source.rst
>> >> >
>> >> > diff --git a/Documentation/media/dmx.h.rst.exceptions 
>> >> > b/Documentation/media/dmx.h.rst.exceptions
>> >> > index 5572d2dc9d0e..d2dac35bb84b 100644
>> >> > --- a/Documentation/media/dmx.h.rst.exceptions
>> >> > +++ b/Documentation/media/dmx.h.rst.exceptions
>> >> > @@ -40,18 +40,6 @@ replace enum dmx_input :c:type:`dmx_input`
>> >> >  replace symbol DMX_IN_FRONTEND :c:type:`dmx_input`
>> >> >  replace symbol DMX_IN_DVR :c:type:`dmx_input`
>> >> >
>> >> > -# dmx_source_t symbols
>> >> > -replace enum dmx_source :c:type:`dmx_source`
>> >> > -replace symbol DMX_SOURCE_FRONT0 :c:type:`dmx_source`
>> >> > -replace symbol DMX_SOURCE_FRONT1 :c:type:`dmx_source`
>> >> > -replace symbol DMX_SOURCE_FRONT2 :c:type:`dmx_source`
>> >> > -replace symbol DMX_SOURCE_FRONT3 :c:type:`dmx_source`
>> >> > -replace symbol DMX_SOURCE_DVR0 :c:type:`dmx_source`
>> >> > -replace symbol DMX_SOURCE_DVR1 :c:type:`dmx_source`
>> >> > -replace symbol DMX_SOURCE_DVR2 :c:type:`dmx_source`
>> >> > -replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source`
>> >> > -
>> >> > -
>> >> >  # Flags for struct dmx_sct_filter_params
>> >> >  replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
>> >> >  replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
>> >> > @@ -61,4 +49,3 @@ replace define DMX_IMMEDIATE_START 
>> >> > :c:type:`dmx_sct_filter_params`
>> >> >  replace typedef dmx_filter_t :c:type:`dmx_filter`
>> >> >  replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
>> >> >  replace typedef dmx_input_t :c:type:`dmx_input`
>> >> > -replace typedef dmx_source_t :c:type:`dmx_source`
>> >> > diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst 
>> >> > b/Documentation/media/uapi/dvb/dmx-set-source.rst
>> >> > deleted file mode 100644
>> >> > index ac7f77b25e06..
>> >> > --- a/Documentation/media/uapi/dvb/dmx-set-source.rst
>> >> > +++ /dev/null
>> >> > @@ -1,44 +0,0 @@
>> >> > -.. -*- coding: utf-8; mode: rst -*-
>> >> > -
>> >> > -.. _DMX_SET_SOURCE:
>> >> > -
>> >> > -==
>> >> > -DMX_SET_SOURCE
>> >> > -==
>> >> > -
>> >> > -Name
>> >> > -
>> >> > -
>> >> > -DMX_SET_SOURCE
>> >> > -
>> >> > -
>> >> > -Synopsis
>> >> > -
>> >> > -
>> >> > -.. c:function:: int ioctl(fd, DMX_SET_SOURCE, struct dmx_source *src)
>> >> > -:name: DMX_SET_SOURCE
>> >> > -
>> >> > -
>> >> > -Arguments
>> >> > --
>> >> > -
>> >> > -
>> >> > -``fd``
>> >> > -File descriptor returned by :c:func:`open() `.
>> >> > -
>> >> > -``src``
>> >> > -   Undocumented.
>> >> > -
>> >> > -
>> >> > -Description
>> >> > 
>> >> > -
>> >> > -.. note:: This ioctl is undocumented. Documentation is welcome.
>> >> > -
>> >> > -
>> >> > -Return Value
>> >> > -
>> >> > -
>> >> > -On success 0 is returned, on error -1 and the ``errno`` variable is set
>> >> > -appropriately. The generic error codes are described at the
>> >> > -:ref:`Generic Error Codes ` chapter.
>> >> > diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
>> >> > b/Documentation/media/uapi/dvb/dmx_fcalls.rst
>> >> > index 49e013d4540f..be98d60877f2 100644
>> >> > --- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
>> >> > +++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
>> >> > @@ -21,6 +21,5 @@ Demux Function Calls
>> >> >  dmx-get-event
>> >> >  dmx-get-stc
>> >> >  dmx-get-pes-pids
>> >> > -dmx-set-source
>> >> >  dmx-add-pid
>> >> >  dmx-remove-pid
>> >> > diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
>> >> > b/Documentation/media/uapi/dvb/dmx_types.rst
>> >> > index 9e907b85cf16..a205c02ccdc1 100644
>> >> > --- a/Documentation/media/uapi/dvb/dmx_types.rst
>> >> > +++ b/Documentation/media/uapi/dvb/dmx_types.rst
>> >> > @@ -197,23 +197,3 @@ struct dmx_stc
>> >> > unsigned int base;  /* output: divisor for stc to get 90 kHz 
>> >> > clock */
>> >> > 

Re: [PATCH v6 3/5] docs-rst: v4l: Include Qualcomm CAMSS in documentation build

2017-09-01 Thread Hans Verkuil
On 30/08/17 13:49, Sakari Ailus wrote:
> Qualcomm CAMSS was left out from documentation build. Fix this.
> 
> Signed-off-by: Sakari Ailus 
> Reviewed-by: Laurent Pinchart 

Acked-by: Hans Verkuil 

Regards,

Hans


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



Re: [PATCH 12/15] media: dmx.h: get rid of DMX_SET_SOURCE

2017-09-01 Thread Mauro Carvalho Chehab
Em Fri, 1 Sep 2017 11:53:11 +0200
Honza Petrouš  escreveu:

> 2017-09-01 11:37 GMT+02:00 Mauro Carvalho Chehab :
> > Em Fri, 1 Sep 2017 08:28:20 +0200
> > Honza Petrouš  escreveu:
> >  
> >> 2017-09-01 1:46 GMT+02:00 Mauro Carvalho Chehab 
> >> :  
> >> > No driver uses this ioctl, nor it is documented anywhere.
> >> >
> >> > So, get rid of it.
> >> >
> >> > Signed-off-by: Mauro Carvalho Chehab 
> >> > ---
> >> >  Documentation/media/dmx.h.rst.exceptions| 13 
> >> >  Documentation/media/uapi/dvb/dmx-set-source.rst | 44 
> >> > -
> >> >  Documentation/media/uapi/dvb/dmx_fcalls.rst |  1 -
> >> >  Documentation/media/uapi/dvb/dmx_types.rst  | 20 ---
> >> >  include/uapi/linux/dvb/dmx.h| 12 ---
> >> >  5 files changed, 90 deletions(-)
> >> >  delete mode 100644 Documentation/media/uapi/dvb/dmx-set-source.rst
> >> >
> >> > diff --git a/Documentation/media/dmx.h.rst.exceptions 
> >> > b/Documentation/media/dmx.h.rst.exceptions
> >> > index 5572d2dc9d0e..d2dac35bb84b 100644
> >> > --- a/Documentation/media/dmx.h.rst.exceptions
> >> > +++ b/Documentation/media/dmx.h.rst.exceptions
> >> > @@ -40,18 +40,6 @@ replace enum dmx_input :c:type:`dmx_input`
> >> >  replace symbol DMX_IN_FRONTEND :c:type:`dmx_input`
> >> >  replace symbol DMX_IN_DVR :c:type:`dmx_input`
> >> >
> >> > -# dmx_source_t symbols
> >> > -replace enum dmx_source :c:type:`dmx_source`
> >> > -replace symbol DMX_SOURCE_FRONT0 :c:type:`dmx_source`
> >> > -replace symbol DMX_SOURCE_FRONT1 :c:type:`dmx_source`
> >> > -replace symbol DMX_SOURCE_FRONT2 :c:type:`dmx_source`
> >> > -replace symbol DMX_SOURCE_FRONT3 :c:type:`dmx_source`
> >> > -replace symbol DMX_SOURCE_DVR0 :c:type:`dmx_source`
> >> > -replace symbol DMX_SOURCE_DVR1 :c:type:`dmx_source`
> >> > -replace symbol DMX_SOURCE_DVR2 :c:type:`dmx_source`
> >> > -replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source`
> >> > -
> >> > -
> >> >  # Flags for struct dmx_sct_filter_params
> >> >  replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
> >> >  replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
> >> > @@ -61,4 +49,3 @@ replace define DMX_IMMEDIATE_START 
> >> > :c:type:`dmx_sct_filter_params`
> >> >  replace typedef dmx_filter_t :c:type:`dmx_filter`
> >> >  replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
> >> >  replace typedef dmx_input_t :c:type:`dmx_input`
> >> > -replace typedef dmx_source_t :c:type:`dmx_source`
> >> > diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst 
> >> > b/Documentation/media/uapi/dvb/dmx-set-source.rst
> >> > deleted file mode 100644
> >> > index ac7f77b25e06..
> >> > --- a/Documentation/media/uapi/dvb/dmx-set-source.rst
> >> > +++ /dev/null
> >> > @@ -1,44 +0,0 @@
> >> > -.. -*- coding: utf-8; mode: rst -*-
> >> > -
> >> > -.. _DMX_SET_SOURCE:
> >> > -
> >> > -==
> >> > -DMX_SET_SOURCE
> >> > -==
> >> > -
> >> > -Name
> >> > -
> >> > -
> >> > -DMX_SET_SOURCE
> >> > -
> >> > -
> >> > -Synopsis
> >> > -
> >> > -
> >> > -.. c:function:: int ioctl(fd, DMX_SET_SOURCE, struct dmx_source *src)
> >> > -:name: DMX_SET_SOURCE
> >> > -
> >> > -
> >> > -Arguments
> >> > --
> >> > -
> >> > -
> >> > -``fd``
> >> > -File descriptor returned by :c:func:`open() `.
> >> > -
> >> > -``src``
> >> > -   Undocumented.
> >> > -
> >> > -
> >> > -Description
> >> > 
> >> > -
> >> > -.. note:: This ioctl is undocumented. Documentation is welcome.
> >> > -
> >> > -
> >> > -Return Value
> >> > -
> >> > -
> >> > -On success 0 is returned, on error -1 and the ``errno`` variable is set
> >> > -appropriately. The generic error codes are described at the
> >> > -:ref:`Generic Error Codes ` chapter.
> >> > diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
> >> > b/Documentation/media/uapi/dvb/dmx_fcalls.rst
> >> > index 49e013d4540f..be98d60877f2 100644
> >> > --- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
> >> > +++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
> >> > @@ -21,6 +21,5 @@ Demux Function Calls
> >> >  dmx-get-event
> >> >  dmx-get-stc
> >> >  dmx-get-pes-pids
> >> > -dmx-set-source
> >> >  dmx-add-pid
> >> >  dmx-remove-pid
> >> > diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
> >> > b/Documentation/media/uapi/dvb/dmx_types.rst
> >> > index 9e907b85cf16..a205c02ccdc1 100644
> >> > --- a/Documentation/media/uapi/dvb/dmx_types.rst
> >> > +++ b/Documentation/media/uapi/dvb/dmx_types.rst
> >> > @@ -197,23 +197,3 @@ struct dmx_stc
> >> > unsigned int base;  /* output: divisor for stc to get 90 kHz 
> >> > clock */
> >> > __u64 stc;  /* output: stc in 'base'*90 kHz units */
> >> >  };
> >> > -
> >> > -
> >> > -
> >> > -enum dmx_source
> >> > -===
> >> > -
> >> > -.. c:type:: dmx_source
> >> > -
> >> > 

Re: [PATCH v6 2/5] v4l: async: Add V4L2 async documentation to the documentation build

2017-09-01 Thread Hans Verkuil
On 30/08/17 13:49, Sakari Ailus wrote:
> 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 

Regards,

Hans


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



Re: [PATCH v6 1/5] v4l: fwnode: Move KernelDoc documentation to the header

2017-09-01 Thread Hans Verkuil
On 30/08/17 13:49, Sakari Ailus wrote:
> 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 

Regards,

Hans

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

Re: [PATCH v6 1/7] media: add glossary.rst with a glossary of terms used at V4L2 spec

2017-09-01 Thread Hans Verkuil
On 29/08/17 15:17, Mauro Carvalho Chehab wrote:
> Add a glossary of terms for V4L2, as several concepts are complex
> enough to cause misunderstandings.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  Documentation/media/uapi/v4l/glossary.rst | 150 
> ++
>  Documentation/media/uapi/v4l/v4l2.rst |   1 +
>  2 files changed, 151 insertions(+)
>  create mode 100644 Documentation/media/uapi/v4l/glossary.rst
> 
> diff --git a/Documentation/media/uapi/v4l/glossary.rst 
> b/Documentation/media/uapi/v4l/glossary.rst
> new file mode 100644
> index ..afafe1bc1894
> --- /dev/null
> +++ b/Documentation/media/uapi/v4l/glossary.rst
> @@ -0,0 +1,150 @@
> +
> +Glossary
> +
> +
> +.. note::
> +
> +   This goal of section is to standardize the terms used within the V4L2
> +   documentation. It is written incrementally as they are standardized in
> +   the V4L2 documentation. So, it is a Work In Progress.
> +
> +.. Please keep the glossary entries in alphabetical order
> +
> +.. glossary::
> +
> +Bridge driver
> + The same as V4L2 main driver.
> +
> +Device Node
> + A character device node in the file system used to control and do
> + input/output data transfers from/to a Kernel driver.
> +
> +Digital Signal Processor - DSP
> + A specialized microprocessor, with its architecture optimized for
> + the operational needs of digital signal processing.
> +
> +Driver
> + The part of the Linux Kernel that implements support
> + for a hardware component.
> +
> +Field-programmable Gate Array - FPGA
> + A field-programmable gate array (FPGA) is an integrated circuit
> + designed to be configured by a customer or a designer after
> + manufacturing.
> +
> + See https://en.wikipedia.org/wiki/Field-programmable_gate_array.
> +
> +Hardware component
> + A subset of the media hardware. For example an I²C or SPI device,
> + or an IP block inside an SoC or FPGA.
> +
> +Hardware peripheral

As I mentioned before, I really don't like the term 'peripheral'. I am
fine with "Media hardware". A peripheral to me are keyboards, mice, webcams,
printers, etc. Not an SoC with a CSI sensor on the board.

> + A group of hardware components that together make a larger
> + user-facing functional peripheral. For instance the SoC ISP IP
> + cores and external camera sensors together make a
> + camera hardware peripheral.
> +
> + Also known as peripheral.
> +
> +Hardware peripheral control

So this would become "Media hardware control"

> + Type of control for a hardware peripheral supported by V4L2 drivers.
> +
> + See :ref:`v4l2_hardware_control`.
> +
> +Inter-Integrated Circuit - I²C
> + A  multi-master, multi-slave, packet switched, single-ended,
> + serial computer bus used to control V4L2 sub-devices.
> +
> + See http://www.nxp.com/docs/en/user-guide/UM10204.pdf.
> +
> +Integrated circuit - IC
> + A set of electronic circuits on one small flat piece of
> + semiconductor material, normally silicon.
> +
> + Also known as chip.
> +
> +IP block
> + The same as IP core.
> +
> +Intelectual property core - IP core

Typo: Intellectual

> + In electronic design a semiconductor intellectual property core,
> + is a reusable unit of logic, cell, or integrated circuit layout
> + design that is the intellectual property of one party.
> + IP cores may be licensed to another party or can be owned
> + and used by a single party alone.
> +
> + See 
> https://en.wikipedia.org/wiki/Semiconductor_intellectual_property_core).
> +
> +Image Signal Processor - ISP
> + A specialised processor that implements a set of algorithms for
> + processing image data. ISPs may implement algorithms for lens
> + shading correction, demosaic, scaling and pixel format conversion
> + as well as produce statistics for the use of the control
> + algorithms (e.g. automatic exposure, white balance and focus).
> +
> +Peripheral
> + The same as hardware peripheral.

I'd drop this.

> +
> +Media Controller
> + An API designed to expose and control devices and sub-devices
> + relationships to applications.
> +
> + See :ref:`media_controller`.
> +
> +MC-centric
> + V4L2 hardware that requires a Media controller.
> +
> + See :ref:`v4l2_hardware_control`.
> +
> +Microprocessor
> + An electronic circuitry that carries out the instructions
> + of a computer program by performing the basic arithmetic, logical,
> + control and input/output (I/O) operations specified by the
> + instructions on a single integrated circuit.
> +
> +SMBus
> + A subset of I²C, with defines a stricter usage of the bus.
> +
> +Serial Peripheral Interface Bus - SPI
> + Synchronous serial communication interface specification used for
> + short distance communication, 

Re: [PATCH 12/15] media: dmx.h: get rid of DMX_SET_SOURCE

2017-09-01 Thread Honza Petrouš
2017-09-01 11:37 GMT+02:00 Mauro Carvalho Chehab :
> Em Fri, 1 Sep 2017 08:28:20 +0200
> Honza Petrouš  escreveu:
>
>> 2017-09-01 1:46 GMT+02:00 Mauro Carvalho Chehab :
>> > No driver uses this ioctl, nor it is documented anywhere.
>> >
>> > So, get rid of it.
>> >
>> > Signed-off-by: Mauro Carvalho Chehab 
>> > ---
>> >  Documentation/media/dmx.h.rst.exceptions| 13 
>> >  Documentation/media/uapi/dvb/dmx-set-source.rst | 44 
>> > -
>> >  Documentation/media/uapi/dvb/dmx_fcalls.rst |  1 -
>> >  Documentation/media/uapi/dvb/dmx_types.rst  | 20 ---
>> >  include/uapi/linux/dvb/dmx.h| 12 ---
>> >  5 files changed, 90 deletions(-)
>> >  delete mode 100644 Documentation/media/uapi/dvb/dmx-set-source.rst
>> >
>> > diff --git a/Documentation/media/dmx.h.rst.exceptions 
>> > b/Documentation/media/dmx.h.rst.exceptions
>> > index 5572d2dc9d0e..d2dac35bb84b 100644
>> > --- a/Documentation/media/dmx.h.rst.exceptions
>> > +++ b/Documentation/media/dmx.h.rst.exceptions
>> > @@ -40,18 +40,6 @@ replace enum dmx_input :c:type:`dmx_input`
>> >  replace symbol DMX_IN_FRONTEND :c:type:`dmx_input`
>> >  replace symbol DMX_IN_DVR :c:type:`dmx_input`
>> >
>> > -# dmx_source_t symbols
>> > -replace enum dmx_source :c:type:`dmx_source`
>> > -replace symbol DMX_SOURCE_FRONT0 :c:type:`dmx_source`
>> > -replace symbol DMX_SOURCE_FRONT1 :c:type:`dmx_source`
>> > -replace symbol DMX_SOURCE_FRONT2 :c:type:`dmx_source`
>> > -replace symbol DMX_SOURCE_FRONT3 :c:type:`dmx_source`
>> > -replace symbol DMX_SOURCE_DVR0 :c:type:`dmx_source`
>> > -replace symbol DMX_SOURCE_DVR1 :c:type:`dmx_source`
>> > -replace symbol DMX_SOURCE_DVR2 :c:type:`dmx_source`
>> > -replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source`
>> > -
>> > -
>> >  # Flags for struct dmx_sct_filter_params
>> >  replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
>> >  replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
>> > @@ -61,4 +49,3 @@ replace define DMX_IMMEDIATE_START 
>> > :c:type:`dmx_sct_filter_params`
>> >  replace typedef dmx_filter_t :c:type:`dmx_filter`
>> >  replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
>> >  replace typedef dmx_input_t :c:type:`dmx_input`
>> > -replace typedef dmx_source_t :c:type:`dmx_source`
>> > diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst 
>> > b/Documentation/media/uapi/dvb/dmx-set-source.rst
>> > deleted file mode 100644
>> > index ac7f77b25e06..
>> > --- a/Documentation/media/uapi/dvb/dmx-set-source.rst
>> > +++ /dev/null
>> > @@ -1,44 +0,0 @@
>> > -.. -*- coding: utf-8; mode: rst -*-
>> > -
>> > -.. _DMX_SET_SOURCE:
>> > -
>> > -==
>> > -DMX_SET_SOURCE
>> > -==
>> > -
>> > -Name
>> > -
>> > -
>> > -DMX_SET_SOURCE
>> > -
>> > -
>> > -Synopsis
>> > -
>> > -
>> > -.. c:function:: int ioctl(fd, DMX_SET_SOURCE, struct dmx_source *src)
>> > -:name: DMX_SET_SOURCE
>> > -
>> > -
>> > -Arguments
>> > --
>> > -
>> > -
>> > -``fd``
>> > -File descriptor returned by :c:func:`open() `.
>> > -
>> > -``src``
>> > -   Undocumented.
>> > -
>> > -
>> > -Description
>> > 
>> > -
>> > -.. note:: This ioctl is undocumented. Documentation is welcome.
>> > -
>> > -
>> > -Return Value
>> > -
>> > -
>> > -On success 0 is returned, on error -1 and the ``errno`` variable is set
>> > -appropriately. The generic error codes are described at the
>> > -:ref:`Generic Error Codes ` chapter.
>> > diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
>> > b/Documentation/media/uapi/dvb/dmx_fcalls.rst
>> > index 49e013d4540f..be98d60877f2 100644
>> > --- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
>> > +++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
>> > @@ -21,6 +21,5 @@ Demux Function Calls
>> >  dmx-get-event
>> >  dmx-get-stc
>> >  dmx-get-pes-pids
>> > -dmx-set-source
>> >  dmx-add-pid
>> >  dmx-remove-pid
>> > diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
>> > b/Documentation/media/uapi/dvb/dmx_types.rst
>> > index 9e907b85cf16..a205c02ccdc1 100644
>> > --- a/Documentation/media/uapi/dvb/dmx_types.rst
>> > +++ b/Documentation/media/uapi/dvb/dmx_types.rst
>> > @@ -197,23 +197,3 @@ struct dmx_stc
>> > unsigned int base;  /* output: divisor for stc to get 90 kHz clock 
>> > */
>> > __u64 stc;  /* output: stc in 'base'*90 kHz units */
>> >  };
>> > -
>> > -
>> > -
>> > -enum dmx_source
>> > -===
>> > -
>> > -.. c:type:: dmx_source
>> > -
>> > -.. code-block:: c
>> > -
>> > -typedef enum dmx_source {
>> > -   DMX_SOURCE_FRONT0 = 0,
>> > -   DMX_SOURCE_FRONT1,
>> > -   DMX_SOURCE_FRONT2,
>> > -   DMX_SOURCE_FRONT3,
>> > -   DMX_SOURCE_DVR0   = 16,
>> > -   DMX_SOURCE_DVR1,
>> > -   DMX_SOURCE_DVR2,
>> > -   DMX_SOURCE_DVR3
>> > -} dmx_source_t;
>> > diff 

[ANN] Call for topics for the media mini-summit on Friday Oct 27 in Prague

2017-09-01 Thread Hans Verkuil
Hi all,

We are organizing a media mini-summit on Friday October 27 in Prague, co-located
with the ELCE conference:

http://events.linuxfoundation.org/events/embedded-linux-conference-europe

This is a call for topics to discuss during that mini-summit.

Also, if you plan to attend, please let me know. It is open for all, but it is
nice if we know beforehand who we can expect.

So if you have a topic that you want to discuss there, then just reply to this
post. If possible, please add a rough idea of how much time you think you will
need.

I plan to make the agenda based on the received topics around mid-October.

Let me kick this off:

Topic: Media development process: what works, what doesn't.
Purpose: In the past 6 months or so we tried to improve the media development
 process. This is an overview of what we did and why we did it, what
 works and what doesn't. Feedback is very much appreciated. It is even
 more appreciated if people/companies would be willing to assign
 new developers to help improve the media subsystem!
Duration: 30-60 minutes

Topic: status of the HDMI CEC kernel support.
Purpose: give a quick overview of the status: what has been merged, what is 
still
 pending, what is under development.
Duration: 10-15 minutes

Regards,

Hans


Re: [PATCH 12/15] media: dmx.h: get rid of DMX_SET_SOURCE

2017-09-01 Thread Mauro Carvalho Chehab
Em Fri, 1 Sep 2017 08:28:20 +0200
Honza Petrouš  escreveu:

> 2017-09-01 1:46 GMT+02:00 Mauro Carvalho Chehab :
> > No driver uses this ioctl, nor it is documented anywhere.
> >
> > So, get rid of it.
> >
> > Signed-off-by: Mauro Carvalho Chehab 
> > ---
> >  Documentation/media/dmx.h.rst.exceptions| 13 
> >  Documentation/media/uapi/dvb/dmx-set-source.rst | 44 
> > -
> >  Documentation/media/uapi/dvb/dmx_fcalls.rst |  1 -
> >  Documentation/media/uapi/dvb/dmx_types.rst  | 20 ---
> >  include/uapi/linux/dvb/dmx.h| 12 ---
> >  5 files changed, 90 deletions(-)
> >  delete mode 100644 Documentation/media/uapi/dvb/dmx-set-source.rst
> >
> > diff --git a/Documentation/media/dmx.h.rst.exceptions 
> > b/Documentation/media/dmx.h.rst.exceptions
> > index 5572d2dc9d0e..d2dac35bb84b 100644
> > --- a/Documentation/media/dmx.h.rst.exceptions
> > +++ b/Documentation/media/dmx.h.rst.exceptions
> > @@ -40,18 +40,6 @@ replace enum dmx_input :c:type:`dmx_input`
> >  replace symbol DMX_IN_FRONTEND :c:type:`dmx_input`
> >  replace symbol DMX_IN_DVR :c:type:`dmx_input`
> >
> > -# dmx_source_t symbols
> > -replace enum dmx_source :c:type:`dmx_source`
> > -replace symbol DMX_SOURCE_FRONT0 :c:type:`dmx_source`
> > -replace symbol DMX_SOURCE_FRONT1 :c:type:`dmx_source`
> > -replace symbol DMX_SOURCE_FRONT2 :c:type:`dmx_source`
> > -replace symbol DMX_SOURCE_FRONT3 :c:type:`dmx_source`
> > -replace symbol DMX_SOURCE_DVR0 :c:type:`dmx_source`
> > -replace symbol DMX_SOURCE_DVR1 :c:type:`dmx_source`
> > -replace symbol DMX_SOURCE_DVR2 :c:type:`dmx_source`
> > -replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source`
> > -
> > -
> >  # Flags for struct dmx_sct_filter_params
> >  replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
> >  replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
> > @@ -61,4 +49,3 @@ replace define DMX_IMMEDIATE_START 
> > :c:type:`dmx_sct_filter_params`
> >  replace typedef dmx_filter_t :c:type:`dmx_filter`
> >  replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
> >  replace typedef dmx_input_t :c:type:`dmx_input`
> > -replace typedef dmx_source_t :c:type:`dmx_source`
> > diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst 
> > b/Documentation/media/uapi/dvb/dmx-set-source.rst
> > deleted file mode 100644
> > index ac7f77b25e06..
> > --- a/Documentation/media/uapi/dvb/dmx-set-source.rst
> > +++ /dev/null
> > @@ -1,44 +0,0 @@
> > -.. -*- coding: utf-8; mode: rst -*-
> > -
> > -.. _DMX_SET_SOURCE:
> > -
> > -==
> > -DMX_SET_SOURCE
> > -==
> > -
> > -Name
> > -
> > -
> > -DMX_SET_SOURCE
> > -
> > -
> > -Synopsis
> > -
> > -
> > -.. c:function:: int ioctl(fd, DMX_SET_SOURCE, struct dmx_source *src)
> > -:name: DMX_SET_SOURCE
> > -
> > -
> > -Arguments
> > --
> > -
> > -
> > -``fd``
> > -File descriptor returned by :c:func:`open() `.
> > -
> > -``src``
> > -   Undocumented.
> > -
> > -
> > -Description
> > 
> > -
> > -.. note:: This ioctl is undocumented. Documentation is welcome.
> > -
> > -
> > -Return Value
> > -
> > -
> > -On success 0 is returned, on error -1 and the ``errno`` variable is set
> > -appropriately. The generic error codes are described at the
> > -:ref:`Generic Error Codes ` chapter.
> > diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
> > b/Documentation/media/uapi/dvb/dmx_fcalls.rst
> > index 49e013d4540f..be98d60877f2 100644
> > --- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
> > +++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
> > @@ -21,6 +21,5 @@ Demux Function Calls
> >  dmx-get-event
> >  dmx-get-stc
> >  dmx-get-pes-pids
> > -dmx-set-source
> >  dmx-add-pid
> >  dmx-remove-pid
> > diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
> > b/Documentation/media/uapi/dvb/dmx_types.rst
> > index 9e907b85cf16..a205c02ccdc1 100644
> > --- a/Documentation/media/uapi/dvb/dmx_types.rst
> > +++ b/Documentation/media/uapi/dvb/dmx_types.rst
> > @@ -197,23 +197,3 @@ struct dmx_stc
> > unsigned int base;  /* output: divisor for stc to get 90 kHz clock 
> > */
> > __u64 stc;  /* output: stc in 'base'*90 kHz units */
> >  };
> > -
> > -
> > -
> > -enum dmx_source
> > -===
> > -
> > -.. c:type:: dmx_source
> > -
> > -.. code-block:: c
> > -
> > -typedef enum dmx_source {
> > -   DMX_SOURCE_FRONT0 = 0,
> > -   DMX_SOURCE_FRONT1,
> > -   DMX_SOURCE_FRONT2,
> > -   DMX_SOURCE_FRONT3,
> > -   DMX_SOURCE_DVR0   = 16,
> > -   DMX_SOURCE_DVR1,
> > -   DMX_SOURCE_DVR2,
> > -   DMX_SOURCE_DVR3
> > -} dmx_source_t;
> > diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
> > index c0ee44fbdb13..dd2b832c02ce 100644
> > --- a/include/uapi/linux/dvb/dmx.h
> > +++ b/include/uapi/linux/dvb/dmx.h
> > @@ -117,17 +117,6 @@ struct 

Re: [PATCH 00/15] Improve DVB documentation and reduce its gap

2017-09-01 Thread Mauro Carvalho Chehab
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.
> >  
> 
> 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.

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.

So, anyone wanting to upstream drivers for a modern FF hardware would need
to touch a lot inside the DVB API, for it to cover all the needs. A more
appropriate approach to support those devices would be, instead, 
to use a set of APIs: DVB, V4L2, ALSA, RC, CEC, MC, DRM.

> 
> It's my 5 cents
> /Honza
> 
> (*) My favourite is HiSilicon with very nice Hi3798 4K chip
> with announced support from Linaro and already available
> devboard for reasonable price.
> 
> PS: I'm in no any way connected with HiSilicon nor
> any other DVB-enabled SoC vendor.

Thanks,
Mauro


Re: [PATCH v5 4/5] v4l: fwnode: Support generic parsing of graph endpoints in a device

2017-09-01 Thread Sakari Ailus
Hi Laurent,

On Fri, Sep 01, 2017 at 11:55:43AM +0300, Laurent Pinchart wrote:
...
> > >> +static int parse_endpoint(
> > >> +struct device *dev, struct v4l2_async_notifier *notifier,
> > >> +struct fwnode_handle *endpoint, unsigned int asd_struct_size,
> > >> +int (*parse_single)(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. */
> > > 
> > > You don't ignore them anymore, the comment should be updated.
> > 
> > Hmm. I actually intended to do something else about this. :-) As there's a
> > single error code, handling that would need to be done a little bit
> > differently right now.
> > 
> > I'd print a warning and proceed. What do you think?
> > 
> > Even if there's a bad DT endpoint, that shouldn't prevent the rest from
> > working, right?
> 
> I think it should, to make sure we catch DT issues. We both know how many 
> vendors don't care about warnings, so I'd rather fail completely to ensure DT 
> will be fixed (and even ten I wouldn't be surprised if some vendors patched 
> the code to remove the check instead of fixing their DT ;-)).

If they test the DTS, they should find out that the device does not work.

If they do not, some devices will work even if others fail.

Therefore I don't see why everything should fail when a part of faulty.
Extending that a little, you should also halt the system to make sure the
problem will be noticed. :-)

> > >> @@ -121,6 +122,21 @@ int v4l2_async_notifier_register(struct v4l2_device
> > >> *v4l2_dev, void v4l2_async_notifier_unregister(struct
> > >> v4l2_async_notifier *notifier);
> > >> 
> > >>  /**
> > >> + * v4l2_async_notifier_release - release notifier resources
> > >> + * @notifier: pointer to  v4l2_async_notifier
> > > 
> > > That's quite obvious given the type of the argument. It would be much more
> > > useful to tell which notifier pointer this function expects (although in
> > > this case it should be obvious too): "(pointer to )?the notifier whose
> > > resources will be released".
> > 
> > This fully matches to the documentation elsewhere in the same file. :-)
> 
> Feel free to fix the rest of the file :-)

That's out of scope of this patch.

> > > "The function can be called multiple times to populate the same notifier
> > > from endpoints of different @dev devices before registering the notifier.
> > > It can't be called anymore once the notifier has been registered."
> > 
> > I don't think there's really a use case for calling this for more than one
> > device, is there?
> 
> I don't have one in mind, but I was wondering. If there isn't then you don't 
> need notifier_realloc(), which could be moved to the next patch.

I don't think there's even benefit from moving it to the next patch, it
just adds to the reviewable code, nothing else.

-- 
Regards,

Sakari Ailus
sakari.ai...@linux.intel.com


Re: [PATCH v5 4/5] v4l: fwnode: Support generic parsing of graph endpoints in a device

2017-09-01 Thread Laurent Pinchart
Hi Sakari,

On Tuesday, 29 August 2017 17:31:21 EEST Sakari Ailus wrote:
> On Tue, Aug 29, 2017 at 05:02:54PM +0300, Laurent Pinchart wrote:
> > On Tuesday, 29 August 2017 14:03:12 EEST Sakari Ailus wrote:
> >> 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.
> >> 
> >> Convert the omap3isp as an example.
> >> 
> >> Signed-off-by: Sakari Ailus 
> >> ---
> >> 
> >>  drivers/media/platform/omap3isp/isp.c | 115 ++-
> >>  drivers/media/platform/omap3isp/isp.h |   5 +-
> >>  drivers/media/v4l2-core/v4l2-async.c  |  16 +
> >>  drivers/media/v4l2-core/v4l2-fwnode.c | 132 
> >>  include/media/v4l2-async.h| > 20 +-
> >>  include/media/v4l2-fwnode.h   |  39 ++
> >>  6 files changed, 242 insertions(+), 85 deletions(-)

[snip]

> >> diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c
> >> b/drivers/media/v4l2-core/v4l2-fwnode.c index 706f9e7b90f1..39a587c6992a
> >> 100644
> >> --- a/drivers/media/v4l2-core/v4l2-fwnode.c
> >> +++ b/drivers/media/v4l2-core/v4l2-fwnode.c

[snip]

> >> +static int parse_endpoint(
> >> +  struct device *dev, struct v4l2_async_notifier *notifier,
> >> +  struct fwnode_handle *endpoint, unsigned int asd_struct_size,
> >> +  int (*parse_single)(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. */
> > 
> > You don't ignore them anymore, the comment should be updated.
> 
> Hmm. I actually intended to do something else about this. :-) As there's a
> single error code, handling that would need to be done a little bit
> differently right now.
> 
> I'd print a warning and proceed. What do you think?
> 
> Even if there's a bad DT endpoint, that shouldn't prevent the rest from
> working, right?

I think it should, to make sure we catch DT issues. We both know how many 
vendors don't care about warnings, so I'd rather fail completely to ensure DT 
will be fixed (and even ten I wouldn't be surprised if some vendors patched 
the code to remove the check instead of fixing their DT ;-)).

> >> +  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_single(dev, vep, asd);
> >> +  v4l2_fwnode_endpoint_free(vep);
> >> +  if (ret) {
> >> +  dev_warn(dev, "driver could not parse endpoint (%d)\n", 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;
> >> +}

[snip]

> >> diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
> >> index c69d8c8a66d0..4a44ab47ab04 100644
> >> --- a/include/media/v4l2-async.h
> >> +++ b/include/media/v4l2-async.h


> >> @@ -121,6 +122,21 @@ int v4l2_async_notifier_register(struct v4l2_device
> >> *v4l2_dev, void v4l2_async_notifier_unregister(struct
> >> v4l2_async_notifier *notifier);
> >> 
> >>  /**
> >> + * v4l2_async_notifier_release - release notifier resources
> >> + * @notifier: pointer to  v4l2_async_notifier
> > 
> > That's quite obvious given the type of the argument. It would be much more
> > useful to tell which notifier pointer this function expects (although in
> > this case it should be obvious too): "(pointer to )?the notifier whose
> > resources will be released".
> 
> This fully matches to the documentation elsewhere in the same file. :-)

Feel free to fix the rest of the file :-)

> I'll replace the text with yours.
> 
> >> + *
> >> + * Release memory resources related to a notifier, including the async
> >> + * sub-devices allocated for the purposes of the notifier. The user is
> >> + * responsible for releasing the notifier's resources after calling
> >> + * @v4l2_async_notifier_parse_fwnode_endpoints.
> >> + *
> >> + * There is no harm 

Re: [PATCH 00/15] Improve DVB documentation and reduce its gap

2017-09-01 Thread Honza Petrouš
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.
>

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.

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(*)

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.

It's my 5 cents
/Honza

(*) My favourite is HiSilicon with very nice Hi3798 4K chip
with announced support from Linaro and already available
devboard for reasonable price.

PS: I'm in no any way connected with HiSilicon nor
any other DVB-enabled SoC vendor.


Re: [PATCH V2 0/1] build: gpio-ir-tx for 3.13

2017-09-01 Thread Hans Verkuil
On 27/08/17 12:35, Jasmin J. wrote:
> From: Jasmin Jessich 
> 
> Changes to V1:
>  Moved IR_GPIO_TX from 4.10.0 to 3.13.0 instead of adding it.
> 
> Kernel 3.17 introduces GPIOD_OUT_LOW/HIGH. gpio-ir-tx requires this
> definitions. This patch adds the API calls prior to 3.17 to be used
> by gpio-ir-tx.
> With that gpio-ir-tx can be compiled back to Kernel 3.13.
> I tested the compilation (not the functionality!) on 4.4, 3.13 and
> 3.4.
> 
> @Sean: Please check if the code in v3.16_gpio-ir-tx.patch looks
> feasible for you (can't test this here). If not, we will drop this
> patch and simply disable gpio-ir-tx for Kernels older than 3.17.

I moved gpio-ir-tx to 3.17. Is there a really urgent need to compile
it for older kernels?

The problem is that you have to maintain that backports patch as well.
So I kept it simple.

Regards,

Hans

> 
> Jasmin Jessich (1):
>   build: gpio-ir-tx backport
> 
>  backports/backports.txt  |  1 +
>  backports/v3.16_gpio-ir-tx.patch | 25 +
>  v4l/versions.txt |  2 +-
>  3 files changed, 27 insertions(+), 1 deletion(-)
>  create mode 100644 backports/v3.16_gpio-ir-tx.patch
> 



[PATCH] cec-pin.c: use proper ktime accessor functions

2017-09-01 Thread Hans Verkuil
Use ktime_to_ns/ns_to_ktime. This makes it possible to work with older kernels
and the media_build compatibility system.

For the mainline kernel these functions are NOPs.

Signed-off-by: Hans Verkuil 
---
 drivers/media/cec/cec-pin.c | 37 ++---
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/drivers/media/cec/cec-pin.c b/drivers/media/cec/cec-pin.c
index c003b8eac617..e2aa5d6e619d 100644
--- a/drivers/media/cec/cec-pin.c
+++ b/drivers/media/cec/cec-pin.c
@@ -132,7 +132,7 @@ static void cec_pin_to_idle(struct cec_pin *pin)
pin->rx_msg.len = 0;
memset(pin->rx_msg.msg, 0, sizeof(pin->rx_msg.msg));
pin->state = CEC_ST_IDLE;
-   pin->ts = 0;
+   pin->ts = ns_to_ktime(0);
 }

 /*
@@ -426,7 +426,7 @@ static void cec_pin_rx_states(struct cec_pin *pin, ktime_t 
ts)
v = cec_pin_read(pin);
if (v && pin->rx_eom) {
pin->work_rx_msg = pin->rx_msg;
-   pin->work_rx_msg.rx_ts = ts;
+   pin->work_rx_msg.rx_ts = ktime_to_ns(ts);
wake_up_interruptible(>kthread_waitq);
pin->ts = ts;
pin->state = CEC_ST_RX_ACK_FINISH;
@@ -457,7 +457,7 @@ static enum hrtimer_restart cec_pin_timer(struct hrtimer 
*timer)
s32 delta;

ts = ktime_get();
-   if (pin->timer_ts) {
+   if (ktime_to_ns(pin->timer_ts)) {
delta = ktime_us_delta(ts, pin->timer_ts);
pin->timer_cnt++;
if (delta > 100 && pin->state != CEC_ST_IDLE) {
@@ -481,17 +481,19 @@ static enum hrtimer_restart cec_pin_timer(struct hrtimer 
*timer)
if (pin->wait_usecs > 150) {
pin->wait_usecs -= 100;
pin->timer_ts = ktime_add_us(ts, 100);
-   hrtimer_forward_now(timer, 10);
+   hrtimer_forward_now(timer, ns_to_ktime(10));
return HRTIMER_RESTART;
}
if (pin->wait_usecs > 100) {
pin->wait_usecs /= 2;
pin->timer_ts = ktime_add_us(ts, pin->wait_usecs);
-   hrtimer_forward_now(timer, pin->wait_usecs * 1000);
+   hrtimer_forward_now(timer,
+   ns_to_ktime(pin->wait_usecs * 1000));
return HRTIMER_RESTART;
}
pin->timer_ts = ktime_add_us(ts, pin->wait_usecs);
-   hrtimer_forward_now(timer, pin->wait_usecs * 1000);
+   hrtimer_forward_now(timer,
+   ns_to_ktime(pin->wait_usecs * 1000));
pin->wait_usecs = 0;
return HRTIMER_RESTART;
}
@@ -531,7 +533,7 @@ static enum hrtimer_restart cec_pin_timer(struct hrtimer 
*timer)
pin->state = CEC_ST_RX_START_BIT_LOW;
break;
}
-   if (pin->ts == 0)
+   if (ktime_to_ns(pin->ts) == 0)
pin->ts = ts;
if (pin->tx_msg.len) {
/*
@@ -572,12 +574,13 @@ static enum hrtimer_restart cec_pin_timer(struct hrtimer 
*timer)
if (!adap->monitor_pin_cnt || states[pin->state].usecs <= 150) {
pin->wait_usecs = 0;
pin->timer_ts = ktime_add_us(ts, states[pin->state].usecs);
-   hrtimer_forward_now(timer, states[pin->state].usecs * 1000);
+   hrtimer_forward_now(timer,
+   ns_to_ktime(states[pin->state].usecs * 1000));
return HRTIMER_RESTART;
}
pin->wait_usecs = states[pin->state].usecs - 100;
pin->timer_ts = ktime_add_us(ts, 100);
-   hrtimer_forward_now(timer, 10);
+   hrtimer_forward_now(timer, ns_to_ktime(10));
return HRTIMER_RESTART;
 }

@@ -596,7 +599,7 @@ static int cec_pin_thread_func(void *_adap)

if (pin->work_rx_msg.len) {
cec_received_msg_ts(adap, >work_rx_msg,
-   pin->work_rx_msg.rx_ts);
+   ns_to_ktime(pin->work_rx_msg.rx_ts));
pin->work_rx_msg.len = 0;
}
if (pin->work_tx_status) {
@@ -623,13 +626,15 @@ static int cec_pin_thread_func(void *_adap)
pin->ops->disable_irq(adap);
cec_pin_high(pin);
cec_pin_to_idle(pin);
-   hrtimer_start(>timer, 0, HRTIMER_MODE_REL);
+   hrtimer_start(>timer, ns_to_ktime(0),
+ HRTIMER_MODE_REL);
break;
case CEC_PIN_IRQ_ENABLE:
pin->enable_irq_failed = !pin->ops->enable_irq(adap);
  

Re: [PATCH] [media_build] update v4.7_dma_attrs.patch

2017-09-01 Thread Hans Verkuil
On 01/09/17 09:41, Jasmin J. wrote:
> Hi!
> 
> To get media-build working again this is needs to be merged also.

I just applied this. I had to wait until the ktime accessor function
fixes were merged in the master tree and that got delayed a bit.

Thanks,

Hans

> 
> BR,
>Jasmin
> 
> 
> On 08/28/2017 06:08 PM, Daniel Scheller wrote:
>> From: Daniel Scheller 
>>
>> Fixes apply_patches wrt
>>
>>   commit 5b6f9abe5a49 ("media: vb2: add bidirectional flag in vb2_queue")
>>
>> Signed-off-by: Daniel Scheller 
>> Tested-by: Jasmin Jessich 
>> ---
>> Tested and verified by Jasmin on 3.13, 3.4 and 2.6.36, and by me on 4.4.
>>
>>  backports/v4.7_dma_attrs.patch | 8 
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/backports/v4.7_dma_attrs.patch b/backports/v4.7_dma_attrs.patch
>> index 28d8dbc..40a7e5b 100644
>> --- a/backports/v4.7_dma_attrs.patch
>> +++ b/backports/v4.7_dma_attrs.patch
>> @@ -294,18 +294,18 @@ index 9a144f2..c5e3113 100644
>>* doesn't fill in the @alloc_devs array.
>>  - * @dma_attrs: DMA attributes to use for the DMA.
>>  + * @dma_attrs: DMA attributes to use for the DMA. May be NULL.
>> -  * @fileio_read_once:  report EOF after reading the first 
>> buffer
>> -  * @fileio_write_immediately:  queue buffer after each write() call
>> -  * @allow_zero_bytesused:  allow bytesused == 0 to be passed to the driver
>> +  * @bidirectional: when this flag is set the DMA direction for the buffers 
>> of
>> +  * this queue will be overridden with DMA_BIDIRECTIONAL direction.
>> +  * This is useful in cases where the hardware (firmware) writes to
>>  @@ -494,7 +494,7 @@ struct vb2_queue {
>>  unsigned inttype;
>>  unsigned intio_modes;
>>  struct device   *dev;
>>  -   unsigned long   dma_attrs;
>>  +   const struct dma_attrs  *dma_attrs;
>> +unsignedbidirectional:1;
>>  unsignedfileio_read_once:1;
>>  unsignedfileio_write_immediately:1;
>> -unsignedallow_zero_bytesused:1;
>>  diff --git a/include/media/videobuf2-dma-contig.h 
>> b/include/media/videobuf2-dma-contig.h
>>  index 5604818..df2aabe 100644
>>  --- a/include/media/videobuf2-dma-contig.h
>>



Re: [PATCH] [media_build] update v4.7_dma_attrs.patch

2017-09-01 Thread Jasmin J.
Hi!

To get media-build working again this is needs to be merged also.

BR,
   Jasmin


On 08/28/2017 06:08 PM, Daniel Scheller wrote:
> From: Daniel Scheller 
> 
> Fixes apply_patches wrt
> 
>   commit 5b6f9abe5a49 ("media: vb2: add bidirectional flag in vb2_queue")
> 
> Signed-off-by: Daniel Scheller 
> Tested-by: Jasmin Jessich 
> ---
> Tested and verified by Jasmin on 3.13, 3.4 and 2.6.36, and by me on 4.4.
> 
>  backports/v4.7_dma_attrs.patch | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/backports/v4.7_dma_attrs.patch b/backports/v4.7_dma_attrs.patch
> index 28d8dbc..40a7e5b 100644
> --- a/backports/v4.7_dma_attrs.patch
> +++ b/backports/v4.7_dma_attrs.patch
> @@ -294,18 +294,18 @@ index 9a144f2..c5e3113 100644
>*  doesn't fill in the @alloc_devs array.
>  - * @dma_attrs:  DMA attributes to use for the DMA.
>  + * @dma_attrs:  DMA attributes to use for the DMA. May be NULL.
> -  * @fileio_read_once:   report EOF after reading the first 
> buffer
> -  * @fileio_write_immediately:   queue buffer after each write() call
> -  * @allow_zero_bytesused:   allow bytesused == 0 to be passed to the driver
> +  * @bidirectional: when this flag is set the DMA direction for the buffers 
> of
> +  *  this queue will be overridden with DMA_BIDIRECTIONAL direction.
> +  *  This is useful in cases where the hardware (firmware) writes to
>  @@ -494,7 +494,7 @@ struct vb2_queue {
>   unsigned inttype;
>   unsigned intio_modes;
>   struct device   *dev;
>  -unsigned long   dma_attrs;
>  +const struct dma_attrs  *dma_attrs;
> + unsignedbidirectional:1;
>   unsignedfileio_read_once:1;
>   unsignedfileio_write_immediately:1;
> - unsignedallow_zero_bytesused:1;
>  diff --git a/include/media/videobuf2-dma-contig.h 
> b/include/media/videobuf2-dma-contig.h
>  index 5604818..df2aabe 100644
>  --- a/include/media/videobuf2-dma-contig.h
> 


Re: DRM Format Modifiers in v4l2

2017-09-01 Thread Laurent Pinchart
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.

-- 
Regards,

Laurent Pinchart



Re: [PATCH 12/15] media: dmx.h: get rid of DMX_SET_SOURCE

2017-09-01 Thread Honza Petrouš
2017-09-01 1:46 GMT+02:00 Mauro Carvalho Chehab :
> No driver uses this ioctl, nor it is documented anywhere.
>
> So, get rid of it.
>
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  Documentation/media/dmx.h.rst.exceptions| 13 
>  Documentation/media/uapi/dvb/dmx-set-source.rst | 44 
> -
>  Documentation/media/uapi/dvb/dmx_fcalls.rst |  1 -
>  Documentation/media/uapi/dvb/dmx_types.rst  | 20 ---
>  include/uapi/linux/dvb/dmx.h| 12 ---
>  5 files changed, 90 deletions(-)
>  delete mode 100644 Documentation/media/uapi/dvb/dmx-set-source.rst
>
> diff --git a/Documentation/media/dmx.h.rst.exceptions 
> b/Documentation/media/dmx.h.rst.exceptions
> index 5572d2dc9d0e..d2dac35bb84b 100644
> --- a/Documentation/media/dmx.h.rst.exceptions
> +++ b/Documentation/media/dmx.h.rst.exceptions
> @@ -40,18 +40,6 @@ replace enum dmx_input :c:type:`dmx_input`
>  replace symbol DMX_IN_FRONTEND :c:type:`dmx_input`
>  replace symbol DMX_IN_DVR :c:type:`dmx_input`
>
> -# dmx_source_t symbols
> -replace enum dmx_source :c:type:`dmx_source`
> -replace symbol DMX_SOURCE_FRONT0 :c:type:`dmx_source`
> -replace symbol DMX_SOURCE_FRONT1 :c:type:`dmx_source`
> -replace symbol DMX_SOURCE_FRONT2 :c:type:`dmx_source`
> -replace symbol DMX_SOURCE_FRONT3 :c:type:`dmx_source`
> -replace symbol DMX_SOURCE_DVR0 :c:type:`dmx_source`
> -replace symbol DMX_SOURCE_DVR1 :c:type:`dmx_source`
> -replace symbol DMX_SOURCE_DVR2 :c:type:`dmx_source`
> -replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source`
> -
> -
>  # Flags for struct dmx_sct_filter_params
>  replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params`
>  replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params`
> @@ -61,4 +49,3 @@ replace define DMX_IMMEDIATE_START 
> :c:type:`dmx_sct_filter_params`
>  replace typedef dmx_filter_t :c:type:`dmx_filter`
>  replace typedef dmx_pes_type_t :c:type:`dmx_pes_type`
>  replace typedef dmx_input_t :c:type:`dmx_input`
> -replace typedef dmx_source_t :c:type:`dmx_source`
> diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst 
> b/Documentation/media/uapi/dvb/dmx-set-source.rst
> deleted file mode 100644
> index ac7f77b25e06..
> --- a/Documentation/media/uapi/dvb/dmx-set-source.rst
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -.. -*- coding: utf-8; mode: rst -*-
> -
> -.. _DMX_SET_SOURCE:
> -
> -==
> -DMX_SET_SOURCE
> -==
> -
> -Name
> -
> -
> -DMX_SET_SOURCE
> -
> -
> -Synopsis
> -
> -
> -.. c:function:: int ioctl(fd, DMX_SET_SOURCE, struct dmx_source *src)
> -:name: DMX_SET_SOURCE
> -
> -
> -Arguments
> --
> -
> -
> -``fd``
> -File descriptor returned by :c:func:`open() `.
> -
> -``src``
> -   Undocumented.
> -
> -
> -Description
> 
> -
> -.. note:: This ioctl is undocumented. Documentation is welcome.
> -
> -
> -Return Value
> -
> -
> -On success 0 is returned, on error -1 and the ``errno`` variable is set
> -appropriately. The generic error codes are described at the
> -:ref:`Generic Error Codes ` chapter.
> diff --git a/Documentation/media/uapi/dvb/dmx_fcalls.rst 
> b/Documentation/media/uapi/dvb/dmx_fcalls.rst
> index 49e013d4540f..be98d60877f2 100644
> --- a/Documentation/media/uapi/dvb/dmx_fcalls.rst
> +++ b/Documentation/media/uapi/dvb/dmx_fcalls.rst
> @@ -21,6 +21,5 @@ Demux Function Calls
>  dmx-get-event
>  dmx-get-stc
>  dmx-get-pes-pids
> -dmx-set-source
>  dmx-add-pid
>  dmx-remove-pid
> diff --git a/Documentation/media/uapi/dvb/dmx_types.rst 
> b/Documentation/media/uapi/dvb/dmx_types.rst
> index 9e907b85cf16..a205c02ccdc1 100644
> --- a/Documentation/media/uapi/dvb/dmx_types.rst
> +++ b/Documentation/media/uapi/dvb/dmx_types.rst
> @@ -197,23 +197,3 @@ struct dmx_stc
> unsigned int base;  /* output: divisor for stc to get 90 kHz clock */
> __u64 stc;  /* output: stc in 'base'*90 kHz units */
>  };
> -
> -
> -
> -enum dmx_source
> -===
> -
> -.. c:type:: dmx_source
> -
> -.. code-block:: c
> -
> -typedef enum dmx_source {
> -   DMX_SOURCE_FRONT0 = 0,
> -   DMX_SOURCE_FRONT1,
> -   DMX_SOURCE_FRONT2,
> -   DMX_SOURCE_FRONT3,
> -   DMX_SOURCE_DVR0   = 16,
> -   DMX_SOURCE_DVR1,
> -   DMX_SOURCE_DVR2,
> -   DMX_SOURCE_DVR3
> -} dmx_source_t;
> diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
> index c0ee44fbdb13..dd2b832c02ce 100644
> --- a/include/uapi/linux/dvb/dmx.h
> +++ b/include/uapi/linux/dvb/dmx.h
> @@ -117,17 +117,6 @@ struct dmx_pes_filter_params
> __u32  flags;
>  };
>
> -typedef enum dmx_source {
> -   DMX_SOURCE_FRONT0 = 0,
> -   DMX_SOURCE_FRONT1,
> -   DMX_SOURCE_FRONT2,
> -   DMX_SOURCE_FRONT3,
> -   DMX_SOURCE_DVR0   = 16,
> -   DMX_SOURCE_DVR1,
> -   DMX_SOURCE_DVR2,
> -   DMX_SOURCE_DVR3
> -} dmx_source_t;
> -
>  struct dmx_stc {
>