Re: [linux-sunxi] [PATCH v2 04/13] rc: sunxi-cir: Add support for an optional reset controller

2014-12-20 Thread Hans de Goede

Hi,

On 19-12-14 19:17, Maxime Ripard wrote:

Hi,

On Thu, Dec 18, 2014 at 09:50:26AM +0100, Hans de Goede wrote:

Hi,

On 18-12-14 03:48, Chen-Yu Tsai wrote:

Hi,

On Thu, Dec 18, 2014 at 1:18 AM, Hans de Goede hdego...@redhat.com wrote:

On sun6i the cir block is attached to the reset controller, add support
for de-asserting the reset if a reset controller is specified in dt.

Signed-off-by: Hans de Goede hdego...@redhat.com
Acked-by: Mauro Carvalho Chehab mche...@osg.samsung.com
Acked-by: Maxime Ripard maxime.rip...@free-electrons.com
---
  .../devicetree/bindings/media/sunxi-ir.txt |  2 ++
  drivers/media/rc/sunxi-cir.c   | 25 --
  2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt 
b/Documentation/devicetree/bindings/media/sunxi-ir.txt
index 23dd5ad..6b70b9b 100644
--- a/Documentation/devicetree/bindings/media/sunxi-ir.txt
+++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt
@@ -10,6 +10,7 @@ Required properties:

  Optional properties:
  - linux,rc-map-name : Remote control map name.
+- resets : phandle + reset specifier pair


Should it be optional? Or should we use a sun6i compatible with
a mandatory reset phandle? I mean, the driver/hardware is not
going to work with the reset missing on sun6i.

Seems we are doing it one way for some of our drivers, and
the other (optional) way for more generic ones, like USB.


I do not believe that we should add a new compatible just because
the reset line of a block is hooked up differently. It is the
exact same ip-block. Only now the reset is not controlled
through the apb-gate, but controlled separately.


He has a point though. Your driver might very well probe nicely and
everything, but still wouldn't be functional at all because the reset
line wouldn't have been specified in the DT.


Right, just like other drivers we've, see e.g.:

Documentation/devicetree/bindings/mmc/sunxi-mmc.txt

Which is dealing with this in the same way.


The easiest way to deal with that would be in the bindings doc to
update it with a compatible for the A31, and mentionning that the
reset property is mandatory there.


No the easiest way to deal with this is to expect people writing
the dts to know what they are doing, just like we do for a lot
of the other blocks in sun6i.

Maybe put a generic note somewhere that sun6i has a reset controller,
and that for all the blocks with optional resets property it should
be considered mandatory on sun6i ?

I'm sorry but I'm not going to make this change for the ir bindings
given that we've the same situation in a lot of other places.

Consistency is important. Moreover I believe that having a sun6i
specific compatible string is just wrong, since it is the exact
same hardware block as on sun5i, just with its reset line routed
differently, just like e.g. the mmc controller, the uarts or the gmac
all of which also do not have a sun6i specific compatible to enforce
reset controller usage.

Regards,

Hans




Note that the code itself might not change at all though. I'd just
like to avoid any potential breaking of the DT bindings themselves. If
we further want to refine the code, we can do that however we want.

I have a slight preference for a clean error if reset is missing, but
I won't get in the way just for that.

Maxime


--
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 12/13] ARM: dts: sun6i: Add sun6i-a31s.dtsi

2014-12-20 Thread Hans de Goede

Hi,

On 19-12-14 19:34, Maxime Ripard wrote:

On Wed, Dec 17, 2014 at 06:18:23PM +0100, Hans de Goede wrote:

Add a dtsi file for A31s based boards.

Since the  A31s is the same die as the A31 in a different package, this dtsi
simply includes sun6i-a31.dtsi and then overrides the pinctrl compatible to
reflect the different package, everything else is identical.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
Changes in v2:
-include sun6i-a31.dtsi and override the pinctrl compatible, rather then
  copying everything
---
  arch/arm/boot/dts/sun6i-a31s.dtsi | 62 +++
  1 file changed, 62 insertions(+)
  create mode 100644 arch/arm/boot/dts/sun6i-a31s.dtsi

diff --git a/arch/arm/boot/dts/sun6i-a31s.dtsi 
b/arch/arm/boot/dts/sun6i-a31s.dtsi
new file mode 100644
index 000..d0bd2b9
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31s.dtsi
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2014 Hans de Goede hdego...@redhat.com
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library 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.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The A31s is the same die as the A31 in a different package, this is
+ * reflected by it having different pinctrl compatible everything else is
+ * identical.
+ */
+
+/include/ sun6i-a31.dtsi
+
+/ {
+   soc@01c0 {
+   pio: pinctrl@01c20800 {
+   compatible = allwinner,sun6i-a31s-pinctrl;
+   };
+   };
+};


Given your previous changes, you should also update the enable-method.


I've not added a new compatible for the enable-method, given that
this is the exact same die, so the 2 are 100?% compatible, just like you
insisted that allwinner,sun4i-a10-mod0-clk should be used for the ir-clk
since it was 100% compatible to that I believe that the enable method
should use the existing compatible and not invent a new one for something
which is 100% compatible.


Also, for this patch and the next one, Arnd just warned me that we
shouldn't duplicate the DT path, and that we should switch to the new
trend on using label references (like what TI or Amlogic does for
example).


Ok, so something like this, right ?  :

pio {
compatible = allwinner,sun6i-a31s-pinctrl;
};

Once we've agreement on the enable-method I'll respin this patch and
the CSQ CS908 board patch.

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 v2 06/13] clk: sunxi: Make the mod0 clk driver also a platform driver

2014-12-20 Thread Hans de Goede

Hi,

On 19-12-14 19:24, Maxime Ripard wrote:

Hi,

On Wed, Dec 17, 2014 at 06:18:17PM +0100, Hans de Goede wrote:

With the prcm in sun6i (and some later SoCs) some mod0 clocks are instantiated
through the mfd framework, and as such do not work with of_clk_declare, since
they do not have registers assigned to them yet at of_clk_declare init time.

Silence the error on not finding registers in the of_clk_declare mod0 clk
setup method, and also register mod0-clk support as a platform driver to work
properly with mfd instantiated mod0 clocks.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  drivers/clk/sunxi/clk-mod0.c | 41 -
  1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/sunxi/clk-mod0.c b/drivers/clk/sunxi/clk-mod0.c
index 658d74f..7ddab6f 100644
--- a/drivers/clk/sunxi/clk-mod0.c
+++ b/drivers/clk/sunxi/clk-mod0.c
@@ -17,6 +17,7 @@
  #include linux/clk-provider.h
  #include linux/clkdev.h
  #include linux/of_address.h
+#include linux/platform_device.h

  #include clk-factors.h

@@ -67,7 +68,7 @@ static struct clk_factors_config sun4i_a10_mod0_config = {
.pwidth = 2,
  };

