cron job: media_tree daily build: ERRORS

2015-05-03 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:   Mon May  4 04:00:19 CEST 2015
git branch: test
git hash:   ebf984bb151e9952cccd060d3aba0b4d30a87e81
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-0.slh.3-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: WARNINGS
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: ERRORS
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin-bf561: 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: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0-i686: WARNINGS
linux-4.1-rc1-i686: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: 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: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: WARNINGS
linux-4.1-rc1-x86_64: WARNINGS
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


Re: [PATCH 9/9] mt9t112: initialize left and top

2015-05-03 Thread Guennadi Liakhovetski
On Sun, 3 May 2015, Guennadi Liakhovetski wrote:

> Hi Hans,
> 
> On Sun, 3 May 2015, Hans Verkuil wrote:
> 
> > From: Hans Verkuil 
> > 
> > The left and top variables were uninitialized, leading to unexpected
> > results.
> > 
> > Signed-off-by: Hans Verkuil 
> > ---
> >  drivers/media/i2c/soc_camera/mt9t112.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/i2c/soc_camera/mt9t112.c 
> > b/drivers/media/i2c/soc_camera/mt9t112.c
> > index de10a76..02190d6 100644
> > --- a/drivers/media/i2c/soc_camera/mt9t112.c
> > +++ b/drivers/media/i2c/soc_camera/mt9t112.c
> > @@ -952,7 +952,8 @@ static int mt9t112_set_fmt(struct v4l2_subdev *sd,
> > struct v4l2_mbus_framefmt *mf = &format->format;
> > struct i2c_client *client = v4l2_get_subdevdata(sd);
> > struct mt9t112_priv *priv = to_mt9t112(client);
> > -   unsigned int top, left;
> > +   unsigned int top = priv->frame.top;
> > +   unsigned int left = priv->frame.left;
> 
> I don't think this is needed. We don't care about left and top in 
> mt9t112_set_fmt().
> 
> How about my comment about a duplicated call to mt9t112_set_params()? Can 
> we have it fixed too?

Sorry, just saw your comment in patch #0:) Np, let's postpone this then.

Thanks
Guennadi
--
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 9/9] mt9t112: initialize left and top

2015-05-03 Thread Guennadi Liakhovetski
Hi Hans,

