[PATCH] media: soc_camera: rcar_vin: Add BT.709 24-bit RGB888 input support

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---

This patch is against master branch of linuxtv.org/media_tree.git.

 drivers/media/platform/soc_camera/rcar_vin.c | 10 ++
 include/linux/platform_data/camera-rcar.h|  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 20defcb..7eb4f1e 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -74,6 +74,8 @@
 #define VNMC_INF_YUV10_BT656   (2  16)
 #define VNMC_INF_YUV10_BT601   (3  16)
 #define VNMC_INF_YUV16 (5  16)
+#define VNMC_INF_RGB888(6  16)
+#define VNMC_INF_RGB_MASK  (6  16)
 #define VNMC_VUP   (1  10)
 #define VNMC_IM_ODD(0  3)
 #define VNMC_IM_ODD_EVEN   (1  3)
@@ -272,6 +274,10 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
 
/* input interface */
switch (icd-current_fmt-code) {
+   case V4L2_MBUS_FMT_RGB888_1X24:
+   /* BT.601/BT.709 24-bit RGB-888 */
+   vnmc |= VNMC_INF_RGB888;
+   break;
case V4L2_MBUS_FMT_YUYV8_1X16:
/* BT.601/BT.1358 16bit YCbCr422 */
vnmc |= VNMC_INF_YUV16;
@@ -331,6 +337,9 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
if (output_is_yuv)
vnmc |= VNMC_BPS;
 
+   if (vnmc  VNMC_INF_RGB_MASK)
+   vnmc ^= VNMC_BPS;
+
/* progressive or interlaced mode */
interrupts = progressive ? VNIE_FIE | VNIE_EFE : VNIE_EFE;
 
@@ -1013,6 +1022,7 @@ static int rcar_vin_get_formats(struct soc_camera_device 
*icd, unsigned int idx,
case V4L2_MBUS_FMT_YUYV8_1X16:
case V4L2_MBUS_FMT_YUYV8_2X8:
case V4L2_MBUS_FMT_YUYV10_2X10:
+   case V4L2_MBUS_FMT_RGB888_1X24:
if (cam-extra_fmt)
break;
 
diff --git a/include/linux/platform_data/camera-rcar.h 
b/include/linux/platform_data/camera-rcar.h
index dfc83c5..03a9df6 100644
--- a/include/linux/platform_data/camera-rcar.h
+++ b/include/linux/platform_data/camera-rcar.h
@@ -17,6 +17,7 @@
 #define RCAR_VIN_VSYNC_ACTIVE_LOW  (1  1)
 #define RCAR_VIN_BT601 (1  2)
 #define RCAR_VIN_BT656 (1  3)
+#define RCAR_VIN_BT709 (1  4)
 
 struct rcar_vin_platform_data {
unsigned int flags;
-- 
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] media: soc_camera: rcar_vin: Add YUYV capture format support

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---

This patch is against master branch of linuxtv.org/media_tree.git.

 drivers/media/platform/soc_camera/rcar_vin.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 7eb4f1e..61c36b0 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -889,6 +889,14 @@ static const struct soc_mbus_pixelfmt rcar_vin_formats[] = 
{
.layout = SOC_MBUS_LAYOUT_PLANAR_Y_C,
},
{
+   .fourcc = V4L2_PIX_FMT_YUYV,
+   .name   = YUYV,
+   .bits_per_sample= 16,
+   .packing= SOC_MBUS_PACKING_NONE,
+   .order  = SOC_MBUS_ORDER_LE,
+   .layout = SOC_MBUS_LAYOUT_PACKED,
+   },
+   {
.fourcc = V4L2_PIX_FMT_UYVY,
.name   = UYVY,
.bits_per_sample= 16,
-- 
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] media: soc_camera: rcar_vin: Enable VSYNC field toggle mode

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

By applying this patch, it sets to VSYNC field toggle mode not only
at the time of progressive mode but at the time of an interlace mode.

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---

This patch is against master branch of linuxtv.org/media_tree.git.

 drivers/media/platform/soc_camera/rcar_vin.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 5196c81..bf97ed6 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -108,6 +108,7 @@
 #define VNDMR2_VPS (1  30)
 #define VNDMR2_HPS (1  29)
 #define VNDMR2_FTEV(1  17)
+#define VNDMR2_VLV_1   (1  12)
 
 #define VIN_MAX_WIDTH  2048
 #define VIN_MAX_HEIGHT 2048
@@ -828,7 +829,7 @@ static int rcar_vin_set_bus_param(struct soc_camera_device 
*icd)
if (ret  0  ret != -ENOIOCTLCMD)
return ret;
 
-   val = priv-field == V4L2_FIELD_NONE ? VNDMR2_FTEV : 0;
+   val = VNDMR2_FTEV | VNDMR2_VLV_1;
if (!(common_flags  V4L2_MBUS_VSYNC_ACTIVE_LOW))
val |= VNDMR2_VPS;
if (!(common_flags  V4L2_MBUS_HSYNC_ACTIVE_LOW))
-- 
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] media: soc_camera: Fix VIDIOC_S_CROP ioctl miscalculation

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

This patch corrects the miscalculation of the capture buffer
size and clipping data update in VIDIOC_S_CROP sequence.

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---

This patch is against master branch of linuxtv.org/media_tree.git.

 drivers/media/platform/soc_camera/rcar_vin.c   | 5 -
 drivers/media/platform/soc_camera/soc_scale_crop.c | 6 --
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 61c36b0..5196c81 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1119,9 +1119,6 @@ static int rcar_vin_set_crop(struct soc_camera_device 
*icd,
cam-width = mf.width;
cam-height = mf.height;
 
-   icd-user_width  = cam-width;
-   icd-user_height = cam-height;
-
cam-vin_left = rect-left  ~1;
cam-vin_top = rect-top  ~1;
 
@@ -1130,8 +1127,6 @@ static int rcar_vin_set_crop(struct soc_camera_device 
*icd,
if (ret  0)
return ret;
 
-   cam-subrect = *rect;
-
dev_dbg(dev, VIN cropped to %ux%u@%u:%u\n,
icd-user_width, icd-user_height,
cam-vin_left, cam-vin_top);
diff --git a/drivers/media/platform/soc_camera/soc_scale_crop.c 
b/drivers/media/platform/soc_camera/soc_scale_crop.c
index 8e74fb7..7a1951a 100644
--- a/drivers/media/platform/soc_camera/soc_scale_crop.c
+++ b/drivers/media/platform/soc_camera/soc_scale_crop.c
@@ -74,14 +74,14 @@ static void update_subrect(struct v4l2_rect *rect, struct 
v4l2_rect *subrect)
 
if (rect-left  subrect-left)
subrect-left = rect-left;
-   else if (rect-left + rect-width 
+   else if (rect-left + rect-width 
 subrect-left + subrect-width)
subrect-left = rect-left + rect-width -
subrect-width;
 
if (rect-top  subrect-top)
subrect-top = rect-top;
-   else if (rect-top + rect-height 
+   else if (rect-top + rect-height 
 subrect-top + subrect-height)
subrect-top = rect-top + rect-height -
subrect-height;
@@ -117,6 +117,7 @@ int soc_camera_client_s_crop(struct v4l2_subdev *sd,
dev_dbg(dev, Camera S_CROP successful for %dx%d@%d:%d\n,
rect-width, rect-height, rect-left, rect-top);
*target_rect = *cam_rect;
+   *subrect = *rect;
return 0;
}
 
@@ -204,6 +205,7 @@ int soc_camera_client_s_crop(struct v4l2_subdev *sd,
 
if (!ret) {
*target_rect = *cam_rect;
+   *subrect = *rect;
update_subrect(target_rect, subrect);
}
 
-- 
1.9.1

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


[PATCH 0/3] media: soc_camera: rcar_vin: Add scaling support

2014-10-14 Thread Yoshihiro Kaneko
This series is against master branch of linuxtv.org/media_tree.git.

Koji Matsuoka (3):
  media: soc_camera: rcar_vin: Add scaling support
  media: soc_camera: rcar_vin: Add capture width check for NV16 format
  media: soc_camera: rcar_vin: Add NV16 horizontal scaling-up support

 drivers/media/platform/soc_camera/rcar_vin.c | 488 ++-
 1 file changed, 478 insertions(+), 10 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 2/3] media: soc_camera: rcar_vin: Add capture width check for NV16 format

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

At the time of NV16 capture format, the user has to specify the
capture output width of the multiple of 32 for H/W specification.
At the time of using NV16 format by ioctl of VIDIOC_S_FMT,
this patch adds align check and the error handling to forbid
specification of the capture output width which is not a multiple of 32.

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---
 drivers/media/platform/soc_camera/rcar_vin.c | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 746f03f..00bc98d 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -488,6 +488,7 @@ struct rcar_vin_priv {
boolrequest_to_stop;
struct completion   capture_stop;
enum chip_idchip;
+   boolerror_flag;
 };
 
 #define is_continuous_transfer(priv)   (priv-vb_count  MAX_BUFFER_NUM)
@@ -647,7 +648,7 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
/* output format */
switch (icd-current_fmt-host_fmt-fourcc) {
case V4L2_PIX_FMT_NV16:
-   iowrite32(ALIGN(cam-width * cam-height, 0x80),
+   iowrite32(ALIGN(ALIGN(cam-width, 0x20) * cam-height, 0x80),
  priv-base + VNUVAOF_REG);
dmr = VNDMR_DTMD_YCSEP;
output_is_yuv = true;
@@ -976,6 +977,8 @@ static int rcar_vin_add_device(struct soc_camera_device 
*icd)
dev_dbg(icd-parent, R-Car VIN driver attached to camera %d\n,
icd-devnum);
 
+   priv-error_flag = false;
+
return 0;
 }
 
@@ -993,6 +996,7 @@ static void rcar_vin_remove_device(struct soc_camera_device 
*icd)
 
priv-state = STOPPED;
priv-request_to_stop = false;
+   priv-error_flag = false;
 
/* make sure active buffer is cancelled */
spin_lock_irq(priv-lock);
@@ -1089,6 +1093,7 @@ static int rcar_vin_set_rect(struct soc_camera_device 
*icd)
unsigned char dsize = 0;
struct v4l2_rect *cam_subrect = cam-subrect;
unsigned long value;
+   unsigned long imgstr;
 
dev_dbg(icd-parent, Crop %ux%u@%u:%u\n,
icd-user_width, icd-user_height, cam-vin_left, cam-vin_top);
@@ -1166,7 +1171,11 @@ static int rcar_vin_set_rect(struct soc_camera_device 
*icd)
break;
}
 
-   iowrite32(ALIGN(cam-out_width, 0x10), priv-base + VNIS_REG);
+   if (icd-current_fmt-host_fmt-fourcc == V4L2_PIX_FMT_NV16)
+   imgstr = ALIGN(cam-out_width, 0x20);
+   else
+   imgstr = ALIGN(cam-out_width, 0x10);
+   iowrite32(imgstr, priv-base + VNIS_REG);
 
return 0;
 }
@@ -1608,6 +1617,17 @@ static int rcar_vin_set_fmt(struct soc_camera_device 
*icd,
dev_dbg(dev, S_FMT(pix=0x%x, %ux%u)\n,
pixfmt, pix-width, pix-height);
 
+   /* At the time of NV16 capture format, the user has to specify the
+  width of the multiple of 32 for H/W specification. */
+   if (priv-error_flag == false)
+   priv-error_flag = true;
+   else {
+   if ((pixfmt == V4L2_PIX_FMT_NV16)  (pix-width  0x1F)) {
+   dev_err(icd-parent, Specified width error in NV16 
format.\n);
+   return -EINVAL;
+   }
+   }
+
switch (pix-field) {
default:
pix-field = V4L2_FIELD_NONE;
-- 
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 3/3] media: soc_camera: rcar_vin: Add NV16 horizontal scaling-up support

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

The scaling function had been forbidden for the capture format of
NV16 until now. With this patch, a horizontal scaling-up function
is supported to the capture format of NV16. a vertical scaling-up
by the capture format of NV16 is forbidden for the H/W specification.

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---
 drivers/media/platform/soc_camera/rcar_vin.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 00bc98d..bf3588f 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -648,7 +648,7 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
/* output format */
switch (icd-current_fmt-host_fmt-fourcc) {
case V4L2_PIX_FMT_NV16:
-   iowrite32(ALIGN(ALIGN(cam-width, 0x20) * cam-height, 0x80),
+   iowrite32(ALIGN((cam-out_width * cam-out_height), 0x80),
  priv-base + VNUVAOF_REG);
dmr = VNDMR_DTMD_YCSEP;
output_is_yuv = true;
@@ -1622,9 +1622,19 @@ static int rcar_vin_set_fmt(struct soc_camera_device 
*icd,
if (priv-error_flag == false)
priv-error_flag = true;
else {
-   if ((pixfmt == V4L2_PIX_FMT_NV16)  (pix-width  0x1F)) {
-   dev_err(icd-parent, Specified width error in NV16 
format.\n);
-   return -EINVAL;
+   if (pixfmt == V4L2_PIX_FMT_NV16) {
+   if (pix-width  0x1F) {
+   dev_err(icd-parent,
+   Specified width error in NV16 format. 
+   Please specify the multiple of 32.\n);
+   return -EINVAL;
+   }
+   if (pix-height != cam-height) {
+   dev_err(icd-parent,
+   Vertical scaling-up error in NV16 format. 
+   Please specify input height size.\n);
+   return -EINVAL;
+   }
}
}
 
@@ -1670,6 +1680,7 @@ static int rcar_vin_set_fmt(struct soc_camera_device *icd,
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_RGB555X:
+   case V4L2_PIX_FMT_NV16: /* horizontal scaling-up only is supported */
can_scale = true;
break;
default:
-- 
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 1/3] media: soc_camera: rcar_vin: Add scaling support

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---
 drivers/media/platform/soc_camera/rcar_vin.c | 455 ++-
 1 file changed, 446 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index bf97ed6..746f03f 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -64,6 +64,30 @@
 #define VNDMR_REG  0x58/* Video n Data Mode Register */
 #define VNDMR2_REG 0x5C/* Video n Data Mode Register 2 */
 #define VNUVAOF_REG0x60/* Video n UV Address Offset Register */
+#define VNC1A_REG  0x80/* Video n Coefficient Set C1A Register */
+#define VNC1B_REG  0x84/* Video n Coefficient Set C1B Register */
+#define VNC1C_REG  0x88/* Video n Coefficient Set C1C Register */
+#define VNC2A_REG  0x90/* Video n Coefficient Set C2A Register */
+#define VNC2B_REG  0x94/* Video n Coefficient Set C2B Register */
+#define VNC2C_REG  0x98/* Video n Coefficient Set C2C Register */
+#define VNC3A_REG  0xA0/* Video n Coefficient Set C3A Register */
+#define VNC3B_REG  0xA4/* Video n Coefficient Set C3B Register */
+#define VNC3C_REG  0xA8/* Video n Coefficient Set C3C Register */
+#define VNC4A_REG  0xB0/* Video n Coefficient Set C4A Register */
+#define VNC4B_REG  0xB4/* Video n Coefficient Set C4B Register */
+#define VNC4C_REG  0xB8/* Video n Coefficient Set C4C Register */
+#define VNC5A_REG  0xC0/* Video n Coefficient Set C5A Register */
+#define VNC5B_REG  0xC4/* Video n Coefficient Set C5B Register */
+#define VNC5C_REG  0xC8/* Video n Coefficient Set C5C Register */
+#define VNC6A_REG  0xD0/* Video n Coefficient Set C6A Register */
+#define VNC6B_REG  0xD4/* Video n Coefficient Set C6B Register */
+#define VNC6C_REG  0xD8/* Video n Coefficient Set C6C Register */
+#define VNC7A_REG  0xE0/* Video n Coefficient Set C7A Register */
+#define VNC7B_REG  0xE4/* Video n Coefficient Set C7B Register */
+#define VNC7C_REG  0xE8/* Video n Coefficient Set C7C Register */
+#define VNC8A_REG  0xF0/* Video n Coefficient Set C8A Register */
+#define VNC8B_REG  0xF4/* Video n Coefficient Set C8B Register */
+#define VNC8C_REG  0xF8/* Video n Coefficient Set C8C Register */
 
 /* Register bit fields for R-Car VIN */
 /* Video n Main Control Register bits */
@@ -120,6 +144,326 @@ enum chip_id {
RCAR_E1,
 };
 
+struct VIN_COEFF {
+   unsigned short xs_value;
+   unsigned long coeff_set[24];
+};
+
+static const struct VIN_COEFF vin_coeff_set[] = {
+   { 0x, {
+   0x, 0x, 0x,
+   0x, 0x, 0x,
+   0x, 0x, 0x,
+   0x, 0x, 0x,
+   0x, 0x, 0x,
+   0x, 0x, 0x,
+   0x, 0x, 0x,
+   0x, 0x, 0x },
+   },
+   { 0x1000, {
+   0x000fa400, 0x000fa400, 0x09625902,
+   0x03f8, 0x0403, 0x3de0d9f0,
+   0x001fffed, 0x0804, 0x3cc1f9c3,
+   0x001003de, 0x0c01, 0x3cb34d7f,
+   0x002003d2, 0x0c00, 0x3d24a92d,
+   0x00200bca, 0x0bff, 0x3df600d2,
+   0x002013cc, 0x07ff, 0x3ed70c7e,
+   0x00100fde, 0x, 0x3f87c036 },
+   },
+   { 0x1200, {
+   0x0021, 0x0021, 0x02a0a9c8,
+   0x002003e7, 0x001a, 0x000185bc,
+   0x002007dc, 0x03ff, 0x3e52859c,
+   0x00200bd4, 0x0002, 0x3d53996b,
+   0x00100fd0, 0x0403, 0x3d04ad2d,
+   0x0bd5, 0x0403, 0x3d35ace7,
+   0x3ff003e4, 0x0801, 0x3dc674a1,
+   0x3fffe800, 0x0800, 0x3e76f461 },
+   },
+   { 0x1400, {
+   0x00100be3, 0x00100be3, 0x04d1359a,
+   0x0fdb, 0x002003ed, 0x0211fd93,
+   0x0fd6, 0x002003f4, 

[PATCH 0/7] [media] exynos-gsc: Fixup PM support

2014-10-14 Thread Ulf Hansson
This patchset fixup the PM support and adds some minor improvements to
potentially save some more power at runtime PM suspend.

Some background to this patchset, which are related to the generic PM domain:
http://marc.info/?l=linux-pmm=141217452218592w=2
http://marc.info/?t=141217462200011r=1w=2

The conserns from the above discussions are intended to be solved by a reworked
approach for the generic PM domain, link below.
http://marc.info/?l=linux-pmm=141320895122707w=2

Ulf Hansson (7):
  [media] exynos-gsc: Simplify clock management
  [media] exynos-gsc: Convert gsc_m2m_resume() from int to void
  [media] exynos-gsc: Make driver functional without CONFIG_PM_RUNTIME
  [media] exynos-gsc: Make runtime PM callbacks available for CONFIG_PM
  [media] exynos-gsc: Fixup system PM
  [media] exynos-gsc: Fixup clock management at -remove()
  [media] exynos-gsc: Do full clock gating at runtime PM suspend

 drivers/media/platform/exynos-gsc/gsc-core.c | 127 ---
 drivers/media/platform/exynos-gsc/gsc-core.h |   3 -
 2 files changed, 36 insertions(+), 94 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 7/7] [media] exynos-gsc: Do full clock gating at runtime PM suspend

2014-10-14 Thread Ulf Hansson
To potentially save more power in runtime PM suspend state, let's also
prepare/unprepare the clock from the runtime PM callbacks.

Signed-off-by: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index e48aefa..e90ba09 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1161,7 +1161,7 @@ static int gsc_runtime_resume(struct device *dev)
 
pr_debug(gsc%d: state: 0x%lx, gsc-id, gsc-state);
 
-   ret = clk_enable(gsc-clock);
+   ret = clk_prepare_enable(gsc-clock);
if (ret)
return ret;
 
@@ -1179,7 +1179,7 @@ static int gsc_runtime_suspend(struct device *dev)
 
ret = gsc_m2m_suspend(gsc);
if (!ret)
-   clk_disable(gsc-clock);
+   clk_disable_unprepare(gsc-clock);
 
pr_debug(gsc%d: state: 0x%lx, gsc-id, gsc-state);
return ret;
-- 
1.9.1

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


[PATCH 4/7] [media] exynos-gsc: Make runtime PM callbacks available for CONFIG_PM

2014-10-14 Thread Ulf Hansson
There are no need to set up the runtime PM callbacks unless they are
being used. Let's make them available for CONFIG_PM.

Signed-off-by: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index c3a050e..361a807 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1150,6 +1150,7 @@ static int gsc_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM
 static int gsc_runtime_resume(struct device *dev)
 {
struct gsc_dev *gsc = dev_get_drvdata(dev);
@@ -1180,6 +1181,7 @@ static int gsc_runtime_suspend(struct device *dev)
pr_debug(gsc%d: state: 0x%lx, gsc-id, gsc-state);
return ret;
 }
+#endif
 
 static int gsc_resume(struct device *dev)
 {
@@ -1221,8 +1223,7 @@ static int gsc_suspend(struct device *dev)
 static const struct dev_pm_ops gsc_pm_ops = {
.suspend= gsc_suspend,
.resume = gsc_resume,
-   .runtime_suspend= gsc_runtime_suspend,
-   .runtime_resume = gsc_runtime_resume,
+   SET_PM_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL)
 };
 
 static struct platform_driver gsc_driver = {
-- 
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 2/7] [media] exynos-gsc: Convert gsc_m2m_resume() from int to void

2014-10-14 Thread Ulf Hansson
Since gsc_m2m_resume() always returns 0, convert it into void instead.

Signed-off-by: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index 3fca4fd..13d0226 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1022,7 +1022,7 @@ static int gsc_m2m_suspend(struct gsc_dev *gsc)
return timeout == 0 ? -EAGAIN : 0;
 }
 
-static int gsc_m2m_resume(struct gsc_dev *gsc)
+static void gsc_m2m_resume(struct gsc_dev *gsc)
 {
struct gsc_ctx *ctx;
unsigned long flags;
@@ -1035,8 +1035,6 @@ static int gsc_m2m_resume(struct gsc_dev *gsc)
 
if (test_and_clear_bit(ST_M2M_SUSPENDED, gsc-state))
gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR);
-
-   return 0;
 }
 
 static int gsc_probe(struct platform_device *pdev)
@@ -1165,8 +1163,9 @@ static int gsc_runtime_resume(struct device *dev)
 
gsc_hw_set_sw_reset(gsc);
gsc_wait_reset(gsc);
+   gsc_m2m_resume(gsc);
 
-   return gsc_m2m_resume(gsc);
+   return 0;
 }
 
 static int gsc_runtime_suspend(struct device *dev)
-- 
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 5/7] [media] exynos-gsc: Fixup system PM

2014-10-14 Thread Ulf Hansson
We had several issues with the system PM support.
1) It were depending on CONFIG_PM_RUNTIME.
2) It unnecessarily tracked the suspend state in a flag.
3) If userspace through sysfs prevents runtime PM operations, could
cause the device to stay in low power after a system PM resume, which
is not reflected properly.

Solve all the above issues by using pm_runtime_force_suspend|resume() as
the system PM callbacks.

Signed-off-by: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 41 ++--
 drivers/media/platform/exynos-gsc/gsc-core.h |  3 --
 2 files changed, 2 insertions(+), 42 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index 361a807..1b9f3d7 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1183,46 +1183,9 @@ static int gsc_runtime_suspend(struct device *dev)
 }
 #endif
 
-static int gsc_resume(struct device *dev)
-{
-   struct gsc_dev *gsc = dev_get_drvdata(dev);
-   unsigned long flags;
-
-   pr_debug(gsc%d: state: 0x%lx, gsc-id, gsc-state);
-
-   /* Do not resume if the device was idle before system suspend */
-   spin_lock_irqsave(gsc-slock, flags);
-   if (!test_and_clear_bit(ST_SUSPEND, gsc-state) ||
-   !gsc_m2m_opened(gsc)) {
-   spin_unlock_irqrestore(gsc-slock, flags);
-   return 0;
-   }
-   spin_unlock_irqrestore(gsc-slock, flags);
-
-   if (!pm_runtime_suspended(dev))
-   return gsc_runtime_resume(dev);
-
-   return 0;
-}
-
-static int gsc_suspend(struct device *dev)
-{
-   struct gsc_dev *gsc = dev_get_drvdata(dev);
-
-   pr_debug(gsc%d: state: 0x%lx, gsc-id, gsc-state);
-
-   if (test_and_set_bit(ST_SUSPEND, gsc-state))
-   return 0;
-
-   if (!pm_runtime_suspended(dev))
-   return gsc_runtime_suspend(dev);
-
-   return 0;
-}
-
 static const struct dev_pm_ops gsc_pm_ops = {
-   .suspend= gsc_suspend,
-   .resume = gsc_resume,
+   SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+   pm_runtime_force_resume)
SET_PM_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL)
 };
 
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.h 
b/drivers/media/platform/exynos-gsc/gsc-core.h
index ef0a656..2dbaa20 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.h
+++ b/drivers/media/platform/exynos-gsc/gsc-core.h
@@ -48,9 +48,6 @@
 #defineGSC_CTX_ABORT   (1  7)
 
 enum gsc_dev_flags {
-   /* for global */
-   ST_SUSPEND,
-
/* for m2m node */
ST_M2M_OPEN,
ST_M2M_RUN,
-- 
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 3/7] [media] exynos-gsc: Make driver functional without CONFIG_PM_RUNTIME

2014-10-14 Thread Ulf Hansson
The driver depended on CONFIG_PM_RUNTIME to be functional, which isn't
necessary.

The solution to the above is to enable all runtime PM resourses during
probe and update the device's runtime PM status to active.

Since driver core invokes pm_request_idle() after -probe(), unused gsc
devices will be runtime PM suspended and thus we will still benefit
from using CONFIG_PM_RUNTIME.

Signed-off-by: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index 13d0226..c3a050e 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1085,7 +1085,7 @@ static int gsc_probe(struct platform_device *pdev)
return PTR_ERR(gsc-clock);
}
 