-static const struct factors_data sun4i_a10_mod0_data __initconst = {
+static const struct factors_data sun4i_a10_mod0_data = {
.enable = 31,
.mux = 24,
.muxmask = BIT(1) | BIT(0),
@@ -82,17 +83,47 @@ static void __init sun4i_a10_mod0_setup(struct device_node 
*node)
void __iomem *reg;

reg = of_iomap(node, 0);
-   if (!reg) {
-   pr_err(Could not get registers for mod0-clk: %s\n,
-  node-name);
+   if (!reg)
return;
-   }


A comment here would be nice to mention that this is intentional.


Ok, I'll respin this patch adding such a comment.

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


[PATCH 04/15] media: blackfin: bfin_capture: improve buf_prepare() callback

2014-12-20 Thread Lad, Prabhakar
this patch improves the buf_prepare() callback.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index a997eac..8bd94a1 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -305,16 +305,12 @@ static int bcap_queue_setup(struct vb2_queue *vq,
 static int bcap_buffer_prepare(struct vb2_buffer *vb)
 {
struct bcap_device *bcap_dev = vb2_get_drv_priv(vb-vb2_queue);
-   struct bcap_buffer *buf = to_bcap_vb(vb);
-   unsigned long size;
 
-   size = bcap_dev-fmt.sizeimage;
-   if (vb2_plane_size(vb, 0)  size) {
-   v4l2_err(bcap_dev-v4l2_dev, buffer too small (%lu  %lu)\n,
-   vb2_plane_size(vb, 0), size);
+   vb2_set_plane_payload(vb, 0, bcap_dev-fmt.sizeimage);
+   if (vb2_get_plane_payload(vb, 0)  vb2_plane_size(vb, 0))
return -EINVAL;
-   }
-   vb2_set_plane_payload(buf-vb, 0, size);
+
+   vb-v4l2_buf.field = bcap_dev-fmt.field;
 
return 0;
 }
-- 
1.9.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


[PATCH 09/15] media: blackfin: bfin_capture: make sure all buffers are returned on stop_streaming() callback

2014-12-20 Thread Lad, Prabhakar
In start_streaming() callback the buffer is removed from the
dma_queue list and assigned to cur_frm, this patch makes sure
that is returned to vb2 core with VB2_BUF_STATE_ERROR flag.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 80a0efc..58414dd 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -374,6 +374,9 @@ static void bcap_stop_streaming(struct vb2_queue *vq)
stream off failed in subdev\n);
 
/* release all active buffers */
+   if (bcap_dev-cur_frm)
+   vb2_buffer_done(bcap_dev-cur_frm-vb, VB2_BUF_STATE_ERROR);
+
while (!list_empty(bcap_dev-dma_queue)) {
bcap_dev-cur_frm = list_entry(bcap_dev-dma_queue.next,
struct bcap_buffer, list);
-- 
1.9.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


[PATCH 10/15] media: blackfin: bfin_capture: return -ENODATA for *std calls

2014-12-20 Thread Lad, Prabhakar
this patch adds supports to return -ENODATA to *_std calls
if the selected output does not support it.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 58414dd..9f48795 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -440,6 +440,11 @@ static irqreturn_t bcap_isr(int irq, void *dev_id)
 static int bcap_querystd(struct file *file, void *priv, v4l2_std_id *std)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
+   struct v4l2_input input;
+
+   input = bcap_dev-cfg-inputs[bcap_dev-cur_input];
+   if (!(input.capabilities  V4L2_IN_CAP_STD))
+   return -ENODATA;
 
return v4l2_subdev_call(bcap_dev-sd, video, querystd, std);
 }
@@ -447,6 +452,11 @@ static int bcap_querystd(struct file *file, void *priv, 
v4l2_std_id *std)
 static int bcap_g_std(struct file *file, void *priv, v4l2_std_id *std)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
+   struct v4l2_input input;
+
+   input = bcap_dev-cfg-inputs[bcap_dev-cur_input];
+   if (!(input.capabilities  V4L2_IN_CAP_STD))
+   return -ENODATA;
 
*std = bcap_dev-std;
return 0;
@@ -455,8 +465,13 @@ static int bcap_g_std(struct file *file, void *priv, 
v4l2_std_id *std)
 static int bcap_s_std(struct file *file, void *priv, v4l2_std_id std)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
+   struct v4l2_input input;
int ret;
 
+   input = bcap_dev-cfg-inputs[bcap_dev-cur_input];
+   if (!(input.capabilities  V4L2_IN_CAP_STD))
+   return -ENODATA;
+
if (vb2_is_busy(bcap_dev-buffer_queue))
return -EBUSY;
 
-- 
1.9.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


[PATCH 14/15] media: blackfin: bfin_capture: add support for VIDIOC_EXPBUF

2014-12-20 Thread Lad, Prabhakar
this patch adds support for VIDIOC_EXPBUF.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 858e333..ff89bae 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -763,6 +763,7 @@ static const struct v4l2_ioctl_ops bcap_ioctl_ops = {
.vidioc_querybuf = vb2_ioctl_querybuf,
.vidioc_qbuf = vb2_ioctl_qbuf,
.vidioc_dqbuf= vb2_ioctl_dqbuf,
+   .vidioc_expbuf   = vb2_ioctl_expbuf,
.vidioc_streamon = vb2_ioctl_streamon,
.vidioc_streamoff= vb2_ioctl_streamoff,
.vidioc_g_parm   = bcap_g_parm,
-- 
1.9.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


[PATCH 12/15] media: blackfin: bfin_capture: add support for vidioc_create_bufs

2014-12-20 Thread Lad, Prabhakar
this patch adds support for vidioc_create_bufs.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index f663687..38870c4 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -759,6 +759,7 @@ static const struct v4l2_ioctl_ops bcap_ioctl_ops = {
.vidioc_query_dv_timings = bcap_query_dv_timings,
.vidioc_enum_dv_timings  = bcap_enum_dv_timings,
.vidioc_reqbufs  = vb2_ioctl_reqbufs,
+   .vidioc_create_bufs  = vb2_ioctl_create_bufs,
.vidioc_querybuf = vb2_ioctl_querybuf,
.vidioc_qbuf = vb2_ioctl_qbuf,
.vidioc_dqbuf= vb2_ioctl_dqbuf,
-- 
1.9.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


[PATCH 15/15] media: blackfin: bfin_capture: set v4l2 buffer sequence

2014-12-20 Thread Lad, Prabhakar
this patch adds support to set the v4l2 buffer sequence.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index ff89bae..1607bc9 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -103,6 +103,8 @@ struct bcap_device {
struct completion comp;
/* prepare to stop */
bool stop;
+   /* vb2 buffer sequence counter */
+   unsigned sequence;
 };
 
 static const struct bcap_format bcap_formats[] = {
@@ -341,6 +343,8 @@ static int bcap_start_streaming(struct vb2_queue *vq, 
unsigned int count)
goto err;
}
 
+   bcap_dev-sequence = 0;
+
reinit_completion(bcap_dev-comp);
bcap_dev-stop = false;
 
@@ -411,6 +415,7 @@ static irqreturn_t bcap_isr(int irq, void *dev_id)
vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
ppi-err = false;
} else {
+   vb-v4l2_buf.sequence = bcap_dev-sequence++;
vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
}
bcap_dev-cur_frm = list_entry(bcap_dev-dma_queue.next,
-- 
1.9.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


[PATCH 11/15] media: blackfin: bfin_capture: return -ENODATA for *dv_timings calls

2014-12-20 Thread Lad, Prabhakar
this patch adds support to return -ENODATA for *dv_timings calls
if the current output does not support it.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 9f48795..f663687 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -487,6 +487,11 @@ static int bcap_enum_dv_timings(struct file *file, void 
*priv,
struct v4l2_enum_dv_timings *timings)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
+   struct v4l2_input input;
+
+   input = bcap_dev-cfg-inputs[bcap_dev-cur_input];
+   if (!(input.capabilities  V4L2_IN_CAP_DV_TIMINGS))
+   return -ENODATA;
 
timings-pad = 0;
 
@@ -498,6 +503,11 @@ static int bcap_query_dv_timings(struct file *file, void 
*priv,
struct v4l2_dv_timings *timings)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
+   struct v4l2_input input;
+
+   input = bcap_dev-cfg-inputs[bcap_dev-cur_input];
+   if (!(input.capabilities  V4L2_IN_CAP_DV_TIMINGS))
+   return -ENODATA;
 
return v4l2_subdev_call(bcap_dev-sd, video,
query_dv_timings, timings);
@@ -507,6 +517,11 @@ static int bcap_g_dv_timings(struct file *file, void *priv,
struct v4l2_dv_timings *timings)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
+   struct v4l2_input input;
+
+   input = bcap_dev-cfg-inputs[bcap_dev-cur_input];
+   if (!(input.capabilities  V4L2_IN_CAP_DV_TIMINGS))
+   return -ENODATA;
 
*timings = bcap_dev-dv_timings;
return 0;
@@ -516,7 +531,13 @@ static int bcap_s_dv_timings(struct file *file, void *priv,
struct v4l2_dv_timings *timings)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
+   struct v4l2_input input;
int ret;
+
+   input = bcap_dev-cfg-inputs[bcap_dev-cur_input];
+   if (!(input.capabilities  V4L2_IN_CAP_DV_TIMINGS))
+   return -ENODATA;
+
if (vb2_is_busy(bcap_dev-buffer_queue))
return -EBUSY;
 
-- 
1.9.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


[PATCH 13/15] media: blackfin: bfin_capture: add support for VB2_DMABUF

2014-12-20 Thread Lad, Prabhakar
this patch adds support for VB2_DMABUF.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 38870c4..858e333 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -856,7 +856,7 @@ static int bcap_probe(struct platform_device *pdev)
/* initialize queue */
q = bcap_dev-buffer_queue;
q-type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-   q-io_modes = VB2_MMAP;
+   q-io_modes = VB2_MMAP | VB2_DMABUF;
q-drv_priv = bcap_dev;
q-buf_struct_size = sizeof(struct bcap_buffer);
q-ops = bcap_video_qops;
-- 
1.9.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


[PATCH 08/15] media: blackfin: bfin_capture: use vb2_ioctl_* helpers

2014-12-20 Thread Lad, Prabhakar
this patch adds support to vb2_ioctl_* helpers.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 107 +
 1 file changed, 22 insertions(+), 85 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 30f1fe0..80a0efc 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -272,15 +272,28 @@ static int bcap_start_streaming(struct vb2_queue *vq, 
unsigned int count)
struct ppi_if *ppi = bcap_dev-ppi;
struct bcap_buffer *buf, *tmp;
struct ppi_params params;
+   dma_addr_t addr;
int ret;
 
/* enable streamon on the sub device */
ret = v4l2_subdev_call(bcap_dev-sd, video, s_stream, 1);
if (ret  (ret != -ENOIOCTLCMD)) {
v4l2_err(bcap_dev-v4l2_dev, stream on failed in subdev\n);
+   bcap_dev-cur_frm = NULL;
goto err;
}
 
+   /* get the next frame from the dma queue */
+   bcap_dev-cur_frm = list_entry(bcap_dev-dma_queue.next,
+   struct bcap_buffer, list);
+   /* remove buffer from the dma queue */
+   list_del_init(bcap_dev-cur_frm-list);
+   addr = vb2_dma_contig_plane_dma_addr(bcap_dev-cur_frm-vb, 0);
+   /* update DMA address */
+   ppi-ops-update_addr(ppi, (unsigned long)addr);
+   /* enable ppi */
+   ppi-ops-start(ppi);
+
/* set ppi params */
params.width = bcap_dev-fmt.width;
params.height = bcap_dev-fmt.height;
@@ -334,6 +347,9 @@ static int bcap_start_streaming(struct vb2_queue *vq, 
unsigned int count)
return 0;
 
 err:
+   if (bcap_dev-cur_frm)
+   vb2_buffer_done(bcap_dev-cur_frm-vb, VB2_BUF_STATE_QUEUED);
+
list_for_each_entry_safe(buf, tmp, bcap_dev-dma_queue, list) {
list_del(buf-list);
vb2_buffer_done(buf-vb, VB2_BUF_STATE_QUEUED);
@@ -377,40 +393,6 @@ static struct vb2_ops bcap_video_qops = {
.stop_streaming = bcap_stop_streaming,
 };
 
-static int bcap_reqbufs(struct file *file, void *priv,
-   struct v4l2_requestbuffers *req_buf)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-   struct vb2_queue *vq = bcap_dev-buffer_queue;
-
-   return vb2_reqbufs(vq, req_buf);
-}
-
-static int bcap_querybuf(struct file *file, void *priv,
-   struct v4l2_buffer *buf)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-
-   return vb2_querybuf(bcap_dev-buffer_queue, buf);
-}
-
-static int bcap_qbuf(struct file *file, void *priv,
-   struct v4l2_buffer *buf)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-
-   return vb2_qbuf(bcap_dev-buffer_queue, buf);
-}
-
-static int bcap_dqbuf(struct file *file, void *priv,
-   struct v4l2_buffer *buf)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-
-   return vb2_dqbuf(bcap_dev-buffer_queue,
-   buf, file-f_flags  O_NONBLOCK);
-}
-
 static irqreturn_t bcap_isr(int irq, void *dev_id)
 {
struct ppi_if *ppi = dev_id;
@@ -452,51 +434,6 @@ static irqreturn_t bcap_isr(int irq, void *dev_id)
return IRQ_HANDLED;
 }
 
-static int bcap_streamon(struct file *file, void *priv,
-   enum v4l2_buf_type buf_type)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-   struct ppi_if *ppi = bcap_dev-ppi;
-   dma_addr_t addr;
-   int ret;
-
-   /* call streamon to start streaming in videobuf */
-   ret = vb2_streamon(bcap_dev-buffer_queue, buf_type);
-   if (ret)
-   return ret;
-
-   /* if dma queue is empty, return error */
-   if (list_empty(bcap_dev-dma_queue)) {
-   v4l2_err(bcap_dev-v4l2_dev, dma queue is empty\n);
-   ret = -EINVAL;
-   goto err;
-   }
-
-   /* get the next frame from the dma queue */
-   bcap_dev-cur_frm = list_entry(bcap_dev-dma_queue.next,
-   struct bcap_buffer, list);
-   /* remove buffer from the dma queue */
-   list_del_init(bcap_dev-cur_frm-list);
-   addr = vb2_dma_contig_plane_dma_addr(bcap_dev-cur_frm-vb, 0);
-   /* update DMA address */
-   ppi-ops-update_addr(ppi, (unsigned long)addr);
-   /* enable ppi */
-   ppi-ops-start(ppi);
-
-   return 0;
-err:
-   vb2_streamoff(bcap_dev-buffer_queue, buf_type);
-   return ret;
-}
-
-static int bcap_streamoff(struct file *file, void *priv,
-   enum v4l2_buf_type buf_type)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-
-   return vb2_streamoff(bcap_dev-buffer_queue, buf_type);
-}
-
 static int bcap_querystd(struct file *file, void *priv, v4l2_std_id *std)

[PATCH 05/15] media: blackfin: bfin_capture: improve queue_setup() callback

2014-12-20 Thread Lad, Prabhakar
this patch improves the queue_setup() callback.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 8bd94a1..76d42bb 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -44,7 +44,6 @@
 #include media/blackfin/ppi.h
 
 #define CAPTURE_DRV_NAMEbfin_capture
