cron job: media_tree daily build: OK

2016-06-27 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:   Tue Jun 28 04:00:27 CEST 2016
git branch: test
git hash:   59f0bc11848f8f3242bc1fefae670e745929cd7b
gcc version:i686-linux-gcc (GCC) 5.3.0
sparse version: v0.5.0-56-g7647c77
smatch version: v0.5.0-3428-gdfe27cf
host hardware:  x86_64
host os:4.6.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mtk: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-pxa: 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: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-i686: OK
linux-4.3-i686: OK
linux-4.4-i686: OK
linux-4.5-i686: OK
linux-4.6-i686: OK
linux-4.7-rc1-i686: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: OK
linux-4.1.1-x86_64: OK
linux-4.2-x86_64: OK
linux-4.3-x86_64: OK
linux-4.4-x86_64: OK
linux-4.5-x86_64: OK
linux-4.6-x86_64: OK
linux-4.7-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: WARNINGS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Tuesday.log

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] rcar-csi2: add Renesas R-Car MIPI CSI-2 driver

2016-06-27 Thread kbuild test robot
Hi,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20160627]
[cannot apply to v4.7-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Niklas-S-derlund/rcar-csi2-add-Renesas-R-Car-MIPI-CSI-2-driver/20160628-015917
base:   git://linuxtv.org/media_tree.git master
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/media/platform/rcar-vin/rcar-csi2.c:371:2: error: unknown field 
's_stream' specified in initializer
 .s_stream = rcar_csi2_s_stream,
 ^
>> drivers/media/platform/rcar-vin/rcar-csi2.c:371:14: error: initialization 
>> from incompatible pointer type [-Werror=incompatible-pointer-types]
 .s_stream = rcar_csi2_s_stream,
 ^~
   drivers/media/platform/rcar-vin/rcar-csi2.c:371:14: note: (near 
initialization for 'rcar_csi2_pad_ops.init_cfg')
   cc1: some warnings being treated as errors

vim +371 drivers/media/platform/rcar-vin/rcar-csi2.c

   365  
   366  static struct v4l2_subdev_core_ops rcar_csi2_subdev_core_ops = {
   367  .s_power = rcar_csi2_s_power,
   368  };
   369  
   370  static const struct v4l2_subdev_pad_ops rcar_csi2_pad_ops = {
 > 371  .s_stream = rcar_csi2_s_stream,
   372  .set_fmt = rcar_csi2_set_pad_format,
   373  };
   374  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH] [media] rcar-csi2: add Renesas R-Car MIPI CSI-2 driver

2016-06-27 Thread kbuild test robot
Hi,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20160627]
[cannot apply to v4.7-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Niklas-S-derlund/rcar-csi2-add-Renesas-R-Car-MIPI-CSI-2-driver/20160628-015917
base:   git://linuxtv.org/media_tree.git master
config: cris-allmodconfig (attached as .config)
compiler: cris-linux-gcc (GCC) 4.6.3
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=cris 

All error/warnings (new ones prefixed by >>):

>> drivers/media/platform/rcar-vin/rcar-csi2.c:371:2: error: unknown field 
>> 's_stream' specified in initializer
>> drivers/media/platform/rcar-vin/rcar-csi2.c:371:2: warning: initialization 
>> from incompatible pointer type [enabled by default]
   drivers/media/platform/rcar-vin/rcar-csi2.c:371:2: warning: (near 
initialization for 'rcar_csi2_pad_ops.init_cfg') [enabled by default]

vim +/s_stream +371 drivers/media/platform/rcar-vin/rcar-csi2.c

   365  
   366  static struct v4l2_subdev_core_ops rcar_csi2_subdev_core_ops = {
   367  .s_power = rcar_csi2_s_power,
   368  };
   369  
   370  static const struct v4l2_subdev_pad_ops rcar_csi2_pad_ops = {
 > 371  .s_stream = rcar_csi2_s_stream,
   372  .set_fmt = rcar_csi2_set_pad_format,
   373  };
   374  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [RESEND PATCH v2 1/5] ir-rx51: Fix build after multiarch changes broke it

2016-06-27 Thread Ivaylo Dimitrov



On 23.06.2016 20:48, Pali Rohár wrote:

On Wednesday 22 June 2016 21:22:17 Ivaylo Dimitrov wrote:

The ir-rx51 driver for n900 has been disabled since the multiarch
changes as plat include directory no longer is SoC specific.

Let's fix it with minimal changes to pass the dmtimer calls in
pdata. Then the following changes can be done while things can
be tested to be working for each change:

1. Change the non-pwm dmtimer to use just hrtimer if possible

2. Change the pwm dmtimer to use Linux PWM API with the new
drivers/pwm/pwm-omap-dmtimer.c and remove the direct calls
to dmtimer functions

3. Parse configuration from device tree and drop the pdata

Note compilation of this depends on the previous patch
"ARM: OMAP2+: Add more functions to pwm pdata for ir-rx51".


I think that this extensive description is not needed for commit
message. Just for email discussion.



I guess Tony can strip the description a bit before applying.

Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 2/2] [media] i2c: adv7482: add adv7482 driver

2016-06-27 Thread Niklas Söderlund
This patch adds basic support for the ADV7482. It can output the HDMI
source on the TXA sink and any AIN source on the TXB sink.

Driver is based on a prototype by Koji Matsuoka in the Renesas BSP.

Signed-off-by: Niklas Söderlund 
---
 .../devicetree/bindings/media/i2c/adv7482.txt  |   62 +
 drivers/media/i2c/Kconfig  |   10 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/adv7482.c| 1388 
 4 files changed, 1461 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7482.txt
 create mode 100644 drivers/media/i2c/adv7482.c

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7482.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7482.txt
new file mode 100644
index 000..c4619db
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/adv7482.txt
@@ -0,0 +1,62 @@
+* Analog Devices ADV7482 video decoder with HDMI receiver
+
+The ADV7482 are a multi format video decoders with an integrated
+HDMI receiver. It can output CSI-2 on two independent outputs
+TXA and TXB from three input sources HDMI, analog and TTL.
+
+Required Properties:
+
+  - compatible: Must contain one of the following
+- "adi,adv7482" for the ADV7482
+
+  - reg: I2C slave address
+
+The device node must contain one 'port' child node per device input and output
+port, in accordance with the video interface bindings defined in
+Documentation/devicetree/bindings/media/video-interfaces.txt. The port nodes
+are numbered as follows.
+
+  Name  TypePort
+
+  HDMI  sink0
+  AIN1  sink1
+  AIN   sink2
+  AIN   sink3
+  AIN   sink4
+  AIN   sink5
+  AIN   sink6
+  AIN   sink7
+  AIN   sink8
+  TTL   sink9
+  TXA   source  10
+  TXB   source  11
+
+The digital output port node must contain at least one source endpoint.
+
+Example:
+
+video_receiver@70 {
+compatible = "adi,adv7482";
+reg = <0x70>;
+
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@10 {
+reg = <10>;
+adv7482_txa: endpoint@1 {
+clock-lanes = <0>;
+data-lanes = <1 2 3 4>;
+remote-endpoint = <_in>;
+};
+};
+
+port@11 {
+reg = <11>;
+adv7482_txb: endpoint@1 {
+clock-lanes = <0>;
+data-lanes = <1>;
+remote-endpoint = <_in>;
+};
+};
+};
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 993dc50..dcc8379 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -204,6 +204,16 @@ config VIDEO_ADV7183
  To compile this driver as a module, choose M here: the
  module will be called adv7183.
 
+config VIDEO_ADV7482
+   tristate "Analog Devices ADV7482 decoder"
+   depends on VIDEO_V4L2 && I2C
+   ---help---
+ V4l2 subdevice driver for the Analog Devices
+ ADV7482 video decoder.
+
+ To compile this driver as a module, choose M here: the
+ module will be called adv7482.
+
 config VIDEO_ADV7604
tristate "Analog Devices ADV7604 decoder"
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 94f2c99..a39ee28 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_VIDEO_ADV7180) += adv7180.o
 obj-$(CONFIG_VIDEO_ADV7183) += adv7183.o
 obj-$(CONFIG_VIDEO_ADV7343) += adv7343.o
 obj-$(CONFIG_VIDEO_ADV7393) += adv7393.o
+obj-$(CONFIG_VIDEO_ADV7482) += adv7482.o
 obj-$(CONFIG_VIDEO_ADV7604) += adv7604.o
 obj-$(CONFIG_VIDEO_ADV7842) += adv7842.o
 obj-$(CONFIG_VIDEO_AD9389B) += ad9389b.o
diff --git a/drivers/media/i2c/adv7482.c b/drivers/media/i2c/adv7482.c
new file mode 100644
index 000..a51ad22
--- /dev/null
+++ b/drivers/media/i2c/adv7482.c
@@ -0,0 +1,1388 @@
+/*
+ * Driver for Analog Devices ADV7482 HDMI receiver
+ *
+ * Copyright (C) 2016 Renesas Electronics Corp.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 

[RFC 0/2] [media] i2c: adv7482: add adv7482 driver

2016-06-27 Thread Niklas Söderlund
Hi all,

This is a RFC for the Analog Devices ADV7482 driver.

It is based on top of the media_tree and depends on the series '[PATCH 
0/2] move s_stream from v4l2_subdev_video_ops to move s_stream from 
v4l2_subdev_pad_ops'. It's tested on a Renesas Salvator-X board.

The driver is not ready for upstream and contains a few hard-coded 
restrictions and hacks. The restrictions are in large part deepening on 
from what I see as limitations to the v4l2 framework. The ADV7482 
supports two video pipelines which can run (almost) independent of each 
other, each pipeline terminates in a CSI-2 output TXA and TXB.

TXA is a 4-lane CSI-2 output which can be connected to ether a HDMI, 
CVBS or TTL input. TXB is a 1-lane CSI-2 output which can be connected 
to the CVBS input. To make things even more complex the datasheet states
that the TTL input can also be an output to which HDMI and CVBS inputs 
can be routed.

This RFC hard codes TXA to the HDMI input and TXB to the CVBS input 
since that is the only configuration I can test. It also do not consider 
the TTL port at all other then reserving a sink pad id for it.

I have modelled the driver with two source pads, one for TXA and one for 
TXB since I can't see any other way. And in this design I find 
limitations to the v4l2 framework, there are operations in struct 
v4l2_subdev_video_ops which now needs to know which source pad it should 
be acting on. I have tried to solve my immediate problem of the need for 
a pad aware s_stream in a separate series mention above but there are 
more operations that needs pad information.

I'm looking forward to trying to find solutions in v4l2 to thees 
problems but in this RFC there is a compile time define which decides 
which pad is the one used in such operations. Also some operations in 
struct v4l2_subdev_video_ops are context aware, for example g_std is 
only valid for TXB since it is connected to the CVBS input. But ofc one 
can call g_std from a driver hooked up to TXA (which is the HDMI) and 
would then get the standard for the CVBS. This results in lots of errors 
in v4l-compliance test. Things that I see needs to be figured out how to 
be pad aware are or extended in some other way are.

- g_std
- s_std
- querystd
- g_tvnorms
- g_input_status
- cropcap (needed for pixelaspect ratio)
- s_dv_timings
- g_dv_timings
- query_dv_timings
- Controlls, TXA and TXB both have a separate set of controls

Further more there are some hard-coded logic regarding which sink is 
connected to which source, this should be moved to s_routing. And 
default-input DT parameters should be added and acted upon. I did not 
want to spend time on this until I figured out how to best deal with the 
more pad aware operations.

Other limitations of the RFC that should be solved are:

- ADV7482 allows for most of its I2C slave addresses to be user 
  selectable. RFC uses hard coded values, thees should be moved to DT.

- EDID, get_edid and set_edid operations need to be added.

- Input format change interrupts like adv7180 have. Now one must
  call querystd or query_dv_timings for the driver to notice that the 
  format have changed.

Given all of the above issues the RFC do work and can deliver both HDMI 
and CVBS video simultaneously. It properly detects what source is 
connected to it and the two pipes can be independently started and 
stopped.

If anyone is interested to test on Salvator-X the following branch 
contains all the patches to grab video (rcar-vin for Gen3, rcar-cis2 and 
adv7482).

https://git.ragnatech.se/linux rcar-vin-gen3

Laurent Pinchart (1):
  media: entity: Add has_route entity operation

Niklas Söderlund (1):
  [media] i2c: adv7482: add adv7482 driver

 .../devicetree/bindings/media/i2c/adv7482.txt  |   62 +
 drivers/media/i2c/Kconfig  |   10 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/adv7482.c| 1388 
 include/media/media-entity.h   |5 +
 5 files changed, 1466 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7482.txt
 create mode 100644 drivers/media/i2c/adv7482.c

-- 
2.8.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 1/2] media: entity: Add has_route entity operation

2016-06-27 Thread Niklas Söderlund
From: Laurent Pinchart 

The optional operation can be used by entities to report whether two
pads are internally connected.

Signed-off-by: Laurent Pinchart 
Signed-off-by: Michal Simek 
Signed-off-by: Niklas Söderlund 
---
 include/media/media-entity.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index cbb266f..c4b2dca 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -179,6 +179,9 @@ struct media_pad {
  * @link_validate: Return whether a link is valid from the entity point of
  * view. The media_entity_pipeline_start() function
  * validates all links by calling this operation. Optional.
+ * @has_route: Return whether a route exists inside the entity between
+ * two given pads. Optional. If the operation isn't
+ * implemented all pads will be considered as connected.
  *
  * Note: Those these callbacks are called with struct media_device.@graph_mutex
  * mutex held.
@@ -188,6 +191,8 @@ struct media_entity_operations {
  const struct media_pad *local,
  const struct media_pad *remote, u32 flags);
int (*link_validate)(struct media_link *link);
+   bool (*has_route)(struct media_entity *entity, unsigned int pad0,
+ unsigned int pad1);
 };
 
 /**
-- 
2.8.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] rcar-csi2: add Renesas R-Car MIPI CSI-2 driver

2016-06-27 Thread Niklas Söderlund
Hi all,

This patch adds support for the R-Car MIPI CSI-2 driver.

It is based on top of the media_tree and depends on the series '[PATCH 
0/2] move s_stream from v4l2_subdev_video_ops to move s_stream from 
v4l2_subdev_pad_ops'. It's tested on a Renesas Salvator-X board.

The patch itself do not need a pad argument for s_stream but it is 
tested on a Renesas Salvator-X which have a ADV7482 device in the video 
input pipeline (RFC for that driver previously posted) which needs the 
pad argument.

If anyone is interested to test on Salvator-X the following branch 
contains all the patches to grab video (rcar-vin for Gen3, rcar-cis2 and 
adv7482).

https://git.ragnatech.se/linux rcar-vin-gen3


Niklas Söderlund (1):
  [media] rcar-csi2: add Renesas R-Car MIPI CSI-2 driver

 .../devicetree/bindings/media/rcar-csi2.txt|  79 +++
 drivers/media/platform/rcar-vin/Kconfig|  11 +
 drivers/media/platform/rcar-vin/Makefile   |   2 +
 drivers/media/platform/rcar-vin/rcar-csi2.c| 545 +
 4 files changed, 637 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/rcar-csi2.txt
 create mode 100644 drivers/media/platform/rcar-vin/rcar-csi2.c

-- 
2.8.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] rcar-csi2: add Renesas R-Car MIPI CSI-2 driver

2016-06-27 Thread Niklas Söderlund
A V4L2 driver for Renesas R-Car MIPI CSI-2 interface. The driver
supports the rcar-vin driver on R-Car Gen3 SoCs where a separate driver
is needed to receive CSI-2.

Driver is based on a prototype by Koji Matsuoka in the Renesas BSP.

Signed-off-by: Niklas Söderlund 
---
 .../devicetree/bindings/media/rcar-csi2.txt|  79 +++
 drivers/media/platform/rcar-vin/Kconfig|  11 +
 drivers/media/platform/rcar-vin/Makefile   |   2 +
 drivers/media/platform/rcar-vin/rcar-csi2.c| 545 +
 4 files changed, 637 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/rcar-csi2.txt
 create mode 100644 drivers/media/platform/rcar-vin/rcar-csi2.c

diff --git a/Documentation/devicetree/bindings/media/rcar-csi2.txt 
b/Documentation/devicetree/bindings/media/rcar-csi2.txt
new file mode 100644
index 000..58a89e0
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/rcar-csi2.txt
@@ -0,0 +1,79 @@
+Renesas R-Car MIPI CSI-2 driver (rcar-csi2)
+---
+
+The rcar-csi2 device provides MIPI CSI-2 capabilities for the Renesas R-Car
+family of devices. It is to be used in conjunction with the rcar-vin driver 
which
+provides the video input capabilities.
+
+ - compatible: Must be one or more of the following
+   - "renesas,csi2-r8a7795" for the R8A7795 device
+   - "renesas,rcar-gen3-csi2" for a generic R-Car Gen3 compatible device.
+
+   When compatible with the generic version nodes must list the
+   SoC-specific version corresponding to the platform first
+   followed by the generic version.
+
+ - reg: the register base and size for the device registers
+ - interrupts: the interrupt for the device
+ - clocks: Reference to the parent clock
+
+The device node should contain two 'port' child nodes with one child 'endpoint'
+node, according to the bindings defined in Documentation/devicetree/bindings/
+media/video-interfaces.txt. Port 0 should connect the device that is the CSI-2
+producer. Port 1 should connect the R-Car VIN device (rcar-vin) consumer.
+
+ - ports:
+   - port@0: sub-node describing a endpoint to the CSI-2 source
+   - port@1: sub-node describing a endpoint to the VIN consumer
+
+Additionally, an alias named csiX will need to be created to specify
+which CSI-2 device this is.
+
+Example:
+
+/* SoC properties */
+
+   aliases {
+   csi40 = 
+   };
+
+   csi40: csi2@feaa {
+   compatible = "renesas,csi2-r8a7795";
+   reg = <0 0xfeaa 0 0x1>;
+   interrupts = <0 246 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = < CPG_MOD 716>;
+   power-domains = <>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@1 {
+   reg = <1>;
+   csi40_out: endpoint@1 {
+   remote-endpoint = <>;
+   };
+   };
+   };
+   };
+
+/* Board properties */
+
+{
+   status = "okay";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   csi40_in: endpoint@0 {
+   clock-lanes = <0>;
+   data-lanes = <1 2 3 4>;
+   remote-endpoint = <_1_out>;
+   };
+   };
+   };
+   };
diff --git a/drivers/media/platform/rcar-vin/Kconfig 
b/drivers/media/platform/rcar-vin/Kconfig
index b2ff2d4..e0774ee 100644
--- a/drivers/media/platform/rcar-vin/Kconfig
+++ b/drivers/media/platform/rcar-vin/Kconfig
@@ -9,3 +9,14 @@ config VIDEO_RCAR_VIN
 
  To compile this driver as a module, choose M here: the
  module will be called rcar-vin.
+
+config VIDEO_RCAR_CSI2
+   tristate "R-Car MIPI CSI-2 Interface driver"
+   depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF
+   depends on ARCH_RENESAS || COMPILE_TEST
+   ---help---
+ Support for Renesas R-Car MIPI CSI-2 interface driver.
+ Supports R-Car Gen3 SoCs.
+
+ To compile this driver as a module, choose M here: the
+ module will be called rcar-csi2.
diff --git a/drivers/media/platform/rcar-vin/Makefile 
b/drivers/media/platform/rcar-vin/Makefile
index 48c5632..81a37f2 100644
--- a/drivers/media/platform/rcar-vin/Makefile
+++ b/drivers/media/platform/rcar-vin/Makefile
@@ -1,3 +1,5 @@
 rcar-vin-objs = rcar-core.o rcar-dma.o rcar-v4l2.o
 
 obj-$(CONFIG_VIDEO_RCAR_VIN) += rcar-vin.o
+
+obj-$(CONFIG_VIDEO_RCAR_CSI2) += rcar-csi2.o
diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c 

Re: [PATCH v3] tw686x: use a formula instead of two tables for div

2016-06-27 Thread Mauro Carvalho Chehab
Em Mon, 27 Jun 2016 12:45:38 -0300
Ezequiel Garcia  escreveu:

