[PATCH v4] [media] tpg: Export the tpg code from vivid as a module

2016-04-08 Thread Helen Mae Koike Fornazier
The test pattern generator will be used by other drivers as the virtual
media controller (vimc)

Signed-off-by: Helen Mae Koike Fornazier 
---

Changes since v3:
- "depends on VIDEO_VIVID" removed from Kconfig
- License changed from GPL v2 to GLP, as the code comes originaly from 
vivid, it should keep the same license
- Added  MODULE_AUTHOS("Hans Verkuil"), same reason as the license

The patch is based on 'media/master' branch and available at
 https://github.com/helen-fornazier/opw-staging tpg/review/vivid 


 drivers/media/common/Kconfig   |  1 +
 drivers/media/common/Makefile  |  2 +-
 drivers/media/common/v4l2-tpg/Kconfig  |  2 ++
 drivers/media/common/v4l2-tpg/Makefile |  3 +++
 .../v4l2-tpg/v4l2-tpg-colors.c}|  7 +++---
 .../v4l2-tpg/v4l2-tpg-core.c}  | 25 --
 drivers/media/platform/vivid/Kconfig   |  1 +
 drivers/media/platform/vivid/Makefile  |  2 +-
 drivers/media/platform/vivid/vivid-core.h  |  2 +-
 .../media/v4l2-tpg-colors.h|  6 +++---
 .../vivid/vivid-tpg.h => include/media/v4l2-tpg.h  |  9 
 11 files changed, 43 insertions(+), 17 deletions(-)
 create mode 100644 drivers/media/common/v4l2-tpg/Kconfig
 create mode 100644 drivers/media/common/v4l2-tpg/Makefile
 rename drivers/media/{platform/vivid/vivid-tpg-colors.c => 
common/v4l2-tpg/v4l2-tpg-colors.c} (99%)
 rename drivers/media/{platform/vivid/vivid-tpg.c => 
common/v4l2-tpg/v4l2-tpg-core.c} (98%)
 rename drivers/media/platform/vivid/vivid-tpg-colors.h => 
include/media/v4l2-tpg-colors.h (93%)
 rename drivers/media/platform/vivid/vivid-tpg.h => include/media/v4l2-tpg.h 
(99%)

diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig
index 21154dd..326df0a 100644
--- a/drivers/media/common/Kconfig
+++ b/drivers/media/common/Kconfig
@@ -19,3 +19,4 @@ config CYPRESS_FIRMWARE
 source "drivers/media/common/b2c2/Kconfig"
 source "drivers/media/common/saa7146/Kconfig"
 source "drivers/media/common/siano/Kconfig"
+source "drivers/media/common/v4l2-tpg/Kconfig"
diff --git a/drivers/media/common/Makefile b/drivers/media/common/Makefile
index 89b795d..2d1b0a0 100644
--- a/drivers/media/common/Makefile
+++ b/drivers/media/common/Makefile
@@ -1,4 +1,4 @@
-obj-y += b2c2/ saa7146/ siano/
+obj-y += b2c2/ saa7146/ siano/ v4l2-tpg/
 obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o
 obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
 obj-$(CONFIG_CYPRESS_FIRMWARE) += cypress_firmware.o
diff --git a/drivers/media/common/v4l2-tpg/Kconfig 
b/drivers/media/common/v4l2-tpg/Kconfig
new file mode 100644
index 000..7456fc1
--- /dev/null
+++ b/drivers/media/common/v4l2-tpg/Kconfig
@@ -0,0 +1,2 @@
+config VIDEO_V4L2_TPG
+   tristate
diff --git a/drivers/media/common/v4l2-tpg/Makefile 
b/drivers/media/common/v4l2-tpg/Makefile
new file mode 100644
index 000..f588df4
--- /dev/null
+++ b/drivers/media/common/v4l2-tpg/Makefile
@@ -0,0 +1,3 @@
+v4l2-tpg-objs := v4l2-tpg-core.o v4l2-tpg-colors.o
+
+obj-$(CONFIG_VIDEO_V4L2_TPG) += v4l2-tpg.o
diff --git a/drivers/media/platform/vivid/vivid-tpg-colors.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
similarity index 99%
rename from drivers/media/platform/vivid/vivid-tpg-colors.c
rename to drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
index 2299f0c..9bcbd31 100644
--- a/drivers/media/platform/vivid/vivid-tpg-colors.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
@@ -1,5 +1,5 @@
 /*
- * vivid-color.c - A table that converts colors to various colorspaces
+ * v4l2-tpg-colors.c - A table that converts colors to various colorspaces
  *
  * The test pattern generator uses the tpg_colors for its test patterns.
  * For testing colorspaces the first 8 colors of that table need to be
@@ -12,7 +12,7 @@
  * This source also contains the code used to generate the tpg_csc_colors
  * table. Run the following command to compile it:
  *
- * gcc vivid-tpg-colors.c -DCOMPILE_APP -o gen-colors -lm
+ * gcc v4l2-tpg-colors.c -DCOMPILE_APP -o gen-colors -lm
  *
  * and run the utility.
  *
@@ -36,8 +36,7 @@
  */
 
 #include 