-#define BCAP_MIN_NUM_BUF2
 
 struct bcap_format {
char *desc;
@@ -292,11 +291,14 @@ static int bcap_queue_setup(struct vb2_queue *vq,
 {
struct bcap_device *bcap_dev = vb2_get_drv_priv(vq);
 
-   if (*nbuffers  BCAP_MIN_NUM_BUF)
-   *nbuffers = BCAP_MIN_NUM_BUF;
+   if (fmt  fmt-fmt.pix.sizeimage  bcap_dev-fmt.sizeimage)
+   return -EINVAL;
+
+   if (vq-num_buffers + *nbuffers  3)
+   *nbuffers = 3 - vq-num_buffers;
 
*nplanes = 1;
-   sizes[0] = bcap_dev-fmt.sizeimage;
+   sizes[0] = fmt ? fmt-fmt.pix.sizeimage : bcap_dev-fmt.sizeimage;
alloc_ctxs[0] = bcap_dev-alloc_ctx;
 
return 0;
-- 
1.9.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


[PATCH 02/15] media: blackfin: bfin_capture: release buffers in case start_streaming() call back fails

2014-12-20 Thread Lad, Prabhakar
this patch adds support to release the buffer by calling
vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED
if start_streaming() call back fails.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index d4eeae9..80463fa 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -345,6 +345,7 @@ static int bcap_start_streaming(struct vb2_queue *vq, 
unsigned int count)
 {
struct bcap_device *bcap_dev = vb2_get_drv_priv(vq);
struct ppi_if *ppi = bcap_dev-ppi;
+   struct bcap_buffer *buf, *tmp;
struct ppi_params params;
int ret;
 
@@ -352,7 +353,7 @@ static int bcap_start_streaming(struct vb2_queue *vq, 
unsigned int count)
ret = v4l2_subdev_call(bcap_dev-sd, video, s_stream, 1);
if (ret  (ret != -ENOIOCTLCMD)) {
v4l2_err(bcap_dev-v4l2_dev, stream on failed in subdev\n);
-   return ret;
+   goto err;
}
 
/* set ppi params */
@@ -391,7 +392,7 @@ static int bcap_start_streaming(struct vb2_queue *vq, 
unsigned int count)
if (ret  0) {
v4l2_err(bcap_dev-v4l2_dev,
Error in setting ppi params\n);
-   return ret;
+   goto err;
}
 
/* attach ppi DMA irq handler */
@@ -399,12 +400,21 @@ static int bcap_start_streaming(struct vb2_queue *vq, 
unsigned int count)
if (ret  0) {
v4l2_err(bcap_dev-v4l2_dev,
Error in attaching interrupt handler\n);
-   return ret;
+   goto err;
}
 
reinit_completion(bcap_dev-comp);
bcap_dev-stop = false;
+
return 0;
+
+err:
+   list_for_each_entry_safe(buf, tmp, bcap_dev-dma_queue, list) {
+   list_del(buf-list);
+   vb2_buffer_done(buf-vb, VB2_BUF_STATE_QUEUED);
+   }
+
+   return ret;
 }
 
 static void bcap_stop_streaming(struct vb2_queue *vq)
-- 
1.9.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


[PATCH 06/15] media: blackfin: bfin_capture: use vb2_fop_mmap/poll

2014-12-20 Thread Lad, Prabhakar
No need to reinvent the wheel. Just use the already existing
functions provided by vb2.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 28 +++---
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 76d42bb..df4a6b4 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -244,18 +244,6 @@ static int bcap_release(struct file *file)
return 0;
 }
 
-static int bcap_mmap(struct file *file, struct vm_area_struct *vma)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-   int ret;
-
-   if (mutex_lock_interruptible(bcap_dev-mutex))
-   return -ERESTARTSYS;
-   ret = vb2_mmap(bcap_dev-buffer_queue, vma);
-   mutex_unlock(bcap_dev-mutex);
-   return ret;
-}
-
 #ifndef CONFIG_MMU
 static unsigned long bcap_get_unmapped_area(struct file *file,
unsigned long addr,
@@ -273,17 +261,6 @@ static unsigned long bcap_get_unmapped_area(struct file 
*file,
 }
 #endif
 
-static unsigned int bcap_poll(struct file *file, poll_table *wait)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-   unsigned int res;
-
-   mutex_lock(bcap_dev-mutex);
-   res = vb2_poll(bcap_dev-buffer_queue, file, wait);
-   mutex_unlock(bcap_dev-mutex);
-   return res;
-}
-
 static int bcap_queue_setup(struct vb2_queue *vq,
const struct v4l2_format *fmt,
unsigned int *nbuffers, unsigned int *nplanes,
@@ -896,11 +873,11 @@ static struct v4l2_file_operations bcap_fops = {
.open = bcap_open,
.release = bcap_release,
.unlocked_ioctl = video_ioctl2,
-   .mmap = bcap_mmap,
+   .mmap = vb2_fop_mmap,
 #ifndef CONFIG_MMU
.get_unmapped_area = bcap_get_unmapped_area,
 #endif
-   .poll = bcap_poll
+   .poll = vb2_fop_poll
 };
 
 static int bcap_probe(struct platform_device *pdev)
@@ -997,6 +974,7 @@ static int bcap_probe(struct platform_device *pdev)
INIT_LIST_HEAD(bcap_dev-dma_queue);
 
vfd-lock = bcap_dev-mutex;
+   vfd-queue = q;
 
/* register video device */
ret = video_register_device(bcap_dev-video_dev, VFL_TYPE_GRABBER, -1);
-- 
1.9.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


[PATCH 07/15] media: blackfin: bfin_capture: use v4l2_fh_open and vb2_fop_release

2014-12-20 Thread Lad, Prabhakar
this patch adds support to use v4l2_fh_open() and vb2_fop_release,
which allows to drop driver specific struct bcap_fh, as this is handled
by core.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 79 +-
 1 file changed, 2 insertions(+), 77 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index df4a6b4..30f1fe0 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -105,12 +105,6 @@ struct bcap_device {
bool stop;
 };
 
-struct bcap_fh {
-   struct v4l2_fh fh;
-   /* indicates whether this file handle is doing IO */
-   bool io_allowed;
-};
-
 static const struct bcap_format bcap_formats[] = {
{
.desc= YCbCr 4:2:2 Interleaved UYVY,
@@ -200,50 +194,6 @@ static void bcap_free_sensor_formats(struct bcap_device 
*bcap_dev)
bcap_dev-sensor_formats = NULL;
 }
 
-static int bcap_open(struct file *file)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-   struct video_device *vfd = bcap_dev-video_dev;
-   struct bcap_fh *bcap_fh;
-
-   if (!bcap_dev-sd) {
-   v4l2_err(bcap_dev-v4l2_dev, No sub device registered\n);
-   return -ENODEV;
-   }
-
-   bcap_fh = kzalloc(sizeof(*bcap_fh), GFP_KERNEL);
-   if (!bcap_fh) {
-   v4l2_err(bcap_dev-v4l2_dev,
-unable to allocate memory for file handle object\n);
-   return -ENOMEM;
-   }
-
-   v4l2_fh_init(bcap_fh-fh, vfd);
-
-   /* store pointer to v4l2_fh in private_data member of file */
-   file-private_data = bcap_fh-fh;
-   v4l2_fh_add(bcap_fh-fh);
-   bcap_fh-io_allowed = false;
-   return 0;
-}
-
-static int bcap_release(struct file *file)
-{
-   struct bcap_device *bcap_dev = video_drvdata(file);
-   struct v4l2_fh *fh = file-private_data;
-   struct bcap_fh *bcap_fh = container_of(fh, struct bcap_fh, fh);
-
-   /* if this instance is doing IO */
-   if (bcap_fh-io_allowed)
-   vb2_queue_release(bcap_dev-buffer_queue);
-
-   file-private_data = NULL;
-   v4l2_fh_del(bcap_fh-fh);
-   v4l2_fh_exit(bcap_fh-fh);
-   kfree(bcap_fh);
-   return 0;
-}
-
 #ifndef CONFIG_MMU
 static unsigned long bcap_get_unmapped_area(struct file *file,
unsigned long addr,
@@ -432,13 +382,6 @@ static int bcap_reqbufs(struct file *file, void *priv,
 {
struct bcap_device *bcap_dev = video_drvdata(file);
struct vb2_queue *vq = bcap_dev-buffer_queue;
-   struct v4l2_fh *fh = file-private_data;
-   struct bcap_fh *bcap_fh = container_of(fh, struct bcap_fh, fh);
-
-   if (vb2_is_busy(vq))
-   return -EBUSY;
-
-   bcap_fh-io_allowed = true;
 
return vb2_reqbufs(vq, req_buf);
 }
@@ -455,11 +398,6 @@ static int bcap_qbuf(struct file *file, void *priv,
struct v4l2_buffer *buf)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
-   struct v4l2_fh *fh = file-private_data;
-   struct bcap_fh *bcap_fh = container_of(fh, struct bcap_fh, fh);
-
-   if (!bcap_fh-io_allowed)
-   return -EBUSY;
 
return vb2_qbuf(bcap_dev-buffer_queue, buf);
 }
@@ -468,11 +406,6 @@ static int bcap_dqbuf(struct file *file, void *priv,
struct v4l2_buffer *buf)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
-   struct v4l2_fh *fh = file-private_data;
-   struct bcap_fh *bcap_fh = container_of(fh, struct bcap_fh, fh);
-
-   if (!bcap_fh-io_allowed)
-   return -EBUSY;
 
return vb2_dqbuf(bcap_dev-buffer_queue,
buf, file-f_flags  O_NONBLOCK);
@@ -523,14 +456,10 @@ static int bcap_streamon(struct file *file, void *priv,
enum v4l2_buf_type buf_type)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
-   struct bcap_fh *fh = file-private_data;
struct ppi_if *ppi = bcap_dev-ppi;
dma_addr_t addr;
int ret;
 
-   if (!fh-io_allowed)
-   return -EBUSY;
-
/* call streamon to start streaming in videobuf */
ret = vb2_streamon(bcap_dev-buffer_queue, buf_type);
if (ret)
@@ -564,10 +493,6 @@ static int bcap_streamoff(struct file *file, void *priv,
enum v4l2_buf_type buf_type)
 {
struct bcap_device *bcap_dev = video_drvdata(file);
-   struct bcap_fh *fh = file-private_data;
-
-   if (!fh-io_allowed)
-   return -EBUSY;
 
return vb2_streamoff(bcap_dev-buffer_queue, buf_type);
 }
@@ -870,8 +795,8 @@ static const struct v4l2_ioctl_ops bcap_ioctl_ops = {
 
 static struct v4l2_file_operations bcap_fops = {
.owner = THIS_MODULE,
-   .open = 

[PATCH 03/15] media: blackfin: bfin_capture: set min_buffers_needed

2014-12-20 Thread Lad, Prabhakar
this patch sets the min_buffers_needed field of the vb2 queue
so that the vb2 core will make sure start_streaming() callback
is called only when we have minimum buffers queued.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 80463fa..a997eac 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -986,6 +986,7 @@ static int bcap_probe(struct platform_device *pdev)
q-mem_ops = vb2_dma_contig_memops;
q-timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q-lock = bcap_dev-mutex;
+   q-min_buffers_needed = 1;
 
ret = vb2_queue_init(q);
if (ret)
-- 
1.9.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


[PATCH 01/15] media: blackfin: bfin_capture: drop buf_init() callback

2014-12-20 Thread Lad, Prabhakar
this patch drops the buf_init() callback as init
of buf list is not required.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 3112844..d4eeae9 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -302,14 +302,6 @@ static int bcap_queue_setup(struct vb2_queue *vq,
return 0;
 }
 
-static int bcap_buffer_init(struct vb2_buffer *vb)
-{
-   struct bcap_buffer *buf = to_bcap_vb(vb);
-
-   INIT_LIST_HEAD(buf-list);
-   return 0;
-}
-
 static int bcap_buffer_prepare(struct vb2_buffer *vb)
 {
struct bcap_device *bcap_dev = vb2_get_drv_priv(vb-vb2_queue);
@@ -441,7 +433,6 @@ static void bcap_stop_streaming(struct vb2_queue *vq)
 
 static struct vb2_ops bcap_video_qops = {
.queue_setup= bcap_queue_setup,
-   .buf_init   = bcap_buffer_init,
.buf_prepare= bcap_buffer_prepare,
.buf_cleanup= bcap_buffer_cleanup,
.buf_queue  = bcap_buffer_queue,
-- 
1.9.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


[PATCH 00/15] media: blackfin: bfin_capture enhancements

2014-12-20 Thread Lad, Prabhakar
Hi Scott,

Although I was on holiday but couldn't resist myself from working,
since I was away from my hardware I had to choose a different one,
blackfin driver was lucky one. Since I don't have the blackfin
board I haven't tested them on the actual board, but just compile
tested, Can you please test it  ACK.

Lad, Prabhakar (15):
  media: blackfin: bfin_capture: drop buf_init() callback
  media: blackfin: bfin_capture: release buffers in case
start_streaming() call back fails
  media: blackfin: bfin_capture: set min_buffers_needed
  media: blackfin: bfin_capture: improve buf_prepare() callback
  media: blackfin: bfin_capture: improve queue_setup() callback
  media: blackfin: bfin_capture: use vb2_fop_mmap/poll
  media: blackfin: bfin_capture: use v4l2_fh_open and vb2_fop_release
  media: blackfin: bfin_capture: use vb2_ioctl_* helpers
  media: blackfin: bfin_capture: make sure all buffers are returned on
stop_streaming() callback
  media: blackfin: bfin_capture: return -ENODATA for *std calls
  media: blackfin: bfin_capture: return -ENODATA for *dv_timings calls
  media: blackfin: bfin_capture: add support for vidioc_create_bufs
  media: blackfin: bfin_capture: add support for VB2_DMABUF
  media: blackfin: bfin_capture: add support for VIDIOC_EXPBUF
  media: blackfin: bfin_capture: set v4l2 buffer sequence

 drivers/media/platform/blackfin/bfin_capture.c | 310 -
 1 file changed, 98 insertions(+), 212 deletions(-)

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


[PATCH 0/8] Fix issues in em28xx

2014-12-20 Thread Russell King - ARM Linux
While testing a PCTV tripleSTICK 292e, a couple of issues were
discovered.  Firstly, disconnecting the device causes a lockdep
splat, which is addressed in the first patch.

Secondly, a number of kernel messages are missing their terminating
newline characters, and these are spread over a range of commits and
a range of kernel versions.  Therefore, I've split the fixes up by
offending commit, which should make backporting to stable trees
easier.  (Some need to be applied to 3.14 and on, some to 3.15 and on,
etc.)

It isn't clear who is the maintainer for this driver; there is no
MAINTAINERS entry.  If there is a maintainer, please ensure that they
add themselves to this critical file.  Thanks.

 drivers/media/usb/em28xx/em28xx-audio.c |  8 
 drivers/media/usb/em28xx/em28xx-core.c  |  4 ++--
 drivers/media/usb/em28xx/em28xx-dvb.c   | 14 +++---
 drivers/media/usb/em28xx/em28xx-input.c |  9 -
 drivers/media/usb/em28xx/em28xx-video.c |  6 +++---
 5 files changed, 20 insertions(+), 21 deletions(-)

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
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 1/8] [media] em28xx: fix em28xx-input removal

2014-12-20 Thread Russell King
Removing the em28xx-rc module results in the following lockdep splat,
which is caused by trying to call cancel_delayed_work_sync() on an
uninitialised delayed work.  Fix this by ensuring we always initialise
the work.

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 0 PID: 2183 Comm: rmmod Not tainted 3.18.0+ #1464
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Backtrace:
[c0012228] (dump_backtrace) from [c00123c0] (show_stack+0x18/0x1c)
 r6:c1419d2c r5: r4: r3:
[c00123a8] (show_stack) from [c06e2550] (dump_stack+0x7c/0x98)
[c06e24d4] (dump_stack) from [c0061c94] (__lock_acquire+0x16d4/0x1bb0)
 r4:edf19f74 r3:df049380
[c00605c0] (__lock_acquire) from [c00626d4] (lock_acquire+0xb0/0x124)
 r10: r9:c003ba90 r8: r7: r6: r5:edf19f74
 r4:
[c0062624] (lock_acquire) from [c003bad4] (flush_work+0x44/0x264)
 r10: r9:eaa86000 r8:edf190b0 r7:edf19f74 r6:0001 r5:edf19f64
 r4:
[c003ba90] (flush_work) from [c003d8f0] (__cancel_work_timer+0x8c/0x124)
 r7: r6:0001 r5: r4:edf19f64
[c003d864] (__cancel_work_timer) from [c003d99c] 
(cancel_delayed_work_sync+0x14/0x18)
 r7: r6:eccc3600 r5: r4:edf19000
[c003d988] (cancel_delayed_work_sync) from [bf0b5c10] 
(em28xx_ir_fini+0x48/0xd8 [em28xx_rc])
[bf0b5bc8] (em28xx_ir_fini [em28xx_rc]) from [bf08a0a8] 
(em28xx_unregister_extension+0x40/0x94 [em28xx])
 r8:c000edc4 r7:0081 r6:bf092bf4 r5:bf0b6a2c r4:edf19000 r3:bf0b5bc8
[bf08a068] (em28xx_unregister_extension [em28xx]) from [bf0b64dc] 
(em28xx_rc_unregister+0x14/0x1c [em28xx_rc])
 r6:0800 r5: r4:bf0b6a50 r3:bf0b64c8
[bf0b64c8] (em28xx_rc_unregister [em28xx_rc]) from [c0096710] 
(SyS_delete_module+0x11c/0x180)
[c00965f4] (SyS_delete_module) from [c000ec00] (ret_fast_syscall+0x0/0x48)
 r6:0001 r5:beb0f813 r4:b8b17d00

Cc: sta...@vger.kernel.org
Fixes: f52226099382 ([media] em28xx: extend the support for device buttons)
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/media/usb/em28xx/em28xx-input.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-input.c 
b/drivers/media/usb/em28xx/em28xx-input.c
index d8dc03aadfbd..ef36c49ef166 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -654,8 +654,6 @@ static void em28xx_init_buttons(struct em28xx *dev)
if (dev-num_button_polling_addresses) {
memset(dev-button_polling_last_values, 0,
   EM28XX_NUM_BUTTON_ADDRESSES_MAX);
-   INIT_DELAYED_WORK(dev-buttons_query_work,
- em28xx_query_buttons);
schedule_delayed_work(dev-buttons_query_work,
  
msecs_to_jiffies(dev-button_polling_interval));
}
@@ -689,6 +687,7 @@ static int em28xx_ir_init(struct em28xx *dev)
}
 
kref_get(dev-ref);
+   INIT_DELAYED_WORK(dev-buttons_query_work, em28xx_query_buttons);
 
if (dev-board.buttons)
em28xx_init_buttons(dev);
-- 
1.8.3.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


[PATCH 5/8] [media] em28xx-audio: fix missing newlines

2014-12-20 Thread Russell King
Inspection shows that newlines are missing from several kernel messages
in em28xx-audio.  Fix these.

Cc: sta...@vger.kernel.org
Fixes: 1b3fd2d34266 ([media] em28xx-audio: don't hardcode audio URB calculus)
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/media/usb/em28xx/em28xx-audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 52dc9d70da72..82d58eb3d32a 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -820,7 +820,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
if (urb_size  ep_size * npackets)
npackets = DIV_ROUND_UP(urb_size, ep_size);
 
-   em28xx_info(Number of URBs: %d, with %d packets and %d size,
+   em28xx_info(Number of URBs: %d, with %d packets and %d size\n,
num_urb, npackets, urb_size);
 
/* Estimate the bytes per period */
-- 
1.8.3.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


[PATCH 6/8] [media] em28xx-audio: fix missing newlines

2014-12-20 Thread Russell King
Inspection shows that newlines are missing from several kernel messages
in em28xx-audio.  Fix these.

Cc: sta...@vger.kernel.org
Fixes: 6d746f91f230 ([media] em28xx-audio: implement em28xx_ops: 
suspend/resume hooks)
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/media/usb/em28xx/em28xx-audio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 82d58eb3d32a..49a5f9532bd8 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -1005,7 +1005,7 @@ static int em28xx_audio_suspend(struct em28xx *dev)
if (dev-usb_audio_type != EM28XX_USB_AUDIO_VENDOR)
return 0;
 
-   em28xx_info(Suspending audio extension);
+   em28xx_info(Suspending audio extension\n);
em28xx_deinit_isoc_audio(dev);
atomic_set(dev-adev.stream_started, 0);
return 0;
@@ -1019,7 +1019,7 @@ static int em28xx_audio_resume(struct em28xx *dev)
if (dev-usb_audio_type != EM28XX_USB_AUDIO_VENDOR)
return 0;
 
-   em28xx_info(Resuming audio extension);
+   em28xx_info(Resuming audio extension\n);
/* Nothing to do other than schedule_work() ?? */
schedule_work(dev-adev.wq_trigger);
return 0;
-- 
1.8.3.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


[PATCH 2/8] [media] em28xx: ensure closing messages terminate with a newline

2014-12-20 Thread Russell King
The lockdep splat addressed in a previous commit revealed that at
least one message in em28xx-input.c was missing a new line:

em28178 #0: Closing input extensionINFO: trying to register non-static key.

Further inspection shows several other messages also miss a new line.
These will be fixed in a subsequent patch.

Cc: sta...@vger.kernel.org
Fixes: aa929ad783c0 ([media] em28xx: print a message at disconnect)
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/media/usb/em28xx/em28xx-audio.c | 2 +-
 drivers/media/usb/em28xx/em28xx-dvb.c   | 2 +-
 drivers/media/usb/em28xx/em28xx-input.c | 2 +-
 drivers/media/usb/em28xx/em28xx-video.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 44ae1e0661e6..52dc9d70da72 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -981,7 +981,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
return 0;
}
 
-   em28xx_info(Closing audio extension);
+   em28xx_info(Closing audio extension\n);
 
if (dev-adev.sndcard) {
snd_card_disconnect(dev-adev.sndcard);
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c 
b/drivers/media/usb/em28xx/em28xx-dvb.c
index 9877b699c6bc..80c384c390e2 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1724,7 +1724,7 @@ static int em28xx_dvb_fini(struct em28xx *dev)
if (!dev-dvb)
return 0;
 
-   em28xx_info(Closing DVB extension);
+   em28xx_info(Closing DVB extension\n);
 
dvb = dev-dvb;
client = dvb-i2c_client_tuner;
diff --git a/drivers/media/usb/em28xx/em28xx-input.c 
b/drivers/media/usb/em28xx/em28xx-input.c
index ef36c49ef166..aea22deadc0a 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -832,7 +832,7 @@ static int em28xx_ir_fini(struct em28xx *dev)
return 0;
}
 
-   em28xx_info(Closing input extension);
+   em28xx_info(Closing input extension\n);
 
em28xx_shutdown_buttons(dev);
 
diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
b/drivers/media/usb/em28xx/em28xx-video.c
index cf7f58b76292..3b8c464bf25a 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1958,7 +1958,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev)
if (v4l2 == NULL)
return 0;
 
-   em28xx_info(Closing video extension);
+   em28xx_info(Closing video extension\n);
 
mutex_lock(dev-lock);
 
-- 
1.8.3.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


[PATCH 7/8] [media] em28xx-dvb: fix missing newlines

2014-12-20 Thread Russell King
Inspection shows that newlines are missing from several kernel messages
in em28xx-dvb.  Fix these.

Cc: sta...@vger.kernel.org
Fixes: ca2b46dacbf5 ([media] em28xx-dvb: implement em28xx_ops: suspend/resume 
hooks)
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/media/usb/em28xx/em28xx-dvb.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c 
b/drivers/media/usb/em28xx/em28xx-dvb.c
index 80c384c390e2..aee70d483264 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1775,17 +1775,17 @@ static int em28xx_dvb_suspend(struct em28xx *dev)
if (!dev-board.has_dvb)
return 0;
 
-   em28xx_info(Suspending DVB extension);
+   em28xx_info(Suspending DVB extension\n);
if (dev-dvb) {
struct em28xx_dvb *dvb = dev-dvb;
 
if (dvb-fe[0]) {
ret = dvb_frontend_suspend(dvb-fe[0]);
-   em28xx_info(fe0 suspend %d, ret);
+   em28xx_info(fe0 suspend %d\n, ret);
}
if (dvb-fe[1]) {
dvb_frontend_suspend(dvb-fe[1]);
-   em28xx_info(fe1 suspend %d, ret);
+   em28xx_info(fe1 suspend %d\n, ret);
}
}
 
@@ -1802,18 +1802,18 @@ static int em28xx_dvb_resume(struct em28xx *dev)
if (!dev-board.has_dvb)
return 0;
 
-   em28xx_info(Resuming DVB extension);
+   em28xx_info(Resuming DVB extension\n);
if (dev-dvb) {
struct em28xx_dvb *dvb = dev-dvb;
 
if (dvb-fe[0]) {
ret = dvb_frontend_resume(dvb-fe[0]);
-   em28xx_info(fe0 resume %d, ret);
+   em28xx_info(fe0 resume %d\n, ret);
}
 
if (dvb-fe[1]) {
ret = dvb_frontend_resume(dvb-fe[1]);
-   em28xx_info(fe1 resume %d, ret);
+   em28xx_info(fe1 resume %d\n, ret);
}
}
 
-- 
1.8.3.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


[PATCH 4/8] [media] em28xx-core: fix missing newlines

2014-12-20 Thread Russell King
Inspection shows that newlines are missing from several kernel messages
in em28xx-core.  Fix these.

Cc: sta...@vger.kernel.org
Fixes: 9c669b731470 ([media] em28xx: add suspend/resume to em28xx_ops)
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/media/usb/em28xx/em28xx-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c 
b/drivers/media/usb/em28xx/em28xx-core.c
index 86461a708abe..37456079f490 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -1125,7 +1125,7 @@ int em28xx_suspend_extension(struct em28xx *dev)
 {
const struct em28xx_ops *ops = NULL;
 
-   em28xx_info(Suspending extensions);
+   em28xx_info(Suspending extensions\n);
mutex_lock(em28xx_devlist_mutex);
list_for_each_entry(ops, em28xx_extension_devlist, next) {
if (ops-suspend)
@@ -1139,7 +1139,7 @@ int em28xx_resume_extension(struct em28xx *dev)
 {
const struct em28xx_ops *ops = NULL;
 
-   em28xx_info(Resuming extensions);
+   em28xx_info(Resuming extensions\n);
mutex_lock(em28xx_devlist_mutex);
list_for_each_entry(ops, em28xx_extension_devlist, next) {
if (ops-resume)
-- 
1.8.3.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


[PATCH 3/8] [media] em28xx-input: fix missing newlines

2014-12-20 Thread Russell King
Inspection shows that newlines are missing from several kernel messages
in em28xx-input.  Fix these.

Cc: sta...@vger.kernel.org
Fixes: 5025076aadfe ([media] em28xx-input: implement em28xx_ops: 
suspend/resume hooks)
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/media/usb/em28xx/em28xx-input.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-input.c 
b/drivers/media/usb/em28xx/em28xx-input.c
index aea22deadc0a..4007356d991d 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -861,7 +861,7 @@ static int em28xx_ir_suspend(struct em28xx *dev)
if (dev-is_audio_only)
return 0;
 
-   em28xx_info(Suspending input extension);
+   em28xx_info(Suspending input extension\n);
if (ir)
cancel_delayed_work_sync(ir-work);
cancel_delayed_work_sync(dev-buttons_query_work);
@@ -878,7 +878,7 @@ static int em28xx_ir_resume(struct em28xx *dev)
if (dev-is_audio_only)
return 0;
 
-   em28xx_info(Resuming input extension);
+   em28xx_info(Resuming input extension\n);
/* if suspend calls ir_raw_event_unregister(), the should call
   ir_raw_event_register() */
if (ir)
-- 
1.8.3.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


[PATCH 8/8] [media] em28xx-video: fix missing newlines

2014-12-20 Thread Russell King
Inspection shows that newlines are missing from several kernel messages
in em28xx-video.  Fix these.

Cc: sta...@vger.kernel.org
Fixes: a61f68119af3 ([media] em28xx-video: implement em28xx_ops: 
suspend/resume hooks)
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/media/usb/em28xx/em28xx-video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
b/drivers/media/usb/em28xx/em28xx-video.c
index 3b8c464bf25a..f220c1f376e3 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -2007,7 +2007,7 @@ static int em28xx_v4l2_suspend(struct em28xx *dev)
if (!dev-has_video)
return 0;
 
-   em28xx_info(Suspending video extension);
+   em28xx_info(Suspending video extension\n);
em28xx_stop_urbs(dev);
return 0;
 }
@@ -2020,7 +2020,7 @@ static int em28xx_v4l2_resume(struct em28xx *dev)
if (!dev-has_video)
return 0;
 
-   em28xx_info(Resuming video extension);
+   em28xx_info(Resuming video extension\n);
/* what do we do here */
return 0;
 }
-- 
1.8.3.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


[PATCH] media: Pinnacle 73e infrared control stopped working since kernel 3.17

2014-12-20 Thread David Cimbůrek
Hi,

with kernel 3.17 remote control for Pinnacle 73e (ID 2304:0237
Pinnacle Systems, Inc. PCTV 73e [DiBcom DiB7000PC]) does not work
anymore.

I checked the changes and found out the problem in commit
af3a4a9bbeb00df3e42e77240b4cdac5479812f9.

In dib0700_core.c in struct dib0700_rc_response the following union:

union {
u16 system16;
struct {
u8 not_system;
u8 system;
};
};

has been replaced by simple variables:

u8 system;
u8 not_system;

But these variables are in reverse order! When I switch the order
back, the remote works fine again! Here is the patch:


--- a/drivers/media/usb/dvb-usr/dib0700_core.c2014-12-20
14:27:15.0 +0100
+++ b/drivers/media/usb/dvb-usr/dib0700_core.c2014-12-20
14:27:36.0 +0100
@@ -658,8 +658,8 @@
 struct dib0700_rc_response {
 u8 report_id;
 u8 data_state;
-u8 system;
 u8 not_system;
+u8 system;
 u8 data;
 u8 not_data;
 };


Regards,
David
--
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 0/8] Fix issues in em28xx

2014-12-20 Thread Frank Schäfer

Am 20.12.2014 um 13:44 schrieb Russell King - ARM Linux:
 It isn't clear who is the maintainer for this driver; there is no
 MAINTAINERS entry.  If there is a maintainer, please ensure that they
 add themselves to this critical file.  Thanks.

(line 3598)

EM28XX VIDEO4LINUX DRIVER
M:Mauro Carvalho Chehab m.che...@samsung.com
L:linux-media@vger.kernel.org
W:http://linuxtv.org
T:git git://linuxtv.org/media_tree.git
S:Maintained
F:drivers/media/usb/em28xx/


--
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/RFC] v4l: vsp1: Add format for Mem2Mem Playback

2014-12-20 Thread Yoshihiro Kaneko
From: Hiroki Negishi hiroki.negishi...@hitachi-solutions.com

Signed-off-by: Hiroki Negishi hiroki.negishi...@hitachi-solutions.com
Signed-off-by: Yoshifumi Hosoya yoshifumi.hosoya...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---

This patch is based on the master branch of linuxtv.org/media_tree.git.

 drivers/media/platform/vsp1/vsp1_video.c | 3 +++
 include/uapi/linux/videodev2.h   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index e512336..9bbc02a 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -130,6 +130,9 @@ static const struct vsp1_format_info vsp1_video_formats[] = 
{
  VI6_FMT_Y_U_V_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
  VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
  3, { 8, 8, 8 }, false, false, 2, 2, false },
+   { V4L2_PIX_FMT_RGB32S, MEDIA_BUS_FMT_ARGB_1X32,
+ VI6_FMT_ARGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
+ 1, { 32, 0, 0 }, false, false, 1, 1, false },
 };
 
 /*
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index d279c1b..f22e167 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -396,6 +396,9 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_ARGB32  v4l2_fourcc('B', 'A', '2', '4') /* 32  
ARGB-8-8-8-8  */
 #define V4L2_PIX_FMT_XRGB32  v4l2_fourcc('B', 'X', '2', '4') /* 32  
XRGB-8-8-8-8  */
 
+/* RGB formats for memory output */
+#define V4L2_PIX_FMT_RGB32S  v4l2_fourcc('R', 'G', '4', 'S') /* 32 RGB-8-8-8-8 
*/
+
 /* Grey formats */
 #define V4L2_PIX_FMT_GREYv4l2_fourcc('G', 'R', 'E', 'Y') /*  8  Greyscale  
   */
 #define V4L2_PIX_FMT_Y4  v4l2_fourcc('Y', '0', '4', ' ') /*  4  Greyscale  
   */
-- 
1.9.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 1/8] [media] em28xx: fix em28xx-input removal

2014-12-20 Thread Russell King - ARM Linux
On Sat, Dec 20, 2014 at 03:11:54PM +0100, Frank Schäfer wrote:
 Hi Russel,

I guess you won't mind if I mis-spell your name too...

 I'd prefer to keep the button initialization related stuff together in
 em28xx_init_buttons() and do the cancel_delayed_work_sync() only if we
 have buttons (dev-num_button_polling_addresses).
 That's how we already do it with the IR work struct (see
 em28xx_ir_suspend()).

Provided all places that touch buttons_query_work are properly updated
that's fine, but to me that is fragile and asking for trouble.  It's far
better to ensure that everything is properly initialised so you don't
have to remember to conditionalise every single reference to a work
struct.

In any case, delayed work struct initialisation is cheap - it doesn't
involve any additional memory, it only initialises the various members
of the struct (and the lockdep information for the static key) so there
really is no argument against always initialising delayed works or normal
works, timers, etc to avoid these kinds of bugs.

Anything to keep the code simple is a good thing.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
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 0/8] Fix issues in em28xx

2014-12-20 Thread Russell King - ARM Linux
On Sat, Dec 20, 2014 at 03:10:04PM +0100, Frank Schäfer wrote:
 
 Am 20.12.2014 um 13:44 schrieb Russell King - ARM Linux:
  It isn't clear who is the maintainer for this driver; there is no
  MAINTAINERS entry.  If there is a maintainer, please ensure that they
  add themselves to this critical file.  Thanks.
 
 (line 3598)
 
 EM28XX VIDEO4LINUX DRIVER
 M:Mauro Carvalho Chehab m.che...@samsung.com
 L:linux-media@vger.kernel.org
 W:http://linuxtv.org
 T:git git://linuxtv.org/media_tree.git
 S:Maintained
 F:drivers/media/usb/em28xx/

That's fine then - I thought my scripts picked Mauro up as the
drivers/media maintainer rather than the driver author.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
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


cx23885: Add si2165 support for HVR-5500

2014-12-20 Thread Antti Palosaari

Matthias and Mauro,
so you decided to add that patch, which makes rather big changes for 
existing HVR-4400 models, without any testing. I plugged HVR-4400 
version that has only DVB-S2 in my machine in order to start finding out 
one lockdep issue but what I see is bad HVR-4400.


*
commit 36efec48e2e6016e05364906720a0ec350a5d768
Author: Matthias Schwarzott z...@gentoo.org
Date:   Tue Jul 22 17:12:13 2014 -0300

[media] cx23885: Add si2165 support for HVR-5500

The same card entry is used for HVR-4400 and HVR-5500.
Only HVR-5500 has been tested.

Signed-off-by: Matthias Schwarzott z...@gentoo.org
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

*

I would also criticize Mauro as he has committed that patch. It should 
be obvious for every experienced media developer that this kind of not 
trivial change needs some more careful review or testing.


That patch should be done differently, not blindly trying to attach chip 
drivers for non-existent chips. I think correct solution is to detect 
different HW models somehow, probing or reading from eeprom or so. Then 
make 2 profiles, one for boards having both satellite and 
terristrial/cable and one for boards having satellite only.



*

cx23885 driver version 0.0.4 loaded
CORE cx23885[0]: subsystem: 0070:c12a, board: Hauppauge WinTV-HVR4400 
[card=38,autodetected]

tveeprom 5-0050: Hauppauge model 121200, rev B2C3, serial# 4034388477
tveeprom 5-0050: MAC address is 00:0d:fe:77:e1:fd
tveeprom 5-0050: tuner model is Conexant CX24118A (idx 123, type 4)
tveeprom 5-0050: TV standards ATSC/DVB Digital (eeprom 0x80)
tveeprom 5-0050: audio processor is CX23888 (idx 40)
tveeprom 5-0050: decoder processor is CX23888 (idx 34)
tveeprom 5-0050: has no radio, has IR receiver, has no IR transmitter
cx23885[0]: warning: unknown hauppauge model #121200
cx23885[0]: hauppauge eeprom: model=121200
All bytes are equal. It is not a TEA5767
tuner 6-0060: Tuner -1 found with type(s) Radio TV.
tda18271 6-0060: creating new instance
Unknown device (0) detected @ 6-0060, device not supported.
tda18271_attach: [6-0060|M] error -22 on line 1285
tda18271 6-0060: destroying instance
tuner 6-0060: Tuner has no way to set tv freq
cx23885[0]: registered device video0 [v4l2]
cx23885[0]: registered device vbi0
cx23885[0]: registered ALSA audio device
cx23885_dvb_register() allocating 1 frontend(s)
cx23885[0]: cx23885 based dvb card
i2c i2c-5: a8293: Allegro A8293 SEC attached
DVB: registering new adapter (cx23885[0])
cx23885 :02:00.0: DVB: registering adapter 0 frontend 0 (NXP 
TDA10071)...

cx23885_dvb_register() allocating 1 frontend(s)
cx23885[0]: cx23885 based dvb card
cx23885[0]: frontend initialization failed
cx23885_dvb_register() dvb_register failed err = -22
cx23885_dev_setup() Failed to register dvb on VID_C
cx23885_dev_checkrevision() Hardware revision = 0xd0
cx23885[0]/0: found at :02:00.0, rev: 4, irq: 18, latency: 0, mmio: 
0xfe80


*

# ../rmmod.pl unload
Seeking media drivers at /lib/modules/3.18.0-rc4+/kernel/drivers/media/
found 0 modules
Seeking media drivers at /lib/modules/3.18.0-rc4+/extra/
found 511 modules
Seeking media drivers at /lib/modules/3.18.0-rc4+/updates/media/
found 511 modules
/sbin/rmmod cx23885
rmmod: ERROR: Module cx23885 is in use
/sbin/rmmod videobuf2_dvb
rmmod: ERROR: Module videobuf2_dvb is in use by: cx23885
/sbin/rmmod videobuf2_core
rmmod: ERROR: Module videobuf2_core is in use by: cx23885 videobuf2_dvb
/sbin/rmmod tuner
rmmod: ERROR: Module tuner is in use
/sbin/rmmod cx2341x
rmmod: ERROR: Module cx2341x is in use by: cx23885
/sbin/rmmod v4l2_common
rmmod: ERROR: Module v4l2_common is in use by: cx2341x cx23885 tuner 
videobuf2_core

/sbin/rmmod altera_ci
rmmod: ERROR: Module altera_ci is in use by: cx23885
/sbin/rmmod videobuf2_dma_sg
rmmod: ERROR: Module videobuf2_dma_sg is in use by: cx23885
/sbin/rmmod videodev
rmmod: ERROR: Module videodev is in use by: cx2341x cx23885 tuner 
v4l2_common videobuf2_core

/sbin/rmmod dvb_core
rmmod: ERROR: Module dvb_core is in use by: cx23885 altera_ci videobuf2_dvb
/sbin/rmmod a8293
rmmod: ERROR: Module a8293 is in use
/sbin/rmmod videobuf2_memops
rmmod: ERROR: Module videobuf2_memops is in use by: videobuf2_dma_sg
/sbin/rmmod tda18271
rmmod: ERROR: Module tda18271 is in use by: cx23885
/sbin/rmmod rc_core
rmmod: ERROR: Module rc_core is in use by: cx23885
/sbin/rmmod tveeprom
rmmod: ERROR: Module tveeprom is in use by: cx23885
/sbin/rmmod media
rmmod: ERROR: Module media is in use by: videodev
/sbin/rmmod tda10071
rmmod: ERROR: Module tda10071 is in use
/sbin/rmmod cx23885
rmmod: ERROR: Module cx23885 is in use
/sbin/rmmod videobuf2_dvb
rmmod: ERROR: Module videobuf2_dvb is in use by: cx23885
/sbin/rmmod videobuf2_core
rmmod: ERROR: Module videobuf2_core is in use by: cx23885 videobuf2_dvb
/sbin/rmmod tuner
rmmod: ERROR: Module tuner is in use
/sbin/rmmod cx2341x
rmmod: ERROR: Module 

Re: [BUG] Hauppage HVR-2250 - No Free Sequences

2014-12-20 Thread Kyle Sanderson
[891338.817585] s5h1411_readreg: readreg error (ret == -5)
[891338.817591] saa7164_cmd_send() No free sequences
[891338.817594] saa7164_api_i2c_read() error, ret(1) = 0xc
[891338.817597] s5h1411_readreg: readreg error (ret == -5)
[891338.817602] saa7164_cmd_send() No free sequences
[891338.817604] saa7164_api_i2c_write() error, ret(1) = 0xc
[891338.817607] s5h1411_writereg: writereg error 0x19 0xf7 0x, ret == -5)
[891338.817611] saa7164_cmd_send() No free sequences
[891338.817613] saa7164_api_i2c_write() error, ret(1) = 0xc
[891338.817615] s5h1411_writereg: writereg error 0x19 0xf7 0x0001, ret == -5)
[891338.817619] saa7164_cmd_send() No free sequences
[891338.817621] saa7164_api_i2c_write() error, ret(1) = 0xc
[891338.817624] s5h1411_writereg: writereg error 0x19 0xf5 0x0001, ret == -5)
[891338.817628] saa7164_cmd_send() No free sequences
[891338.817630] saa7164_api_i2c_write() error, ret(1) = 0xc
[891338.817634] __tda18271_write_regs: [3-0060|S] ERROR: idx = 0x5,
len = 1, i2c_transfer returned: -5
[891338.817637] tda18271_init: [3-0060|S] error -5 on line 832
[891338.817640] tda18271_tune: [3-0060|S] error -5 on line 910
[891338.817643] tda18271_set_params: [3-0060|S] error -5 on line 985
[891338.817647] saa7164_cmd_send() No free sequences
[891338.817649] saa7164_api_i2c_write() error, ret(1) = 0xc
[891338.817651] s5h1411_writereg: writereg error 0x19 0xf5 0x, ret == -5)
[891338.817655] saa7164_cmd_send() No free sequences
[891338.817657] saa7164_api_i2c_write() error, ret(1) = 0xc
[891338.817659] s5h1411_writereg: writereg error 0x19 0xf7 0x, ret == -5)
[891338.817663] saa7164_cmd_send() No free sequences
[891338.817664] saa7164_api_i2c_write() error, ret(1) = 0xc
[891338.817667] s5h1411_writereg: writereg error 0x19 0xf7 0x0001, ret == -5)
[891338.846673] saa7164_cmd_send() No free sequences
[891338.846678] saa7164_api_i2c_read() error, ret(1) = 0xc
[891338.846682] s5h1411_readreg: readreg error (ret == -5)
[891338.846686] saa7164_cmd_send() No free sequences