On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> The left and top variables were uninitialized, leading to unexpected
> results.
> 
> Signed-off-by: Hans Verkuil 
> ---
>  drivers/media/i2c/soc_camera/mt9t112.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/mt9t112.c 
> b/drivers/media/i2c/soc_camera/mt9t112.c
> index de10a76..02190d6 100644
> --- a/drivers/media/i2c/soc_camera/mt9t112.c
> +++ b/drivers/media/i2c/soc_camera/mt9t112.c
> @@ -952,7 +952,8 @@ static int mt9t112_set_fmt(struct v4l2_subdev *sd,
>   struct v4l2_mbus_framefmt *mf = &format->format;
>   struct i2c_client *client = v4l2_get_subdevdata(sd);
>   struct mt9t112_priv *priv = to_mt9t112(client);
> - unsigned int top, left;
> + unsigned int top = priv->frame.top;
> + unsigned int left = priv->frame.left;

I don't think this is needed. We don't care about left and top in 
mt9t112_set_fmt().

How about my comment about a duplicated call to mt9t112_set_params()? Can 
we have it fixed too?

Thanks
Guennadi

>   int i;
>  
>   if (format->pad)
> -- 
> 2.1.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


Re: [PATCH 8/9] ov9740: avoid calling ov9740_res_roundup() twice

2015-05-03 Thread Guennadi Liakhovetski
Hi Hans,

On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> Simplify ov9740_s_fmt.
> 
> Signed-off-by: Hans Verkuil 
> Reported-by: Guennadi Liakhovetski 
> ---
>  drivers/media/i2c/soc_camera/ov9740.c | 18 +-
>  1 file changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/ov9740.c 
> b/drivers/media/i2c/soc_camera/ov9740.c
> index 03a7fc7..61a8e18 100644
> --- a/drivers/media/i2c/soc_camera/ov9740.c
> +++ b/drivers/media/i2c/soc_camera/ov9740.c
> @@ -673,20 +673,8 @@ static int ov9740_s_fmt(struct v4l2_subdev *sd,
>  {
>   struct i2c_client *client = v4l2_get_subdevdata(sd);
>   struct ov9740_priv *priv = to_ov9740(sd);
> - enum v4l2_colorspace cspace;
> - u32 code = mf->code;
>   int ret;
>  
> - ov9740_res_roundup(&mf->width, &mf->height);
> -
> - switch (code) {
> - case MEDIA_BUS_FMT_YUYV8_2X8:
> - cspace = V4L2_COLORSPACE_SRGB;
> - break;
> - default:
> - return -EINVAL;
> - }
> -

ov9740_s_fmt() is also called from ov9740_s_power(), so, don't we have to 
do this simplification the other way round - remove redundant code from 
ov9740_set_fmt() instead?

Thanks
Guennadi

>   ret = ov9740_reg_write_array(client, ov9740_defaults,
>ARRAY_SIZE(ov9740_defaults));
>   if (ret < 0)
> @@ -696,11 +684,7 @@ static int ov9740_s_fmt(struct v4l2_subdev *sd,
>   if (ret < 0)
>   return ret;
>  
> - mf->code= code;
> - mf->colorspace  = cspace;
> -
> - memcpy(&priv->current_mf, mf, sizeof(struct v4l2_mbus_framefmt));
> -
> + priv->current_mf = *mf;
>   return ret;
>  }
>  
> -- 
> 2.1.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


Re: [PATCH 7/9] ov9640: avoid calling ov9640_res_roundup() twice

2015-05-03 Thread Guennadi Liakhovetski
Hi Hans,

On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> Simplify ov9640_s_fmt and ov9640_set_fmt
> 
> Signed-off-by: Hans Verkuil 
> Reported-by: Guennadi Liakhovetski 
> ---
>  drivers/media/i2c/soc_camera/ov9640.c | 24 +++-
>  1 file changed, 3 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/ov9640.c 
> b/drivers/media/i2c/soc_camera/ov9640.c
> index 8caae1c..c8ac41e 100644
> --- a/drivers/media/i2c/soc_camera/ov9640.c
> +++ b/drivers/media/i2c/soc_camera/ov9640.c
> @@ -486,11 +486,8 @@ static int ov9640_s_fmt(struct v4l2_subdev *sd,
>  {
>   struct i2c_client *client = v4l2_get_subdevdata(sd);
>   struct ov9640_reg_alt alts = {0};
> - enum v4l2_colorspace cspace;
> - u32 code = mf->code;
>   int ret;
>  
> - ov9640_res_roundup(&mf->width, &mf->height);
>   ov9640_alter_regs(mf->code, &alts);
>  
>   ov9640_reset(client);
> @@ -499,24 +496,7 @@ static int ov9640_s_fmt(struct v4l2_subdev *sd,
>   if (ret)
>   return ret;
>  
> - switch (code) {
> - case MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE:
> - case MEDIA_BUS_FMT_RGB565_2X8_LE:
> - cspace = V4L2_COLORSPACE_SRGB;
> - break;
> - default:
> - code = MEDIA_BUS_FMT_UYVY8_2X8;
> - case MEDIA_BUS_FMT_UYVY8_2X8:
> - cspace = V4L2_COLORSPACE_JPEG;
> - }
> -
> - ret = ov9640_write_regs(client, mf->width, code, &alts);
> - if (!ret) {
> - mf->code= code;
> - mf->colorspace  = cspace;
> - }
> -
> - return ret;
> + return ov9640_write_regs(client, mf->width, mf->code, &alts);
>  }
>  
>  static int ov9640_set_fmt(struct v4l2_subdev *sd,
> @@ -539,8 +519,10 @@ static int ov9640_set_fmt(struct v4l2_subdev *sd,
>   break;
>   default:
>   mf->code = MEDIA_BUS_FMT_UYVY8_2X8;
> + /* fall through */
>   case MEDIA_BUS_FMT_UYVY8_2X8:
>   mf->colorspace = V4L2_COLORSPACE_JPEG;
> + break;

Again, not sure this is a good idea. Otherwise

Acked-by: Guennadi Liakhovetski 

Thanks
Guennadi

>   }
>  
>   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
> -- 
> 2.1.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


Re: [PATCH 5/9] ov5642: avoid calling ov5642_find_datafmt() twice

2015-05-03 Thread Guennadi Liakhovetski
Hi Hans,

On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> Simplify ov5642_set_fmt().
> 
> Signed-off-by: Hans Verkuil 
> Reported-by: Guennadi Liakhovetski 
> ---
>  drivers/media/i2c/soc_camera/ov5642.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/ov5642.c 
> b/drivers/media/i2c/soc_camera/ov5642.c
> index bab9ac0..061fca3 100644
> --- a/drivers/media/i2c/soc_camera/ov5642.c
> +++ b/drivers/media/i2c/soc_camera/ov5642.c
> @@ -804,14 +804,15 @@ static int ov5642_set_fmt(struct v4l2_subdev *sd,
>   if (!fmt) {
>   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
>   return -EINVAL;
> - mf->code= ov5642_colour_fmts[0].code;
> - mf->colorspace  = ov5642_colour_fmts[0].colorspace;
> + fmt = ov5642_colour_fmts;
> + mf->code = fmt->code;
> + mf->colorspace = fmt->colorspace;

Again - I still don't see why this is needed.

Thanks
Guennadi

>   }
>  
>   mf->field   = V4L2_FIELD_NONE;
>  
>   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
> - priv->fmt = ov5642_find_datafmt(mf->code);
> + priv->fmt = fmt;
>   else
>   cfg->try_fmt = *mf;
>   return 0;
> -- 
> 2.1.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


Re: [PATCH 6/9] ov772x: avoid calling ov772x_select_params() twice

2015-05-03 Thread Guennadi Liakhovetski
On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> Merge ov772x_s_fmt into ov772x_set_fmt.
> 
> Signed-off-by: Hans Verkuil 
> Reported-by: Guennadi Liakhovetski 

Acked-by: Guennadi Liakhovetski 

Thanks
Guennadi

> ---
>  drivers/media/i2c/soc_camera/ov772x.c | 41 
> +++
>  1 file changed, 13 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/ov772x.c 
> b/drivers/media/i2c/soc_camera/ov772x.c
> index f150a8b..aa32bc5 100644
> --- a/drivers/media/i2c/soc_camera/ov772x.c
> +++ b/drivers/media/i2c/soc_camera/ov772x.c
> @@ -895,38 +895,15 @@ static int ov772x_get_fmt(struct v4l2_subdev *sd,
>   return 0;
>  }
>  
> -static int ov772x_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt 
> *mf)
> -{
> - struct ov772x_priv *priv = to_ov772x(sd);
> - const struct ov772x_color_format *cfmt;
> - const struct ov772x_win_size *win;
> - int ret;
> -
> - ov772x_select_params(mf, &cfmt, &win);
> -
> - ret = ov772x_set_params(priv, cfmt, win);
> - if (ret < 0)
> - return ret;
> -
> - priv->win = win;
> - priv->cfmt = cfmt;
> -
> - mf->code = cfmt->code;
> - mf->width = win->rect.width;
> - mf->height = win->rect.height;
> - mf->field = V4L2_FIELD_NONE;
> - mf->colorspace = cfmt->colorspace;
> -
> - return 0;
> -}
> -
>  static int ov772x_set_fmt(struct v4l2_subdev *sd,
>   struct v4l2_subdev_pad_config *cfg,
>   struct v4l2_subdev_format *format)
>  {
> + struct ov772x_priv *priv = to_ov772x(sd);
>   struct v4l2_mbus_framefmt *mf = &format->format;
>   const struct ov772x_color_format *cfmt;
>   const struct ov772x_win_size *win;
> + int ret;
>  
>   if (format->pad)
>   return -EINVAL;
> @@ -939,9 +916,17 @@ static int ov772x_set_fmt(struct v4l2_subdev *sd,
>   mf->field = V4L2_FIELD_NONE;
>   mf->colorspace = cfmt->colorspace;
>  
> - if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
> - return ov772x_s_fmt(sd, mf);
> - cfg->try_fmt = *mf;
> + if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
> + cfg->try_fmt = *mf;
> + return 0;
> + }
> +
> + ret = ov772x_set_params(priv, cfmt, win);
> + if (ret < 0)
> + return ret;
> +
> + priv->win = win;
> + priv->cfmt = cfmt;
>   return 0;
>  }
>  
> -- 
> 2.1.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


Payment

2015-05-03 Thread Finance Department
Dear Winner,

You have been awarded the sum of  8,000,000.00 (Eight Million Pounds sterling) 
with reference number 77100146. This compensation funds from the United 
Nation.Send us your personal details to deliver your funds.

Gloria Peter
--
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 4/9] ov2640: avoid calling ov2640_select_win() twice

2015-05-03 Thread Guennadi Liakhovetski
Hi Hans,

On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> Simplify ov2640_set_params and ov2640_set_fmt.
> 
> Signed-off-by: Hans Verkuil 
> Reported-by: Guennadi Liakhovetski 
> ---
>  drivers/media/i2c/soc_camera/ov2640.c | 21 ++---
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/ov2640.c 
> b/drivers/media/i2c/soc_camera/ov2640.c
> index 9b4f5de..5dcaf24 100644
> --- a/drivers/media/i2c/soc_camera/ov2640.c
> +++ b/drivers/media/i2c/soc_camera/ov2640.c
> @@ -769,15 +769,15 @@ static const struct ov2640_win_size 
> *ov2640_select_win(u32 *width, u32 *height)
>   return &ov2640_supported_win_sizes[default_size];
>  }
>  
> -static int ov2640_set_params(struct i2c_client *client, u32 *width, u32 
> *height,
> -  u32 code)
> +static int ov2640_set_params(struct i2c_client *client,
> +  const struct ov2640_win_size *win, u32 code)
>  {
>   struct ov2640_priv   *priv = to_ov2640(client);
>   const struct regval_list *selected_cfmt_regs;
>   int ret;
>  
>   /* select win */
> - priv->win = ov2640_select_win(width, height);
> + priv->win = win;
>  
>   /* select format */
>   priv->cfmt_code = 0;
> @@ -798,6 +798,7 @@ static int ov2640_set_params(struct i2c_client *client, 
> u32 *width, u32 *height,
>   case MEDIA_BUS_FMT_UYVY8_2X8:
>   dev_dbg(&client->dev, "%s: Selected cfmt UYVY", __func__);
>   selected_cfmt_regs = ov2640_uyvy_regs;
> + break;

Hm, IIRC, some versions of gcc complain like "break at the end of a switch 
statement is deprecated." Why did you add this at two locations? Are you 
seeing a warning? If not, maybe better not do that.

Otherwise

Acked-by: Guennadi Liakhovetski 

Thanks
Guennadi

>   }
>  
>   /* reset hardware */
> @@ -832,8 +833,6 @@ static int ov2640_set_params(struct i2c_client *client, 
> u32 *width, u32 *height,
>   goto err;
>  
>   priv->cfmt_code = code;
> - *width = priv->win->width;
> - *height = priv->win->height;
>  
>   return 0;
>  
> @@ -887,14 +886,13 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
>  {
>   struct v4l2_mbus_framefmt *mf = &format->format;
>   struct i2c_client *client = v4l2_get_subdevdata(sd);
> + const struct ov2640_win_size *win;
>  
>   if (format->pad)
>   return -EINVAL;
>  
> - /*
> -  * select suitable win, but don't store it
> -  */
> - ov2640_select_win(&mf->width, &mf->height);
> + /* select suitable win */
> + win = ov2640_select_win(&mf->width, &mf->height);
>  
>   mf->field   = V4L2_FIELD_NONE;
>  
> @@ -905,14 +903,15 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
>   break;
>   default:
>   mf->code = MEDIA_BUS_FMT_UYVY8_2X8;
> + /* fall through */
>   case MEDIA_BUS_FMT_YUYV8_2X8:
>   case MEDIA_BUS_FMT_UYVY8_2X8:
>   mf->colorspace = V4L2_COLORSPACE_JPEG;
> + break;
>   }
>  
>   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
> - return ov2640_set_params(client, &mf->width,
> -  &mf->height, mf->code);
> + return ov2640_set_params(client, win, mf->code);
>   cfg->try_fmt = *mf;
>   return 0;
>  }
> -- 
> 2.1.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


Re: [PATCH 3/9] mt9v022: avoid calling mt9v022_find_datafmt() twice

2015-05-03 Thread Guennadi Liakhovetski
On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> Simplify mt9v022_s_fmt and mt9v022_set_fmt.
> 
> Signed-off-by: Hans Verkuil 
> Reported-by: Guennadi Liakhovetski 

Acked-by: Guennadi Liakhovetski 

Thanks
Guennadi

> ---
>  drivers/media/i2c/soc_camera/mt9v022.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/mt9v022.c 
> b/drivers/media/i2c/soc_camera/mt9v022.c
> index f313774..00516bf 100644
> --- a/drivers/media/i2c/soc_camera/mt9v022.c
> +++ b/drivers/media/i2c/soc_camera/mt9v022.c
> @@ -396,6 +396,7 @@ static int mt9v022_get_fmt(struct v4l2_subdev *sd,
>  }
>  
>  static int mt9v022_s_fmt(struct v4l2_subdev *sd,
> +  const struct mt9v022_datafmt *fmt,
>struct v4l2_mbus_framefmt *mf)
>  {
>   struct i2c_client *client = v4l2_get_subdevdata(sd);
> @@ -434,9 +435,8 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd,
>   if (!ret) {
>   mf->width   = mt9v022->rect.width;
>   mf->height  = mt9v022->rect.height;
> - mt9v022->fmt= mt9v022_find_datafmt(mf->code,
> - mt9v022->fmts, mt9v022->num_fmts);
> - mf->colorspace  = mt9v022->fmt->colorspace;
> + mt9v022->fmt= fmt;
> + mf->colorspace  = fmt->colorspace;
>   }
>  
>   return ret;
> @@ -471,7 +471,7 @@ static int mt9v022_set_fmt(struct v4l2_subdev *sd,
>   mf->colorspace  = fmt->colorspace;
>  
>   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
> - return mt9v022_s_fmt(sd, mf);
> + return mt9v022_s_fmt(sd, fmt, mf);
>   cfg->try_fmt = *mf;
>   return 0;
>  }
> -- 
> 2.1.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


Re: [PATCH 2/9] mt9m001: avoid calling mt9m001_find_datafmt() twice

2015-05-03 Thread Guennadi Liakhovetski
On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> Simplify mt9m001_s_fmt and mt9m001_set_fmt.
> 
> Signed-off-by: Hans Verkuil 
> Reported-by: Guennadi Liakhovetski 

Acked-by: Guennadi Liakhovetski 

Thanks
Guennadi

> ---
>  drivers/media/i2c/soc_camera/mt9m001.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/mt9m001.c 
> b/drivers/media/i2c/soc_camera/mt9m001.c
> index 4fbdd1e..1f49140 100644
> --- a/drivers/media/i2c/soc_camera/mt9m001.c
> +++ b/drivers/media/i2c/soc_camera/mt9m001.c
> @@ -271,6 +271,7 @@ static int mt9m001_get_fmt(struct v4l2_subdev *sd,
>  }
>  
>  static int mt9m001_s_fmt(struct v4l2_subdev *sd,
> +  const struct mt9m001_datafmt *fmt,
>struct v4l2_mbus_framefmt *mf)
>  {
>   struct i2c_client *client = v4l2_get_subdevdata(sd);
> @@ -290,9 +291,8 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd,
>   if (!ret) {
>   mf->width   = mt9m001->rect.width;
>   mf->height  = mt9m001->rect.height;
> - mt9m001->fmt= mt9m001_find_datafmt(mf->code,
> - mt9m001->fmts, mt9m001->num_fmts);
> - mf->colorspace  = mt9m001->fmt->colorspace;
> + mt9m001->fmt= fmt;
> + mf->colorspace  = fmt->colorspace;
>   }
>  
>   return ret;
> @@ -328,7 +328,7 @@ static int mt9m001_set_fmt(struct v4l2_subdev *sd,
>   mf->colorspace  = fmt->colorspace;
>  
>   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
> - return mt9m001_s_fmt(sd, mf);
> + return mt9m001_s_fmt(sd, fmt, mf);
>   cfg->try_fmt = *mf;
>   return 0;
>  }
> -- 
> 2.1.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


Re: [PATCH 1/9] imx074: don't call imx074_find_datafmt() twice

2015-05-03 Thread Guennadi Liakhovetski
Hi Hans,

Thanks for fixing the drivers!

On Sun, 3 May 2015, Hans Verkuil wrote:

> From: Hans Verkuil 
> 
> Simplify imx074_set_fmt().
> 
> Signed-off-by: Hans Verkuil 
> Reported-by: Guennadi Liakhovetski 
> ---
>  drivers/media/i2c/soc_camera/imx074.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/imx074.c 
> b/drivers/media/i2c/soc_camera/imx074.c
> index f68c235..4226f06 100644
> --- a/drivers/media/i2c/soc_camera/imx074.c
> +++ b/drivers/media/i2c/soc_camera/imx074.c
> @@ -171,8 +171,9 @@ static int imx074_set_fmt(struct v4l2_subdev *sd,
>   /* MIPI CSI could have changed the format, double-check */
>   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
>   return -EINVAL;
> - mf->code= imx074_colour_fmts[0].code;
> - mf->colorspace  = imx074_colour_fmts[0].colorspace;
> + fmt = imx074_colour_fmts;
> + mf->code = fmt->code;
> + mf->colorspace = fmt->colorspace;

Uhm, why this change? I understand, that this is equivalent code, but (1) 
is it at all related to the change? and (2) imx074_colour_fmts is an 
array, so, I'd prefer to keep it as is. I do use pointer arithmetics for 
array, but then I'd do something like

+   fmt = imx074_colour_fmts + 0;
+   mf->code = fmt->code;
+   mf->colorspace = fmt->colorspace;

which looks silly:) And then - even more importantly - you overwrite the 
fmt variable, which is then used below instead of calling 
imx074_find_datafmt() again. So, now you assign a (theoretically) 
different value to priv->fmt. I know that array only has one element and 
imx074_find_datafmt() will anyway just return it, but, I don't see why 
this change is needed?

Thanks
Guennadi

>   }
>  
>   mf->width   = IMX074_WIDTH;
> @@ -180,7 +181,7 @@ static int imx074_set_fmt(struct v4l2_subdev *sd,
>   mf->field   = V4L2_FIELD_NONE;
>  
>   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
> - priv->fmt = imx074_find_datafmt(mf->code);
> + priv->fmt = fmt;
>   else
>   cfg->try_fmt = *mf;
>  
> -- 
> 2.1.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


Re: soc-camera: opinion poll - future directions

2015-05-03 Thread Guennadi Liakhovetski
Hi Hans,

On Sun, 3 May 2015, Hans Verkuil wrote:

> Hi Guennadi,
> 
> On 05/03/2015 06:11 PM, Guennadi Liakhovetski wrote:
> > Hi all,
> > 
> > Just a quick opinion poll - where and how should the soc-camera framework 
> > and drivers be heading? Possible (probably not all) directions:
> > 
> > (1) all is good, keep as is. That means keep all drivers, killing them off 
> > only when it becomes very obvious, that noone wants them, keep developing 
> > drivers, that are still being used and updating all of them on any API 
> > updates. Keep me as maintainer, which means slow patch processing rate and 
> > no active participation in new developments - at hardware, soc-camera or 
> > V4L levels.
> > 
> > (2) we want more! I.e. some contributors are planning to either add new 
> > drivers to it or significantly develop existing ones, see significant 
> > benefit in it. In this case it might become necessary to replace me with 
> > someone, who can be more active in this area.
> > 
> > (3) slowly phase out. Try to either deprecate and remove soc-camera 
> > drivers one by one or move them out to become independent V4L2 host or 
> > subdevice drivers, but keep updating while still there.
> > 
> > (4) basically as (3) but even more aggressively - get rid of it ASAP:)
> > 
> > Opinions? Expecially would be interesting to hear from respective 
> > host-driver maintainers / developers, sorry, not adding CCs, they probably 
> > read the list anyway:)
> 
> I'm closest to 1. I would certainly not use it for new drivers, I see no
> reason to do that anymore. The core frameworks are quite good these days
> and I think the need for soc-camera has basically disappeared. But there
> is no need to phase out or remove soc-camera drivers (unless they are
> clearly broken and nobody will fix them). And if someone wants to turn
> a soc-camera driver into a standalone driver, then I would encourage
> that.

Understand, thanks.

> However, there are two things that need work fairly soon:
> 
> 1) the dependency of subdev drivers on soc_camera: that has to go. I plan
> to work on that, but the first step is to replace the video crop ops by
> the pad selection ops. I finally got my Renesas sh7724 board up and running,

Uhm... Does anyone really still care about V4L on SuperH?..

> so I hope to make progress on this soon. I'll update soc-camera as well
> to conform to v4l2-compliance. Once that's done I will investigate how to
> remove the soc-camera dependency.
> 
> The soc-camera dependency kills the reusability of those drivers and it
> really needs to be addressed.
> 
> 2) Converting soc-camera videobuf drivers to vb2. At some point vb1 will be
> removed, so any remaining vb1 driver will likely be killed off if nobody does
> the conversion. I believe it is only omap1 and pxa that still use videobuf.
> 
> I think omap1 might be a candidate for removal, but I don't know about the 
> pxa.
> Guennadi, what is the status of these drivers?

Dont know, sorry. PXA in general seems to still be quite actively 
maintained - I recently saw a patch series for PXA CCF support, so, 
probably V4L is still in use too.

> If I would do a vb2 conversion
> for the pxa, would you be able to test it?

I have a board with PXA270, and it still seems to be in the mainline, but 
I don't know how easy it would be to get it running with a current kernel.

Thanks
Guennadi
--
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: soc-camera: opinion poll - future directions

2015-05-03 Thread Hans Verkuil
Hi Guennadi,

On 05/03/2015 06:11 PM, Guennadi Liakhovetski wrote:
> Hi all,
> 
> Just a quick opinion poll - where and how should the soc-camera framework 
> and drivers be heading? Possible (probably not all) directions:
> 
> (1) all is good, keep as is. That means keep all drivers, killing them off 
> only when it becomes very obvious, that noone wants them, keep developing 
> drivers, that are still being used and updating all of them on any API 
> updates. Keep me as maintainer, which means slow patch processing rate and 
> no active participation in new developments - at hardware, soc-camera or 
> V4L levels.
> 
> (2) we want more! I.e. some contributors are planning to either add new 
> drivers to it or significantly develop existing ones, see significant 
> benefit in it. In this case it might become necessary to replace me with 
> someone, who can be more active in this area.
> 
> (3) slowly phase out. Try to either deprecate and remove soc-camera 
> drivers one by one or move them out to become independent V4L2 host or 
> subdevice drivers, but keep updating while still there.
> 
> (4) basically as (3) but even more aggressively - get rid of it ASAP:)
> 
> Opinions? Expecially would be interesting to hear from respective 
> host-driver maintainers / developers, sorry, not adding CCs, they probably 
> read the list anyway:)

I'm closest to 1. I would certainly not use it for new drivers, I see no
reason to do that anymore. The core frameworks are quite good these days
and I think the need for soc-camera has basically disappeared. But there
is no need to phase out or remove soc-camera drivers (unless they are
clearly broken and nobody will fix them). And if someone wants to turn
a soc-camera driver into a standalone driver, then I would encourage
that.

However, there are two things that need work fairly soon:

1) the dependency of subdev drivers on soc_camera: that has to go. I plan
to work on that, but the first step is to replace the video crop ops by
the pad selection ops. I finally got my Renesas sh7724 board up and running,
so I hope to make progress on this soon. I'll update soc-camera as well
to conform to v4l2-compliance. Once that's done I will investigate how to
remove the soc-camera dependency.