-
-#include "vivid-tpg-colors.h"
+#include 
 
 /* sRGB colors with range [0-255] */
 const struct color tpg_colors[TPG_COLOR_MAX] = {
diff --git a/drivers/media/platform/vivid/vivid-tpg.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
similarity index 98%
rename from drivers/media/platform/vivid/vivid-tpg.c
rename to drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index da862bb..cf1dadd 100644
--- a/drivers/media/platform/vivid/vivid-tpg.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -1,5 +1,5 @@
 /*
- * vivid-tpg.c - Test Pattern Generator
+ * v4l2-tpg-core.c - Test Pattern Generator
  *
  * Note: gen_twopix and tpg_gen_text are based on code from vivi.c. See the
  *

[PATCH v3] [media] vimc: Virtual Media Controller core, capture and sensor

2016-04-06 Thread Helen Mae Koike Fornazier
From: Helen Fornazier 

First version of the Virtual Media Controller.
Add a simple version of the core of the driver, the capture and
sensor nodes in the topology, generating a grey image in a hardcoded
format.

Signed-off-by: Helen Fornazier 
---

Changes since v2: update with current media master tree
- Add struct media_pipeline in vimc_cap_device
- Use vb2_v4l2_buffer instead of vb2_buffer
- Typos
- Remove usage of entity->type and use entity->function instead
- Remove fmt argument from queue setup
- Use ktime_get_ns instead of v4l2_get_timestamp
- Iterate over link's list using list_for_each_entry
- Use media_device_{init, cleanup}
- Use entity->use_count to keep track of entities instead of the old
entity->id
- Replace media_entity_init by media_entity_pads_init

 drivers/media/platform/Kconfig |   2 +
 drivers/media/platform/Makefile|   1 +
 drivers/media/platform/vimc/Kconfig|   6 +
 drivers/media/platform/vimc/Makefile   |   3 +
 drivers/media/platform/vimc/vimc-capture.c | 534 ++
 drivers/media/platform/vimc/vimc-capture.h |  28 ++
 drivers/media/platform/vimc/vimc-core.c| 595 +
 drivers/media/platform/vimc/vimc-core.h|  55 +++
 drivers/media/platform/vimc/vimc-sensor.c  | 277 ++
 drivers/media/platform/vimc/vimc-sensor.h  |  28 ++
 10 files changed, 1529 insertions(+)
 create mode 100644 drivers/media/platform/vimc/Kconfig
 create mode 100644 drivers/media/platform/vimc/Makefile
 create mode 100644 drivers/media/platform/vimc/vimc-capture.c
 create mode 100644 drivers/media/platform/vimc/vimc-capture.h
 create mode 100644 drivers/media/platform/vimc/vimc-core.c
 create mode 100644 drivers/media/platform/vimc/vimc-core.h
 create mode 100644 drivers/media/platform/vimc/vimc-sensor.c
 create mode 100644 drivers/media/platform/vimc/vimc-sensor.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 201f5c2..14ed03f 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -284,6 +284,8 @@ menuconfig V4L_TEST_DRIVERS
 
 if V4L_TEST_DRIVERS
 
+source "drivers/media/platform/vimc/Kconfig"
+
 source "drivers/media/platform/vivid/Kconfig"
 
 config VIDEO_VIM2M
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index bbb7bd1..e4508fe 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_VIDEO_OMAP3) += omap3isp/
 
 obj-$(CONFIG_VIDEO_VIU) += fsl-viu.o
 
+obj-$(CONFIG_VIDEO_VIMC)   += vimc/
 obj-$(CONFIG_VIDEO_VIVID)  += vivid/
 obj-$(CONFIG_VIDEO_VIM2M)  += vim2m.o
 
diff --git a/drivers/media/platform/vimc/Kconfig 
b/drivers/media/platform/vimc/Kconfig
new file mode 100644
index 000..81279f4
--- /dev/null
+++ b/drivers/media/platform/vimc/Kconfig
@@ -0,0 +1,6 @@
+config VIDEO_VIMC
+   tristate "Virtual Media Controller Driver (VIMC)"
+   select VIDEO_V4L2_SUBDEV_API
+   default n
+   ---help---
+ Skeleton driver for Virtual Media Controller
diff --git a/drivers/media/platform/vimc/Makefile 
b/drivers/media/platform/vimc/Makefile
new file mode 100644
index 000..c45195e
--- /dev/null
+++ b/drivers/media/platform/vimc/Makefile
@@ -0,0 +1,3 @@
+vimc-objs := vimc-core.o vimc-capture.o vimc-sensor.o
+
+obj-$(CONFIG_VIDEO_VIMC) += vimc.o
diff --git a/drivers/media/platform/vimc/vimc-capture.c 
b/drivers/media/platform/vimc/vimc-capture.c
new file mode 100644
index 000..3fb8bfe
--- /dev/null
+++ b/drivers/media/platform/vimc/vimc-capture.c
@@ -0,0 +1,534 @@
+/*
+ * vimc-capture.c Virtual Media Controller Driver
+ *
+ * Copyright (C) 2015 Helen Fornazier 
+ *
+ * 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.
+ *
+ * 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 General Public License for more details.
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include "vimc-capture.h"
+
+struct vimc_cap_device {
+   struct vimc_ent_device ved;
+   struct video_device vdev;
+   struct v4l2_device *v4l2_dev;
+   struct device *dev;
+   struct v4l2_pix_format format;
+   struct vb2_queue queue;
+   struct list_head buf_list;
+   /* NOTE: in a real driver, a spin lock must be used to access the
+* queue because the frames are generated from a hardware interruption
+* and the isr is not allowed to sleep.
+* Even if it is not necessary a spinlock in the vimc driver, we
+* use it here as a code reference */
+   spinlock_t qlock;
+   struct mutex lock;
+   u32 sequence;
+   

[PATCH v3] [media] tpg: Export the tpg code from vivid as a module

2016-04-01 Thread Helen Mae Koike Fornazier
The test pattern generator will be used by other drivers as the virtual
media controller (vimc)

Signed-off-by: Helen Mae Koike Fornazier 
---

The patch is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging tpg/review/vivid

Changes since last version:
* mv drivers/media/platform/tpg drivers/media/common/v4l2-tpg
* files renamed with v4l2 prefix
* tpg removed from menuconfig, depends on VIDEO_VIVID and selected 
automaticaly by VIDEO_VIVID
* module's description

NOTE: I left the "select VIDEO_V4L2_TPG" in the vivid Kconfig because without 
it the tpg module is
not selected automaticaly when selecting VIDEO_VIVID, it seems that using the 
"depends on VIDEO_VIVID" in
the tpg's Kconfig is not enough (I thought it should be, but apparently I 
missundestood the docs). Please,
let me know if this is not correct.

 drivers/media/common/Kconfig   |  1 +
 drivers/media/common/Makefile  |  2 +-
 drivers/media/common/v4l2-tpg/Kconfig  |  3 +++
 drivers/media/common/v4l2-tpg/Makefile |  3 +++
 .../v4l2-tpg/v4l2-tpg-colors.c}|  7 +++
 .../v4l2-tpg/v4l2-tpg-core.c}  | 24 --
 drivers/media/platform/vivid/Kconfig   |  1 +
 drivers/media/platform/vivid/Makefile  |  2 +-
 drivers/media/platform/vivid/vivid-core.h  |  2 +-
 .../media/v4l2-tpg-colors.h|  6 +++---
 .../vivid/vivid-tpg.h => include/media/v4l2-tpg.h  |  9 
 11 files changed, 43 insertions(+), 17 deletions(-)
 create mode 100644 drivers/media/common/v4l2-tpg/Kconfig
 create mode 100644 drivers/media/common/v4l2-tpg/Makefile
 rename drivers/media/{platform/vivid/vivid-tpg-colors.c => 
common/v4l2-tpg/v4l2-tpg-colors.c} (99%)
 rename drivers/media/{platform/vivid/vivid-tpg.c => 
common/v4l2-tpg/v4l2-tpg-core.c} (98%)
 rename drivers/media/platform/vivid/vivid-tpg-colors.h => 