> Hi Mauro,
> 
> Thanks a lot for the patch.
> 
> On 27 April 2016 at 12:27, Mauro Carvalho Chehab
>  wrote:
> > Instead of using two tables to estimate the temporal decimation
> > factor, use a formula. This allows to get the closest fps, with
> > sounds better than the current tables.
> >
> > Compile-tested only.
> >
> > Signed-off-by: Mauro Carvalho Chehab 
> >
> > [media] tw686x: cleanup the fps estimation code
> >
> > There are some issues with the old code:
> > 1) it uses two static tables;
> > 2) some values for 50Hz standards are wrong;
> > 3) it doesn't store the real framerate.
> >
> > This patch fixes the above issues.
> >
> > Compile-tested only.
> >
> > Signed-off-by: Mauro Carvalho Chehab 
> >
> > -
> >
> > v3: Patch v2 were actually a diff patch against PATCH v1. Fold the two 
> > patches in one.
> >
> > PS.: With this patch, it should be easy to add support for
> > VIDIOC_G_PARM and VIDIOC_S_PARM, as vc->fps will now store the
> > real frame rate, with should be used when returning from those
> > functions.
> >
> > ---
> >  drivers/media/pci/tw686x/tw686x-video.c | 110 
> > +---
> >  1 file changed, 73 insertions(+), 37 deletions(-)
> >
> > diff --git a/drivers/media/pci/tw686x/tw686x-video.c 
> > b/drivers/media/pci/tw686x/tw686x-video.c
> > index 253e10823ba3..b247a7b4ddd8 100644
> > --- a/drivers/media/pci/tw686x/tw686x-video.c
> > +++ b/drivers/media/pci/tw686x/tw686x-video.c
> > @@ -43,53 +43,89 @@ static const struct tw686x_format formats[] = {
> > }
> >  };
> >
> > -static unsigned int tw686x_fields_map(v4l2_std_id std, unsigned int fps)
> > +static const unsigned int fps_map[15] = {
> > +   /*
> > +* bit 31 enables selecting the field control register
> > +* bits 0-29 are a bitmask with fields that will be output.
> > +* For NTSC (and PAL-M, PAL-60), all 30 bits are used.
> > +* For other PAL standards, only the first 25 bits are used.
> > +*/  
> 
> I ran a few tests and it worked perfectly fine for 60Hz standards.

Good!

> For 50Hz standards, or at least for PAL-Nc, it didn't
> work so well, and the real FPS was too different from the requested
> one. I need to look into it some more.

I would be expecting a maximum difference a little bigger than 1 Hz.

> > +   0x, /* output all fields */
> > +   0x8006, /* 2 fps (60Hz), 2 fps (50Hz) */
> > +   0x80018006, /* 4 fps (60Hz), 4 fps (50Hz) */
> > +   0x80618006, /* 6 fps (60Hz), 6 fps (50Hz) */
> > +   0x81818186, /* 8 fps (60Hz), 8 fps (50Hz) */
> > +   0x86186186, /* 10 fps (60Hz), 8 fps (50Hz) */
> > +   0x86619866, /* 12 fps (60Hz), 10 fps (50Hz) */
> > +   0x8666, /* 14 fps (60Hz), 12 fps (50Hz) */
> > +   0x999e, /* 16 fps (60Hz), 14 fps (50Hz) */
> > +   0x99e6799e, /* 18 fps (60Hz), 16 fps (50Hz) */
> > +   0x9e79e79e, /* 20 fps (60Hz), 16 fps (50Hz) */
> > +   0x9e7e7e7e, /* 22 fps (60Hz), 18 fps (50Hz) */
> > +   0x9fe7f9fe, /* 24 fps (60Hz), 20 fps (50Hz) */
> > +   0x9ffe7ffe, /* 26 fps (60Hz), 22 fps (50Hz) */
> > +   0x9ffe, /* 28 fps (60Hz), 24 fps (50Hz) */  
> 
> Why this particular selection of fps values and bits set in each case?
> Is it arbitrary?

No. This is the same table that was already in the code:

static const unsigned int map[15] = {
0x, 0x0001, 0x4001, 0x00104001, 0x00404041,
0x01041041, 0x01104411, 0x0111, 0x0445, 0x04511445,
0x05145145, 0x05151515, 0x05515455, 0x05551555, 0x0555
};

Except that the calculus that used to be there to set bit 31 to 1
on everything except map[0] and the code that makes it set two
FPS at the same time were pre-calculated, e. g. I run this code
locally to generate the new table:

map = tw686x_fields_map(vc->video_standard, fps) << 1;
map |= map << 1;
if (map > 0)
map |= BIT(31);

There, bit 31 = 0 disables the frame filtering. bit 31 = 1 enables it.

Each bit at the 0-29 bitrange means one of the 30 frames received.
If equal to 1, the frame is sent; if equal to 0, it is not sent.

So, the first value, for example: 0x8006 has 2 consecutive
bits set, so the mean frame rate would be 2Hz. The next value there
is 0x0x80018006, with has 4 bits selected, so mean fps is 4Hz, and
so on.

As the original table always sets 2 consecutive frames at the same
time, I suspect that this is a requirement to avoid interlacing
issues.

So, the code I used to generate the table always allocate 2 consecutive
bits each time.

I suspect that such the table was built assuming that there are 30 bits,
but, on 50Hz, only 25 bits are used. So, it is sub-optimal for 50 Hz.
It means that the frames are not equally spaced.

If you 

Problems with cx23885 IR receiver

2016-06-27 Thread Florian Lindner
Hello,

I bought a TechnoTrend TT-budget CT2-4500 [1,2] DVB-C card.

By recommendation from that list I use the firmware from
http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/4.0.11/

Aaccording to linuxtv.org my card is an OEM version of the DVB Sky T980C).

Thanks to this list, who helped me to get the TV part working. However,
the IR receiver is not working yet.

I do a modprobe ir-kbd-i2c, the journal then says:

kernel: Registered IR keymap rc-fusionhdtv-mce
kernel: input: i2c IR (FusionHDTV) as /devices/virtual/rc/rc0/input20
kernel: rc rc0: i2c IR (FusionHDTV) as /devices/virtual/rc/rc0
kernel: ir-kbd-i2c: i2c IR (FusionHDTV) detected at i2c-7/7-006b/ir0
[cx23885[0]]

The device works as a dev/input device:

# ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event17) with:
Driver ir-kbd-i2c, table rc-fusionhdtv-mce
Supported protocols: unknown
Enabled protocols: unknown
Name: i2c IR (FusionHDTV)
bus: 24, vendor/product: :, version: 0x
Repeat delay = 500 ms, repeat period = 125 ms

However, I can get no results from event17 using `cat /dev/input/event17`.

The remote works (I can see the IR blinking using a cellphone camera)

Also, lircd gets no results:

# lircd --loglevel=debug --nodaemon -H dev/input -d /dev/input/event17
lircd-0.9.3a[2273]: Warning: Running as root
lircd-0.9.3a[2273]: Info: Using remote: Technotrend.
lircd-0.9.3a[2273]: Notice: lircd(devinput) ready, using /var/run/lirc/lircd

Now using irw /var/run/lirc/lircd also get's no signales from the remote.

Any hints you might have? Any more lowlevel debugging ideas?

Thanks,
Florian

[1] http://www.technotrend.eu/2984/TT-budget_CT2-4500_CI.html
[2] https://www.linuxtv.org/wiki/index.php/TechnoTrend_TT-budget_CT2-4500_CI
[3] https://github.com/OpenELEC/dvb-firmware/tree/master/firmware
[4] https://aur.archlinux.org/packages/openelec-dvb-firmware/
[5] https://www.linuxtv.org/wiki/index.php/DVBSky_T980C
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] tw686x: use a formula instead of two tables for div

2016-06-27 Thread Ezequiel Garcia
Hi Mauro,

Thanks a lot for the patch.

On 27 April 2016 at 12:27, Mauro Carvalho Chehab
 wrote:
> Instead of using two tables to estimate the temporal decimation
> factor, use a formula. This allows to get the closest fps, with
> sounds better than the current tables.
>
> Compile-tested only.
>
> Signed-off-by: Mauro Carvalho Chehab 
>
> [media] tw686x: cleanup the fps estimation code
>
> There are some issues with the old code:
> 1) it uses two static tables;
> 2) some values for 50Hz standards are wrong;
> 3) it doesn't store the real framerate.
>
> This patch fixes the above issues.
>
> Compile-tested only.
>
> Signed-off-by: Mauro Carvalho Chehab 
>
> -
>
> v3: Patch v2 were actually a diff patch against PATCH v1. Fold the two 
> patches in one.
>
> PS.: With this patch, it should be easy to add support for
> VIDIOC_G_PARM and VIDIOC_S_PARM, as vc->fps will now store the
> real frame rate, with should be used when returning from those
> functions.
>
> ---
>  drivers/media/pci/tw686x/tw686x-video.c | 110 
> +---
>  1 file changed, 73 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/media/pci/tw686x/tw686x-video.c 
> b/drivers/media/pci/tw686x/tw686x-video.c
> index 253e10823ba3..b247a7b4ddd8 100644
> --- a/drivers/media/pci/tw686x/tw686x-video.c
> +++ b/drivers/media/pci/tw686x/tw686x-video.c
> @@ -43,53 +43,89 @@ static const struct tw686x_format formats[] = {
> }
>  };
>
> -static unsigned int tw686x_fields_map(v4l2_std_id std, unsigned int fps)
> +static const unsigned int fps_map[15] = {
> +   /*
> +* bit 31 enables selecting the field control register
> +* bits 0-29 are a bitmask with fields that will be output.
> +* For NTSC (and PAL-M, PAL-60), all 30 bits are used.
> +* For other PAL standards, only the first 25 bits are used.
> +*/

I ran a few tests and it worked perfectly fine for 60Hz standards.
For 50Hz standards, or at least for PAL-Nc, it didn't
work so well, and the real FPS was too different from the requested
one. I need to look into it some more.

> +   0x, /* output all fields */
> +   0x8006, /* 2 fps (60Hz), 2 fps (50Hz) */
> +   0x80018006, /* 4 fps (60Hz), 4 fps (50Hz) */
> +   0x80618006, /* 6 fps (60Hz), 6 fps (50Hz) */
> +   0x81818186, /* 8 fps (60Hz), 8 fps (50Hz) */
> +   0x86186186, /* 10 fps (60Hz), 8 fps (50Hz) */
> +   0x86619866, /* 12 fps (60Hz), 10 fps (50Hz) */
> +   0x8666, /* 14 fps (60Hz), 12 fps (50Hz) */
> +   0x999e, /* 16 fps (60Hz), 14 fps (50Hz) */
> +   0x99e6799e, /* 18 fps (60Hz), 16 fps (50Hz) */
> +   0x9e79e79e, /* 20 fps (60Hz), 16 fps (50Hz) */
> +   0x9e7e7e7e, /* 22 fps (60Hz), 18 fps (50Hz) */
> +   0x9fe7f9fe, /* 24 fps (60Hz), 20 fps (50Hz) */
> +   0x9ffe7ffe, /* 26 fps (60Hz), 22 fps (50Hz) */
> +   0x9ffe, /* 28 fps (60Hz), 24 fps (50Hz) */

Why this particular selection of fps values and bits set in each case?
Is it arbitrary?

> +};
> +
> +static unsigned int tw686x_real_fps(unsigned int index, unsigned int max_fps)
> +{
> +   unsigned int i, bits, c = 0;
> +
> +   if (!index || index >= ARRAY_SIZE(fps_map))
> +   return max_fps;
> +
> +   bits = fps_map[index];
> +   for (i = 0; i < max_fps; i++)
> +   if ((1 << i) & bits)
> +   c++;
> +

We can use hweight_long here to count the number of bits set.
If you are OK with it, I can rework the patch and submit a new version.
-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] tw686x: be explicit about the possible dma_mode options

2016-06-27 Thread Ezequiel Garcia
On 27 June 2016 at 05:31, Hans Verkuil  wrote:
> Users won't know what to put in this module option if it isn't
> described.
>
> Signed-off-by: Hans Verkuil 
> ---
> Ezequiel, this sits on top of your tw686x patch series and will be part of 
> the pull
> request.

It looks good.

Thanks!

> ---
>  drivers/media/pci/tw686x/tw686x-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/pci/tw686x/tw686x-core.c 
> b/drivers/media/pci/tw686x/tw686x-core.c
> index 586bc67..71a0453 100644
> --- a/drivers/media/pci/tw686x/tw686x-core.c
> +++ b/drivers/media/pci/tw686x/tw686x-core.c
> @@ -91,7 +91,7 @@ static int tw686x_dma_mode_set(const char *val, struct 
> kernel_param *kp)
>  }
>  module_param_call(dma_mode, tw686x_dma_mode_set, tw686x_dma_mode_get,
>   _mode, S_IRUGO|S_IWUSR);
> -MODULE_PARM_DESC(dma_mode, "DMA operation mode");
> +MODULE_PARM_DESC(dma_mode, "DMA operation mode (memcpy/contig/sg, 
> default=memcpy)");
>
>  void tw686x_disable_channel(struct tw686x_dev *dev, unsigned int channel)
>  {
> --
> 2.8.1
>



-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2.1 8/9] media: Add 1X16 16-bit raw bayer media bus code definitions

2016-06-27 Thread Sakari Ailus
The codes will be called:

MEDIA_BUS_FMT_SBGGR16_1X16
MEDIA_BUS_FMT_SGBRG16_1X16
MEDIA_BUS_FMT_SGRBG16_1X16
MEDIA_BUS_FMT_SRGGB16_1X16

Signed-off-by: Sakari Ailus 
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 252 +++--
 include/uapi/linux/media-bus-format.h  |   6 +-
 2 files changed, 137 insertions(+), 121 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index 6d45dc8..db5b935 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -1116,6 +1116,8 @@ see .
  
  
  
+ 
+ 
  
  

@@ -1128,6 +1130,8 @@ see .
  
  
  Bit
+ 15
+ 14
  13
  12
  11
@@ -1149,12 +1153,7 @@ see .
  MEDIA_BUS_FMT_SBGGR8_1X8
  0x3001
  
- -
- -
- -
- -
- -
- -
+ 
  b7
  b6
  b5
@@ -1168,12 +1167,7 @@ see .
  MEDIA_BUS_FMT_SGBRG8_1X8
  0x3013
  
- -
- -
- -
- -
- -
- -
+ 
  g7
  g6
  g5
@@ -1187,12 +1181,7 @@ see .
  MEDIA_BUS_FMT_SGRBG8_1X8
  0x3002
  
- -
- -
- -
- -
- -
- -
+ 
  g7
  g6
  g5
@@ -1206,12 +1195,7 @@ see .
  MEDIA_BUS_FMT_SRGGB8_1X8
  0x3014
  
- -
- -
- -
- -
- -
- -
+ 
  r7
  r6
  r5
@@ -1225,12 +1209,7 @@ see .
  MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8
  0x3015
  
- -
- -
- -
- -
- -
- -
+ 
  b7
  b6
  b5
@@ -1244,12 +1223,7 @@ see .
  MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8
  0x3016
  
- -
- -
- -
- -
- -
- -
+ 
  g7
  g6
  g5
@@ -1263,12 +1237,7 @@ see .
  MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8
  0x3017
  
- -
- -
- -
- -
- -
- -
+ 
  g7
  g6
  g5
@@ -1282,12 +1251,7 @@ see .
  MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8
  0x3018
  
- -
- -
- -
- -
- -
- -
+ 
  r7
  r6
  r5
@@ -1301,12 +1265,7 @@ see .
  MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8
  0x300b
  
- -
- -
- -
- -
- -
- -
+ 
  b7
  b6
  b5
@@ -1320,12 +1279,7 @@ see .
  MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8
  0x300c
  
- -
- -
- -
- -
- -
- -
+ 
  g7
  g6
  g5
@@ -1339,12 +1293,7 @@ see .
  MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8
  0x3009
  
- -
- -
- -
- -
- -
- -
+ 
  g7
  g6
  g5
@@ -1358,12 +1307,7 @@ see .
  MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8
  0x300d
  
- -
- -
- -
- -
- -
- -
+ 
  r7
  r6
  r5
@@ -1377,12 +1321,7 @@ see .
  MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE
  0x3003
  
- -
- -
- -
- -
- -
- -
+ 
  0
  0
  0
@@ -1396,12 +1335,7 @@ see .
  
  
  
- -
- -
- -
- -
- -
- -
+ 
  b7
  b6
  b5
@@ -1415,12 +1349,7 @@ see .
  MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE
  0x3004
  
- -
- -
- -
- -
- -
- -
+ 
  b7
  b6
  

[PATCH v2.1 9/9] v4l: Add 16-bit raw bayer pixel format definitions

2016-06-27 Thread Sakari Ailus
The formats added by this patch are:

V4L2_PIX_FMT_SBGGR16
V4L2_PIX_FMT_SGBRG16
V4L2_PIX_FMT_SGRBG16

V4L2_PIX_FMT_SRGGB16 already existed before the patch. Rework the
documentation to match that of the other sample depths.

Signed-off-by: Sakari Ailus 
---
 .../v4l/{pixfmt-sbggr16.xml => pixfmt-srggb16.xml} | 49 ++
 Documentation/DocBook/media/v4l/pixfmt.xml |  2 +-
 include/uapi/linux/videodev2.h |  3 ++
 3 files changed, 35 insertions(+), 19 deletions(-)
 rename Documentation/DocBook/media/v4l/{pixfmt-sbggr16.xml => 
pixfmt-srggb16.xml} (62%)

diff --git a/Documentation/DocBook/media/v4l/pixfmt-sbggr16.xml 
b/Documentation/DocBook/media/v4l/pixfmt-srggb16.xml
similarity index 62%
rename from Documentation/DocBook/media/v4l/pixfmt-sbggr16.xml
rename to Documentation/DocBook/media/v4l/pixfmt-srggb16.xml
index 6494b05..517dd4d 100644
--- a/Documentation/DocBook/media/v4l/pixfmt-sbggr16.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt-srggb16.xml
@@ -1,22 +1,29 @@
-
-  
-V4L2_PIX_FMT_SBGGR16 ('BYR2')
-
-  
-  
-V4L2_PIX_FMT_SBGGR16
-Bayer RGB format
-  
-  
-Description
+
+  
+   V4L2_PIX_FMT_SRGGB16 ('RG16'),
+V4L2_PIX_FMT_SGRBG16 ('GR16'),
+V4L2_PIX_FMT_SGBRG16 ('GB16'),
+V4L2_PIX_FMT_SBGGR16 ('BYR2')
+
+   
+  
+  
+   V4L2_PIX_FMT_SRGGB16
+   V4L2_PIX_FMT_SGRBG16
+   V4L2_PIX_FMT_SGBRG16
+   V4L2_PIX_FMT_SBGGR16
+   16-bit Bayer formats
+  
+  
+   Description
 
-This format is similar to 
-V4L2_PIX_FMT_SBGGR8, except each pixel has
-a depth of 16 bits. The least significant byte is stored at lower
-memory addresses (little-endian). Note the actual sampling precision
-may be lower than 16 bits, for example 10 bits per pixel with values
-in range 0 to 1023.
+   These four pixel formats are raw sRGB / Bayer formats with
+16 bits per colour. Each colour component is stored in a 16-bit word.
+Each n-pixel row contains n/2 green samples and n/2 blue or red
+samples, with alternating red and blue rows. Bytes are stored in
+memory in little endian order. They are conventionally described
+as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these
+formats:
 
 
   V4L2_PIX_FMT_SBGGR16 4  4
@@ -79,5 +86,11 @@ pixel image

   
 
+
+Note the actual sampling precision for format
+V4L2_PIX_FMT_SBGGR16 may be lower than 16
+bits, for example 10 bits per pixel with values in range 0 to
+1023.
+
   
 
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index 296a50a..2c22098 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -1587,7 +1587,6 @@ access the palette, this must be done with ioctls of the 
Linux framebuffer API.<
 
 
 
-
 
 
 
@@ -1596,6 +1595,7 @@ access the palette, this must be done with ioctls of the 
Linux framebuffer API.<
 
 
 
+
   
 
   
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index c34d467..d201857 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -591,6 +591,9 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGRBG14P v4l2_fourcc('p', 'g', 'E', 'E')
 #define V4L2_PIX_FMT_SRGGB14P v4l2_fourcc('p', 'R', 'E', 'E')
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. 
GRGR.. */
+#define V4L2_PIX_FMT_SGBRG16 v4l2_fourcc('G', 'B', '1', '6') /* 16  GBGB.. 
RGRG.. */
+#define V4L2_PIX_FMT_SGRBG16 v4l2_fourcc('G', 'R', '1', '6') /* 16  GRGR.. 
BGBG.. */
+#define V4L2_PIX_FMT_SRGGB16 v4l2_fourcc('R', 'G', '1', '6') /* 16  RGRG.. 
GBGB.. */
 
 /* compressed formats */
 #define V4L2_PIX_FMT_MJPEGv4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG   
*/
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv5 08/13] media/platform: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Fabien DESSENNE


On 06/27/2016 03:31 PM, Hans Verkuil wrote:
> From: Hans Verkuil 
>
> Stop using alloc_ctx and just fill in the device pointer.
>
> Signed-off-by: Hans Verkuil 
> Cc: Fabien Dessenne 
> Acked-by: Benoit Parrot 
> Reviewed-by: Laurent Pinchart 
> ---
>   drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 18 --
>   drivers/media/platform/sti/bdisp/bdisp.h  |  2 --
>   drivers/media/platform/ti-vpe/cal.c   | 15 +--
>   drivers/media/platform/ti-vpe/vpe.c   | 20 
>   drivers/media/platform/vsp1/vsp1_video.c  | 14 ++
>   drivers/media/platform/vsp1/vsp1_video.h  |  1 -
>   drivers/media/platform/xilinx/xilinx-dma.c| 11 +--
>   drivers/media/platform/xilinx/xilinx-dma.h|  2 --
>   8 files changed, 12 insertions(+), 71 deletions(-)

Acked-by: Fabien Dessenne