The soc-camera dependency kills the reusability of those drivers and it
really needs to be addressed.

2) Converting soc-camera videobuf drivers to vb2. At some point vb1 will be
removed, so any remaining vb1 driver will likely be killed off if nobody does
the conversion. I believe it is only omap1 and pxa that still use videobuf.

I think omap1 might be a candidate for removal, but I don't know about the pxa.
Guennadi, what is the status of these drivers? If I would do a vb2 conversion
for the pxa, would you be able to test it?

Regards,

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


soc-camera: opinion poll - future directions

2015-05-03 Thread Guennadi Liakhovetski
Hi all,

Just a quick opinion poll - where and how should the soc-camera framework 
and drivers be heading? Possible (probably not all) directions:

(1) all is good, keep as is. That means keep all drivers, killing them off 
only when it becomes very obvious, that noone wants them, keep developing 
drivers, that are still being used and updating all of them on any API 
updates. Keep me as maintainer, which means slow patch processing rate and 
no active participation in new developments - at hardware, soc-camera or 
V4L levels.

(2) we want more! I.e. some contributors are planning to either add new 
drivers to it or significantly develop existing ones, see significant 
benefit in it. In this case it might become necessary to replace me with 
someone, who can be more active in this area.

(3) slowly phase out. Try to either deprecate and remove soc-camera 
drivers one by one or move them out to become independent V4L2 host or 
subdevice drivers, but keep updating while still there.

(4) basically as (3) but even more aggressively - get rid of it ASAP:)

Opinions? Expecially would be interesting to hear from respective 
host-driver maintainers / developers, sorry, not adding CCs, they probably 
read the list anyway:)

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


[PATCH v3 4/6] rtl28xxu: add I2C read without write

2015-05-03 Thread Olli Salonen
Add support for I2C read operation without a preceeding write.

While here, change the error code to EOPNOTSUPP in case an
unsupported I2C operation is attempted.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index f1a7613..5e0c015 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -232,8 +232,14 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, 
struct i2c_msg msg[],
req.data = msg[0].buf;
ret = rtl28xxu_ctrl_msg(d, &req);
}
+   } else if (num == 1 && (msg[0].flags & I2C_M_RD)) {
+   req.value = (msg[0].addr << 1);
+   req.index = CMD_I2C_DA_RD;
+   req.size = msg[0].len;
+   req.data = msg[0].buf;
+   ret = rtl28xxu_ctrl_msg(d, &req);
} else {
-   ret = -EINVAL;
+   ret = -EOPNOTSUPP;
}
 
 err_mutex_unlock:
-- 
1.9.1

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


[PATCH v3 5/6] si2168: add I2C error handling

2015-05-03 Thread Olli Salonen
Return error from si2168_cmd_execute in case the demodulator returns an
error.

Signed-off-by: Olli Salonen 
---
 drivers/media/dvb-frontends/si2168.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 29a5936..b68ab34 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -60,6 +60,12 @@ static int si2168_cmd_execute(struct i2c_client *client, 
struct si2168_cmd *cmd)
jiffies_to_msecs(jiffies) -
(jiffies_to_msecs(timeout) - TIMEOUT));
 
+   /* error bit set? */
+   if ((cmd->args[0] >> 6) & 0x01) {
+   ret = -EREMOTEIO;
+   goto err_mutex_unlock;
+   }
+
if (!((cmd->args[0] >> 7) & 0x01)) {
ret = -ETIMEDOUT;
goto err_mutex_unlock;
-- 
1.9.1

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


[PATCH v3 6/6] rtl2832: add support for GoTView MasterHD 3 USB tuner

2015-05-03 Thread Olli Salonen
GoTView MasterHD 3 is a DVB-T2/C USB 2.0 tuner.

It's based on the following components:
- USB bridge: RTL2832P (contains also DVB-T demodulator)
- Demodulator: Si2168-A30
- Tuner: Si2148-A20

The demodulator and the tuner will need firmwares. The Si2148 uses Si2158
firmware. Antti has the firmwares available for download:
http://palosaari.fi/linux/v4l-dvb/firmware/

Do note that for DVB-T either of the demodulators can be used. DVB-C and
DVB-T2 are only supported by the Si2168 demodulator. The driver will
register 2 frontends for the same adapter. Frontend 0 will be the RTL2832
demodulator and frontend 1 will be the Si2168 demodulator. The same
tuner is used for both.

As a consequence of the above, it's recommended to use application that
does implement proper DVBv5 support.

For some reason, the old I2C write method sporadically fails. Thus the
need for an option to only use the new I2C write method supported by the
RTL2832.

Signed-off-by: Olli Salonen 
---
 drivers/media/dvb-frontends/rtl2832.c  |   4 +
 drivers/media/dvb-frontends/rtl2832.h  |   1 +
 drivers/media/dvb-frontends/rtl2832_priv.h |  25 ++
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c| 117 -
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h|   5 ++
 5 files changed, 149 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/rtl2832.c 
b/drivers/media/dvb-frontends/rtl2832.c
index 20fa245..08558eb 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -376,6 +376,10 @@ static int rtl2832_init(struct dvb_frontend *fe)
len = ARRAY_SIZE(rtl2832_tuner_init_r820t);
init = rtl2832_tuner_init_r820t;
break;
+   case RTL2832_TUNER_SI2157:
+   len = ARRAY_SIZE(rtl2832_tuner_init_si2157);
+   init = rtl2832_tuner_init_si2157;
+   break;
default:
ret = -EINVAL;
goto err;
diff --git a/drivers/media/dvb-frontends/rtl2832.h 
b/drivers/media/dvb-frontends/rtl2832.h
index a8e912e..c6cdcc4 100644
--- a/drivers/media/dvb-frontends/rtl2832.h
+++ b/drivers/media/dvb-frontends/rtl2832.h
@@ -47,6 +47,7 @@ struct rtl2832_platform_data {
 #define RTL2832_TUNER_FC00130x29
 #define RTL2832_TUNER_R820T 0x2a
 #define RTL2832_TUNER_R828D 0x2b
+#define RTL2832_TUNER_SI21570x2c
u8 tuner;
 
struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
diff --git a/drivers/media/dvb-frontends/rtl2832_priv.h 
b/drivers/media/dvb-frontends/rtl2832_priv.h
index c3a922c..a973b8a 100644
--- a/drivers/media/dvb-frontends/rtl2832_priv.h
+++ b/drivers/media/dvb-frontends/rtl2832_priv.h
@@ -377,4 +377,29 @@ static const struct rtl2832_reg_value 
rtl2832_tuner_init_r820t[] = {
{DVBT_SPEC_INV,  0x1},
 };
 
+static const struct rtl2832_reg_value rtl2832_tuner_init_si2157[] = {
+   {DVBT_DAGC_TRG_VAL, 0x39},
+   {DVBT_AGC_TARG_VAL_0,0x0},
+   {DVBT_AGC_TARG_VAL_8_1, 0x40},
+   {DVBT_AAGC_LOOP_GAIN,   0x16},
+   {DVBT_LOOP_GAIN2_3_0,0x8},
+   {DVBT_LOOP_GAIN2_4,  0x1},
+   {DVBT_LOOP_GAIN3,   0x18},
+   {DVBT_VTOP1,0x35},
+   {DVBT_VTOP2,0x21},
+   {DVBT_VTOP3,0x21},
+   {DVBT_KRF1,  0x0},
+   {DVBT_KRF2, 0x40},
+   {DVBT_KRF3, 0x10},
+   {DVBT_KRF4, 0x10},
+   {DVBT_IF_AGC_MIN,   0x80},
+   {DVBT_IF_AGC_MAX,   0x7f},
+   {DVBT_RF_AGC_MIN,   0x80},
+   {DVBT_RF_AGC_MAX,   0x7f},
+   {DVBT_POLAR_RF_AGC,  0x0},
+   {DVBT_POLAR_IF_AGC,  0x0},
+   {DVBT_AD7_SETTING,0xe9f4},
+   {DVBT_SPEC_INV,  0x0},
+};
+
 #endif /* RTL2832_PRIV_H */
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 5e0c015..5cc2f12 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -217,7 +217,7 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, 
struct i2c_msg msg[],
req.data = &msg[0].buf[1];
ret = rtl28xxu_ctrl_msg(d, &req);
}
-   } else if (msg[0].len < 23) {
+   } else if ((msg[0].len < 23) && (!dev->new_i2c_write)) {
/* method 2 - old I2C */
req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
req.index = CMD_I2C_WR;
@@ -363,6 +363,8 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};
struct rtl28xxu