-   ret = clk_prepare(gsc-clock);
+   ret = clk_prepare_enable(gsc-clock);
if (ret) {
dev_err(gsc-pdev-dev, clock prepare failed for clock: %s\n,
GSC_CLOCK_GATE_NAME);
@@ -1108,30 +1108,30 @@ static int gsc_probe(struct platform_device *pdev)
goto err_v4l2;
 
platform_set_drvdata(pdev, gsc);
-   pm_runtime_enable(dev);
-   ret = pm_runtime_get_sync(pdev-dev);
-   if (ret  0)
-   goto err_m2m;
+
+   gsc_hw_set_sw_reset(gsc);
+   gsc_wait_reset(gsc);
+   gsc_m2m_resume(gsc);
 
/* Initialize continious memory allocator */
gsc-alloc_ctx = vb2_dma_contig_init_ctx(dev);
if (IS_ERR(gsc-alloc_ctx)) {
ret = PTR_ERR(gsc-alloc_ctx);
-   goto err_pm;
+   goto err_m2m;
}
 
dev_dbg(dev, gsc-%d registered successfully\n, gsc-id);
 
-   pm_runtime_put(dev);
+   pm_runtime_set_active(dev);
+   pm_runtime_enable(dev);
+
return 0;
-err_pm:
-   pm_runtime_put(dev);
 err_m2m:
gsc_unregister_m2m_device(gsc);
 err_v4l2:
v4l2_device_unregister(gsc-v4l2_dev);
 err_clk:
-   clk_unprepare(gsc-clock);
+   clk_disable_unprepare(gsc-clock);
return ret;
 }
 
