linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] [media] Fixes and improvements for VIDIOC_QUERYCAP in Samsung media drivers
@ 2016-06-16 21:40 Javier Martinez Canillas
  2016-06-16 21:40 ` [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Javier Martinez Canillas @ 2016-06-16 21:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Junghak Sung, Kukjin Kim,
	Seung-Woo Kim, Mauro Carvalho Chehab, Jacek Anaszewski,
	Kamil Debski, Jeongtae Park, Inki Dae, linux-samsung-soc,
	Kyungmin Park, Krzysztof Kozlowski, Geunyoung Kim,
	Markus Elfring, Andrzej Pietrasiewicz, Hans Verkuil,
	linux-arm-kernel, linux-media

Hello,

This series contains some fixes and improvements for the VIDIOC_QUERYCAP ioctl
handler in different media platform drivers for IP blocks found in Exynos SoCs.

Some of the issues were reported by the v4l2-compliance tool while others are
things I noticed while looking at the Driver name, Card type and Bus info.

Best regards,
Javier


Javier Martinez Canillas (6):
  [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP
  [media] s5p-mfc: improve v4l2_capability driver and card fields
  [media] s5p-jpeg: set capablity bus_info as required by
    VIDIOC_QUERYCAP
  [media] s5p-jpeg: only fill driver's name in capabilities driver field
  [media] gsc-m2m: add device name sufix to bus_info capatiliby field
  [media] gsc-m2m: improve v4l2_capability driver and card fields

 drivers/media/platform/exynos-gsc/gsc-m2m.c     | 7 ++++---
 drivers/media/platform/s5p-jpeg/jpeg-core.c     | 7 ++++---
 drivers/media/platform/s5p-mfc/s5p_mfc.c        | 1 -
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c    | 7 ++++---
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    | 7 ++++---
 6 files changed, 18 insertions(+), 13 deletions(-)

-- 
2.5.5

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP
  2016-06-16 21:40 [PATCH 0/6] [media] Fixes and improvements for VIDIOC_QUERYCAP in Samsung media drivers Javier Martinez Canillas
@ 2016-06-16 21:40 ` Javier Martinez Canillas
  2016-06-17  7:11   ` Hans Verkuil
  2016-06-29 19:43   ` Shuah Khan
  2016-06-16 21:40 ` [PATCH 2/6] [media] s5p-mfc: improve v4l2_capability driver and card fields Javier Martinez Canillas
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Javier Martinez Canillas @ 2016-06-16 21:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Mauro Carvalho Chehab, Kamil Debski,
	Jeongtae Park, Kyungmin Park, linux-arm-kernel, linux-media

The driver doesn't set the struct v4l2_capability bus_info field so the
v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP:

Required ioctls:
                VIDIOC_QUERYCAP returned 0 (Success)
                fail: v4l2-compliance.cpp(304): string empty
                fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info))
        test VIDIOC_QUERYCAP: FAIL

This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler:

Required ioctls:
                VIDIOC_QUERYCAP returned 0 (Success)
        test VIDIOC_QUERYCAP: OK

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 3 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index f2d6376ce618..4a40df22fd63 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -267,7 +267,8 @@ static int vidioc_querycap(struct file *file, void *priv,
 
 	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
 	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
-	cap->bus_info[0] = 0;
+	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
+		 dev_name(&dev->plat_dev->dev));
 	/*
 	 * This is only a mem-to-mem video device. The capture and output
 	 * device capability flags are left only for backward compatibility
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 034b5c1d35a1..dd466ea6429e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -945,7 +945,8 @@ static int vidioc_querycap(struct file *file, void *priv,
 
 	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
 	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
-	cap->bus_info[0] = 0;
+	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
+		 dev_name(&dev->plat_dev->dev));
 	/*
 	 * This is only a mem-to-mem video device. The capture and output
 	 * device capability flags are left only for backward compatibility
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/6] [media] s5p-mfc: improve v4l2_capability driver and card fields
  2016-06-16 21:40 [PATCH 0/6] [media] Fixes and improvements for VIDIOC_QUERYCAP in Samsung media drivers Javier Martinez Canillas
  2016-06-16 21:40 ` [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
@ 2016-06-16 21:40 ` Javier Martinez Canillas
  2016-06-17  7:12   ` Hans Verkuil
  2016-06-29 19:45   ` Shuah Khan
  2016-06-16 21:40 ` [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Javier Martinez Canillas @ 2016-06-16 21:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Mauro Carvalho Chehab, Kamil Debski,
	Jeongtae Park, Kyungmin Park, linux-arm-kernel, linux-media

According to the V4L2 documentation the driver and card fields should be
used to identify the driver and the device but the s5p-mfc driver fills
those field using the platform device name, which in turn is the name of
the device DT node.

So not only the filled information isn't correct but also the same values
are used in all the fields for both the encoder and decoder video devices.

Before this patch:

Driver Info (not using libv4l2):
        Driver name   : 11000000.codec
        Card type     : 11000000.codec
        Bus info      : platform:11000000.codec
        Driver version: 4.7.0

Driver Info (not using libv4l2):
        Driver name   : 11000000.codec
        Card type     : 11000000.codec
        Bus info      : platform:11000000.codec
        Driver version: 4.7.0

After this patch:

Driver Info (not using libv4l2):
        Driver name   : s5p-mfc
        Card type     : s5p-mfc-dec
        Bus info      : platform:11000000.codec
        Driver version: 4.7.0

Driver Info (not using libv4l2):
        Driver name   : s5p-mfc
        Card type     : s5p-mfc-enc
        Bus info      : platform:11000000.codec
        Driver version: 4.7.0

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/platform/s5p-mfc/s5p_mfc.c        | 1 -
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c    | 4 ++--
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    | 4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 6ee620ee8cd5..a936f89fa54a 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -35,7 +35,6 @@
 #include "s5p_mfc_cmd.h"
 #include "s5p_mfc_pm.h"
 
-#define S5P_MFC_NAME		"s5p-mfc"
 #define S5P_MFC_DEC_NAME	"s5p-mfc-dec"
 #define S5P_MFC_ENC_NAME	"s5p-mfc-enc"
 
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 9eb2481ec292..a10dcd244ff0 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -25,6 +25,8 @@
 #include "regs-mfc.h"
 #include "regs-mfc-v8.h"
 
+#define S5P_MFC_NAME		"s5p-mfc"
+
 /* Definitions related to MFC memory */
 
 /* Offset base used to differentiate between CAPTURE and OUTPUT
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 4a40df22fd63..5793b0d8ee0c 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -265,8 +265,8 @@ static int vidioc_querycap(struct file *file, void *priv,
 {
 	struct s5p_mfc_dev *dev = video_drvdata(file);
 
-	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
-	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
+	strncpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver) - 1);
+	strncpy(cap->card, dev->vfd_dec->name, sizeof(cap->card) - 1);
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
 		 dev_name(&dev->plat_dev->dev));
 	/*
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index dd466ea6429e..1220559d4874 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -943,8 +943,8 @@ static int vidioc_querycap(struct file *file, void *priv,
 {
 	struct s5p_mfc_dev *dev = video_drvdata(file);
 
-	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
-	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
+	strncpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver) - 1);
+	strncpy(cap->card, dev->vfd_enc->name, sizeof(cap->card) - 1);
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
 		 dev_name(&dev->plat_dev->dev));
 	/*
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP
  2016-06-16 21:40 [PATCH 0/6] [media] Fixes and improvements for VIDIOC_QUERYCAP in Samsung media drivers Javier Martinez Canillas
  2016-06-16 21:40 ` [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
  2016-06-16 21:40 ` [PATCH 2/6] [media] s5p-mfc: improve v4l2_capability driver and card fields Javier Martinez Canillas
@ 2016-06-16 21:40 ` Javier Martinez Canillas
  2016-06-17  6:45   ` Jacek Anaszewski
                     ` (2 more replies)
  2016-06-16 21:40 ` [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field Javier Martinez Canillas
                   ` (2 subsequent siblings)
  5 siblings, 3 replies; 19+ messages in thread
From: Javier Martinez Canillas @ 2016-06-16 21:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Mauro Carvalho Chehab,
	Jacek Anaszewski, Andrzej Pietrasiewicz, linux-arm-kernel,
	linux-media

The driver doesn't set the struct v4l2_capability cap_info field so the
v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP:

Required ioctls:
                VIDIOC_QUERYCAP returned 0 (Success)
                fail: v4l2-compliance.cpp(304): string empty
                fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info))
        test VIDIOC_QUERYCAP: FAIL

This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler:

Required ioctls:
                VIDIOC_QUERYCAP returned 0 (Success)
        test VIDIOC_QUERYCAP: OK

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 17bc94092864..e3ff3d4bd72e 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1256,7 +1256,8 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
 		strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder",
 			sizeof(cap->card));
 	}
-	cap->bus_info[0] = 0;
+	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
+		 dev_name(ctx->jpeg->dev));
 	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M;
 	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
 	return 0;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field
  2016-06-16 21:40 [PATCH 0/6] [media] Fixes and improvements for VIDIOC_QUERYCAP in Samsung media drivers Javier Martinez Canillas
                   ` (2 preceding siblings ...)
  2016-06-16 21:40 ` [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
@ 2016-06-16 21:40 ` Javier Martinez Canillas
  2016-06-17  6:45   ` Jacek Anaszewski
                     ` (2 more replies)
  2016-06-16 21:40 ` [PATCH 5/6] [media] gsc-m2m: add device name sufix to bus_info capatiliby field Javier Martinez Canillas
  2016-06-16 21:40 ` [PATCH 6/6] [media] gsc-m2m: improve v4l2_capability driver and card fields Javier Martinez Canillas
  5 siblings, 3 replies; 19+ messages in thread
From: Javier Martinez Canillas @ 2016-06-16 21:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Mauro Carvalho Chehab,
	Jacek Anaszewski, Andrzej Pietrasiewicz, linux-arm-kernel,
	linux-media

The driver fills in both the struct v4l2_capability driver and card fields
the same values, that is the driver's name plus the information if the dev
is a decoder or an encoder.

But the driver field has a fixed length of 16 bytes so the filled data is
truncated:

Driver Info (not using libv4l2):
        Driver name   : s5p-jpeg decode
        Card type     : s5p-jpeg decoder
        Bus info      : platform:11f50000.jpeg
        Driver version: 4.7.0

Also, this field should only contain the driver's name so use just that.
The information if the device is a decoder or an encoder is in the card
type field anyways.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index e3ff3d4bd72e..f9fb52a53e79 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1246,12 +1246,12 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
 	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
 
 	if (ctx->mode == S5P_JPEG_ENCODE) {
-		strlcpy(cap->driver, S5P_JPEG_M2M_NAME " encoder",
+		strlcpy(cap->driver, S5P_JPEG_M2M_NAME,
 			sizeof(cap->driver));
 		strlcpy(cap->card, S5P_JPEG_M2M_NAME " encoder",
 			sizeof(cap->card));
 	} else {
-		strlcpy(cap->driver, S5P_JPEG_M2M_NAME " decoder",
+		strlcpy(cap->driver, S5P_JPEG_M2M_NAME,
 			sizeof(cap->driver));
 		strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder",
 			sizeof(cap->card));
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/6] [media] gsc-m2m: add device name sufix to bus_info capatiliby field
  2016-06-16 21:40 [PATCH 0/6] [media] Fixes and improvements for VIDIOC_QUERYCAP in Samsung media drivers Javier Martinez Canillas
                   ` (3 preceding siblings ...)
  2016-06-16 21:40 ` [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field Javier Martinez Canillas
@ 2016-06-16 21:40 ` Javier Martinez Canillas
  2016-06-17  7:13   ` Hans Verkuil
  2016-06-16 21:40 ` [PATCH 6/6] [media] gsc-m2m: improve v4l2_capability driver and card fields Javier Martinez Canillas
  5 siblings, 1 reply; 19+ messages in thread
From: Javier Martinez Canillas @ 2016-06-16 21:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Junghak Sung, Kukjin Kim,
	Seung-Woo Kim, Mauro Carvalho Chehab, Inki Dae,
	linux-samsung-soc, Krzysztof Kozlowski, Markus Elfring,
	Hans Verkuil, linux-arm-kernel, linux-media

The driver doesn't set the device in the struct v4l2_capability bus_info
field so v4l2-compliance reports the following error for VIDIOC_QUERYCAP:

Required ioctls:
                fail: v4l2-compliance.cpp(537): missing bus_info prefix ('platform')
        test VIDIOC_QUERYCAP: FAIL

This patch fixes this by filling also the device besides the bus.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/platform/exynos-gsc/gsc-m2m.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c
index a600e32e2543..af81383086b8 100644
--- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
@@ -281,7 +281,8 @@ static int gsc_m2m_querycap(struct file *file, void *fh,
 
 	strlcpy(cap->driver, gsc->pdev->name, sizeof(cap->driver));
 	strlcpy(cap->card, gsc->pdev->name, sizeof(cap->card));
-	strlcpy(cap->bus_info, "platform", sizeof(cap->bus_info));
+	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
+		 dev_name(&gsc->pdev->dev));
 	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE |
 		V4L2_CAP_VIDEO_CAPTURE_MPLANE |	V4L2_CAP_VIDEO_OUTPUT_MPLANE;
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 6/6] [media] gsc-m2m: improve v4l2_capability driver and card fields
  2016-06-16 21:40 [PATCH 0/6] [media] Fixes and improvements for VIDIOC_QUERYCAP in Samsung media drivers Javier Martinez Canillas
                   ` (4 preceding siblings ...)
  2016-06-16 21:40 ` [PATCH 5/6] [media] gsc-m2m: add device name sufix to bus_info capatiliby field Javier Martinez Canillas
@ 2016-06-16 21:40 ` Javier Martinez Canillas
  2016-06-17  7:13   ` Hans Verkuil
  5 siblings, 1 reply; 19+ messages in thread
From: Javier Martinez Canillas @ 2016-06-16 21:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Junghak Sung, Kukjin Kim,
	Seung-Woo Kim, Mauro Carvalho Chehab, linux-samsung-soc,
	Krzysztof Kozlowski, Geunyoung Kim, Markus Elfring, Hans Verkuil,
	linux-arm-kernel, linux-media

According to the V4L2 documentation the driver and card fields should be
used to identify the driver and the device but the gsc-m2m driver fills
those field using the platform device name, which in turn is the name of
the device DT node.

So not only the filled information isn't correct but also the same values
are used in the driver, card and bus_info fields.

Before this patch:

Driver Info (not using libv4l2):
        Driver name   : 13e00000.video-
        Card type     : 13e00000.video-scaler
        Bus info      : platform:13e00000.video-scaler
        Driver version: 4.7.0

After this patch:

Driver Info (not using libv4l2):
        Driver name   : exynos-gsc
        Card type     : exynos-gsc gscaler
        Bus info      : platform:13e00000.video-scaler
        Driver version: 4.7.0

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---

 drivers/media/platform/exynos-gsc/gsc-m2m.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c
index af81383086b8..274861c27367 100644
--- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
@@ -279,8 +279,8 @@ static int gsc_m2m_querycap(struct file *file, void *fh,
 	struct gsc_ctx *ctx = fh_to_ctx(fh);
 	struct gsc_dev *gsc = ctx->gsc_dev;
 
-	strlcpy(cap->driver, gsc->pdev->name, sizeof(cap->driver));
-	strlcpy(cap->card, gsc->pdev->name, sizeof(cap->card));
+	strlcpy(cap->driver, GSC_MODULE_NAME, sizeof(cap->driver));
+	strlcpy(cap->card, GSC_MODULE_NAME " gscaler", sizeof(cap->card));
 	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
 		 dev_name(&gsc->pdev->dev));
 	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE |
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field
  2016-06-16 21:40 ` [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field Javier Martinez Canillas
@ 2016-06-17  6:45   ` Jacek Anaszewski
  2016-06-17  7:13   ` Hans Verkuil
  2016-06-29 19:47   ` Shuah Khan
  2 siblings, 0 replies; 19+ messages in thread
From: Jacek Anaszewski @ 2016-06-17  6:45 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Mauro Carvalho Chehab, Andrzej Pietrasiewicz,
	linux-arm-kernel, linux-media

Hi Javier,

On 06/16/2016 11:40 PM, Javier Martinez Canillas wrote:
> The driver fills in both the struct v4l2_capability driver and card fields
> the same values, that is the driver's name plus the information if the dev
> is a decoder or an encoder.
>
> But the driver field has a fixed length of 16 bytes so the filled data is
> truncated:
>
> Driver Info (not using libv4l2):
>          Driver name   : s5p-jpeg decode
>          Card type     : s5p-jpeg decoder
>          Bus info      : platform:11f50000.jpeg
>          Driver version: 4.7.0
>
> Also, this field should only contain the driver's name so use just that.
> The information if the device is a decoder or an encoder is in the card
> type field anyways.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
>
>   drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> index e3ff3d4bd72e..f9fb52a53e79 100644
> --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> @@ -1246,12 +1246,12 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
>   	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
>
>   	if (ctx->mode == S5P_JPEG_ENCODE) {
> -		strlcpy(cap->driver, S5P_JPEG_M2M_NAME " encoder",
> +		strlcpy(cap->driver, S5P_JPEG_M2M_NAME,
>   			sizeof(cap->driver));
>   		strlcpy(cap->card, S5P_JPEG_M2M_NAME " encoder",
>   			sizeof(cap->card));
>   	} else {
> -		strlcpy(cap->driver, S5P_JPEG_M2M_NAME " decoder",
> +		strlcpy(cap->driver, S5P_JPEG_M2M_NAME,
>   			sizeof(cap->driver));
>   		strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder",
>   			sizeof(cap->card));
>

Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>

-- 
Best regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP
  2016-06-16 21:40 ` [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
@ 2016-06-17  6:45   ` Jacek Anaszewski
  2016-06-17  7:12   ` Hans Verkuil
  2016-06-29 19:46   ` Shuah Khan
  2 siblings, 0 replies; 19+ messages in thread
From: Jacek Anaszewski @ 2016-06-17  6:45 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Mauro Carvalho Chehab, Andrzej Pietrasiewicz,
	linux-arm-kernel, linux-media

Hi Javier,

On 06/16/2016 11:40 PM, Javier Martinez Canillas wrote:
> The driver doesn't set the struct v4l2_capability cap_info field so the
> v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP:
>
> Required ioctls:
>                  VIDIOC_QUERYCAP returned 0 (Success)
>                  fail: v4l2-compliance.cpp(304): string empty
>                  fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info))
>          test VIDIOC_QUERYCAP: FAIL
>
> This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler:
>
> Required ioctls:
>                  VIDIOC_QUERYCAP returned 0 (Success)
>          test VIDIOC_QUERYCAP: OK
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
>
>   drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> index 17bc94092864..e3ff3d4bd72e 100644
> --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> @@ -1256,7 +1256,8 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
>   		strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder",
>   			sizeof(cap->card));
>   	}
> -	cap->bus_info[0] = 0;
> +	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
> +		 dev_name(ctx->jpeg->dev));
>   	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M;
>   	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
>   	return 0;
>

Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>

-- 
Best regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP
  2016-06-16 21:40 ` [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
@ 2016-06-17  7:11   ` Hans Verkuil
  2016-06-29 19:43   ` Shuah Khan
  1 sibling, 0 replies; 19+ messages in thread
From: Hans Verkuil @ 2016-06-17  7:11 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Mauro Carvalho Chehab, Kamil Debski, Jeongtae Park,
	Kyungmin Park, linux-arm-kernel, linux-media

On 06/16/2016 11:40 PM, Javier Martinez Canillas wrote:
> The driver doesn't set the struct v4l2_capability bus_info field so the
> v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP:
> 
> Required ioctls:
>                 VIDIOC_QUERYCAP returned 0 (Success)
>                 fail: v4l2-compliance.cpp(304): string empty
>                 fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info))
>         test VIDIOC_QUERYCAP: FAIL
> 
> This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler:
> 
> Required ioctls:
>                 VIDIOC_QUERYCAP returned 0 (Success)
>         test VIDIOC_QUERYCAP: OK
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

	Hans

> ---
> 
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 3 ++-
>  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index f2d6376ce618..4a40df22fd63 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -267,7 +267,8 @@ static int vidioc_querycap(struct file *file, void *priv,
>  
>  	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
>  	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
> -	cap->bus_info[0] = 0;
> +	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
> +		 dev_name(&dev->plat_dev->dev));
>  	/*
>  	 * This is only a mem-to-mem video device. The capture and output
>  	 * device capability flags are left only for backward compatibility
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index 034b5c1d35a1..dd466ea6429e 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -945,7 +945,8 @@ static int vidioc_querycap(struct file *file, void *priv,
>  
>  	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
>  	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
> -	cap->bus_info[0] = 0;
> +	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
> +		 dev_name(&dev->plat_dev->dev));
>  	/*
>  	 * This is only a mem-to-mem video device. The capture and output
>  	 * device capability flags are left only for backward compatibility
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/6] [media] s5p-mfc: improve v4l2_capability driver and card fields
  2016-06-16 21:40 ` [PATCH 2/6] [media] s5p-mfc: improve v4l2_capability driver and card fields Javier Martinez Canillas
@ 2016-06-17  7:12   ` Hans Verkuil
  2016-06-29 19:45   ` Shuah Khan
  1 sibling, 0 replies; 19+ messages in thread
From: Hans Verkuil @ 2016-06-17  7:12 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Mauro Carvalho Chehab, Kamil Debski, Jeongtae Park,
	Kyungmin Park, linux-arm-kernel, linux-media

On 06/16/2016 11:40 PM, Javier Martinez Canillas wrote:
> According to the V4L2 documentation the driver and card fields should be
> used to identify the driver and the device but the s5p-mfc driver fills
> those field using the platform device name, which in turn is the name of
> the device DT node.
> 
> So not only the filled information isn't correct but also the same values
> are used in all the fields for both the encoder and decoder video devices.
> 
> Before this patch:
> 
> Driver Info (not using libv4l2):
>         Driver name   : 11000000.codec
>         Card type     : 11000000.codec
>         Bus info      : platform:11000000.codec
>         Driver version: 4.7.0
> 
> Driver Info (not using libv4l2):
>         Driver name   : 11000000.codec
>         Card type     : 11000000.codec
>         Bus info      : platform:11000000.codec
>         Driver version: 4.7.0
> 
> After this patch:
> 
> Driver Info (not using libv4l2):
>         Driver name   : s5p-mfc
>         Card type     : s5p-mfc-dec
>         Bus info      : platform:11000000.codec
>         Driver version: 4.7.0
> 
> Driver Info (not using libv4l2):
>         Driver name   : s5p-mfc
>         Card type     : s5p-mfc-enc
>         Bus info      : platform:11000000.codec
>         Driver version: 4.7.0
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

Hans

> ---
> 
>  drivers/media/platform/s5p-mfc/s5p_mfc.c        | 1 -
>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c    | 4 ++--
>  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    | 4 ++--
>  4 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> index 6ee620ee8cd5..a936f89fa54a 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> @@ -35,7 +35,6 @@
>  #include "s5p_mfc_cmd.h"
>  #include "s5p_mfc_pm.h"
>  
> -#define S5P_MFC_NAME		"s5p-mfc"
>  #define S5P_MFC_DEC_NAME	"s5p-mfc-dec"
>  #define S5P_MFC_ENC_NAME	"s5p-mfc-enc"
>  
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> index 9eb2481ec292..a10dcd244ff0 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> @@ -25,6 +25,8 @@
>  #include "regs-mfc.h"
>  #include "regs-mfc-v8.h"
>  
> +#define S5P_MFC_NAME		"s5p-mfc"
> +
>  /* Definitions related to MFC memory */
>  
>  /* Offset base used to differentiate between CAPTURE and OUTPUT
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index 4a40df22fd63..5793b0d8ee0c 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -265,8 +265,8 @@ static int vidioc_querycap(struct file *file, void *priv,
>  {
>  	struct s5p_mfc_dev *dev = video_drvdata(file);
>  
> -	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
> -	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
> +	strncpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver) - 1);
> +	strncpy(cap->card, dev->vfd_dec->name, sizeof(cap->card) - 1);
>  	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
>  		 dev_name(&dev->plat_dev->dev));
>  	/*
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index dd466ea6429e..1220559d4874 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -943,8 +943,8 @@ static int vidioc_querycap(struct file *file, void *priv,
>  {
>  	struct s5p_mfc_dev *dev = video_drvdata(file);
>  
> -	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
> -	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
> +	strncpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver) - 1);
> +	strncpy(cap->card, dev->vfd_enc->name, sizeof(cap->card) - 1);
>  	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
>  		 dev_name(&dev->plat_dev->dev));
>  	/*
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP
  2016-06-16 21:40 ` [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
  2016-06-17  6:45   ` Jacek Anaszewski
@ 2016-06-17  7:12   ` Hans Verkuil
  2016-06-29 19:46   ` Shuah Khan
  2 siblings, 0 replies; 19+ messages in thread
From: Hans Verkuil @ 2016-06-17  7:12 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Mauro Carvalho Chehab, Jacek Anaszewski, Andrzej Pietrasiewicz,
	linux-arm-kernel, linux-media

On 06/16/2016 11:40 PM, Javier Martinez Canillas wrote:
> The driver doesn't set the struct v4l2_capability cap_info field so the
> v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP:
> 
> Required ioctls:
>                 VIDIOC_QUERYCAP returned 0 (Success)
>                 fail: v4l2-compliance.cpp(304): string empty
>                 fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info))
>         test VIDIOC_QUERYCAP: FAIL
> 
> This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler:
> 
> Required ioctls:
>                 VIDIOC_QUERYCAP returned 0 (Success)
>         test VIDIOC_QUERYCAP: OK
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

Hans

> ---
> 
>  drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> index 17bc94092864..e3ff3d4bd72e 100644
> --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> @@ -1256,7 +1256,8 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
>  		strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder",
>  			sizeof(cap->card));
>  	}
> -	cap->bus_info[0] = 0;
> +	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
> +		 dev_name(ctx->jpeg->dev));
>  	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M;
>  	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
>  	return 0;
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field
  2016-06-16 21:40 ` [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field Javier Martinez Canillas
  2016-06-17  6:45   ` Jacek Anaszewski
@ 2016-06-17  7:13   ` Hans Verkuil
  2016-06-29 19:47   ` Shuah Khan
  2 siblings, 0 replies; 19+ messages in thread
From: Hans Verkuil @ 2016-06-17  7:13 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Mauro Carvalho Chehab, Jacek Anaszewski, Andrzej Pietrasiewicz,
	linux-arm-kernel, linux-media

On 06/16/2016 11:40 PM, Javier Martinez Canillas wrote:
> The driver fills in both the struct v4l2_capability driver and card fields
> the same values, that is the driver's name plus the information if the dev
> is a decoder or an encoder.
> 
> But the driver field has a fixed length of 16 bytes so the filled data is
> truncated:
> 
> Driver Info (not using libv4l2):
>         Driver name   : s5p-jpeg decode
>         Card type     : s5p-jpeg decoder
>         Bus info      : platform:11f50000.jpeg
>         Driver version: 4.7.0
> 
> Also, this field should only contain the driver's name so use just that.
> The information if the device is a decoder or an encoder is in the card
> type field anyways.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

Hans

> ---
> 
>  drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> index e3ff3d4bd72e..f9fb52a53e79 100644
> --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> @@ -1246,12 +1246,12 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
>  	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
>  
>  	if (ctx->mode == S5P_JPEG_ENCODE) {
> -		strlcpy(cap->driver, S5P_JPEG_M2M_NAME " encoder",
> +		strlcpy(cap->driver, S5P_JPEG_M2M_NAME,
>  			sizeof(cap->driver));
>  		strlcpy(cap->card, S5P_JPEG_M2M_NAME " encoder",
>  			sizeof(cap->card));
>  	} else {
> -		strlcpy(cap->driver, S5P_JPEG_M2M_NAME " decoder",
> +		strlcpy(cap->driver, S5P_JPEG_M2M_NAME,
>  			sizeof(cap->driver));
>  		strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder",
>  			sizeof(cap->card));
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/6] [media] gsc-m2m: add device name sufix to bus_info capatiliby field
  2016-06-16 21:40 ` [PATCH 5/6] [media] gsc-m2m: add device name sufix to bus_info capatiliby field Javier Martinez Canillas
@ 2016-06-17  7:13   ` Hans Verkuil
  0 siblings, 0 replies; 19+ messages in thread
From: Hans Verkuil @ 2016-06-17  7:13 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Junghak Sung, Kukjin Kim, Seung-Woo Kim, Mauro Carvalho Chehab,
	Inki Dae, linux-samsung-soc, Krzysztof Kozlowski, Markus Elfring,
	Hans Verkuil, linux-arm-kernel, linux-media

On 06/16/2016 11:40 PM, Javier Martinez Canillas wrote:
> The driver doesn't set the device in the struct v4l2_capability bus_info
> field so v4l2-compliance reports the following error for VIDIOC_QUERYCAP:
> 
> Required ioctls:
>                 fail: v4l2-compliance.cpp(537): missing bus_info prefix ('platform')
>         test VIDIOC_QUERYCAP: FAIL
> 
> This patch fixes this by filling also the device besides the bus.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

Hans

> ---
> 
>  drivers/media/platform/exynos-gsc/gsc-m2m.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c
> index a600e32e2543..af81383086b8 100644
> --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
> +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
> @@ -281,7 +281,8 @@ static int gsc_m2m_querycap(struct file *file, void *fh,
>  
>  	strlcpy(cap->driver, gsc->pdev->name, sizeof(cap->driver));
>  	strlcpy(cap->card, gsc->pdev->name, sizeof(cap->card));
> -	strlcpy(cap->bus_info, "platform", sizeof(cap->bus_info));
> +	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
> +		 dev_name(&gsc->pdev->dev));
>  	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE |
>  		V4L2_CAP_VIDEO_CAPTURE_MPLANE |	V4L2_CAP_VIDEO_OUTPUT_MPLANE;
>  
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 6/6] [media] gsc-m2m: improve v4l2_capability driver and card fields
  2016-06-16 21:40 ` [PATCH 6/6] [media] gsc-m2m: improve v4l2_capability driver and card fields Javier Martinez Canillas
@ 2016-06-17  7:13   ` Hans Verkuil
  0 siblings, 0 replies; 19+ messages in thread
From: Hans Verkuil @ 2016-06-17  7:13 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Junghak Sung, Kukjin Kim, Seung-Woo Kim, Mauro Carvalho Chehab,
	linux-samsung-soc, Krzysztof Kozlowski, Geunyoung Kim,
	Markus Elfring, Hans Verkuil, linux-arm-kernel, linux-media

On 06/16/2016 11:40 PM, Javier Martinez Canillas wrote:
> According to the V4L2 documentation the driver and card fields should be
> used to identify the driver and the device but the gsc-m2m driver fills
> those field using the platform device name, which in turn is the name of
> the device DT node.
> 
> So not only the filled information isn't correct but also the same values
> are used in the driver, card and bus_info fields.
> 
> Before this patch:
> 
> Driver Info (not using libv4l2):
>         Driver name   : 13e00000.video-
>         Card type     : 13e00000.video-scaler
>         Bus info      : platform:13e00000.video-scaler
>         Driver version: 4.7.0
> 
> After this patch:
> 
> Driver Info (not using libv4l2):
>         Driver name   : exynos-gsc
>         Card type     : exynos-gsc gscaler
>         Bus info      : platform:13e00000.video-scaler
>         Driver version: 4.7.0
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

Hans

> 
> ---
> 
>  drivers/media/platform/exynos-gsc/gsc-m2m.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c
> index af81383086b8..274861c27367 100644
> --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
> +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
> @@ -279,8 +279,8 @@ static int gsc_m2m_querycap(struct file *file, void *fh,
>  	struct gsc_ctx *ctx = fh_to_ctx(fh);
>  	struct gsc_dev *gsc = ctx->gsc_dev;
>  
> -	strlcpy(cap->driver, gsc->pdev->name, sizeof(cap->driver));
> -	strlcpy(cap->card, gsc->pdev->name, sizeof(cap->card));
> +	strlcpy(cap->driver, GSC_MODULE_NAME, sizeof(cap->driver));
> +	strlcpy(cap->card, GSC_MODULE_NAME " gscaler", sizeof(cap->card));
>  	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
>  		 dev_name(&gsc->pdev->dev));
>  	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE |
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP
  2016-06-16 21:40 ` [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
  2016-06-17  7:11   ` Hans Verkuil
@ 2016-06-29 19:43   ` Shuah Khan
  1 sibling, 0 replies; 19+ messages in thread
From: Shuah Khan @ 2016-06-29 19:43 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Mauro Carvalho Chehab, Kamil Debski, Jeongtae Park,
	Kyungmin Park, linux-arm-kernel, linux-media

On 06/16/2016 03:40 PM, Javier Martinez Canillas wrote:
> The driver doesn't set the struct v4l2_capability bus_info field so the
> v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP:
> 
> Required ioctls:
>                 VIDIOC_QUERYCAP returned 0 (Success)
>                 fail: v4l2-compliance.cpp(304): string empty
>                 fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info))
>         test VIDIOC_QUERYCAP: FAIL
> 
> This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler:
> 
> Required ioctls:
>                 VIDIOC_QUERYCAP returned 0 (Success)
>         test VIDIOC_QUERYCAP: OK
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

I started making the very same changes. Looks good.

Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>

-- Shuah
> ---
> 
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 3 ++-
>  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index f2d6376ce618..4a40df22fd63 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -267,7 +267,8 @@ static int vidioc_querycap(struct file *file, void *priv,
>  
>  	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
>  	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
> -	cap->bus_info[0] = 0;
> +	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
> +		 dev_name(&dev->plat_dev->dev));
>  	/*
>  	 * This is only a mem-to-mem video device. The capture and output
>  	 * device capability flags are left only for backward compatibility
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index 034b5c1d35a1..dd466ea6429e 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -945,7 +945,8 @@ static int vidioc_querycap(struct file *file, void *priv,
>  
>  	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
>  	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
> -	cap->bus_info[0] = 0;
> +	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
> +		 dev_name(&dev->plat_dev->dev));
>  	/*
>  	 * This is only a mem-to-mem video device. The capture and output
>  	 * device capability flags are left only for backward compatibility
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/6] [media] s5p-mfc: improve v4l2_capability driver and card fields
  2016-06-16 21:40 ` [PATCH 2/6] [media] s5p-mfc: improve v4l2_capability driver and card fields Javier Martinez Canillas
  2016-06-17  7:12   ` Hans Verkuil
@ 2016-06-29 19:45   ` Shuah Khan
  1 sibling, 0 replies; 19+ messages in thread
From: Shuah Khan @ 2016-06-29 19:45 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Mauro Carvalho Chehab, Kamil Debski, Jeongtae Park,
	Kyungmin Park, linux-arm-kernel, linux-media

On 06/16/2016 03:40 PM, Javier Martinez Canillas wrote:
> According to the V4L2 documentation the driver and card fields should be
> used to identify the driver and the device but the s5p-mfc driver fills
> those field using the platform device name, which in turn is the name of
> the device DT node.
> 
> So not only the filled information isn't correct but also the same values
> are used in all the fields for both the encoder and decoder video devices.
> 
> Before this patch:
> 
> Driver Info (not using libv4l2):
>         Driver name   : 11000000.codec
>         Card type     : 11000000.codec
>         Bus info      : platform:11000000.codec
>         Driver version: 4.7.0
> 
> Driver Info (not using libv4l2):
>         Driver name   : 11000000.codec
>         Card type     : 11000000.codec
>         Bus info      : platform:11000000.codec
>         Driver version: 4.7.0
> 
> After this patch:
> 
> Driver Info (not using libv4l2):
>         Driver name   : s5p-mfc
>         Card type     : s5p-mfc-dec
>         Bus info      : platform:11000000.codec
>         Driver version: 4.7.0
> 
> Driver Info (not using libv4l2):
>         Driver name   : s5p-mfc
>         Card type     : s5p-mfc-enc
>         Bus info      : platform:11000000.codec
>         Driver version: 4.7.0
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>


Looks good.

Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>

-- Shuah

> ---
> 
>  drivers/media/platform/s5p-mfc/s5p_mfc.c        | 1 -
>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c    | 4 ++--
>  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    | 4 ++--
>  4 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> index 6ee620ee8cd5..a936f89fa54a 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> @@ -35,7 +35,6 @@
>  #include "s5p_mfc_cmd.h"
>  #include "s5p_mfc_pm.h"
>  
> -#define S5P_MFC_NAME		"s5p-mfc"
>  #define S5P_MFC_DEC_NAME	"s5p-mfc-dec"
>  #define S5P_MFC_ENC_NAME	"s5p-mfc-enc"
>  
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> index 9eb2481ec292..a10dcd244ff0 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> @@ -25,6 +25,8 @@
>  #include "regs-mfc.h"
>  #include "regs-mfc-v8.h"
>  
> +#define S5P_MFC_NAME		"s5p-mfc"
> +
>  /* Definitions related to MFC memory */
>  
>  /* Offset base used to differentiate between CAPTURE and OUTPUT
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index 4a40df22fd63..5793b0d8ee0c 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -265,8 +265,8 @@ static int vidioc_querycap(struct file *file, void *priv,
>  {
>  	struct s5p_mfc_dev *dev = video_drvdata(file);
>  
> -	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
> -	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
> +	strncpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver) - 1);
> +	strncpy(cap->card, dev->vfd_dec->name, sizeof(cap->card) - 1);
>  	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
>  		 dev_name(&dev->plat_dev->dev));
>  	/*
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index dd466ea6429e..1220559d4874 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -943,8 +943,8 @@ static int vidioc_querycap(struct file *file, void *priv,
>  {
>  	struct s5p_mfc_dev *dev = video_drvdata(file);
>  
> -	strncpy(cap->driver, dev->plat_dev->name, sizeof(cap->driver) - 1);
> -	strncpy(cap->card, dev->plat_dev->name, sizeof(cap->card) - 1);
> +	strncpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver) - 1);
> +	strncpy(cap->card, dev->vfd_enc->name, sizeof(cap->card) - 1);
>  	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
>  		 dev_name(&dev->plat_dev->dev));
>  	/*
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP
  2016-06-16 21:40 ` [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
  2016-06-17  6:45   ` Jacek Anaszewski
  2016-06-17  7:12   ` Hans Verkuil
@ 2016-06-29 19:46   ` Shuah Khan
  2 siblings, 0 replies; 19+ messages in thread
From: Shuah Khan @ 2016-06-29 19:46 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Mauro Carvalho Chehab, Jacek Anaszewski, Andrzej Pietrasiewicz,
	linux-arm-kernel, linux-media

On 06/16/2016 03:40 PM, Javier Martinez Canillas wrote:
> The driver doesn't set the struct v4l2_capability cap_info field so the
> v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP:
> 
> Required ioctls:
>                 VIDIOC_QUERYCAP returned 0 (Success)
>                 fail: v4l2-compliance.cpp(304): string empty
>                 fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info))
>         test VIDIOC_QUERYCAP: FAIL
> 
> This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler:
> 
> Required ioctls:
>                 VIDIOC_QUERYCAP returned 0 (Success)
>         test VIDIOC_QUERYCAP: OK
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
> 
>  drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> index 17bc94092864..e3ff3d4bd72e 100644
> --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> @@ -1256,7 +1256,8 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
>  		strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder",
>  			sizeof(cap->card));
>  	}
> -	cap->bus_info[0] = 0;
> +	snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
> +		 dev_name(ctx->jpeg->dev));
>  	cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M;
>  	cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
>  	return 0;
> 

Looks good.

Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>

-- Shuah

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field
  2016-06-16 21:40 ` [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field Javier Martinez Canillas
  2016-06-17  6:45   ` Jacek Anaszewski
  2016-06-17  7:13   ` Hans Verkuil
@ 2016-06-29 19:47   ` Shuah Khan
  2 siblings, 0 replies; 19+ messages in thread
From: Shuah Khan @ 2016-06-29 19:47 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: Mauro Carvalho Chehab, Jacek Anaszewski, Andrzej Pietrasiewicz,
	linux-arm-kernel, linux-media

On 06/16/2016 03:40 PM, Javier Martinez Canillas wrote:
> The driver fills in both the struct v4l2_capability driver and card fields
> the same values, that is the driver's name plus the information if the dev
> is a decoder or an encoder.
> 
> But the driver field has a fixed length of 16 bytes so the filled data is
> truncated:
> 
> Driver Info (not using libv4l2):
>         Driver name   : s5p-jpeg decode
>         Card type     : s5p-jpeg decoder
>         Bus info      : platform:11f50000.jpeg
>         Driver version: 4.7.0
> 
> Also, this field should only contain the driver's name so use just that.
> The information if the device is a decoder or an encoder is in the card
> type field anyways.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
> 
>  drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> index e3ff3d4bd72e..f9fb52a53e79 100644
> --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> @@ -1246,12 +1246,12 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,
>  	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
>  
>  	if (ctx->mode == S5P_JPEG_ENCODE) {
> -		strlcpy(cap->driver, S5P_JPEG_M2M_NAME " encoder",
> +		strlcpy(cap->driver, S5P_JPEG_M2M_NAME,
>  			sizeof(cap->driver));
>  		strlcpy(cap->card, S5P_JPEG_M2M_NAME " encoder",
>  			sizeof(cap->card));
>  	} else {
> -		strlcpy(cap->driver, S5P_JPEG_M2M_NAME " decoder",
> +		strlcpy(cap->driver, S5P_JPEG_M2M_NAME,
>  			sizeof(cap->driver));
>  		strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder",
>  			sizeof(cap->card));
> 

Looks good.
Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>

-- Shuah

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-06-29 19:54 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-16 21:40 [PATCH 0/6] [media] Fixes and improvements for VIDIOC_QUERYCAP in Samsung media drivers Javier Martinez Canillas
2016-06-16 21:40 ` [PATCH 1/6] [media] s5p-mfc: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
2016-06-17  7:11   ` Hans Verkuil
2016-06-29 19:43   ` Shuah Khan
2016-06-16 21:40 ` [PATCH 2/6] [media] s5p-mfc: improve v4l2_capability driver and card fields Javier Martinez Canillas
2016-06-17  7:12   ` Hans Verkuil
2016-06-29 19:45   ` Shuah Khan
2016-06-16 21:40 ` [PATCH 3/6] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP Javier Martinez Canillas
2016-06-17  6:45   ` Jacek Anaszewski
2016-06-17  7:12   ` Hans Verkuil
2016-06-29 19:46   ` Shuah Khan
2016-06-16 21:40 ` [PATCH 4/6] [media] s5p-jpeg: only fill driver's name in capabilities driver field Javier Martinez Canillas
2016-06-17  6:45   ` Jacek Anaszewski
2016-06-17  7:13   ` Hans Verkuil
2016-06-29 19:47   ` Shuah Khan
2016-06-16 21:40 ` [PATCH 5/6] [media] gsc-m2m: add device name sufix to bus_info capatiliby field Javier Martinez Canillas
2016-06-17  7:13   ` Hans Verkuil
2016-06-16 21:40 ` [PATCH 6/6] [media] gsc-m2m: improve v4l2_capability driver and card fields Javier Martinez Canillas
2016-06-17  7:13   ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).