[PATCH v3 3/6] si2157: support selection of IF interface

2015-05-03 Thread Olli Salonen
The chips supported by the si2157 driver have two IF outputs (either
pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
add an option to choose which output shall be used.

As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.

Signed-off-by: Olli Salonen 
---
 drivers/media/pci/cx23885/cx23885-dvb.c | 4 
 drivers/media/pci/smipcie/smipcie.c | 1 +
 drivers/media/tuners/si2157.c   | 4 +++-
 drivers/media/tuners/si2157.h   | 6 ++
 drivers/media/tuners/si2157_priv.h  | 1 +
 drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 ++
 drivers/media/usb/dvb-usb-v2/af9035.c   | 1 +
 drivers/media/usb/dvb-usb-v2/dvbsky.c   | 2 ++
 drivers/media/usb/dvb-usb/cxusb.c   | 1 +
 drivers/media/usb/em28xx/em28xx-dvb.c   | 2 ++
 10 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index 745caab..37fd013 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1912,6 +1912,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -1957,6 +1958,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2093,6 +2095,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2172,6 +2175,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
diff --git a/drivers/media/pci/smipcie/smipcie.c 
b/drivers/media/pci/smipcie/smipcie.c
index 4115925..143fd78 100644
--- a/drivers/media/pci/smipcie/smipcie.c
+++ b/drivers/media/pci/smipcie/smipcie.c
@@ -657,6 +657,7 @@ static int smi_dvbsky_sit2_fe_attach(struct smi_port *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = port->fe;
+   si2157_config.if_port = 1;
 
memset(&client_info, 0, sizeof(struct i2c_board_info));
strlcpy(client_info.type, "si2157", I2C_NAME_SIZE);
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index d74ae26..cdaf687 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
if (dev->chiptype == SI2157_CHIPTYPE_SI2146)
memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6);
else
-   memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6);
+   memcpy(cmd.args, "\x14\x00\x02\x07\x00\x00", 6);
+   cmd.args[4] = dev->if_port;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2157_cmd_execute(client, &cmd);
@@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client,
i2c_set_clientdata(client, dev);
dev->fe = cfg->fe;
dev->inversion = cfg->inversion;
+   dev->if_port = cfg->if_port;
dev->fw_loaded = false;
dev->chiptype = (u8)id->driver_data;
dev->if_frequency = 500; /* default value of property 0x0706 */
diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
index a564c4a..4db97ab 100644
--- a/drivers/media/tuners/si2157.h
+++ b/drivers/media/tuners/si2157.h
@@ -34,6 +34,12 @@ struct si2157_config {
 * Spectral Inversion
 */
bool inversion;
+
+   /*
+* Port selection
+* Select the RF interface to use (pins 9+11 or 12+13)
+*/
+   u8 if_port;
 };
 
 #endif
diff --git a/dr

[PATCH v3 2/6] dvbsky: use si2168 config option ts_clock_gapped

2015-05-03 Thread Olli Salonen
Change the dvbsky driver to support gapped clock instead of the current
hack.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index cdf59bc..0f73b1d 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -615,7 +615,8 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
memset(&si2168_config, 0, sizeof(si2168_config));
si2168_config.i2c_adapter = &i2c_adapter;
si2168_config.fe = &adap->fe[0];
-   si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_gapped = true;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2168", I2C_NAME_SIZE);
info.addr = 0x64;
-- 
1.9.1

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


[PATCH v3 1/6] si2168: add support for gapped clock

2015-05-03 Thread Olli Salonen
Add a parameter in si2168_config to support gapped clock. This might be 
necessary on
some devices with higher bitrates.

Signed-off-by: Olli Salonen 
---
 drivers/media/dvb-frontends/si2168.c  | 3 +++
 drivers/media/dvb-frontends/si2168.h  | 3 +++
 drivers/media/dvb-frontends/si2168_priv.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 5db588e..29a5936 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -508,6 +508,8 @@ static int si2168_init(struct dvb_frontend *fe)
/* set ts mode */
memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
cmd.args[4] |= dev->ts_mode;
+   if (dev->ts_clock_gapped)
+   cmd.args[4] |= 0x40;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2168_cmd_execute(client, &cmd);
@@ -688,6 +690,7 @@ static int si2168_probe(struct i2c_client *client,
*config->fe = &dev->fe;
dev->ts_mode = config->ts_mode;
dev->ts_clock_inv = config->ts_clock_inv;
+   dev->ts_clock_gapped = config->ts_clock_gapped;
dev->fw_loaded = false;
 
i2c_set_clientdata(client, dev);
diff --git a/drivers/media/dvb-frontends/si2168.h 
b/drivers/media/dvb-frontends/si2168.h
index 70d702a..3225d0c 100644
--- a/drivers/media/dvb-frontends/si2168.h
+++ b/drivers/media/dvb-frontends/si2168.h
@@ -42,6 +42,9 @@ struct si2168_config {
 
/* TS clock inverted */
bool ts_clock_inv;
+
+   /* TS clock gapped */
+   bool ts_clock_gapped;
 };
 
 #endif
diff --git a/drivers/media/dvb-frontends/si2168_priv.h 
b/drivers/media/dvb-frontends/si2168_priv.h
index d7efce8..d2589e3 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -38,6 +38,7 @@ struct si2168_dev {
bool fw_loaded;
u8 ts_mode;
bool ts_clock_inv;
+   bool ts_clock_gapped;
 };
 
 /* firmware command struct */
-- 
1.9.1

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


Re: issue with videobuf2-dma-sg.ko

2015-05-03 Thread Vincent McIntyre
On Sun, May 03, 2015 at 10:45:37AM +0200, Hans Verkuil wrote:
> Hi Vince,
> 
> On 05/03/2015 09:14 AM, Vincent McIntyre wrote:
> > Hi
> > 
> > I am trying to load the cx23885 module. It fails to load and I get this in 
> > dmesg;
> > 
> >   [  433.506983] videobuf2_dma_sg: Unknown symbol dma_buf_export (err 0)
> > 
> 
> Try again, I've hopefully fixed this problem. You need to do a git pull from 
> the
> media_build.git repo and that should solve it.
> 
> Let me know if you run into problems.
> 

That was quick work!
I rebuilt and the module is loading fine again, dmesg attached.
Thanks Hans
Vince



dmesg.txt.gz
Description: application/gunzip


Re: Kernel crash with dvb devices

2015-05-03 Thread Josu Lazkano
Thanks for the reply,

I am not sure if it is related to the TeVii.

Someone could say which device is crashing? I see [dib7000p] in the
call trace, maybe it could be "Hauppauge Nova-TD Stick (52009)"
device, it use "dvb_usb_dib0700" module.

Regards.

2015-05-03 13:03 GMT+02:00 crow :
> Hi,
> I don’t have S660 but the S650 and I have hat also kernel crash see on
> the link [1]. For this i am using an workaround inside grub (I am on
> Archlinux x86_64):
> /etc/default/grub:
> GRUB_CMDLINE_LINUX_DEFAULT="irqpoll ipv6.disable=1"
>
> With the irqpoll I don’t have crashes. Of course it would be great to
> fix this. Maybe it can help you to.
>
> [1] https://www.mail-archive.com/linux-media@vger.kernel.org/msg79486.html
>
> Regards,
>
> On Sat, May 2, 2015 at 11:55 AM, Josu Lazkano  wrote:
>> Hello list,
>>
>> I have some DVB devices in a MythTV backend:
>>
>> TeVii S660 USB
>> Hauppauge Nova-TD Stick (52009)
>> Avermedia Super 007
>>
>> The problems is that sometimes I got a kernel crash and I need to
>> reboot the machine. Here is a log: http://paste.debian.net/170723/
>>
>> Is this kernel/module/firmware problem?
>>
>> I am using Debian Jessie with 3.16.0-4-amd64 kernel.
>>
>> Thanks for your help.
>>
>> Best regards.
>>
>> --
>> Josu Lazkano
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To 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



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


Re: [PATCH 0/3] Add media bdisp driver for stihxxx platforms

2015-05-03 Thread Hans Verkuil
On 04/27/2015 06:25 PM, Hans Verkuil wrote:
> Hi Fabien,
> 
> Thank you for this driver! Good to see V4L2 support for this SoC.
> 
> I did a quick initial scan over the driver and there are a few things that
> need to be addressed:
> 
> - I think bdisp as the driver name is a bit generic, perhaps something like
>   stih4xx-bdisp might be more appropriate. Similar to the exynos-* drivers.
> 
> - Replace cropcap/g_crop/s_crop by the g/s_selection ioctls. The old ioctls
>   are no longer supported for new drivers (the v4l2 core will automatically
>   add support for those ioctls if g/s_selection is implemented in the driver).
>   Read careful how crop and compose rectangles are used in a m2m device. I
>   would expect that you implement cropping for the BUF_TYPE_VIDEO_OUTPUT side
>   (i.e. memory to hardware) and implement composing for the 
> BUF_TYPE_VIDEO_CAPTURE
>   side (i.e. hardware to memory).
> 
>   If the hardware also support composition for output or cropping for capture,
>   then let me know: in that case you will likely have to implement support for
>   V4L2_SEL_TGT_NATIVE_SIZE as well.
> 
> - Several ioctl and fop helpers were added to media/v4l2-mem2mem.h (e.g.
>   v4l2_m2m_ioctl_reqbufs, v4l2_m2m_fop_mmap, etc.). Use these instead of
>   rolling your own.

Two more comments:

- You can drop the desc field from struct bdisp_format: a patch was merged in
  media_tree.git that sets the VIDIOC_ENUM_FMT description in the v4l2 core,
  so it can be dropped from drivers.

- I noticed that you call video_device_release, but you shouldn't since struct
  video_device is embedded in a larger struct. video_device_release attempts
  to kfree the video_device, which obviously is wrong. Just remove that call.

Regards,

Hans

> 
> - I would like to see the output of these v4l2-compliance commands:
> 
>   v4l2-compliance
>   v4l2-compliance -s
>   v4l2-compliance -f
> 
>   In all fairness: mem2mem devices are not often tested using v4l2-compliance
>   and there may be problems testing this (-f will likely fail), but I still
>   like to see the output so I know what works and what doesn't.
> 
>   Please use the latest v4l2-compliance code from the v4l-utils.git 
> repository.
>   I won't accept the driver unless I see the results of these compliance 
> tests:
>   running this is required for new drivers since it is a great way of 
> verifying
>   the completeness of your driver.
> 
> Regards,
> 
>   Hans
> 
> On 04/27/2015 05:56 PM, Fabien Dessenne wrote:
>> This series of patches adds the support of v4l2 2D blitter driver for
>> STMicroelectronics SOC.
>>
>> The following features are supported and tested:
>> - Color format conversion (RGB32, RGB24, RGB16, NV12, YUV420P)
>> - Copy
>> - Scale
>> - Flip
>> - Deinterlace
>> - Wide (4K) picture support
>> - Crop
>>
>> This driver uses the v4l2 mem2mem framework and its implementation was 
>> largely
>> inspired by the Exynos G-Scaler (exynos-gsc) driver.
>>
>> The driver is mainly implemented across two files:
>> - bdisp-v4l2.c
>> - bdisp-hw.c
>> bdisp-v4l2.c uses v4l2_m2m to manage the V4L2 interface with the userland. It
>> calls the HW services that are implemented in bdisp-hw.c.
>>
>> The additional bdisp-debug.c file manages some debugfs entries.
>>
>> Fabien Dessenne (3):
>>   [media] bdisp: add DT bindings documentation
>>   [media] bdisp: 2D blitter driver using v4l2 mem2mem framework
>>   [media] bdisp: add debug file system
>>
>>  .../devicetree/bindings/media/st,stih4xx.txt   |   32 +
>>  drivers/media/platform/Kconfig |   10 +
>>  drivers/media/platform/Makefile|2 +
>>  drivers/media/platform/bdisp/Kconfig   |9 +
>>  drivers/media/platform/bdisp/Makefile  |3 +
>>  drivers/media/platform/bdisp/bdisp-debug.c |  668 +
>>  drivers/media/platform/bdisp/bdisp-filter.h|  346 +
>>  drivers/media/platform/bdisp/bdisp-hw.c|  823 +++
>>  drivers/media/platform/bdisp/bdisp-reg.h   |  235 +++
>>  drivers/media/platform/bdisp/bdisp-v4l2.c  | 1492 
>> 
>>  drivers/media/platform/bdisp/bdisp.h   |  220 +++
>>  11 files changed, 3840 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/media/st,stih4xx.txt
>>  create mode 100644 drivers/media/platform/bdisp/Kconfig
>>  create mode 100644 drivers/media/platform/bdisp/Makefile
>>  create mode 100644 drivers/media/platform/bdisp/bdisp-debug.c
>>  create mode 100644 drivers/media/platform/bdisp/bdisp-filter.h
>>  create mode 100644 drivers/media/platform/bdisp/bdisp-hw.c
>>  create mode 100644 drivers/media/platform/bdisp/bdisp-reg.h
>>  create mode 100644 drivers/media/platform/bdisp/bdisp-v4l2.c
>>  create mode 100644 drivers/media/platform/bdisp/bdisp.h
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majord

Re: Kernel crash with dvb devices

2015-05-03 Thread crow
Hi,
I don’t have S660 but the S650 and I have hat also kernel crash see on
the link [1]. For this i am using an workaround inside grub (I am on
Archlinux x86_64):
/etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="irqpoll ipv6.disable=1"

With the irqpoll I don’t have crashes. Of course it would be great to
fix this. Maybe it can help you to.

[1] https://www.mail-archive.com/linux-media@vger.kernel.org/msg79486.html

Regards,

On Sat, May 2, 2015 at 11:55 AM, Josu Lazkano  wrote:
> Hello list,
>
> I have some DVB devices in a MythTV backend:
>
> TeVii S660 USB
> Hauppauge Nova-TD Stick (52009)
> Avermedia Super 007
>
> The problems is that sometimes I got a kernel crash and I need to
> reboot the machine. Here is a log: http://paste.debian.net/170723/
>
> Is this kernel/module/firmware problem?
>
> I am using Debian Jessie with 3.16.0-4-amd64 kernel.
>
> Thanks for your help.
>
> Best regards.
>
> --
> Josu Lazkano
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 11/11] DocBook/media: add CEC documentation