Definitely out of ideas at this point. Any tips?
Kyle.

On Sat, Dec 6, 2014 at 11:07 AM, Kyle Sanderson kyle.l...@gmail.com wrote:
 [1627538.860627] s5h1411_readreg: readreg error (ret == -5)
 [1627538.860633] saa7164_cmd_send() No free sequences
 [1627538.860636] saa7164_api_i2c_read() error, ret(1) = 0xc
 [1627538.860639] s5h1411_readreg: readreg error (ret == -5)
 [1627538.860647] saa7164_cmd_send() No free sequences
 [1627538.860649] saa7164_api_i2c_write() error, ret(1) = 0xc
 [1627538.860652] s5h1411_writereg: writereg error 0x19 0xf7 0x, ret == -5)
 [1627538.860656] saa7164_cmd_send() No free sequences
 [1627538.860658] saa7164_api_i2c_write() error, ret(1) = 0xc
 [1627538.860661] s5h1411_writereg: writereg error 0x19 0xf7 0x0001, ret == -5)
 [1627538.860665] saa7164_cmd_send() No free sequences
 [1627538.860666] saa7164_api_i2c_write() error, ret(1) = 0xc
 [1627538.860669] s5h1411_writereg: writereg error 0x19 0xf5 0x0001, ret == -5)
 [1627538.860675] saa7164_cmd_send() No free sequences
 [1627538.860676] saa7164_api_i2c_write() error, ret(1) = 0xc
 [1627538.860681] __tda18271_write_regs: [2-0060|M] ERROR: idx = 0x5,
 len = 1, i2
  c_transfer returned:
 -5
 [1627538.860685] tda18271_init: [2-0060|M] error -5 on line 832
 [1627538.860688] tda18271_tune: [2-0060|M] error -5 on line 910
 [1627538.860691] tda18271_set_params: [2-0060|M] error -5 on line 985
 [1627538.860695] saa7164_cmd_send() No free sequences
 [1627538.860696] saa7164_api_i2c_write() error, ret(1) = 0xc
 [1627538.860699] s5h1411_writereg: writereg error 0x19 0xf5 0x, ret == -5)
 [1627538.860703] saa7164_cmd_send() No free sequences
 [1627538.860704] saa7164_api_i2c_write() error, ret(1) = 0xc
 [1627538.860707] s5h1411_writereg: writereg error 0x19 0xf7 0x, ret == -5)
 [1627538.860710] saa7164_cmd_send() No free sequences
 [1627538.860712] saa7164_api_i2c_write() error, ret(1) = 0xc
 [1627538.860714] s5h1411_writereg: writereg error 0x19 0xf7 0x0001, ret == -5)
 [1627538.878939] saa7164_cmd_send() No free sequences
 [1627538.878942] saa7164_api_i2c_read() error, ret(1) = 0xc
 [1627538.878944] s5h1411_readreg: readreg error (ret == -5)
 [1627538.878947] saa7164_cmd_send() No free sequences
 [1627538.878949] saa7164_api_i2c_read() error, ret(1) = 0xc
 [1627538.878951] s5h1411_readreg: readreg error (ret == -5)
 [1627538.929029] saa7164_cmd_send() No free sequences
 [1627538.929031] saa7164_api_i2c_read() error, ret(1) = 0xc
 [1627538.929033] s5h1411_readreg: readreg error (ret == -5)
 [1627538.929037] saa7164_cmd_send() No free sequences
 [1627538.929038] saa7164_api_i2c_read() error, ret(1) = 0xc
 [1627538.929040] s5h1411_readreg: readreg error (ret == -5)
 [1627538.979118] saa7164_cmd_send() No free sequences
 [1627538.979120] saa7164_api_i2c_read() error, ret(1) = 0xc
 [1627538.979123] s5h1411_readreg: readreg error (ret == -5)
 [1627538.979126] saa7164_cmd_send() No free sequences
 [1627538.979128] 