-- 
1.9.1

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


[PATCH 6/7] [media] exynos-gsc: Fixup clock management at -remove()

2014-10-14 Thread Ulf Hansson
We want to make sure that the clock is fully gated after -remove(). To
do this, we need to bring the device into full power and not only
unprepare the clock, but also disable it.

Signed-off-by: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index 1b9f3d7..e48aefa 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1139,12 +1139,15 @@ static int gsc_remove(struct platform_device *pdev)
 {
struct gsc_dev *gsc = platform_get_drvdata(pdev);
 
+   pm_runtime_get_sync(pdev-dev);
+
gsc_unregister_m2m_device(gsc);
v4l2_device_unregister(gsc-v4l2_dev);
-
vb2_dma_contig_cleanup_ctx(gsc-alloc_ctx);
+   clk_disable_unprepare(gsc-clock);
+
pm_runtime_disable(pdev-dev);
-   clk_unprepare(gsc-clock);
+   pm_runtime_put_noidle(pdev-dev);
 
dev_dbg(pdev-dev, %s driver unloaded\n, pdev-name);
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 1/7] [media] exynos-gsc: Simplify clock management

2014-10-14 Thread Ulf Hansson
Instead of having separate functions that fecthes, prepares and
unprepares the clock, let's encapsulate this code into -probe().

This makes error handling easier and decreases the lines of code.

Signed-off-by: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 49 
 1 file changed, 14 insertions(+), 35 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index b4c9f1d..3fca4fd 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1000,36 +1000,6 @@ static void *gsc_get_drv_data(struct platform_device 
*pdev)
return driver_data;
 }
 
-static void gsc_clk_put(struct gsc_dev *gsc)
-{
-   if (!IS_ERR(gsc-clock))
-   clk_unprepare(gsc-clock);
-}
-
-static int gsc_clk_get(struct gsc_dev *gsc)
-{
-   int ret;
-
-   dev_dbg(gsc-pdev-dev, gsc_clk_get Called\n);
-
-   gsc-clock = devm_clk_get(gsc-pdev-dev, GSC_CLOCK_GATE_NAME);
-   if (IS_ERR(gsc-clock)) {
-   dev_err(gsc-pdev-dev, failed to get clock~~~: %s\n,
-   GSC_CLOCK_GATE_NAME);
-   return PTR_ERR(gsc-clock);
-   }
-
-   ret = clk_prepare(gsc-clock);
-   if (ret  0) {
-   dev_err(gsc-pdev-dev, clock prepare failed for clock: %s\n,
-   GSC_CLOCK_GATE_NAME);
-   gsc-clock = ERR_PTR(-EINVAL);
-   return ret;
-   }
-
-   return 0;
-}
-
 static int gsc_m2m_suspend(struct gsc_dev *gsc)
 {
unsigned long flags;
@@ -1098,7 +1068,6 @@ static int gsc_probe(struct platform_device *pdev)
init_waitqueue_head(gsc-irq_queue);
spin_lock_init(gsc-slock);
mutex_init(gsc-lock);
-   gsc-clock = ERR_PTR(-EINVAL);
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
gsc-regs = devm_ioremap_resource(dev, res);
@@ -,9 +1080,19 @@ static int gsc_probe(struct platform_device *pdev)
return -ENXIO;
}
 
-   ret = gsc_clk_get(gsc);
-   if (ret)
+   gsc-clock = devm_clk_get(dev, GSC_CLOCK_GATE_NAME);
+   if (IS_ERR(gsc-clock)) {
+   dev_err(dev, failed to get clock~~~: %s\n,
+   GSC_CLOCK_GATE_NAME);
+   return PTR_ERR(gsc-clock);
+   }
+
+   ret = clk_prepare(gsc-clock);
+   if (ret) {
+   dev_err(gsc-pdev-dev, clock prepare failed for clock: %s\n,
+   GSC_CLOCK_GATE_NAME);
return ret;
+   }
 
ret = devm_request_irq(dev, res-start, gsc_irq_handler,
0, pdev-name, gsc);
@@ -1154,7 +1133,7 @@ err_m2m:
 err_v4l2:
v4l2_device_unregister(gsc-v4l2_dev);
 err_clk:
-   gsc_clk_put(gsc);
+   clk_unprepare(gsc-clock);
return ret;
 }
 