2015-05-03 Thread Hans Verkuil
Some comments:

On 04/29/2015 12:02 PM, Kamil Debski wrote:
> From: Hans Verkuil 
> 
> Add DocBook documentation for the CEC API.
> 
> Signed-off-by: Hans Verkuil 
> [k.deb...@samsung.com: add documentation for passthrough mode]
> [k.deb...@samsung.com: minor fixes and change of reserved field sizes]
> Signed-off-by: Kamil Debski 
> ---
>  Documentation/DocBook/media/Makefile   |4 +-
>  Documentation/DocBook/media/v4l/biblio.xml |   10 +
>  Documentation/DocBook/media/v4l/cec-api.xml|   74 ++
>  Documentation/DocBook/media/v4l/cec-func-close.xml |   59 +
>  Documentation/DocBook/media/v4l/cec-func-ioctl.xml |   73 ++
>  Documentation/DocBook/media/v4l/cec-func-open.xml  |   94 +++
>  Documentation/DocBook/media/v4l/cec-func-poll.xml  |   89 +++
>  .../DocBook/media/v4l/cec-ioc-g-adap-log-addrs.xml |  275 
> 
>  .../DocBook/media/v4l/cec-ioc-g-adap-phys-addr.xml |   78 ++
>  .../DocBook/media/v4l/cec-ioc-g-adap-state.xml |   87 +++
>  Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml |  167 
>  .../DocBook/media/v4l/cec-ioc-g-event.xml  |  142 ++
>  .../DocBook/media/v4l/cec-ioc-g-vendor-id.xml  |   70 +
>  .../DocBook/media/v4l/cec-ioc-receive.xml  |  185 +
>  Documentation/DocBook/media_api.tmpl   |6 +-
>  15 files changed, 1410 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/DocBook/media/v4l/cec-api.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-func-close.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-func-ioctl.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-func-open.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-func-poll.xml
>  create mode 100644 
> Documentation/DocBook/media/v4l/cec-ioc-g-adap-log-addrs.xml
>  create mode 100644 
> Documentation/DocBook/media/v4l/cec-ioc-g-adap-phys-addr.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-adap-state.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-event.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-vendor-id.xml
>  create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-receive.xml
> 



> diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml 
> b/Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml



> +
> +  CEC Capabilities Flags
> +  
> + &cs-def;
> + 
> +   
> + CEC_CAP_STATE
> + 0x0001
> + Userspace has to configure the adapter state (enable or 
> disable it) by
> + calling &CEC-S-ADAP-STATE;.
> +   
> +   
> + CEC_CAP_PHYS_ADDR
> + 0x0002
> + Userspace has to configure the physical address by
> + calling &CEC-S-ADAP-PHYS-ADDR;.
> +   
> +   
> + CEC_CAP_LOG_ADDRS
> + 0x0004
> + Userspace has to configure the logical addresses by
> + calling &CEC-S-ADAP-LOG-ADDRS;.
> +   
> +   
> + CEC_CAP_TRANSMIT
> + 0x0008
> + Userspace can transmit messages by calling 
> &CEC-TRANSMIT;.
> +   
> +   
> + CEC_CAP_RECEIVE
> + 0x0010
> + Userspace can receive messages by calling 
> &CEC-RECEIVE;.
> +   
> +   
> + CEC_CAP_VENDOR_ID
> + 0x0020
> + Userspace has to configure the vendor ID by
> + calling &CEC-S-VENDOR-ID;.
> +   

CAP_PASSTHROUGH is missing here.

> + 
> +  
> +
> +  
> +
> +  
> +&return-value;
> +  
> +
> diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-event.xml 
> b/Documentation/DocBook/media/v4l/cec-ioc-g-event.xml
> new file mode 100644
> index 000..2b7e8e9
> --- /dev/null
> +++ b/Documentation/DocBook/media/v4l/cec-ioc-g-event.xml



> +  
> +Description
> +
> +CEC devices can send asynchronous events. These can be retrieved 
> by calling
> +the CEC_G_EVENT ioctl. If the file descriptor is in 
> non-blocking
> +mode and no event is pending, then it will return -1 and set errno to 
> the &EAGAIN;.

We should add something like this:

There can be up to 16 events queued up. If more events are added, then 
the oldest
event will be discarded.

I think we should increase the number of events to 40: given the speed of the 
bus (or lack
thereof) this should be more than sufficient provided the application will 
check events
at least once per second. The alternative would be to use a framework like 
v4l2_event, but
that is IMHO overkill for a bus like this.



> +
> +  CEC Events
> +  
> + &cs-def;
> + 
> +   
> + CEC_EVENT_CONNECT
> + 1
> + Generated when the HDMI cable is connected.
> +   
> +   
> + CEC_EVENT_READY
> + 2
> + Generated when all logical addresses are claimed.
> +   
> 

Re: [PATCH v5 06/11] cec: add HDMI CEC framework

2015-05-03 Thread Hans Verkuil
Hi Kamil,

Here is my review:

On 04/29/2015 12:02 PM, Kamil Debski wrote:
> From: Hans Verkuil 
> 
> The added HDMI CEC framework provides a generic kernel interface for
> HDMI CEC devices.
> 
> Signed-off-by: Hans Verkuil 
> [k.deb...@samsung.com: Merged CEC Updates commit by Hans Verkuil]
> [k.deb...@samsung.com: Merged Update author commit by Hans Verkuil]
> [k.deb...@samsung.com: change kthread handling when setting logical
> address]
> [k.deb...@samsung.com: code cleanup and fixes]
> [k.deb...@samsung.com: add missing CEC commands to match spec]
> [k.deb...@samsung.com: add RC framework support]
> [k.deb...@samsung.com: move and edit documentation]
> [k.deb...@samsung.com: add vendor id reporting]
> [k.deb...@samsung.com: add possibility to clear assigned logical
> addresses]
> [k.deb...@samsung.com: documentation fixes, clenaup and expansion]
> [k.deb...@samsung.com: reorder of API structs and add reserved fields]
> [k.deb...@samsung.com: fix handling of events and fix 32/64bit timespec
> problem]
> [k.deb...@samsung.com: add cec.h to include/uapi/linux/Kbuild]
> [k.deb...@samsung.com: add sequence number handling]
> [k.deb...@samsung.com: add passthrough mode]
> [k.deb...@samsung.com: fix CEC defines, add missing CEC 2.0 commands]
> [k.deb...@samsung.com: add DocBook documentation by Hans Verkuil, with
> minor additions]
> Signed-off-by: Kamil Debski 
> ---
>  Documentation/cec.txt |  396 +++
>  drivers/media/Kconfig |6 +
>  drivers/media/Makefile|2 +
>  drivers/media/cec.c   | 1200 
> +
>  include/media/cec.h   |  142 ++
>  include/uapi/linux/Kbuild |1 +
>  include/uapi/linux/cec.h  |  337 +
>  7 files changed, 2084 insertions(+)
>  create mode 100644 Documentation/cec.txt
>  create mode 100644 drivers/media/cec.c
>  create mode 100644 include/media/cec.h
>  create mode 100644 include/uapi/linux/cec.h
> 
> diff --git a/Documentation/cec.txt b/Documentation/cec.txt
> new file mode 100644
> index 000..2b6c08a
> --- /dev/null
> +++ b/Documentation/cec.txt



> +The following capabilities are defined:
> +
> +/* Userspace has to configure the adapter state (enable/disable) */
> +#define CEC_CAP_STATE(1 << 0)
> +/* Userspace has to configure the physical address */
> +#define CEC_CAP_PHYS_ADDR(1 << 1)
> +/* Userspace has to configure the logical addresses */
> +#define CEC_CAP_LOG_ADDRS(1 << 2)
> +/* Userspace can transmit messages */
> +#define CEC_CAP_TRANSMIT (1 << 3)
> +/* Userspace can receive messages */
> +#define CEC_CAP_RECEIVE  (1 << 4)
> +/* Userspace has to configure the vendor id */
> +#define CEC_CAP_VENDOR_ID(1 << 5)
> +/* The hardware has the possibility to work in the promiscuous mode */
> +#define CEC_CAP_PROMISCUOUS  (1 << 6)

CAP_PROMISCUOUS doesn't exist anymore, this can be removed.

Instead add the PASSTHROUGH capability.

Frankly, I wonder if this cec.txt document should document the userspace
API at all now that that is part of DocBook. I think it is better if it
only describes the kernel API and just refers to the DocBook for the
userspace parts.

CEC_G/S_PASSTHROUGH aren't described here as well, which only shows that
the userspace API should just be dropped.



> diff --git a/include/uapi/linux/cec.h b/include/uapi/linux/cec.h



> +/* The hardware has the possibility to work in the passthrough */

s/the passthrough/passthrough mode/

> +#define CEC_CAP_PASSTHROUGH  (1 << 6)



> +#define CEC_G_EVENT  _IOWR('a', 9, struct cec_event)
> +/*
> +   Read and set the vendor ID of the CEC adapter.
> + */
> +#define CEC_G_VENDOR_ID  _IOR('a', 9, __u32)

9 -> 10, same for the following ioctls, all need to be increased by 1
since current G_EVENT and G_VENDOR_ID have the same ioctl number.