Re: [PATCH/RFC] v4l: vsp1: Add format for Mem2Mem Playback

2014-12-20 Thread Laurent Pinchart
Hello Kaneko-san,

Thank you for the patch.


On Saturday 20 December 2014 23:16:03 Yoshihiro Kaneko wrote:
 From: Hiroki Negishi hiroki.negishi...@hitachi-solutions.com
 
 Signed-off-by: Hiroki Negishi hiroki.negishi...@hitachi-solutions.com
 Signed-off-by: Yoshifumi Hosoya yoshifumi.hosoya...@renesas.com
 Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
 ---
 
 This patch is based on the master branch of linuxtv.org/media_tree.git.
 
  drivers/media/platform/vsp1/vsp1_video.c | 3 +++
  include/uapi/linux/videodev2.h   | 3 +++
  2 files changed, 6 insertions(+)
 
 diff --git a/drivers/media/platform/vsp1/vsp1_video.c
 b/drivers/media/platform/vsp1/vsp1_video.c index e512336..9bbc02a 100644
 --- a/drivers/media/platform/vsp1/vsp1_video.c
 +++ b/drivers/media/platform/vsp1/vsp1_video.c
 @@ -130,6 +130,9 @@ static const struct vsp1_format_info
 vsp1_video_formats[] = { VI6_FMT_Y_U_V_420, VI6_RPF_DSWAP_P_LLS |
 VI6_RPF_DSWAP_P_LWS | VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
 3, { 8, 8, 8 }, false, false, 2, 2, false },
 + { V4L2_PIX_FMT_RGB32S, MEDIA_BUS_FMT_ARGB_1X32,
 +   VI6_FMT_ARGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
 +   1, { 32, 0, 0 }, false, false, 1, 1, false },
  };
 
  /*
 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
 index d279c1b..f22e167 100644
 --- a/include/uapi/linux/videodev2.h
 +++ b/include/uapi/linux/videodev2.h
 @@ -396,6 +396,9 @@ struct v4l2_pix_format {
  #define V4L2_PIX_FMT_ARGB32  v4l2_fourcc('B', 'A', '2', '4') /* 32 
 ARGB-8-8-8-8  */ #define V4L2_PIX_FMT_XRGB32  v4l2_fourcc('B', 'X', '2',
 '4') /* 32  XRGB-8-8-8-8  */
 
 +/* RGB formats for memory output */
 +#define V4L2_PIX_FMT_RGB32S  v4l2_fourcc('R', 'G', '4', 'S') /* 32
 RGB-8-8-8-8 */ +