@@ -1167,7 +1146,7 @@ static int gsc_remove(struct platform_device *pdev)
 
vb2_dma_contig_cleanup_ctx(gsc-alloc_ctx);
pm_runtime_disable(pdev-dev);
-   gsc_clk_put(gsc);
+   clk_unprepare(gsc-clock);
 
dev_dbg(pdev-dev, %s driver unloaded\n, pdev-name);
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 1/2] media: soc_camera: rcar_vin: Add r8a7794 device support

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---
 drivers/media/platform/soc_camera/rcar_vin.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index bf3588f..224604d0 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1887,6 +1887,7 @@ MODULE_DEVICE_TABLE(of, rcar_vin_of_table);
 #endif
 
 static struct platform_device_id rcar_vin_id_table[] = {
+   { r8a7794-vin,  RCAR_GEN2 },
{ r8a7791-vin,  RCAR_GEN2 },
{ r8a7790-vin,  RCAR_GEN2 },
{ r8a7779-vin,  RCAR_H1 },
-- 
1.9.1

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


[PATCH 0/2] media: soc_camera: rcar_vin: Add r8a7794, r8a7793 device support

2014-10-14 Thread Yoshihiro Kaneko
This series is against master branch of linuxtv.org/media_tree.git.

Koji Matsuoka (2):
  media: soc_camera: rcar_vin: Add r8a7794 device support
  media: soc_camera: rcar_vin: Add r8a7793 device support

 drivers/media/platform/soc_camera/rcar_vin.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
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 2/2] media: soc_camera: rcar_vin: Add r8a7793 device support

2014-10-14 Thread Yoshihiro Kaneko
From: Koji Matsuoka koji.matsuoka...@renesas.com

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---
 drivers/media/platform/soc_camera/rcar_vin.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 224604d0..55f99aa 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1888,6 +1888,7 @@ MODULE_DEVICE_TABLE(of, rcar_vin_of_table);
 
 static struct platform_device_id rcar_vin_id_table[] = {
{ r8a7794-vin,  RCAR_GEN2 },
+   { r8a7793-vin,  RCAR_GEN2 },
{ r8a7791-vin,  RCAR_GEN2 },
{ r8a7790-vin,  RCAR_GEN2 },
{ r8a7779-vin,  RCAR_H1 },
-- 
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] s5p-jpeg: Only build suspend/resume for PM

2014-10-14 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com

If power management is disabled these function become unused, so there
is no reason to build them. This fixes a couple of build warnings when
PM(_SLEEP,_RUNTIME) is not enabled.

Acked-by: Geert Uytterhoeven ge...@linux-m68k.org
Signed-off-by: Thierry Reding tred...@nvidia.com
---
Changes in v2:
- add #endif comment for readability
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index e525a7c8d885..ec7339e84b57 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -2632,6 +2632,7 @@ static int s5p_jpeg_remove(struct platform_device *pdev)
return 0;
 }
 
+#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
 static int s5p_jpeg_runtime_suspend(struct device *dev)
 {
struct s5p_jpeg *jpeg = dev_get_drvdata(dev);
@@ -2681,7 +2682,9 @@ static int s5p_jpeg_runtime_resume(struct device *dev)
 
return 0;
 }
+#endif /* CONFIG_PM_RUNTIME || CONFIG_PM_SLEEP */
 
+#ifdef CONFIG_PM_SLEEP
 static int s5p_jpeg_suspend(struct device *dev)
 {
if (pm_runtime_suspended(dev))
@@ -2697,6 +2700,7 @@ static int s5p_jpeg_resume(struct device *dev)
 
return s5p_jpeg_runtime_resume(dev);
 }
+#endif
 
 static const struct dev_pm_ops s5p_jpeg_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(s5p_jpeg_suspend, s5p_jpeg_resume)
-- 
2.1.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 v2] [media] s5p-fimc: Only build suspend/resume for PM

2014-10-14 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com

If power management is disabled these functions become unused, so there
is no reason to build them. This fixes a couple of build warnings when
PM(_SLEEP,_RUNTIME) is not enabled.

Signed-off-by: Thierry Reding tred...@nvidia.com
---
Changes in v2:
- add #endif comment for readability

 drivers/media/platform/exynos4-is/fimc-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/exynos4-is/fimc-core.c 
b/drivers/media/platform/exynos4-is/fimc-core.c
index b70fd996d794..aee92d908e49 100644
--- a/drivers/media/platform/exynos4-is/fimc-core.c
+++ b/drivers/media/platform/exynos4-is/fimc-core.c
@@ -832,6 +832,7 @@ err:
return -ENXIO;
 }
 
+#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
 static int fimc_m2m_suspend(struct fimc_dev *fimc)
 {
unsigned long flags;
@@ -870,6 +871,7 @@ static int fimc_m2m_resume(struct fimc_dev *fimc)
 
return 0;
 }
+#endif /* CONFIG_PM_RUNTIME || CONFIG_PM_SLEEP */
 
 static const struct of_device_id fimc_of_match[];
 
-- 
2.1.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


Re: Hauppauge HVR-2200 (saa7164) problems (on Linux Mint 17)

2014-10-14 Thread Steven Toth
Please keep the discussion on the mailing list at all times.

 I couldn't figure out how to apply the patch using the patch file, so I
 manually edited the file (drivers/media/pci/saa7164/saa7164-fw.c), but I
 kept getting the image corrupt message.

That's probably the issue. Assuming you have the patch applied and are
using the firmware it will work for you.

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.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


Re: [PATCH 3/3] media: soc_camera: rcar_vin: Add NV16 horizontal scaling-up support

2014-10-14 Thread Sergei Shtylyov

Hello.

On 10/14/2014 10:26 AM, Yoshihiro Kaneko wrote:


From: Koji Matsuoka koji.matsuoka...@renesas.com



The scaling function had been forbidden for the capture format of
NV16 until now. With this patch, a horizontal scaling-up function
is supported to the capture format of NV16. a vertical scaling-up
by the capture format of NV16 is forbidden for the H/W specification.


   s/for/by/?


Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
---
  drivers/media/platform/soc_camera/rcar_vin.c | 19 +++
  1 file changed, 15 insertions(+), 4 deletions(-)



diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 00bc98d..bf3588f 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c

[...]