> +#define CEC_S_VENDOR_ID  _IOW('a', 10, __u32)
> +/*
> +   Enable/disable the passthrough mode
> + */
> +#define CEC_G_PASSTHROUGH_IOR('a', 11, __u32)
> +#define CEC_S_PASSTHROUGH_IOW('a', 12, __u32)
> +
> +#endif
> 

Regards,

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


Re: [PATCH v3 1/1] V4L2: platform: Renesas R-Car JPEG codec driver

2015-05-03 Thread Hans Verkuil
Hi Mikhail,

Thank you for the patch!

I have one high-level comment: please rename the source to r-car-jpu.c. It's
good practice to start with the SoC name since 'jpu' by itself is not very
descriptive.

I have a few more comments (mostly easy ones) below:

On 04/29/2015 11:53 PM, Mikhail Ulyanov wrote:
> Here's the the driver for the Renesas R-Car JPEG processing unit driver.
> 
> The driver is implemented within the V4L2 framework as a mem-to-mem device.  
> It
> presents two video nodes to userspace, one for the encoding part, and one for
> the decoding part.
> 
> It was found that the only working mode for encoding is no markers output, so 
> we
> generate it with software. In current version of driver we also use software
> JPEG header parsing because with hardware parsing performance is lower then
> desired.
> 
> From a userspace point of view the encoding process is typical (S_FMT, REQBUF,
> optionally QUERYBUF, QBUF, STREAMON, DQBUF) for both the source and 
> destination
> queues. The decoding process requires that the source queue performs S_FMT,
> REQBUF, (QUERYBUF), QBUF and STREAMON. After STREAMON on the source queue, it 
> is
> possible to perform G_FMT on the destination queue to find out the processed
> image width and height in order to be able to allocate an appropriate buffer -
> it is assumed that the user does not pass the compressed image width and 
> height
> but instead this information is parsed from the JPEG input. This is done in
> kernel. Then REQBUF, QBUF and STREAMON on the destination queue complete the
> decoding and it is possible to DQBUF from both queues and finish the 
> operation.
> 
> During encoding the available formats are: V4L2_PIX_FMT_NV12M and
> V4L2_PIX_FMT_NV16M for source and V4L2_PIX_FMT_JPEG for destination.
> 
> During decoding the available formats are: V4L2_PIX_FMT_JPEG for source and
> V4L2_PIX_FMT_NV12M and V4L2_PIX_FMT_NV16M for destination.
> 
> Performance of current version:
> 1280x800 NV12 image encoding/decoding
>   decoding ~121 FPS
>   encoding ~190 FPS
> 
> Signed-off-by: Mikhail Ulyanov 
> ---
> Changes since v2:
> - Kconfig entry reordered
> - unnecessary clk_disable_unprepare(jpu->clk) removed
> - ref_count fixed in jpu_resume
> - enable DMABUF in src_vq->io_modes
> - remove jpu_s_priority jpu_g_priority
> - jpu_g_selection fixed
> - timeout in jpu_reset added and hardware reset reworked
> - remove unused macros
> - JPEG header parsing now is software because of performance issues
>   based on s5p-jpu code
> - JPEG header generation redesigned:
>   JPEG header(s) pre-generated and memcpy'ed on encoding
>   we only fill the necessary fields
>   more "transparent" header format description
> - S_FMT, G_FMT and TRY_FMT hooks redesigned
>   partially inspired by VSP1 driver code
> - some code was reformatted
> - image formats handling redesigned
> - multi-planar V4L2 API now in use
> - now passes v4l2-compliance tool check
> 
> Cnanges since v1:
> - s/g_fmt function simplified
> - default format for queues added
> - dumb vidioc functions added to be in compliance with standard api:
> jpu_s_priority, jpu_g_priority
> - standard v4l2_ctrl_subscribe_event and v4l2_event_unsubscribe
>   now in use by the same reason
> 
>  drivers/media/platform/Kconfig  |   11 +
>  drivers/media/platform/Makefile |1 +
>  drivers/media/platform/jpu.c| 1724 
> +++
>  3 files changed, 1736 insertions(+)
>  create mode 100644 drivers/media/platform/jpu.c
> 



> diff --git a/drivers/media/platform/jpu.c b/drivers/media/platform/jpu.c
> new file mode 100644
> index 000..6c658cc
> --- /dev/null
> +++ b/drivers/media/platform/jpu.c



> +/**
> + * struct jpu - JPEG IP abstraction
> + * @mutex: the mutex protecting this structure
> + * @lock: spinlock protecting the device contexts
> + * @v4l2_dev: v4l2 device for mem2mem mode
> + * @vfd_encoder: video device node for encoder mem2mem mode
> + * @vfd_decoder: video device node for decoder mem2mem mode
> + * @m2m_dev: v4l2 mem2mem device data
> + * @regs: JPEG IP registers mapping
> + * @irq: JPEG IP irq
> + * @clk: JPEG IP clock
> + * @dev: JPEG IP struct device
> + * @alloc_ctx: videobuf2 memory allocator's context
> + * @ref_counter: reference counter
> + */
> +struct jpu {
> + struct mutexmutex;
> + spinlock_t  lock;
> + struct v4l2_device  v4l2_dev;
> + struct video_device *vfd_encoder;
> + struct video_device *vfd_decoder;

Please just embed these video_device structs (so remove the '*'). This means
that the release callback of each video_device should be set to
video_device_release_empty() and that the video_device_alloc/release can be
removed.

The use of video_device_alloc/release is deprecated and will eventually
disappear.

> + struct v4l2_m2m_dev *m2m_dev;
> +
> + void __iomem*regs;
> +  

[PATCH 8/9] ov9740: avoid calling ov9740_res_roundup() twice

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

Simplify ov9740_s_fmt.

Signed-off-by: Hans Verkuil 
Reported-by: Guennadi Liakhovetski 
---
 drivers/media/i2c/soc_camera/ov9740.c | 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov9740.c 
b/drivers/media/i2c/soc_camera/ov9740.c
index 03a7fc7..61a8e18 100644
--- a/drivers/media/i2c/soc_camera/ov9740.c
+++ b/drivers/media/i2c/soc_camera/ov9740.c
@@ -673,20 +673,8 @@ static int ov9740_s_fmt(struct v4l2_subdev *sd,
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ov9740_priv *priv = to_ov9740(sd);
-   enum v4l2_colorspace cspace;
-   u32 code = mf->code;
int ret;
 
-   ov9740_res_roundup(&mf->width, &mf->height);
-
-   switch (code) {
-   case MEDIA_BUS_FMT_YUYV8_2X8:
-   cspace = V4L2_COLORSPACE_SRGB;
-   break;
-   default:
-   return -EINVAL;
-   }
-
ret = ov9740_reg_write_array(client, ov9740_defaults,
 ARRAY_SIZE(ov9740_defaults));
if (ret < 0)
@@ -696,11 +684,7 @@ static int ov9740_s_fmt(struct v4l2_subdev *sd,
if (ret < 0)
return ret;
 
-   mf->code= code;
-   mf->colorspace  = cspace;
-
-   memcpy(&priv->current_mf, mf, sizeof(struct v4l2_mbus_framefmt));
-
+   priv->current_mf = *mf;
return ret;
 }
 
-- 
2.1.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 9/9] mt9t112: initialize left and top

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

The left and top variables were uninitialized, leading to unexpected
results.

Signed-off-by: Hans Verkuil 
---
 drivers/media/i2c/soc_camera/mt9t112.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/soc_camera/mt9t112.c 
b/drivers/media/i2c/soc_camera/mt9t112.c
index de10a76..02190d6 100644
--- a/drivers/media/i2c/soc_camera/mt9t112.c
+++ b/drivers/media/i2c/soc_camera/mt9t112.c
@@ -952,7 +952,8 @@ static int mt9t112_set_fmt(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *mf = &format->format;
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct mt9t112_priv *priv = to_mt9t112(client);
-   unsigned int top, left;
+   unsigned int top = priv->frame.top;
+   unsigned int left = priv->frame.left;
int i;
 
if (format->pad)
-- 
2.1.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 6/9] ov772x: avoid calling ov772x_select_params() twice

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

Merge ov772x_s_fmt into ov772x_set_fmt.

Signed-off-by: Hans Verkuil 
Reported-by: Guennadi Liakhovetski 
---
 drivers/media/i2c/soc_camera/ov772x.c | 41 +++
 1 file changed, 13 insertions(+), 28 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov772x.c 
b/drivers/media/i2c/soc_camera/ov772x.c
index f150a8b..aa32bc5 100644
--- a/drivers/media/i2c/soc_camera/ov772x.c
+++ b/drivers/media/i2c/soc_camera/ov772x.c
@@ -895,38 +895,15 @@ static int ov772x_get_fmt(struct v4l2_subdev *sd,
return 0;
 }
 
-static int ov772x_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
-{
-   struct ov772x_priv *priv = to_ov772x(sd);
-   const struct ov772x_color_format *cfmt;
-   const struct ov772x_win_size *win;
-   int ret;
-
-   ov772x_select_params(mf, &cfmt, &win);
-
-   ret = ov772x_set_params(priv, cfmt, win);
-   if (ret < 0)
-   return ret;
-
-   priv->win = win;
-   priv->cfmt = cfmt;
-
-   mf->code = cfmt->code;
-   mf->width = win->rect.width;
-   mf->height = win->rect.height;
-   mf->field = V4L2_FIELD_NONE;
-   mf->colorspace = cfmt->colorspace;
-
-   return 0;
-}
-
 static int ov772x_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *format)
 {
+   struct ov772x_priv *priv = to_ov772x(sd);
struct v4l2_mbus_framefmt *mf = &format->format;
const struct ov772x_color_format *cfmt;
const struct ov772x_win_size *win;
+   int ret;
 
if (format->pad)
return -EINVAL;
@@ -939,9 +916,17 @@ static int ov772x_set_fmt(struct v4l2_subdev *sd,
mf->field = V4L2_FIELD_NONE;
mf->colorspace = cfmt->colorspace;
 
-   if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-   return ov772x_s_fmt(sd, mf);
-   cfg->try_fmt = *mf;
+   if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
+   cfg->try_fmt = *mf;
+   return 0;
+   }
+
+   ret = ov772x_set_params(priv, cfmt, win);
+   if (ret < 0)
+   return ret;
+
+   priv->win = win;
+   priv->cfmt = cfmt;
return 0;
 }
 
-- 
2.1.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 5/9] ov5642: avoid calling ov5642_find_datafmt() twice

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

Simplify ov5642_set_fmt().

Signed-off-by: Hans Verkuil 
Reported-by: Guennadi Liakhovetski 
---
 drivers/media/i2c/soc_camera/ov5642.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov5642.c 
b/drivers/media/i2c/soc_camera/ov5642.c
index bab9ac0..061fca3 100644
--- a/drivers/media/i2c/soc_camera/ov5642.c
+++ b/drivers/media/i2c/soc_camera/ov5642.c
@@ -804,14 +804,15 @@ static int ov5642_set_fmt(struct v4l2_subdev *sd,
if (!fmt) {
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return -EINVAL;
-   mf->code= ov5642_colour_fmts[0].code;
-   mf->colorspace  = ov5642_colour_fmts[0].colorspace;
+   fmt = ov5642_colour_fmts;
+   mf->code = fmt->code;
+   mf->colorspace = fmt->colorspace;
}
 
mf->field   = V4L2_FIELD_NONE;
 
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-   priv->fmt = ov5642_find_datafmt(mf->code);
+   priv->fmt = fmt;
else
cfg->try_fmt = *mf;
return 0;
-- 
2.1.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 7/9] ov9640: avoid calling ov9640_res_roundup() twice

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

Simplify ov9640_s_fmt and ov9640_set_fmt