When adding a new format V4L2 also requires a documentation update to describe 
the format. I assume your format falls in the category of packed RGB formats, 
could you thus please update Documentation/DocBook/media/v4l/pixfmt-packed-
rgb.xml in this patch as well ?

  /* Grey formats */
  #define V4L2_PIX_FMT_GREYv4l2_fourcc('G', 'R', 'E', 'Y') /*  8 
 Greyscale */ #define V4L2_PIX_FMT_Y4  v4l2_fourcc('Y', '0', '4', '
 ') /*  4  Greyscale */

-- 
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: [RFC PATCH 5/8] media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER

2014-12-20 Thread Laurent Pinchart
Hi Hans,

On Friday 19 December 2014 13:21:29 Hans Verkuil wrote:
 On 12/19/2014 01:18 PM, Laurent Pinchart wrote:
  On Friday 19 December 2014 12:44:46 Hans Verkuil wrote:
  On 12/08/2014 12:38 AM, Laurent Pinchart wrote:
  On Thursday 04 December 2014 10:54:56 Hans Verkuil wrote:
  From: Hans Verkuil hans.verk...@cisco.com
  
  These drivers depend on VIDEO_V4L2_SUBDEV_API, which in turn
  depends on MEDIA_CONTROLLER. So it is sufficient to just depend
  on VIDEO_V4L2_SUBDEV_API.
  
  Shouldn't the VIDEO_V4L2_SUBDEV_API dependency be dropped from those
  (and other) subdev drivers ? They don't require the userspace API, just
  the kernel part.
  
  They set V4L2_SUBDEV_FL_HAS_DEVNODE and use v4l2_subdev_get_try_format,
  so they do need VIDEO_V4L2_SUBDEV_API. Or am I missing something?
  
  VIDEO_V4L2_SUBDEV_API was initially designed to cover both the subdev
  userspace API and the subdev in-kernel pad-level API. Now that the latter
  has been found useful without the former, I think we should revisit the
  idea.
  
  Does it still make sense to have a single Kconfig option to cover both
  concepts ? Should it be kept a-is, split in two, or redefined to cover the
  userspace API only (with the v4l2_subdev_get_try_* functions being then
  always available) ? As the idea is to standardize on pad-level operations
  for in- kernel communication between bridges and subdevs the
  v4l2_subdev_get_try_* functions will get increasingly used in most (if
  not all) subdev drivers.

 OK, but if you don't mind I would make such changes in a separate patch.

Sure. I sometimes think one step ahead :-) We can certainly fix that in a 
separate patch or patch series.

What's your opinion regarding repurposing or splitting 
CONFIG_VIDEO_V4L2_SUBDEV_API ?

 This patch just removes an obviously superfluous dependency and brings these
 drivers in line with the others.
 
 Removing it altogether is a separate issue.

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


[PATCH] media: pci: cx18: cx18-alsa-mixer.c: Remove some unused functions

2014-12-20 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
snd_cx18_mixer_tv_vol_get() snd_cx18_mixer_tv_vol_info() 
snd_cx18_mixer_tv_vol_put()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
---
 drivers/media/pci/cx18/cx18-alsa-mixer.c |   62 --
 1 file changed, 62 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-alsa-mixer.c 
b/drivers/media/pci/cx18/cx18-alsa-mixer.c
index 341bddc..e7b0a1f 100644
--- a/drivers/media/pci/cx18/cx18-alsa-mixer.c
+++ b/drivers/media/pci/cx18/cx18-alsa-mixer.c
@@ -69,68 +69,6 @@ static inline int cx18_av_vol_to_dB(int v)
return (v  9) - 119;
 }
 
