cron job: media_tree daily build: ERRORS

2014-03-05 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:   Wed  5 Mar 08:48:23 CET 2014
git branch: test
git hash:   59432be1c7fbf2a4f608850855ff649bee0f7b3b
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.12-6.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: WARNINGS
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: ERRORS
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: 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-i686: OK
linux-3.13-i686: OK
linux-3.14-rc1-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: 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-x86_64: OK
linux-3.13-x86_64: OK
linux-3.14-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse version: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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


[linuxtv-media:master 463/499] drivers/media/dvb-frontends/drx39xyj/drxj.c:20803 drx_ctrl_u_code() warn: variable dereferenced before check 'mc_info' (see line 20800)

2014-03-05 Thread Dan Carpenter
Hi Mauro,

FYI, there are new smatch warnings show up in

tree:   git://linuxtv.org/media_tree.git master
head:   59432be1c7fbf2a4f608850855ff649bee0f7b3b
commit: b240eacdd536bac23c9d48dfc3d527ed6870ddad [463/499] [media] drx-j: get 
rid of drx_driver.c

New smatch warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:20803 drx_ctrl_u_code() warn: 
variable dereferenced before check 'mc_info' (see line 20800)

Old smatch warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1218 mult32() warn: missing break? 
reassigning '*h'

git remote add linuxtv-media git://linuxtv.org/media_tree.git
git remote update linuxtv-media
git checkout b240eacdd536bac23c9d48dfc3d527ed6870ddad
vim +/mc_info +20803 drivers/media/dvb-frontends/drx39xyj/drxj.c

b240eacd Mauro Carvalho Chehab 2014-01-24  20794u16 i = 0;
b240eacd Mauro Carvalho Chehab 2014-01-24  20795u16 mc_nr_of_blks = 0;
b240eacd Mauro Carvalho Chehab 2014-01-24  20796u16 mc_magic_word = 0;
b240eacd Mauro Carvalho Chehab 2014-01-24  20797const u8 *mc_data_init 
= NULL;
b240eacd Mauro Carvalho Chehab 2014-01-24  20798u8 *mc_data = NULL;
b240eacd Mauro Carvalho Chehab 2014-01-24  20799unsigned size;
b240eacd Mauro Carvalho Chehab 2014-01-24 @20800char *mc_file = 
mc_info-mc_file;
b240eacd Mauro Carvalho Chehab 2014-01-24  20801  
b240eacd Mauro Carvalho Chehab 2014-01-24  20802/* Check arguments */
b240eacd Mauro Carvalho Chehab 2014-01-24 @20803if (!mc_info || 
!mc_file)
b240eacd Mauro Carvalho Chehab 2014-01-24  20804return -EINVAL;
b240eacd Mauro Carvalho Chehab 2014-01-24  20805  
b240eacd Mauro Carvalho Chehab 2014-01-24  20806if (!demod-firmware) {

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
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 v6 7/8] of: Document simplified graph binding for single port devices

2014-03-05 Thread Philipp Zabel
For simple devices with only one port, it can be made implicit.
The endpoint node can be a direct child of the device node.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 Documentation/devicetree/bindings/graph.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/graph.txt 
b/Documentation/devicetree/bindings/graph.txt
index 1a69c07..e496547 100644
--- a/Documentation/devicetree/bindings/graph.txt
+++ b/Documentation/devicetree/bindings/graph.txt
@@ -84,6 +84,14 @@ device {
 };
 };
 
+For devices with only a single port and a single endpoint, this can be further
+simplified by making the port implicit, and adding the endpoint node as a 
direct
+child of the device node.
+
+device {
+   endpoint { ... };
+};
+
 Links between endpoints
 ---
 
-- 
1.9.0.rc3

--
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 v6 1/8] [media] of: move graph helpers from drivers/media/v4l2-core to drivers/of

2014-03-05 Thread Philipp Zabel
This patch moves the parsing helpers used to parse connected graphs
in the device tree, like the video interface bindings documented in
Documentation/devicetree/bindings/media/video-interfaces.txt, from
drivers/media/v4l2-core/v4l2-of.c into drivers/of/base.c.

This allows to reuse the same parser code from outside the V4L2
framework, most importantly from display drivers.
The functions v4l2_of_get_next_endpoint, v4l2_of_get_remote_port,
and v4l2_of_get_remote_port_parent are moved. They are renamed to
of_graph_get_next_endpoint, of_graph_get_remote_port, and
of_graph_get_remote_port_parent, respectively.
Since there are not that many current users yet, switch all of
them to the new functions right away.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/i2c/adv7343.c   |   4 +-
 drivers/media/i2c/mt9p031.c   |   4 +-
 drivers/media/i2c/s5k5baf.c   |   3 +-
 drivers/media/i2c/tvp514x.c   |   3 +-
 drivers/media/i2c/tvp7002.c   |   3 +-
 drivers/media/platform/exynos4-is/fimc-is.c   |   6 +-
 drivers/media/platform/exynos4-is/media-dev.c |   3 +-
 drivers/media/platform/exynos4-is/mipi-csis.c |   3 +-
 drivers/media/v4l2-core/v4l2-of.c | 117 -
 drivers/of/base.c | 118 ++
 include/linux/of_graph.h  |  46 ++
 include/media/v4l2-of.h   |  25 +-
 12 files changed, 182 insertions(+), 153 deletions(-)
 create mode 100644 include/linux/of_graph.h

diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
index d4e15a6..9d38f7b 100644
--- a/drivers/media/i2c/adv7343.c
+++ b/drivers/media/i2c/adv7343.c
@@ -26,12 +26,12 @@
 #include linux/videodev2.h
 #include linux/uaccess.h
 #include linux/of.h
+#include linux/of_graph.h
 
 #include media/adv7343.h
 #include media/v4l2-async.h
 #include media/v4l2-device.h
 #include media/v4l2-ctrls.h
-#include media/v4l2-of.h
 
 #include adv7343_regs.h
 
@@ -410,7 +410,7 @@ adv7343_get_pdata(struct i2c_client *client)
if (!IS_ENABLED(CONFIG_OF) || !client-dev.of_node)
return client-dev.platform_data;
 
-   np = v4l2_of_get_next_endpoint(client-dev.of_node, NULL);
+   np = of_graph_get_next_endpoint(client-dev.of_node, NULL);
if (!np)
return NULL;
 
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index e5ddf47..192c4aa 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -21,6 +21,7 @@
 #include linux/module.h
 #include linux/of.h
 #include linux/of_gpio.h
+#include linux/of_graph.h
 #include linux/pm.h
 #include linux/regulator/consumer.h
 #include linux/slab.h
@@ -29,7 +30,6 @@
 #include media/mt9p031.h
 #include media/v4l2-ctrls.h
 #include media/v4l2-device.h
-#include media/v4l2-of.h
 #include media/v4l2-subdev.h
 
 #include aptina-pll.h
@@ -943,7 +943,7 @@ mt9p031_get_pdata(struct i2c_client *client)
if (!IS_ENABLED(CONFIG_OF) || !client-dev.of_node)
return client-dev.platform_data;
 
-   np = v4l2_of_get_next_endpoint(client-dev.of_node, NULL);
+   np = of_graph_get_next_endpoint(client-dev.of_node, NULL);
if (!np)
return NULL;
 
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 77e10e0..2d768ef 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -21,6 +21,7 @@
 #include linux/media.h
 #include linux/module.h
 #include linux/of_gpio.h
+#include linux/of_graph.h
 #include linux/regulator/consumer.h
 #include linux/slab.h
 
@@ -1855,7 +1856,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf 
*state, struct device *dev)
if (ret  0)
return ret;
 
-   node_ep = v4l2_of_get_next_endpoint(node, NULL);
+   node_ep = of_graph_get_next_endpoint(node, NULL);
if (!node_ep) {
dev_err(dev, no endpoint defined at node %s\n,
node-full_name);
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 83d85df..ca00117 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -36,6 +36,7 @@
 #include linux/module.h
 #include linux/v4l2-mediabus.h
 #include linux/of.h
+#include linux/of_graph.h
 
 #include media/v4l2-async.h
 #include media/v4l2-device.h
@@ -1068,7 +1069,7 @@ tvp514x_get_pdata(struct i2c_client *client)
if (!IS_ENABLED(CONFIG_OF) || !client-dev.of_node)
return client-dev.platform_data;
 
-   endpoint = v4l2_of_get_next_endpoint(client-dev.of_node, NULL);
+   endpoint = of_graph_get_next_endpoint(client-dev.of_node, NULL);
if (!endpoint)
return NULL;
 
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 912e1cc..c4e1e2c 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -30,6 +30,7 @@
 

[PATCH v6 3/8] of: Warn if of_graph_get_next_endpoint is called with the root node

2014-03-05 Thread Philipp Zabel
If of_graph_get_next_endpoint is given a parentless node instead of an
endpoint node, it is clearly a bug.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v5:
 - Added parentless previous endpoint's full name to warning
---
 drivers/of/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b2f223f..b5e690b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2028,8 +2028,8 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
of_node_put(node);
} else {
port = of_get_parent(prev);
-   if (!port)
-   /* Hm, has someone given us the root node ?... */
+   if (WARN_ONCE(!port, %s(): endpoint %s has no parent node\n,
+ __func__, prev-full_name))
return NULL;
 
/* Avoid dropping prev node refcount to 0. */
-- 
1.9.0.rc3

--
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 v6 4/8] of: Reduce indentation in of_graph_get_next_endpoint

2014-03-05 Thread Philipp Zabel
A 'return endpoint;' at the end of the (!prev) case allows to
reduce the indentation level of the (prev) case.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/of/base.c | 42 ++
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b5e690b..a8e47d3 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2026,32 +2026,34 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
pr_err(%s(): no endpoint nodes specified for %s\n,
   __func__, parent-full_name);
of_node_put(node);
-   } else {
-   port = of_get_parent(prev);
-   if (WARN_ONCE(!port, %s(): endpoint %s has no parent node\n,
- __func__, prev-full_name))
-   return NULL;
 
-   /* Avoid dropping prev node refcount to 0. */
-   of_node_get(prev);
-   endpoint = of_get_next_child(port, prev);
-   if (endpoint) {
-   of_node_put(port);
-   return endpoint;
-   }
+   return endpoint;
+   }
 
-   /* No more endpoints under this port, try the next one. */
-   do {
-   port = of_get_next_child(parent, port);
-   if (!port)
-   return NULL;
-   } while (of_node_cmp(port-name, port));
+   port = of_get_parent(prev);
+   if (WARN_ONCE(!port, %s(): endpoint %s has no parent node\n,
+ __func__, prev-full_name))
+   return NULL;
 
-   /* Pick up the first endpoint in this port. */
-   endpoint = of_get_next_child(port, NULL);
+   /* Avoid dropping prev node refcount to 0. */
+   of_node_get(prev);
+   endpoint = of_get_next_child(port, prev);
+   if (endpoint) {
of_node_put(port);
+   return endpoint;
}
 
+   /* No more endpoints under this port, try the next one. */
+   do {
+   port = of_get_next_child(parent, port);
+   if (!port)
+   return NULL;
+   } while (of_node_cmp(port-name, port));
+
+   /* Pick up the first endpoint in this port. */
+   endpoint = of_get_next_child(port, NULL);
+   of_node_put(port);
+
return endpoint;
 }
 EXPORT_SYMBOL(of_graph_get_next_endpoint);
-- 
1.9.0.rc3

--
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 v6 6/8] of: Implement simplified graph binding for single port devices

2014-03-05 Thread Philipp Zabel
For simple devices with only one port, it can be made implicit.
The endpoint node can be a direct child of the device node.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v5:
 - Unrolled for-loop in of_graph_get_remote_port_parent
---
 drivers/of/base.c | 42 +-
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 715144af..ffd0217 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2003,7 +2003,8 @@ int of_graph_parse_endpoint(const struct device_node 
*node,
 * It doesn't matter whether the two calls below succeed.
 * If they don't then the default value 0 is used.
 */
-   of_property_read_u32(port_node, reg, endpoint-port);
+   if (port_node  !of_node_cmp(port_node-name, port))
+   of_property_read_u32(port_node, reg, endpoint-port);
of_property_read_u32(node, reg, endpoint-id);
 
of_node_put(port_node);
@@ -2034,8 +2035,13 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
struct device_node *node;
/*
 * It's the first call, we have to find a port subnode
-* within this node or within an optional 'ports' node.
+* within this node or within an optional 'ports' node,
+* or at least a single endpoint.
 */
+   endpoint = of_get_child_by_name(parent, endpoint);
+   if (endpoint)
+   return endpoint;
+
node = of_get_child_by_name(parent, ports);
if (node)
parent = node;
@@ -2046,8 +2052,6 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
/* Found a port, get an endpoint. */
endpoint = of_get_next_child(port, NULL);
of_node_put(port);
-   } else {
-   endpoint = NULL;
}
 
if (!endpoint)
@@ -2062,6 +2066,10 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
if (WARN_ONCE(!port, %s(): endpoint %s has no parent node\n,
  __func__, prev-full_name))
return NULL;
+   if (port == parent) {
+   of_node_put(port);
+   return NULL;
+   }
 
/* Avoid dropping prev node refcount to 0. */
of_node_get(prev);
@@ -2097,18 +2105,21 @@ struct device_node *of_graph_get_remote_port_parent(
   const struct device_node *node)
 {
struct device_node *np;
-   unsigned int depth;
 
/* Get remote endpoint node. */
np = of_parse_phandle(node, remote-endpoint, 0);
+   if (!np)
+   return NULL;
 
-   /* Walk 3 levels up only if there is 'ports' node. */
-   for (depth = 3; depth  np; depth--) {
-   np = of_get_next_parent(np);
-   if (depth == 2  of_node_cmp(np-name, ports))
-   break;
-   }
-   return np;
+   np = of_get_next_parent(np);
+   if (!np || of_node_cmp(np-name, port) != 0)
+   return np;
+
+   np = of_get_next_parent(np);
+   if (!np || of_node_cmp(np-name, ports) != 0)
+   return np;
+
+   return of_get_next_parent(np);
 }
 EXPORT_SYMBOL(of_graph_get_remote_port_parent);
 
@@ -2127,6 +2138,11 @@ struct device_node *of_graph_get_remote_port(const 
struct device_node *node)
np = of_parse_phandle(node, remote-endpoint, 0);
if (!np)
return NULL;
-   return of_get_next_parent(np);
+   np = of_get_next_parent(np);
+   if (of_node_cmp(np-name, port)) {
+   of_node_put(np);
+   return NULL;
+   }
+   return np;
 }
 EXPORT_SYMBOL(of_graph_get_remote_port);
-- 
1.9.0.rc3

--
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 v6 8/8] of: Warn if of_graph_parse_endpoint is called with the root node

2014-03-05 Thread Philipp Zabel
If of_graph_parse_endpoint is given a parentless node instead of an
endpoint node, it is clearly a bug.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/of/base.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index ffd0217..75de6bd 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1996,6 +1996,9 @@ int of_graph_parse_endpoint(const struct device_node 
*node,
 {
struct device_node *port_node = of_get_parent(node);
 
+   WARN_ONCE(!port_node, %s(): endpoint %s has no parent node\n,
+ __func__, node-full_name);
+
memset(endpoint, 0, sizeof(*endpoint));
 
endpoint-local_node = node;
-- 
1.9.0.rc3

--
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 v6 0/8] Move device tree graph parsing helpers to drivers/of

2014-03-05 Thread Philipp Zabel
Hi,

this version of the OF graph helper move series further addresses a few of
Tomi's and Sylwester's comments.

Changes since v5:
 - Fixed spelling errors and a wrong device node name in the link section
 - Added parentless previous endpoint's full name to warning
 - Fixed documentation comment for of_graph_parse_endpoint
 - Unrolled for-loop in of_graph_get_remote_port_parent

Philipp Zabel (8):
  [media] of: move graph helpers from drivers/media/v4l2-core to
drivers/of
  Documentation: of: Document graph bindings
  of: Warn if of_graph_get_next_endpoint is called with the root node
  of: Reduce indentation in of_graph_get_next_endpoint
  [media] of: move common endpoint parsing to drivers/of
  of: Implement simplified graph binding for single port devices
  of: Document simplified graph binding for single port devices
  of: Warn if of_graph_parse_endpoint is called with the root node

 Documentation/devicetree/bindings/graph.txt   | 137 +
 drivers/media/i2c/adv7343.c   |   4 +-
 drivers/media/i2c/mt9p031.c   |   4 +-
 drivers/media/i2c/s5k5baf.c   |   3 +-
 drivers/media/i2c/tvp514x.c   |   3 +-
 drivers/media/i2c/tvp7002.c   |   3 +-
 drivers/media/platform/exynos4-is/fimc-is.c   |   6 +-
 drivers/media/platform/exynos4-is/media-dev.c |  13 +-
 drivers/media/platform/exynos4-is/mipi-csis.c |   5 +-
 drivers/media/v4l2-core/v4l2-of.c | 133 +---
 drivers/of/base.c | 167 ++
 include/linux/of_graph.h  |  66 ++
 include/media/v4l2-of.h   |  33 +
 13 files changed, 399 insertions(+), 178 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/graph.txt
 create mode 100644 include/linux/of_graph.h

-- 
1.9.0.rc3

--
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 v6 5/8] [media] of: move common endpoint parsing to drivers/of

2014-03-05 Thread Philipp Zabel
This patch adds a new struct of_endpoint which is then embedded in struct
v4l2_of_endpoint and contains the endpoint properties that are not V4L2
(or even media) specific: the port number, endpoint id, local device tree
node and remote endpoint phandle. of_graph_parse_endpoint parses those
properties and is used by v4l2_of_parse_endpoint, which just adds the
V4L2 MBUS information to the containing v4l2_of_endpoint structure.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v5:
 - Fixed documentation comment for of_graph_parse_endpoint
---
 drivers/media/platform/exynos4-is/media-dev.c | 10 +-
 drivers/media/platform/exynos4-is/mipi-csis.c |  2 +-
 drivers/media/v4l2-core/v4l2-of.c | 16 +++
 drivers/of/base.c | 28 +++
 include/linux/of_graph.h  | 20 +++
 include/media/v4l2-of.h   |  8 ++--
 6 files changed, 59 insertions(+), 25 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index d0f82da..04d6ecd 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -469,10 +469,10 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
return 0;
 
v4l2_of_parse_endpoint(ep, endpoint);
-   if (WARN_ON(endpoint.port == 0) || index = FIMC_MAX_SENSORS)
+   if (WARN_ON(endpoint.base.port == 0) || index = FIMC_MAX_SENSORS)
return -EINVAL;
 