@@ -1622,9 +1622,19 @@ static int rcar_vin_set_fmt(struct soc_camera_device 
*icd,
if (priv-error_flag == false)
priv-error_flag = true;
else {
-   if ((pixfmt == V4L2_PIX_FMT_NV16)  (pix-width  0x1F)) {
-   dev_err(icd-parent, Specified width error in NV16 
format.\n);
-   return -EINVAL;
+   if (pixfmt == V4L2_PIX_FMT_NV16) {
+   if (pix-width  0x1F) {
+   dev_err(icd-parent,
+   Specified width error in NV16 format. 


   You should indent the string more to the right, preferrably starting it 
under 'icd'.



+   Please specify the multiple of 32.\n);


   Do not break the string like this. scripts/checkpatch.pl has been taught 
to not complain about long strings.



+   return -EINVAL;
+   }
+   if (pix-height != cam-height) {
+   dev_err(icd-parent,
+   Vertical scaling-up error in NV16 format. 
+   Please specify input height size.\n);


   Same here. Not breaking the lines helps to find the error messages in the 
code.


[...]

WBR, Sergei

--
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: [Linaro-mm-sig] [RFC 0/4] dma-buf Constraints-Enabled Allocation helpers

2014-10-14 Thread Sumit Semwal
Hi Laura,

On 13 October 2014 13:42, Laura Abbott lau...@codeaurora.org wrote:
 On 10/10/2014 1:07 PM, Sumit Semwal wrote:

 Hi,

 Why:
 
   While sharing buffers using dma-buf, currently there's no mechanism to
 let
 devices share their memory access constraints with each other to allow for
 delayed allocation of backing storage.

 This RFC attempts to introduce the idea of memory constraints of a device,
 and how these constraints can be shared and used to help allocate buffers
 that
 can satisfy requirements of all devices attached to a particular dma-buf.

 How:
 
   A constraints_mask is added to dma_parms of the device, and at the time
 of
 each device attachment to a dma-buf, the dma-buf uses this
 constraints_mask
 to calculate the access_mask for the dma-buf.

 Allocators can be defined for each of these constraints_masks, and then
 helper
 functions can be used to allocate the backing storage from the matching
 allocator satisfying the constraints of all devices interested.

 A new miscdevice, /dev/cenalloc [1] is created, which acts as the dma-buf
 exporter to make this transparent to the devices.

 More details in the patch description of cenalloc: Constraint-Enabled
 Allocation helpers for dma-buf.


 At present, the constraint_mask is only a bitmask, but it should be
 possible to
 change it to a struct and adapt the constraint_mask calculation
 accordingly,
 based on discussion.


 Important requirement:
 ==
   Of course, delayed allocation can only work if all participating devices
 will wait for other devices to have 'attached' before mapping the buffer
 for the first time.

 As of now, users of dma-buf(drm prime, v4l2 etc) call the attach() and
 then
 map_attachment() almost immediately after it. This would need to be
 changed if
 they were to benefit from constraints.


 What 'cenalloc' is not:
 ===
 - not 'general' allocator helpers - useful only for constraints-enabled
devices that share buffers with others using dma-buf.
 - not a replacement for existing allocation mechanisms inside various
subsystems; merely a possible alternative.
 - no page-migration - it would be very complementary to the delayed
 allocation
 suggested here.

 TODOs:
 ==
 - demonstration test cases
 - vma helpers for allocators
 - more sample allocators
 - userspace ioctl (It should be a simple one, and we have one ready, but
 wanted
 to agree on the kernel side of things first)



 I'm interested to see the userspace ioctl. The mask based approach of
 Ion does not scale well to a userspace ABI so I'm curious if cenalloc
 does better.
Apologies for the delay in response.
Since with cenalloc, the decision of 'which pool to allocate from' is
not with the userspace, but is calculated based on the devices that
attach, the userspace ABI should be just a simple xxx_create, which
returns an fd that'd be the dma-buf fd. That will allow easy sharing
with other dma-buf importers via standard dma-buf API.

 Thanks,
 Laura

 --
 Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
 hosted by The Linux Foundation



-- 
Thanks and regards,

Sumit Semwal
Kernel Team Lead - Linaro Mobile Group
Linaro.org │ Open source software for ARM SoCs
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 2/4] cenalloc: Constraint-Enabled Allocation helpers for dma-buf

2014-10-14 Thread Sumit Semwal
Hi Greg, Daniel!

On 12 October 2014 00:10, Daniel Vetter dan...@ffwll.ch wrote:
 On Fri, Oct 10, 2014 at 04:09:00PM -0700, Greg Kroah-Hartman wrote:
 On Sat, Oct 11, 2014 at 01:37:56AM +0530, Sumit Semwal wrote:
  Devices sharing buffers using dma-buf could benefit from sharing their
  constraints via struct device, and dma-buf framework would manage the
  common constraints for all attached devices per buffer.
 
  With that information, we could have a 'generic' allocator helper in
  the form of a central dma-buf exporter, which can create dma-bufs, and
  allocate backing storage at the time of first call to
  dma_buf_map_attachment.
 
  This allocation would utilise the constraint-mask by matching it to
  the right allocator from a pool of allocators, and then allocating
  buffer backing storage from this allocator.
 
  The pool of allocators could be platform-dependent, allowing for
  platforms to hide the specifics of these allocators from the devices
  that access the dma-buf buffers.
 
  A sample sequence could be:
  - get handle to cenalloc_device,
  - create a dmabuf using cenalloc_buffer_create;
  - use this dmabuf to attach each device, which has its constraints
 set in the constraints mask (dev-dma_params-access_constraints_mask)
- at each dma_buf_attach() call, dma-buf will check to see if the 
  constraint
  mask for the device requesting attachment is compatible with the 
  constraints
  of devices already attached to the dma-buf; returns an error if it 
  isn't.
  - after all devices have attached, the first call to 
  dma_buf_map_attachment()
will allocate the backing storage for the buffer.
  - follow the dma-buf api for map / unmap etc usage.
  - detach all attachments,
  - call cenalloc_buffer_free to free the buffer if refcount reaches zero;
 
  ** IMPORTANT**
  This mechanism of delayed allocation based on constraint-enablement will 
  work
  *ONLY IF* the first map_attachment() call is made AFTER all attach() calls 
  are
  done.
 
  Signed-off-by: Sumit Semwal sumit.sem...@linaro.org
  Cc: linux-ker...@vger.kernel.org
  Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
  Cc: linux-media@vger.kernel.org
  Cc: dri-de...@lists.freedesktop.org
  Cc: linaro-mm-...@lists.linaro.org
  ---
   MAINTAINERS  |   1 +
   drivers/cenalloc/cenalloc.c  | 597 
  +++
   drivers/cenalloc/cenalloc.h  |  99 +++
   drivers/cenalloc/cenalloc_priv.h | 188 
   4 files changed, 885 insertions(+)
   create mode 100644 drivers/cenalloc/cenalloc.c
   create mode 100644 drivers/cenalloc/cenalloc.h
   create mode 100644 drivers/cenalloc/cenalloc_priv.h
 
  diff --git a/MAINTAINERS b/MAINTAINERS
  index 40d4796..e88ac81 100644
  --- a/MAINTAINERS
  +++ b/MAINTAINERS
  @@ -3039,6 +3039,7 @@ L:linux-media@vger.kernel.org
   L: dri-de...@lists.freedesktop.org
   L: linaro-mm-...@lists.linaro.org
   F: drivers/dma-buf/
  +F: drivers/cenalloc/
   F: include/linux/dma-buf*
   F: include/linux/reservation.h
   F: include/linux/*fence.h
  diff --git a/drivers/cenalloc/cenalloc.c b/drivers/cenalloc/cenalloc.c
  new file mode 100644
  index 000..f278056
  --- /dev/null
  +++ b/drivers/cenalloc/cenalloc.c
  @@ -0,0 +1,597 @@
  +/*
  + * Allocator helper framework for constraints-aware dma-buf backing 
  storage
  + * allocation.
  + * This allows constraint-sharing devices to deferred-allocate buffers 
  shared
  + * via dma-buf.
  + *
  + * Copyright(C) 2014 Linaro Limited. All rights reserved.
  + * Author: Sumit Semwal sumit.sem...@linaro.org
  + *
  + * Structure for management of clients, buffers etc heavily derived from
  + * Android's ION framework.

 Does that mean we can drop ION after this gets merged?

 Yeah, I hope so. Not sure whetether this hope is shared by google android
 people ...
Apologies for the delay in response; was travelling for LPC and so
couldn't respond.

Yes, that is certainly the hope, but this is the first-step RFC which
would need a few more things before ION can be replaced completely.

 /me dreams

 I guess we can collectively dream about this next week at plumbers ;-)
 I'll try to squeeze in some light review of Sumit's patches between
 conference travels ...

 Cheers, Daniel
 --
 Daniel Vetter
 Software Engineer, Intel Corporation
 +41 (0) 79 365 57 48 - http://blog.ffwll.ch



-- 
Thanks and regards,

Sumit Semwal
Kernel Team Lead - Linaro Mobile Group
Linaro.org │ Open source software for ARM SoCs
--
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: [Linaro-mm-sig] [RFC 2/4] cenalloc: Constraint-Enabled Allocation helpers for dma-buf

2014-10-14 Thread Sumit Semwal
Hi Laura,


On 13 October 2014 14:05, Laura Abbott lau...@codeaurora.org wrote:
 On 10/10/2014 1:07 PM, Sumit Semwal wrote:

 Devices sharing buffers using dma-buf could benefit from sharing their
 constraints via struct device, and dma-buf framework would manage the
 common constraints for all attached devices per buffer.

 With that information, we could have a 'generic' allocator helper in
 the form of a central dma-buf exporter, which can create dma-bufs, and
 allocate backing storage at the time of first call to
 dma_buf_map_attachment.

 This allocation would utilise the constraint-mask by matching it to
 the right allocator from a pool of allocators, and then allocating
 buffer backing storage from this allocator.

 The pool of allocators could be platform-dependent, allowing for
 platforms to hide the specifics of these allocators from the devices
 that access the dma-buf buffers.

 A sample sequence could be:
 - get handle to cenalloc_device,
 - create a dmabuf using cenalloc_buffer_create;
 - use this dmabuf to attach each device, which has its constraints
 set in the constraints mask (dev-dma_params-access_constraints_mask)
- at each dma_buf_attach() call, dma-buf will check to see if the
 constraint
  mask for the device requesting attachment is compatible with the
 constraints
  of devices already attached to the dma-buf; returns an error if it
 isn't.
 - after all devices have attached, the first call to
 dma_buf_map_attachment()
will allocate the backing storage for the buffer.
 - follow the dma-buf api for map / unmap etc usage.
 - detach all attachments,
 - call cenalloc_buffer_free to free the buffer if refcount reaches zero;

 ** IMPORTANT**
 This mechanism of delayed allocation based on constraint-enablement will
 work
 *ONLY IF* the first map_attachment() call is made AFTER all attach() calls
 are
 done.


 My first instinct is 'I wonder which drivers will call map_attachment at
 the wrong time and screw things up'. Are there any plans for
 synchronization and/or debugging output to catch drivers violating this
 requirement?

Well, of course you're right - at the moment, no mechanism to do so.
That will certainly be the next step - we could discuss it sometime
this week at LPC to see what makes better sense.

 [...]

 +int cenalloc_phys(struct dma_buf *dmabuf,
 +phys_addr_t *addr, size_t *len)
 +{
 +   struct cenalloc_buffer *buffer;
 +   int ret;
 +
 +   if (is_cenalloc_buffer(dmabuf))
 +   buffer = (struct cenalloc_buffer *)dmabuf-priv;
 +   else
 +   return -EINVAL;
 +
 +   if (!buffer-allocator-ops-phys) {
 +   pr_err(%s: cenalloc_phys is not implemented by this
 allocator.\n,
 +  __func__);
 +   return -ENODEV;
 +   }
 +   mutex_lock(buffer-lock);
 +   ret = buffer-allocator-ops-phys(buffer-allocator, buffer,
 addr,
 +   len);
 +   mutex_lock(buffer-lock);
 +   return ret;
 +}
 +EXPORT_SYMBOL_GPL(cenalloc_phys);
 +


 The .phys operation makes it difficult to have drivers which can
 handle both contiguous and non contiguous memory (too much special
 casing). Any chance we could drop this API and just have drivers
 treat an sg_table with 1 entry as contiguous memory?
I am not sure I understand how having a .phys makes it more difficult
- and also, for cases where you're sharing buffers between CPU and a
co-processor like DSP, my understanding is that we'd need an
equivalent of a phys address.


 Thanks,
 Laura

 --
 Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
 hosted by The Linux Foundation



-- 
Thanks and regards,

Sumit Semwal
Kernel Team Lead - Linaro Mobile Group
Linaro.org │ Open source software for ARM SoCs
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/6] media: add media token device resource framework

2014-10-14 Thread Shuah Khan
Add media token device resource framework to allow sharing
resources such as tuner, dma, audio etc. across media drivers
and non-media sound drivers that control media hardware. The
Media token resource is created at the main struct device that
is common to all drivers that claim various pieces of the main
media device, which allows them to find the resource using the
main struct device. As an example, digital, analog, and
snd-usb-audio drivers can use the media token resource API
using the main struct device for the interface the media device
is attached to.

A shared media tokens resource is created using devres framework
for drivers to find and lock/unlock. Creating a shared devres
helps avoid creating data structure dependencies between drivers.
This media token resource contains media token for tuner, and
audio. When tuner token is requested, audio token is issued.
Subsequent token (for tuner and audio) gets from the same task
and task in the same tgid succeed. This allows applications that
make multiple v4l2 ioctls to work with the first call acquiring
the token and applications that create separate threads to handle
video and audio functions.

Signed-off-by: Shuah Khan shua...@osg.samsung.com
---
 MAINTAINERS  |2 +
 include/linux/media_tknres.h |   50 +
 lib/Makefile |2 +
 lib/media_tknres.c   |  237 ++
 4 files changed, 291 insertions(+)
 create mode 100644 include/linux/media_tknres.h
 create mode 100644 lib/media_tknres.c

diff --git a/MAINTAINERS b/MAINTAINERS
index e80a275..9216179 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5864,6 +5864,8 @@ F:include/uapi/linux/v4l2-*
 F: include/uapi/linux/meye.h
 F: include/uapi/linux/ivtv*
 F: include/uapi/linux/uvcvideo.h
+F: include/linux/media_tknres.h
+F: lib/media_tknres.c
 
 MEDIAVISION PRO MOVIE STUDIO DRIVER
 M: Hans Verkuil hverk...@xs4all.nl
diff --git a/include/linux/media_tknres.h b/include/linux/media_tknres.h
new file mode 100644
index 000..6d37327
--- /dev/null
+++ b/include/linux/media_tknres.h
@@ -0,0 +1,50 @@
+/*
+ * media_tknres.h - managed media token resource
+ *
+ * Copyright (c) 2014 Shuah Khan shua...@osg.samsung.com
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This file is released under the GPLv2.
+ */
+#ifndef __LINUX_MEDIA_TOKEN_H
+#define __LINUX_MEDIA_TOKEN_H
+
+struct device;
+
+#if defined(CONFIG_MEDIA_SUPPORT)
+extern int media_tknres_create(struct device *dev);
+extern int media_tknres_destroy(struct device *dev);
+
+extern int media_get_tuner_tkn(struct device *dev);
+extern int media_put_tuner_tkn(struct device *dev);
+
+extern int media_get_audio_tkn(struct device *dev);
+extern int media_put_audio_tkn(struct device *dev);
+#else
+static inline int media_tknres_create(struct device *dev)
+{
+   return 0;
+}
+static inline int media_tknres_destroy(struct device *dev)
+{
+   return 0;
+}
+static inline int media_get_tuner_tkn(struct device *dev)
+{
+   return 0;
+}
+static inline int media_put_tuner_tkn(struct device *dev)
+{
+   return 0;
+}
+static int media_get_audio_tkn(struct device *dev)
+{
+   return 0;
+}
+static int media_put_audio_tkn(struct device *dev)
+{
+   return 0;
+}
+#endif
+
+#endif /* __LINUX_MEDIA_TOKEN_H */
diff --git a/lib/Makefile b/lib/Makefile
index d6b4bc4..6f21695 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -139,6 +139,8 @@ obj-$(CONFIG_DQL) += dynamic_queue_limits.o
 
 obj-$(CONFIG_GLOB) += glob.o
 
+obj-$(CONFIG_MEDIA_SUPPORT) += media_tknres.o
+
 obj-$(CONFIG_MPILIB) += mpi/
 obj-$(CONFIG_SIGNATURE) += digsig.o
 
diff --git a/lib/media_tknres.c b/lib/media_tknres.c
new file mode 100644
index 000..e0a36cb
--- /dev/null
+++ b/lib/media_tknres.c
@@ -0,0 +1,237 @@
+/*
+ * media_tknres.c - managed media token resource
+ *
+ * Copyright (c) 2014 Shuah Khan shua...@osg.samsung.com
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This file is released under the GPLv2.
+ */
+/*
+ * Media devices often have hardware resources that are shared
+ * across several functions. For instance, TV tuner cards often
+ * have MUXes, converters, radios, tuners, etc. that are shared
+ * across various functions. However, v4l2, alsa, DVB, usbfs, and
+ * all other drivers have no knowledge of what resources are
+ * shared. For example, users can't access DVB and alsa at the same
+ * time, or the DVB and V4L analog API at the same time, since many
+ * only have one converter that can be in either analog or digital
+ * mode. Accessing and/or changing mode of a converter while it is
+ * in use by another function results in video stream error.
+ *
+ * A shared media tokens resource is created using devres framework
+ * for drivers to find and lock/unlock. Creating a shared devres
+ * helps avoid creating data structure dependencies between drivers.
+ * This media token resource contains media token for tuner, and
+ * audio. 

[PATCH v2 5/6] sound/usb: pcm changes to use media token api

2014-10-14 Thread Shuah Khan
Change snd_usb_capture_ops trigger to hold audio token prior
starting endpoints for SNDRV_PCM_TRIGGER_START request and
release after stopping endpoints for SNDRV_PCM_TRIGGER_STOP
request. Audio token is released from snd_usb_capture_ops
close interface to cover the case where an application exits
without stopping capture. Audio token get request will succeed
if it is free or when a media application with the same task
pid or task gid makes the request. This covers the cases when
a media application first hold the tuner nd audio token and
then requests SNDRV_PCM_TRIGGER_START either from the same
thread or a another thread in the same process group.

Signed-off-by: Shuah Khan shua...@osg.samsung.com
---
 sound/usb/pcm.c |9 +
 1 file changed, 9 insertions(+)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index c62a165..d23abeb 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -21,6 +21,7 @@
 #include linux/usb.h
 #include linux/usb/audio.h
 #include linux/usb/audio-v2.h
+#include linux/media_tknres.h
 
 #include sound/core.h
 #include sound/pcm.h
@@ -1220,6 +1221,7 @@ static int snd_usb_pcm_close(struct snd_pcm_substream 
*substream, int direction)
 
subs-pcm_substream = NULL;
snd_usb_autosuspend(subs-stream-chip);
+   media_put_audio_tkn(subs-dev-dev);
 
return 0;
 }
@@ -1573,6 +1575,12 @@ static int snd_usb_substream_capture_trigger(struct 
snd_pcm_substream *substream
 
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
+   err = media_get_audio_tkn(subs-dev-dev);
+   if (err == -EBUSY) {
+   dev_info(subs-dev-dev, %s device is busy\n,
+   __func__);
+   return err;
+   }
err = start_endpoints(subs, false);
if (err  0)
return err;
@@ -1583,6 +1591,7 @@ static int snd_usb_substream_capture_trigger(struct 
snd_pcm_substream *substream
case SNDRV_PCM_TRIGGER_STOP:
stop_endpoints(subs, false);
subs-running = 0;
+   media_put_audio_tkn(subs-dev-dev);
return 0;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
subs-data_endpoint-retire_data_urb = NULL;
-- 
1.7.10.4

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


[PATCH v2 6/6] media: au0828-core changes to create and destroy media

2014-10-14 Thread Shuah Khan
Changed au0828-core to create media token resource in its
usb_probe() and destroy it from usb_disconnect() interfaces.
It creates the resource on the main struct device which is
the parent device for the interface usb device. This is the
main struct device that is common for all the drivers that
control the media device, including the non-media sound
drivers.

Signed-off-by: Shuah Khan shua...@osg.samsung.com
---
 drivers/media/usb/au0828/au0828-core.c |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/media/usb/au0828/au0828-core.c 
b/drivers/media/usb/au0828/au0828-core.c
index bc06480..189e435 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -26,6 +26,7 @@
 #include linux/videodev2.h
 #include media/v4l2-common.h
 #include linux/mutex.h
+#include linux/media_tknres.h
 
 /*
  * 1 = General debug messages
@@ -127,6 +128,17 @@ static int recv_control_msg(struct au0828_dev *dev, u16 
request, u32 value,
return status;
 }
 
+/* interfaces to create and destroy media tknres */
+static int au0828_create_media_tknres(struct au0828_dev *dev)
+{
+   return media_tknres_create(dev-usbdev-dev);
+}
+
+static int au0828_destroy_media_tknres(struct au0828_dev *dev)
+{
+   return media_tknres_destroy(dev-usbdev-dev);
+}
+
 static void au0828_usb_release(struct au0828_dev *dev)
 {
/* I2C */
@@ -157,6 +169,8 @@ static void au0828_usb_disconnect(struct usb_interface 
*interface)
/* Digital TV */
au0828_dvb_unregister(dev);
 
+   au0828_destroy_media_tknres(dev);
+
usb_set_intfdata(interface, NULL);
mutex_lock(dev-mutex);
dev-usbdev = NULL;
@@ -215,6 +229,13 @@ static int au0828_usb_probe(struct usb_interface 
*interface,
dev-usbdev = usbdev;
dev-boardnr = id-driver_info;
 
+   /* create media token resource */
+   if (au0828_create_media_tknres(dev)) {
+   mutex_unlock(dev-lock);
+   kfree(dev);
+   return -ENOMEM;
+   }
+
 #ifdef CONFIG_VIDEO_AU0828_V4L2
dev-v4l2_dev.release = au0828_usb_v4l2_release;
 
@@ -223,6 +244,7 @@ static int au0828_usb_probe(struct usb_interface *interface,
if (retval) {
pr_err(%s() v4l2_device_register failed\n,
   __func__);
+   au0828_destroy_media_tknres(dev);
mutex_unlock(dev-lock);
kfree(dev);
return retval;
@@ -232,6 +254,7 @@ static int au0828_usb_probe(struct usb_interface *interface,
if (retval) {
pr_err(%s() v4l2_ctrl_handler_init failed\n,
   __func__);
+   au0828_destroy_media_tknres(dev);
mutex_unlock(dev-lock);
kfree(dev);
return retval;
-- 
1.7.10.4

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


[PATCH v2 4/6] media: dvb-core changes to use media token api

2014-10-14 Thread Shuah Khan
Change dvb_frontend_open() to hold tuner and audio tokens
when frontend is opened in R/W mode. Tuner and audio tokens
are released when frontend is released in frontend exit state.
This change allows main dvb application process to hold the
tokens for all threads it creates and be able to handle channel
change requests without releasing the tokens thereby risking
loosing tokens to another application.

Note that media_get_tuner_tkn() will do a get on audio token
and return with both tuner and audio tokens locked. When tuner
token released using media_put_tuner_tkn() , audio token is
released. Initialize dev_parent field struct video_device to
enable media tuner token lookup from v4l2-core.

Signed-off-by: Shuah Khan shua...@osg.samsung.com
---
 drivers/media/dvb-core/dvb_frontend.c |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index b8579ee..fcf5f08 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -41,6 +41,7 @@
 #include linux/jiffies.h
 #include linux/kthread.h
 #include asm/processor.h
+#include linux/media_tknres.h
 
 #include dvb_frontend.h
 #include dvbdev.h
@@ -2499,9 +2500,15 @@ static int dvb_frontend_open(struct inode *inode, struct 
file *file)
fepriv-tone = -1;
fepriv-voltage = -1;
 
+   /* get tuner and audio tokens - device is opened in R/W */
+   ret = media_get_tuner_tkn(fe-dvb-device);
+   if (ret == -EBUSY) {
+   dev_info(fe-dvb-device, dvb: Tuner is busy\n);
+   goto err2;
+   }
ret = dvb_frontend_start (fe);
if (ret)
-   goto err2;
+   goto start_err;
 
/*  empty event queue */
fepriv-events.eventr = fepriv-events.eventw = 0;
@@ -2511,6 +2518,8 @@ static int dvb_frontend_open(struct inode *inode, struct 
file *file)
mutex_unlock (adapter-mfe_lock);
return ret;
 
+start_err:
+   media_put_tuner_tkn(fe-dvb-device);
 err2:
dvb_generic_release(inode, file);
 err1:
@@ -2542,6 +2551,9 @@ static int dvb_frontend_release(struct inode *inode, 
struct file *file)
wake_up(fepriv-wait_queue);
if (fe-exit != DVB_FE_NO_EXIT)
wake_up(dvbdev-wait_queue);
+   /* release token if fe is in exit state */
+   else
+   media_put_tuner_tkn(fe-dvb-device);
if (fe-ops.ts_bus_ctrl)
fe-ops.ts_bus_ctrl(fe, 0);
}
-- 
1.7.10.4

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


[PATCH v2 3/6] media: au0828-video changes to use media token api

2014-10-14 Thread Shuah Khan
au0828-video driver uses vb1 api and needs changes to vb1
v4l2 interfaces that change the tuner status. In addition
to that this driver initializes the tuner from a some ioctls
that are query (read) tuner status. These ioctls are changed
to hold the tuner and audio tokens to avoid disrupting digital
stream if active. Further more, release v4l2_file_operations
powers down the tuner. The following changes are made:

read, poll v4l2_file_operations:
- hold tuner and audio tokens
- return leaving tuner and audio tokens locked

vb1 streamon:
- hold tuner and audio tokens
- return leaving tuner and audio tokens locked

release v4l2_file_operations:
- hold tuner and audio tokens before power down
  Don't call s_power when tuner is busy

Note that media_get_tuner_tkn() will do a get on audio token
and return with both tuner and audio tokens locked. When tuner
token released using media_put_tuner_tkn() , audio token is
released. Initialize dev_parent field struct video_device to
enable media tuner token lookup from v4l2-core.

Signed-off-by: Shuah Khan shua...@osg.samsung.com
---
 drivers/media/usb/au0828/au0828-video.c |   42 ++-
 1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/au0828/au0828-video.c 
b/drivers/media/usb/au0828/au0828-video.c
index 5f337b1..931e736 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -34,6 +34,7 @@
 #include linux/slab.h
 #include linux/init.h
 #include linux/device.h
+#include linux/media_tknres.h
 #include media/v4l2-common.h
 #include media/v4l2-ioctl.h
 #include media/v4l2-event.h
@@ -1085,10 +1086,21 @@ static int au0828_v4l2_close(struct file *filp)
 
au0828_uninit_isoc(dev);
 
+   ret = media_get_tuner_tkn(dev-usbdev-dev);
+   if (ret) {
+   dev_info(dev-usbdev-dev,
+   %s: Tuner is busy\n, __func__);
+   /* don't touch tuner - avoid putting to sleep step */
+   goto skip_s_power;
+   }
+   dev_info(dev-usbdev-dev, %s: Putting tuner to sleep\n,
+   __func__);
/* Save some power by putting tuner to sleep */
v4l2_device_call_all(dev-v4l2_dev, 0, core, s_power, 0);
-   dev-std_set_in_tuner_core = 0;
+   media_put_tuner_tkn(dev-usbdev-dev);
 
+skip_s_power:
+   dev-std_set_in_tuner_core = 0;
/* When close the device, set the usb intf0 into alt0 to free
   USB bandwidth */
ret = usb_set_interface(dev-usbdev, 0, 0);
@@ -1136,6 +1148,12 @@ static ssize_t au0828_v4l2_read(struct file *filp, char 
__user *buf,
if (rc  0)
return rc;
 
+   /* don't put the tuner token - this case is same as STREAMON */
+   rc = media_get_tuner_tkn(dev-usbdev-dev);
+   if (rc) {
+   dev_info(dev-usbdev-dev, %s: Tuner is busy\n, __func__);
+   return -EBUSY;
+   }
if (mutex_lock_interruptible(dev-lock))
return -ERESTARTSYS;
au0828_init_tuner(dev);
@@ -1177,6 +1195,12 @@ static unsigned int au0828_v4l2_poll(struct file *filp, 
poll_table *wait)
if (check_dev(dev)  0)
return POLLERR;
 
+   /* don't put the tuner token - this case is same as STREAMON */
+   res = media_get_tuner_tkn(dev-usbdev-dev);
+   if (res) {
+   dev_info(dev-usbdev-dev, %s: Tuner is busy\n, __func__);
+   return -EBUSY;
+   }
res = v4l2_ctrl_poll(filp, wait);
if (!(req_events  (POLLIN | POLLRDNORM)))
return res;
@@ -1548,10 +1572,17 @@ static int vidioc_g_tuner(struct file *file, void 
*priv, struct v4l2_tuner *t)
 {
struct au0828_fh *fh = priv;
struct au0828_dev *dev = fh-dev;
+   int ret;
 
if (t-index != 0)
return -EINVAL;
 
+   ret = media_get_tuner_tkn(dev-usbdev-dev);
+   if (ret) {
+   dev_info(dev-usbdev-dev, %s: Tuner is busy\n, __func__);
+   return -EBUSY;
+   }
+
strcpy(t-name, Auvitek tuner);
 
au0828_init_tuner(dev);
@@ -1682,6 +1713,12 @@ static int vidioc_streamon(struct file *file, void *priv,
dprintk(1, vidioc_streamon fh=%p t=%d fh-res=%d dev-res=%d\n,
fh, type, fh-resources, dev-resources);
 
+   rc = media_get_tuner_tkn(dev-usbdev-dev);
+   if (rc) {
+   dev_info(dev-usbdev-dev, %s: Tuner is busy\n, __func__);
+   return -EBUSY;
+   }
+
if (unlikely(!res_get(fh, get_ressource(fh
return -EBUSY;
 
@@ -2083,12 +2120,15 @@ int au0828_analog_register(struct au0828_dev *dev,
dev-vdev-v4l2_dev = dev-v4l2_dev;
dev-vdev-lock = dev-lock;
strcpy(dev-vdev-name, au0828a video);
+   /* there is no way to deduce parent 

[PATCH v2 0/6] media token resource framework

2014-10-14 Thread Shuah Khan
Add media token device resource framework to allow sharing
resources such as tuner, dma, audio etc. across media drivers
and non-media sound drivers that control media hardware. The
Media token resource is created at the main struct device that
is common to all drivers that claim various pieces of the main
media device, which allows them to find the resource using the
main struct device. As an example, digital, analog, and
snd-usb-audio drivers can use the media token resource API
using the main struct device for the interface the media device
is attached to.

This patch series consists of media token resource framework
and changes to use it in dvb-core, v4l2-core, au0828 driver,
and snd-usb-audio driver.

With these changes dvb and v4l2 can share the tuner without
disrupting each other. Used tvtime, xawtv, kaffeine, and vlc,
vlc audio capture option, arecord/aplay during development to
identify v4l2 vb2 and vb1 ioctls and file operations that
disrupt the digital stream and would require changes to check
tuner ownership prior to changing the tuner configuration.
vb2 changes are made in the v4l2-core and vb1 changes are made
in the au0828 driver to encourage porting drivers to vb2 to
advantage of the new media token resource framework with changes
in the core.

In this patch v2 series, fixed problems identified in the
patch v1 series. Important ones are changing snd-usb-audio
to use media tokens, holding tuner lock in VIDIOC_ENUMINPUT,
and VIDIOC_QUERYSTD.

Shuah Khan (6):
  media: add media token device resource framework
  media: v4l2-core changes to use media token api
  media: au0828-video changes to use media token api
  media: dvb-core changes to use media token api
  sound/usb: pcm changes to use media token api
  media: au0828-core changes to create and destroy media

 MAINTAINERS |2 +
 drivers/media/dvb-core/dvb_frontend.c   |   14 +-
 drivers/media/usb/au0828/au0828-core.c  |   23 +++
 drivers/media/usb/au0828/au0828-video.c |   42 +-
 drivers/media/v4l2-core/v4l2-fh.c   |7 +
 drivers/media/v4l2-core/v4l2-ioctl.c|   61 
 include/linux/media_tknres.h|   50 +++
 lib/Makefile|2 +
 lib/media_tknres.c  |  237 +++
 sound/usb/pcm.c |9 ++
 10 files changed, 445 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/media_tknres.h
 create mode 100644 lib/media_tknres.c

-- 
1.7.10.4

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


[PATCH v2 2/6] media: v4l2-core changes to use media token api

2014-10-14 Thread Shuah Khan
Changes to v4l2-core to hold tuner and audio tokens in v4l2
ioctl that change the tuner modes, and release the token from
fh exit. The changes are limited to vb2 calls that disrupt
digital stream. vb1 changes are made in the driver. The
following ioctls are changed:

S_INPUT, S_FMT, S_TUNER, S_FREQUENCY, S_STD, S_HW_FREQ_SEEK,
VIDIOC_ENUMINPUT, and VIDIOC_QUERYSTD:

- hold tuner and audio tokens before calling appropriate
  ops-vidioc_s_*
- return tuner and audio tokens locked.

v4l2_fh_exit:

- releases tuner and audio tokens.

Note that media_get_tuner_tkn() will do a get on audio token
and return with both tuner and audio tokens locked. When tuner
token released using media_put_tuner_tkn() , audio token is
released.

Signed-off-by: Shuah Khan shua...@osg.samsung.com
---
 drivers/media/v4l2-core/v4l2-fh.c|7 
 drivers/media/v4l2-core/v4l2-ioctl.c |   61 ++
 2 files changed, 68 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-fh.c 
b/drivers/media/v4l2-core/v4l2-fh.c
index c97067a..717e03d 100644
--- a/drivers/media/v4l2-core/v4l2-fh.c
+++ b/drivers/media/v4l2-core/v4l2-fh.c
@@ -25,7 +25,10 @@
 #include linux/bitops.h
 #include linux/slab.h
 #include linux/export.h
+#include linux/device.h
+#include linux/media_tknres.h
 #include media/v4l2-dev.h
+#include media/v4l2-device.h
 #include media/v4l2-fh.h
 #include media/v4l2-event.h
 #include media/v4l2-ioctl.h
@@ -92,6 +95,10 @@ void v4l2_fh_exit(struct v4l2_fh *fh)
 {
if (fh-vdev == NULL)
return;
+
+   if (fh-vdev-dev_parent)
+   media_put_tuner_tkn(fh-vdev-dev_parent);
+
v4l2_event_unsubscribe_all(fh);
fh-vdev = NULL;
 }
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 9ccb19a..686f428 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -17,6 +17,7 @@
 #include linux/types.h
 #include linux/kernel.h
 #include linux/version.h
+#include linux/media_tknres.h
 
 #include linux/videodev2.h
 
@@ -1003,6 +1004,15 @@ static void v4l_sanitize_format(struct v4l2_format *fmt)
   sizeof(fmt-fmt.pix) - offset);
 }
 
+static int v4l_get_tuner_tkn(struct video_device *vfd)
+{
+   int rc = 0;
+
+   if (vfd-dev_parent)
+   rc = media_get_tuner_tkn(vfd-dev_parent);
+   return rc;
+}
+
 static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
@@ -1022,6 +1032,14 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
 static int v4l_s_input(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
+   struct video_device *vfd = video_devdata(file);
+   int ret = 0;
+
+   ret = v4l_get_tuner_tkn(vfd);
+   if (ret) {
+   pr_info(%s: Tuner is busy\n, __func__);
+   return ret;
+   }
return ops-vidioc_s_input(file, fh, *(unsigned int *)arg);
 }
 
@@ -1063,7 +1081,13 @@ static int v4l_enuminput(const struct v4l2_ioctl_ops 
*ops,
 {
struct video_device *vfd = video_devdata(file);
struct v4l2_input *p = arg;
+   int ret;
 
+   ret = v4l_get_tuner_tkn(vfd);
+   if (ret) {
+   pr_info(%s: Tuner is busy\n, __func__);
+   return ret;
+   }
/*
 * We set the flags for CAP_DV_TIMINGS 
 * CAP_STD here based on ioctl handler provided by the
@@ -1236,6 +1260,12 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
bool is_tx = vfd-vfl_dir != VFL_DIR_RX;
int ret;
 
+   ret = v4l_get_tuner_tkn(vfd);
+   if (ret) {
+   pr_info(%s: Tuner is busy\n, __func__);
+   return ret;
+   }
+
v4l_sanitize_format(p);
 
switch (p-type) {
@@ -1415,9 +1445,15 @@ static int v4l_s_tuner(const struct v4l2_ioctl_ops *ops,
 {
struct video_device *vfd = video_devdata(file);
struct v4l2_tuner *p = arg;
+   int ret;
 
p-type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
+   ret = v4l_get_tuner_tkn(vfd);
+   if (ret) {
+   pr_info(%s: Tuner is busy\n, __func__);
+   return ret;
+   }
return ops-vidioc_s_tuner(file, fh, p);
 }
 
@@ -1453,6 +1489,7 @@ static int v4l_s_frequency(const struct v4l2_ioctl_ops 
*ops,
struct video_device *vfd = video_devdata(file);
const struct v4l2_frequency *p = arg;
enum v4l2_tuner_type type;
+   int ret;
 
if (vfd-vfl_type == VFL_TYPE_SDR) {
if (p-type != V4L2_TUNER_ADC  p-type != V4L2_TUNER_RF)
@@ -1462,6 +1499,11 @@ static int v4l_s_frequency(const struct v4l2_ioctl_ops 
*ops,
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
if (type != p-type)
return -EINVAL;
+   ret = 

Re: [PATCH 1/3] media: soc_camera: rcar_vin: Add scaling support

2014-10-14 Thread Geert Uytterhoeven
Hi Kaneko-san, Matsuoka-san,

On Tue, Oct 14, 2014 at 8:26 AM, Yoshihiro Kaneko ykaneko0...@gmail.com wrote:
 From: Koji Matsuoka koji.matsuoka...@renesas.com

Thanks for our patch!

 --- a/drivers/media/platform/soc_camera/rcar_vin.c
 +++ b/drivers/media/platform/soc_camera/rcar_vin.c

 @@ -120,6 +144,326 @@ enum chip_id {
 RCAR_E1,
  };

 +struct VIN_COEFF {

Please don't use upper case for struct names.

 +   unsigned short xs_value;
 +   unsigned long coeff_set[24];

The actual size of long depends on the word size of the CPU.
On 32-bit builds it is 32-bit, on 64-bit builds it is 64-bit.
As all values in the table below are 32-bit, and the values are
written to register using iowrite32(), please use u32 instead of
unsigned long.

 +};

 +#define VIN_COEFF_SET_COUNT (sizeof(vin_coeff_set) / sizeof(struct 
 VIN_COEFF))

There exists a convenience macro ARRAY_SIZE() for this.
Please just use ARRAY_SIZE(vin_coeff_set) instead of defining
VIN_COEFF_SET_COUNT.

 @@ -677,6 +1024,61 @@ static void rcar_vin_clock_stop(struct soc_camera_host 
 *ici)
 /* VIN does not have mclk */
  }

 +static void set_coeff(struct rcar_vin_priv *priv, unsigned long xs)

I think xs can be unsigned short?

 +{
 +   int i;
 +   struct VIN_COEFF *p_prev_set = NULL;
 +   struct VIN_COEFF *p_set = NULL;

If you add const to the two definitions above...

 +   /* Search the correspondence coefficient values */
 +   for (i = 0; i  VIN_COEFF_SET_COUNT; i++) {
 +   p_prev_set = p_set;
 +   p_set = (struct VIN_COEFF *) vin_coeff_set[i];

... the above cast is no longer needed.

 @@ -686,6 +1088,7 @@ static int rcar_vin_set_rect(struct soc_camera_device 
 *icd)
 unsigned int left_offset, top_offset;
 unsigned char dsize = 0;
 struct v4l2_rect *cam_subrect = cam-subrect;
 +   unsigned long value;

u32, as it's written to a 32-bit register later.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: Hauppauge HVR-2200 (saa7164) problems (on Linux Mint 17)

2014-10-14 Thread serrin
Thanks for that, it's working now. I didn't realise you had to apply the 
patch before building it, silly me.


Yours sincerely

serrin

On 14/10/2014 9:48 PM, Steven Toth wrote:

Please keep the discussion on the mailing list at all times.


I couldn't figure out how to apply the patch using the patch file, so I
manually edited the file (drivers/media/pci/saa7164/saa7164-fw.c), but I
kept getting the image corrupt message.

That's probably the issue. Assuming you have the patch applied and are
using the firmware it will work for you.



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

2014-10-14 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 Oct 15 04:00:21 CEST 2014
git branch: test
git hash:   cf3167cf1e969b17671a4d3d956d22718a8ceb85
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-20-g7abd8a7
host hardware:  x86_64
host os:3.17-0.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: 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: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: OK
linux-3.11.1-i686: WARNINGS
linux-3.12.23-i686: WARNINGS
linux-3.13.11-i686: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.15.2-i686: OK
linux-3.16-i686: OK
linux-3.17-i686: OK
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: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: WARNINGS
linux-3.12.23-x86_64: WARNINGS
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16-x86_64: WARNINGS
linux-3.17-x86_64: WARNINGS
apps: OK
spec-git: OK
sparse: WARNINGS

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


ERROR: cfb_fillrect [drivers/media/platform/vivid/vivid.ko] undefined!

2014-10-14 Thread kbuild test robot
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2d65a9f48fcdf7866aab6457bc707ca233e0c791
commit: e75420dd25bc9d7b6f4e3b4c4f6c778b610c8cda [media] vivid: enable the 
vivid driver
date:   6 weeks ago
config: i386-randconfig-ib0-10151216 (attached as .config)
reproduce:
  git checkout e75420dd25bc9d7b6f4e3b4c4f6c778b610c8cda
  # save the attached .config to linux build tree
  make ARCH=i386 

All error/warnings:

 ERROR: cfb_fillrect [drivers/media/platform/vivid/vivid.ko] undefined!
 ERROR: cfb_imageblit [drivers/media/platform/vivid/vivid.ko] undefined!
 ERROR: cfb_copyarea [drivers/media/platform/vivid/vivid.ko] undefined!

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.17.0-rc1 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT=elf32-i386
CONFIG_ARCH_DEFCONFIG=arch/x86/configs/i386_defconfig
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
# CONFIG_ZONE_DMA32 is not set
# CONFIG_AUDIT_ARCH is not set
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_X86_32_SMP=y
CONFIG_X86_HT=y
CONFIG_X86_32_LAZY_GS=y
CONFIG_ARCH_HWEIGHT_CFLAGS=-fcall-saved-ecx -fcall-saved-edx
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME=(none)
CONFIG_SYSVIPC=y
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_CROSS_MEMORY_ATTACH is not set
# CONFIG_FHANDLE is not set
CONFIG_USELIB=y
# CONFIG_AUDIT is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_DEBUG=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_HZ_PERIODIC=y
# CONFIG_NO_HZ_IDLE is not set
# CONFIG_NO_HZ is not set
CONFIG_HIGH_RES_TIMERS=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_IRQ_TIME_ACCOUNTING is not set
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_PREEMPT_RCU is not set
CONFIG_RCU_STALL_COMMON=y
CONFIG_RCU_FANOUT=32
CONFIG_RCU_FANOUT_LEAF=16
# CONFIG_RCU_FANOUT_EXACT is not set
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_RCU_NOCB_CPU is not set
CONFIG_BUILD_BIN2C=y
CONFIG_IKCONFIG=y
CONFIG_LOG_BUF_SHIFT=17
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_ARCH_WANTS_PROT_NUMA_PROT_NONE=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CPUSETS=y
# CONFIG_PROC_PID_CPUSET is not set
# CONFIG_CGROUP_CPUACCT is not set
CONFIG_RESOURCE_COUNTERS=y
# CONFIG_MEMCG is not set
CONFIG_CGROUP_PERF=y
# CONFIG_CGROUP_SCHED is not set
CONFIG_CHECKPOINT_RESTORE=y
# CONFIG_NAMESPACES is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
# CONFIG_RELAY is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=
CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_ANON_INODES=y
CONFIG_HAVE_UID16=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_EXPERT=y
# CONFIG_UID16 is not set
CONFIG_SGETMASK_SYSCALL=y

Re: [PATCH 3/3] media: soc_camera: rcar_vin: Add NV16 horizontal scaling-up support

2014-10-14 Thread Simon Horman
On Tue, Oct 14, 2014 at 04:57:53PM +0400, Sergei Shtylyov wrote:
 Hello.
 
 On 10/14/2014 10:26 AM, Yoshihiro Kaneko wrote:
 
 From: Koji Matsuoka koji.matsuoka...@renesas.com
 
 The scaling function had been forbidden for the capture format of
 NV16 until now. With this patch, a horizontal scaling-up function
 is supported to the capture format of NV16. a vertical scaling-up
 by the capture format of NV16 is forbidden for the H/W specification.
 
s/for/by/?
 

How about the following text?

Up until now scaling has been forbidden for the NV16 capture format. This
patch adds support for horizontal scaling-up for NV16. Vertical scaling-up
for NV16 is forbidden for by the H/W specification.

 Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
 Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
 ---
   drivers/media/platform/soc_camera/rcar_vin.c | 19 +++
   1 file changed, 15 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
 b/drivers/media/platform/soc_camera/rcar_vin.c
 index 00bc98d..bf3588f 100644
 --- a/drivers/media/platform/soc_camera/rcar_vin.c
 +++ b/drivers/media/platform/soc_camera/rcar_vin.c
 [...]
 @@ -1622,9 +1622,19 @@ static int rcar_vin_set_fmt(struct soc_camera_device 
 *icd,
  if (priv-error_flag == false)
  priv-error_flag = true;
  else {
 -if ((pixfmt == V4L2_PIX_FMT_NV16)  (pix-width  0x1F)) {
 -dev_err(icd-parent, Specified width error in NV16 
 format.\n);
 -return -EINVAL;
 +if (pixfmt == V4L2_PIX_FMT_NV16) {
 +if (pix-width  0x1F) {
 +dev_err(icd-parent,
 +Specified width error in NV16 format. 
 
You should indent the string more to the right, preferrably starting it
 under 'icd'.
 
 +Please specify the multiple of 32.\n);
 
Do not break the string like this. scripts/checkpatch.pl has been taught
 to not complain about long strings.
 
 +return -EINVAL;
 +}
 +if (pix-height != cam-height) {
 +dev_err(icd-parent,
 +Vertical scaling-up error in NV16 format. 
 +Please specify input height size.\n);
 
Same here. Not breaking the lines helps to find the error messages in the
 code.
 
 [...]
 
 WBR, Sergei
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-sh in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html