-static int snd_cx18_mixer_tv_vol_info(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_info *uinfo)
-{
-   uinfo-type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-   uinfo-count = 1;
-   /* We're already translating values, just keep this control in dB */
-   uinfo-value.integer.min  = -96;
-   uinfo-value.integer.max  =   8;
-   uinfo-value.integer.step =   1;
-   return 0;
-}
-
-static int snd_cx18_mixer_tv_vol_get(struct snd_kcontrol *kctl,
-struct snd_ctl_elem_value *uctl)
-{
-   struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
-   struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-   struct v4l2_control vctrl;
-   int ret;
-
-   vctrl.id = V4L2_CID_AUDIO_VOLUME;
-   vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-
-   snd_cx18_lock(cxsc);
-   ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-   snd_cx18_unlock(cxsc);
-
-   if (!ret)
-   uctl-value.integer.value[0] = cx18_av_vol_to_dB(vctrl.value);
-   return ret;
-}
-
-static int snd_cx18_mixer_tv_vol_put(struct snd_kcontrol *kctl,
-struct snd_ctl_elem_value *uctl)
-{
-   struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
-   struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-   struct v4l2_control vctrl;
-   int ret;
-
-   vctrl.id = V4L2_CID_AUDIO_VOLUME;
-   vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-
-   snd_cx18_lock(cxsc);
-
-   /* Fetch current state */
-   ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-
-   if (ret ||
-   (cx18_av_vol_to_dB(vctrl.value) != uctl-value.integer.value[0])) {
-
-   /* Set, if needed */
-   vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-   ret = v4l2_subdev_call(cx-sd_av, core, s_ctrl, vctrl);
-   if (!ret)
-   ret = 1; /* Indicate control was changed w/o error */
-   }
-   snd_cx18_unlock(cxsc);
-
-   return ret;
-}
-
 
 /* This is a bit of overkill, the slider is already in dB internally */
 static DECLARE_TLV_DB_SCALE(snd_cx18_mixer_tv_vol_db_scale, -9600, 100, 0);
-- 
1.7.10.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


[PATCHv2 1/2] regmap: add configurable lock class key for lockdep

2014-12-20 Thread Antti Palosaari
Lockdep validator complains recursive locking and deadlock when two
different regmap instances are called in a nested order, as regmap
groups locks by default. That happens easily for example when both
I2C client and I2C adapter are using regmap. As a solution, add
configuration option to pass custom lock class key for lockdep
validator.

Here is example schema, where nested regmap calls are issued, when
more than 1 block uses regmap.
 __ ___ ___
|  USB IF  |   |   demod   |   |   tuner   |
|--|   |---|   |---|
|  |--I2C--|-/ |--I2C--|   |
|I2C master|   |  I2C mux  |   | I2C slave |
|__|   |___|   |___|

Cc: Lars-Peter Clausen l...@metafoo.de
Cc: Mark Brown broo...@kernel.org
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/base/regmap/regmap.c | 3 +++
 include/linux/regmap.h   | 5 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index d2f8a81..56064d3 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -559,6 +559,9 @@ struct regmap *regmap_init(struct device *dev,
mutex_init(map-mutex);
map-lock = regmap_lock_mutex;
map-unlock = regmap_unlock_mutex;
+   if (config-lockdep_lock_class_key)
+   lockdep_set_class(map-mutex,
+ 
config-lockdep_lock_class_key);
}
map-lock_arg = map;
}
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index c5ed83f..f930370 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -134,6 +134,10 @@ typedef void (*regmap_unlock)(void *);
  * @lock_arg:this field is passed as the only argument of lock/unlock
  *   functions (ignored in case regular lock/unlock functions
  *   are not overridden).
+ * @lock_class_key: Custom lock class key for lockdep validator. Use that when
+ *regmap in question is used for bus master IO in order to 
avoid
+ *false lockdep nested locking warning. Valid only when regmap
+ *default mutex locking is used.
  * @reg_read:Optional callback that if filled will be used to perform
  *   all the reads from the registers. Should only be provided for
  *   devices whose read operation cannot be represented as a simple
@@ -197,6 +201,7 @@ struct regmap_config {
regmap_lock lock;
regmap_unlock unlock;
void *lock_arg;
+   struct lock_class_key *lockdep_lock_class_key;
 
int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
int (*reg_write)(void *context, unsigned int reg, unsigned int val);
-- 
http://palosaari.fi/

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


[PATCHv2 2/2] rtl2832: use custom lock class key for regmap

2014-12-20 Thread Antti Palosaari
There was nested locking error shown by lockdep validator when both
demod and tuner drivers were using regmap. That is false positive
coming from the reason lockdep groups mutexes to 'classes'. That
leads situation both tuner driver and demod driver regmap mutex is
seen as a same mutex, even those are different ones in a real life.
Lockdep uses keys to separate these clock classes. Use custom class
key to demod regmap in order to separate it from mutex used by tuner
regmap, thus seen it as a different lock also from lockdep point of
view.

Cc: Lars-Peter Clausen l...@metafoo.de
Cc: Mark Brown broo...@kernel.org
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/rtl2832.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/dvb-frontends/rtl2832.c 
b/drivers/media/dvb-frontends/rtl2832.c
index f44dc50..6cfe5b6 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -1186,6 +1186,7 @@ static int rtl2832_probe(struct i2c_client *client,
.range_max= 5 * 0x100,
},
};
+   static struct lock_class_key key;
static const struct regmap_config regmap_config = {
.reg_bits=  8,
.val_bits=  8,
@@ -1194,6 +1195,7 @@ static int rtl2832_probe(struct i2c_client *client,
.ranges = regmap_range_cfg,
.num_ranges = ARRAY_SIZE(regmap_range_cfg),
.cache_type = REGCACHE_RBTREE,
+   .lockdep_lock_class_key = key,
};
 
dev_dbg(client-dev, \n);
-- 
http://palosaari.fi/

--
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][PATCH] mn88472: add support for the mn88473 demod

2014-12-20 Thread Benjamin Larsson
Factor out the bw_val data to a table and load data from it
depending on the configured demod.

Signed-off-by: Benjamin Larsson benja...@southpole.se
---
 drivers/media/dvb-frontends/mn88472.h| 30 +
 drivers/staging/media/mn88472/mn88472.c  | 66 ++--
 drivers/staging/media/mn88472/mn88472_priv.h |  1 +
 3 files changed, 64 insertions(+), 33 deletions(-)

diff --git a/drivers/media/dvb-frontends/mn88472.h 
b/drivers/media/dvb-frontends/mn88472.h
index f0fdc7e..0016f7b 100644
--- a/drivers/media/dvb-frontends/mn88472.h
+++ b/drivers/media/dvb-frontends/mn88472.h
@@ -29,6 +29,35 @@ enum ts_mode {
PARALLEL_TS_MODE,
 };
 
+enum model {
+   MODEL_MN88472,
+   MODEL_MN88473,
+   MODEL_MAX,
+};
+
+enum bw_modes {
+   BW_5MHZ,
+   BW_6MHZ,
+   BW_7MHZ,
+   BW_8MHZ,
+   BW_MODE_MAX,
+};
+
+/* close to y=freq*4.5714285 */
+static u32 ad_frequency_factor[BW_MODE_MAX] = {
+   0x15CC5B6,  /* 5MHz */
+   0x1A286DC,  /* 6MHz */
+   0x1E84800,  /* 7MHz */
+   0x22E0925,  /* 8MHz */
+};
+
+static u8 bw_param[MODEL_MAX][BW_MODE_MAX][2] = {
+   { { 0x1b, 0xa9 }, { 0x00, 0x00 } }, /* 5MHz */
+   { { 0x15, 0x6b }, { 0x1c, 0x29 } }, /* 6MHz */
+   { { 0x0f, 0x2c }, { 0x17, 0x0a } }, /* 7MHz */
+   { { 0x08, 0xee }, { 0x11, 0xec } }, /* 8MHz */
+};
+
 struct mn88472_config {
/*
 * Max num of bytes given I2C adapter could write at once.
@@ -53,6 +82,7 @@ struct mn88472_config {
u32 xtal;
int ts_mode;
int ts_clock;
+   int model;
 };
 
 #endif
diff --git a/drivers/staging/media/mn88472/mn88472.c 
b/drivers/staging/media/mn88472/mn88472.c
index 8b35639..77ed941 100644
--- a/drivers/staging/media/mn88472/mn88472.c
+++ b/drivers/staging/media/mn88472/mn88472.c
@@ -28,10 +28,10 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
struct i2c_client *client = fe-demodulator_priv;
struct mn88472_dev *dev = i2c_get_clientdata(client);
struct dtv_frontend_properties *c = fe-dtv_property_cache;
-   int ret, i;
+   int ret, i, bw;
u64 tmp;
-   u8 delivery_system_val, if_val[3], bw_val[7], bw_val2;
+   u8 delivery_system_val, if_val[3], ad_val[3], bw_val2;
 
dev_dbg(client-dev, %s:\n, __func__);
dev_dbg(client-dev,
@@ -59,35 +59,20 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
goto err;
}
 
-   switch (c-delivery_system) {
-   case SYS_DVBT:
-   case SYS_DVBT2:
-   if (c-bandwidth_hz = 500) {
-   memcpy(bw_val, \xe5\x99\x9a\x1b\xa9\x1b\xa9, 7);
-   bw_val2 = 0x03;
-   } else if (c-bandwidth_hz = 600) {
-   /* IF 357 Hz, BW 600 Hz */
-   memcpy(bw_val, \xbf\x55\x55\x15\x6b\x15\x6b, 7);
-   bw_val2 = 0x02;
-   } else if (c-bandwidth_hz = 700) {
-   /* IF 457 Hz, BW 700 Hz */
-   memcpy(bw_val, \xa4\x00\x00\x0f\x2c\x0f\x2c, 7);
-   bw_val2 = 0x01;
-   } else if (c-bandwidth_hz = 800) {
-   /* IF 457 Hz, BW 800 Hz */
-   memcpy(bw_val, \x8f\x80\x00\x08\xee\x08\xee, 7);
-   bw_val2 = 0x00;
-   } else {
-   ret = -EINVAL;
-   goto err;
-   }
-   break;
-   case SYS_DVBC_ANNEX_A:
-   /* IF 507 Hz, BW 800 Hz */
-   memcpy(bw_val, \x8f\x80\x00\x08\xee\x08\xee, 7);
+   /* bw related parameters */
+   if (c-bandwidth_hz = 500) {
+   bw = BW_5MHZ;
+   bw_val2 = 0x03;
+   } else if (c-bandwidth_hz = 600) {
+   bw = BW_6MHZ;
+   bw_val2 = 0x02;
+   } else if (c-bandwidth_hz = 700) {
+   bw = BW_7MHZ;
+   bw_val2 = 0x01;
+   } else if (c-bandwidth_hz = 800) {
+   bw = BW_8MHZ;
bw_val2 = 0x00;
-   break;
-   default:
+   } else {
ret = -EINVAL;
goto err;
}
@@ -114,6 +99,14 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
if_val[1] = ((tmp   8)  0xff);
if_val[2] = ((tmp   0)  0xff);
 
+   /* Calculate A/D frequency registers (Xtal * ad_freq_fac) */
+   tmp =  div_u64(dev-xtal * (u64)(124) +
+((dev-xtal * (u64)(124))/ 2),
+  ad_frequency_factor[bw] );
+   ad_val[0] = ((tmp  16)  0xff);
+   ad_val[1] = ((tmp   8)  0xff);
+   ad_val[2] = ((tmp   0)  0xff);
+
ret = regmap_write(dev-regmap[2], 0xfb, 0x13);
ret = regmap_write(dev-regmap[2], 0xef, 0x13);
ret = regmap_write(dev-regmap[2], 0xf9, 0x13);
@@ -142,12 +135,19 @@ static int 

Re: [RFC][PATCH] mn88472: add support for the mn88473 demod

2014-12-20 Thread Benjamin Larsson
This is what mn88473 support in the mn88472 demod driver could look 
like. The code is untested but will look similar in the final version. 
It is also possible to let the driver figure out the demod version from 
the 0xff register. Then the users would not need to set that parameter. 
Same goes to the xtal parameter.


So does the mn88473 support look ok and should the driver figure out 
what demod is connected ?


MvH
Benjamin Larsson
--
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: pci: cx18: cx18-alsa-mixer.c: Remove some unused functions

2014-12-20 Thread Andy Walls
On December 20, 2014 5:35:17 PM EST, Rickard Strandqvist 
rickard_strandqv...@spectrumdigital.se wrote:
Removes some functions that are not used anywhere:
snd_cx18_mixer_tv_vol_get() snd_cx18_mixer_tv_vol_info()
snd_cx18_mixer_tv_vol_put()

This was partially found by using a static code analysis program called
cppcheck.

Signed-off-by: Rickard Strandqvist
rickard_strandqv...@spectrumdigital.se
---
drivers/media/pci/cx18/cx18-alsa-mixer.c |   62
--
 1 file changed, 62 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-alsa-mixer.c