-   pd-mux_id = (endpoint.port - 1)  0x1;
+   pd-mux_id = (endpoint.base.port - 1)  0x1;
 
rem = of_graph_get_remote_port_parent(ep);
of_node_put(ep);
@@ -494,13 +494,13 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
return -EINVAL;
}
 
-   if (fimc_input_is_parallel(endpoint.port)) {
+   if (fimc_input_is_parallel(endpoint.base.port)) {
if (endpoint.bus_type == V4L2_MBUS_PARALLEL)
pd-sensor_bus_type = FIMC_BUS_TYPE_ITU_601;
else
pd-sensor_bus_type = FIMC_BUS_TYPE_ITU_656;
pd-flags = endpoint.bus.parallel.flags;
-   } else if (fimc_input_is_mipi_csi(endpoint.port)) {
+   } else if (fimc_input_is_mipi_csi(endpoint.base.port)) {
/*
 * MIPI CSI-2: only input mux selection and
 * the sensor's clock frequency is needed.
@@ -508,7 +508,7 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
pd-sensor_bus_type = FIMC_BUS_TYPE_MIPI_CSI2;
} else {
v4l2_err(fmd-v4l2_dev, Wrong port id (%u) at node %s\n,
-endpoint.port, rem-full_name);
+endpoint.base.port, rem-full_name);
}
/*
 * For FIMC-IS handled sensors, that are placed under i2c-isp device
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c 
b/drivers/media/platform/exynos4-is/mipi-csis.c
index fd1ae65..3678ba5 100644
--- a/drivers/media/platform/exynos4-is/mipi-csis.c
+++ b/drivers/media/platform/exynos4-is/mipi-csis.c
@@ -772,7 +772,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
/* Get port node and validate MIPI-CSI channel id. */
v4l2_of_parse_endpoint(node, endpoint);
 
-   state-index = endpoint.port - FIMC_INPUT_MIPI_CSI2_0;
+   state-index = endpoint.base.port - FIMC_INPUT_MIPI_CSI2_0;
if (state-index  0 || state-index = CSIS_MAX_ENTITIES)
return -ENXIO;
 
diff --git a/drivers/media/v4l2-core/v4l2-of.c 
b/drivers/media/v4l2-core/v4l2-of.c
index f919db3..b4ed9a9 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -127,17 +127,9 @@ static void v4l2_of_parse_parallel_bus(const struct 
device_node *node,
 int v4l2_of_parse_endpoint(const struct device_node *node,
   struct v4l2_of_endpoint *endpoint)
 {
-   struct device_node *port_node = of_get_parent(node);
-
-   memset(endpoint, 0, offsetof(struct v4l2_of_endpoint, head));
-
-   endpoint-local_node = node;
-   /*
-* It doesn't matter whether the two calls below succeed.
-* If they don't then the default value 0 is used.
-*/
-   of_property_read_u32(port_node, reg, endpoint-port);
-   of_property_read_u32(node, reg, endpoint-id);
+   of_graph_parse_endpoint(node, endpoint-base);
+   endpoint-bus_type = 0;
+   memset(endpoint-bus, 0, sizeof(endpoint-bus));
 
v4l2_of_parse_csi_bus(node, endpoint);
/*
@@ -147,8 +139,6 @@ int v4l2_of_parse_endpoint(const struct device_node *node,
if (endpoint-bus.mipi_csi2.flags == 0)
v4l2_of_parse_parallel_bus(node, endpoint);
 
-   of_node_put(port_node);
-
return 0;
 }
 EXPORT_SYMBOL(v4l2_of_parse_endpoint);
diff --git a/drivers/of/base.c 

[PATCH v6 2/8] Documentation: of: Document graph bindings

2014-03-05 Thread Philipp Zabel
The device tree graph bindings as used by V4L2 and documented in
Documentation/device-tree/bindings/media/video-interfaces.txt contain
generic parts that are not media specific but could be useful for any
subsystem with data flow between multiple devices. This document
describes the generic bindings.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v5:
 - Fixed spelling errors and a wrong device node name in the link section
 Documentation/devicetree/bindings/graph.txt | 129 
 1 file changed, 129 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/graph.txt

diff --git a/Documentation/devicetree/bindings/graph.txt 
b/Documentation/devicetree/bindings/graph.txt
new file mode 100644
index 000..1a69c07
--- /dev/null
+++ b/Documentation/devicetree/bindings/graph.txt
@@ -0,0 +1,129 @@
+Common bindings for device graphs
+
+General concept
+---
+
+The hierarchical organisation of the device tree is well suited to describe
+control flow to devices, but there can be more complex connections between
+devices that work together to form a logical compound device, following an
+arbitrarily complex graph.
+There already is a simple directed graph between devices tree nodes using
+phandle properties pointing to other nodes to describe connections that
+can not be inferred from device tree parent-child relationships. The device
+tree graph bindings described herein abstract more complex devices that can
+have multiple specifiable ports, each of which can be linked to one or more
+ports of other devices.
+
+These common bindings do not contain any information about the direction or
+type of the connections, they just map their existence. Specific properties
+may be described by specialized bindings depending on the type of connection.
+
+To see how this binding applies to video pipelines, for example, see
+Documentation/device-tree/bindings/media/video-interfaces.txt.
+Here the ports describe data interfaces, and the links between them are
+the connecting data buses. A single port with multiple connections can
+correspond to multiple devices being connected to the same physical bus.
+
+Organisation of ports and endpoints
+---
+
+Ports are described by child 'port' nodes contained in the device node.
+Each port node contains an 'endpoint' subnode for each remote device port
+connected to this port. If a single port is connected to more than one
+remote device, an 'endpoint' child node must be provided for each link.
+If more than one port is present in a device node or there is more than one
+endpoint at a port, or a port node needs to be associated with a selected
+hardware interface, a common scheme using '#address-cells', '#size-cells'
+and 'reg' properties is used number the nodes.
+
+device {
+...
+#address-cells = 1;
+#size-cells = 0;
+
+port@0 {
+   #address-cells = 1;
+   #size-cells = 0;
+   reg = 0;
+
+endpoint@0 {
+   reg = 0;
+   ...
+   };
+endpoint@1 {
+   reg = 1;
+   ...
+   };
+};
+
+port@1 {
+   reg = 1;
+
+   endpoint { ... };
+   };
+};
+
+All 'port' nodes can be grouped under an optional 'ports' node, which
+allows to specify #address-cells, #size-cells properties for the 'port'
+nodes independently from any other child device nodes a device might
+have.
+
+device {
+...
+ports {
+#address-cells = 1;
+#size-cells = 0;
+
+port@0 {
+...
+endpoint@0 { ... };
+endpoint@1 { ... };
+};
+
+port@1 { ... };
+};
+};
+
+Links between endpoints
+---
+
+Each endpoint should contain a 'remote-endpoint' phandle property that points
+to the corresponding endpoint in the port of the remote device. In turn, the
+remote endpoint should contain a 'remote-endpoint' property. If it has one,
+it must not point to another than the local endpoint. Two endpoints with their
+'remote-endpoint' phandles pointing at each other form a link between the
+containing ports.
+
+device-1 {
+port {
+device_1_output: endpoint {
+remote-endpoint = device_2_input;
+};
+};
+};
+
+device-2 {
+port {
+device_2_input: endpoint {
+remote-endpoint = device_1_output;
+};
+};
+};
+
+
+Required properties
+---
+
+If there is more than one 'port' or more than one 'endpoint' node or 'reg'
+property is present in port and/or endpoint nodes the following properties
+are required in a relevant parent node:
+
+ - #address-cells : number of cells 

[linuxtv-media:master 467/499] drivers/media/dvb-frontends/drx39xyj/drxj.c:20041 drxj_close() warn: variable dereferenced before check 'demod' (see line 20036)

2014-03-05 Thread Dan Carpenter
Hi Mauro,

FYI, there are new smatch warnings show up in

tree:   git://linuxtv.org/media_tree.git master
head:   59432be1c7fbf2a4f608850855ff649bee0f7b3b
commit: b78359a6894ac3451bec3fde5d0499fba87b8b67 [467/499] [media] drx-j: get 
rid of the remaining drx generic functions

New smatch warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:20041 drxj_close() warn: variable 
dereferenced before check 'demod' (see line 20036)

Old smatch warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1145 mult32() warn: missing break? 
reassigning '*h'
drivers/media/dvb-frontends/drx39xyj/drxj.c:20435 drx_ctrl_u_code() warn: 
variable dereferenced before check 'mc_info' (see line 20432)

git remote add linuxtv-media git://linuxtv.org/media_tree.git
git remote update linuxtv-media
git checkout b78359a6894ac3451bec3fde5d0499fba87b8b67
vim +/demod +20041 drivers/media/dvb-frontends/drx39xyj/drxj.c

38b2df95 Devin Heitmueller 2012-08-13  20030  * \brief Close the demod 
instance, power down the device
38b2df95 Devin Heitmueller 2012-08-13  20031  * \return Status_t Return 
status.
38b2df95 Devin Heitmueller 2012-08-13  20032  *
38b2df95 Devin Heitmueller 2012-08-13  20033  */
1bfc9e15 Mauro Carvalho Chehab 2014-01-16  20034  int drxj_close(struct 
drx_demod_instance *demod)
38b2df95 Devin Heitmueller 2012-08-13  20035  {
4d7bb0eb Mauro Carvalho Chehab 2014-01-16 @20036struct i2c_device_addr 
*dev_addr = demod-my_i2c_dev_addr;
1bfc9e15 Mauro Carvalho Chehab 2014-01-16  20037struct drx_common_attr 
*common_attr = demod-my_common_attr;
068e94ea Mauro Carvalho Chehab 2014-01-16  20038int rc;
1bfc9e15 Mauro Carvalho Chehab 2014-01-16  20039enum drx_power_mode 
power_mode = DRX_POWER_UP;
38b2df95 Devin Heitmueller 2012-08-13  20040  
b78359a6 Mauro Carvalho Chehab 2014-01-24 @20041if ((demod == NULL) ||
b78359a6 Mauro Carvalho Chehab 2014-01-24  20042
(demod-my_common_attr == NULL) ||
b78359a6 Mauro Carvalho Chehab 2014-01-24  20043(demod-my_ext_attr 
== NULL) ||
b78359a6 Mauro Carvalho Chehab 2014-01-24  20044
(demod-my_i2c_dev_addr == NULL) ||

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 5/7] [media] of: move common endpoint parsing to drivers/of

2014-03-05 Thread Tomi Valkeinen
On 04/03/14 17:47, Philipp Zabel wrote:
 Am Dienstag, den 04.03.2014, 14:21 +0200 schrieb Tomi Valkeinen:
 On 04/03/14 13:36, Philipp Zabel wrote:
 [...]
 Can port_node be NULL? Probably only if something is quite wrong, but
 maybe it's safer to return error in that case.

 both of_property_read_u32 and of_node_put can handle port_node == NULL.
 I'll add a WARN_ONCE here as for of_graph_get_next_endpoint and continue
 on.

 Isn't it better to return an error?
 
 I am not sure. We can still correctly parse the endpoint properties of a
 parentless node. All current users ignore the return value anyway. So as
 long as we still do the memset and and set local_node and id, returning
 an error effectively won't change the current behaviour.

Is the parentless node case an error or not? If it's not, we can handle
it silently and return 0, no WARN needed. If it is an error, we should
return an error, even if nobody is currently handling that (which is a
bug in itself, as the function does return an error value, and callers
should handle it).

 Tomi




signature.asc
Description: OpenPGP digital signature


[PATCH] [media] s5-mfc: remove meaningless assignment

2014-03-05 Thread Seung-Woo Kim
Signed-off-by: Seung-Woo Kim sw0312@samsung.com
---
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index 2475a3c..ee05f2d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -44,8 +44,6 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev)
return -ENOMEM;
}
 
-   dev-bank1 = dev-bank1;
-
if (HAS_PORTNUM(dev)  IS_TWOPORT(dev)) {
bank2_virt = dma_alloc_coherent(dev-mem_dev_r, 1  
MFC_BASE_ALIGN_ORDER,
bank2_dma_addr, GFP_KERNEL);
-- 
1.7.4.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] [media] s5-mfc: remove meaningless assignment

2014-03-05 Thread Kamil Debski
Hi Seung-Woo,

 From: Seung-Woo Kim [mailto:sw0312@samsung.com]
 Sent: Wednesday, March 05, 2014 11:08 AM
 
 Signed-off-by: Seung-Woo Kim sw0312@samsung.com

Thank you for your patch. I know that content of the patch is obvious, but
please provide a description of the patch.

Best wishes,
-- 
Kamil Debski
Samsung RD Institute Poland

 ---
  drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c |2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 index 2475a3c..ee05f2d 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 @@ -44,8 +44,6 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev)
   return -ENOMEM;
   }
 
 - dev-bank1 = dev-bank1;
 -
   if (HAS_PORTNUM(dev)  IS_TWOPORT(dev)) {
   bank2_virt = dma_alloc_coherent(dev-mem_dev_r, 1 
 MFC_BASE_ALIGN_ORDER,
   bank2_dma_addr, GFP_KERNEL);
 --
 1.7.4.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] s5-mfc: remove meaningless memory bank assignment

2014-03-05 Thread Seung-Woo Kim
There was assignment of memory bank with dma address converted
from physical address. But allocation has been changed with dma
function, so the assignment is not necessary.

Signed-off-by: Seung-Woo Kim sw0312@samsung.com
---
change from v1
- fixes subject and adds proper description
---
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index 2475a3c..ee05f2d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -44,8 +44,6 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev)
return -ENOMEM;
}
 
-   dev-bank1 = dev-bank1;
-
if (HAS_PORTNUM(dev)  IS_TWOPORT(dev)) {
bank2_virt = dma_alloc_coherent(dev-mem_dev_r, 1  
MFC_BASE_ALIGN_ORDER,
bank2_dma_addr, GFP_KERNEL);
-- 
1.7.4.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 v2] [patch] [media] em28xx-cards: remove a wrong indent level

2014-03-05 Thread Dan Carpenter
This code is correct but the indenting is wrong and triggers a static
checker warning add curly braces?.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com
---
v2: in v1 I added curly braces.

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
b/drivers/media/usb/em28xx/em28xx-cards.c
index 4d97a76cc3b0..33f06ffec4b2 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3331,8 +3331,8 @@ static int em28xx_usb_probe(struct usb_interface 
*interface,
if (has_video) {
if (!dev-analog_ep_isoc || (try_bulk  dev-analog_ep_bulk))
dev-analog_xfer_bulk = 1;
-   em28xx_info(analog set to %s mode.\n,
-   dev-analog_xfer_bulk ? bulk : isoc);
+   em28xx_info(analog set to %s mode.\n,
+   dev-analog_xfer_bulk ? bulk : isoc);
}
if (has_dvb) {
if (!dev-dvb_ep_isoc || (try_bulk  dev-dvb_ep_bulk))
--
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 v6 0/8] Move device tree graph parsing helpers to drivers/of

2014-03-05 Thread Tomi Valkeinen
Hi,

On 05/03/14 11:20, Philipp Zabel wrote:
 Hi,
 
 this version of the OF graph helper move series further addresses a few of
 Tomi's and Sylwester's comments.
 
 Changes since v5:
  - Fixed spelling errors and a wrong device node name in the link section
  - Added parentless previous endpoint's full name to warning
  - Fixed documentation comment for of_graph_parse_endpoint
  - Unrolled for-loop in of_graph_get_remote_port_parent
 
 Philipp Zabel (8):
   [media] of: move graph helpers from drivers/media/v4l2-core to
 drivers/of
   Documentation: of: Document graph bindings
   of: Warn if of_graph_get_next_endpoint is called with the root node
   of: Reduce indentation in of_graph_get_next_endpoint
   [media] of: move common endpoint parsing to drivers/of
   of: Implement simplified graph binding for single port devices
   of: Document simplified graph binding for single port devices
   of: Warn if of_graph_parse_endpoint is called with the root node

So, as I've pointed out, I don't agree with the API, as it's too limited
and I can't use it, but as this series is (mostly) about moving the
current API to a common place, it's fine for me.

Acked-by: Tomi Valkeinen tomi.valkei...@ti.com

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] [media] s5-mfc: remove meaningless memory bank assignment

2014-03-05 Thread Sachin Kamat
On 5 March 2014 16:38, Seung-Woo Kim sw0312@samsung.com wrote:
 There was assignment of memory bank with dma address converted
 from physical address. But allocation has been changed with dma
 function, so the assignment is not necessary.

 Signed-off-by: Seung-Woo Kim sw0312@samsung.com
 ---
 change from v1
 - fixes subject and adds proper description
 ---
  drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c |2 --
  1 files changed, 0 insertions(+), 2 deletions(-)

 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 index 2475a3c..ee05f2d 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 @@ -44,8 +44,6 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev)
 return -ENOMEM;
 }

 -   dev-bank1 = dev-bank1;

Are you sure this isn't some kind of typo? If not then your commit
description is too verbose
to actually say that the code is redundant and could be removed. The
code here is something like

 a = a;

which does not make sense nor add any value and hence redundant and
could be removed.

-- 
With warm regards,
Sachin
--
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


Loan Application

2014-03-05 Thread Loans
Loan Application at a low rate of 0.5% send your Name,Amount,Phone and country 
to standar...@56788.com

Note: $5,000.00 USD minimum and $100,000,000 Maximum.
--
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 v3] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-03-05 Thread Mauro Carvalho Chehab
We can't free struct em28xx while one of the extensions is still
using it.

So, add a kref() to control it, freeing it only after the
extensions fini calls.

Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
---
 drivers/media/usb/em28xx/em28xx-audio.c |  7 ++-
 drivers/media/usb/em28xx/em28xx-cards.c | 31 ---
 drivers/media/usb/em28xx/em28xx-dvb.c   |  6 +-
 drivers/media/usb/em28xx/em28xx-input.c |  8 +++-
 drivers/media/usb/em28xx/em28xx-video.c | 15 ---
 drivers/media/usb/em28xx/em28xx.h   |  8 ++--
 6 files changed, 56 insertions(+), 19 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 0f5b6f3e7a3f..f75c0a5494d6 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -301,6 +301,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream 
*substream)
goto err;
}
 
+   kref_get(dev-ref);
dev-adev.users++;
mutex_unlock(dev-lock);
 
@@ -341,6 +342,7 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream 
*substream)
substream-runtime-dma_area = NULL;
}
mutex_unlock(dev-lock);
+   kref_put(dev-ref, em28xx_free_device);
 
return 0;
 }
@@ -895,6 +897,8 @@ static int em28xx_audio_init(struct em28xx *dev)
 
em28xx_info(Binding audio extension\n);
 