include/media/v4l2-tpg-colors.h (93%)
 rename drivers/media/platform/vivid/vivid-tpg.h => include/media/v4l2-tpg.h 
(99%)

diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig
index 21154dd..326df0a 100644
--- a/drivers/media/common/Kconfig
+++ b/drivers/media/common/Kconfig
@@ -19,3 +19,4 @@ config CYPRESS_FIRMWARE
 source "drivers/media/common/b2c2/Kconfig"
 source "drivers/media/common/saa7146/Kconfig"
 source "drivers/media/common/siano/Kconfig"
+source "drivers/media/common/v4l2-tpg/Kconfig"
diff --git a/drivers/media/common/Makefile b/drivers/media/common/Makefile
index 89b795d..2d1b0a0 100644
--- a/drivers/media/common/Makefile
+++ b/drivers/media/common/Makefile
@@ -1,4 +1,4 @@
-obj-y += b2c2/ saa7146/ siano/
+obj-y += b2c2/ saa7146/ siano/ v4l2-tpg/
 obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o
 obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
 obj-$(CONFIG_CYPRESS_FIRMWARE) += cypress_firmware.o
diff --git a/drivers/media/common/v4l2-tpg/Kconfig 
b/drivers/media/common/v4l2-tpg/Kconfig
new file mode 100644
index 000..3c36f52
--- /dev/null
+++ b/drivers/media/common/v4l2-tpg/Kconfig
@@ -0,0 +1,3 @@
+config VIDEO_V4L2_TPG
+   tristate
+   depends on VIDEO_VIVID
diff --git a/drivers/media/common/v4l2-tpg/Makefile 
b/drivers/media/common/v4l2-tpg/Makefile
new file mode 100644
index 000..f588df4
--- /dev/null
+++ b/drivers/media/common/v4l2-tpg/Makefile
@@ -0,0 +1,3 @@
+v4l2-tpg-objs := v4l2-tpg-core.o v4l2-tpg-colors.o
+
+obj-$(CONFIG_VIDEO_V4L2_TPG) += v4l2-tpg.o
diff --git a/drivers/media/platform/vivid/vivid-tpg-colors.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
similarity index 99%
rename from drivers/media/platform/vivid/vivid-tpg-colors.c
rename to drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
index 2299f0c..9bcbd31 100644
--- a/drivers/media/platform/vivid/vivid-tpg-colors.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c
@@ -1,5 +1,5 @@
 /*
- * vivid-color.c - A table that converts colors to various colorspaces
+ * v4l2-tpg-colors.c - A table that converts colors to various colorspaces
  *
  * The test pattern generator uses the tpg_colors for its test patterns.
  * For testing colorspaces the first 8 colors of that table need to be
@@ -12,7 +12,7 @@
  * This source also contains the code used to generate the tpg_csc_colors
  * table. Run the following command to compile it:
  *
- * gcc vivid-tpg-colors.c -DCOMPILE_APP -o gen-colors -lm
+ * gcc v4l2-tpg-colors.c -DCOMPILE_APP -o gen-colors -lm
  *
  * and run the utility.
  *
@@ -36,8 +36,7 @@
  */
 
 #include 