b/drivers/media/pci/cx18/cx18-alsa-mixer.c
index 341bddc..e7b0a1f 100644
--- a/drivers/media/pci/cx18/cx18-alsa-mixer.c
+++ b/drivers/media/pci/cx18/cx18-alsa-mixer.c
@@ -69,68 +69,6 @@ static inline int cx18_av_vol_to_dB(int v)
   return (v  9) - 119;
 }
 
-static int snd_cx18_mixer_tv_vol_info(struct snd_kcontrol *kcontrol,
-struct snd_ctl_elem_info *uinfo)
-{
-  uinfo-type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-  uinfo-count = 1;
-  /* We're already translating values, just keep this control in dB */
-  uinfo-value.integer.min  = -96;
-  uinfo-value.integer.max  =   8;
-  uinfo-value.integer.step =   1;
-  return 0;
-}
-
-static int snd_cx18_mixer_tv_vol_get(struct snd_kcontrol *kctl,
-   struct snd_ctl_elem_value *uctl)
-{
-  struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
-  struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-  struct v4l2_control vctrl;
-  int ret;
-
-  vctrl.id = V4L2_CID_AUDIO_VOLUME;
-  vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-
-  snd_cx18_lock(cxsc);
-  ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-  snd_cx18_unlock(cxsc);
-
-  if (!ret)
-  uctl-value.integer.value[0] = cx18_av_vol_to_dB(vctrl.value);
-  return ret;
-}
-
-static int snd_cx18_mixer_tv_vol_put(struct snd_kcontrol *kctl,
-   struct snd_ctl_elem_value *uctl)
-{
-  struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
-  struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-  struct v4l2_control vctrl;
-  int ret;
-
-  vctrl.id = V4L2_CID_AUDIO_VOLUME;
-  vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-
-  snd_cx18_lock(cxsc);
-
-  /* Fetch current state */
-  ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-
-  if (ret ||
-  (cx18_av_vol_to_dB(vctrl.value) != uctl-value.integer.value[0]))
{
-
-  /* Set, if needed */
-  vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-  ret = v4l2_subdev_call(cx-sd_av, core, s_ctrl, vctrl);
-  if (!ret)
-  ret = 1; /* Indicate control was changed w/o error */
-  }
-  snd_cx18_unlock(cxsc);
-
-  return ret;
-}
-
 
/* This is a bit of overkill, the slider is already in dB internally */
static DECLARE_TLV_DB_SCALE(snd_cx18_mixer_tv_vol_db_scale, -9600, 100,
0);

Really?  Did you try to compile the file after this patch?

http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/pci/cx18/cx18-alsa-mixer.c#n143

They are referenced later in the same file.

This is only half a fix.

 You can either remove the cx18-alsa-mixer.* files and from the build system, 
or even better,you can hook-up and initialize these callbacks with alsa so alsa 
mixer controls show up for cx18.  :)

-Andy
--
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: pci: cx18: cx18-alsa-mixer.c: Remove some unused functions

2014-12-20 Thread Rickard Strandqvist
2014-12-21 1:06 GMT+01:00 Andy Walls awa...@md.metrocast.net:
 On December 20, 2014 5:35:17 PM EST, Rickard Strandqvist 
 rickard_strandqv...@spectrumdigital.se wrote:
Removes some functions that are not used anywhere:
snd_cx18_mixer_tv_vol_get() snd_cx18_mixer_tv_vol_info()
snd_cx18_mixer_tv_vol_put()

This was partially found by using a static code analysis program called
cppcheck.

Signed-off-by: Rickard Strandqvist
rickard_strandqv...@spectrumdigital.se
---
drivers/media/pci/cx18/cx18-alsa-mixer.c |   62
--
 1 file changed, 62 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-alsa-mixer.c
b/drivers/media/pci/cx18/cx18-alsa-mixer.c
index 341bddc..e7b0a1f 100644
--- a/drivers/media/pci/cx18/cx18-alsa-mixer.c
+++ b/drivers/media/pci/cx18/cx18-alsa-mixer.c
@@ -69,68 +69,6 @@ static inline int cx18_av_vol_to_dB(int v)
   return (v  9) - 119;
 }

-static int snd_cx18_mixer_tv_vol_info(struct snd_kcontrol *kcontrol,
-struct snd_ctl_elem_info *uinfo)
-{
-  uinfo-type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-  uinfo-count = 1;
-  /* We're already translating values, just keep this control in dB */
-  uinfo-value.integer.min  = -96;
-  uinfo-value.integer.max  =   8;
-  uinfo-value.integer.step =   1;
-  return 0;
-}
-
-static int snd_cx18_mixer_tv_vol_get(struct snd_kcontrol *kctl,
-   struct snd_ctl_elem_value *uctl)
-{
-  struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
-  struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-  struct v4l2_control vctrl;
-  int ret;
-
-  vctrl.id = V4L2_CID_AUDIO_VOLUME;
-  vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-
-  snd_cx18_lock(cxsc);
-  ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-  snd_cx18_unlock(cxsc);
-
-  if (!ret)
-  uctl-value.integer.value[0] = cx18_av_vol_to_dB(vctrl.value);
-  return ret;
-}
-
-static int snd_cx18_mixer_tv_vol_put(struct snd_kcontrol *kctl,
-   struct snd_ctl_elem_value *uctl)
-{
-  struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
-  struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-  struct v4l2_control vctrl;
-  int ret;
-
-  vctrl.id = V4L2_CID_AUDIO_VOLUME;
-  vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-
-  snd_cx18_lock(cxsc);
-
-  /* Fetch current state */
-  ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-
-  if (ret ||
-  (cx18_av_vol_to_dB(vctrl.value) != uctl-value.integer.value[0]))
{
-
-  /* Set, if needed */
-  vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-  ret = v4l2_subdev_call(cx-sd_av, core, s_ctrl, vctrl);
-  if (!ret)
-  ret = 1; /* Indicate control was changed w/o error */
-  }
-  snd_cx18_unlock(cxsc);
-
-  return ret;
-}
-

/* This is a bit of overkill, the slider is already in dB internally */
static DECLARE_TLV_DB_SCALE(snd_cx18_mixer_tv_vol_db_scale, -9600, 100,
0);

 Really?  Did you try to compile the file after this patch?

 http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/pci/cx18/cx18-alsa-mixer.c#n143

 They are referenced later in the same file.

 This is only half a fix.

  You can either remove the cx18-alsa-mixer.* files and from the build system, 
 or even better,you can hook-up and initialize these callbacks with alsa so 
 alsa mixer controls show up for cx18.  :)




Hi

Ok sorry :-(

Sure, I compile everything as allyesconfig, allmodconfig and allnoconfig.

So snd_cx18_mixer_tv_volume_info is the same as snd_cx18_mixer_tv_vol_info then.

Would gladly done something a little more concrete.
But first I want to see if as I can go through all of the
approximately 2000 functions that are not in use.


Kind regards
Rickard Strandqvist
--
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: pci: cx18: cx18-alsa-mixer.c: Remove some unused functions

2014-12-20 Thread Andy Walls
On December 20, 2014 8:17:05 PM EST, Rickard Strandqvist 
rickard_strandqv...@spectrumdigital.se wrote:
2014-12-21 1:06 GMT+01:00 Andy Walls awa...@md.metrocast.net:
 On December 20, 2014 5:35:17 PM EST, Rickard Strandqvist
rickard_strandqv...@spectrumdigital.se wrote:
Removes some functions that are not used anywhere:
snd_cx18_mixer_tv_vol_get() snd_cx18_mixer_tv_vol_info()
snd_cx18_mixer_tv_vol_put()

This was partially found by using a static code analysis program
called
cppcheck.

Signed-off-by: Rickard Strandqvist
rickard_strandqv...@spectrumdigital.se
---
drivers/media/pci/cx18/cx18-alsa-mixer.c |   62
--
 1 file changed, 62 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-alsa-mixer.c
b/drivers/media/pci/cx18/cx18-alsa-mixer.c
index 341bddc..e7b0a1f 100644
--- a/drivers/media/pci/cx18/cx18-alsa-mixer.c
+++ b/drivers/media/pci/cx18/cx18-alsa-mixer.c
@@ -69,68 +69,6 @@ static inline int cx18_av_vol_to_dB(int v)
   return (v  9) - 119;
 }

-static int snd_cx18_mixer_tv_vol_info(struct snd_kcontrol *kcontrol,
-struct snd_ctl_elem_info *uinfo)
-{
-  uinfo-type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-  uinfo-count = 1;
-  /* We're already translating values, just keep this control in
dB */
-  uinfo-value.integer.min  = -96;
-  uinfo-value.integer.max  =   8;
-  uinfo-value.integer.step =   1;
-  return 0;
-}
-
-static int snd_cx18_mixer_tv_vol_get(struct snd_kcontrol *kctl,
-   struct snd_ctl_elem_value *uctl)
-{
-  struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
-  struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-  struct v4l2_control vctrl;
-  int ret;
-
-  vctrl.id = V4L2_CID_AUDIO_VOLUME;
-  vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-
-  snd_cx18_lock(cxsc);
-  ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-  snd_cx18_unlock(cxsc);
-
-  if (!ret)
-  uctl-value.integer.value[0] =
cx18_av_vol_to_dB(vctrl.value);
-  return ret;
-}
-
-static int snd_cx18_mixer_tv_vol_put(struct snd_kcontrol *kctl,
-   struct snd_ctl_elem_value *uctl)
-{
-  struct snd_cx18_card *cxsc = snd_kcontrol_chip(kctl);
-  struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-  struct v4l2_control vctrl;
-  int ret;
-
-  vctrl.id = V4L2_CID_AUDIO_VOLUME;
-  vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-
-  snd_cx18_lock(cxsc);
-
-  /* Fetch current state */
-  ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-
-  if (ret ||
-  (cx18_av_vol_to_dB(vctrl.value) !=
uctl-value.integer.value[0]))
{
-
-  /* Set, if needed */
-  vctrl.value =
dB_to_cx18_av_vol(uctl-value.integer.value[0]);
-  ret = v4l2_subdev_call(cx-sd_av, core, s_ctrl,
vctrl);
-  if (!ret)
-  ret = 1; /* Indicate control was changed w/o
error */
-  }
-  snd_cx18_unlock(cxsc);
-
-  return ret;
-}
-

/* This is a bit of overkill, the slider is already in dB internally
*/
static DECLARE_TLV_DB_SCALE(snd_cx18_mixer_tv_vol_db_scale, -9600,
100,
0);

 Really?  Did you try to compile the file after this patch?


http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/pci/cx18/cx18-alsa-mixer.c#n143

 They are referenced later in the same file.

 This is only half a fix.

  You can either remove the cx18-alsa-mixer.* files and from the build
system, or even better,you can hook-up and initialize these callbacks
with alsa so alsa mixer controls show up for cx18.  :)




Hi

Ok sorry :-(

Sure, I compile everything as allyesconfig, allmodconfig and
allnoconfig.

So snd_cx18_mixer_tv_volume_info is the same as
snd_cx18_mixer_tv_vol_info then.

Would gladly done something a little more concrete.
But first I want to see if as I can go through all of the
approximately 2000 functions that are not in use.


Kind regards
Rickard Strandqvist

Yes they are supposed to be the same.  It is dead code with typographical 
errors. So it is probably not even in the Makefile.

Regards,
Andy
--
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


[RESEND PATCH] media: fix au0828_analog_register() to not free au0828_dev

2014-12-20 Thread Shuah Khan
au0828_analog_register() frees au0828_dev when it fails to
locate isoc endpoint. au0828_usb_probe() continues with dvb
and rc probe and registration assuming dev is still valid.
When au0828_analog_register() fails to locate isoc endpoint,
it should return without free'ing au0828_dev. Otherwise, the
probe will fail as dev is null when au0828_dvb_register() is
called.

Signed-off-by: Shuah Khan shua...@osg.samsung.com
---

Resending as the first one had malformed changelog

 drivers/media/usb/au0828/au0828-video.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/usb/au0828/au0828-video.c 
b/drivers/media/usb/au0828/au0828-video.c
index 3bdf132..94b65b8 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1713,7 +1713,6 @@ int au0828_analog_register(struct au0828_dev *dev,
}
if (!(dev-isoc_in_endpointaddr)) {
pr_info(Could not locate isoc endpoint\n);
-   kfree(dev);
return -ENODEV;
}
 
-- 
2.1.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


cron job: media_tree daily build: ERRORS

2014-12-20 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:   Sun Dec 21 04:00:16 CET 2014
git branch: test
git hash:   427ae153c65ad7a08288d86baf99000569627d03
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-41-g6c2d743
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.17-3.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: 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.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: 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-i686: OK
linux-3.17-i686: OK
linux-3.18-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: 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-x86_64: OK
linux-3.17-x86_64: OK
linux-3.18-x86_64: OK
apps: OK
spec-git: OK
sparse: ERRORS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.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