+   kref_get(dev-ref);
+
printk(KERN_INFO em28xx-audio.c: Copyright (C) 2006 Markus 
 Rechberger\n);
printk(KERN_INFO
@@ -967,7 +971,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
if (dev == NULL)
return 0;
 
-   if (dev-has_alsa_audio != 1) {
+   if (!dev-has_alsa_audio) {
/* This device does not support the extension (in this case
   the device is expecting the snd-usb-audio module or
   doesn't have analog audio support at all) */
@@ -986,6 +990,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
dev-adev.sndcard = NULL;
}
 
+   kref_put(dev-ref, em28xx_free_device);
return 0;
 }
 
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
b/drivers/media/usb/em28xx/em28xx-cards.c
index 2fb300e882f0..512448b757c9 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -2939,7 +2939,7 @@ static void flush_request_modules(struct em28xx *dev)
  * unregisters the v4l2,i2c and usb devices
  * called when the device gets disconnected or at module unload
 */
-void em28xx_release_resources(struct em28xx *dev)
+static void em28xx_release_resources(struct em28xx *dev)
 {
/*FIXME: I2C IR should be disconnected */
 
@@ -2956,7 +2956,26 @@ void em28xx_release_resources(struct em28xx *dev)
 
mutex_unlock(dev-lock);
 };
-EXPORT_SYMBOL_GPL(em28xx_release_resources);
+
+/**
+ * em28xx_free_defice() - Free em28xx device
+ *
+ * @ref: struct kref for em28xx device
+ *
+ * This is called when all extensions and em28xx core unregisters a device
+ */
+void em28xx_free_device(struct kref *ref)
+{
+   struct em28xx *dev = kref_to_dev(ref);
+
+   em28xx_info(Freeing device\n);
+
+   if (!dev-disconnected)
+   em28xx_release_resources(dev);
+
+   kfree(dev-alt_max_pkt_size_isoc);
+   kfree(dev);
+}
 
 /*
  * em28xx_init_dev()
@@ -3409,6 +3428,8 @@ static int em28xx_usb_probe(struct usb_interface 
*interface,
dev-dvb_xfer_bulk ? bulk : isoc);
}
 
+   kref_init(dev-ref);
+
request_modules(dev);
 
/* Should be the last thing to do, to avoid newer udev's to
@@ -3453,11 +3474,7 @@ static void em28xx_usb_disconnect(struct usb_interface 
*interface)
em28xx_close_extension(dev);
 
em28xx_release_resources(dev);
-
-   if (!dev-users) {
-   kfree(dev-alt_max_pkt_size_isoc);
-   kfree(dev);
-   }
+   kref_put(dev-ref, em28xx_free_device);
 }
 
 static int em28xx_usb_suspend(struct usb_interface *interface,
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c 
b/drivers/media/usb/em28xx/em28xx-dvb.c
index d4986bdfbdc3..6dbc71ba2820 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1043,7 +1043,6 @@ static int em28xx_dvb_init(struct em28xx *dev)
em28xx_info(Binding DVB extension\n);
 
dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
-
if (dvb == NULL) {
em28xx_info(em28xx_dvb: memory allocation failed\n);
return -ENOMEM;
@@ -1521,6 +1520,9 @@ static int em28xx_dvb_init(struct em28xx *dev)
dvb-adapter.mfe_shared = mfe_shared;
 
em28xx_info(DVB extension successfully initialized\n);
+
+   kref_get(dev-ref);
+
 ret:
em28xx_set_mode(dev, EM28XX_SUSPEND);
mutex_unlock(dev-lock);
@@ -1579,6 +1581,8 @@ static int 

Re: [PATCH v6 0/8] Move device tree graph parsing helpers to drivers/of

2014-03-05 Thread Philipp Zabel
Hi Tomi,

Am Mittwoch, den 05.03.2014, 13:35 +0200 schrieb Tomi Valkeinen:
 Hi,
 
 On 05/03/14 11:20, Philipp Zabel wrote:
  Hi,
  
  this version of the OF graph helper move series further addresses a few of
  Tomi's and Sylwester's comments.
  
  Changes since v5:
   - Fixed spelling errors and a wrong device node name in the link section
   - Added parentless previous endpoint's full name to warning
   - Fixed documentation comment for of_graph_parse_endpoint
   - Unrolled for-loop in of_graph_get_remote_port_parent
  
  Philipp Zabel (8):
[media] of: move graph helpers from drivers/media/v4l2-core to
  drivers/of
Documentation: of: Document graph bindings
of: Warn if of_graph_get_next_endpoint is called with the root node
of: Reduce indentation in of_graph_get_next_endpoint
[media] of: move common endpoint parsing to drivers/of
of: Implement simplified graph binding for single port devices
of: Document simplified graph binding for single port devices
of: Warn if of_graph_parse_endpoint is called with the root node
 
 So, as I've pointed out, I don't agree with the API, as it's too limited
 and I can't use it, but as this series is (mostly) about moving the
 current API to a common place, it's fine for me.
 
 Acked-by: Tomi Valkeinen tomi.valkei...@ti.com

Thanks. I'll be happy to help expanding the API to parse ports
individually, once this gets accepted.

Mauro, Guennadi, are you fine with how this turned out? I'd like to get
your acks again, for the changed location.

regards
Philipp

--
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] dvb_frontend: Fix possible read out of bounds

2014-03-05 Thread Ole Ernst
Check if index is within bounds _before_ accessing the value.

Signed-off-by: Ole Ernst olebo...@gmx.com
---
 drivers/media/dvb-core/dvb_frontend.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index 2d32c13..6ce435a 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -1279,7 +1279,7 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
switch(tvp-cmd) {
case DTV_ENUM_DELSYS:
ncaps = 0;
-   while (fe-ops.delsys[ncaps]  ncaps  MAX_DELSYS) {
+   while (ncaps  MAX_DELSYS  fe-ops.delsys[ncaps]) {
tvp-u.buffer.data[ncaps] = fe-ops.delsys[ncaps];
ncaps++;
}
@@ -1596,7 +1596,7 @@ static int dvbv5_set_delivery_system(struct dvb_frontend 
*fe,
 * supported
 */
ncaps = 0;
-   while (fe-ops.delsys[ncaps]  ncaps  MAX_DELSYS) {
+   while (ncaps  MAX_DELSYS  fe-ops.delsys[ncaps]) {
if (fe-ops.delsys[ncaps] == desired_system) {
c-delivery_system = desired_system;
dev_dbg(fe-dvb-device,
@@ -1628,7 +1628,7 @@ static int dvbv5_set_delivery_system(struct dvb_frontend 
*fe,
* of the desired system
*/
ncaps = 0;
-   while (fe-ops.delsys[ncaps]  ncaps  MAX_DELSYS) {
+   while (ncaps  MAX_DELSYS  fe-ops.delsys[ncaps]) {
if (dvbv3_type(fe-ops.delsys[ncaps]) == type)
delsys = fe-ops.delsys[ncaps];
ncaps++;
@@ -1703,7 +1703,7 @@ static int dvbv3_set_delivery_system(struct dvb_frontend 
*fe)
 * DVBv3 standard
 */
ncaps = 0;
-   while (fe-ops.delsys[ncaps]  ncaps  MAX_DELSYS) {
+   while (ncaps  MAX_DELSYS  fe-ops.delsys[ncaps]) {
if (dvbv3_type(fe-ops.delsys[ncaps]) != DVBV3_UNKNOWN) {
delsys = fe-ops.delsys[ncaps];
break;
-- 
1.9.0

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


[PATCH] [media] DocBook: Fix a breakage at controls.xml

2014-03-05 Thread Mauro Carvalho Chehab
Some previous patch introduced this bug:

/devel/v4l/patchwork/Documentation/DocBook/controls.xml:2262: parser error : 
attributes construct error
  row id=v4l2-mpeg-video-hor-search-range
^
/devel/v4l/patchwork/Documentation/DocBook/controls.xml:2262: parser error : 
Couldn't find end of Start Tag row line 2262
  row id=v4l2-mpeg-video-hor-search-range
^

Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 0e1770c133a8..b7f3feb820db 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2259,7 +2259,7 @@ VBV buffer control./entry
  /row
 
  rowentry/entry/row
- row id=v4l2-mpeg-video-hor-search-range
+ row id=v4l2-mpeg-video-hor-search-range
entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE/constantnbsp;/entry
entryinteger/entry
  /row
-- 
1.8.5.3

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


Re: [linuxtv-media:master 499/499] drivers/media/usb/usbtv/usbtv-core.c:119:22: sparse: symbol 'usbtv_id_table' was not declared. Should it be static?

2014-03-05 Thread Mauro Carvalho Chehab
Hi Fengguang,

This patch got obsoleted by another patch in the same series.

Unfortunately, I had to break sending the patch series into a few
pushes, as my mailbomb script has a logic there that prevents it to
send more than 30~50 emails (I never remember the exact setting).

So, I pushed this 80-series into a few pushes. You likely compiled the
tree without waiting for the hole series to be upstreamed.

Regards,
Mauro

Em Tue, 04 Feb 2014 17:02:02 +0800
kbuild test robot fengguang...@intel.com escreveu:

 tree:   git://linuxtv.org/media_tree.git master
 head:   a3550ea665acd1922df8275379028c1634675629
 commit: a3550ea665acd1922df8275379028c1634675629 [499/499] [media] usbtv: 
 split core and video implementation
 reproduce: make C=1 CF=-D__CHECK_ENDIAN__
 
 
 sparse warnings: (new ones prefixed by )
 
  drivers/media/usb/usbtv/usbtv-core.c:119:22: sparse: symbol 
  'usbtv_id_table' was not declared. Should it be static?
  drivers/media/usb/usbtv/usbtv-core.c:129:19: sparse: symbol 
  'usbtv_usb_driver' was not declared. Should it be static?
 --
  drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
  __be32
  drivers/media/usb/usbtv/usbtv-video.c:565:23: sparse: symbol 
  'usbtv_ioctl_ops' was not declared. Should it be static?
  drivers/media/usb/usbtv/usbtv-video.c:587:29: sparse: symbol 'usbtv_fops' 
  was not declared. Should it be static?
  drivers/media/usb/usbtv/usbtv-video.c:648:16: sparse: symbol 
  'usbtv_vb2_ops' was not declared. Should it be static?
 
 Please consider folding the attached diff :-)
 
 ---
 0-DAY kernel build testing backend  Open Source Technology Center
 http://lists.01.org/mailman/listinfo/kbuild Intel Corporation


-- 

Cheers,
Mauro
--
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 v2 4/5] Expose default devices

2014-03-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Sakari Ailus sakari.ai...@iki.fi
---
 src/mediactl-priv.h |  7 +++
 src/mediactl.c  | 32 
 src/mediactl.h  | 19 +++
 3 files changed, 58 insertions(+)

diff --git a/src/mediactl-priv.h b/src/mediactl-priv.h
index 37e60aa..4644165 100644
--- a/src/mediactl-priv.h
+++ b/src/mediactl-priv.h
@@ -49,6 +49,13 @@ struct media_device {
 
void (*debug_handler)(void *, ...);
void *debug_priv;
+
+   struct {
+   struct media_entity *v4l;
+   struct media_entity *fb;
+   struct media_entity *alsa;
+   struct media_entity *dvb;
+   } def;
 };
 
 #define media_dbg(media, ...) \
diff --git a/src/mediactl.c b/src/mediactl.c
index a48953a..5bf76ea 100644
--- a/src/mediactl.c
+++ b/src/mediactl.c
@@ -145,6 +145,21 @@ const char *media_entity_get_devname(struct media_entity 
*entity)
return entity-devname[0] ? entity-devname : NULL;
 }
 
+struct media_entity *media_get_default_entity(struct media_device *media,
+ unsigned int type)
+{
+   switch (type) {
+   case MEDIA_ENT_T_DEVNODE_V4L:
+   return media-def.v4l;
+   case MEDIA_ENT_T_DEVNODE_FB:
+   return media-def.fb;
+   case MEDIA_ENT_T_DEVNODE_ALSA:
+   return media-def.alsa;
+   case MEDIA_ENT_T_DEVNODE_DVB:
+   return media-def.dvb;
+   }
+}
+
 const struct media_device_info *media_get_info(struct media_device *media)
 {
return media-info;
@@ -518,6 +533,23 @@ static int media_enum_entities(struct media_device *media)
 
media-entities_count++;
 
+   if (entity-info.flags  MEDIA_ENT_FL_DEFAULT) {
+   switch (entity-info.type) {
+   case MEDIA_ENT_T_DEVNODE_V4L:
+   media-def.v4l = entity;
+   break;
+   case MEDIA_ENT_T_DEVNODE_FB:
+   media-def.fb = entity;
+   break;
+   case MEDIA_ENT_T_DEVNODE_ALSA:
+   media-def.alsa = entity;
+   break;
+   case MEDIA_ENT_T_DEVNODE_DVB:
+   media-def.dvb = entity;
+   break;
+   }
+   }
+
/* Find the corresponding device name. */
if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE 
media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV)
diff --git a/src/mediactl.h b/src/mediactl.h
index e2c93b8..b74be0b 100644
--- a/src/mediactl.h
+++ b/src/mediactl.h
@@ -244,6 +244,25 @@ unsigned int media_get_entities_count(struct media_device 
*media);
 struct media_entity *media_get_entity(struct media_device *media, unsigned int 
index);
 
 /**
+ * @brief Get the default entity for a given type
+ * @param media - media device.
+ * @param type - entity type.
+ *
+ * This function returns the default entity of the requested type. @a type must
+ * be one of
+ *
+ * MEDIA_ENT_T_DEVNODE_V4L
+ * MEDIA_ENT_T_DEVNODE_FB
+ * MEDIA_ENT_T_DEVNODE_ALSA
+ * MEDIA_ENT_T_DEVNODE_DVB
+ *
+ * @return A pointer to the default entity for the type if it exists, or NULL
+ * otherwise.
+ */
+struct media_entity *media_get_default_entity(struct media_device *media,
+ unsigned int type);
+
+/**
  * @brief Get the media device information
  * @param media - media device.
  *
-- 
1.8.3.2

--
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 v2 5/5] Add support for emulated devices

2014-03-05 Thread Laurent Pinchart
Emulated media devices are backed by real hardware devices for the
functions they provide, but have no kernel media device counterpart.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 src/mediactl.c | 85 +++---
 src/mediactl.h | 52 +++
 2 files changed, 133 insertions(+), 4 deletions(-)

diff --git a/src/mediactl.c b/src/mediactl.c
index 5bf76ea..b904762 100644
--- a/src/mediactl.c
+++ b/src/mediactl.c
@@ -636,7 +636,7 @@ void media_debug_set_handler(struct media_device *media,
}
 }
 
-struct media_device *media_device_new(const char *devnode)
+static struct media_device *__media_device_new(void)
 {
struct media_device *media;
int ret;
@@ -650,6 +650,18 @@ struct media_device *media_device_new(const char *devnode)
 
media_debug_set_handler(media, NULL, NULL);
 
+   return media;
+}
+
+struct media_device *media_device_new(const char *devnode)
+{
+   struct media_device *media;
+   int ret;
+
+   media = __media_device_new();
+   if (media == NULL)
+   return NULL;
+
media-devnode = strdup(devnode);
if (media-devnode == NULL) {
media_device_unref(media);
@@ -659,6 +671,19 @@ struct media_device *media_device_new(const char *devnode)
return media;
 }
 
+struct media_device *media_device_new_emulated(struct media_device_info *info)
+{
+   struct media_device *media;
+
+   media = __media_device_new();
+   if (media == NULL)
+   return NULL;
+
+   media-info = *info;
+
+   return media;
+}
+
 struct media_device *media_device_ref(struct media_device *media)
 {
media-refcount++;
@@ -687,9 +712,61 @@ void media_device_unref(struct media_device *media)
free(media);
 }
 
-/* 
-
- * Parsing
- */
+int media_device_add_entity(struct media_device *media,
+   const struct media_entity_desc *desc,
+   const char *devnode)
+{
+   struct media_entity **defent;
+   struct media_entity *entity;
+   unsigned int size;
+
+   size = (media-entities_count + 1) * sizeof(*media-entities);
+   entity = realloc(media-entities, size);
+   if (entity == NULL)
+   return -ENOMEM;
+
+   media-entities = entity;
+   media-entities_count++;
+
+   entity = media-entities[media-entities_count - 1];
+   memset(entity, 0, sizeof *entity);
+
+   entity-fd = -1;
+   entity-media = media;
+   strncpy(entity-devname, devnode, sizeof entity-devname);
+   entity-devname[sizeof entity-devname - 1] = '\0';
+
+   entity-info.id = 0;
+   entity-info.type = desc-type;
+   entity-info.flags = 0;
+   memcpy(entity-info.name, desc-name, sizeof entity-info.name);
+
+   switch (entity-info.type) {
+   case MEDIA_ENT_T_DEVNODE_V4L:
+   defent = media-def.v4l;
+   entity-info.v4l = desc-v4l;
+   break;
+   case MEDIA_ENT_T_DEVNODE_FB:
+   defent = media-def.fb;
+   entity-info.fb = desc-fb;
+   break;
+   case MEDIA_ENT_T_DEVNODE_ALSA:
+   defent = media-def.alsa;
+   entity-info.alsa = desc-alsa;
+   break;
+   case MEDIA_ENT_T_DEVNODE_DVB:
+   defent = media-def.dvb;
+   entity-info.dvb = desc-dvb;
+   break;
+   }
+
+   if (desc-flags  MEDIA_ENT_FL_DEFAULT) {
+   entity-info.flags |= MEDIA_ENT_FL_DEFAULT;
+   *defent = entity;
+   }
+
+   return 0;
+}
 
 struct media_pad *media_parse_pad(struct media_device *media,
  const char *p, char **endp)
diff --git a/src/mediactl.h b/src/mediactl.h
index b74be0b..e34ae81 100644
--- a/src/mediactl.h
+++ b/src/mediactl.h
@@ -60,6 +60,22 @@ struct media_entity;
 struct media_device *media_device_new(const char *devnode);
 
 /**
+ * @brief Create a new emulated media device.
+ * @param info - device information.
+ *
+ * Emulated media devices are userspace-only objects not backed by a kernel
+ * media device. They are created for ALSA and V4L2 devices that are not
+ * associated with a media controller device.
+ *
+ * Only device query functions are available for media devices. Enumerating or
+ * setting up links is invalid.
+ *
+ * @return A pointer to the new media device or NULL if memory cannot be
+ * allocated.
+ */
+struct media_device *media_device_new_emulated(struct media_device_info *info);
+
+/**
  * @brief Take a reference to the device.
  * @param media - device instance.
  *
@@ -81,6 +97,42 @@ struct media_device *media_device_ref(struct media_device 
*media);
 void media_device_unref(struct media_device *media);
 
 /**
+ * @brief Add an entity to an existing media device
+ * @param media - device instance.
+ * 

[PATCH/RFC v2 1/5] Split media_device creation and opening

2014-03-05 Thread Laurent Pinchart
Make the media_device refcounted to manage its life time.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 src/main.c |  21 ---
 src/mediactl.c | 172 -
 src/mediactl.h |  84 +++-
 3 files changed, 180 insertions(+), 97 deletions(-)

diff --git a/src/main.c b/src/main.c
index 4a27c8c..8b48fde 100644
--- a/src/main.c
+++ b/src/main.c
@@ -329,15 +329,20 @@ int main(int argc, char **argv)
if (parse_cmdline(argc, argv))
return EXIT_FAILURE;
 
-   /* Open the media device and enumerate entities, pads and links. */
+   media = media_device_new(media_opts.devname);
+   if (media == NULL) {
+   printf(Failed to create media device\n);
+   goto out;
+   }
+
if (media_opts.verbose)
-   media = media_open_debug(
-   media_opts.devname,
+   media_debug_set_handler(media,
(void (*)(void *, ...))fprintf, stdout);
-   else
-   media = media_open(media_opts.devname);
-   if (media == NULL) {
-   printf(Failed to open %s\n, media_opts.devname);
+
+   /* Enumerate entities, pads and links. */
+   ret = media_device_enumerate(media);
+   if (ret  0) {
+   printf(Failed to enumerate %s (%d)\n, media_opts.devname, 
ret);
goto out;
}
 
@@ -446,7 +451,7 @@ int main(int argc, char **argv)
 
 out:
if (media)
-   media_close(media);
+   media_device_unref(media);
 
return ret ? EXIT_FAILURE : EXIT_SUCCESS;
 }
diff --git a/src/mediactl.c b/src/mediactl.c
index 57cf86b..c71d4e1 100644
--- a/src/mediactl.c
+++ b/src/mediactl.c
@@ -101,6 +101,42 @@ struct media_entity *media_get_entity_by_id(struct 
media_device *media,
return NULL;
 }
 
+/* 
-
+ * Open/close
+ */
+
+static int media_device_open(struct media_device *media)
+{
+   int ret;
+
+   if (media-fd != -1)
+   return 0;
+
+   media_dbg(media, Opening media device %s\n, media-devnode);
+
+   media-fd = open(media-devnode, O_RDWR);
+   if (media-fd  0) {
+   ret = -errno;
+   media_dbg(media, %s: Can't open media device %s\n,
+ __func__, media-devnode);
+   return ret;
+   }
+
+   return 0;
+}
+
+static void media_device_close(struct media_device *media)
+{
+   if (media-fd != -1) {
+   close(media-fd);
+   media-fd = -1;
+   }
+}
+
+/* 
-
+ * Link setup
+ */
+
 int media_setup_link(struct media_device *media,
 struct media_pad *source,
 struct media_pad *sink,
@@ -111,6 +147,10 @@ int media_setup_link(struct media_device *media,
unsigned int i;
int ret;
 
+   ret = media_device_open(media);
+   if (ret  0)
+   goto done;
+
for (i = 0; i  source-entity-num_links; i++) {
link = source-entity-links[i];
 
@@ -123,7 +163,8 @@ int media_setup_link(struct media_device *media,
 
if (i == source-entity-num_links) {
media_dbg(media, %s: Link not found\n, __func__);
-   return -ENOENT;
+   ret = -ENOENT;
+   goto done;
}
 
/* source pad */
@@ -142,12 +183,18 @@ int media_setup_link(struct media_device *media,
if (ret == -1) {
media_dbg(media, %s: Unable to setup link (%s)\n,
  __func__, strerror(errno));
-   return -errno;
+   ret = -errno;
+   goto done;
}
 
link-flags = ulink.flags;
link-twin-flags = ulink.flags;
-   return 0;
+
+   ret = 0;
+
+done:
+   media_device_close(media);
+   return ret;
 }
 
 int media_reset_links(struct media_device *media)
@@ -425,6 +472,58 @@ static int media_enum_entities(struct media_device *media)
return ret;
 }
 
+int media_device_enumerate(struct media_device *media)
+{
+   int ret;
+
+   if (media-entities)
+   return 0;
+
+   ret = media_device_open(media);
+   if (ret  0)
+   return ret;
+
+   ret = ioctl(media-fd, MEDIA_IOC_DEVICE_INFO, media-info);
+   if (ret  0) {
+   media_dbg(media, %s: Unable to retrieve media device 
+ information for device %s (%s)\n, __func__,
+ media-devnode, strerror(errno));
+   ret = -errno;
+   goto done;
+   }
+
+   media_dbg(media, Enumerating entities\n);
+
+   ret = media_enum_entities(media);
+   if (ret  0) {
+   media_dbg(media,
+ %s: Unable to enumerate entities for device %s 

[PATCH/RFC v2 3/5] Make the media_entity structure private

2014-03-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 src/main.c  | 94 ++---
 src/mediactl-priv.h | 12 +++
 src/mediactl.c  | 38 --
 src/mediactl.h  | 78 +++-
 4 files changed, 164 insertions(+), 58 deletions(-)

diff --git a/src/main.c b/src/main.c
index b0e2277..6f980b4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -171,7 +171,6 @@ static const char *media_pad_type_to_string(unsigned flag)
 
 static void media_print_topology_dot(struct media_device *media)
 {
-   struct media_entity *entities = media_get_entities(media);
unsigned int nents = media_get_entities_count(media);
unsigned int i, j;
 
@@ -179,34 +178,41 @@ static void media_print_topology_dot(struct media_device 
*media)
printf(\trankdir=TB\n);
 
for (i = 0; i  nents; ++i) {
-   struct media_entity *entity = entities[i];
+   struct media_entity *entity = media_get_entity(media, i);
+   const struct media_entity_desc *info = 
media_entity_get_info(entity);
+   const char *devname = media_entity_get_devname(entity);
+   unsigned int num_links = media_entity_get_links_count(entity);
unsigned int npads;
 
switch (media_entity_type(entity)) {
case MEDIA_ENT_T_DEVNODE:
printf(\tn%08x [label=\%s\\n%s\, shape=box, 
style=filled, 
   fillcolor=yellow]\n,
-  entity-info.id, entity-info.name, 
entity-devname);
+  info-id, info-name, devname);
break;
 
case MEDIA_ENT_T_V4L2_SUBDEV:
-   printf(\tn%08x [label=\{{, entity-info.id);
+   printf(\tn%08x [label=\{{, info-id);
 
-   for (j = 0, npads = 0; j  entity-info.pads; ++j) {
-   if (!(entity-pads[j].flags  
MEDIA_PAD_FL_SINK))
+   for (j = 0, npads = 0; j  info-pads; ++j) {
+   const struct media_pad *pad = 
media_entity_get_pad(entity, j);
+
+   if (!(pad-flags  MEDIA_PAD_FL_SINK))
continue;
 
printf(%sport%u %u, npads ?  |  : , j, 
j);
npads++;
}
 
-   printf(} | %s, entity-info.name);
-   if (entity-devname)
-   printf(\\n%s, entity-devname);
+   printf(} | %s, info-name);
+   if (devname)
+   printf(\\n%s, devname);
printf( | {);
 
-   for (j = 0, npads = 0; j  entity-info.pads; ++j) {
-   if (!(entity-pads[j].flags  
MEDIA_PAD_FL_SOURCE))
+   for (j = 0, npads = 0; j  info-pads; ++j) {
+   const struct media_pad *pad = 
media_entity_get_pad(entity, j);
+
+   if (!(pad-flags  MEDIA_PAD_FL_SOURCE))
continue;
 
printf(%sport%u %u, npads ?  |  : , j, 
j);
@@ -220,19 +226,21 @@ static void media_print_topology_dot(struct media_device 
*media)
continue;
}
 
-   for (j = 0; j  entity-num_links; j++) {
-   struct media_link *link = entity-links[j];
+   for (j = 0; j  num_links; j++) {
+   const struct media_link *link = 
media_entity_get_link(entity, j);
+   const struct media_pad *source = link-source;
+   const struct media_pad *sink = link-sink;
 
-   if (link-source-entity != entity)
+   if (source-entity != entity)
continue;
 
-   printf(\tn%08x, link-source-entity-info.id);
-   if (media_entity_type(link-source-entity) == 
MEDIA_ENT_T_V4L2_SUBDEV)
-   printf(:port%u, link-source-index);
+   printf(\tn%08x, 
media_entity_get_info(source-entity)-id);
+   if (media_entity_type(source-entity) == 
MEDIA_ENT_T_V4L2_SUBDEV)
+   printf(:port%u, source-index);
printf( - );
-   printf(n%08x, link-sink-entity-info.id);
-   if (media_entity_type(link-sink-entity) == 
MEDIA_ENT_T_V4L2_SUBDEV)
-   printf(:port%u, link-sink-index);
+   printf(n%08x, 
media_entity_get_info(sink-entity)-id);
+   if (media_entity_type(sink-entity) == 
MEDIA_ENT_T_V4L2_SUBDEV)
+

[PATCH/RFC v2 2/5] Make the media_device structure private

2014-03-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 src/main.c  | 32 ---
 src/mediactl-priv.h | 45 ++
 src/mediactl.c  | 29 +
 src/mediactl.h  | 62 +
 src/v4l2subdev.c|  1 +
 5 files changed, 142 insertions(+), 27 deletions(-)
 create mode 100644 src/mediactl-priv.h

diff --git a/src/main.c b/src/main.c
index 8b48fde..b0e2277 100644
--- a/src/main.c
+++ b/src/main.c
@@ -171,13 +171,15 @@ static const char *media_pad_type_to_string(unsigned flag)
 
 static void media_print_topology_dot(struct media_device *media)
 {
+   struct media_entity *entities = media_get_entities(media);
+   unsigned int nents = media_get_entities_count(media);
unsigned int i, j;
 
printf(digraph board {\n);
printf(\trankdir=TB\n);
 
-   for (i = 0; i  media-entities_count; ++i) {
-   struct media_entity *entity = media-entities[i];
+   for (i = 0; i  nents; ++i) {
+   struct media_entity *entity = entities[i];
unsigned int npads;
 
switch (media_entity_type(entity)) {
@@ -254,13 +256,15 @@ static void media_print_topology_text(struct media_device 
*media)
{ MEDIA_LNK_FL_DYNAMIC, DYNAMIC },
};
 
+   struct media_entity *entities = media_get_entities(media);
+   unsigned int nents = media_get_entities_count(media);
unsigned int i, j, k;
unsigned int padding;
 
printf(Device topology\n);
 
-   for (i = 0; i  media-entities_count; ++i) {
-   struct media_entity *entity = media-entities[i];
+   for (i = 0; i  nents; ++i) {
+   struct media_entity *entity = entities[i];
 
padding = printf(- entity %u: , entity-info.id);
printf(%s (%u pad%s, %u link%s)\n, entity-info.name,
@@ -347,10 +351,12 @@ int main(int argc, char **argv)
}
 
if (media_opts.print) {
+   const struct media_device_info *info = media_get_info(media);
+
printf(Media controller API version %u.%u.%u\n\n,
-  (media-info.media_version  16)  0xff,
-  (media-info.media_version  8)  0xff,
-  (media-info.media_version  0)  0xff);
+  (info-media_version  16)  0xff,
+  (info-media_version  8)  0xff,
+  (info-media_version  0)  0xff);
printf(Media device information\n
   \n
   driver  %s\n
@@ -359,12 +365,12 @@ int main(int argc, char **argv)
   bus info%s\n
   hw revision 0x%x\n
   driver version  %u.%u.%u\n\n,
-  media-info.driver, media-info.model,
-  media-info.serial, media-info.bus_info,
-  media-info.hw_revision,
-  (media-info.driver_version  16)  0xff,
-  (media-info.driver_version  8)  0xff,
-  (media-info.driver_version  0)  0xff);
+  info-driver, info-model,
+  info-serial, info-bus_info,
+  info-hw_revision,
+  (info-driver_version  16)  0xff,
+  (info-driver_version  8)  0xff,
+  (info-driver_version  0)  0xff);
}
 
if (media_opts.entity) {
diff --git a/src/mediactl-priv.h b/src/mediactl-priv.h
new file mode 100644
index 000..844acc7
--- /dev/null
+++ b/src/mediactl-priv.h
@@ -0,0 +1,45 @@
+/*
+ * Media controller interface library
+ *
+ * Copyright (C) 2010-2011 Ideas on board SPRL
+ *
+ * Contact: Laurent Pinchart laurent.pinch...@ideasonboard.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ */
+
+#ifndef __MEDIA_PRIV_H__
+#define __MEDIA_PRIV_H__
+
+#include linux/media.h
+
+#include mediactl.h
+
+struct media_device {
+   int fd;
+   int refcount;
+   char *devnode;
+
+   struct media_device_info info;
+   struct media_entity *entities;
+   unsigned int entities_count;
+
+   void (*debug_handler)(void *, ...);
+   void *debug_priv;
+};
+
+#define 

[PATCH/RFC v2 0/5] media-ctl API changes to prepare for device enumeration library

2014-03-05 Thread Laurent Pinchart
Hello,

Here's the second version of the patch set that make libmediactl usable by the
upcoming media device enumeration library. In order to do so I need to change
the libmediactl API and add support for emulated media devices.

In order to avoid further API/ABI breakages I've decided to make the
media_device and media_entity structures private and provide accessors for the
fields that need to be read. I'm open to suggestions on whether I should make
the media_pad and media_link structures private now as well, or on any other
aspect of these changes.

For reference the (work in progress) media device enumeration library is
available at

http://git.ideasonboard.org/media-enum.git

Changes since v1:

- Made struct media_entity private

Laurent Pinchart (5):
  Split media_device creation and opening
  Make the media_device structure private
  Make the media_entity structure private
  Expose default devices
  Add support for emulated devices

 src/main.c  | 137 +-
 src/mediactl-priv.h |  64 ++
 src/mediactl.c  | 330 +---
 src/mediactl.h  | 281 ++--
 src/v4l2subdev.c|   1 +
 5 files changed, 652 insertions(+), 161 deletions(-)
 create mode 100644 src/mediactl-priv.h

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 0/5] rc: scancode filtering improvements

2014-03-05 Thread Antti Seppälä
On 1 March 2014 01:17, James Hogan james.ho...@imgtec.com wrote:
 These patches make some improvements relating to the recently added RC
 scancode filtering interface:
 - Patch 1 adds generic scancode filtering. This allows filtering to also
   work for raw rc drivers and scancode drivers without filtering
   capabilities.
 - Patches 2-4 future proof the sysfs API to allow a different wakeup
   filter protocol to be set than the current protocol. A new
   wakeup_protocols sysfs file is added which behaves similarly to the
   protocols sysfs file but applies only to wakeup filters.
 - Finally patch 5 improves the driver interface so that changing either
   the normal or wakeup protocol automatically causes the corresponding
   filter to be refreshed to the driver, or failing that cleared. It also
   ensures that the filter is turned off (and for wakeup that means
   wakeup is disabled) if the protocol is set to none. This avoids the
   driver having to maintain the filters, or even need a
   change_wakeup_protocol() callback if there is only one wakeup protocol
   allowed at a time.

 The patch rc-main: store_filter: pass errors to userland should
 probably be applied first.

 An updated img-ir v4 patchset which depends on this one will follow
 soon.

 Cc: Mauro Carvalho Chehab m.che...@samsung.com
 Cc: Bruno Prémont bonb...@linux-vserver.org
 Cc: Maxim Levitsky maximlevit...@gmail.com
 Cc: Sean Young s...@mess.org
 Cc: David Härdeman da...@hardeman.nu
 Cc: Jiri Kosina jkos...@suse.cz
 Cc: Antti Seppälä a.sepp...@gmail.com


After reviewing the series and porting my nuvoton changes to it I
haven't noticed any errors worth mentioning.
In fact I think this series is very well written and should be merged.

James, I hope you also have the time to submit the ir encoder series
for inclusion. :)

Reviewed-by: Antti Seppälä a.sepp...@gmail.com
--
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/6] v4l: vsp1: uds: Enable scaling of alpha layer

2014-03-05 Thread Laurent Pinchart
Scaling of the alpha layer is disabled as both the RPF and WPF are
configured to hardcode the alpha value to 255. This results in a 0 alpha
value at the UDS output, making the image invisible when alpha blended
in the BRU. Fix it by enabling scaling of the alpha layer.

Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 drivers/media/platform/vsp1/vsp1_uds.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_uds.c 
b/drivers/media/platform/vsp1/vsp1_uds.c
index 509c9fe..137299c 100644
--- a/drivers/media/platform/vsp1/vsp1_uds.c
+++ b/drivers/media/platform/vsp1/vsp1_uds.c
@@ -131,7 +131,7 @@ static int uds_s_stream(struct v4l2_subdev *subdev, int 
enable)
return 0;
 
/* Enable multi-tap scaling. */
-   vsp1_uds_write(uds, VI6_UDS_CTRL, VI6_UDS_CTRL_BC);
+   vsp1_uds_write(uds, VI6_UDS_CTRL, VI6_UDS_CTRL_AON | VI6_UDS_CTRL_BC);
 
vsp1_uds_write(uds, VI6_UDS_PASS_BWIDTH,
   (uds_passband_width(uds-hscale)
@@ -139,7 +139,6 @@ static int uds_s_stream(struct v4l2_subdev *subdev, int 
enable)
   (uds_passband_width(uds-vscale)
 VI6_UDS_PASS_BWIDTH_V_SHIFT));
 
-
/* Set the scaling ratios and the output size. */
format = uds-entity.formats[UDS_PAD_SOURCE];
 
-- 
1.8.3.2

--
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/6] ARM: shmobile: r8a7790: Add VSP1 devices to DT

2014-03-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 arch/arm/boot/dts/r8a7790.dtsi | 55 ++
 1 file changed, 55 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 618e5b5..979636b 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -407,6 +407,61 @@
status = disabled;
};
 
+   vsp1@fe92 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe92 0 0x8000;
+   interrupts = 0 266 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7790_CLK_VSP1_SY,
+mstp1_clks R8A7790_CLK_VSP1_RT;
+   clock-names = , rt;
+
+   renesas,has-sru;
+   renesas,#rpf = 5;
+   renesas,#uds = 1;
+   renesas,#wpf = 4;
+   };
+
+   vsp1@fe928000 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe928000 0 0x8000;
+   interrupts = 0 267 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7790_CLK_VSP1_SY,
+mstp1_clks R8A7790_CLK_VSP1_RT;
+   clock-names = , rt;
+
+   renesas,has-lut;
+   renesas,has-sru;
+   renesas,#rpf = 5;
+   renesas,#uds = 3;
+   renesas,#wpf = 4;
+   };
+
+   vsp1@fe93 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe93 0 0x8000;
+   interrupts = 0 246 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7790_CLK_VSP1_DU0;
+
+   renesas,has-lif;
+   renesas,has-lut;
+   renesas,#rpf = 4;
+   renesas,#uds = 1;
+   renesas,#wpf = 4;
+   };
+
+   vsp1@fe938000 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe938000 0 0x8000;
+   interrupts = 0 247 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7790_CLK_VSP1_DU1;
+
+   renesas,has-lif;
+   renesas,has-lut;
+   renesas,#rpf = 4;
+   renesas,#uds = 1;
+   renesas,#wpf = 4;
+   };
+
clocks {
#address-cells = 2;
#size-cells = 2;
-- 
1.8.3.2

--
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/6] v4l: vsp1: Add DT support

2014-03-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 .../devicetree/bindings/media/renesas,vsp1.txt | 51 +
 drivers/media/platform/vsp1/vsp1_drv.c | 52 ++
 2 files changed, 95 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,vsp1.txt

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt 
b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
new file mode 100644
index 000..3b828d4
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -0,0 +1,51 @@
+* Renesas VSP1 Video Processing Engine
+
+The VSP1 is a video processing engine that supports up-/down-scaling, alpha
+blending, color space conversion and various other image processing features.
+It can be found in the Renesas R-Car second generation SoCs.
+
+Required properties:
+
+  - compatible: Must contain renesas,vsp1
+
+  - reg: Base address and length of the registers block for the VSP1.
+  - interrupt-parent, interrupts: Specifier for the VSP1 interrupt.
+
+  - clocks: A list of phandle + clock-specifier pairs for the main VSP1 clock
+and the optional auxiliary RT clock if needed. VSP1 instances that need an
+auxiliary RT clock must specify the clock-names property.
+
+  - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP1.
+  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1.
+  - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP1.
+
+
+Optional properties:
+
+  - clock-names: When the VSP1 requires an auxiliary RT clock this property
+must be present and must contain , rt.
+
+  - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
+available.
+  - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
+available.
+  - renesas,has-sru: Boolean, indicates that the Super Resolution Unit (SRU)
+module is available.
+
+
+Example: R8A7790 (R-Car H2) VSP1-S node
+
+   vsp1@fe928000 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe928000 0 0x8000;
+   interrupts = 0 267 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7790_CLK_VSP1_SY,
+mstp1_clks R8A7790_CLK_VSP1_RT;
+   clock-names = , rt;
+
+   renesas,has-lut;
+   renesas,has-sru;
+   renesas,#rpf = 5;
+   renesas,#uds = 3;
+   renesas,#wpf = 4;
+   };
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 5f774cc..b75ca84 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -16,6 +16,7 @@
 #include linux/device.h
 #include linux/interrupt.h
 #include linux/module.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/videodev2.h
 
@@ -458,34 +459,59 @@ static const struct dev_pm_ops vsp1_pm_ops = {
  * Platform Driver
  */
 
-static struct vsp1_platform_data *
-vsp1_get_platform_data(struct platform_device *pdev)
+static int vsp1_validate_platform_data(struct platform_device *pdev,
+  struct vsp1_platform_data *pdata)
 {
-   struct vsp1_platform_data *pdata = pdev-dev.platform_data;
-
if (pdata == NULL) {
dev_err(pdev-dev, missing platform data\n);
-   return NULL;
+   return -EINVAL;
}
 
if (pdata-rpf_count = 0 || pdata-rpf_count  VPS1_MAX_RPF) {
dev_err(pdev-dev, invalid number of RPF (%u)\n,
pdata-rpf_count);
-   return NULL;
+   return -EINVAL;
}
 
if (pdata-uds_count = 0 || pdata-uds_count  VPS1_MAX_UDS) {
dev_err(pdev-dev, invalid number of UDS (%u)\n,
pdata-uds_count);
-   return NULL;
+   return -EINVAL;
}
 
if (pdata-wpf_count = 0 || pdata-wpf_count  VPS1_MAX_WPF) {
dev_err(pdev-dev, invalid number of WPF (%u)\n,
pdata-wpf_count);
-   return NULL;
+   return -EINVAL;
}
 
+   return 0;
+}
+
+static struct vsp1_platform_data *
+vsp1_get_platform_data(struct platform_device *pdev)
+{
+   struct device_node *np = pdev-dev.of_node;
+   struct vsp1_platform_data *pdata;
+
+   if (!IS_ENABLED(CONFIG_OF) || np == NULL)
+   return pdev-dev.platform_data;
+
+   pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
+   if (pdata == NULL)
+   return NULL;
+
+   if (of_property_read_bool(np, renesas,has-lif))
+   pdata-features |= VSP1_HAS_LIF;
+   if (of_property_read_bool(np, renesas,has-lut))
+   pdata-features |= VSP1_HAS_LUT;
+   if (of_property_read_bool(np, renesas,has-sru))
+   pdata-features |= VSP1_HAS_SRU;
+

[PATCH 1/6] v4l: vsp1: Support multi-input entities

2014-03-05 Thread Laurent Pinchart
Rework the route configuration code to support entities with multiple
sink pads.

Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 drivers/media/platform/vsp1/vsp1_entity.c | 54 +++
 drivers/media/platform/vsp1/vsp1_entity.h | 23 +++--
 drivers/media/platform/vsp1/vsp1_hsit.c   |  7 ++--
 drivers/media/platform/vsp1/vsp1_lif.c|  1 -
 drivers/media/platform/vsp1/vsp1_lut.c|  1 -
 drivers/media/platform/vsp1/vsp1_rpf.c|  1 -
 drivers/media/platform/vsp1/vsp1_sru.c|  1 -
 drivers/media/platform/vsp1/vsp1_uds.c|  1 -
 drivers/media/platform/vsp1/vsp1_video.c  |  7 ++--
 drivers/media/platform/vsp1/vsp1_wpf.c|  1 -
 10 files changed, 54 insertions(+), 43 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_entity.c 
b/drivers/media/platform/vsp1/vsp1_entity.c
index 0226e47..966b185 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -100,8 +100,10 @@ static int vsp1_entity_link_setup(struct media_entity 
*entity,
if (source-sink)
return -EBUSY;
source-sink = remote-entity;
+   source-sink_pad = remote-index;
} else {
source-sink = NULL;
+   source-sink_pad = 0;
}
 
return 0;
@@ -116,42 +118,40 @@ const struct media_entity_operations vsp1_media_ops = {
  * Initialization
  */
 
+static const struct vsp1_route vsp1_routes[] = {
+   { VSP1_ENTITY_HSI, 0, VI6_DPR_HSI_ROUTE, { VI6_DPR_NODE_HSI, } },
+   { VSP1_ENTITY_HST, 0, VI6_DPR_HST_ROUTE, { VI6_DPR_NODE_HST, } },
+   { VSP1_ENTITY_LIF, 0, 0, { VI6_DPR_NODE_LIF, } },
+   { VSP1_ENTITY_LUT, 0, VI6_DPR_LUT_ROUTE, { VI6_DPR_NODE_LUT, } },
+   { VSP1_ENTITY_RPF, 0, VI6_DPR_RPF_ROUTE(0), { VI6_DPR_NODE_RPF(0), } },
+   { VSP1_ENTITY_RPF, 1, VI6_DPR_RPF_ROUTE(1), { VI6_DPR_NODE_RPF(1), } },
+   { VSP1_ENTITY_RPF, 2, VI6_DPR_RPF_ROUTE(2), { VI6_DPR_NODE_RPF(2), } },
+   { VSP1_ENTITY_RPF, 3, VI6_DPR_RPF_ROUTE(3), { VI6_DPR_NODE_RPF(3), } },
+   { VSP1_ENTITY_RPF, 4, VI6_DPR_RPF_ROUTE(4), { VI6_DPR_NODE_RPF(4), } },
+   { VSP1_ENTITY_SRU, 0, VI6_DPR_SRU_ROUTE, { VI6_DPR_NODE_SRU, } },
+   { VSP1_ENTITY_UDS, 0, VI6_DPR_UDS_ROUTE(0), { VI6_DPR_NODE_UDS(0), } },
+   { VSP1_ENTITY_UDS, 1, VI6_DPR_UDS_ROUTE(1), { VI6_DPR_NODE_UDS(1), } },
+   { VSP1_ENTITY_UDS, 2, VI6_DPR_UDS_ROUTE(2), { VI6_DPR_NODE_UDS(2), } },
+   { VSP1_ENTITY_WPF, 0, 0, { VI6_DPR_NODE_WPF(0), } },
+   { VSP1_ENTITY_WPF, 1, 0, { VI6_DPR_NODE_WPF(1), } },
+   { VSP1_ENTITY_WPF, 2, 0, { VI6_DPR_NODE_WPF(2), } },
+   { VSP1_ENTITY_WPF, 3, 0, { VI6_DPR_NODE_WPF(3), } },
+};
+
 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
 unsigned int num_pads)
 {
-   static const struct {
-   unsigned int id;
-   unsigned int reg;
-   } routes[] = {
-   { VI6_DPR_NODE_HSI, VI6_DPR_HSI_ROUTE },
-   { VI6_DPR_NODE_HST, VI6_DPR_HST_ROUTE },
-   { VI6_DPR_NODE_LIF, 0 },
-   { VI6_DPR_NODE_LUT, VI6_DPR_LUT_ROUTE },
-   { VI6_DPR_NODE_RPF(0), VI6_DPR_RPF_ROUTE(0) },
-   { VI6_DPR_NODE_RPF(1), VI6_DPR_RPF_ROUTE(1) },
-   { VI6_DPR_NODE_RPF(2), VI6_DPR_RPF_ROUTE(2) },
-   { VI6_DPR_NODE_RPF(3), VI6_DPR_RPF_ROUTE(3) },
-   { VI6_DPR_NODE_RPF(4), VI6_DPR_RPF_ROUTE(4) },
-   { VI6_DPR_NODE_SRU, VI6_DPR_SRU_ROUTE },
-   { VI6_DPR_NODE_UDS(0), VI6_DPR_UDS_ROUTE(0) },
-   { VI6_DPR_NODE_UDS(1), VI6_DPR_UDS_ROUTE(1) },
-   { VI6_DPR_NODE_UDS(2), VI6_DPR_UDS_ROUTE(2) },
-   { VI6_DPR_NODE_WPF(0), 0 },
-   { VI6_DPR_NODE_WPF(1), 0 },
-   { VI6_DPR_NODE_WPF(2), 0 },
-   { VI6_DPR_NODE_WPF(3), 0 },
-   };
-
unsigned int i;
 
-   for (i = 0; i  ARRAY_SIZE(routes); ++i) {
-   if (routes[i].id == entity-id) {
-   entity-route = routes[i].reg;
+   for (i = 0; i  ARRAY_SIZE(vsp1_routes); ++i) {
+   if (vsp1_routes[i].type == entity-type 
+   vsp1_routes[i].index == entity-index) {
+   entity-route = vsp1_routes[i];
break;
}
}
 
-   if (i == ARRAY_SIZE(routes))
+   if (i == ARRAY_SIZE(vsp1_routes))
return -EINVAL;
 
entity-vsp1 = vsp1;
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h 
b/drivers/media/platform/vsp1/vsp1_entity.h
index e152798..dc31a31 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.h
+++ b/drivers/media/platform/vsp1/vsp1_entity.h
@@ -30,13 +30,31 @@ enum vsp1_entity_type {
VSP1_ENTITY_WPF,
 };
 
+/*
+ * struct vsp1_route - Entity routing configuration
+ * @type: Entity type this routing entry is associated with
+ * @index: 

[PATCH 6/6] ARM: shmobile: r8a7791: Add VSP1 devices to DT

2014-03-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 arch/arm/boot/dts/r8a7791.dtsi | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index b007f9e..315215f 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -462,6 +462,45 @@
status = disabled;
};
 
+   vsp1@fe928000 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe928000 0 0x8000;
+   interrupts = 0 267 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7791_CLK_VSP1_SY;
+
+   renesas,has-lut;
+   renesas,has-sru;
+   renesas,#rpf = 5;
+   renesas,#uds = 3;
+   renesas,#wpf = 4;
+   };
+
+   vsp1@fe93 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe93 0 0x8000;
+   interrupts = 0 246 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7791_CLK_VSP1_DU0;
+
+   renesas,has-lif;
+   renesas,has-lut;
+   renesas,#rpf = 4;
+   renesas,#uds = 1;
+   renesas,#wpf = 4;
+   };
+
+   vsp1@fe938000 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe938000 0 0x8000;
+   interrupts = 0 247 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7791_CLK_VSP1_DU1;
+
+   renesas,has-lif;
+   renesas,has-lut;
+   renesas,#rpf = 4;
+   renesas,#uds = 1;
+   renesas,#wpf = 4;
+   };
+
clocks {
#address-cells = 2;
#size-cells = 2;
-- 
1.8.3.2

--
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/6] v4l: vsp1: Add BRU support

2014-03-05 Thread Laurent Pinchart
The Blend ROP Unit performs blending and ROP operations for up to four
sources.

Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 drivers/media/platform/vsp1/Makefile  |   2 +-
 drivers/media/platform/vsp1/vsp1.h|   2 +
 drivers/media/platform/vsp1/vsp1_bru.c| 395 ++
 drivers/media/platform/vsp1/vsp1_bru.h|  39 +++
 drivers/media/platform/vsp1/vsp1_drv.c|   9 +
 drivers/media/platform/vsp1/vsp1_entity.c |   3 +
 drivers/media/platform/vsp1/vsp1_entity.h |   1 +
 drivers/media/platform/vsp1/vsp1_regs.h   |  98 
 drivers/media/platform/vsp1/vsp1_rpf.c|   6 +-
 drivers/media/platform/vsp1/vsp1_rwpf.h   |   4 +
 drivers/media/platform/vsp1/vsp1_video.c  |  19 ++
 drivers/media/platform/vsp1/vsp1_video.h  |   1 +
 drivers/media/platform/vsp1/vsp1_wpf.c|  12 +-
 13 files changed, 586 insertions(+), 5 deletions(-)
 create mode 100644 drivers/media/platform/vsp1/vsp1_bru.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_bru.h

diff --git a/drivers/media/platform/vsp1/Makefile 
b/drivers/media/platform/vsp1/Makefile
index 151cecd..6a93f92 100644
--- a/drivers/media/platform/vsp1/Makefile
+++ b/drivers/media/platform/vsp1/Makefile
@@ -1,6 +1,6 @@
 vsp1-y := vsp1_drv.o vsp1_entity.o vsp1_video.o
 vsp1-y += vsp1_rpf.o vsp1_rwpf.o vsp1_wpf.o
 vsp1-y += vsp1_hsit.o vsp1_lif.o vsp1_lut.o
-vsp1-y += vsp1_sru.o vsp1_uds.o
+vsp1-y += vsp1_bru.o vsp1_sru.o vsp1_uds.o
 
 obj-$(CONFIG_VIDEO_RENESAS_VSP1)   += vsp1.o
diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 94d1b02..6ff1636 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -28,6 +28,7 @@ struct clk;
 struct device;
 
 struct vsp1_platform_data;
+struct vsp1_bru;
 struct vsp1_hsit;
 struct vsp1_lif;
 struct vsp1_lut;
@@ -50,6 +51,7 @@ struct vsp1_device {
struct mutex lock;
int ref_count;
 
+   struct vsp1_bru *bru;
struct vsp1_hsit *hsi;
struct vsp1_hsit *hst;
struct vsp1_lif *lif;
diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
b/drivers/media/platform/vsp1/vsp1_bru.c
new file mode 100644
index 000..f806954
--- /dev/null
+++ b/drivers/media/platform/vsp1/vsp1_bru.c
@@ -0,0 +1,395 @@
+/*
+ * vsp1_bru.c  --  R-Car VSP1 Blend ROP Unit
+ *
+ * Copyright (C) 2013 Renesas Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include linux/device.h
+#include linux/gfp.h
+
+#include media/v4l2-subdev.h
+
+#include vsp1.h
+#include vsp1_bru.h
+
+#define BRU_MIN_SIZE   4U
+#define BRU_MAX_SIZE   8190U
+
+/* 
-
+ * Device Access
+ */
+
+static inline u32 vsp1_bru_read(struct vsp1_bru *bru, u32 reg)
+{
+   return vsp1_read(bru-entity.vsp1, reg);
+}
+
+static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data)
+{
+   vsp1_write(bru-entity.vsp1, reg, data);
+}
+
+/* 
-
+ * V4L2 Subdevice Core Operations
+ */
+
+static bool bru_is_input_enabled(struct vsp1_bru *bru, unsigned int input)
+{
+   return media_entity_remote_pad(bru-entity.pads[input]) != NULL;
+}
+
+static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+{
+   struct vsp1_bru *bru = to_bru(subdev);
+   struct v4l2_mbus_framefmt *format;
+   unsigned int i;
+
+   if (!enable)
+   return 0;
+
+   format = bru-entity.formats[BRU_PAD_SOURCE];
+
+   /* The hardware is extremely flexible but we have no userspace API to
+* expose all the parameters, nor is it clear whether we would have use
+* cases for all the supported modes. Let's just harcode the parameters
+* to sane default values for now.
+*/
+
+   /* Disable both color data normalization and dithering. */
+   vsp1_bru_write(bru, VI6_BRU_INCTRL, 0);
+
+   /* Set the background position to cover the whole output image and
+* set its color to opaque black.
+*/
+   vsp1_bru_write(bru, VI6_BRU_VIRRPF_SIZE,
+  (format-width  VI6_BRU_VIRRPF_SIZE_HSIZE_SHIFT) |
+  (format-height  VI6_BRU_VIRRPF_SIZE_VSIZE_SHIFT));
+   vsp1_bru_write(bru, VI6_BRU_VIRRPF_LOC, 0);
+   vsp1_bru_write(bru, VI6_BRU_VIRRPF_COL,
+  0xff  VI6_BRU_VIRRPF_COL_A_SHIFT);
+
+   /* Route BRU input 1 as SRC input to the 

[PATCH 0/6] VSP1 Blend/ROP Unit and DT support

2014-03-05 Thread Laurent Pinchart
Hello,

This patch series extends the VSP1 driver with support for the Blend/ROP Units
as well as DT bindings. Please see individual patches for details.

The driver patches (1 to 4) and platform patches (5 to 6) can be merged
independently once the DT bindings will be approved.

The series has been tested with the VSP1-DU0 instance on the Lager and Koelsch
boards.

Laurent Pinchart (6):
  v4l: vsp1: Support multi-input entities
  v4l: vsp1: Add BRU support
  v4l: vsp1: uds: Enable scaling of alpha layer
  v4l: vsp1: Add DT support
  ARM: shmobile: r8a7790: Add VSP1 devices to DT
  ARM: shmobile: r8a7791: Add VSP1 devices to DT

 .../devicetree/bindings/media/renesas,vsp1.txt |  51 +++
 arch/arm/boot/dts/r8a7790.dtsi |  55 +++
 arch/arm/boot/dts/r8a7791.dtsi |  39 ++
 drivers/media/platform/vsp1/Makefile   |   2 +-
 drivers/media/platform/vsp1/vsp1.h |   2 +
 drivers/media/platform/vsp1/vsp1_bru.c | 395 +
 drivers/media/platform/vsp1/vsp1_bru.h |  39 ++
 drivers/media/platform/vsp1/vsp1_drv.c |  61 +++-
 drivers/media/platform/vsp1/vsp1_entity.c  |  57 +--
 drivers/media/platform/vsp1/vsp1_entity.h  |  24 +-
 drivers/media/platform/vsp1/vsp1_hsit.c|   7 +-
 drivers/media/platform/vsp1/vsp1_lif.c |   1 -
 drivers/media/platform/vsp1/vsp1_lut.c |   1 -
 drivers/media/platform/vsp1/vsp1_regs.h|  98 +
 drivers/media/platform/vsp1/vsp1_rpf.c |   7 +-
 drivers/media/platform/vsp1/vsp1_rwpf.h|   4 +
 drivers/media/platform/vsp1/vsp1_sru.c |   1 -
 drivers/media/platform/vsp1/vsp1_uds.c |   4 +-
 drivers/media/platform/vsp1/vsp1_video.c   |  26 +-
 drivers/media/platform/vsp1/vsp1_video.h   |   1 +
 drivers/media/platform/vsp1/vsp1_wpf.c |  13 +-
 21 files changed, 830 insertions(+), 58 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,vsp1.txt
 create mode 100644 drivers/media/platform/vsp1/vsp1_bru.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_bru.h

-- 
Regards,

Laurent Pinchart

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


[PATCH 4/6] v4l: vsp1: Add DT support

2014-03-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 .../devicetree/bindings/media/renesas,vsp1.txt | 51 +
 drivers/media/platform/vsp1/vsp1_drv.c | 52 ++
 2 files changed, 95 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,vsp1.txt

(With the DT mailing list CC'ed this time, sorry about that)

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.txt 
b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
new file mode 100644
index 000..3b828d4
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.txt
@@ -0,0 +1,51 @@
+* Renesas VSP1 Video Processing Engine
+
+The VSP1 is a video processing engine that supports up-/down-scaling, alpha
+blending, color space conversion and various other image processing features.
+It can be found in the Renesas R-Car second generation SoCs.
+
+Required properties:
+
+  - compatible: Must contain renesas,vsp1
+
+  - reg: Base address and length of the registers block for the VSP1.
+  - interrupt-parent, interrupts: Specifier for the VSP1 interrupt.
+
+  - clocks: A list of phandle + clock-specifier pairs for the main VSP1 clock
+and the optional auxiliary RT clock if needed. VSP1 instances that need an
+auxiliary RT clock must specify the clock-names property.
+
+  - renesas,#rpf: Number of Read Pixel Formatter (RPF) modules in the VSP1.
+  - renesas,#uds: Number of Up Down Scaler (UDS) modules in the VSP1.
+  - renesas,#wpf: Number of Write Pixel Formatter (WPF) modules in the VSP1.
+
+
+Optional properties:
+
+  - clock-names: When the VSP1 requires an auxiliary RT clock this property
+must be present and must contain , rt.
+
+  - renesas,has-lif: Boolean, indicates that the LCD Interface (LIF) module is
+available.
+  - renesas,has-lut: Boolean, indicates that the Look Up Table (LUT) module is
+available.
+  - renesas,has-sru: Boolean, indicates that the Super Resolution Unit (SRU)
+module is available.
+
+
+Example: R8A7790 (R-Car H2) VSP1-S node
+
+   vsp1@fe928000 {
+   compatible = renesas,vsp1;
+   reg = 0 0xfe928000 0 0x8000;
+   interrupts = 0 267 IRQ_TYPE_LEVEL_HIGH;
+   clocks = mstp1_clks R8A7790_CLK_VSP1_SY,
+mstp1_clks R8A7790_CLK_VSP1_RT;
+   clock-names = , rt;
+
+   renesas,has-lut;
+   renesas,has-sru;
+   renesas,#rpf = 5;
+   renesas,#uds = 3;
+   renesas,#wpf = 4;
+   };
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 5f774cc..b75ca84 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -16,6 +16,7 @@
 #include linux/device.h
 #include linux/interrupt.h
 #include linux/module.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/videodev2.h
 
@@ -458,34 +459,59 @@ static const struct dev_pm_ops vsp1_pm_ops = {
  * Platform Driver
  */
 
-static struct vsp1_platform_data *
-vsp1_get_platform_data(struct platform_device *pdev)
+static int vsp1_validate_platform_data(struct platform_device *pdev,
+  struct vsp1_platform_data *pdata)
 {
-   struct vsp1_platform_data *pdata = pdev-dev.platform_data;
-
if (pdata == NULL) {
dev_err(pdev-dev, missing platform data\n);
-   return NULL;
+   return -EINVAL;
}
 
if (pdata-rpf_count = 0 || pdata-rpf_count  VPS1_MAX_RPF) {
dev_err(pdev-dev, invalid number of RPF (%u)\n,
pdata-rpf_count);
-   return NULL;
+   return -EINVAL;
}
 
if (pdata-uds_count = 0 || pdata-uds_count  VPS1_MAX_UDS) {
dev_err(pdev-dev, invalid number of UDS (%u)\n,
pdata-uds_count);
-   return NULL;
+   return -EINVAL;
}
 
if (pdata-wpf_count = 0 || pdata-wpf_count  VPS1_MAX_WPF) {
dev_err(pdev-dev, invalid number of WPF (%u)\n,
pdata-wpf_count);
-   return NULL;
+   return -EINVAL;
}
 
+   return 0;
+}
+
+static struct vsp1_platform_data *
+vsp1_get_platform_data(struct platform_device *pdev)
+{
+   struct device_node *np = pdev-dev.of_node;
+   struct vsp1_platform_data *pdata;
+
+   if (!IS_ENABLED(CONFIG_OF) || np == NULL)
+   return pdev-dev.platform_data;
+
+   pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
+   if (pdata == NULL)
+   return NULL;
+
+   if (of_property_read_bool(np, renesas,has-lif))
+   pdata-features |= VSP1_HAS_LIF;
+   if (of_property_read_bool(np, renesas,has-lut))
+   pdata-features |= VSP1_HAS_LUT;
+   if (of_property_read_bool(np, 

Re: [GIT PULL FOR v3.15] DocBook build fix

2014-03-05 Thread Mauro Carvalho Chehab
Hi Sakari,

Em Sun, 2 Mar 2014 17:40:24 +0200
Sakari Ailus sakari.ai...@iki.fi escreveu:

 Hi Mauro,
 
 Here's a trivial fix for the DocBook build. Please pull.
 
 The following changes since commit a06b429df49bb50ec1e671123a45147a1d1a6186:
 
   [media] au0828: rework GPIO management for HVR-950q (2014-02-28 15:21:31 
 -0300)
 
 are available in the git repository at:
 
   ssh://linuxtv.org/git/sailus/media_tree.git v4l2-doc-fix
 
 for you to fetch changes up to 8a7beb0cc41415f50c13bedc4dc13a4a49895839:
 
   v4l: Trivial documentation fix (2014-03-02 17:23:36 +0200)
 
 
 Sakari Ailus (1):
   v4l: Trivial documentation fix

Thanks for the patch. Unfortunately, I ended by writing the very same
fix before applying from this tree, as I noticed the DocBook compilation
breakage while merging some other docbook patch.

Regards,
Mauro

 
  Documentation/DocBook/media/v4l/controls.xml |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 


-- 

Cheers,
Mauro
--
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] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Mauro Carvalho Chehab
Em Tue, 11 Feb 2014 13:38:51 +0100
Laurent Pinchart laurent.pinch...@ideasonboard.com escreveu:

 Hi Paul,
 
 Thank you for the patch.
 
 On Tuesday 11 February 2014 12:17:01 Paul Bolle wrote:
  Commit d632dfefd36f ([media] v4l: omap4iss: Add support for OMAP4
  camera interface - Build system) added a Kconfig entry for
  VIDEO_OMAP4_DEBUG. But nothing uses that symbol.
  
  This entry was apparently copied from a similar entry for OMAP 3
  Camera debug messages. The OMAP 3 entry is used to set the DEBUG
  compiler flag, which enables calls of dev_dbg().
  
  So add a Makefile line to do that for omap4iss too.
  
  Signed-off-by: Paul Bolle pebo...@tiscali.nl
 
 Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 
 and applied to my tree.
 
  ---
  0) v1 was called [media] v4l: omap4iss: Remove VIDEO_OMAP4_DEBUG. This
  versions implements Laurent's alternative (which is much better).
 
 Thanks :-)
 
  1) Still untested.
  
   drivers/staging/media/omap4iss/Makefile | 2 ++
   1 file changed, 2 insertions(+)
  
  diff --git a/drivers/staging/media/omap4iss/Makefile
  b/drivers/staging/media/omap4iss/Makefile index a716ce9..f46c6bd 100644
  --- a/drivers/staging/media/omap4iss/Makefile
  +++ b/drivers/staging/media/omap4iss/Makefile
  @@ -1,5 +1,7 @@
   # Makefile for OMAP4 ISS driver
  
  +ccflags-$(CONFIG_VIDEO_OMAP4_DEBUG) += -DDEBUG
  +

This seems to be a very bad idea on my eyes. It is just creating an
alias to an already existing Kconfig symbol with no good reason.

To be fair, there are also two other drivers doing this:


drivers/media/platform/omap3isp/Makefile:ccflags-$(CONFIG_VIDEO_OMAP3_DEBUG) += 
-DDEBUG

drivers/media/platform/ti-vpe/Makefile:ccflags-$(CONFIG_VIDEO_TI_VPE_DEBUG) += 
-DDEBUG

It sounds better do to a s/CONFIG_DEBUG/CONFIG_VIDEO_whatever_DEBUG/ 
inside each of those driver, or to just remove this, and document that
one should enable CONFIG_DEBUG if they want to debug v4l2 drivers.

   omap4-iss-objs += \
  iss.o iss_csi2.o iss_csiphy.o iss_ipipeif.o iss_ipipe.o iss_resizer.o
  iss_video.o
 


-- 

Cheers,
Mauro
--
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: [linuxtv-media:master 499/499] drivers/media/usb/usbtv/usbtv-core.c:119:22: sparse: symbol 'usbtv_id_table' was not declared. Should it be static?

2014-03-05 Thread Mauro Carvalho Chehab
Em Wed, 5 Mar 2014 14:27:46 -0300
Mauro Carvalho Chehab m.che...@samsung.com escreveu:

 Hi Fengguang,
 
 This patch got obsoleted by another patch in the same series.
 
 Unfortunately, I had to break sending the patch series into a few
 pushes, as my mailbomb script has a logic there that prevents it to
 send more than 30~50 emails (I never remember the exact setting).
 
 So, I pushed this 80-series into a few pushes. You likely compiled the
 tree without waiting for the hole series to be upstreamed.

Sorry, I sent the reply to the wrong patch. The above comments are for
this patch:
Subject: [PATCH linuxtv-media] drx-j: drxj_default_aud_data_g can be 
static

That was on the email with this title:
[linuxtv-media:master 428/499] 
drivers/media/dvb-frontends/drx39xyj/drxj.c:1039:16: sparse: symbol 
'drxj_default_aud_data_g' was not declared. Should

Regards,
Mauro

 
 Regards,
 Mauro
 
 Em Tue, 04 Feb 2014 17:02:02 +0800
 kbuild test robot fengguang...@intel.com escreveu:
 
  tree:   git://linuxtv.org/media_tree.git master
  head:   a3550ea665acd1922df8275379028c1634675629
  commit: a3550ea665acd1922df8275379028c1634675629 [499/499] [media] usbtv: 
  split core and video implementation
  reproduce: make C=1 CF=-D__CHECK_ENDIAN__
  
  
  sparse warnings: (new ones prefixed by )
  
   drivers/media/usb/usbtv/usbtv-core.c:119:22: sparse: symbol 
   'usbtv_id_table' was not declared. Should it be static?
   drivers/media/usb/usbtv/usbtv-core.c:129:19: sparse: symbol 
   'usbtv_usb_driver' was not declared. Should it be static?
  --
   drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:285:14: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:287:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:288:15: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:289:20: sparse: cast to restricted 
   __be32
   drivers/media/usb/usbtv/usbtv-video.c:565:23: sparse: symbol 
   'usbtv_ioctl_ops' was not declared. Should it be static?
   drivers/media/usb/usbtv/usbtv-video.c:587:29: sparse: symbol 
   'usbtv_fops' was not declared. Should it be static?
   drivers/media/usb/usbtv/usbtv-video.c:648:16: sparse: symbol 
   'usbtv_vb2_ops' was not declared. Should it be static?
  
  Please consider folding the attached diff :-)
  
  ---
  0-DAY kernel build testing backend  Open Source Technology 
  Center
  http://lists.01.org/mailman/listinfo/kbuild Intel 
  Corporation
 
 


-- 

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


To: 许总 (亲启) --- 2014第12届中国国际汽车零部件及用品展览会 【参展信息】 YD20120302-2

2014-03-05 Thread slqm
诚邀参加【2014 中国汽车零部件(全球)采供峰会】——
  
★ 亚洲顶级展馆,逾16万买家、逾1000家展商、3000多个展位
★ 汽车零部件行业年中盛宴,政府重点支持,企业积极参与
★ 全球汽车零部件一站式采购平台,中国汽车产业发展和国际交流合作的风向标
  
  
展会名称: 2014第12届中国(广州)国际汽车零部件及用品展览会
英文名称: The 12th China (Guangzhou) International Auto Parts Expo,2014
  
展会时间: 2014年6月09-11日
展会地点: 广州琶洲保利世贸博览馆 (中国广东省广州市海珠区新港东路1000号)
  
  
咨询电话: 4000-680-860(转8144或5220); 139-1031-8144; 010―8211-3755、8699-7155; 
在线客服: QQ/ 82775507;  微信/ yondexpo;  邮箱/ yonde...@163.com; 
  
官方微博: http://weibo.com/qipeizhan 
展会详情: 请联络组委会索取《参展邀请函》及相关资料!! 
  
  
  
  
---
【友情提示】此邮件由『100%百万邮件*群发系统』发送。如需发送请Q:1055-800812。 
N�r��yb�X��ǧv�^�)޺{.n�+{���bj)w*jg����ݢj/���z�ޖ��2�ޙ�)ߡ�a�����G���h��j:+v���w��٥

Please change v4l2_format_sdr to v4l2_sdr_format

2014-03-05 Thread Hans Verkuil
Hi Antti,

While adding sdr support for v4l2-compliance I noticed that the sdr field
of v4l2_format has type struct v4l2_format_sdr. Can you change that to
v4l2_sdr_format to be consistent with the others? (pix/vbi/sliced_vbi_format).

It's unexpected and it can still be changed.

Sorry I missed that earlier.

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


uvcvideo: logitech C920 resets controls during VIDIOC_STREAMON

2014-03-05 Thread William Manley
Hi All

I've been attempting to use the Logitech C920 with the uvcvideo driver.
 I set the controls with v4l2-ctl but some of them change during
VIDIOC_STREAMON.  My understanding is that the values of controls should
be preserved.

Minimal test case:

#include linux/videodev2.h
#include stdio.h
#include stdlib.h
#include fcntl.h
#include errno.h
#include string.h
#include unistd.h
#include sys/ioctl.h

#define DEVICE /dev/video2

int main()
{
int fd, type;

fd = open(DEVICE, O_RDWR | O_CLOEXEC);
if (fd  0) {
perror(Failed to open  DEVICE \n);
return 1;
}

struct v4l2_requestbuffers reqbuf = {
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
.memory = V4L2_MEMORY_MMAP,
.count = 1,
};

if (-1 == ioctl (fd, VIDIOC_REQBUFS, reqbuf)) {
perror(VIDIOC_REQBUFS);
return 1;
}

system(v4l2-ctl -d DEVICE  -l | grep exposure_absolute);

type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (fd, VIDIOC_STREAMON, type) != 0) {
perror(VIDIOC_STREAMON);
return 1;
}

printf(VIDIOC_STREAMON\n);

usleep(10);
system(v4l2-ctl -d DEVICE  -l | grep exposure_absolute);

return 0;
}

None of the other controls seem to be affected.  Note: to get the C920
to report exposure_absolute correctly I also had to make this change to
the uvcvideo kernel driver:

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c
b/drivers/media/usb/uvc/uvc_ctrl.c
index a2f4501..e7c805b 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -227,7 +227,8 @@ static struct uvc_control_info uvc_ctrls[] = {
.size   = 4,
.flags  = UVC_CTRL_FLAG_SET_CUR
| UVC_CTRL_FLAG_GET_RANGE
-   | UVC_CTRL_FLAG_RESTORE,
+   | UVC_CTRL_FLAG_RESTORE
+   | UVC_CTRL_FLAG_AUTO_UPDATE,
},
{
.entity = UVC_GUID_UVC_CAMERA,


The variables seem to be changed when the URBs are Submitted.  To
investigate I made the following change to the uvc driver:


diff --git a/drivers/media/usb/uvc/uvc_video.c
b/drivers/media/usb/uvc/uvc_video.c
index 3394c34..f2f66f6 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1649,17 +1649,23 @@ static int uvc_init_video(struct uvc_streaming
*stream, gfp_t gfp_flags)
if (ret  0)
return ret;

+   /* No effect: */
+   uvc_ctrl_resume_device(stream-dev);
+
/* Submit the URBs. */
for (i = 0; i  UVC_URBS; ++i) {
ret = usb_submit_urb(stream-urb[i], gfp_flags);
if (ret  0) {
uvc_printk(KERN_ERR, Failed to submit URB %u 
(%d).\n, i, ret);
uvc_uninit_video(stream, 1);
return ret;
}
}

+   /* Fixes the issue: */
+   uvc_ctrl_resume_device(stream-dev);
+
return 0;
 }


At this point the backtrace looks something like:

uvc_init_video
uvc_video_enable
uvc_v4l2_do_ioctl (in the case VIDIOC_STREAMON:)

The call to uvc_ctrl_resume_device() has the effect that the v4l2 ctrls
which are cached in the kernel get resubmitted to the camera as if it
were coming out of suspend/resume.

I've looked at the wireshark capture of USB traffic and I can't find
anywhere where the host causes exposure_auto to change.  The camera does
have a mode where it would change by itself but that is disabled
(exposure_auto=1).  I've uploaded the wireshark trace to:

http://williammanley.net/usb-wireshark-streamon.pcapng

I'm guessing that this is a hardware bug.  One fix would be modify the
driver to save all values at the beginning of STREAMON and then restore
them at the end.  What do you think?

Thanks

Will
--
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] rtl2832u_sdr: fixing v4l2-compliance issues

2014-03-05 Thread Hans Verkuil
Antti,

Attached is a patch that fixed all but one v4l2-compliance error:

fail: v4l2-test-controls.cpp(295): returned control value out 
of range
fail: v4l2-test-controls.cpp(357): invalid control 00a2090c
test VIDIOC_G/S_CTRL: FAIL
fail: v4l2-test-controls.cpp(465): returned control value out 
of range
fail: v4l2-test-controls.cpp(573): invalid control 00a2090c
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL

That's the BANDWIDTH control and it returned value 320 when the minimum was 
600.
I couldn't trace where that came from in the limited time I spent on it, I 
expect you
can find it much quicker.

I did my testing with this tree:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/sdr

which is a merge of your tree:

http://git.linuxtv.org/media-tree.git/shortlog/refs/heads/sdr

and my ongoing vb2-fixes tree:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/vb2-part4

I leave it to you to process this patch further.

Regards,

Hans

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index ac487cb..3013305 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -120,6 +120,7 @@ struct rtl2832_sdr_state {
struct vb2_queue vb_queue;
struct list_head queued_bufs;
spinlock_t queued_bufs_lock; /* Protects queued_bufs */
+   unsigned sequence;   /* buffer sequence counter */
 
/* Note if taking both locks v4l2_lock must always be locked first! */
struct mutex v4l2_lock;  /* Protects everything else */
@@ -415,6 +416,8 @@ static void rtl2832_sdr_urb_complete(struct urb *urb)
len = rtl2832_sdr_convert_stream(s, ptr, urb-transfer_buffer,
urb-actual_length);
vb2_set_plane_payload(fbuf-vb, 0, len);
+   v4l2_get_timestamp(fbuf-vb.v4l2_buf.timestamp);
+   fbuf-vb.v4l2_buf.sequence = s-sequence++;
vb2_buffer_done(fbuf-vb, VB2_BUF_STATE_DONE);
}
 skip:
@@ -611,8 +614,9 @@ static int rtl2832_sdr_queue_setup(struct vb2_queue *vq,
struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq);
dev_dbg(s-udev-dev, %s: *nbuffers=%d\n, __func__, *nbuffers);
 
-   /* Absolute min and max number of buffers available for mmap() */
-   *nbuffers = clamp_t(unsigned int, *nbuffers, 8, 32);
+   /* Need at least 8 buffers */
+   if (vq-num_buffers + *nbuffers  8)
+   *nbuffers = 8 - vq-num_buffers;
*nplanes = 1;
/* 2 = max 16-bit sample returned */
sizes[0] = PAGE_ALIGN(BULK_BUFFER_SIZE * 2);
@@ -1013,6 +1017,8 @@ static int rtl2832_sdr_start_streaming(struct vb2_queue 
*vq, unsigned int count)
if (ret)
goto err;
 
+   s-sequence = 0;
+
ret = rtl2832_sdr_submit_urbs(s);
if (ret)
goto err;
@@ -1087,6 +1093,8 @@ static int rtl2832_sdr_s_tuner(struct file *file, void 
*priv,
struct rtl2832_sdr_state *s = video_drvdata(file);
dev_dbg(s-udev-dev, %s:\n, __func__);
 
+   if (v-index  1)
+   return -EINVAL;
return 0;
 }
 
@@ -1122,12 +1130,15 @@ static int rtl2832_sdr_g_frequency(struct file *file, 
void *priv,
dev_dbg(s-udev-dev, %s: tuner=%d type=%d\n,
__func__, f-tuner, f-type);
 
-   if (f-tuner == 0)
+   if (f-tuner == 0) {
f-frequency = s-f_adc;
-   else if (f-tuner == 1)
+   f-type = V4L2_TUNER_ADC;
+   } else if (f-tuner == 1) {
f-frequency = s-f_tuner;
-   else
+   f-type = V4L2_TUNER_RF;
+   } else {
return -EINVAL;
+   }
 
return ret;
 }
@@ -1161,7 +1172,9 @@ static int rtl2832_sdr_s_frequency(struct file *file, 
void *priv,
__func__, s-f_adc);
ret = rtl2832_sdr_set_adc(s);
} else if (f-tuner == 1) {
-   s-f_tuner = f-frequency;
+   s-f_tuner = clamp_t(unsigned int, f-frequency,
+   bands_fm[0].rangelow,
+   bands_fm[0].rangehigh);
dev_dbg(s-udev-dev, %s: RF frequency=%u Hz\n,
__func__, f-frequency);
 
@@ -1195,6 +1208,7 @@ static int rtl2832_sdr_g_fmt_sdr_cap(struct file *file, 
void *priv,
dev_dbg(s-udev-dev, %s:\n, __func__);
 
f-fmt.sdr.pixelformat = s-pixelformat;
+   memset(f-fmt.sdr.reserved, 0, sizeof(f-fmt.sdr.reserved));
 
return 0;
 }
@@ -1211,6 +1225,7 @@ static int rtl2832_sdr_s_fmt_sdr_cap(struct file *file, 
void *priv,
if (vb2_is_busy(q))
return -EBUSY;
 
+   memset(f-fmt.sdr.reserved, 0, sizeof(f-fmt.sdr.reserved));

Re: [PATCH v2] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Laurent Pinchart
Hi Mauro,

Thank you for the review.

On Wednesday 05 March 2014 17:10:06 Mauro Carvalho Chehab wrote:
 Em Tue, 11 Feb 2014 13:38:51 +0100 Laurent Pinchart escreveu:
  On Tuesday 11 February 2014 12:17:01 Paul Bolle wrote:
   Commit d632dfefd36f ([media] v4l: omap4iss: Add support for OMAP4
   camera interface - Build system) added a Kconfig entry for
   VIDEO_OMAP4_DEBUG. But nothing uses that symbol.
   
   This entry was apparently copied from a similar entry for OMAP 3
   Camera debug messages. The OMAP 3 entry is used to set the DEBUG
   compiler flag, which enables calls of dev_dbg().
   
   So add a Makefile line to do that for omap4iss too.
   
   Signed-off-by: Paul Bolle pebo...@tiscali.nl
  
  Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
  
  and applied to my tree.
  
   ---
   0) v1 was called [media] v4l: omap4iss: Remove VIDEO_OMAP4_DEBUG. This
   versions implements Laurent's alternative (which is much better).
  
  Thanks :-)
  
   1) Still untested.
   
drivers/staging/media/omap4iss/Makefile | 2 ++
1 file changed, 2 insertions(+)
   
   diff --git a/drivers/staging/media/omap4iss/Makefile
   b/drivers/staging/media/omap4iss/Makefile index a716ce9..f46c6bd 100644
   --- a/drivers/staging/media/omap4iss/Makefile
   +++ b/drivers/staging/media/omap4iss/Makefile
   @@ -1,5 +1,7 @@
   
# Makefile for OMAP4 ISS driver
   
   +ccflags-$(CONFIG_VIDEO_OMAP4_DEBUG) += -DDEBUG
   +
 
 This seems to be a very bad idea on my eyes. It is just creating an alias to
 an already existing Kconfig symbol with no good reason.
 
 To be fair, there are also two other drivers doing this:
 
   
drivers/media/platform/omap3isp/Makefile:ccflags-$(CONFIG_VIDEO_OMAP3_DEBUG
 ) += -DDEBUG
 drivers/media/platform/ti-vpe/Makefile:ccflags-$(CONFIG_VIDEO_TI_VPE_DEBUG)
 += -DDEBUG
 
 It sounds better do to a s/CONFIG_DEBUG/CONFIG_VIDEO_whatever_DEBUG/
 inside each of those driver, or to just remove this, and document that
 one should enable CONFIG_DEBUG if they want to debug v4l2 drivers.

Please note that -DDEBUG is equivalent to '#define DEBUG', not to '#define 
CONFIG_DEBUG'. 'DEBUG' needs to be defined for dev_dbg() to have any effect. 
Furthermore, there's not CONFIG_DEBUG as far as I know.

An alternative to this would be to add

#ifdef CONFIG_VIDEO_OMAP3_DEBUG
#define DEBUG
#endif

at the beginning of each source file of the driver. That doesn't seem very 
practical to me though.

omap4-iss-objs += \

 iss.o iss_csi2.o iss_csiphy.o iss_ipipeif.o iss_ipipe.o iss_resizer.o
   
   iss_video.o

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 0/5] rc: scancode filtering improvements

2014-03-05 Thread James Hogan
Hi Antti,

On Wednesday 05 March 2014 20:12:15 Antti Seppälä wrote:
 After reviewing the series and porting my nuvoton changes to it I
 haven't noticed any errors worth mentioning.
 In fact I think this series is very well written and should be merged.

Thanks for reviewing!

 James, I hope you also have the time to submit the ir encoder series
 for inclusion. :)

I did a little work on it the other day, including adding encode+loopback on 
filter change to loopback driver, fixing a few bugs and adding RC-5/RC-5X 
encode. I'll probably see what I can do to add partial encode to be sure the 
API doesn't fall short and then send a combined patchset.

Cheers
James

signature.asc
Description: This is a digitally signed message part.


Re: [PATCH v2] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Joe Perches
On Thu, 2014-03-06 at 00:50 +0100, Laurent Pinchart wrote:

 Please note that -DDEBUG is equivalent to '#define DEBUG', not to '#define 
 CONFIG_DEBUG'. 'DEBUG' needs to be defined for dev_dbg() to have any effect. 

Not quite.  If CONFIG_DYNAMIC_DEBUG is set, these
dev_dbg statements are compiled in but not by default
set to emit output.  Output can be enabled by using
dynamic_debug controls like:

# echo -n 'file omap4iss/* +p'  debugfs/dynamic_debug/control

See Documentation/dynamic-debug-howto.txt for more details.


--
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] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Laurent Pinchart
Hi Joe,

On Wednesday 05 March 2014 16:28:03 Joe Perches wrote:
 On Thu, 2014-03-06 at 00:50 +0100, Laurent Pinchart wrote:
  Please note that -DDEBUG is equivalent to '#define DEBUG', not to '#define
  CONFIG_DEBUG'. 'DEBUG' needs to be defined for dev_dbg() to have any
  effect.

 Not quite.  If CONFIG_DYNAMIC_DEBUG is set, these
 dev_dbg statements are compiled in but not by default
 set to emit output.  Output can be enabled by using
 dynamic_debug controls like:
 
 # echo -n 'file omap4iss/* +p'  debugfs/dynamic_debug/control
 
 See Documentation/dynamic-debug-howto.txt for more details.

Thank you for the additional information.

Would you recommend to drop driver-specific Kconfig options related to 
debugging and use CONFIG_DYNAMIC_DEBUG instead ?

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v2] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Joe Perches
On Thu, 2014-03-06 at 01:48 +0100, Laurent Pinchart wrote:
 Would you recommend to drop driver-specific Kconfig options related to 
 debugging and use CONFIG_DYNAMIC_DEBUG instead ?

For development, sure, if there's sufficient memory.

For embedded systems with limited memory, using
dynamic_debug isn't always possible or effective.

Also, there are sometimes reasons to have debugging
messages always enabled or emitted.

For those cases, either adding #define DEBUG or using
printk(KERN_DEBUG would be fine.


--
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] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Laurent Pinchart
Hi Joe,

On Wednesday 05 March 2014 17:00:37 Joe Perches wrote:
 On Thu, 2014-03-06 at 01:48 +0100, Laurent Pinchart wrote:
  Would you recommend to drop driver-specific Kconfig options related to
  debugging and use CONFIG_DYNAMIC_DEBUG instead ?
 
 For development, sure, if there's sufficient memory.
 
 For embedded systems with limited memory, using dynamic_debug isn't always
 possible or effective.
 
 Also, there are sometimes reasons to have debugging messages always enabled
 or emitted.
 
 For those cases, either adding #define DEBUG or using printk(KERN_DEBUG
 would be fine.

My goal here is to offer an easy way for users to enable debugging without 
requiring changes to the source code. The driver includes various dev_dbg() 
messages, I don't want to ask people reporting problems to turn them into 
printk() calls :-) Even adding #define DEBUG at the beginning of the source 
files is likely too error prone for users without much programming experience.

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v2] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Joe Perches
On Thu, 2014-03-06 at 02:27 +0100, Laurent Pinchart wrote:
 On Wednesday 05 March 2014 17:00:37 Joe Perches wrote:
  On Thu, 2014-03-06 at 01:48 +0100, Laurent Pinchart wrote:
   Would you recommend to drop driver-specific Kconfig options related to
   debugging and use CONFIG_DYNAMIC_DEBUG instead ?
  For development, sure, if there's sufficient memory.
  For embedded systems with limited memory, using dynamic_debug isn't always
  possible or effective.
  Also, there are sometimes reasons to have debugging messages always enabled
  or emitted.
  For those cases, either adding #define DEBUG or using printk(KERN_DEBUG
  would be fine.
 My goal here is to offer an easy way for users to enable debugging without 
 requiring changes to the source code.

Dynamic debugging works, but various distributions don't
have it enabled.

 The driver includes various dev_dbg() 
 messages, I don't want to ask people reporting problems to turn them into 
 printk() calls :-) Even adding #define DEBUG at the beginning of the source 
 files is likely too error prone for users without much programming experience.

I think your best bet is to add #define DEBUG to a common
header file like iss.h or omap4iss.h




--
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: [RFCv1 PATCH 0/4] add G/S_EDID support for video nodes

2014-03-05 Thread Laurent Pinchart
Hi Hans,

Thank you for the patches.

On Tuesday 04 March 2014 12:30:55 Hans Verkuil wrote:
 Currently the VIDIOC_SUBDEV_G/S_EDID and struct v4l2_subdev_edid are subdev
 APIs. However, that's in reality quite annoying since for simple video
 pipelines there is no need to create v4l-subdev device nodes for anything
 else except for setting or getting EDIDs.
 
 What happens in practice is that v4l2 bridge drivers add explicit support
 for VIDIOC_SUBDEV_G/S_EDID themselves, just to avoid having to create
 subdev device nodes just for this.
 
 So this patch series makes the ioctls available as regular ioctls as
 well. In that case the pad field should be set to 0 and the bridge driver
 will fill in the right pad value internally depending on the current
 input or output and pass it along to the actual subdev driver.

Would it make sense to allow usage of the pad field on video nodes as well ?

Apart from that and minor issues with patch 2/4 this series looks good to me.

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v2] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Laurent Pinchart
Hi Joe,

On Wednesday 05 March 2014 17:35:42 Joe Perches wrote:
 On Thu, 2014-03-06 at 02:27 +0100, Laurent Pinchart wrote:
  On Wednesday 05 March 2014 17:00:37 Joe Perches wrote:
   On Thu, 2014-03-06 at 01:48 +0100, Laurent Pinchart wrote:
Would you recommend to drop driver-specific Kconfig options related to
debugging and use CONFIG_DYNAMIC_DEBUG instead ?
   
   For development, sure, if there's sufficient memory.
   For embedded systems with limited memory, using dynamic_debug isn't
   always possible or effective.
   Also, there are sometimes reasons to have debugging messages always
   enabled or emitted.
   For those cases, either adding #define DEBUG or using printk(KERN_DEBUG
   would be fine.
  
  My goal here is to offer an easy way for users to enable debugging without
  requiring changes to the source code.
 
 Dynamic debugging works, but various distributions don't
 have it enabled.
 
  The driver includes various dev_dbg() messages, I don't want to ask people
  reporting problems to turn them into printk() calls :-) Even adding
  #define DEBUG at the beginning of the source files is likely too error
  prone for users without much programming experience.

 I think your best bet is to add #define DEBUG to a common
 header file like iss.h or omap4iss.h

I've thought about that, but it would require iss.h to be included before all 
other headers. I've also thought about creating an iss-debug.h header to be 
included first just to #define DEBUG, but decided to go for handling the OMAP4 
ISS debug option in the Makefile instead. If that's ugly and discouraged as 
reported by Mauro I can try to come up with something else.

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] [media] s5-mfc: remove meaningless memory bank assignment

2014-03-05 Thread Seung-Woo Kim
Hello Sachin,

On 2014년 03월 05일 20:42, Sachin Kamat wrote:
 On 5 March 2014 16:38, Seung-Woo Kim sw0312@samsung.com wrote:

(...)

 -   dev-bank1 = dev-bank1;
 
 Are you sure this isn't some kind of typo? If not then your commit
 description is too verbose
 to actually say that the code is redundant and could be removed. The
 code here is something like
 
  a = a;
 
 which does not make sense nor add any value and hence redundant and
 could be removed.

Right, this meaningless code can be simply removed as like the first
version. Anyway this redundant made from change of address type in
earlier patch. So I tried to describe that.

Regards,
- Seung-Woo Kim

-- 
Seung-Woo Kim
Samsung Software RD Center
--

--
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] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Joe Perches
On Thu, 2014-03-06 at 02:52 +0100, Laurent Pinchart wrote:

Hi again Laurent

 I've thought about that, but it would require iss.h to be included before all 
 other headers. I've also thought about creating an iss-debug.h header to be 
 included first just to #define DEBUG, but decided to go for handling the 
 OMAP4 
 ISS debug option in the Makefile instead. If that's ugly and discouraged as 
 reported by Mauro I can try to come up with something else.

Unless debugging logging statements are in system level static inlines,
adding #define DEBUG to iss.h should otherwise produce the same output
as -DDEBUG in a Makefile.

--
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] s5-mfc: remove meaningless memory bank assignment

2014-03-05 Thread Sachin Kamat
Hi Seung-Woo,

On 6 March 2014 07:43, Seung-Woo Kim sw0312@samsung.com wrote:
 Hello Sachin,

 On 2014년 03월 05일 20:42, Sachin Kamat wrote:
 On 5 March 2014 16:38, Seung-Woo Kim sw0312@samsung.com wrote:

 (...)

 -   dev-bank1 = dev-bank1;

 Are you sure this isn't some kind of typo? If not then your commit
 description is too verbose
 to actually say that the code is redundant and could be removed. The
 code here is something like

  a = a;

 which does not make sense nor add any value and hence redundant and
 could be removed.

 Right, this meaningless code can be simply removed as like the first
 version. Anyway this redundant made from change of address type in
 earlier patch. So I tried to describe that.

What Kamil meant was that it is not a good practice to leave the
commit description
blank however trivial the patch might be. So a single line stating the
obvious should
be sufficient in this case.

-- 
With warm regards,
Sachin
--
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-03-05 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:   Thu Mar  6 04:00:20 CET 2014
git branch: test
git hash:   bfd0306462fdbc5e0a8c6999aef9dde0f9745399
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.13-5.slh.4-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: WARNINGS
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.31.14-i686: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
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-i686: OK
linux-3.13-i686: OK
linux-3.14-rc1-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
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-x86_64: OK
linux-3.13-x86_64: OK
linux-3.14-rc1-x86_64: OK
apps: OK
spec-git: OK
ABI WARNING: change for arm-at91
ABI WARNING: change for arm-davinci
ABI WARNING: change for arm-exynos
ABI WARNING: change for arm-mx
ABI WARNING: change for arm-omap
ABI WARNING: change for arm-omap1
ABI WARNING: change for arm-pxa
ABI WARNING: change for blackfin
ABI WARNING: change for i686
ABI WARNING: change for m32r
ABI WARNING: change for mips
ABI WARNING: change for powerpc64
ABI WARNING: change for sh
ABI WARNING: change for x86_64
sparse version: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


Re: [PATCH] [media] s5-mfc: remove meaningless memory bank assignment

2014-03-05 Thread Seung-Woo Kim
Hello Sachin,

On 2014년 03월 06일 12:28, Sachin Kamat wrote:
 Hi Seung-Woo,
 
 On 6 March 2014 07:43, Seung-Woo Kim sw0312@samsung.com wrote:
 Hello Sachin,

 On 2014년 03월 05일 20:42, Sachin Kamat wrote:
 On 5 March 2014 16:38, Seung-Woo Kim sw0312@samsung.com wrote:

 (...)

 -   dev-bank1 = dev-bank1;

 Are you sure this isn't some kind of typo? If not then your commit
 description is too verbose
 to actually say that the code is redundant and could be removed. The
 code here is something like

  a = a;

 which does not make sense nor add any value and hence redundant and
 could be removed.

 Right, this meaningless code can be simply removed as like the first
 version. Anyway this redundant made from change of address type in
 earlier patch. So I tried to describe that.
 
 What Kamil meant was that it is not a good practice to leave the
 commit description
 blank however trivial the patch might be. So a single line stating the
 obvious should
 be sufficient in this case.
 

Ok, I will re-send with just simple statement.

Thanks,
- Seung-Woo Kim

-- 
Seung-Woo Kim
Samsung Software RD Center
--

--
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] [media] v4l: omap4iss: Add DEBUG compiler flag

2014-03-05 Thread Greg Kroah-Hartman
On Thu, Mar 06, 2014 at 01:48:29AM +0100, Laurent Pinchart wrote:
 Hi Joe,
 
 On Wednesday 05 March 2014 16:28:03 Joe Perches wrote:
  On Thu, 2014-03-06 at 00:50 +0100, Laurent Pinchart wrote:
   Please note that -DDEBUG is equivalent to '#define DEBUG', not to '#define
   CONFIG_DEBUG'. 'DEBUG' needs to be defined for dev_dbg() to have any
   effect.
 
  Not quite.  If CONFIG_DYNAMIC_DEBUG is set, these
  dev_dbg statements are compiled in but not by default
  set to emit output.  Output can be enabled by using
  dynamic_debug controls like:
  
  # echo -n 'file omap4iss/* +p'  debugfs/dynamic_debug/control
  
  See Documentation/dynamic-debug-howto.txt for more details.
 
 Thank you for the additional information.
 
 Would you recommend to drop driver-specific Kconfig options related to 
 debugging and use CONFIG_DYNAMIC_DEBUG instead ?

Yes, please do that, no one wants to rebuild drivers and subsystems with
different options just for debugging.

thanks,

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


Re: [PATCH v3] [media] s5p-mfc: remove meaningless memory bank assignment

2014-03-05 Thread Sachin Kamat
Hi Seung-Woo,

On 6 March 2014 10:25, Seung-Woo Kim sw0312@samsung.com wrote:
 This patch removes meaningless assignment of memory bank to itself.

 Signed-off-by: Seung-Woo Kim sw0312@samsung.com
 ---

Thanks for re-doing this.

Acked-by: Sachin Kamat sachin.ka...@linaro.org

-- 
With warm regards,
Sachin
--
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] s5p-mfc: Add a control for IVF format for VP8 encoder

2014-03-05 Thread Arun Kumar K
From: Pawel Osciak posc...@chromium.org

Add a control to enable/disable IVF output stream format for VP8 encode.
Set the IVF format output to disabled as default.

Signed-off-by: Pawel Osciak posc...@chromium.org
Signed-off-by: Arun Kumar K arun...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml|8 
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   11 +++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |2 ++
 drivers/media/v4l2-core/v4l2-ctrls.c|1 +
 include/uapi/linux/v4l2-controls.h  |1 +
 6 files changed, 24 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 0e1770c..07fb64a 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3222,6 +3222,14 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a 
golden frame./entry
 Acceptable values are 0, 1, 2 and 3 corresponding to encoder profiles 0, 1, 2 
and 3./entry
  /row
 
+ rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT/constantnbsp;/entry
+   entryboolean/entry
+ /row
+ rowentry spanname=descrOutputs the VP8 encoded stream in 
IVF file format./entry
+ /row
+
   rowentry/entry/row
 /tbody
   /tgroup
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 5c28cc3..4d17df9 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -418,6 +418,7 @@ struct s5p_mfc_vp8_enc_params {
u8 rc_frame_qp;
u8 rc_p_frame_qp;
u8 profile;
+   bool ivf;
 };
 
 /**
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index df83cd1..a67913e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -676,6 +676,14 @@ static struct mfc_control controls[] = {
.step = 1,
.default_value = 0,
},
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT,
+   .type = V4L2_CTRL_TYPE_BOOLEAN,
+   .minimum = 0,
+   .maximum = 1,
+   .step = 1,
+   .default_value = 0,
+   },
 };
 
 #define NUM_CTRLS ARRAY_SIZE(controls)
@@ -1636,6 +1644,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:
p-codec.vp8.profile = ctrl-val;
break;
+   case V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT:
+   p-codec.vp8.ivf = ctrl-val;
+   break;
default:
v4l2_err(dev-v4l2_dev, Invalid control, id=%d, val=%d\n,
ctrl-id, ctrl-val);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index f64621a..90edb19 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -1243,6 +1243,8 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx 
*ctx)
 
/* VP8 specific params */
reg = 0;
+   /* Bit set to 1 disables IVF stream format. */
+   reg |= p_vp8-ivf ? 0 : (0x1  12);
reg |= (p_vp8-imd_4x4  0x1)  10;
switch (p_vp8-num_partitions) {
case V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION:
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index e9e12c4..19e78df 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -752,6 +752,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP:return VPX 
I-Frame QP Value;
case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return VPX 
P-Frame QP Value;
case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:   return VPX 
Profile;
+   case V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT:return VPX 
Output stream in IVF format;
 
/* CAMERA controls */
/* Keep the order of the 'case's the same as in videodev2.h! */
diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index cda6fa0..b2763d6 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -565,6 +565,7 @@ enum v4l2_vp8_golden_frame_sel {
 #define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE+509)
 #define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP (V4L2_CID_MPEG_BASE+510)
 #define V4L2_CID_MPEG_VIDEO_VPX_PROFILE
(V4L2_CID_MPEG_BASE+511)
+#define V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT (V4L2_CID_MPEG_BASE+512)
 
 /*  

Re: [RFCv1 PATCH 2/4] v4l2: add VIDIOC_G/S_EDID support to the v4l2 core.

2014-03-05 Thread Hans Verkuil
Hi Laurent,

Thank you for your comments!

On 03/06/2014 02:41 AM, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch.
 
 On Tuesday 04 March 2014 12:30:57 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Support this ioctl as part of the v4l2 core. Use the new ioctl
 name and struct v4l2_edid type in the existing core code.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 32 
  drivers/media/v4l2-core/v4l2-dev.c|  2 ++
  drivers/media/v4l2-core/v4l2-ioctl.c  | 16 +++---
  drivers/media/v4l2-core/v4l2-subdev.c |  4 ++--
  include/media/v4l2-ioctl.h|  2 ++
  include/media/v4l2-subdev.h   |  4 ++--
  6 files changed, 37 insertions(+), 23 deletions(-)

 diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 1b18616..6463c87
 100644
 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 @@ -740,7 +740,7 @@ static int put_v4l2_event32(struct v4l2_event *kp,
 struct v4l2_event32 __user *u return 0;
  }

 -struct v4l2_subdev_edid32 {
 +struct v4l2_edid32 {
  __u32 pad;
  __u32 start_block;
  __u32 blocks;
 @@ -748,11 +748,11 @@ struct v4l2_subdev_edid32 {
  compat_caddr_t edid;
  };

 -static int get_v4l2_subdev_edid32(struct v4l2_subdev_edid *kp, struct
 v4l2_subdev_edid32 __user *up) +static int get_v4l2_edid32(struct v4l2_edid
 *kp, struct v4l2_edid32 __user *up) {
  u32 tmp;

 -if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_subdev_edid32)) ||
 +if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_edid32)) ||
  get_user(kp-pad, up-pad) ||
  get_user(kp-start_block, up-start_block) ||
  get_user(kp-blocks, up-blocks) ||
 @@ -763,11 +763,11 @@ static int get_v4l2_subdev_edid32(struct
 v4l2_subdev_edid *kp, struct v4l2_subde return 0;
  }

 -static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid *kp, struct
 v4l2_subdev_edid32 __user *up) +static int put_v4l2_edid32(struct v4l2_edid
 *kp, struct v4l2_edid32 __user *up) {
  u32 tmp = (u32)((unsigned long)kp-edid);

 -if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_subdev_edid32)) ||
 +if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_edid32)) ||
  put_user(kp-pad, up-pad) ||
  put_user(kp-start_block, up-start_block) ||
  put_user(kp-blocks, up-blocks) ||
 @@ -787,8 +787,8 @@ static int put_v4l2_subdev_edid32(struct
 v4l2_subdev_edid *kp, struct v4l2_subde #define VIDIOC_DQBUF32   
 _IOWR('V',
 17, struct v4l2_buffer32)
  #define VIDIOC_ENUMSTD32_IOWR('V', 25, struct v4l2_standard32)
  #define VIDIOC_ENUMINPUT32  _IOWR('V', 26, struct v4l2_input32)
 -#define VIDIOC_SUBDEV_G_EDID32  _IOWR('V', 63, struct 
 v4l2_subdev_edid32)
 -#define VIDIOC_SUBDEV_S_EDID32  _IOWR('V', 64, struct 
 v4l2_subdev_edid32)
 +#define VIDIOC_G_EDID32 _IOWR('V', 63, struct v4l2_edid32)
 +#define VIDIOC_S_EDID32 _IOWR('V', 64, struct v4l2_edid32)
 
 Shouldn't the ioctl numbers be 40 and 41 ?

Oh, for crying out loud. That's been wrong since these ioctls were first added
in 3.7. I'll split this off as a patch for 3.14 with a CC to stable.

Well spotted!

 
  #define VIDIOC_TRY_FMT32_IOWR('V', 64, struct v4l2_format32)
  #define VIDIOC_G_EXT_CTRLS32_IOWR('V', 71, struct v4l2_ext_controls32)
  #define VIDIOC_S_EXT_CTRLS32_IOWR('V', 72, struct v4l2_ext_controls32)
 @@ -816,7 +816,7 @@ static long do_video_ioctl(struct file *file, unsigned
 int cmd, unsigned long ar struct v4l2_ext_controls v2ecs;
  struct v4l2_event v2ev;
  struct v4l2_create_buffers v2crt;
 -struct v4l2_subdev_edid v2edid;
 +struct v4l2_edid v2edid;
  unsigned long vx;
  int vi;
  } karg;
 @@ -849,8 +849,8 @@ static long do_video_ioctl(struct file *file, unsigned
 int cmd, unsigned long ar case VIDIOC_S_OUTPUT32: cmd = VIDIOC_S_OUTPUT;
 break;
  case VIDIOC_CREATE_BUFS32: cmd = VIDIOC_CREATE_BUFS; break;
  case VIDIOC_PREPARE_BUF32: cmd = VIDIOC_PREPARE_BUF; break;
 -case VIDIOC_SUBDEV_G_EDID32: cmd = VIDIOC_SUBDEV_G_EDID; break;
 -case VIDIOC_SUBDEV_S_EDID32: cmd = VIDIOC_SUBDEV_S_EDID; break;
 +case VIDIOC_G_EDID32: cmd = VIDIOC_G_EDID; break;
 +case VIDIOC_S_EDID32: cmd = VIDIOC_S_EDID; break;
  }

  switch (cmd) {
 @@ -868,9 +868,9 @@ static long do_video_ioctl(struct file *file, unsigned
 int cmd, unsigned long ar compatible_arg = 0;
  break;

 -case VIDIOC_SUBDEV_G_EDID:
 -case VIDIOC_SUBDEV_S_EDID:
 -err = get_v4l2_subdev_edid32(karg.v2edid, up);
 +case VIDIOC_G_EDID:
 +case VIDIOC_S_EDID:
 +err = get_v4l2_edid32(karg.v2edid, up);
  compatible_arg = 0;
  break;

 

Re: [RFCv1 PATCH 0/4] add G/S_EDID support for video nodes

2014-03-05 Thread Hans Verkuil
On 03/06/2014 02:45 AM, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patches.
 
 On Tuesday 04 March 2014 12:30:55 Hans Verkuil wrote:
 Currently the VIDIOC_SUBDEV_G/S_EDID and struct v4l2_subdev_edid are subdev
 APIs. However, that's in reality quite annoying since for simple video
 pipelines there is no need to create v4l-subdev device nodes for anything
 else except for setting or getting EDIDs.

 What happens in practice is that v4l2 bridge drivers add explicit support
 for VIDIOC_SUBDEV_G/S_EDID themselves, just to avoid having to create
 subdev device nodes just for this.

 So this patch series makes the ioctls available as regular ioctls as
 well. In that case the pad field should be set to 0 and the bridge driver
 will fill in the right pad value internally depending on the current
 input or output and pass it along to the actual subdev driver.
 
 Would it make sense to allow usage of the pad field on video nodes as well ?

No, really not. The video node driver has full control over which inputs/outputs
map to which pads. None of that is (or should be) visible from userspace.

What should probably change is that rather than requiring userspace to set pad
to 0, I just say that it is ignored. The bridge driver will fill in the pad
before handing it over to the relevant subdev. Requiring apps to set it to 0
(which is a valid pad number anyway, so that doesn't really help with possible
future use of the field) will require the driver to set it to 0 as well after
having called the subdev. Which is annoying and will be forgotten anyway.

I also need to mention in the docbook that if it is called for a pad, an input
or an output that does not support EDIDs these ioctls will return -EINVAL.

I'll post a REVIEWv1 series soon.

Regards,

Hans

 
 Apart from that and minor issues with patch 2/4 this series looks good to me.
 

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


[GIT PULL FOR v3.15] vb2: fixes, balancing callbacks

2014-03-05 Thread Hans Verkuil
Hi Mauro,

This pull request is identical to the REVIEWv4 series:

https://www.mail-archive.com/linux-media@vger.kernel.org/msg72474.html

except for being rebased to the latest master branch.

Take special note: the first three patches (vb2: Check if there are buffers 
before
streamon, vb2: fix read/write regression and vb2: fix PREPARE_BUF 
regression)
are patches for 3.14 that have already been processed by you. However, this 
patch
series relies on them being present. I have not tried it, but I doubt if this
series applies without them being there.

This patch series adds debugging code to check for unbalanced ops and then 
proceeds
to fix all the bugs I found with that debugging code and some more that I found
while testing nasty streaming corner cases with v4l2-compliance.

Regards,

Hans

The following changes since commit bfd0306462fdbc5e0a8c6999aef9dde0f9745399:

  [media] v4l: Document timestamp buffer flag behaviour (2014-03-05 16:48:28 
-0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git vb2-part1

for you to fetch changes up to 8028d16f6406661755f405c49078d6f8c93dd3ec:

  vivi: fix ENUM_FRAMEINTERVALS implementation (2014-03-05 21:45:19 +0100)


Hans Verkuil (17):
  vb2: fix read/write regression
  vb2: fix PREPARE_BUF regression
  vb2: add debugging code to check for unbalanced ops
  vb2: change result code of buf_finish to void
  pwc: do not decompress the image unless the state is DONE
  vb2: call buf_finish from __queue_cancel.
  vb2: consistent usage of periods in videobuf2-core.h
  vb2: fix buf_init/buf_cleanup call sequences
  vb2: rename queued_count to owned_by_drv_count
  vb2: don't init the list if there are still buffers
  vb2: only call start_streaming if sufficient buffers are queued
  vb2: properly clean up PREPARED and QUEUED buffers
  vb2: replace BUG by WARN_ON
  vb2: fix streamoff handling if streamon wasn't called.
  vb2: call buf_finish after the state check.
  vivi: correctly cleanup after a start_streaming failure
  vivi: fix ENUM_FRAMEINTERVALS implementation

Ricardo Ribalda Delgado (1):
  vb2: Check if there are buffers before streamon

 drivers/media/parport/bw-qcam.c |   6 +-
 drivers/media/pci/sta2x11/sta2x11_vip.c |   7 +-
 drivers/media/platform/davinci/vpbe_display.c   |   6 +-
 drivers/media/platform/davinci/vpif_capture.c   |   7 +-
 drivers/media/platform/davinci/vpif_display.c   |   7 +-
 drivers/media/platform/marvell-ccic/mcam-core.c |   3 +-
 drivers/media/platform/s5p-tv/mixer_video.c |   6 +-
 drivers/media/platform/vivi.c   |  18 ++-
 drivers/media/usb/pwc/pwc-if.c  |  17 ++-
 drivers/media/usb/uvc/uvc_queue.c   |   6 +-
 drivers/media/v4l2-core/videobuf2-core.c| 594 

 drivers/staging/media/davinci_vpfe/vpfe_video.c |   3 +-
 drivers/staging/media/go7007/go7007-v4l2.c  |   3 +-
 include/media/videobuf2-core.h  | 113 +++
 14 files changed, 565 insertions(+), 231 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html