>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c 
> b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> index d12a419..b3e8b5a 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
> @@ -439,7 +439,7 @@ static void bdisp_ctrls_delete(struct bdisp_ctx *ctx)
>
>   static int bdisp_queue_setup(struct vb2_queue *vq,
>   unsigned int *nb_buf, unsigned int *nb_planes,
> -unsigned int sizes[], void *allocators[])
> +unsigned int sizes[], void *alloc_ctxs[])
>   {
>  struct bdisp_ctx *ctx = vb2_get_drv_priv(vq);
>  struct bdisp_frame *frame = ctx_get_frame(ctx, vq->type);
> @@ -453,7 +453,6 @@ static int bdisp_queue_setup(struct vb2_queue *vq,
>  dev_err(ctx->bdisp_dev->dev, "Invalid format\n");
>  return -EINVAL;
>  }
> -   allocators[0] = ctx->bdisp_dev->alloc_ctx;
>
>  if (*nb_planes)
>  return sizes[0] < frame->sizeimage ? -EINVAL : 0;
> @@ -553,6 +552,7 @@ static int queue_init(void *priv,
>  src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
>  src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
>  src_vq->lock = >bdisp_dev->lock;
> +   src_vq->dev = ctx->bdisp_dev->v4l2_dev.dev;
>
>  ret = vb2_queue_init(src_vq);
>  if (ret)
> @@ -567,6 +567,7 @@ static int queue_init(void *priv,
>  dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
>  dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
>  dst_vq->lock = >bdisp_dev->lock;
> +   dst_vq->dev = ctx->bdisp_dev->v4l2_dev.dev;
>
>  return vb2_queue_init(dst_vq);
>   }
> @@ -1269,8 +1270,6 @@ static int bdisp_remove(struct platform_device *pdev)
>
>  bdisp_hw_free_filters(bdisp->dev);
>
> -   vb2_dma_contig_cleanup_ctx(bdisp->alloc_ctx);
> -
>  pm_runtime_disable(>dev);
>
>  bdisp_debugfs_remove(bdisp);
> @@ -1371,18 +1370,11 @@ static int bdisp_probe(struct platform_device *pdev)
>  goto err_dbg;
>  }
>
> -   /* Continuous memory allocator */
> -   bdisp->alloc_ctx = vb2_dma_contig_init_ctx(dev);
> -   if (IS_ERR(bdisp->alloc_ctx)) {
> -   ret = PTR_ERR(bdisp->alloc_ctx);
> -   goto err_pm;
> -   }
> -
>  /* Filters */
>  if (bdisp_hw_alloc_filters(bdisp->dev)) {
>  dev_err(bdisp->dev, "no memory for filters\n");
>  ret = -ENOMEM;
> -   goto err_vb2_dma;
> +   goto err_pm;
>  }
>
>  /* Register */
> @@ -1401,8 +1393,6 @@ static int bdisp_probe(struct platform_device *pdev)
>
>   err_filter:
>  bdisp_hw_free_filters(bdisp->dev);
> -err_vb2_dma:
> -   vb2_dma_contig_cleanup_ctx(bdisp->alloc_ctx);
>   err_pm:
>  pm_runtime_put(dev);
>   err_dbg:
> diff --git a/drivers/media/platform/sti/bdisp/bdisp.h 
> b/drivers/media/platform/sti/bdisp/bdisp.h
> index 0cf9857..b3fbf99 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp.h
> +++ b/drivers/media/platform/sti/bdisp/bdisp.h
> @@ -175,7 +175,6 @@ struct bdisp_dbg {
>* @id: device index
>* @m2m:memory-to-memory V4L2 device information
>* @state:  flags used to synchronize m2m and capture mode operation
> - * @alloc_ctx:  videobuf2 memory allocator context
>* @clock:  IP clock
>* @regs:   registers
>* @irq_queue:  interrupt handler waitqueue
> @@ -193,7 +192,6 @@ struct bdisp_dev {
>  u16 id;
>  struct bdisp_m2m_device m2m;
>  unsigned long   state;
> -   struct vb2_alloc_ctx*alloc_ctx;
>  struct clk  *clock;
>  void __iomem*regs;
>  wait_queue_head_t   irq_queue;
> diff --git a/drivers/media/platform/ti-vpe/cal.c 
> 

[PATCH v2.1 6/9] v4l: Add 14-bit raw bayer pixel format definitions

2016-06-27 Thread Sakari Ailus
The formats added by this patch are:

V4L2_PIX_FMT_SBGGR14
V4L2_PIX_FMT_SGBRG14
V4L2_PIX_FMT_SGRBG14
V4L2_PIX_FMT_SRGGB14

Signed-off-by: Jouni Ukkonen 
Signed-off-by: Sakari Ailus 
Acked-by: Hans Verkuil 
---
since v2:

- Use "GR14" instead of "BA14" 4cc for V4L2_PIX_FMT_SGRBG14.

 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml | 91 ++
 Documentation/DocBook/media/v4l/pixfmt.xml |  1 +
 include/uapi/linux/videodev2.h |  4 +
 3 files changed, 96 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml

diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb14.xml 
b/Documentation/DocBook/media/v4l/pixfmt-srggb14.xml
new file mode 100644
index 000..5139c45
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/pixfmt-srggb14.xml
@@ -0,0 +1,91 @@
+
+  
+   V4L2_PIX_FMT_SRGGB14 ('RG14'),
+V4L2_PIX_FMT_SGRBG14 ('GR14'),
+V4L2_PIX_FMT_SGBRG14 ('GB14'),
+V4L2_PIX_FMT_SBGGR14 ('BG14')
+
+   
+  
+  
+   V4L2_PIX_FMT_SRGGB14
+   V4L2_PIX_FMT_SGRBG14
+   V4L2_PIX_FMT_SGBRG14
+   V4L2_PIX_FMT_SBGGR14
+   14-bit Bayer formats expanded to 16 bits
+  
+  
+   Description
+
+   These four pixel formats are raw sRGB / Bayer formats with
+14 bits per colour. Each colour component is stored in a 16-bit word, with 2
+unused high bits filled with zeros. Each n-pixel row contains n/2 green samples
+and n/2 blue or red samples, with alternating red and blue rows. Bytes are
+stored in memory in little endian order. They are conventionally described
+as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these
+formats:
+
+
+  V4L2_PIX_FMT_SBGGR14 4  4
+pixel image
+
+  
+   Byte Order.
+   Each cell is one byte, the 2 most significant bits in the high
+ bytes are 0.
+ 
+   
+ 
+ 
+   
+ start+0:
+ B00low
+ B00high
+ G01low
+ G01high
+ B02low
+ B02high
+ G03low
+ G03high
+   
+   
+ start+8:
+ G10low
+ G10high
+ R11low
+ R11high
+ G12low
+ G12high
+ R13low
+ R13high
+   
+   
+ start+16:
+ B20low
+ B20high
+ G21low
+ G21high
+ B22low
+ B22high
+ G23low
+ G23high
+   
+   
+ start+24:
+ G30low
+ G30high
+ R31low
+ R31high
+ G32low
+ G32high
+ R33low
+ R33high
+   
+ 
+   
+ 
+   
+  
+
+  
+
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index 457337e..29e9d7c 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -1594,6 +1594,7 @@ access the palette, this must be done with ioctls of the 
Linux framebuffer API.<
 
 
 
+
   
 
   
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 7ace868..86af01a 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -581,6 +581,10 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
 #define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
 #define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
+#define V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4') /* 14  BGBG.. 
GRGR.. */
+#define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') /* 14  GBGB.. 
RGRG.. */
+#define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('G', 'R', '1', '4') /* 14  GRGR.. 
BGBG.. */
+#define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') /* 14  RGRG.. 
GBGB.. */
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. 
GRGR.. */
 
 /* compressed formats */
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] [media] dvb-usb: silence an uninitialized variable warning

2016-06-27 Thread Dan Carpenter
My static checker complains that if adap->props.num_frontends is 0 then
"ret" is uninitialized.  I don't think that can happen.  But "ret" is
always zero here so we can just remove the condition.

This extra check was added in commit 0d3ab8410dcb ('[media] dvb core:
must check dvb_create_media_graph()').

Signed-off-by: Dan Carpenter 

diff --git a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c 
b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
index 6477b04..a04c0a2 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
@@ -320,8 +320,6 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter 
*adap)
 
adap->num_frontends_initialized++;
}
-   if (ret)
-   return ret;
 
ret = dvb_create_media_graph(>dvb_adap, true);
if (ret)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 09/13] media/platform: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Reviewed-by: Laurent Pinchart 
Cc: Mikhail Ulyanov 
Cc: Guennadi Liakhovetski 
Cc: Jonathan Corbet 
---
 drivers/media/platform/m2m-deinterlace.c| 15 ++-
 drivers/media/platform/marvell-ccic/mcam-core.c | 24 +---
 drivers/media/platform/marvell-ccic/mcam-core.h |  2 --
 drivers/media/platform/mx2_emmaprp.c| 17 +++--
 drivers/media/platform/omap3isp/ispvideo.c  | 12 ++--
 drivers/media/platform/omap3isp/ispvideo.h  |  1 -
 drivers/media/platform/rcar_jpu.c   | 22 --
 drivers/media/platform/sh_veu.c | 17 +++--
 drivers/media/platform/sh_vou.c | 14 ++
 9 files changed, 17 insertions(+), 107 deletions(-)