Signed-off-by: Hans Verkuil 
Reported-by: Guennadi Liakhovetski 
---
 drivers/media/i2c/soc_camera/ov9640.c | 24 +++-
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov9640.c 
b/drivers/media/i2c/soc_camera/ov9640.c
index 8caae1c..c8ac41e 100644
--- a/drivers/media/i2c/soc_camera/ov9640.c
+++ b/drivers/media/i2c/soc_camera/ov9640.c
@@ -486,11 +486,8 @@ static int ov9640_s_fmt(struct v4l2_subdev *sd,
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ov9640_reg_alt alts = {0};
-   enum v4l2_colorspace cspace;
-   u32 code = mf->code;
int ret;
 
-   ov9640_res_roundup(&mf->width, &mf->height);
ov9640_alter_regs(mf->code, &alts);
 
ov9640_reset(client);
@@ -499,24 +496,7 @@ static int ov9640_s_fmt(struct v4l2_subdev *sd,
if (ret)
return ret;
 
-   switch (code) {
-   case MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE:
-   case MEDIA_BUS_FMT_RGB565_2X8_LE:
-   cspace = V4L2_COLORSPACE_SRGB;
-   break;
-   default:
-   code = MEDIA_BUS_FMT_UYVY8_2X8;
-   case MEDIA_BUS_FMT_UYVY8_2X8:
-   cspace = V4L2_COLORSPACE_JPEG;
-   }
-
-   ret = ov9640_write_regs(client, mf->width, code, &alts);
-   if (!ret) {
-   mf->code= code;
-   mf->colorspace  = cspace;
-   }
-
-   return ret;
+   return ov9640_write_regs(client, mf->width, mf->code, &alts);
 }
 
 static int ov9640_set_fmt(struct v4l2_subdev *sd,
@@ -539,8 +519,10 @@ static int ov9640_set_fmt(struct v4l2_subdev *sd,
break;
default:
mf->code = MEDIA_BUS_FMT_UYVY8_2X8;
+   /* fall through */
case MEDIA_BUS_FMT_UYVY8_2X8:
mf->colorspace = V4L2_COLORSPACE_JPEG;
+   break;
}
 
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-- 
2.1.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 4/9] ov2640: avoid calling ov2640_select_win() twice

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

Simplify ov2640_set_params and ov2640_set_fmt.

Signed-off-by: Hans Verkuil 
Reported-by: Guennadi Liakhovetski 
---
 drivers/media/i2c/soc_camera/ov2640.c | 21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov2640.c 
b/drivers/media/i2c/soc_camera/ov2640.c
index 9b4f5de..5dcaf24 100644
--- a/drivers/media/i2c/soc_camera/ov2640.c
+++ b/drivers/media/i2c/soc_camera/ov2640.c
@@ -769,15 +769,15 @@ static const struct ov2640_win_size 
*ov2640_select_win(u32 *width, u32 *height)
return &ov2640_supported_win_sizes[default_size];
 }
 
-static int ov2640_set_params(struct i2c_client *client, u32 *width, u32 
*height,
-u32 code)
+static int ov2640_set_params(struct i2c_client *client,
+const struct ov2640_win_size *win, u32 code)
 {
struct ov2640_priv   *priv = to_ov2640(client);
const struct regval_list *selected_cfmt_regs;
int ret;
 
/* select win */
-   priv->win = ov2640_select_win(width, height);
+   priv->win = win;
 
/* select format */
priv->cfmt_code = 0;
@@ -798,6 +798,7 @@ static int ov2640_set_params(struct i2c_client *client, u32 
*width, u32 *height,
case MEDIA_BUS_FMT_UYVY8_2X8:
dev_dbg(&client->dev, "%s: Selected cfmt UYVY", __func__);
selected_cfmt_regs = ov2640_uyvy_regs;
+   break;
}
 
/* reset hardware */
@@ -832,8 +833,6 @@ static int ov2640_set_params(struct i2c_client *client, u32 
*width, u32 *height,
goto err;
 
priv->cfmt_code = code;
-   *width = priv->win->width;
-   *height = priv->win->height;
 
return 0;
 
@@ -887,14 +886,13 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
 {
struct v4l2_mbus_framefmt *mf = &format->format;
struct i2c_client *client = v4l2_get_subdevdata(sd);
+   const struct ov2640_win_size *win;
 
if (format->pad)
return -EINVAL;
 
-   /*
-* select suitable win, but don't store it
-*/
-   ov2640_select_win(&mf->width, &mf->height);
+   /* select suitable win */
+   win = ov2640_select_win(&mf->width, &mf->height);
 
mf->field   = V4L2_FIELD_NONE;
 
@@ -905,14 +903,15 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
break;
default:
mf->code = MEDIA_BUS_FMT_UYVY8_2X8;
+   /* fall through */
case MEDIA_BUS_FMT_YUYV8_2X8:
case MEDIA_BUS_FMT_UYVY8_2X8:
mf->colorspace = V4L2_COLORSPACE_JPEG;
+   break;
}
 
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-   return ov2640_set_params(client, &mf->width,
-&mf->height, mf->code);
+   return ov2640_set_params(client, win, mf->code);
cfg->try_fmt = *mf;
return 0;
 }
-- 
2.1.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 3/9] mt9v022: avoid calling mt9v022_find_datafmt() twice

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

Simplify mt9v022_s_fmt and mt9v022_set_fmt.

Signed-off-by: Hans Verkuil 
Reported-by: Guennadi Liakhovetski 
---
 drivers/media/i2c/soc_camera/mt9v022.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/mt9v022.c 
b/drivers/media/i2c/soc_camera/mt9v022.c
index f313774..00516bf 100644
--- a/drivers/media/i2c/soc_camera/mt9v022.c
+++ b/drivers/media/i2c/soc_camera/mt9v022.c
@@ -396,6 +396,7 @@ static int mt9v022_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int mt9v022_s_fmt(struct v4l2_subdev *sd,
+const struct mt9v022_datafmt *fmt,
 struct v4l2_mbus_framefmt *mf)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -434,9 +435,8 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd,
if (!ret) {
mf->width   = mt9v022->rect.width;
mf->height  = mt9v022->rect.height;
-   mt9v022->fmt= mt9v022_find_datafmt(mf->code,
-   mt9v022->fmts, mt9v022->num_fmts);
-   mf->colorspace  = mt9v022->fmt->colorspace;
+   mt9v022->fmt= fmt;
+   mf->colorspace  = fmt->colorspace;
}
 
return ret;
@@ -471,7 +471,7 @@ static int mt9v022_set_fmt(struct v4l2_subdev *sd,
mf->colorspace  = fmt->colorspace;
 
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-   return mt9v022_s_fmt(sd, mf);
+   return mt9v022_s_fmt(sd, fmt, mf);
cfg->try_fmt = *mf;
return 0;
 }
-- 
2.1.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 2/9] mt9m001: avoid calling mt9m001_find_datafmt() twice

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

Simplify mt9m001_s_fmt and mt9m001_set_fmt.

Signed-off-by: Hans Verkuil 
Reported-by: Guennadi Liakhovetski 
---
 drivers/media/i2c/soc_camera/mt9m001.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/mt9m001.c 
b/drivers/media/i2c/soc_camera/mt9m001.c
index 4fbdd1e..1f49140 100644
--- a/drivers/media/i2c/soc_camera/mt9m001.c
+++ b/drivers/media/i2c/soc_camera/mt9m001.c
@@ -271,6 +271,7 @@ static int mt9m001_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int mt9m001_s_fmt(struct v4l2_subdev *sd,
+const struct mt9m001_datafmt *fmt,
 struct v4l2_mbus_framefmt *mf)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -290,9 +291,8 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd,
if (!ret) {
mf->width   = mt9m001->rect.width;
mf->height  = mt9m001->rect.height;
-   mt9m001->fmt= mt9m001_find_datafmt(mf->code,
-   mt9m001->fmts, mt9m001->num_fmts);
-   mf->colorspace  = mt9m001->fmt->colorspace;
+   mt9m001->fmt= fmt;
+   mf->colorspace  = fmt->colorspace;
}
 
return ret;
@@ -328,7 +328,7 @@ static int mt9m001_set_fmt(struct v4l2_subdev *sd,
mf->colorspace  = fmt->colorspace;
 
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-   return mt9m001_s_fmt(sd, mf);
+   return mt9m001_s_fmt(sd, fmt, mf);
cfg->try_fmt = *mf;
return 0;
 }
-- 
2.1.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 1/9] imx074: don't call imx074_find_datafmt() twice

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

Simplify imx074_set_fmt().

Signed-off-by: Hans Verkuil 
Reported-by: Guennadi Liakhovetski 
---
 drivers/media/i2c/soc_camera/imx074.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/imx074.c 
b/drivers/media/i2c/soc_camera/imx074.c
index f68c235..4226f06 100644
--- a/drivers/media/i2c/soc_camera/imx074.c
+++ b/drivers/media/i2c/soc_camera/imx074.c
@@ -171,8 +171,9 @@ static int imx074_set_fmt(struct v4l2_subdev *sd,
/* MIPI CSI could have changed the format, double-check */
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return -EINVAL;
-   mf->code= imx074_colour_fmts[0].code;
-   mf->colorspace  = imx074_colour_fmts[0].colorspace;
+   fmt = imx074_colour_fmts;
+   mf->code = fmt->code;
+   mf->colorspace = fmt->colorspace;
}
 
mf->width   = IMX074_WIDTH;
@@ -180,7 +181,7 @@ static int imx074_set_fmt(struct v4l2_subdev *sd,
mf->field   = V4L2_FIELD_NONE;
 
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-   priv->fmt = imx074_find_datafmt(mf->code);
+   priv->fmt = fmt;
else
cfg->try_fmt = *mf;
 
-- 
2.1.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 0/9] soc-camera sensor improvements

2015-05-03 Thread Hans Verkuil
From: Hans Verkuil 

As per Guennadi's suggestions, improve the code of various soc-camera sensor
drivers to avoid duplicating code.

Note that the mt9t112 issue is something I discovered and that has been there
from before my recent patches that removed the old video ops.

Also note that that is the only driver that Guennadi commented upon ("Now
mt9t112_frame_check() will be called twice in the .s_mbus_fmt() case.") that
I did not change: this driver is more complex than the others and I did not
see an easy way of changing this.

I might tackle that one later as I actually have hardware with this sensor.

Regards,

Hans

Hans Verkuil (9):
  imx074: don't call imx074_find_datafmt() twice
  mt9m001: avoid calling mt9m001_find_datafmt() twice
  mt9v022: avoid calling mt9v022_find_datafmt() twice
  ov2640: avoid calling ov2640_select_win() twice
  ov5642: avoid calling ov5642_find_datafmt() twice
  ov772x: avoid calling ov772x_select_params() twice
  ov9640: avoid calling ov9640_res_roundup() twice
  ov9740: avoid calling ov9740_res_roundup() twice
  mt9t112: initialize left and top

 drivers/media/i2c/soc_camera/imx074.c  |  7 +++---
 drivers/media/i2c/soc_camera/mt9m001.c |  8 +++
 drivers/media/i2c/soc_camera/mt9t112.c |  3 ++-
 drivers/media/i2c/soc_camera/mt9v022.c |  8 +++
 drivers/media/i2c/soc_camera/ov2640.c  | 21 +
 drivers/media/i2c/soc_camera/ov5642.c  |  7 +++---
 drivers/media/i2c/soc_camera/ov772x.c  | 41 +++---
 drivers/media/i2c/soc_camera/ov9640.c  | 24 +++-
 drivers/media/i2c/soc_camera/ov9740.c  | 18 +--
 9 files changed, 45 insertions(+), 92 deletions(-)

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


Re: issue with videobuf2-dma-sg.ko

2015-05-03 Thread Hans Verkuil
Hi Vince,

On 05/03/2015 09:14 AM, Vincent McIntyre wrote:
> Hi
> 
> I am trying to load the cx23885 module. It fails to load and I get this in 
> dmesg;
> 
>   [  433.506983] videobuf2_dma_sg: Unknown symbol dma_buf_export (err 0)
> 
> I wrote a small script to load each of the dependencies one at a time,
> which shows pretty clearly the problem is videobuf2-dma-sg.ko.
> 
> I am up to date with the media_tree:
>   $ git log |head
>   commit 59366d3bbae4f67ae3b3a32696faa0798cef1b67
>   Author: Hans Verkuil 
>   Date:   Sat May 2 10:41:49 2015 +0200
> 
>   v4l/compat.h: fix compiler warning
> 
>   In file included from :0:0:
>   v4l/compat.h:1605:11: warning: 'struct device_node' declared inside 
> parameter list
>  u64 *out_values, size_t sz)
> ^
> 
> Can anyone point out how to fix this?
> What other information would be useful?