-
-#include "vivid-tpg-colors.h"
+#include 
 
 /* sRGB colors with range [0-255] */
 const struct color tpg_colors[TPG_COLOR_MAX] = {
diff --git a/drivers/media/platform/vivid/vivid-tpg.c 
b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
similarity index 98%
rename from drivers/media/platform/vivi

[PATCH v4 1/2] [media] media: change pipeline validation return error

2016-03-30 Thread Helen Mae Koike Fornazier
According to the V4L2 API, the VIDIOC_STREAMON ioctl should return EPIPE
if there is a format mismatch in the pipeline configuration.

As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the error
caused by the v4l2_subdev_link_validate_default (if it is in use), it
should return -EPIPE when it detect the mismatch.

When an entity is connected to a non enabled link,
media_entity_pipeline_start should return -ENOLINK, as the link does not
exist.

Signed-off-by: Helen Mae Koike Fornazier 
Acked-by: Sakari Ailus 
---

Nothing has changed since v3

The patch is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

 drivers/media/media-entity.c  | 2 +-
 drivers/media/v4l2-core/v4l2-subdev.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index c53c1d5..d8a2299 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -445,7 +445,7 @@ __must_check int __media_entity_pipeline_start(struct 
media_entity *entity,
bitmap_or(active, active, has_no_links, entity->num_pads);
 
if (!bitmap_full(active, entity->num_pads)) {
-   ret = -EPIPE;
+   ret = -ENOLINK;
dev_dbg(entity->graph_obj.mdev->dev,
"\"%s\":%u must be connected by an enabled 
link\n",
entity->name,
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index d630838..918e79d 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -508,7 +508,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
if (source_fmt->format.width != sink_fmt->format.width
|| source_fmt->format.height != sink_fmt->format.height
|| source_fmt->format.code != sink_fmt->format.code)
-   return -EINVAL;
+   return -EPIPE;
 
/* The field order must match, or the sink field order must be NONE
 * to support interlaced hardware connected to bridges that support
@@ -516,7 +516,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
 */
if (source_fmt->format.field != sink_fmt->format.field &&
sink_fmt->format.field != V4L2_FIELD_NONE)
-   return -EINVAL;
+   return -EPIPE;
 
return 0;
 }
-- 
1.9.1

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


[PATCH v4 0/2] media: updating error codes on streamon

2016-03-30 Thread Helen Mae Koike Fornazier
Fix error code on streamon

Changes since v3:

[media] media: change pipeline validation return error
* Nothing has changed
[media] DocBook: update error code in videoc-streamon
* Added "link" word
* Added Ack-by 

The patch set is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

Helen Mae Koike Fornazier (2):
  [media] media: change pipeline validation return error
  [media] DocBook: update error code in videoc-streamon

 Documentation/DocBook/media/v4l/vidioc-streamon.xml | 8 
 drivers/media/media-entity.c| 2 +-
 drivers/media/v4l2-core/v4l2-subdev.c   | 4 ++--
 3 files changed, 11 insertions(+), 3 deletions(-)

-- 
1.9.1

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


[PATCH v4 2/2] [media] DocBook: update error code in videoc-streamon

2016-03-30 Thread Helen Mae Koike Fornazier
Add description of ENOLINK error

Signed-off-by: Helen Mae Koike Fornazier 
Acked-by: Sakari Ailus 
---

Changes since v3:
* ..."pipeline configuration"... to ..."pipeline link configuration"...
* Added Acked-by

The patch is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

 Documentation/DocBook/media/v4l/vidioc-streamon.xml | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/vidioc-streamon.xml 
b/Documentation/DocBook/media/v4l/vidioc-streamon.xml
index df2c63d..89fd7ce 100644
--- a/Documentation/DocBook/media/v4l/vidioc-streamon.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-streamon.xml
@@ -123,6 +123,14 @@ synchronize with other events.
  

   
+  
+   ENOLINK
+   
+ The driver implements Media Controller interface and
+ the pipeline link configuration is invalid.
+ 
+   
+  
 
   
 
-- 
1.9.1

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


[PATCH v3 2/2] [media] DocBook: update error code in videoc-streamon

2016-03-30 Thread Helen Mae Koike Fornazier
Add description of ENOLINK error

Signed-off-by: Helen Mae Koike Fornazier 
---

The patch set is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

Changes since v2:
* this is a new commit in the set

 Documentation/DocBook/media/v4l/vidioc-streamon.xml | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/vidioc-streamon.xml 
b/Documentation/DocBook/media/v4l/vidioc-streamon.xml
index df2c63d..c4b88b0 100644
--- a/Documentation/DocBook/media/v4l/vidioc-streamon.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-streamon.xml
@@ -123,6 +123,14 @@ synchronize with other events.
  

   
+  
+   ENOLINK
+   
+ The driver implements Media Controller interface and
+ the pipeline configuration is invalid.
+ 
+   
+  
 
   
 
-- 
1.9.1

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


[PATCH v3 1/2] [media] media: change pipeline validation return error

2016-03-30 Thread Helen Mae Koike Fornazier
According to the V4L2 API, the VIDIOC_STREAMON ioctl should return EPIPE
if there is a format mismatch in the pipeline configuration.

As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the error
caused by the v4l2_subdev_link_validate_default (if it is in use), it
should return -EPIPE when it detect the mismatch.

When an entity is connected to a non enabled link,
media_entity_pipeline_start should return -ENOLINK, as the link does not
exist.

Signed-off-by: Helen Mae Koike Fornazier 
Acked-by: Sakari Ailus 
---

The patch is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

Changes since v2:
* Added Ack by Sakari

 drivers/media/media-entity.c  | 2 +-
 drivers/media/v4l2-core/v4l2-subdev.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index c53c1d5..d8a2299 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -445,7 +445,7 @@ __must_check int __media_entity_pipeline_start(struct 
media_entity *entity,
bitmap_or(active, active, has_no_links, entity->num_pads);
 
if (!bitmap_full(active, entity->num_pads)) {
-   ret = -EPIPE;
+   ret = -ENOLINK;
dev_dbg(entity->graph_obj.mdev->dev,
"\"%s\":%u must be connected by an enabled 
link\n",
entity->name,
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index d630838..918e79d 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -508,7 +508,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
if (source_fmt->format.width != sink_fmt->format.width
|| source_fmt->format.height != sink_fmt->format.height
|| source_fmt->format.code != sink_fmt->format.code)
-   return -EINVAL;
+   return -EPIPE;
 
/* The field order must match, or the sink field order must be NONE
 * to support interlaced hardware connected to bridges that support
@@ -516,7 +516,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
 */
if (source_fmt->format.field != sink_fmt->format.field &&
sink_fmt->format.field != V4L2_FIELD_NONE)
-   return -EINVAL;
+   return -EPIPE;
 
return 0;
 }
-- 
1.9.1

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


[PATCH v3 0/2] media: updating error codes on streamon

2016-03-30 Thread Helen Mae Koike Fornazier
Fix error code on streamon

The patch set is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

Changes since v2:

  [media] media: change pipeline validation return error
* Added Ack by Sakari

  Updated the DocBook in the commit:
[media] DocBook: update error code in videoc-streamon


Helen Mae Koike Fornazier (2):
  [media] media: change pipeline validation return error
  [media] DocBook: update error code in videoc-streamon

 Documentation/DocBook/media/v4l/vidioc-streamon.xml | 8 
 drivers/media/media-entity.c| 2 +-
 drivers/media/v4l2-core/v4l2-subdev.c   | 4 ++--
 3 files changed, 11 insertions(+), 3 deletions(-)

-- 
1.9.1

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


[PATCH v2] [media] media: change pipeline validation return error

2016-03-29 Thread Helen Mae Koike Fornazier
According to the V4L2 API, the VIDIOC_STREAMON ioctl should return EPIPE
if there is a format mismatch in the pipeline configuration.

As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the error
caused by the v4l2_subdev_link_validate_default (if it is in use), it
should return -EPIPE when it detect the mismatch.

When an entity is connected to a non enabled link,
media_entity_pipeline_start should return -ENOLINK, as the link does not
exist.

Signed-off-by: Helen Mae Koike Fornazier 
---

The patch is based on 'media/master' branch and available at
https://github.com/helen-fornazier/opw-staging media/devel

Changes since v1:
* Commit message, it was "v4l2-subdev: return -EPIPE instead of -EINVAL 
in link validate default"
* EPIPE to ENOLINK in the __media_entity_pipeline_start

 drivers/media/media-entity.c  | 2 +-
 drivers/media/v4l2-core/v4l2-subdev.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index c53c1d5..d8a2299 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -445,7 +445,7 @@ __must_check int __media_entity_pipeline_start(struct 
media_entity *entity,
bitmap_or(active, active, has_no_links, entity->num_pads);
 
if (!bitmap_full(active, entity->num_pads)) {
-   ret = -EPIPE;
+   ret = -ENOLINK;
dev_dbg(entity->graph_obj.mdev->dev,
"\"%s\":%u must be connected by an enabled 
link\n",
entity->name,
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index d630838..918e79d 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -508,7 +508,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
if (source_fmt->format.width != sink_fmt->format.width
|| source_fmt->format.height != sink_fmt->format.height
|| source_fmt->format.code != sink_fmt->format.code)
-   return -EINVAL;
+   return -EPIPE;
 
/* The field order must match, or the sink field order must be NONE
 * to support interlaced hardware connected to bridges that support
@@ -516,7 +516,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
 */
if (source_fmt->format.field != sink_fmt->format.field &&
sink_fmt->format.field != V4L2_FIELD_NONE)
-   return -EINVAL;
+   return -EPIPE;
 
return 0;
 }
-- 
1.9.1

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