diff --git a/drivers/media/platform/m2m-deinterlace.c 
b/drivers/media/platform/m2m-deinterlace.c
index 7383818..15110ea 100644
--- a/drivers/media/platform/m2m-deinterlace.c
+++ b/drivers/media/platform/m2m-deinterlace.c
@@ -136,7 +136,6 @@ struct deinterlace_dev {
struct dma_chan *dma_chan;
 
struct v4l2_m2m_dev *m2m_dev;
-   struct vb2_alloc_ctx*alloc_ctx;
 };
 
 struct deinterlace_ctx {
@@ -820,8 +819,6 @@ static int deinterlace_queue_setup(struct vb2_queue *vq,
*nbuffers = count;
sizes[0] = size;
 
-   alloc_ctxs[0] = ctx->dev->alloc_ctx;
-
dprintk(ctx->dev, "get %d buffer(s) of size %d each.\n", count, size);
 
return 0;
@@ -874,6 +871,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
src_vq->ops = _qops;
src_vq->mem_ops = _dma_contig_memops;
src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+   src_vq->dev = ctx->dev->v4l2_dev.dev;
q_data[V4L2_M2M_SRC].fmt = [0];
q_data[V4L2_M2M_SRC].width = 640;
q_data[V4L2_M2M_SRC].height = 480;
@@ -891,6 +889,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
dst_vq->ops = _qops;
dst_vq->mem_ops = _dma_contig_memops;
dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+   dst_vq->dev = ctx->dev->v4l2_dev.dev;
q_data[V4L2_M2M_DST].fmt = [0];
q_data[V4L2_M2M_DST].width = 640;
q_data[V4L2_M2M_DST].height = 480;
@@ -1046,13 +1045,6 @@ static int deinterlace_probe(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, pcdev);
 
-   pcdev->alloc_ctx = vb2_dma_contig_init_ctx(>dev);
-   if (IS_ERR(pcdev->alloc_ctx)) {
-   v4l2_err(>v4l2_dev, "Failed to alloc vb2 context\n");
-   ret = PTR_ERR(pcdev->alloc_ctx);
-   goto err_ctx;
-   }
-
pcdev->m2m_dev = v4l2_m2m_init(_ops);
if (IS_ERR(pcdev->m2m_dev)) {
v4l2_err(>v4l2_dev, "Failed to init mem2mem device\n");
@@ -1064,8 +1056,6 @@ static int deinterlace_probe(struct platform_device *pdev)
 
 err_m2m:
video_unregister_device(>vfd);
-err_ctx:
-   vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
 unreg_dev:
v4l2_device_unregister(>v4l2_dev);
 rel_dma:
@@ -1082,7 +1072,6 @@ static int deinterlace_remove(struct platform_device 
*pdev)
v4l2_m2m_release(pcdev->m2m_dev);
video_unregister_device(>vfd);
v4l2_device_unregister(>v4l2_dev);
-   vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
dma_release_channel(pcdev->dma_chan);
 
return 0;
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c 
b/drivers/media/platform/marvell-ccic/mcam-core.c
index 9b878de..8a1f12d 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core.c
@@ -1059,10 +1059,6 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq,
 
if (*nbufs < minbufs)
*nbufs = minbufs;
-   if (cam->buffer_mode == B_DMA_contig)
-   alloc_ctxs[0] = cam->vb_alloc_ctx;
-   else if (cam->buffer_mode == B_DMA_sg)
-   alloc_ctxs[0] = cam->vb_alloc_ctx_sg;
 
if (*num_planes)
return sizes[0] < size ? -EINVAL : 0;
@@ -1271,6 +1267,7 @@ static int mcam_setup_vb2(struct mcam_camera *cam)
vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ;
vq->buf_struct_size = sizeof(struct mcam_vb_buffer);
+   vq->dev = cam->dev;
INIT_LIST_HEAD(>buffers);
switch (cam->buffer_mode) {
case B_DMA_contig:
@@ -1279,9 +1276,6 @@ static int mcam_setup_vb2(struct mcam_camera *cam)
vq->mem_ops = _dma_contig_memops;
cam->dma_setup = mcam_ctlr_dma_contig;
cam->frame_complete = mcam_dma_contig_done;
-   

[PATCHv5 08/13] media/platform: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Cc: Fabien Dessenne 
Acked-by: Benoit Parrot 
Reviewed-by: Laurent Pinchart 
---
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 18 --
 drivers/media/platform/sti/bdisp/bdisp.h  |  2 --
 drivers/media/platform/ti-vpe/cal.c   | 15 +--
 drivers/media/platform/ti-vpe/vpe.c   | 20 
 drivers/media/platform/vsp1/vsp1_video.c  | 14 ++
 drivers/media/platform/vsp1/vsp1_video.h  |  1 -
 drivers/media/platform/xilinx/xilinx-dma.c| 11 +--
 drivers/media/platform/xilinx/xilinx-dma.h|  2 --
 8 files changed, 12 insertions(+), 71 deletions(-)

diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c 
b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
index d12a419..b3e8b5a 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c
@@ -439,7 +439,7 @@ static void bdisp_ctrls_delete(struct bdisp_ctx *ctx)
 
 static int bdisp_queue_setup(struct vb2_queue *vq,
 unsigned int *nb_buf, unsigned int *nb_planes,
-unsigned int sizes[], void *allocators[])
+unsigned int sizes[], void *alloc_ctxs[])
 {
struct bdisp_ctx *ctx = vb2_get_drv_priv(vq);
struct bdisp_frame *frame = ctx_get_frame(ctx, vq->type);
@@ -453,7 +453,6 @@ static int bdisp_queue_setup(struct vb2_queue *vq,
dev_err(ctx->bdisp_dev->dev, "Invalid format\n");
return -EINVAL;
}
-   allocators[0] = ctx->bdisp_dev->alloc_ctx;
 
if (*nb_planes)
return sizes[0] < frame->sizeimage ? -EINVAL : 0;
@@ -553,6 +552,7 @@ static int queue_init(void *priv,
src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
src_vq->lock = >bdisp_dev->lock;
+   src_vq->dev = ctx->bdisp_dev->v4l2_dev.dev;
 
ret = vb2_queue_init(src_vq);
if (ret)
@@ -567,6 +567,7 @@ static int queue_init(void *priv,
dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
dst_vq->lock = >bdisp_dev->lock;
+   dst_vq->dev = ctx->bdisp_dev->v4l2_dev.dev;
 
return vb2_queue_init(dst_vq);
 }
@@ -1269,8 +1270,6 @@ static int bdisp_remove(struct platform_device *pdev)
 
bdisp_hw_free_filters(bdisp->dev);
 
-   vb2_dma_contig_cleanup_ctx(bdisp->alloc_ctx);
-
pm_runtime_disable(>dev);
 
bdisp_debugfs_remove(bdisp);
@@ -1371,18 +1370,11 @@ static int bdisp_probe(struct platform_device *pdev)
goto err_dbg;
}
 
-   /* Continuous memory allocator */
-   bdisp->alloc_ctx = vb2_dma_contig_init_ctx(dev);
-   if (IS_ERR(bdisp->alloc_ctx)) {
-   ret = PTR_ERR(bdisp->alloc_ctx);
-   goto err_pm;
-   }
-
/* Filters */
if (bdisp_hw_alloc_filters(bdisp->dev)) {
dev_err(bdisp->dev, "no memory for filters\n");
ret = -ENOMEM;
-   goto err_vb2_dma;
+   goto err_pm;
}
 
/* Register */
@@ -1401,8 +1393,6 @@ static int bdisp_probe(struct platform_device *pdev)
 
 err_filter:
bdisp_hw_free_filters(bdisp->dev);
-err_vb2_dma:
-   vb2_dma_contig_cleanup_ctx(bdisp->alloc_ctx);
 err_pm:
pm_runtime_put(dev);
 err_dbg:
diff --git a/drivers/media/platform/sti/bdisp/bdisp.h 
b/drivers/media/platform/sti/bdisp/bdisp.h
index 0cf9857..b3fbf99 100644
--- a/drivers/media/platform/sti/bdisp/bdisp.h
+++ b/drivers/media/platform/sti/bdisp/bdisp.h
@@ -175,7 +175,6 @@ struct bdisp_dbg {
  * @id: device index
  * @m2m:memory-to-memory V4L2 device information
  * @state:  flags used to synchronize m2m and capture mode operation
- * @alloc_ctx:  videobuf2 memory allocator context
  * @clock:  IP clock
  * @regs:   registers
  * @irq_queue:  interrupt handler waitqueue
@@ -193,7 +192,6 @@ struct bdisp_dev {
u16 id;
struct bdisp_m2m_device m2m;
unsigned long   state;
-   struct vb2_alloc_ctx*alloc_ctx;
struct clk  *clock;
void __iomem*regs;
wait_queue_head_t   irq_queue;
diff --git a/drivers/media/platform/ti-vpe/cal.c 
b/drivers/media/platform/ti-vpe/cal.c
index 82001e6..51ebf32 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -287,7 +287,6 @@ struct cal_ctx {
/* Several counters */
unsigned long   jiffies;
 
-   struct vb2_alloc_ctx*alloc_ctx;
struct cal_dmaqueue vidq;
 
/* Input Number */
@@ 

[PATCHv5 05/13] media/pci: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Cc: Federico Vaga 
Cc: Mauro Carvalho Chehab 
---
 drivers/media/pci/cobalt/cobalt-driver.c  |  9 -
 drivers/media/pci/cobalt/cobalt-driver.h  |  1 -
 drivers/media/pci/cobalt/cobalt-v4l2.c|  2 +-
 drivers/media/pci/cx23885/cx23885-417.c   |  1 -
 drivers/media/pci/cx23885/cx23885-core.c  | 10 +-
 drivers/media/pci/cx23885/cx23885-dvb.c   |  2 +-
 drivers/media/pci/cx23885/cx23885-vbi.c   |  1 -
 drivers/media/pci/cx23885/cx23885-video.c |  3 ++-
 drivers/media/pci/cx23885/cx23885.h   |  1 -
 drivers/media/pci/cx25821/cx25821-core.c  | 10 +-
 drivers/media/pci/cx25821/cx25821-video.c |  3 +--
 drivers/media/pci/cx25821/cx25821.h   |  1 -
 drivers/media/pci/cx88/cx88-blackbird.c   |  2 +-
 drivers/media/pci/cx88/cx88-dvb.c |  2 +-
 drivers/media/pci/cx88/cx88-mpeg.c| 10 +-
 drivers/media/pci/cx88/cx88-vbi.c |  1 -
 drivers/media/pci/cx88/cx88-video.c   | 11 ++-
 drivers/media/pci/cx88/cx88.h |  2 --
 drivers/media/pci/dt3155/dt3155.c | 13 ++---
 drivers/media/pci/dt3155/dt3155.h |  2 --
 drivers/media/pci/saa7134/saa7134-core.c  | 22 +++---
 drivers/media/pci/saa7134/saa7134-ts.c|  1 -
 drivers/media/pci/saa7134/saa7134-vbi.c   |  1 -
 drivers/media/pci/saa7134/saa7134-video.c |  3 ++-
 drivers/media/pci/saa7134/saa7134.h   |  1 -
 drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c| 11 +--
 drivers/media/pci/solo6x10/solo6x10-v4l2.c| 10 +-
 drivers/media/pci/solo6x10/solo6x10.h |  2 --
 drivers/media/pci/sta2x11/sta2x11_vip.c   | 18 ++
 drivers/media/pci/tw68/tw68-core.c| 15 +++
 drivers/media/pci/tw68/tw68-video.c   |  2 +-
 drivers/media/pci/tw68/tw68.h |  1 -
 drivers/staging/media/tw686x-kh/tw686x-kh-video.c | 10 +-
 drivers/staging/media/tw686x-kh/tw686x-kh.h   |  1 -
 34 files changed, 32 insertions(+), 153 deletions(-)

diff --git a/drivers/media/pci/cobalt/cobalt-driver.c 
b/drivers/media/pci/cobalt/cobalt-driver.c
index 8d6f04f..1aaa2b0 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.c
+++ b/drivers/media/pci/cobalt/cobalt-driver.c
@@ -691,17 +691,10 @@ static int cobalt_probe(struct pci_dev *pci_dev,
cobalt->pci_dev = pci_dev;
cobalt->instance = i;
 
-   cobalt->alloc_ctx = vb2_dma_sg_init_ctx(_dev->dev);
-   if (IS_ERR(cobalt->alloc_ctx)) {
-   kfree(cobalt);
-   return -ENOMEM;
-   }
-
retval = v4l2_device_register(_dev->dev, >v4l2_dev);
if (retval) {
pr_err("cobalt: v4l2_device_register of card %d failed\n",
cobalt->instance);
-   vb2_dma_sg_cleanup_ctx(cobalt->alloc_ctx);
kfree(cobalt);
return retval;
}
@@ -782,7 +775,6 @@ err:
cobalt_err("error %d on initialization\n", retval);
 
v4l2_device_unregister(>v4l2_dev);
-   vb2_dma_sg_cleanup_ctx(cobalt->alloc_ctx);
kfree(cobalt);
return retval;
 }
@@ -818,7 +810,6 @@ static void cobalt_remove(struct pci_dev *pci_dev)
cobalt_info("removed cobalt card\n");
 
v4l2_device_unregister(v4l2_dev);
-   vb2_dma_sg_cleanup_ctx(cobalt->alloc_ctx);
kfree(cobalt);
 }
 
diff --git a/drivers/media/pci/cobalt/cobalt-driver.h 
b/drivers/media/pci/cobalt/cobalt-driver.h
index b2f08e4..ed00dc9 100644
--- a/drivers/media/pci/cobalt/cobalt-driver.h
+++ b/drivers/media/pci/cobalt/cobalt-driver.h
@@ -262,7 +262,6 @@ struct cobalt {
int instance;
struct pci_dev *pci_dev;
struct v4l2_device v4l2_dev;
-   void *alloc_ctx;
 
void __iomem *bar0, *bar1;
 
diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c 
b/drivers/media/pci/cobalt/cobalt-v4l2.c
index c0ba458..6c19cdfc 100644
--- a/drivers/media/pci/cobalt/cobalt-v4l2.c
+++ b/drivers/media/pci/cobalt/cobalt-v4l2.c
@@ -54,7 +54,6 @@ static int cobalt_queue_setup(struct vb2_queue *q,
*num_buffers = 3;
if (*num_buffers > NR_BUFS)
*num_buffers = NR_BUFS;
-   alloc_ctxs[0] = s->cobalt->alloc_ctx;
if (*num_planes)
return sizes[0] < size ? -EINVAL : 0;
*num_planes = 1;
@@ -1224,6 +1223,7 @@ static int cobalt_node_register(struct cobalt *cobalt, 
int node)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 2;
q->lock = >lock;
+   q->dev = >pci_dev->dev;

[PATCHv5 07/13] media/platform: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Acked-by: Lad, Prabhakar 
Cc: Scott Jiang 
Acked-by: Philipp Zabel 
---
 drivers/media/platform/am437x/am437x-vpfe.c| 10 +-
 drivers/media/platform/am437x/am437x-vpfe.h|  2 --
 drivers/media/platform/blackfin/bfin_capture.c | 15 ++-
 drivers/media/platform/coda/coda-common.c  | 16 ++--
 drivers/media/platform/coda/coda.h |  1 -
 drivers/media/platform/davinci/vpbe_display.c  | 12 +---
 drivers/media/platform/davinci/vpif_capture.c  | 11 +--
 drivers/media/platform/davinci/vpif_capture.h  |  2 --
 drivers/media/platform/davinci/vpif_display.c  | 11 +--
 drivers/media/platform/davinci/vpif_display.h  |  2 --
 drivers/media/platform/rcar-vin/rcar-dma.c | 11 +--
 drivers/media/platform/rcar-vin/rcar-vin.h |  2 --
 include/media/davinci/vpbe_display.h   |  2 --
 13 files changed, 9 insertions(+), 88 deletions(-)

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index e749eb7..d22b09d 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -1915,7 +1915,6 @@ static int vpfe_queue_setup(struct vb2_queue *vq,
 
if (vq->num_buffers + *nbuffers < 3)
*nbuffers = 3 - vq->num_buffers;
-   alloc_ctxs[0] = vpfe->alloc_ctx;
 
if (*nplanes) {
if (sizes[0] < size)
@@ -2364,13 +2363,6 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe)
goto probe_out;
 
/* Initialize videobuf2 queue as per the buffer type */
-   vpfe->alloc_ctx = vb2_dma_contig_init_ctx(vpfe->pdev);
-   if (IS_ERR(vpfe->alloc_ctx)) {
-   vpfe_err(vpfe, "Failed to get the context\n");
-   err = PTR_ERR(vpfe->alloc_ctx);
-   goto probe_out;
-   }
-
q = >buffer_queue;
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ;
@@ -2381,11 +2373,11 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->lock = >lock;
q->min_buffers_needed = 1;
+   q->dev = vpfe->pdev;
 
err = vb2_queue_init(q);
if (err) {
vpfe_err(vpfe, "vb2_queue_init() failed\n");
-   vb2_dma_contig_cleanup_ctx(vpfe->alloc_ctx);
goto probe_out;
}
 
diff --git a/drivers/media/platform/am437x/am437x-vpfe.h 
b/drivers/media/platform/am437x/am437x-vpfe.h
index 777bf97..17d7aa4 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.h
+++ b/drivers/media/platform/am437x/am437x-vpfe.h
@@ -264,8 +264,6 @@ struct vpfe_device {
struct v4l2_rect crop;
/* Buffer queue used in video-buf */
struct vb2_queue buffer_queue;
-   /* Allocator-specific contexts for each plane */
-   struct vb2_alloc_ctx *alloc_ctx;
/* Queue of filled frames */
struct list_head dma_queue;
/* IRQ lock for DMA queue */
diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index d0092da..1e244287 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -91,8 +91,6 @@ struct bcap_device {
struct bcap_buffer *cur_frm;
/* buffer queue used in videobuf2 */
struct vb2_queue buffer_queue;
-   /* allocator-specific contexts for each plane */
-   struct vb2_alloc_ctx *alloc_ctx;
/* queue of filled frames */
struct list_head dma_queue;
/* used in videobuf2 callback */
@@ -209,7 +207,6 @@ static int bcap_queue_setup(struct vb2_queue *vq,
 
if (vq->num_buffers + *nbuffers < 2)
*nbuffers = 2;
-   alloc_ctxs[0] = bcap_dev->alloc_ctx;
 
if (*nplanes)
return sizes[0] < bcap_dev->fmt.sizeimage ? -EINVAL : 0;
@@ -820,12 +817,6 @@ static int bcap_probe(struct platform_device *pdev)
}
bcap_dev->ppi->priv = bcap_dev;
 
-   bcap_dev->alloc_ctx = vb2_dma_contig_init_ctx(>dev);
-   if (IS_ERR(bcap_dev->alloc_ctx)) {
-   ret = PTR_ERR(bcap_dev->alloc_ctx);
-   goto err_free_ppi;
-   }
-
vfd = _dev->video_dev;
/* initialize field of video device */
vfd->release= video_device_release_empty;
@@ -839,7 +830,7 @@ static int bcap_probe(struct platform_device *pdev)
if (ret) {
v4l2_err(pdev->dev.driver,
"Unable to register v4l2 device\n");
-   goto err_cleanup_ctx;
+   goto err_free_ppi;
}
v4l2_info(_dev->v4l2_dev, "v4l2 device 

[PATCHv5 11/13] media/platform: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Cc: Kyungmin Park 
Cc: Sylwester Nawrocki 
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 10 +-
 drivers/media/platform/exynos-gsc/gsc-core.h |  1 -
 drivers/media/platform/exynos-gsc/gsc-m2m.c  |  6 +++---
 drivers/media/platform/s3c-camif/camif-capture.c |  3 +--
 drivers/media/platform/s3c-camif/camif-core.c| 11 +--
 drivers/media/platform/s3c-camif/camif-core.h|  2 --
 drivers/media/platform/s5p-g2d/g2d.c | 13 +++--
 drivers/media/platform/s5p-g2d/g2d.h |  1 -
 drivers/media/platform/s5p-jpeg/jpeg-core.c  | 17 -
 drivers/media/platform/s5p-jpeg/jpeg-core.h  |  2 --
 drivers/media/platform/s5p-tv/mixer.h|  2 --
 drivers/media/platform/s5p-tv/mixer_video.c  | 15 ++-
 12 files changed, 15 insertions(+), 68 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index c9d2009..787bd16 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1123,20 +1123,13 @@ static int gsc_probe(struct platform_device *pdev)
if (ret < 0)
goto err_m2m;
 
-   /* Initialize continious memory allocator */
vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
-   gsc->alloc_ctx = vb2_dma_contig_init_ctx(dev);
-   if (IS_ERR(gsc->alloc_ctx)) {
-   ret = PTR_ERR(gsc->alloc_ctx);
-   goto err_pm;
-   }
 
dev_dbg(dev, "gsc-%d registered successfully\n", gsc->id);
 
pm_runtime_put(dev);
return 0;
-err_pm:
-   pm_runtime_put(dev);
+
 err_m2m:
gsc_unregister_m2m_device(gsc);
 err_v4l2:
@@ -1153,7 +1146,6 @@ static int gsc_remove(struct platform_device *pdev)
gsc_unregister_m2m_device(gsc);
v4l2_device_unregister(>v4l2_dev);
 
-   vb2_dma_contig_cleanup_ctx(gsc->alloc_ctx);
vb2_dma_contig_clear_max_seg_size(>dev);
pm_runtime_disable(>dev);
gsc_clk_put(gsc);
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.h 
b/drivers/media/platform/exynos-gsc/gsc-core.h
index ec4000c..5c48329 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.h
+++ b/drivers/media/platform/exynos-gsc/gsc-core.h
@@ -341,7 +341,6 @@ struct gsc_dev {
wait_queue_head_t   irq_queue;
struct gsc_m2m_device   m2m;
unsigned long   state;
-   struct vb2_alloc_ctx*alloc_ctx;
struct video_device vdev;
struct v4l2_device  v4l2_dev;
 };
diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c 
b/drivers/media/platform/exynos-gsc/gsc-m2m.c
index a600e32..622709c 100644
--- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
@@ -227,10 +227,8 @@ static int gsc_m2m_queue_setup(struct vb2_queue *vq,
return -EINVAL;
 
*num_planes = frame->fmt->num_planes;
-   for (i = 0; i < frame->fmt->num_planes; i++) {
+   for (i = 0; i < frame->fmt->num_planes; i++)
sizes[i] = frame->payload[i];
-   allocators[i] = ctx->gsc_dev->alloc_ctx;
-   }
return 0;
 }
 
@@ -591,6 +589,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
src_vq->lock = >gsc_dev->lock;
+   src_vq->dev = >gsc_dev->pdev->dev;
 
ret = vb2_queue_init(src_vq);
if (ret)
@@ -605,6 +604,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
dst_vq->lock = >gsc_dev->lock;
+   dst_vq->dev = >gsc_dev->pdev->dev;
 
return vb2_queue_init(dst_vq);
 }
diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index bd060ef..5eb5df1 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -440,7 +440,6 @@ static int queue_setup(struct vb2_queue *vq,
   unsigned int sizes[], void *allocators[])
 {
struct camif_vp *vp = vb2_get_drv_priv(vq);
-   struct camif_dev *camif = vp->camif;
struct camif_frame *frame = >out_frame;
const struct camif_fmt *fmt = vp->out_fmt;
unsigned int size;
@@ -449,7 +448,6 @@ static int queue_setup(struct vb2_queue *vq,
return -EINVAL;
 
size = (frame->f_width * frame->f_height * fmt->depth) / 8;
-   allocators[0] = camif->alloc_ctx;
 
if (*num_planes)
 

[PATCHv5 13/13] vb2: replace void *alloc_ctxs by struct device *alloc_devs

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Make this a proper typed array. Drop the old allocate context code since
that is no longer used.

Note that the memops functions now get a struct device pointer instead of
the struct device ** that was there initially (actually a void pointer to
a struct containing only a struct device pointer).

This code is now a lot cleaner.

Signed-off-by: Hans Verkuil 
Reviewed-by: Laurent Pinchart 
Cc: Sakari Ailus 
Cc: Mauro Carvalho Chehab 
---
 drivers/input/touchscreen/sur40.c  |  2 +-
 drivers/media/dvb-frontends/rtl2832_sdr.c  |  2 +-
 drivers/media/pci/cobalt/cobalt-v4l2.c |  2 +-
 drivers/media/pci/cx23885/cx23885-417.c|  2 +-
 drivers/media/pci/cx23885/cx23885-dvb.c|  2 +-
 drivers/media/pci/cx23885/cx23885-vbi.c|  2 +-
 drivers/media/pci/cx23885/cx23885-video.c  |  2 +-
 drivers/media/pci/cx25821/cx25821-video.c  |  2 +-
 drivers/media/pci/cx88/cx88-blackbird.c|  2 +-
 drivers/media/pci/cx88/cx88-dvb.c  |  2 +-
 drivers/media/pci/cx88/cx88-vbi.c  |  2 +-
 drivers/media/pci/cx88/cx88-video.c|  2 +-
 drivers/media/pci/dt3155/dt3155.c  |  2 +-
 drivers/media/pci/netup_unidvb/netup_unidvb_core.c |  2 +-
 drivers/media/pci/saa7134/saa7134-ts.c |  2 +-
 drivers/media/pci/saa7134/saa7134-vbi.c|  2 +-
 drivers/media/pci/saa7134/saa7134-video.c  |  2 +-
 drivers/media/pci/saa7134/saa7134.h|  2 +-
 drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c |  2 +-
 drivers/media/pci/solo6x10/solo6x10-v4l2.c |  2 +-
 drivers/media/pci/sta2x11/sta2x11_vip.c|  2 +-
 drivers/media/pci/tw68/tw68-video.c|  2 +-
 drivers/media/pci/tw686x/tw686x-video.c|  2 +-
 drivers/media/platform/am437x/am437x-vpfe.c|  4 +--
 drivers/media/platform/blackfin/bfin_capture.c |  2 +-
 drivers/media/platform/coda/coda-common.c  |  2 +-
 drivers/media/platform/davinci/vpbe_display.c  |  2 +-
 drivers/media/platform/davinci/vpif_capture.c  |  4 +--
 drivers/media/platform/davinci/vpif_display.c  |  4 +--
 drivers/media/platform/exynos-gsc/gsc-core.h   |  1 -
 drivers/media/platform/exynos-gsc/gsc-m2m.c|  2 +-
 drivers/media/platform/exynos4-is/fimc-capture.c   |  2 +-
 drivers/media/platform/exynos4-is/fimc-isp-video.c |  2 +-
 drivers/media/platform/exynos4-is/fimc-lite.c  |  2 +-
 drivers/media/platform/exynos4-is/fimc-m2m.c   |  2 +-
 drivers/media/platform/m2m-deinterlace.c   |  2 +-
 drivers/media/platform/marvell-ccic/mcam-core.c|  2 +-
 drivers/media/platform/mx2_emmaprp.c   |  2 +-
 drivers/media/platform/omap3isp/ispvideo.c |  2 +-
 drivers/media/platform/rcar-vin/rcar-dma.c |  2 +-
 drivers/media/platform/rcar_jpu.c  |  2 +-
 drivers/media/platform/s3c-camif/camif-capture.c   |  2 +-
 drivers/media/platform/s5p-g2d/g2d.c   |  2 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.c|  2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   | 10 +++---
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   | 12 +++
 drivers/media/platform/s5p-tv/mixer_video.c|  2 +-
 drivers/media/platform/sh_veu.c|  2 +-
 drivers/media/platform/sh_vou.c|  2 +-
 drivers/media/platform/soc_camera/atmel-isi.c  |  2 +-
 drivers/media/platform/soc_camera/rcar_vin.c   |  2 +-
 .../platform/soc_camera/sh_mobile_ceu_camera.c |  2 +-
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c  |  2 +-
 drivers/media/platform/ti-vpe/cal.c|  2 +-
 drivers/media/platform/ti-vpe/vpe.c|  2 +-
 drivers/media/platform/vim2m.c |  7 +---
 drivers/media/platform/vivid/vivid-sdr-cap.c   |  2 +-
 drivers/media/platform/vivid/vivid-vbi-cap.c   |  2 +-
 drivers/media/platform/vivid/vivid-vbi-out.c   |  2 +-
 drivers/media/platform/vivid/vivid-vid-cap.c   |  7 +---
 drivers/media/platform/vivid/vivid-vid-out.c   |  7 +---
 drivers/media/platform/vsp1/vsp1_video.c   |  8 ++---
 drivers/media/platform/xilinx/xilinx-dma.c |  2 +-
 drivers/media/usb/airspy/airspy.c  |  2 +-
 drivers/media/usb/au0828/au0828-vbi.c  |  2 +-
 drivers/media/usb/au0828/au0828-video.c|  2 +-
 drivers/media/usb/em28xx/em28xx-vbi.c  |  2 +-
 drivers/media/usb/em28xx/em28xx-video.c|  2 +-
 drivers/media/usb/go7007/go7007-v4l2.c |  2 +-
 drivers/media/usb/hackrf/hackrf.c  |  2 +-
 drivers/media/usb/msi2500/msi2500.c|  2 +-
 drivers/media/usb/pwc/pwc-if.c |  2 +-
 drivers/media/usb/s2255/s2255drv.c |  2 +-
 

[PATCHv5 10/13] media/.../soc-camera: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Cc: Guennadi Liakhovetski 
Cc: Ludovic Desroches 
Cc: Sergei Shtylyov 
---
 drivers/media/platform/soc_camera/atmel-isi.c| 13 +
 drivers/media/platform/soc_camera/rcar_vin.c | 12 +---
 drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | 15 ++-
 3 files changed, 4 insertions(+), 36 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index ab2d9b9..899b93a 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -72,8 +72,6 @@ struct atmel_isi {
 
int sequence;
 
-   struct vb2_alloc_ctx*alloc_ctx;
-
/* Allocate descriptors for dma buffer use */
struct fbd  *p_fb_descriptors;
dma_addr_t  fb_descriptors_phys;
@@ -322,7 +320,6 @@ static int queue_setup(struct vb2_queue *vq,
 
*nplanes = 1;
sizes[0] = size;
-   alloc_ctxs[0] = isi->alloc_ctx;
 
isi->sequence = 0;
isi->active = NULL;
@@ -567,6 +564,7 @@ static int isi_camera_init_videobuf(struct vb2_queue *q,
q->mem_ops = _dma_contig_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->lock = >host_lock;
+   q->dev = ici->v4l2_dev.dev;
 
return vb2_queue_init(q);
 }
@@ -963,7 +961,6 @@ static int atmel_isi_remove(struct platform_device *pdev)
struct atmel_isi, soc_host);
 
soc_camera_host_unregister(soc_host);
-   vb2_dma_contig_cleanup_ctx(isi->alloc_ctx);
dma_free_coherent(>dev,
sizeof(struct fbd) * MAX_BUFFER_NUM,
isi->p_fb_descriptors,
@@ -1067,12 +1064,6 @@ static int atmel_isi_probe(struct platform_device *pdev)
list_add(>dma_desc[i].list, >dma_desc_head);
}
 
-   isi->alloc_ctx = vb2_dma_contig_init_ctx(>dev);
-   if (IS_ERR(isi->alloc_ctx)) {
-   ret = PTR_ERR(isi->alloc_ctx);
-   goto err_alloc_ctx;
-   }
-
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
isi->regs = devm_ioremap_resource(>dev, regs);
if (IS_ERR(isi->regs)) {
@@ -1119,8 +1110,6 @@ err_register_soc_camera_host:
pm_runtime_disable(>dev);
 err_req_irq:
 err_ioremap:
-   vb2_dma_contig_cleanup_ctx(isi->alloc_ctx);
-err_alloc_ctx:
dma_free_coherent(>dev,
sizeof(struct fbd) * MAX_BUFFER_NUM,
isi->p_fb_descriptors,
diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 3f9c1b8..dadc5b3 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -484,7 +484,6 @@ struct rcar_vin_priv {
struct list_headcapture;
 #define MAX_BUFFER_NUM 3
struct vb2_v4l2_buffer  *queue_buf[MAX_BUFFER_NUM];
-   struct vb2_alloc_ctx*alloc_ctx;
enum v4l2_field field;
unsigned intpdata_flags;
unsigned intvb_count;
@@ -540,8 +539,6 @@ static int rcar_vin_videobuf_setup(struct vb2_queue *vq,
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct rcar_vin_priv *priv = ici->priv;
 
-   alloc_ctxs[0] = priv->alloc_ctx;
-
if (!vq->num_buffers)
priv->sequence = 0;
 
@@ -1816,6 +1813,7 @@ static int rcar_vin_init_videobuf2(struct vb2_queue *vq,
vq->buf_struct_size = sizeof(struct rcar_vin_buffer);
vq->timestamp_flags  = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
vq->lock = >host_lock;
+   vq->dev = ici->v4l2_dev.dev;
 
return vb2_queue_init(vq);
 }
@@ -1912,10 +1910,6 @@ static int rcar_vin_probe(struct platform_device *pdev)
if (ret)
return ret;
 
-   priv->alloc_ctx = vb2_dma_contig_init_ctx(>dev);
-   if (IS_ERR(priv->alloc_ctx))
-   return PTR_ERR(priv->alloc_ctx);
-
priv->ici.priv = priv;
priv->ici.v4l2_dev.dev = >dev;
priv->ici.drv_name = dev_name(>dev);
@@ -1946,7 +1940,6 @@ static int rcar_vin_probe(struct platform_device *pdev)
 
 cleanup:
pm_runtime_disable(>dev);
-   vb2_dma_contig_cleanup_ctx(priv->alloc_ctx);
 
return ret;
 }
@@ -1954,12 +1947,9 @@ cleanup:
 static int rcar_vin_remove(struct platform_device *pdev)
 {
struct soc_camera_host *soc_host = to_soc_camera_host(>dev);
-   struct rcar_vin_priv *priv = container_of(soc_host,
- struct 

[PATCHv5 06/13] staging/media: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Acked-by: Lad, Prabhakar 
Reviewed-by: Laurent Pinchart 
---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 10 +-
 drivers/staging/media/davinci_vpfe/vpfe_video.h |  2 --
 drivers/staging/media/omap4iss/iss_video.c  | 10 +-
 drivers/staging/media/omap4iss/iss_video.h  |  1 -
 4 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index ea3ddec..77e66e7 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -542,7 +542,6 @@ static int vpfe_release(struct file *file)
video->io_usrs = 0;
/* Free buffers allocated */
vb2_queue_release(>buffer_queue);
-   vb2_dma_contig_cleanup_ctx(video->alloc_ctx);
}
/* Decrement device users counter */
video->usrs--;
@@ -1115,7 +1114,6 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq,
 
*nplanes = 1;
sizes[0] = size;
-   alloc_ctxs[0] = video->alloc_ctx;
v4l2_dbg(1, debug, _dev->v4l2_dev,
 "nbuffers=%d, size=%lu\n", *nbuffers, size);
return 0;
@@ -1350,12 +1348,6 @@ static int vpfe_reqbufs(struct file *file, void *priv,
video->memory = req_buf->memory;
 
/* Initialize videobuf2 queue as per the buffer type */
-   video->alloc_ctx = vb2_dma_contig_init_ctx(vpfe_dev->pdev);
-   if (IS_ERR(video->alloc_ctx)) {
-   v4l2_err(_dev->v4l2_dev, "Failed to get the context\n");
-   return PTR_ERR(video->alloc_ctx);
-   }
-
q = >buffer_queue;
q->type = req_buf->type;
q->io_modes = VB2_MMAP | VB2_USERPTR;
@@ -1365,11 +1357,11 @@ static int vpfe_reqbufs(struct file *file, void *priv,
q->mem_ops = _dma_contig_memops;
q->buf_struct_size = sizeof(struct vpfe_cap_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+   q->dev = vpfe_dev->pdev;
 
ret = vb2_queue_init(q);
if (ret) {
v4l2_err(_dev->v4l2_dev, "vb2_queue_init() failed\n");
-   vb2_dma_contig_cleanup_ctx(vpfe_dev->pdev);
return ret;
}
 
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h 
b/drivers/staging/media/davinci_vpfe/vpfe_video.h
index 653334d..aaec440 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.h
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h
@@ -123,8 +123,6 @@ struct vpfe_video_device {
/* Used to store pixel format */
struct v4l2_format  fmt;
struct vb2_queuebuffer_queue;
-   /* allocator-specific contexts for each plane */
-   struct vb2_alloc_ctx *alloc_ctx;
/* Queue of filled frames */
struct list_headdma_queue;
spinlock_t  irqlock;
diff --git a/drivers/staging/media/omap4iss/iss_video.c 
b/drivers/staging/media/omap4iss/iss_video.c
index cf8da23..3c077e3 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -310,8 +310,6 @@ static int iss_video_queue_setup(struct vb2_queue *vq,
if (sizes[0] == 0)
return -EINVAL;
 
-   alloc_ctxs[0] = video->alloc_ctx;
-
*count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0]));
 
return 0;
@@ -1017,13 +1015,6 @@ static int iss_video_open(struct file *file)
goto done;
}
 
-   video->alloc_ctx = vb2_dma_contig_init_ctx(video->iss->dev);
-   if (IS_ERR(video->alloc_ctx)) {
-   ret = PTR_ERR(video->alloc_ctx);
-   omap4iss_put(video->iss);
-   goto done;
-   }
-
q = >queue;
 
q->type = video->type;
@@ -1033,6 +1024,7 @@ static int iss_video_open(struct file *file)
q->mem_ops = _dma_contig_memops;
q->buf_struct_size = sizeof(struct iss_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+   q->dev = video->iss->dev;
 
ret = vb2_queue_init(q);
if (ret) {
diff --git a/drivers/staging/media/omap4iss/iss_video.h 
b/drivers/staging/media/omap4iss/iss_video.h
index c8bd295..d7e05d0 100644
--- a/drivers/staging/media/omap4iss/iss_video.h
+++ b/drivers/staging/media/omap4iss/iss_video.h
@@ -170,7 +170,6 @@ struct iss_video {
spinlock_t qlock;   /* protects dmaqueue and error */
struct list_head dmaqueue;
enum iss_video_dmaqueue_flags dmaqueue_flags;
-   struct vb2_alloc_ctx *alloc_ctx;
 
const struct iss_video_operations *ops;
 };
-- 
2.8.1

--
To unsubscribe from this list: send the line 

[PATCHv5 04/13] sur40: set q->dev instead of allocating a context

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Cc: Florian Echtler 
---
 drivers/input/touchscreen/sur40.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/input/touchscreen/sur40.c 
b/drivers/input/touchscreen/sur40.c
index 880c40b..cc4bd3e 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -151,7 +151,6 @@ struct sur40_state {
struct mutex lock;
 
struct vb2_queue queue;
-   struct vb2_alloc_ctx *alloc_ctx;
struct list_head buf_list;
spinlock_t qlock;
int sequence;
@@ -580,19 +579,13 @@ static int sur40_probe(struct usb_interface *interface,
sur40->queue = sur40_queue;
sur40->queue.drv_priv = sur40;
sur40->queue.lock = >lock;
+   sur40->queue.dev = sur40->dev;
 
/* initialize the queue */
error = vb2_queue_init(>queue);
if (error)
goto err_unreg_v4l2;
 
-   sur40->alloc_ctx = vb2_dma_sg_init_ctx(sur40->dev);
-   if (IS_ERR(sur40->alloc_ctx)) {
-   dev_err(sur40->dev, "Can't allocate buffer context");
-   error = PTR_ERR(sur40->alloc_ctx);
-   goto err_unreg_v4l2;
-   }
-
sur40->vdev = sur40_video_device;
sur40->vdev.v4l2_dev = >v4l2;
sur40->vdev.lock = >lock;
@@ -633,7 +626,6 @@ static void sur40_disconnect(struct usb_interface 
*interface)
 
video_unregister_device(>vdev);
v4l2_device_unregister(>v4l2);
-   vb2_dma_sg_cleanup_ctx(sur40->alloc_ctx);
 
input_unregister_polled_device(sur40->input);
input_free_polled_device(sur40->input);
@@ -655,11 +647,8 @@ static int sur40_queue_setup(struct vb2_queue *q,
   unsigned int *nbuffers, unsigned int *nplanes,
   unsigned int sizes[], void *alloc_ctxs[])
 {
-   struct sur40_state *sur40 = vb2_get_drv_priv(q);
-
if (q->num_buffers + *nbuffers < 3)
*nbuffers = 3 - q->num_buffers;
-   alloc_ctxs[0] = sur40->alloc_ctx;
 
if (*nplanes)
return sizes[0] < sur40_video_format.sizeimage ? -EINVAL : 0;
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 03/13] v4l2-pci-skeleton: set q->dev instead of allocating a context

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx as that is now no longer needed.

Signed-off-by: Hans Verkuil 
---
 samples/v4l/v4l2-pci-skeleton.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/samples/v4l/v4l2-pci-skeleton.c b/samples/v4l/v4l2-pci-skeleton.c
index a55cf94..5f91d76 100644
--- a/samples/v4l/v4l2-pci-skeleton.c
+++ b/samples/v4l/v4l2-pci-skeleton.c
@@ -56,7 +56,6 @@ MODULE_LICENSE("GPL v2");
  * @format: current pix format
  * @input: current video input (0 = SDTV, 1 = HDTV)
  * @queue: vb2 video capture queue
- * @alloc_ctx: vb2 contiguous DMA context
  * @qlock: spinlock controlling access to buf_list and sequence
  * @buf_list: list of buffers queued for DMA
  * @sequence: frame sequence counter
@@ -73,7 +72,6 @@ struct skeleton {
unsigned input;
 
struct vb2_queue queue;
-   struct vb2_alloc_ctx *alloc_ctx;
 
spinlock_t qlock;
struct list_head buf_list;
@@ -182,7 +180,6 @@ static int queue_setup(struct vb2_queue *vq,
 
if (vq->num_buffers + *nbuffers < 3)
*nbuffers = 3 - vq->num_buffers;
-   alloc_ctxs[0] = skel->alloc_ctx;
 
if (*nplanes)
return sizes[0] < skel->format.sizeimage ? -EINVAL : 0;
@@ -820,6 +817,7 @@ static int skeleton_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
q = >queue;
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ;
+   q->dev = >dev;
q->drv_priv = skel;
q->buf_struct_size = sizeof(struct skel_buffer);
q->ops = _qops;
@@ -850,12 +848,6 @@ static int skeleton_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
if (ret)
goto free_hdl;
 
-   skel->alloc_ctx = vb2_dma_contig_init_ctx(>dev);
-   if (IS_ERR(skel->alloc_ctx)) {
-   dev_err(>dev, "Can't allocate buffer context");
-   ret = PTR_ERR(skel->alloc_ctx);
-   goto free_hdl;
-   }
INIT_LIST_HEAD(>buf_list);
spin_lock_init(>qlock);
 
@@ -885,13 +877,11 @@ static int skeleton_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
 
ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
if (ret)
-   goto free_ctx;
+   goto free_hdl;
 
dev_info(>dev, "V4L2 PCI Skeleton Driver loaded\n");
return 0;
 
-free_ctx:
-   vb2_dma_contig_cleanup_ctx(skel->alloc_ctx);
 free_hdl:
v4l2_ctrl_handler_free(>ctrl_handler);
v4l2_device_unregister(>v4l2_dev);
@@ -907,7 +897,6 @@ static void skeleton_remove(struct pci_dev *pdev)
 
video_unregister_device(>vdev);
v4l2_ctrl_handler_free(>ctrl_handler);
-   vb2_dma_contig_cleanup_ctx(skel->alloc_ctx);
v4l2_device_unregister(>v4l2_dev);
pci_disable_device(skel->pdev);
 }
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 12/13] media/platform: convert drivers to use the new vb2_queue dev field

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil 
Cc: Kyungmin Park 
Cc: Sylwester Nawrocki 
---
 drivers/media/platform/exynos4-is/fimc-capture.c   |  7 ++-
 drivers/media/platform/exynos4-is/fimc-core.c  | 10 --
 drivers/media/platform/exynos4-is/fimc-core.h  |  3 ---
 drivers/media/platform/exynos4-is/fimc-is.c| 13 +
 drivers/media/platform/exynos4-is/fimc-is.h|  2 --
 drivers/media/platform/exynos4-is/fimc-isp-video.c |  9 +++--
 drivers/media/platform/exynos4-is/fimc-isp.h   |  2 --
 drivers/media/platform/exynos4-is/fimc-lite.c  | 18 +++---
 drivers/media/platform/exynos4-is/fimc-lite.h  |  2 --
 drivers/media/platform/exynos4-is/fimc-m2m.c   |  6 +++---
 drivers/media/platform/s5p-mfc/s5p_mfc.c   | 18 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|  2 --
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   | 10 --
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   | 14 +-
 14 files changed, 22 insertions(+), 94 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c 
b/drivers/media/platform/exynos4-is/fimc-capture.c
index bf47d3b..512b254 100644
--- a/drivers/media/platform/exynos4-is/fimc-capture.c
+++ b/drivers/media/platform/exynos4-is/fimc-capture.c
@@ -354,11 +354,9 @@ static int queue_setup(struct vb2_queue *vq,
if (*num_planes) {
if (*num_planes != fmt->memplanes)
return -EINVAL;
-   for (i = 0; i < *num_planes; i++) {
+   for (i = 0; i < *num_planes; i++)
if (sizes[i] < (wh * fmt->depth[i]) / 8)
return -EINVAL;
-   allocators[i] = ctx->fimc_dev->alloc_ctx;
-   }
return 0;
}
 
@@ -371,8 +369,6 @@ static int queue_setup(struct vb2_queue *vq,
sizes[i] = frame->payload[i];
else
sizes[i] = max_t(u32, size, frame->payload[i]);
-
-   allocators[i] = ctx->fimc_dev->alloc_ctx;
}
 
return 0;
@@ -1779,6 +1775,7 @@ static int fimc_register_capture_device(struct fimc_dev 
*fimc,
q->buf_struct_size = sizeof(struct fimc_vid_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->lock = >lock;
+   q->dev = >pdev->dev;
 
ret = vb2_queue_init(q);
if (ret)
diff --git a/drivers/media/platform/exynos4-is/fimc-core.c 
b/drivers/media/platform/exynos4-is/fimc-core.c
index 368f44f..8f89ca2 100644
--- a/drivers/media/platform/exynos4-is/fimc-core.c
+++ b/drivers/media/platform/exynos4-is/fimc-core.c
@@ -1018,20 +1018,11 @@ static int fimc_probe(struct platform_device *pdev)
goto err_sd;
}
 
-   /* Initialize contiguous memory allocator */
vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
-   fimc->alloc_ctx = vb2_dma_contig_init_ctx(dev);
-   if (IS_ERR(fimc->alloc_ctx)) {
-   ret = PTR_ERR(fimc->alloc_ctx);
-   goto err_gclk;
-   }
 
dev_dbg(dev, "FIMC.%d registered successfully\n", fimc->id);
return 0;
 
-err_gclk:
-   if (!pm_runtime_enabled(dev))
-   clk_disable(fimc->clock[CLK_GATE]);
 err_sd:
fimc_unregister_capture_subdev(fimc);
 err_sclk:
@@ -1124,7 +1115,6 @@ static int fimc_remove(struct platform_device *pdev)
pm_runtime_set_suspended(>dev);
 
fimc_unregister_capture_subdev(fimc);
-   vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
vb2_dma_contig_clear_max_seg_size(>dev);
 
clk_disable(fimc->clock[CLK_BUS]);
diff --git a/drivers/media/platform/exynos4-is/fimc-core.h 
b/drivers/media/platform/exynos4-is/fimc-core.h
index 6b74354..5615fef 100644
--- a/drivers/media/platform/exynos4-is/fimc-core.h
+++ b/drivers/media/platform/exynos4-is/fimc-core.h
@@ -307,7 +307,6 @@ struct fimc_m2m_device {
  */
 struct fimc_vid_cap {
struct fimc_ctx *ctx;
-   struct vb2_alloc_ctx*alloc_ctx;
struct v4l2_subdev  subdev;
struct exynos_video_entity  ve;
struct media_padvd_pad;
@@ -417,7 +416,6 @@ struct fimc_ctx;
  * @m2m:   memory-to-memory V4L2 device information
  * @vid_cap:   camera capture device information
  * @state: flags used to synchronize m2m and capture mode operation
- * @alloc_ctx: videobuf2 memory allocator context
  * @pipeline:  fimc video capture pipeline data structure
  */
 struct fimc_dev {
@@ -436,7 +434,6 @@ struct fimc_dev {
struct fimc_m2m_device  m2m;
struct fimc_vid_cap vid_cap;
unsigned long   state;
-   struct vb2_alloc_ctx

[PATCHv5 00/13] vb2: replace allocation context by device pointer

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

The opaque allocation context that allocators use and drivers have to fill
in is really nothing more than a device pointer wrapped in an kmalloc()ed
struct.

This patch series adds a new 'struct device *dev' field that contains the
default device pointer to use if the driver doesn't set alloc_ctxs. This
simplifies many drivers since there are only two Samsung drivers that need
different devices for different planes. All others use the same device for
everything.

So instead of having to allocate a context (and free it, which not all
drivers did) you just set a dev pointer once.

The last patch removes the allocation context code altogether and replaces
it with proper struct device pointers instead of the untyped void pointer.

Note: one idea I toyed with was to have an array of devs instead of a
single dev field in vb2_queue, but that was actually awkward to use.

A single dev turned out to be much easier to use.

If there are no comments, then I intend to post a pull request on
Friday.

Regards,

Hans

Changes since v4:
- rebased
- converted the new rcar-vin driver.

Changes since v3:
- move dma_attrs out of struct vb2_dc_conf as the first patch. This
  was originally done in the last patch, but that would actually break
  dma-contig for the patches before that. Thanks to Laurent for noticing.
  It is also better to have this as a separate patch anyway.
- fixed up vsp1_video.c as per Laurent's requests.

Changes since v2:
- rebased against latest linuxtv master and converted the tw686x
  drivers.

Changes since v1:
- rebased against latest linuxtv master
- add dma_attrs field to vb2_queue to specify non-standard DMA attributes
  for both dma-contig. This feature was added to v4.6.


Hans Verkuil (13):
  vb2: move dma_attrs to vb2_queue
  vb2: add a dev field to use for the default allocation context
  v4l2-pci-skeleton: set q->dev instead of allocating a context
  sur40: set q->dev instead of allocating a context
  media/pci: convert drivers to use the new vb2_queue dev field
  staging/media: convert drivers to use the new vb2_queue dev field
  media/platform: convert drivers to use the new vb2_queue dev field
  media/platform: convert drivers to use the new vb2_queue dev field
  media/platform: convert drivers to use the new vb2_queue dev field
  media/.../soc-camera: convert drivers to use the new vb2_queue dev
field
  media/platform: convert drivers to use the new vb2_queue dev field
  media/platform: convert drivers to use the new vb2_queue dev field
  vb2: replace void *alloc_ctxs by struct device *alloc_devs

 drivers/input/touchscreen/sur40.c  | 15 +--
 drivers/media/dvb-frontends/rtl2832_sdr.c  |  2 +-
 drivers/media/pci/cobalt/cobalt-driver.c   |  9 
 drivers/media/pci/cobalt/cobalt-driver.h   |  1 -
 drivers/media/pci/cobalt/cobalt-v4l2.c |  4 +-
 drivers/media/pci/cx23885/cx23885-417.c|  3 +-
 drivers/media/pci/cx23885/cx23885-core.c   | 10 +
 drivers/media/pci/cx23885/cx23885-dvb.c|  4 +-
 drivers/media/pci/cx23885/cx23885-vbi.c|  3 +-
 drivers/media/pci/cx23885/cx23885-video.c  |  5 ++-
 drivers/media/pci/cx23885/cx23885.h|  1 -
 drivers/media/pci/cx25821/cx25821-core.c   | 10 +
 drivers/media/pci/cx25821/cx25821-video.c  |  5 +--
 drivers/media/pci/cx25821/cx25821.h|  1 -
 drivers/media/pci/cx88/cx88-blackbird.c|  4 +-
 drivers/media/pci/cx88/cx88-dvb.c  |  4 +-
 drivers/media/pci/cx88/cx88-mpeg.c | 10 +
 drivers/media/pci/cx88/cx88-vbi.c  |  3 +-
 drivers/media/pci/cx88/cx88-video.c| 13 ++
 drivers/media/pci/cx88/cx88.h  |  2 -
 drivers/media/pci/dt3155/dt3155.c  | 15 ++-
 drivers/media/pci/dt3155/dt3155.h  |  2 -
 drivers/media/pci/netup_unidvb/netup_unidvb_core.c |  2 +-
 drivers/media/pci/saa7134/saa7134-core.c   | 22 --
 drivers/media/pci/saa7134/saa7134-ts.c |  3 +-
 drivers/media/pci/saa7134/saa7134-vbi.c|  3 +-
 drivers/media/pci/saa7134/saa7134-video.c  |  5 ++-
 drivers/media/pci/saa7134/saa7134.h|  3 +-
 drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 13 +-
 drivers/media/pci/solo6x10/solo6x10-v4l2.c | 12 +-
 drivers/media/pci/solo6x10/solo6x10.h  |  2 -
 drivers/media/pci/sta2x11/sta2x11_vip.c| 20 ++---
 drivers/media/pci/tw68/tw68-core.c | 15 ++-
 drivers/media/pci/tw68/tw68-video.c|  4 +-
 drivers/media/pci/tw68/tw68.h  |  1 -
 drivers/media/pci/tw686x/tw686x-video.c|  2 +-
 drivers/media/platform/am437x/am437x-vpfe.c| 14 ++-
 drivers/media/platform/am437x/am437x-vpfe.h|  2 -
 

[PATCHv5 01/13] vb2: move dma_attrs to vb2_queue

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

Make the dma attributes struct part of vb2_queue. This greatly simplifies
the remainder of the patch series since the dma_contig alloc context is
now (as before) just a struct device pointer.

Signed-off-by: Hans Verkuil 
Reviewed-by: Laurent Pinchart 
Cc: Sakari Ailus 
Cc: Mauro Carvalho Chehab 
---
 drivers/media/v4l2-core/videobuf2-core.c   |  2 +-
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 16 +++-
 drivers/media/v4l2-core/videobuf2-dma-sg.c |  5 +++--
 drivers/media/v4l2-core/videobuf2-vmalloc.c|  5 +++--
 include/media/videobuf2-core.h |  7 ---
 include/media/videobuf2-dma-contig.h   |  9 +
 6 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 633fc1a..36f4392 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -207,7 +207,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
unsigned long size = PAGE_ALIGN(vb->planes[plane].length);
 
mem_priv = call_ptr_memop(vb, alloc, q->alloc_ctx[plane],
- size, dma_dir, q->gfp_flags);
+   q->dma_attrs, size, dma_dir, q->gfp_flags);
if (IS_ERR_OR_NULL(mem_priv))
goto free;
 
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c 
b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index e3e47ac..a7825c6 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -23,7 +23,6 @@
 
 struct vb2_dc_conf {
struct device   *dev;
-   struct dma_attrsattrs;
 };
 
 struct vb2_dc_buf {
@@ -140,8 +139,9 @@ static void vb2_dc_put(void *buf_priv)
kfree(buf);
 }
 
-static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size,
- enum dma_data_direction dma_dir, gfp_t gfp_flags)
+static void *vb2_dc_alloc(void *alloc_ctx, const struct dma_attrs *attrs,
+ unsigned long size, enum dma_data_direction dma_dir,
+ gfp_t gfp_flags)
 {
struct vb2_dc_conf *conf = alloc_ctx;
struct device *dev = conf->dev;
@@ -151,7 +151,8 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long 
size,
if (!buf)
return ERR_PTR(-ENOMEM);
 
-   buf->attrs = conf->attrs;
+   if (attrs)
+   buf->attrs = *attrs;
buf->cookie = dma_alloc_attrs(dev, size, >dma_addr,
GFP_KERNEL | gfp_flags, >attrs);
if (!buf->cookie) {
@@ -729,8 +730,7 @@ const struct vb2_mem_ops vb2_dma_contig_memops = {
 };
 EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);
 
-void *vb2_dma_contig_init_ctx_attrs(struct device *dev,
-   struct dma_attrs *attrs)
+void *vb2_dma_contig_init_ctx(struct device *dev)
 {
struct vb2_dc_conf *conf;
 
@@ -739,12 +739,10 @@ void *vb2_dma_contig_init_ctx_attrs(struct device *dev,
return ERR_PTR(-ENOMEM);
 
conf->dev = dev;
-   if (attrs)
-   conf->attrs = *attrs;
 
return conf;
 }
-EXPORT_SYMBOL_GPL(vb2_dma_contig_init_ctx_attrs);
+EXPORT_SYMBOL_GPL(vb2_dma_contig_init_ctx);
 
 void vb2_dma_contig_cleanup_ctx(void *alloc_ctx)
 {
diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c 
b/drivers/media/v4l2-core/videobuf2-dma-sg.c
index 9985c89..e7153f7 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c
@@ -99,8 +99,9 @@ static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf 
*buf,
return 0;
 }
 
-static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size,
- enum dma_data_direction dma_dir, gfp_t gfp_flags)
+static void *vb2_dma_sg_alloc(void *alloc_ctx, const struct dma_attrs 
*dma_attrs,
+ unsigned long size, enum dma_data_direction 
dma_dir,
+ gfp_t gfp_flags)
 {
struct vb2_dma_sg_conf *conf = alloc_ctx;
struct vb2_dma_sg_buf *buf;
diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c 
b/drivers/media/v4l2-core/videobuf2-vmalloc.c
index 1c30274..fb94c80 100644
--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
@@ -33,8 +33,9 @@ struct vb2_vmalloc_buf {
 
 static void vb2_vmalloc_put(void *buf_priv);
 
-static void *vb2_vmalloc_alloc(void *alloc_ctx, unsigned long size,
-  enum dma_data_direction dma_dir, gfp_t gfp_flags)
+static void *vb2_vmalloc_alloc(void *alloc_ctx, const struct dma_attrs *attrs,
+  unsigned long size, enum dma_data_direction 
dma_dir,
+ 

[PATCHv5 02/13] vb2: add a dev field to use for the default allocation context

2016-06-27 Thread Hans Verkuil
From: Hans Verkuil 

The allocation context is nothing more than a per-plane device pointer
to use when allocating buffers. So just provide a dev pointer in vb2_queue
for that purpose and drivers can skip allocating/releasing/filling in
the allocation context unless they require different per-plane device
pointers as used by some Samsung SoCs.

Signed-off-by: Hans Verkuil 
Reviewed-by: Laurent Pinchart 
Cc: Sakari Ailus 
Cc: Mauro Carvalho Chehab 
Cc: Florian Echtler 
Cc: Federico Vaga 
Cc: "Lad, Prabhakar" 
Cc: Scott Jiang 
Acked-by: Philipp Zabel 
Cc: Fabien Dessenne 
Acked-by: Benoit Parrot 
Cc: Mikhail Ulyanov 
Cc: Guennadi Liakhovetski 
Cc: Jonathan Corbet 
Cc: Ludovic Desroches 
Cc: Sergei Shtylyov 
Cc: Kyungmin Park 
Cc: Sylwester Nawrocki 
---
 drivers/media/v4l2-core/videobuf2-core.c | 14 --
 include/media/videobuf2-core.h   |  3 +++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 36f4392..aabb03e 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -206,7 +206,8 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
for (plane = 0; plane < vb->num_planes; ++plane) {
unsigned long size = PAGE_ALIGN(vb->planes[plane].length);
 
-   mem_priv = call_ptr_memop(vb, alloc, q->alloc_ctx[plane],
+   mem_priv = call_ptr_memop(vb, alloc,
+   q->alloc_ctx[plane] ? : >dev,
q->dma_attrs, size, dma_dir, q->gfp_flags);
if (IS_ERR_OR_NULL(mem_priv))
goto free;
@@ -1131,9 +1132,10 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const 
void *pb)
vb->planes[plane].data_offset = 0;
 
/* Acquire each plane's memory */
-   mem_priv = call_ptr_memop(vb, get_userptr, q->alloc_ctx[plane],
- planes[plane].m.userptr,
- planes[plane].length, dma_dir);
+   mem_priv = call_ptr_memop(vb, get_userptr,
+   q->alloc_ctx[plane] ? : >dev,
+   planes[plane].m.userptr,
+   planes[plane].length, dma_dir);
if (IS_ERR_OR_NULL(mem_priv)) {
dprintk(1, "failed acquiring userspace "
"memory for plane %d\n", plane);
@@ -1256,8 +1258,8 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const 
void *pb)
 
/* Acquire each plane's memory */
mem_priv = call_ptr_memop(vb, attach_dmabuf,
-   q->alloc_ctx[plane], dbuf, planes[plane].length,
-   dma_dir);
+   q->alloc_ctx[plane] ? : >dev,
+   dbuf, planes[plane].length, dma_dir);
if (IS_ERR(mem_priv)) {
dprintk(1, "failed to attach dmabuf\n");
ret = PTR_ERR(mem_priv);
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 444ef3b..d38668c 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -400,6 +400,8 @@ struct vb2_buf_ops {
  * caller. For example, for V4L2, it should match
  * the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h
  * @io_modes:  supported io methods (see vb2_io_modes enum)
+ * @dev:   device to use for the default allocation context if the driver
+ * doesn't fill in the @alloc_ctx array.
  * @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
@@ -467,6 +469,7 @@ struct vb2_buf_ops {
 struct vb2_queue {
unsigned inttype;
unsigned intio_modes;
+   struct device   *dev;
const struct dma_attrs  *dma_attrs;
unsignedfileio_read_once:1;
unsignedfileio_write_immediately:1;
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v4.8] R-Car VSP1 driver changes

2016-06-27 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit c3f34a4bdd596127000666c17bbf8ba1c3d2d332:

  [media] v4l: vsp1: Remove deprecated DRM API (2016-06-20 20:09:10 -0300)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git vsp1/flip

for you to fetch changes up to 1ae8abb4289a1c71d3aeec90431f5a5d0e88ad72:

  v4l: vsp1: wpf: Add flipping support (2016-06-22 13:33:11 +0300)

The commits are based on top of the vsp1 branch of your tree.


Laurent Pinchart (23):
  v4l: vsp1: Fix typo in register field names
  v4l: vsp1: Fix descriptions of Gen2 VSP instances
  v4l: vsp1: Fix crash when resetting pipeline
  v4l: vsp1: pipe: Fix typo in comment
  v4l: vsp1: Constify operation structures
  v4l: vsp1: Stop the pipeline upon the first STREAMOFF
  v4l: vsp1: sru: Fix intensity control ID
  media: Add video processing entity functions
  media: Add video statistics computation functions
  v4l: vsp1: Base link creation on availability of entities
  v4l: vsp1: Don't register media device when userspace API is disabled
  v4l: vsp1: Don't create LIF entity when the userspace API is enabled
  v4l: vsp1: Set entities functions
  v4l: vsp1: dl: Don't free fragments with interrupts disabled
  v4l: vsp1: lut: Initialize the mutex
  v4l: vsp1: lut: Expose configuration through a control
  v4l: vsp1: Add Cubic Look Up Table (CLU) support
  v4l: vsp1: Support runtime modification of controls
  v4l: vsp1: lut: Support runtime modification of controls
  v4l: vsp1: clu: Support runtime modification of controls
  v4l: vsp1: Simplify alpha propagation
  v4l: vsp1: rwpf: Support runtime modification of controls
  v4l: vsp1: wpf: Add flipping support

 Documentation/DocBook/media/v4l/media-types.xml |  64 +++
 drivers/media/platform/vsp1/Makefile|   3 +-
 drivers/media/platform/vsp1/vsp1.h  |   5 +
 drivers/media/platform/vsp1/vsp1_bru.c  |  12 +-
 drivers/media/platform/vsp1/vsp1_clu.c  | 292 +++
 drivers/media/platform/vsp1/vsp1_clu.h  |  48 ++
 drivers/media/platform/vsp1/vsp1_dl.c   |  72 ++--
 drivers/media/platform/vsp1/vsp1_drm.c  |   6 +-
 drivers/media/platform/vsp1/vsp1_drv.c  |  69 +---
 drivers/media/platform/vsp1/vsp1_entity.c   |   4 +-
 drivers/media/platform/vsp1/vsp1_entity.h   |   5 +-
 drivers/media/platform/vsp1/vsp1_hsit.c |  14 +-
 drivers/media/platform/vsp1/vsp1_lif.c  |  16 +-
 drivers/media/platform/vsp1/vsp1_lut.c  | 101 +++
 drivers/media/platform/vsp1/vsp1_lut.h  |   7 +-
 drivers/media/platform/vsp1/vsp1_pipe.c |  54 ++
 drivers/media/platform/vsp1/vsp1_pipe.h |   6 +-
 drivers/media/platform/vsp1/vsp1_regs.h |  24 ++-
 drivers/media/platform/vsp1/vsp1_rpf.c  |  31 ++--
 drivers/media/platform/vsp1/vsp1_rwpf.c |   6 +-
 drivers/media/platform/vsp1/vsp1_rwpf.h |  14 +-
 drivers/media/platform/vsp1/vsp1_sru.c  |  14 +-
 drivers/media/platform/vsp1/vsp1_uds.c  |  16 +-
 drivers/media/platform/vsp1/vsp1_uds.h  |   2 +-
 drivers/media/platform/vsp1/vsp1_video.c|  14 +-
 drivers/media/platform/vsp1/vsp1_wpf.c  | 161 --
 include/uapi/linux/media.h  |  10 ++
 include/uapi/linux/vsp1.h   |  34 
 28 files changed, 891 insertions(+), 213 deletions(-)
 create mode 100644 drivers/media/platform/vsp1/vsp1_clu.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_clu.h
 delete mode 100644 include/uapi/linux/vsp1.h

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [v2] media: rc: fix Meson IR decoder

2016-06-27 Thread Neil Armstrong
On 06/27/2016 12:53 PM, Martin Blumenstingl wrote:
> On Mon, Jun 27, 2016 at 8:27 AM, Neil Armstrong  
> wrote:
>> I'm quite sure the registers are good for meson6 actually, and
>> it seems reasonable Amlogic made the HW evolve for the Meson8 and GXBB 
>> platforms.
> OK, then from now on I will NOT assume anymore that the reference code
> also works on Meson6 platforms. Thanks for clarifying this.

Yes it's quite safer to assume this !

>> Since we are using devicetree, the correct way to achieve this fix is not
>> to drop support for meson6 (what you do) but add a logic to select the 
>> correct
>> register for meson8 and gxbb if their compatible string are encountered.
>
>> I made this fix already but lacked time to actually test it on HW :
>> https://github.com/torvalds/linux/compare/master...superna:amlogic/v4.7/ir
>>
>> My patch is missing the meson8b support, and may need a supplementary 
>> compatible check or
>> a separate dt match table.
> I can test it on GXBB (only, I do not have Meson8b hardware, but
> according to the datasheet the registers are the same).
> If you want I can start based on your patch series. Should we add only
> a binding for amlogic,meson8b and re-use that in meson-gxbb.dtsi or
> should we add both (8b and gxbb) bindings instead?

Yes, no problem !
Add the two bindings, it's a better practice and we can track more easily which
hardware is really supported from the driver point of view.

>> PS: BTW could you format the cover letter using the git format-patch 
>> --cover-letter instead and
>> add the v2 using the -subject-prefix like :
>> # git format-patch --cover-letter --signoff --subject-prefix "PATCH v2" -2
> sounds like this is what other devs are using as well - thanks for
> letting me know
>

Neil

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/9] Output raw touch data via V4L2

2016-06-27 Thread Nick Dyer
On 27/06/2016 13:22, Hans Verkuil wrote:
> On 06/27/2016 01:57 PM, Nick Dyer wrote:
> 2) Alternatively, if we want to keep using BUF_TYPE_VIDEO_CAPTURE, then:
> 
> - we keep V4L2_CAP_TOUCH which is combined with CAP_VIDEO_CAPTURE (and perhaps
>   VIDEO_OUTPUT in the future). The CAP_TOUCH just says that this is a touch
>   device, not a video device, but otherwise it acts the same.
> 
> I'd go with 2, since I see no reason to add a new BUF_TYPE for this.
> It acts exactly like video after all, with only a few restrictions (i.e. no
> colorspace info or interlaced). And adding a new BUF_TYPE will likely break
> the existing sur40 app.

OK, I will rework with this approach.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v4.8] V4L2 core fixes

2016-06-27 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 0db5c79989de2c68d5abb7ba891bfdb3cd3b7e05:

  [media] media-devnode.h: Fix documentation (2016-06-16 08:14:56 -0300)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git v4l2/core

for you to fetch changes up to 7dccb13aef849b9e9e02faa3c46269bb130297d3:

  videodev2.h: Fix V4L2_PIX_FMT_YUV411P description (2016-06-27 15:32:54 
+0300)


Laurent Pinchart (2):
  videodev2.h: Group YUV 3 planes formats together
  videodev2.h: Fix V4L2_PIX_FMT_YUV411P description

 include/uapi/linux/videodev2.h | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v4.8] Various fixes

2016-06-27 Thread Hans Verkuil
Note for Ulrich's patches: these are prerequisites for two other patch
series (one from Ulrich for HDMI support and one from Niklas for Gen3
support). It doesn't hurt to add these now, and it will simplify future
development.

Regards,

Hans

The following changes since commit 0db5c79989de2c68d5abb7ba891bfdb3cd3b7e05:

  [media] media-devnode.h: Fix documentation (2016-06-16 08:14:56 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.8c

for you to fetch changes up to ad124b474f36aa0581ca46a5f609e7d8c7e0a5a6:

  media: rcar-vin: add DV timings support (2016-06-27 11:34:52 +0200)


Alexey Khoroshilov (1):
  radio-maxiradio: fix memory leak when device is removed

Hans Verkuil (1):
  v4l2-ctrl.h: fix comments

Helen Fornazier (1):
  stk1160: Check *nplanes in queue_setup

Ismael Luceno (1):
  solo6x10: Simplify solo_enum_ext_input

Ulrich Hecht (3):
  media: rcar_vin: Use correct pad number in try_fmt
  media: rcar-vin: pad-aware driver initialisation
  media: rcar-vin: add DV timings support

 drivers/media/pci/solo6x10/solo6x10-v4l2.c  |  34 -
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 112 
++--
 drivers/media/platform/rcar-vin/rcar-vin.h  |   2 +
 drivers/media/radio/radio-maxiradio.c   |   1 +
 drivers/media/usb/stk1160/stk1160-v4l.c |   3 ++
 include/media/v4l2-ctrls.h  |  24 ++--
 6 files changed, 143 insertions(+), 33 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v4.8] Sensors and decoders fixes

2016-06-27 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 0db5c79989de2c68d5abb7ba891bfdb3cd3b7e05:

  [media] media-devnode.h: Fix documentation (2016-06-16 08:14:56 -0300)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git sensors/next

for you to fetch changes up to 84052e33262dd7940408e179c68bbf70e93cacb1:

  adv7604: Don't ignore pad number in subdev DV timings pad operations 
(2016-06-27 15:27:53 +0300)


Axel Lin (1):
  v4l: mt9v032: Remove duplicate test for I2C_FUNC_SMBUS_WORD_DATA 
functionality

Guennadi Liakhovetski (1):
  v4l: mt9t001: fix clean up in case of power-on failures

Julia Lawall (1):
  v4l: mt9t001: constify v4l2_subdev_internal_ops structure

Laurent Pinchart (2):
  v4l: mt9v032: Remove unneeded header
  adv7604: Don't ignore pad number in subdev DV timings pad operations

Markus Pargmann (2):
  v4l: mt9v032: Do not unset master_mode
  v4l: mt9v032: Add V4L2 controls for AEC and AGC

Sakari Ailus (1):
  smiapp: Remove useless rval assignment in smiapp_get_pdata()

 drivers/media/i2c/adv7604.c|  46 +--
 drivers/media/i2c/mt9t001.c|  17 ++-
 drivers/media/i2c/mt9v032.c| 279 
 drivers/media/i2c/smiapp/smiapp-core.c |   4 +-
 4 files changed, 260 insertions(+), 86 deletions(-)

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/24] v4l: Add metadata buffer type and format

2016-06-27 Thread Guennadi Liakhovetski
Hi Laurent,

Just one question to this patch:

On Mon, 20 Jun 2016, Laurent Pinchart wrote:

> The metadata buffer type is used to transfer metadata between userspace
> and kernelspace through a V4L2 buffers queue. It comes with a new
> metadata capture capability and format description.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  Documentation/DocBook/media/v4l/dev-meta.xml  | 93 
> +++
>  Documentation/DocBook/media/v4l/v4l2.xml  |  1 +
>  drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 19 ++
>  drivers/media/v4l2-core/v4l2-dev.c| 16 +++--
>  drivers/media/v4l2-core/v4l2-ioctl.c  | 34 ++
>  drivers/media/v4l2-core/videobuf2-v4l2.c  |  3 +
>  include/media/v4l2-ioctl.h|  8 +++
>  include/uapi/linux/videodev2.h| 14 
>  8 files changed, 182 insertions(+), 6 deletions(-)
>  create mode 100644 Documentation/DocBook/media/v4l/dev-meta.xml
> 
> diff --git a/Documentation/DocBook/media/v4l/dev-meta.xml 
> b/Documentation/DocBook/media/v4l/dev-meta.xml
> new file mode 100644
> index ..9b5b1fba2007
> --- /dev/null
> +++ b/Documentation/DocBook/media/v4l/dev-meta.xml
> @@ -0,0 +1,93 @@
> +  Metadata Interface
> +
> +  
> +Experimental
> +This is an  experimental 
> +interface and may change in the future.
> +  
> +
> +  
> +Metadata refers to any non-image data that supplements video frames with
> +additional information. This may include statistics computed over the image
> +or frame capture parameters supplied by the image source. This interface is
> +intended for transfer of metadata to userspace and control of that operation.
> +  
> +
> +  
> +The metadata interface is implemented on video capture devices. The device 
> can
> +be dedicated to metadata or can implement both video and metadata capture as
> +specified in its reported capabilities.
> +  
> +
> +  
> +Querying Capabilities
> +
> +
> +Devices supporting the metadata interface set the
> +V4L2_CAP_META_CAPTURE flag in the
> +capabilities field of 
> +returned by the  ioctl. That flag means the device can 
> capture
> +metadata to memory.
> +
> +
> +At least one of the read/write or streaming I/O methods must be supported.
> +
> +  
> +
> +  
> +Data Format Negotiation
> +
> +
> +The metadata device uses the format ioctls to
> +select the capture format. The metadata buffer content format is bound to 
> that
> +selectable format. In addition to the basic
> +format ioctls, the  ioctl
> +must be supported as well.

Why does ENUM_FMT have to be supported? As far as I understand, you 
haven't implemented it for VSP1, I followed that example and haven't 
implemented it for UVC either.

Thanks
Guennadi
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/9] Output raw touch data via V4L2

2016-06-27 Thread Hans Verkuil
On 06/27/2016 01:57 PM, Nick Dyer wrote:
> Hi Hans-
> 
> Thanks for reviewing this again in such detail.
> 
> On 27/06/2016 12:26, Hans Verkuil wrote:
>> On 06/23/2016 12:08 AM, Nick Dyer wrote:
>>> This is a series of patches to add output of raw touch diagnostic data via 
>>> V4L2
>>> to the Atmel maXTouch and Synaptics RMI4 drivers.
>>>
>>> It's a rewrite of the previous implementation which output via debugfs: it 
>>> now
>>> uses a V4L2 device in a similar way to the sur40 driver.
>>>
>>> We have a utility which can read the data and display it in a useful format:
>>> https://github.com/ndyer/heatmap/commits/heatmap-v4l
>>>
>>> These patches are also available from
>>> https://github.com/ndyer/linux/commits/v4l-touch-2016-06-22
>>>
>>> Changes in v5 (Hans Verkuil review):
>>> - Update v4l2-core:
>>>   - Add VFL_TYPE_TOUCH, V4L2_BUF_TYPE_TOUCH_CAPTURE and V4L2_CAP_TOUCH
>>
>> The use of V4L2_CAP_TOUCH and V4L2_BUF_TYPE_TOUCH_CAPTURE is very 
>> inconsistent.
>> What is the rationale of adding V4L2_BUF_TYPE_TOUCH_CAPTURE? I can't remember
>> asking for it.
> 
> I am afraid that I missed updating atmel_mxt_ts from
> V4L2_BUF_TYPE_VIDEO_CAPTURE to V4L2_BUF_TYPE_TOUCH_CAPTURE, which has
> confused the situation.
> 
> Perhaps I read too much into your request that I look at the way that SDR
> is treated. When I started going through the code paths in v4l2-core and
> v4l2-compliance, it seemed cleaner to treat touch as completely separate,
> hence introducing the new BUF_TYPE. I'm happy to try it without this.

Yeah, I didn't mean that you had to add a new BUF_TYPE. My remark was related to
ensuring that all occurrences in the spec where they talk about the various
/dev/video/radio/etc. devices are extended with v4l-touch as well.

> 
>> And wouldn't the use of V4L2_BUF_TYPE_TOUCH_CAPTURE break userspace for 
>> sur40?
> 
> I think it is likely, yes. And it looks like that would make Florian unhappy.
> 
>> I'm ambiguous towards having a V4L2_BUF_TYPE_TOUCH_CAPTURE, to be honest.
>>
>> I would also recommend renaming V4L2_CAP_TOUCH to V4L2_CAP_TOUCH_CAPTURE.
> 
> Do you agree with the following changes:
> 
> - Rename V4L2_CAP_TOUCH to V4L2_CAP_TOUCH_CAPTURE.
> 
> - Touch devices should register both V4L2_CAP_VIDEO_CAPTURE and
> V4L2_CAP_TOUCH_CAPTURE.
> 
> - Get rid of V4L2_BUF_TYPE_TOUCH_CAPTURE and use
> V4L2_BUF_TYPE_VIDEO_CAPTURE. In v4l2-ioctl.c if we need to force particular
> pix formats for touch, it will need to look at V4L2_CAP_TOUCH_CAPTURE.

Actually, I think we have two choices, depending on whether we use a
BUF_TYPE_TOUCH_CAPTURE or not.

1) If we go with a BUF_TYPE_TOUCH_CAPTURE, then:

- we need a V4L2_CAP_TOUCH_CAPTURE
- no V4L2_CAP_VIDEO_CAPTURE will be set (since that would indicate support for
  BUF_TYPE_VIDEO_CAPTURE, which we don't have anymore).
- new callbacks for g/s/try/enum_fmt_tch_cap should be added to v4l2-ioctl.h.

2) Alternatively, if we want to keep using BUF_TYPE_VIDEO_CAPTURE, then:

- we keep V4L2_CAP_TOUCH which is combined with CAP_VIDEO_CAPTURE (and perhaps
  VIDEO_OUTPUT in the future). The CAP_TOUCH just says that this is a touch
  device, not a video device, but otherwise it acts the same.

I'd go with 2, since I see no reason to add a new BUF_TYPE for this.
It acts exactly like video after all, with only a few restrictions (i.e. no
colorspace info or interlaced). And adding a new BUF_TYPE will likely break
the existing sur40 app.

> 
> Your other review comments look straightforward to address - thanks.
> 
> I should say, you can see my current changes to v4l2-compliance here:
> https://github.com/ndyer/v4l-utils/commit/07e00c33
> 
> Should I post them along with the kernel patches next time?

Yes, please.

Regards,

Hans

> 
>>
>> I can imagine an embedded usb gadget device that outputs touch data to a PC.
>>
>> Regards,
>>
>>  Hans
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 19/19] bdisp: move the V/H filter spec to bdisp-hw.c

2016-06-27 Thread Fabien DESSENNE


On 06/24/2016 05:32 PM, Mauro Carvalho Chehab wrote:
> Those structs are used only at bdisp-hw, so they shouldn't be
> there in a header file that it is used elsewhere.
>
> This fixes the following Gcc 6.1 warnings:
>
> In file included from drivers/media/platform/sti/bdisp/bdisp-debug.c:11:0:
> drivers/media/platform/sti/bdisp/bdisp-filter.h:207:65: warning: 
> ‘bdisp_v_spec’ defined but not used [-Wunused-const-variable=]
>   static const struct __maybe_unused bdisp_filter_v_spec bdisp_v_spec[] = {
>   ^
> In file included from drivers/media/platform/sti/bdisp/bdisp-debug.c:11:0:
> drivers/media/platform/sti/bdisp/bdisp-filter.h:23:65: warning: 
> ‘bdisp_h_spec’ defined but not used [-Wunused-const-variable=]
>   static const struct __maybe_unused bdisp_filter_h_spec bdisp_h_spec[] = {
>   ^
>
> Signed-off-by: Mauro Carvalho Chehab 

Acked-by: Fabien Dessenne 

> ---
>   drivers/media/platform/sti/bdisp/bdisp-filter.h | 304 
> ---
>   drivers/media/platform/sti/bdisp/bdisp-hw.c | 305 
> 
>   2 files changed, 305 insertions(+), 304 deletions(-)
>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-filter.h 
> b/drivers/media/platform/sti/bdisp/bdisp-filter.h
> index fc8c54f725ad..53e52fb4127f 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-filter.h
> +++ b/drivers/media/platform/sti/bdisp/bdisp-filter.h
> @@ -19,178 +19,6 @@ struct bdisp_filter_h_spec {
>  const u16 max;
>  const u8 coef[BDISP_HF_NB];
>   };
> -
> -static const struct bdisp_filter_h_spec bdisp_h_spec[] = {
> -   {
> -   .min = 0,
> -   .max = 921,
> -   .coef = {
> -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
> -   0x00, 0x00, 0xff, 0x07, 0x3d, 0xfc, 0x01, 0x00,
> -   0x00, 0x01, 0xfd, 0x11, 0x36, 0xf9, 0x02, 0x00,
> -   0x00, 0x01, 0xfb, 0x1b, 0x2e, 0xf9, 0x02, 0x00,
> -   0x00, 0x01, 0xf9, 0x26, 0x26, 0xf9, 0x01, 0x00,
> -   0x00, 0x02, 0xf9, 0x30, 0x19, 0xfb, 0x01, 0x00,
> -   0x00, 0x02, 0xf9, 0x39, 0x0e, 0xfd, 0x01, 0x00,
> -   0x00, 0x01, 0xfc, 0x3e, 0x06, 0xff, 0x00, 0x00
> -   }
> -   },
> -   {
> -   .min = 921,
> -   .max = 1024,
> -   .coef = {
> -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
> -   0xff, 0x03, 0xfd, 0x08, 0x3e, 0xf9, 0x04, 0xfe,
> -   0xfd, 0x06, 0xf8, 0x13, 0x3b, 0xf4, 0x07, 0xfc,
> -   0xfb, 0x08, 0xf5, 0x1f, 0x34, 0xf1, 0x09, 0xfb,
> -   0xfb, 0x09, 0xf2, 0x2b, 0x2a, 0xf1, 0x09, 0xfb,
> -   0xfb, 0x09, 0xf2, 0x35, 0x1e, 0xf4, 0x08, 0xfb,
> -   0xfc, 0x07, 0xf5, 0x3c, 0x12, 0xf7, 0x06, 0xfd,
> -   0xfe, 0x04, 0xfa, 0x3f, 0x07, 0xfc, 0x03, 0xff
> -   }
> -   },
> -   {
> -   .min = 1024,
> -   .max = 1126,
> -   .coef = {
> -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
> -   0xff, 0x03, 0xfd, 0x08, 0x3e, 0xf9, 0x04, 0xfe,
> -   0xfd, 0x06, 0xf8, 0x13, 0x3b, 0xf4, 0x07, 0xfc,
> -   0xfb, 0x08, 0xf5, 0x1f, 0x34, 0xf1, 0x09, 0xfb,
> -   0xfb, 0x09, 0xf2, 0x2b, 0x2a, 0xf1, 0x09, 0xfb,
> -   0xfb, 0x09, 0xf2, 0x35, 0x1e, 0xf4, 0x08, 0xfb,
> -   0xfc, 0x07, 0xf5, 0x3c, 0x12, 0xf7, 0x06, 0xfd,
> -   0xfe, 0x04, 0xfa, 0x3f, 0x07, 0xfc, 0x03, 0xff
> -   }
> -   },
> -   {
> -   .min = 1126,
> -   .max = 1228,
> -   .coef = {
> -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
> -   0xff, 0x03, 0xfd, 0x08, 0x3e, 0xf9, 0x04, 0xfe,
> -   0xfd, 0x06, 0xf8, 0x13, 0x3b, 0xf4, 0x07, 0xfc,
> -   0xfb, 0x08, 0xf5, 0x1f, 0x34, 0xf1, 0x09, 0xfb,
> -   0xfb, 0x09, 0xf2, 0x2b, 0x2a, 0xf1, 0x09, 0xfb,
> -   0xfb, 0x09, 0xf2, 0x35, 0x1e, 0xf4, 0x08, 0xfb,
> -   0xfc, 0x07, 0xf5, 0x3c, 0x12, 0xf7, 0x06, 0xfd,
> -   0xfe, 0x04, 0xfa, 0x3f, 0x07, 0xfc, 0x03, 0xff
> -   }
> -   },
> -   {
> -   .min = 1228,
> -   .max = 1331,
> -   .coef = {
> -   0xfd, 0x04, 0xfc, 0x05, 0x39, 0x05, 0xfc, 0x04,
> -   0xfc, 0x06, 0xf9, 0x0c, 0x39, 0xfe, 0x00, 0x02,
> -   0xfb, 0x08, 0xf6, 0x17, 0x35, 0xf9, 0x02, 0x00,
> -  

Re: [PATCH v5 0/9] Output raw touch data via V4L2

2016-06-27 Thread Nick Dyer
Hi Hans-

Thanks for reviewing this again in such detail.

On 27/06/2016 12:26, Hans Verkuil wrote:
> On 06/23/2016 12:08 AM, Nick Dyer wrote:
>> This is a series of patches to add output of raw touch diagnostic data via 
>> V4L2
>> to the Atmel maXTouch and Synaptics RMI4 drivers.
>>
>> It's a rewrite of the previous implementation which output via debugfs: it 
>> now
>> uses a V4L2 device in a similar way to the sur40 driver.
>>
>> We have a utility which can read the data and display it in a useful format:
>> https://github.com/ndyer/heatmap/commits/heatmap-v4l
>>
>> These patches are also available from
>> https://github.com/ndyer/linux/commits/v4l-touch-2016-06-22
>>
>> Changes in v5 (Hans Verkuil review):
>> - Update v4l2-core:
>>   - Add VFL_TYPE_TOUCH, V4L2_BUF_TYPE_TOUCH_CAPTURE and V4L2_CAP_TOUCH
> 
> The use of V4L2_CAP_TOUCH and V4L2_BUF_TYPE_TOUCH_CAPTURE is very 
> inconsistent.
> What is the rationale of adding V4L2_BUF_TYPE_TOUCH_CAPTURE? I can't remember
> asking for it.

I am afraid that I missed updating atmel_mxt_ts from
V4L2_BUF_TYPE_VIDEO_CAPTURE to V4L2_BUF_TYPE_TOUCH_CAPTURE, which has
confused the situation.

Perhaps I read too much into your request that I look at the way that SDR
is treated. When I started going through the code paths in v4l2-core and
v4l2-compliance, it seemed cleaner to treat touch as completely separate,
hence introducing the new BUF_TYPE. I'm happy to try it without this.

> And wouldn't the use of V4L2_BUF_TYPE_TOUCH_CAPTURE break userspace for sur40?

I think it is likely, yes. And it looks like that would make Florian unhappy.

> I'm ambiguous towards having a V4L2_BUF_TYPE_TOUCH_CAPTURE, to be honest.
> 
> I would also recommend renaming V4L2_CAP_TOUCH to V4L2_CAP_TOUCH_CAPTURE.

Do you agree with the following changes:

- Rename V4L2_CAP_TOUCH to V4L2_CAP_TOUCH_CAPTURE.

- Touch devices should register both V4L2_CAP_VIDEO_CAPTURE and
V4L2_CAP_TOUCH_CAPTURE.

- Get rid of V4L2_BUF_TYPE_TOUCH_CAPTURE and use
V4L2_BUF_TYPE_VIDEO_CAPTURE. In v4l2-ioctl.c if we need to force particular
pix formats for touch, it will need to look at V4L2_CAP_TOUCH_CAPTURE.

Your other review comments look straightforward to address - thanks.

I should say, you can see my current changes to v4l2-compliance here:
https://github.com/ndyer/v4l-utils/commit/07e00c33

Should I post them along with the kernel patches next time?

> 
> I can imagine an embedded usb gadget device that outputs touch data to a PC.
> 
> Regards,
> 
>   Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/9] Output raw touch data via V4L2

2016-06-27 Thread Hans Verkuil
On 06/23/2016 12:08 AM, Nick Dyer wrote:
> This is a series of patches to add output of raw touch diagnostic data via 
> V4L2
> to the Atmel maXTouch and Synaptics RMI4 drivers.
> 
> It's a rewrite of the previous implementation which output via debugfs: it now
> uses a V4L2 device in a similar way to the sur40 driver.
> 
> We have a utility which can read the data and display it in a useful format:
> https://github.com/ndyer/heatmap/commits/heatmap-v4l
> 
> These patches are also available from
> https://github.com/ndyer/linux/commits/v4l-touch-2016-06-22
> 
> Changes in v5 (Hans Verkuil review):
> - Update v4l2-core:
>   - Add VFL_TYPE_TOUCH, V4L2_BUF_TYPE_TOUCH_CAPTURE and V4L2_CAP_TOUCH

The use of V4L2_CAP_TOUCH and V4L2_BUF_TYPE_TOUCH_CAPTURE is very inconsistent.
What is the rationale of adding V4L2_BUF_TYPE_TOUCH_CAPTURE? I can't remember
asking for it.

And wouldn't the use of V4L2_BUF_TYPE_TOUCH_CAPTURE break userspace for sur40?

I'm ambiguous towards having a V4L2_BUF_TYPE_TOUCH_CAPTURE, to be honest.

I would also recommend renaming V4L2_CAP_TOUCH to V4L2_CAP_TOUCH_CAPTURE.

I can imagine an embedded usb gadget device that outputs touch data to a PC.

Regards,

Hans

>   - Change V4L2_INPUT_TYPE_TOUCH_SENSOR to V4L2_INPUT_TYPE_TOUCH
>   - Improve DocBook documentation
>   - Add FMT definitions for touch data
>   - Note this will need the latest version of the heatmap util
> - Synaptics RMI4 driver:
>   - Remove some less important non full frame report types
>   - Switch report type names to const char * array
>   - Move a static array to inside context struct
> - Split sur40 changes to a separate commit
> 
> Changes in v4:
> - Address nits from the input side in atmel_mxt_ts patches (Dmitry Torokhov)
> - Add Synaptics RMI4 F54 support patch
> 
> Changes in v3:
> - Address V4L2 review comments from Hans Verkuil
> - Run v4l-compliance and fix all issues - needs minor patch here:
>   https://github.com/ndyer/v4l-utils/commit/cf50469773f
> 
> Changes in v2:
> - Split pixfmt changes into separate commit and add DocBook
> - Introduce VFL_TYPE_TOUCH_SENSOR and /dev/v4l-touch
> - Remove "single node" support for now, it may be better to treat it as
>   metadata later
> - Explicitly set VFL_DIR_RX
> - Fix Kconfig
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 8/9] Input: synaptics-rmi4 - add support for F54 diagnostics

2016-06-27 Thread Hans Verkuil
On 06/23/2016 12:08 AM, Nick Dyer wrote:
> Function 54 implements access to various RMI4 diagnostic features.
> 
> This patch adds support for retrieving this data. It registers a V4L2
> device to output the data to user space.
> 
> Signed-off-by: Nick Dyer 
> ---
>  drivers/input/rmi4/Kconfig  |  11 +
>  drivers/input/rmi4/Makefile |   1 +
>  drivers/input/rmi4/rmi_bus.c|   3 +
>  drivers/input/rmi4/rmi_driver.h |   1 +
>  drivers/input/rmi4/rmi_f54.c| 730 
> 
>  5 files changed, 746 insertions(+)
>  create mode 100644 drivers/input/rmi4/rmi_f54.c
> 
> diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig
> index f73df24..f3418b6 100644
> --- a/drivers/input/rmi4/Kconfig
> +++ b/drivers/input/rmi4/Kconfig
> @@ -61,3 +61,14 @@ config RMI4_F30
>  
> Function 30 provides GPIO and LED support for RMI4 devices. This
> includes support for buttons on TouchPads and ClickPads.
> +
> +config RMI4_F54
> + bool "RMI4 Function 54 (Analog diagnostics)"
> + depends on RMI4_CORE
> + depends on VIDEO_V4L2
> + select VIDEOBUF2_VMALLOC
> + help
> +   Say Y here if you want to add support for RMI4 function 54
> +
> +   Function 54 provides access to various diagnostic features in certain
> +   RMI4 touch sensors.
> diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile
> index 95c00a7..0bafc85 100644
> --- a/drivers/input/rmi4/Makefile
> +++ b/drivers/input/rmi4/Makefile
> @@ -7,6 +7,7 @@ rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o
>  rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o
>  rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o
>  rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o
> +rmi_core-$(CONFIG_RMI4_F54) += rmi_f54.o
>  
>  # Transports
>  obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o
> diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
> index b368b05..3aedc65 100644
> --- a/drivers/input/rmi4/rmi_bus.c
> +++ b/drivers/input/rmi4/rmi_bus.c
> @@ -315,6 +315,9 @@ static struct rmi_function_handler *fn_handlers[] = {
>  #ifdef CONFIG_RMI4_F30
>   _f30_handler,
>  #endif
> +#ifdef CONFIG_RMI4_F54
> + _f54_handler,
> +#endif
>  };
>  
>  static void __rmi_unregister_function_handlers(int start_idx)
> diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
> index 6e140fa..8dfbebe 100644
> --- a/drivers/input/rmi4/rmi_driver.h
> +++ b/drivers/input/rmi4/rmi_driver.h
> @@ -102,4 +102,5 @@ extern struct rmi_function_handler rmi_f01_handler;
>  extern struct rmi_function_handler rmi_f11_handler;
>  extern struct rmi_function_handler rmi_f12_handler;
>  extern struct rmi_function_handler rmi_f30_handler;
> +extern struct rmi_function_handler rmi_f54_handler;
>  #endif
> diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
> new file mode 100644
> index 000..df4c821
> --- /dev/null
> +++ b/drivers/input/rmi4/rmi_f54.c
> @@ -0,0 +1,730 @@
> +/*
> + * Copyright (c) 2012-2015 Synaptics Incorporated
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published 
> by
> + * the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "rmi_driver.h"
> +
> +#define F54_NAME "rmi4_f54"
> +
> +/* F54 data offsets */
> +#define F54_REPORT_DATA_OFFSET  3
> +#define F54_FIFO_OFFSET 1
> +#define F54_NUM_TX_OFFSET   1
> +#define F54_NUM_RX_OFFSET   0
> +
> +/* F54 commands */
> +#define F54_GET_REPORT  1
> +#define F54_FORCE_CAL   2
> +
> +/* Fixed sizes of reports */
> +#define F54_QUERY_LEN27
> +
> +/* F54 capabilities */
> +#define F54_CAP_BASELINE (1 << 2)
> +#define F54_CAP_IMAGE8   (1 << 3)
> +#define F54_CAP_IMAGE16  (1 << 6)
> +
> +enum rmi_f54_report_type {
> + F54_REPORT_NONE = 0,
> + F54_8BIT_IMAGE = 1,
> + F54_16BIT_IMAGE = 2,
> + F54_RAW_16BIT_IMAGE = 3,
> + F54_TRUE_BASELINE = 9,
> + F54_FULL_RAW_CAP = 19,
> + F54_FULL_RAW_CAP_RX_COUPLING_COMP = 20,
> + F54_MAX_REPORT_TYPE,
> +};
> +
> +const char *rmi_f54_report_type_names[] = {
> + [F54_REPORT_NONE]   = "No report",
> + [F54_8BIT_IMAGE]= "8 bit image",
> + [F54_16BIT_IMAGE]   = "16 bit image",
> + [F54_RAW_16BIT_IMAGE]   = "Raw 16 bit image",
> + [F54_TRUE_BASELINE] = "True baseline",
> + [F54_FULL_RAW_CAP]  = "Full raw cap",
> + [F54_FULL_RAW_CAP_RX_COUPLING_COMP]
> + = "Full raw cap RX coupling comp",
> + [F54_MAX_REPORT_TYPE]   = "Max report type",

Since it is used in enum_input this should follow the same rules as
used for titles in english, so "Full Raw Cap" instead of 

Re: [PATCH v5 7/9] Input: atmel_mxt_ts - add support for reference data

2016-06-27 Thread Hans Verkuil
On 06/23/2016 12:08 AM, Nick Dyer wrote:
> There are different datatypes available from a maXTouch chip. Add
> support to retrieve reference data as well.
> 
> Signed-off-by: Nick Dyer 
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 58 
> 
>  1 file changed, 51 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c 
> b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 739d138..f733785 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -135,6 +135,7 @@ struct t9_range {
>  /* MXT_DEBUG_DIAGNOSTIC_T37 */
>  #define MXT_DIAGNOSTIC_PAGEUP0x01
>  #define MXT_DIAGNOSTIC_DELTAS0x10
> +#define MXT_DIAGNOSTIC_REFS  0x11
>  #define MXT_DIAGNOSTIC_SIZE  128
>  
>  #define MXT_FAMILY_1386  160
> @@ -249,6 +250,12 @@ struct mxt_dbg {
>   int input;
>  };
>  
> +enum v4l_dbg_inputs {
> + MXT_V4L_INPUT_DELTAS,
> + MXT_V4L_INPUT_REFS,
> + MXT_V4L_INPUT_MAX,
> +};
> +
>  static const struct v4l2_file_operations mxt_video_fops = {
>   .owner = THIS_MODULE,
>   .open = v4l2_fh_open,
> @@ -2273,6 +2280,7 @@ static void mxt_buffer_queue(struct vb2_buffer *vb)
>   struct mxt_data *data = vb2_get_drv_priv(vb->vb2_queue);
>   u16 *ptr;
>   int ret;
> + u8 mode;
>  
>   ptr = vb2_plane_vaddr(vb, 0);
>   if (!ptr) {
> @@ -2280,7 +2288,18 @@ static void mxt_buffer_queue(struct vb2_buffer *vb)
>   goto fault;
>   }
>  
> - ret = mxt_read_diagnostic_debug(data, MXT_DIAGNOSTIC_DELTAS, ptr);
> + switch (data->dbg.input) {
> + case MXT_V4L_INPUT_DELTAS:
> + default:
> + mode = MXT_DIAGNOSTIC_DELTAS;
> + break;
> +
> + case MXT_V4L_INPUT_REFS:
> + mode = MXT_DIAGNOSTIC_REFS;
> + break;
> + }
> +
> + ret = mxt_read_diagnostic_debug(data, mode, ptr);
>   if (ret)
>   goto fault;
>  
> @@ -2325,11 +2344,20 @@ static int mxt_vidioc_querycap(struct file *file, 
> void *priv,
>  static int mxt_vidioc_enum_input(struct file *file, void *priv,
>  struct v4l2_input *i)
>  {
> - if (i->index > 0)
> + if (i->index >= MXT_V4L_INPUT_MAX)
>   return -EINVAL;
>  
>   i->type = V4L2_INPUT_TYPE_TOUCH;
> - strlcpy(i->name, "Mutual References", sizeof(i->name));
> +
> + switch (i->index) {
> + case MXT_V4L_INPUT_REFS:
> + strlcpy(i->name, "Mutual References", sizeof(i->name));
> + break;
> + case MXT_V4L_INPUT_DELTAS:
> + strlcpy(i->name, "Mutual Deltas", sizeof(i->name));

Same here: Mutual Capacitance Deltas

> + break;
> + }
> +
>   return 0;
>  }
>  
> @@ -2337,12 +2365,16 @@ static int mxt_set_input(struct mxt_data *data, 
> unsigned int i)
>  {
>   struct v4l2_pix_format *f = >dbg.format;
>  
> - if (i > 0)
> + if (i >= MXT_V4L_INPUT_MAX)
>   return -EINVAL;
>  
> + if (i == MXT_V4L_INPUT_DELTAS)
> + f->pixelformat = V4L2_TCH_FMT_DELTA_TD16;
> + else
> + f->pixelformat = V4L2_TCH_FMT_TU16;
> +
>   f->width = data->xy_switch ? data->ysize : data->xsize;
>   f->height = data->xy_switch ? data->xsize : data->ysize;
> - f->pixelformat = V4L2_TCH_FMT_DELTA_TD16;
>   f->field = V4L2_FIELD_NONE;
>   f->colorspace = V4L2_COLORSPACE_RAW;
>   f->bytesperline = f->width * sizeof(u16);
> @@ -2380,10 +2412,22 @@ static int mxt_vidioc_fmt(struct file *file, void 
> *priv, struct v4l2_format *f)
>  static int mxt_vidioc_enum_fmt(struct file *file, void *priv,
>struct v4l2_fmtdesc *fmt)
>  {
> - if (fmt->index > 0 || fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> + if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> + return -EINVAL;
> +
> + switch (fmt->index) {
> + case 0:
> + fmt->pixelformat = V4L2_TCH_FMT_TU16;
> + break;
> +
> + case 1:
> + fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16;
> + break;
> +
> + default:
>   return -EINVAL;
> + }
>  
> - fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16;
>   return 0;
>  }
>  
> 

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 3/9] Input: atmel_mxt_ts - output diagnostic debug via v4l2 device

2016-06-27 Thread Hans Verkuil
On 06/23/2016 12:08 AM, Nick Dyer wrote:
> Register a video device to output T37 diagnostic data.
> 
> Signed-off-by: Nick Dyer 
> ---
>  drivers/input/touchscreen/Kconfig|   6 +-
>  drivers/input/touchscreen/atmel_mxt_ts.c | 244 
> +++
>  2 files changed, 248 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/Kconfig 
> b/drivers/input/touchscreen/Kconfig
> index da96ecf..7c1c5ec 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -117,9 +117,11 @@ config TOUCHSCREEN_ATMEL_MXT
>  
>  config TOUCHSCREEN_ATMEL_MXT_T37
>   bool "Support T37 Diagnostic Data"
> - depends on TOUCHSCREEN_ATMEL_MXT
> + depends on TOUCHSCREEN_ATMEL_MXT && VIDEO_V4L2
> + select VIDEOBUF2_VMALLOC
>   help
> -   Say Y here if you want support for the T37 Diagnostic Data object.
> +   Say Y here if you want support to output data from the T37
> +   Diagnostic Data object using a V4L device.
>  
>  config TOUCHSCREEN_AUO_PIXCIR
>   tristate "AUO in-cell touchscreen using Pixcir ICs"
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c 
> b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 0048233..7780d38 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -28,6 +28,10 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
>  
>  /* Firmware files */
>  #define MXT_FW_NAME  "maxtouch.fw"
> @@ -224,6 +228,23 @@ struct mxt_dbg {
>   struct t37_debug *t37_buf;
>   unsigned int t37_pages;
>   unsigned int t37_nodes;
> +
> + struct v4l2_device v4l2;
> + struct v4l2_pix_format format;
> + struct video_device vdev;
> + struct vb2_queue queue;
> + struct mutex lock;
> + int input;
> +};
> +
> +static const struct v4l2_file_operations mxt_video_fops = {
> + .owner = THIS_MODULE,
> + .open = v4l2_fh_open,
> + .release = vb2_fop_release,
> + .unlocked_ioctl = video_ioctl2,
> + .read = vb2_fop_read,
> + .mmap = vb2_fop_mmap,
> + .poll = vb2_fop_poll,
>  };
>  
>  /* Each client has this additional data */
> @@ -279,6 +300,11 @@ struct mxt_data {
>   struct completion crc_completion;
>  };
>  
> +struct mxt_vb2_buffer {
> + struct vb2_buffer   vb;
> + struct list_headlist;
> +};
> +
>  static size_t mxt_obj_size(const struct mxt_object *obj)
>  {
>   return obj->size_minus_one + 1;
> @@ -1525,6 +1551,11 @@ static void mxt_free_input_device(struct mxt_data 
> *data)
>  
>  static void mxt_free_object_table(struct mxt_data *data)
>  {
> +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37
> + video_unregister_device(>dbg.vdev);
> + v4l2_device_unregister(>dbg.v4l2);
> +#endif
> +
>   kfree(data->object_table);
>   data->object_table = NULL;
>   kfree(data->msg_buf);
> @@ -2157,10 +2188,191 @@ wait_cmd:
>   return mxt_convert_debug_pages(data, outbuf);
>  }
>  
> +static int mxt_queue_setup(struct vb2_queue *q,
> +unsigned int *nbuffers, unsigned int *nplanes,
> +unsigned int sizes[], void *alloc_ctxs[])
> +{
> + struct mxt_data *data = q->drv_priv;
> + size_t size = data->dbg.t37_nodes * sizeof(u16);
> +
> + if (*nplanes)
> + return sizes[0] < size ? -EINVAL : 0;
> +
> + *nplanes = 1;
> + sizes[0] = size;
> +
> + return 0;
> +}
> +
> +static void mxt_buffer_queue(struct vb2_buffer *vb)
> +{
> + struct mxt_data *data = vb2_get_drv_priv(vb->vb2_queue);
> + u16 *ptr;
> + int ret;
> +
> + ptr = vb2_plane_vaddr(vb, 0);
> + if (!ptr) {
> + dev_err(>client->dev, "Error acquiring frame ptr\n");
> + goto fault;
> + }
> +
> + ret = mxt_read_diagnostic_debug(data, MXT_DIAGNOSTIC_DELTAS, ptr);
> + if (ret)
> + goto fault;
> +
> + vb2_set_plane_payload(vb, 0, data->dbg.t37_nodes * sizeof(u16));
> + vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
> + return;
> +
> +fault:
> + vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
> +}
> +
> +/* V4L2 structures */
> +static const struct vb2_ops mxt_queue_ops = {
> + .queue_setup= mxt_queue_setup,
> + .buf_queue  = mxt_buffer_queue,
> + .wait_prepare   = vb2_ops_wait_prepare,
> + .wait_finish= vb2_ops_wait_finish,
> +};
> +
> +static const struct vb2_queue mxt_queue = {
> + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
> + .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ,
> + .buf_struct_size = sizeof(struct mxt_vb2_buffer),
> + .ops = _queue_ops,
> + .mem_ops = _vmalloc_memops,
> + .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
> + .min_buffers_needed = 1,
> +};
> +
> +static int mxt_vidioc_querycap(struct file *file, void *priv,
> +  struct v4l2_capability *cap)
> +{
> + struct 

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

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

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

Regards,

Hans

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


Re: [PATCH v5 1/9] [media] v4l2-core: Add support for touch devices

2016-06-27 Thread Hans Verkuil
On 06/23/2016 12:08 AM, Nick Dyer wrote:
> Some touch controllers send out touch data in a similar way to a
> greyscale frame grabber.
> 
> Use a new device prefix v4l-touch for these devices, to stop generic
> capture software from treating them as webcams.
> 
> Add formats:
> - V4L2_TCH_FMT_DELTA_TD16 for signed 16-bit touch deltas
> - V4L2_TCH_FMT_DELTA_TD08 for signed 16-bit touch deltas
> - V4L2_TCH_FMT_TU16 for unsigned 16-bit touch data
> - V4L2_TCH_FMT_TU08 for unsigned 8-bit touch data
> 
> This support will be used by:
> * Atmel maXTouch (atmel_mxt_ts)
> * Synaptics RMI4.
> * sur40
> 
> Signed-off-by: Nick Dyer 
> ---
>  Documentation/DocBook/media/v4l/dev-touch.xml  | 53 ++
>  Documentation/DocBook/media/v4l/media-types.xml|  5 ++
>  .../DocBook/media/v4l/pixfmt-tch-td08.xml  | 66 +
>  .../DocBook/media/v4l/pixfmt-tch-td16.xml  | 82 
> ++
>  .../DocBook/media/v4l/pixfmt-tch-tu08.xml  | 66 +
>  .../DocBook/media/v4l/pixfmt-tch-tu16.xml  | 81 +
>  Documentation/DocBook/media/v4l/pixfmt.xml | 13 
>  Documentation/DocBook/media/v4l/v4l2.xml   |  1 +
>  drivers/media/v4l2-core/v4l2-dev.c | 16 -
>  drivers/media/v4l2-core/v4l2-ioctl.c   | 44 
>  drivers/media/v4l2-core/videobuf2-v4l2.c   |  1 +

You forgot drivers/media/v4l2-core/v4l2-compat-ioctl32.c.

For the next version, please place the docbook changes in a separate patch.

>  include/media/v4l2-dev.h   |  3 +-
>  include/uapi/linux/media.h |  2 +
>  include/uapi/linux/videodev2.h | 10 +++
>  14 files changed, 439 insertions(+), 4 deletions(-)
>  create mode 100644 Documentation/DocBook/media/v4l/dev-touch.xml
>  create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml
>  create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-td16.xml
>  create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-tu08.xml
>  create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-tu16.xml
> 
> diff --git a/Documentation/DocBook/media/v4l/dev-touch.xml 
> b/Documentation/DocBook/media/v4l/dev-touch.xml
> new file mode 100644
> index 000..9e36328
> --- /dev/null
> +++ b/Documentation/DocBook/media/v4l/dev-touch.xml
> @@ -0,0 +1,53 @@
> +Touch Devices
> +
> +Touch devices are accessed through character device special files
> +  named /dev/v4l-touch0 to
> +  /dev/v4l-touch255 with major number 81 and
> +  dynamically allocated minor numbers 0 to 255.
> +
> +
> +  Overview
> +
> +  Sensors may be Optical, or Projected Capacitive touch (PCT).
> +
> +  Processing is required to analyse the raw data and produce input
> +events. In some systems, this may be performed on the ASIC and the raw 
> data
> +is purely a side-channel for diagnostics or tuning. In other systems, the
> +ASIC is a simple analogue front end device which delivers touch data at
> +high rate, and any touch processing must be done on the host.
> +
> +  For capacitive touch sensing, the touchscreen is composed of an array
> +of horizontal and vertical conductors (alternatively called rows/columns,
> +X/Y lines, or tx/rx). Mutual Capacitance measured is at the nodes where 
> the
> +conductors cross. Alternatively, Self Capacitance measures the signal 
> from
> +each column and row independently.
> +
> +  A touch input may be determined by comparing the raw capacitance
> +measurement to a no-touch reference (or "baseline") measurement:
> +
> +  Delta = Raw - Reference
> +
> +  The reference measurement takes account of variations in the
> +capacitance across the touch sensor matrix, for example
> +manufacturing irregularities, environmental or edge effects.
> +
> +
> +
> +  Querying Capabilities
> +
> +  Devices supporting the touch interface set the
> +V4L2_CAP_VIDEO_CAPTURE flag in the

And the V4L2_CAP_TOUCH flag, right?

> +capabilities field of 
> +returned by the  ioctl.
> +
> +  At least one of the read/write, streaming or asynchronous I/O methods

Change to:

"At least one of the read/write or streaming I/O methods"

Asynchronous I/O was never implemented. We really need to remove this old stuff
from the spec.

> +must be supported.
> +
> +
> +
> +  Data Format Negotiation
> +
> +   A touch device may support read/write
> +and/or streaming (memory mapping or
> +user pointer) I/O.

dma-buf isn't mentioned here.

> +
> diff --git a/Documentation/DocBook/media/v4l/media-types.xml 
> b/Documentation/DocBook/media/v4l/media-types.xml
> index 5e3f20f..fb957c7 100644
> --- a/Documentation/DocBook/media/v4l/media-types.xml
> +++ b/Documentation/DocBook/media/v4l/media-types.xml
> @@ -202,6 +202,11 @@
>   typically, /dev/swradio?
> 
> 
> + MEDIA_INTF_T_V4L_TOUCH
> + Device node interface 

Re: [PATCH] sur40: drop unnecessary format description

2016-06-27 Thread Nick Dyer
On 27/06/2016 11:25, Hans Verkuil wrote:
> Don't fill in the format description. This is now done in the V4L2 core to 
> ensure
> consistent descriptions.
> 
> Signed-off-by: Hans Verkuil 

Acked-by: Nick Dyer 

> 
> diff --git a/drivers/input/touchscreen/sur40.c 
> b/drivers/input/touchscreen/sur40.c
> index 880c40b..5f1617b 100644
> --- a/drivers/input/touchscreen/sur40.c
> +++ b/drivers/input/touchscreen/sur40.c
> @@ -793,7 +793,6 @@ static int sur40_vidioc_enum_fmt(struct file *file, void 
> *priv,
>  {
>   if (f->index != 0)
>   return -EINVAL;
> - strlcpy(f->description, "8-bit greyscale", sizeof(f->description));
>   f->pixelformat = V4L2_PIX_FMT_GREY;
>   f->flags = 0;
>   return 0;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] sur40: drop unnecessary format description

2016-06-27 Thread Hans Verkuil
Don't fill in the format description. This is now done in the V4L2 core to 
ensure
consistent descriptions.

Signed-off-by: Hans Verkuil 

diff --git a/drivers/input/touchscreen/sur40.c 
b/drivers/input/touchscreen/sur40.c
index 880c40b..5f1617b 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -793,7 +793,6 @@ static int sur40_vidioc_enum_fmt(struct file *file, void 
*priv,
 {
if (f->index != 0)
return -EINVAL;
-   strlcpy(f->description, "8-bit greyscale", sizeof(f->description));
f->pixelformat = V4L2_PIX_FMT_GREY;
f->flags = 0;
return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] videodev2.h: Group YUV 3 planes formats together

2016-06-27 Thread Sakari Ailus
Hi Laurent,

On Thu, Jun 16, 2016 at 02:33:14AM +0300, Laurent Pinchart wrote:
> The formats are interleaved with the YUV packed and miscellaneous
> formats, making the result confusing especially with the YUV444 format
> being packed and not planar like YUV410 or YUV420. Move them to their
> own group as the 2 planes or 3 non-contiguous planes formats to clarify
> the header.
> 
> Signed-off-by: Laurent Pinchart 

For the two:

Acked-by: Sakari Ailus 

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 6/8] media: rcar-vin: initialize EDID data

2016-06-27 Thread Hans Verkuil
Hi Ulrich,

On 05/13/2016 10:36 AM, Hans Verkuil wrote:
> On 05/11/2016 04:02 PM, Ulrich Hecht wrote:
>> Initializes the decoder subdevice with a fixed EDID blob.
>>
>> Signed-off-by: Ulrich Hecht 
> 
> Nacked-by: Hans Verkuil 
> 
> Instead implement the g/s_edid ioctls.
> 
> You truly cannot default to an EDID. When an EDID is set the HPD will go high.
> But you don't know the EDID here, the contents of the EDID is something that
> only userspace will know depending on the type of device you're building.
> 
> In practice userspace will overwrite the EDID with the real one and so the HPD
> will go down and up again. And while transmitters are supposed to handle that
> cleanly, in reality this is a different story.
> 
> Just add the g/s_edid ioctls and you can use 'v4l2-ctl --set-edid=edid=hdmi' 
> to
> fill in a default EDID.
> 
> I won't accept this patch since I know from my own experience that this 
> doesn't
> work.

I haven't seen a follow-up on this. Can you do a v5? It's likely that will be 
the
last version and I can commit this.

Thanks!

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 5/8] media: rcar-vin: add DV timings support

2016-06-27 Thread Hans Verkuil
On 05/11/2016 04:02 PM, Ulrich Hecht wrote:
> Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
> and QUERY_DV_TIMINGS.
> 
> Signed-off-by: Ulrich Hecht 

Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 82 
> +
>  1 file changed, 82 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index 3788f8a..10a5c10 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -400,6 +400,10 @@ static int rvin_enum_input(struct file *file, void *priv,
>  
>   i->type = V4L2_INPUT_TYPE_CAMERA;
>   i->std = vin->vdev.tvnorms;
> +
> + if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
> + i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
> +
>   strlcpy(i->name, "Camera", sizeof(i->name));
>  
>   return 0;
> @@ -478,6 +482,78 @@ static int rvin_subscribe_event(struct v4l2_fh *fh,
>   return v4l2_ctrl_subscribe_event(fh, sub);
>  }
>  
> +static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_enum_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int pad, ret;
> +
> + pad = timings->pad;
> + timings->pad = vin->src_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
> +
> + timings->pad = pad;
> +
> + return ret;
> +}
> +
> +static int rvin_s_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int err;
> +
> + err = v4l2_subdev_call(sd,
> + video, s_dv_timings, timings);
> + if (!err) {
> + vin->source.width = timings->bt.width;
> + vin->source.height = timings->bt.height;
> + vin->format.width = timings->bt.width;
> + vin->format.height = timings->bt.height;
> + }
> + return err;
> +}
> +
> +static int rvin_g_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> +
> + return v4l2_subdev_call(sd,
> + video, g_dv_timings, timings);
> +}
> +
> +static int rvin_query_dv_timings(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings *timings)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> +
> + return v4l2_subdev_call(sd,
> + video, query_dv_timings, timings);
> +}
> +
> +static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
> + struct v4l2_dv_timings_cap *cap)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int pad, ret;
> +
> + pad = cap->pad;
> + cap->pad = vin->src_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
> +
> + cap->pad = pad;
> +
> + return ret;
> +}
> +
>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>   .vidioc_querycap= rvin_querycap,
>   .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
> @@ -494,6 +570,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>   .vidioc_g_input = rvin_g_input,
>   .vidioc_s_input = rvin_s_input,
>  
> + .vidioc_dv_timings_cap  = rvin_dv_timings_cap,
> + .vidioc_enum_dv_timings = rvin_enum_dv_timings,
> + .vidioc_g_dv_timings= rvin_g_dv_timings,
> + .vidioc_s_dv_timings= rvin_s_dv_timings,
> + .vidioc_query_dv_timings= rvin_query_dv_timings,
> +
>   .vidioc_querystd= rvin_querystd,
>   .vidioc_g_std   = rvin_g_std,
>   .vidioc_s_std   = rvin_s_std,
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 2/8] media: adv7604: automatic "default-input" selection

2016-06-27 Thread Hans Verkuil
On 05/11/2016 04:02 PM, Ulrich Hecht wrote:
> From: William Towle 
> 
> Add logic such that the "default-input" property becomes unnecessary
> for chips that only have one suitable input (ADV7611 by design, and
> ADV7612 due to commit 7111cddd518f ("[media] media: adv7604: reduce
> support to first (digital) input").
> 
> Additionally, Ian's documentation in commit bf9c82278c34 ("[media]
> media: adv7604: ability to read default input port from DT") states
> that the "default-input" property should reside directly in the node
> for adv7612. Hence, also adjust the parsing to make the implementation
> consistent with this.
> 
> Signed-off-by: William Towle 
> Signed-off-by: Ulrich Hecht 
> ---
>  drivers/media/i2c/adv7604.c | 18 +-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index 41a1bfc..d722c16 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -2788,7 +2788,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
>   struct device_node *np;
>   unsigned int flags;
>   int ret;
> - u32 v;
> + u32 v = -1;
>  
>   np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
>  
> @@ -2810,6 +2810,22 @@ static int adv76xx_parse_dt(struct adv76xx_state 
> *state)
>  
>   of_node_put(endpoint);
>  
> + if (of_property_read_u32(np, "default-input", )) {
> + /* not specified ... can we choose automatically? */
> + switch (state->info->type) {
> + case ADV7611:
> + v = 0;
> + break;
> + case ADV7612:
> + if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
> + v = 0;
> + /* else is unhobbled, leave unspecified */

Please add a break here, don't fall through.

What happens when the default_input is unspecified? I don't really like this,
I think that if nothing is specified, then it should just fall back to
input 0.

Note that neither include/media/i2c/adv7604.h nor 
Documentation/devicetree/bindings/media/i2c/adv7604.txt
say anything about this either.

Regards,

Hans

> + default:
> + break;
> + }
> + }
> + state->pdata.default_input = v;
> +
>   flags = bus_cfg.bus.parallel.flags;
>  
>   if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] solo6x10: Set FRAME_BUF_SIZE to 200KB

2016-06-27 Thread Hans Verkuil
Andrey,

Since you are the original author, can you give me your Signed-off-by line?

My apologies for the very late reply, it's been very busy lately and I am
finally catching up...

Thanks!

Hans

On 05/04/2016 06:21 PM, Ismael Luceno wrote:
> From: Andrey Utkin 
> 
> Such frame size is met in practice. Also report oversized frames.
> 
> [ismael: Reworked warning and commit message]
> 
> Signed-off-by: Ismael Luceno 
> ---
>  drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c 
> b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> index 67a14c4..f98017b 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> @@ -33,7 +33,7 @@
>  #include "solo6x10-jpeg.h"
>  
>  #define MIN_VID_BUFFERS  2
> -#define FRAME_BUF_SIZE   (196 * 1024)
> +#define FRAME_BUF_SIZE   (200 * 1024)
>  #define MP4_QS   16
>  #define DMA_ALIGN4096
>  
> @@ -323,8 +323,11 @@ static int solo_send_desc(struct solo_enc_dev *solo_enc, 
> int skip,
>   int i;
>   int ret;
>  
> - if (WARN_ON_ONCE(size > FRAME_BUF_SIZE))
> + if (WARN_ON_ONCE(size > FRAME_BUF_SIZE)) {
> + dev_warn(_dev->pdev->dev,
> +  "oversized frame (%d bytes)\n", size);
>   return -EINVAL;
> + }
>  
>   solo_enc->desc_count = 1;
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] v4l2-compliance: Improve test readability when fail

2016-06-27 Thread Hans Verkuil
On 05/09/2016 05:44 PM, Helen Koike wrote:
> In case of failure, print "q.create_bufs(node, 1, ) != EINVAL" instead
> of "ret != EINVAL"
> 
> Signed-off-by: Helen Koike 
> ---
> 
> Hello,
> 
> I was wondering, why the q.create_bufs is expected to should return EINVAL in 
> this test? The height and size are set to half of the original values, and 
> the type and memory doesn't seems to change.

For all drivers currently in the kernel the buffer size that create_bufs wants 
should be >= the size
of the current format.

This checks if the drivers perform that test correctly.

In theory it should be possible to allocate smaller buffers as well and drivers 
that
allow on-the-fly format changes, but such drivers do not exist today.

If such drivers arrive, then this test should probably be modified.

Regards,

Hans

> 
> Thank you
> 
>  utils/v4l2-compliance/v4l2-test-buffers.cpp | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp 
> b/utils/v4l2-compliance/v4l2-test-buffers.cpp
> index 6c5ed55..fb14170 100644
> --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
> @@ -955,8 +955,7 @@ int testMmap(struct node *node, unsigned frame_count)
>   fmt.s_height(fmt.g_height() / 2);
>   for (unsigned p = 0; p < fmt.g_num_planes(); 
> p++)
>   fmt.s_sizeimage(fmt.g_sizeimage(p) / 2, 
> p);
> - ret = q.create_bufs(node, 1, );
> - fail_on_test(ret != EINVAL);
> + fail_on_test(q.create_bufs(node, 1, ) != 
> EINVAL);
>   fail_on_test(testQueryBuf(node, cur_fmt.type, 
> q.g_buffers()));
>   fmt = cur_fmt;
>   for (unsigned p = 0; p < fmt.g_num_planes(); 
> p++)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v4.8] tw686x enhancements

2016-06-27 Thread Hans Verkuil
This improves the tw686x driver, adding support for features that were formerly
only available in the staging tw686x driver.

Krzysztof, please let us know if there are features that you need that are not
available in this driver. Otherwise I plan to remove the staging driver for
kernel 4.9.

Ezequiel, as a future follow-up patch it might be nice to automatically choose
between contig/memcpy and sg based on the requested field format.

Right now this is determined by dma_mode, but that can be improved.

It would also simplify the dma_mode since that would then be a bool saying
whether or not it should memcpy for stability.

I'm not postponing merging this series for that since this is already a
substantial improvement.

Regards,

Hans

The following changes since commit 0db5c79989de2c68d5abb7ba891bfdb3cd3b7e05:

  [media] media-devnode.h: Fix documentation (2016-06-16 08:14:56 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.8b

for you to fetch changes up to f600ab6de581ab45751bbc157e507b0ec1c6cc1a:

  tw686x: be explicit about the possible dma_mode options (2016-06-27 10:28:59 
+0200)


Ezequiel Garcia (6):
  tw686x: Introduce an interface to support multiple DMA modes
  tw686x: Add support for DMA contiguous interlaced frame mode
  tw686x: Add support for DMA scatter-gather mode
  tw686x: audio: Implement non-memcpy capture
  tw686x: audio: Allow to configure the period size
  tw686x: audio: Prevent hw param changes while busy

Hans Verkuil (1):
  tw686x: be explicit about the possible dma_mode options

 drivers/media/pci/tw686x/Kconfig|   2 +
 drivers/media/pci/tw686x/tw686x-audio.c |  92 +---
 drivers/media/pci/tw686x/tw686x-core.c  |  56 ++-
 drivers/media/pci/tw686x/tw686x-regs.h  |   9 ++
 drivers/media/pci/tw686x/tw686x-video.c | 492 
+++-
 drivers/media/pci/tw686x/tw686x.h   |  41 -
 6 files changed, 544 insertions(+), 148 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] ARM: dts: meson: fixed size of the meson-ir registers

2016-06-27 Thread Carlo Caione
On 26/06/16 23:06, Martin Blumenstingl wrote:
> According to the reference driver (and the datasheet of the newer
> Meson8b/S805 and GXBB/S905 SoCs) there are 14 registers, each 32 bit
> wide.

Then why are you modifying the DTS for the Meson6? As Neil already
suggested, it seems that the hardware has been slightly modified for the
latest SoCs, so this approach is clearly wrong.
Add a new compatible and use of_device_get_match_data() to get the SoC
specific data.

> Adjust the register size to reflect that, as register offset 0x20 is
> now also needed by the meson-ir driver.

According to the AML8726-MX (meson6) datasheet the value of 0x20 is
correct, at least for that hardware.

Cheers,

-- 
Carlo Caione
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] tw686x: be explicit about the possible dma_mode options

2016-06-27 Thread Hans Verkuil
Users won't know what to put in this module option if it isn't
described.

Signed-off-by: Hans Verkuil 
---
Ezequiel, this sits on top of your tw686x patch series and will be part of the 
pull
request.
---
 drivers/media/pci/tw686x/tw686x-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/tw686x/tw686x-core.c 
b/drivers/media/pci/tw686x/tw686x-core.c
index 586bc67..71a0453 100644
--- a/drivers/media/pci/tw686x/tw686x-core.c
+++ b/drivers/media/pci/tw686x/tw686x-core.c
@@ -91,7 +91,7 @@ static int tw686x_dma_mode_set(const char *val, struct 
kernel_param *kp)
 }
 module_param_call(dma_mode, tw686x_dma_mode_set, tw686x_dma_mode_get,
  _mode, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(dma_mode, "DMA operation mode");
+MODULE_PARM_DESC(dma_mode, "DMA operation mode (memcpy/contig/sg, 
default=memcpy)");

 void tw686x_disable_channel(struct tw686x_dev *dev, unsigned int channel)
 {
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [v2] media: rc: fix Meson IR decoder

2016-06-27 Thread Neil Armstrong


On 06/26/2016 11:06 PM, Martin Blumenstingl wrote:
> The meson-ir driver uses the wrong offset (at least according to
> Amlogic's reference driver as well as the datasheets of the
> Meson8b/S805 and GXBB/S905).
> This means that we are getting incorrect durations (REG1_TIME_IV)
> reported from the hardware.

Hi,

I'm quite sure the registers are good for meson6 actually, and
it seems reasonable Amlogic made the HW evolve for the Meson8 and GXBB 
platforms.

>
> This problem was also noticed by some people trying to use this on an
> ODROID-C1 and ODROID-C2 - the workaround there (probably because the
> datasheets were not publicy available yet at that time) was to switch
> to ir_raw_event_store_edge (which leaves it up to the kernel to measure
> the duration of a pulse). See [0] and [1] for the corresponding
> patches.

Since we are using devicetree, the correct way to achieve this fix is not
to drop support for meson6 (what you do) but add a logic to select the correct
register for meson8 and gxbb if their compatible string are encountered.

> Please note that I was only able to test this on an GXBB/S905 based
> device (due to lack of other hardware).

I made this fix already but lacked time to actually test it on HW :
https://github.com/torvalds/linux/compare/master...superna:amlogic/v4.7/ir

My patch is missing the meson8b support, and may need a supplementary 
compatible check or
a separate dt match table.

Neil

>
> [0] 
> https://github.com/erdoukki/linux-amlogic-1/commit/969b2e2242fb14a13cb651f9a1cf771b599c958b
> [1] http://forum.odroid.com/viewtopic.php?f=135=20504
>

PS: BTW could you format the cover letter using the git format-patch 
--cover-letter instead and
add the v2 using the -subject-prefix like :
# git format-patch --cover-letter --signoff --subject-prefix "PATCH v2" -2

> ___
> linux-amlogic mailing list
> linux-amlo...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic
>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html