Try again, I've hopefully fixed this problem. You need to do a git pull from the
media_build.git repo and that should solve it.

Let me know if you run into problems.

Regards,

Hans

> Cheers
> Vince
> 
> System details
> 
>   $ uname -a
>   Linux ubuntu 3.13.0-51-generic #84-Ubuntu SMP Wed Apr 15 12:11:46 UTC 2015 
> i686 i686 i686 GNU/Linux
>   
>   $ sudo sh load.sh
>   videobuf2_core 3
>   videodev 2
>   rc_core 1
>   altera_ci 0
>   modprobe -v altera_ci
>   insmod 
> /lib/modules/3.13.0-51-generic/kernel/drivers/media/pci/cx23885/altera-ci.ko
>   v4l2_common 2
>   snd_pcm 4
>   snd 17
>   tveeprom 0
>   modprobe -v tveeprom
>   insmod 
> /lib/modules/3.13.0-51-generic/kernel/drivers/media/common/tveeprom.ko
>   cx2341x 0
>   modprobe -v cx2341x
>   insmod /lib/modules/3.13.0-51-generic/kernel/drivers/media/common/cx2341x.ko
>   videobuf2_dma_sg 0
>   modprobe -v videobuf2_dma_sg
>   insmod 
> /lib/modules/3.13.0-51-generic/kernel/drivers/media/v4l2-core/videobuf2-dma-sg.ko
>   modprobe: ERROR: could not insert 'videobuf2_dma_sg': Unknown symbol in 
> module, or unknown parameter (see dmesg)
>   videobuf2_dvb 0
>   modprobe -v videobuf2_dvb
>   insmod 
> /lib/modules/3.13.0-51-generic/kernel/drivers/media/v4l2-core/videobuf2-dvb.ko
>   dvb_core 2
>   tda18271 0
>   modprobe -v tda18271
>   insmod 
> /lib/modules/3.13.0-51-generic/kernel/drivers/media/tuners/tda18271.ko
>   altera_stapl 0
>   modprobe -v altera_stapl
>   insmod 
> /lib/modules/3.13.0-51-generic/kernel/drivers/misc/altera-stapl/altera-stapl.ko
>   cx23885 0
>   modprobe -v cx23885
>   insmod 
> /lib/modules/3.13.0-51-generic/kernel/drivers/media/v4l2-core/videobuf2-dma-sg.ko
>   modprobe: ERROR: could not insert 'cx23885': Unknown symbol in module, or 
> unknown parameter (see dmesg)
>   
>   $ dmesg|tail
>   [   38.177893] nvidia :01:00.0: irq 43 for MSI/MSI-X
>   [   39.350957] init: plymouth-upstart-bridge main process ended, respawning
>   [   39.390535] init: plymouth-upstart-bridge main process (1381) terminated 
> with status 1
>   [   39.390563] init: plymouth-upstart-bridge main process ended, respawning
>   [   56.994291] audit_printk_skb: 123 callbacks suppressed
>   [   56.994298] type=1400 audit(1430633192.185:74): apparmor="STATUS" 
> operation="profile_replace" profile="unconfined" 
> name="/usr/lib/cups/backend/cups-pdf" pid=2295 comm="apparmor_parser"
>   [   56.994310] type=1400 audit(1430633192.185:75): apparmor="STATUS" 
> operation="profile_replace" profile="unconfined" name="/usr/sbin/cupsd" 
> pid=2295 comm="apparmor_parser"
>   [   56.994991] type=1400 audit(1430633192.185:76): apparmor="STATUS" 
> operation="profile_replace" profile="unconfined" name="/usr/sbin/cupsd" 
> pid=2295 comm="apparmor_parser"
>   [  122.119702] videobuf2_dma_sg: Unknown symbol dma_buf_export (err 0)
>   [  122.243021] videobuf2_dma_sg: Unknown symbol dma_buf_export (err 0)
>   
>   
>   
>   $ cat load.sh
>   #!/bin/sh
>   for m in videobuf2_core videodev rc_core altera_ci v4l2_common snd_pcm snd 
> tveeprom cx2341x videobuf2_dma_sg videobuf2_dvb dvb_core tda18271 
> altera_stapl cx23885
>   do
>   n=`lsmod|grep -F $m -c`
>   echo $m $n
>   [ $n -eq 0 ] || continue
>   echo modprobe -v $m
>   modprobe -v $m
>   done
>   
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To 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: Mystique SaTiX-S2 Sky V2 USB (DVBSKY S960 clone) - Linux driver.

2015-05-03 Thread Olli Salonen
Hi Steve,

I've got the device in question and can confirm that it works ok.

lsusb definitely should work ok - maybe there's indeed something wrong
with your device. As suggested by P. van Gaans, maybe you can try your
device on another computer or even on Windows and see if it works
there.

Cheers,
-olli


On 2 May 2015 at 03:32, P. van Gaans  wrote:
> On 05/01/2015 04:57 PM, Steve wrote:
>>
>> Hi,
>>
>> I'm trying a direct mail to you as you are associated with this page:
>>
>>  http://linuxtv.org/wiki/index.php/DVB-S2_USB_Devices
>>
>> I have bought a Mystique SaTiX-S2 Sky V2 USB (DVBSKY S960 clone) - but
>> it doesn't work with my 3.19 kernel, which I'd assumed it would from the
>> above page.
>>
>> I've tried asking about the problem in various ways - first to
>> "AskUbuntu":
>>
>>
>> http://askubuntu.com/questions/613406/absent-frontend0-with-usb-dvbsky-s960-s860-driver-bug
>>
>>
>> ... and, more recently, on the Linux-Media mailing list.  Without
>> convincing myself that I've contacted the right person/people to give
>> constructive feedback.
>>
>> By any chance can you offer me some advice about who it is best to
>> approach?  (Obviously I'd also be grateful if you can shed any light on
>> this problem.)
>>
>> Steve
>>
>>
>
> Hi Steve,
>
> The page actually states "Support in-kernel is expected in Linux kernel
> 3.18.". Devil's advocate, but it doesn't say it's actually there or
> guarantees it ever will. At the time it was written, 3.18 wasn't out yet.
> Looking at your dmesg output however it seems your kernel is aware of the
> device. (so the patch made it) As for me, I was offered a bargain for
> another device so I have no S960.
>
> Linux-media mailing list is the right place. (and here we are) A few quick
> suggestions:
>
> Did you really, really, really get the right firmware and are you absolutely
> positive it's in the right location and has the right filename? Does dmesg
> mention the firmware being loaded?
>
> Get/compile the latest v4l-dvb sources.
> (http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers)
> Maybe it's just a bug that has already been fixed.
>
> Try another program to access the device. But if even lsusb hangs, this is
> pretty much moot.
>
> Make sure the power supply/device is functioning properly. Try it on another
> OS to make sure it's not defective.
>
> Try another computer, preferably with another chipset. If your RAM is faulty
> or you have a funky USB-controller, you can experience strange problems.
>
> Good luck!
>
> Best regards,
>
> P. van Gaans
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To 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


issue with videobuf2-dma-sg.ko

2015-05-03 Thread Vincent McIntyre
Hi

I am trying to load the cx23885 module. It fails to load and I get this in 
dmesg;

  [  433.506983] videobuf2_dma_sg: Unknown symbol dma_buf_export (err 0)

I wrote a small script to load each of the dependencies one at a time,
which shows pretty clearly the problem is videobuf2-dma-sg.ko.

I am up to date with the media_tree:
  $ git log |head
  commit 59366d3bbae4f67ae3b3a32696faa0798cef1b67
  Author: Hans Verkuil 
  Date:   Sat May 2 10:41:49 2015 +0200

  v4l/compat.h: fix compiler warning

  In file included from :0:0:
  v4l/compat.h:1605:11: warning: 'struct device_node' declared inside 
parameter list
 u64 *out_values, size_t sz)
  ^

Can anyone point out how to fix this?
What other information would be useful?
Cheers
Vince

System details

  $ uname -a
  Linux ubuntu 3.13.0-51-generic #84-Ubuntu SMP Wed Apr 15 12:11:46 UTC 2015 
i686 i686 i686 GNU/Linux
  
  $ sudo sh load.sh
  videobuf2_core 3
  videodev 2
  rc_core 1
  altera_ci 0
  modprobe -v altera_ci
  insmod 
/lib/modules/3.13.0-51-generic/kernel/drivers/media/pci/cx23885/altera-ci.ko
  v4l2_common 2
  snd_pcm 4
  snd 17
  tveeprom 0
  modprobe -v tveeprom
  insmod /lib/modules/3.13.0-51-generic/kernel/drivers/media/common/tveeprom.ko
  cx2341x 0
  modprobe -v cx2341x
  insmod /lib/modules/3.13.0-51-generic/kernel/drivers/media/common/cx2341x.ko
  videobuf2_dma_sg 0
  modprobe -v videobuf2_dma_sg
  insmod 
/lib/modules/3.13.0-51-generic/kernel/drivers/media/v4l2-core/videobuf2-dma-sg.ko
  modprobe: ERROR: could not insert 'videobuf2_dma_sg': Unknown symbol in 
module, or unknown parameter (see dmesg)
  videobuf2_dvb 0
  modprobe -v videobuf2_dvb
  insmod 
/lib/modules/3.13.0-51-generic/kernel/drivers/media/v4l2-core/videobuf2-dvb.ko
  dvb_core 2
  tda18271 0
  modprobe -v tda18271
  insmod /lib/modules/3.13.0-51-generic/kernel/drivers/media/tuners/tda18271.ko
  altera_stapl 0
  modprobe -v altera_stapl
  insmod 
/lib/modules/3.13.0-51-generic/kernel/drivers/misc/altera-stapl/altera-stapl.ko
  cx23885 0
  modprobe -v cx23885
  insmod 
/lib/modules/3.13.0-51-generic/kernel/drivers/media/v4l2-core/videobuf2-dma-sg.ko
  modprobe: ERROR: could not insert 'cx23885': Unknown symbol in module, or 
unknown parameter (see dmesg)
  
  $ dmesg|tail
  [   38.177893] nvidia :01:00.0: irq 43 for MSI/MSI-X
  [   39.350957] init: plymouth-upstart-bridge main process ended, respawning
  [   39.390535] init: plymouth-upstart-bridge main process (1381) terminated 
with status 1
  [   39.390563] init: plymouth-upstart-bridge main process ended, respawning
  [   56.994291] audit_printk_skb: 123 callbacks suppressed
  [   56.994298] type=1400 audit(1430633192.185:74): apparmor="STATUS" 
operation="profile_replace" profile="unconfined" 
name="/usr/lib/cups/backend/cups-pdf" pid=2295 comm="apparmor_parser"
  [   56.994310] type=1400 audit(1430633192.185:75): apparmor="STATUS" 
operation="profile_replace" profile="unconfined" name="/usr/sbin/cupsd" 
pid=2295 comm="apparmor_parser"
  [   56.994991] type=1400 audit(1430633192.185:76): apparmor="STATUS" 
operation="profile_replace" profile="unconfined" name="/usr/sbin/cupsd" 
pid=2295 comm="apparmor_parser"
  [  122.119702] videobuf2_dma_sg: Unknown symbol dma_buf_export (err 0)
  [  122.243021] videobuf2_dma_sg: Unknown symbol dma_buf_export (err 0)
  
  
  
  $ cat load.sh
  #!/bin/sh
  for m in videobuf2_core videodev rc_core altera_ci v4l2_common snd_pcm snd 
tveeprom cx2341x videobuf2_dma_sg videobuf2_dvb dvb_core tda18271 altera_stapl 
cx23885
  do
  n=`lsmod|grep -F $m -c`
  echo $m $n
  [ $n -eq 0 ] || continue
  echo modprobe -v $m
  modprobe -v $m
  done
  
--
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