cron job: media_tree daily build: OK

2015-07-31 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:   Sat Aug  1 04:00:19 CEST 2015
git branch: test
git hash:   4dc102b2f53d63207fa12a6ad49c7b6448bc3301
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-51-ga53cea2
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-3.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin-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: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.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: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-rc1-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.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: OK
linux-4.1.1-x86_64: OK
linux-4.2-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.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] vb2: revert: vb2: allow requeuing buffers while streaming

2015-07-31 Thread Antti Palosaari

Moikka!

On 07/31/2015 05:43 PM, Sakari Ailus wrote:

Terve,

On Wed, Jul 29, 2015 at 06:29:05PM +0300, Antti Palosaari wrote:

commit ce0eff016f7272faa6dc6eec722b1ca1970ff9aa
[media] vb2: allow requeuing buffers while streaming

That commit causes buf_queue() called on infinity loop when
start_streaming() returns error. On that case resources are eaten
quickly and machine crashes.

Cc: Hans Verkuil 
Signed-off-by: Antti Palosaari 


Fixed by this patch in media-fixes:

commit 6d058c5643e16779ae4c001d2e893c140940e48f
Author: Sakari Ailus 
Date:   Fri Jul 3 04:37:07 2015 -0300

 [media] vb2: Only requeue buffers immediately once streaming is started

 Buffers can be returned back to videobuf2 in driver's streamon handler. In
 this case vb2_buffer_done() with buffer state VB2_BUF_STATE_QUEUED will
 cause the driver's buf_queue vb2 operation to be called, queueing the same
 buffer again only to be returned to videobuf2 using vb2_buffer_done() and 
so
 on.

 Add a new buffer state VB2_BUF_STATE_REQUEUEING which, when used as the
 state argument to vb2_buffer_done(), will result in buffers queued to the
 driver. Using VB2_BUF_STATE_QUEUED will leave the buffer to videobuf2, as 
it
 was before "[media] vb2: allow requeuing buffers while streaming".

 Fixes: ce0eff016f72 ("[media] vb2: allow requeuing buffers while 
streaming")

 [mche...@osg.samsung.com: fix warning: enumeration value 
'VB2_BUF_STATE_REQUEUEING' not handled in switch]

 Signed-off-by: Sakari Ailus 
 Acked-by: Hans Verkuil 
 Cc: sta...@vger.kernel.org # for v4.1
 Signed-off-by: Mauro Carvalho Chehab 



I wonder why this fix is not included to media master yet, but only 
fixes... It is not first time such happens. I wasted a lot of time when 
I tried implement receiver / transmitter blocking to hackrf driver 
start_streaming and it crashes machine always, lets say 15 times, until 
I started suspect issue might be somewhere else than driver.


Anyhow, you could crash machine easily with that bug using vivid driver 
error injection option

v4l2-ctl -d /dev/video0 -c inject_vidioc_streamon_error=1

regards
Antti

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


Re: [PATCH] [media] vmc: Virtual Media Controller core, capture and sensor

2015-07-31 Thread Helen Fornazier
Hi,

On Fri, Jul 24, 2015 at 10:35 AM, Hans Verkuil  wrote:
> Hi Helen,
>
> Thank you for creating this driver! Much appreciated!

Thank you for your review

>
> I do have some comments, see my notes below...
>
> On 07/18/2015 04:42 PM, Helen Fornazier wrote:
>> First version of the Virtual Media Controller.
>> Add a simple version of the core of the driver, the capture and
>> sensor nodes in the topology, generating a grey image in a hardcoded
>> format.
>>
>> Signed-off-by: Helen Fornazier 
>> ---
>>
>> The Virtual Media Controller is meant to provide a test tool which simulates 
>> a configurable video pipeline exposing
>> the configuration of its individual nodes (such as sensors, debayers, 
>> scalers, inputs, outputs) throught the subdevice API.
>>
>> This first version generates a grey image with a fixed format within a 
>> thread in the sensor, but it will be integrated with
>> the Test Pattern Generator from the Vivid driver in the future.
>>
>> For more information: http://kernelnewbies.org/LaurentPinchart
>>
>> The patch is based on 'media/master' branch and available at
>> https://github.com/helen-fornazier/opw-staging vmc/review/video-pipe
>>
>>  drivers/media/Kconfig   |   1 +
>>  drivers/media/Makefile  |   2 +-
>>  drivers/media/vmc/Kconfig   |   6 +
>>  drivers/media/vmc/Makefile  |   4 +
>>  drivers/media/vmc/vmc-capture.c | 528 +++
>>  drivers/media/vmc/vmc-capture.h |  50 
>>  drivers/media/vmc/vmc-core.c| 595 
>> 
>>  drivers/media/vmc/vmc-core.h|  55 
>>  drivers/media/vmc/vmc-sensor.c  | 275 +++
>>  drivers/media/vmc/vmc-sensor.h  |  40 +++
>>  10 files changed, 1555 insertions(+), 1 deletion(-)
>>  create mode 100644 drivers/media/vmc/Kconfig
>
> As was mentioned before, this virtual driver should go into the platform
> directory.
>
> I would also prefer that is was renamed to vimc to be consistent with the 
> vim2m and
> vivid drivers (all with 'vi' prefixes).
>
>>  create mode 100644 drivers/media/vmc/Makefile
>>  create mode 100644 drivers/media/vmc/vmc-capture.c
>>  create mode 100644 drivers/media/vmc/vmc-capture.h
>>  create mode 100644 drivers/media/vmc/vmc-core.c
>>  create mode 100644 drivers/media/vmc/vmc-core.h
>>  create mode 100644 drivers/media/vmc/vmc-sensor.c
>>  create mode 100644 drivers/media/vmc/vmc-sensor.h
>>
>> diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
>> index 3ef3d6c..6804a32 100644
>> --- a/drivers/media/Kconfig
>> +++ b/drivers/media/Kconfig
>> @@ -216,5 +216,6 @@ config MEDIA_ATTACH
>>  source "drivers/media/i2c/Kconfig"
>>  source "drivers/media/tuners/Kconfig"
>>  source "drivers/media/dvb-frontends/Kconfig"
>> +source "drivers/media/vmc/Kconfig"
>>
>>  endif # MEDIA_SUPPORT
>> diff --git a/drivers/media/Makefile b/drivers/media/Makefile
>> index e608bbc..471ea93 100644
>> --- a/drivers/media/Makefile
>> +++ b/drivers/media/Makefile
>> @@ -28,6 +28,6 @@ obj-y += rc/
>>  # Finally, merge the drivers that require the core
>>  #
>>
>> -obj-y += common/ platform/ pci/ usb/ mmc/ firewire/
>> +obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ vmc/
>>  obj-$(CONFIG_VIDEO_DEV) += radio/
>>
>> diff --git a/drivers/media/vmc/Kconfig b/drivers/media/vmc/Kconfig
>> new file mode 100644
>> index 000..72aba9a
>> --- /dev/null
>> +++ b/drivers/media/vmc/Kconfig
>> @@ -0,0 +1,6 @@
>> +config VMC
>> + tristate "Virtual Media Controller Driver (VMC)"
>> + depends on VIDEO_V4L2_SUBDEV_API
>> + default n
>> + ---help---
>> +   Skeleton driver for Virtual Media Controller
>> diff --git a/drivers/media/vmc/Makefile b/drivers/media/vmc/Makefile
>> new file mode 100644
>> index 000..6eb773c
>> --- /dev/null
>> +++ b/drivers/media/vmc/Makefile
>> @@ -0,0 +1,4 @@
>> +vmc-objs := vmc-core.o vmc-capture.o vmc-sensor.o
>> +
>> +
>> +obj-$(CONFIG_VMC) += vmc.o
>> diff --git a/drivers/media/vmc/vmc-capture.c 
>> b/drivers/media/vmc/vmc-capture.c
>> new file mode 100644
>> index 000..9367973
>> --- /dev/null
>> +++ b/drivers/media/vmc/vmc-capture.c
>> @@ -0,0 +1,528 @@
>> +/*
>> + * vmc-capture.c Virtual Media Controller Driver
>> + *
>> + * Copyright (C) 2015 Helen Fornazier 
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + */
>> +
>> +#include 
>> +#include 
>> +
>> +#include "vmc-capture.h"
>> +
>> +struct vmc_cap_buffer {
>> + /*
>> +  * vb2_buffer must be the first element
>> +  * the vi

Re: dvb_usb_af9015: command failed=1 _ kernel >= 4.1.x

2015-07-31 Thread poma
On 13.07.2015 11:48, poma wrote:
> On 07.07.2015 10:48, poma wrote:
>> On 06.07.2015 22:17, Jose Alberto Reguero wrote:
>>> I made the patch for the af9035. I have not a af9015 whith mxl5007 and dual 
>>> channel. Revert it, if it cause regresions.
>>>
>>> Jose Alberto
>>>
>>
>> Thanks.
>>
>> From e19560ea038e54dc57be717db55f19d449df63f0 Mon Sep 17 00:00:00 2001
>> From: poma 
>> Date: Tue, 7 Jul 2015 10:26:13 +0200
>> Subject: [PATCH] Fix for AF9015 DVB-T USB2.0 stick
>>
>> This reverts commitas:
>>
>> - 02f9cf96df57575acea2e6eb4041e9f3ecd32548
>>   "[media] [PATH,2/2] mxl5007 move loop_thru to attach"
>> - fe4860af002a4516dd878f7297b61e186c475b35
>>   "[media] [PATH,1/2] mxl5007 move reset to attach"
>>
>> This is the conclusion after extensive testing,
>> these two commitas produce:
>>
>> mxl5007t_soft_reset: 521: failed!
>> mxl5007t_attach: error -121 on line 907
>>
>> causing AF9015 DVB-T USB2.0 stick completely unusable.
>>
>>
>> Tested-by: poma 
>> ---
>>  drivers/media/tuners/mxl5007t.c | 30 +-
>>  1 file changed, 5 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/media/tuners/mxl5007t.c 
>> b/drivers/media/tuners/mxl5007t.c
>> index f4ae04c..f8c4ba2 100644
>> --- a/drivers/media/tuners/mxl5007t.c
>> +++ b/drivers/media/tuners/mxl5007t.c
>> @@ -374,6 +374,7 @@ static struct reg_pair_t *mxl5007t_calc_init_regs(struct 
>> mxl5007t_state *state,
>>  mxl5007t_set_if_freq_bits(state, cfg->if_freq_hz, cfg->invert_if);
>>  mxl5007t_set_xtal_freq_bits(state, cfg->xtal_freq_hz);
>>  
>> +set_reg_bits(state->tab_init, 0x04, 0x01, cfg->loop_thru_enable);
>>  set_reg_bits(state->tab_init, 0x03, 0x08, cfg->clk_out_enable << 3);
>>  set_reg_bits(state->tab_init, 0x03, 0x07, cfg->clk_out_amp);
>>  
>> @@ -530,6 +531,10 @@ static int mxl5007t_tuner_init(struct mxl5007t_state 
>> *state,
>>  struct reg_pair_t *init_regs;
>>  int ret;
>>  
>> +ret = mxl5007t_soft_reset(state);
>> +if (mxl_fail(ret))
>> +goto fail;
>> +
>>  /* calculate initialization reg array */
>>  init_regs = mxl5007t_calc_init_regs(state, mode);
>>  
>> @@ -895,32 +900,7 @@ struct dvb_frontend *mxl5007t_attach(struct 
>> dvb_frontend *fe,
>>  /* existing tuner instance */
>>  break;
>>  }
>> -
>> -if (fe->ops.i2c_gate_ctrl)
>> -fe->ops.i2c_gate_ctrl(fe, 1);
>> -
>> -ret = mxl5007t_soft_reset(state);
>> -
>> -if (fe->ops.i2c_gate_ctrl)
>> -fe->ops.i2c_gate_ctrl(fe, 0);
>> -
>> -if (mxl_fail(ret))
>> -goto fail;
>> -
>> -if (fe->ops.i2c_gate_ctrl)
>> -fe->ops.i2c_gate_ctrl(fe, 1);
>> -
>> -ret = mxl5007t_write_reg(state, 0x04,
>> -state->config->loop_thru_enable);
>> -
>> -if (fe->ops.i2c_gate_ctrl)
>> -fe->ops.i2c_gate_ctrl(fe, 0);
>> -
>> -if (mxl_fail(ret))
>> -goto fail;
>> -
>>  fe->tuner_priv = state;
>> -
>>  mutex_unlock(&mxl5007t_list_mutex);
>>  
>>  memcpy(&fe->ops.tuner_ops, &mxl5007t_tuner_ops,
>>
> 
> 
> Guys, any chance to push this any time soon?
> 
> 

Will someone finally push this?

--
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] vb2: revert: vb2: allow requeuing buffers while streaming

2015-07-31 Thread Sakari Ailus
Terve,

On Wed, Jul 29, 2015 at 06:29:05PM +0300, Antti Palosaari wrote:
> commit ce0eff016f7272faa6dc6eec722b1ca1970ff9aa
> [media] vb2: allow requeuing buffers while streaming
> 
> That commit causes buf_queue() called on infinity loop when
> start_streaming() returns error. On that case resources are eaten
> quickly and machine crashes.
> 
> Cc: Hans Verkuil 
> Signed-off-by: Antti Palosaari 

Fixed by this patch in media-fixes:

commit 6d058c5643e16779ae4c001d2e893c140940e48f
Author: Sakari Ailus 
Date:   Fri Jul 3 04:37:07 2015 -0300

[media] vb2: Only requeue buffers immediately once streaming is started

Buffers can be returned back to videobuf2 in driver's streamon handler. In
this case vb2_buffer_done() with buffer state VB2_BUF_STATE_QUEUED will
cause the driver's buf_queue vb2 operation to be called, queueing the same
buffer again only to be returned to videobuf2 using vb2_buffer_done() and so
on.

Add a new buffer state VB2_BUF_STATE_REQUEUEING which, when used as the
state argument to vb2_buffer_done(), will result in buffers queued to the
driver. Using VB2_BUF_STATE_QUEUED will leave the buffer to videobuf2, as it
was before "[media] vb2: allow requeuing buffers while streaming".

Fixes: ce0eff016f72 ("[media] vb2: allow requeuing buffers while streaming")

[mche...@osg.samsung.com: fix warning: enumeration value 
'VB2_BUF_STATE_REQUEUEING' not handled in switch]

Signed-off-by: Sakari Ailus 
Acked-by: Hans Verkuil 
Cc: sta...@vger.kernel.org # for v4.1
Signed-off-by: Mauro Carvalho Chehab 

-- 
Terveisin,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
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/2] media: atmel-isi: move configure_geometry() to start_streaming()

2015-07-31 Thread Laurent Pinchart
Hi Josh,

Thank you for the patch.

On Wednesday 17 June 2015 18:39:39 Josh Wu wrote:
> As in set_fmt() function we only need to know which format is been set,
> we don't need to access the ISI hardware in this moment.
> 
> So move the configure_geometry(), which access the ISI hardware, to
> start_streaming() will make code more consistent and simpler.
> 
> Signed-off-by: Josh Wu 
> ---
> 
>  drivers/media/platform/soc_camera/atmel-isi.c | 17 +
>  1 file changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c
> b/drivers/media/platform/soc_camera/atmel-isi.c index 8bc40ca..b01086d
> 100644
> --- a/drivers/media/platform/soc_camera/atmel-isi.c
> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
> @@ -390,6 +390,11 @@ static int start_streaming(struct vb2_queue *vq,
> unsigned int count) /* Disable all interrupts */
>   isi_writel(isi, ISI_INTDIS, (u32)~0UL);
> 
> + ret = configure_geometry(isi, icd->user_width, icd->user_height,
> + icd->current_fmt->code);

I would also make configure_geometry a void function, as the only failure case 
really can't occur.

Apart from that,

Reviewed-by: Laurent Pinchart 

> + if (ret < 0)
> + return ret;
> +
>   spin_lock_irq(&isi->lock);
>   /* Clear any pending interrupt */
>   isi_readl(isi, ISI_STATUS);
> @@ -477,8 +482,6 @@ static int isi_camera_init_videobuf(struct vb2_queue *q,
> static int isi_camera_set_fmt(struct soc_camera_device *icd,
> struct v4l2_format *f)
>  {
> - struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
> - struct atmel_isi *isi = ici->priv;
>   struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
>   const struct soc_camera_format_xlate *xlate;
>   struct v4l2_pix_format *pix = &f->fmt.pix;
> @@ -511,16 +514,6 @@ static int isi_camera_set_fmt(struct soc_camera_device
> *icd, if (mf->code != xlate->code)
>   return -EINVAL;
> 
> - /* Enable PM and peripheral clock before operate isi registers */
> - pm_runtime_get_sync(ici->v4l2_dev.dev);
> -
> - ret = configure_geometry(isi, pix->width, pix->height, xlate->code);
> -
> - pm_runtime_put(ici->v4l2_dev.dev);
> -
> - if (ret < 0)
> - return ret;
> -
>   pix->width  = mf->width;
>   pix->height = mf->height;
>   pix->field  = mf->field;

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 1/2] media: atmel-isi: setup the ISI_CFG2 register directly

2015-07-31 Thread Laurent Pinchart
Hi Josh,

Thank you for the patch.

On Wednesday 17 June 2015 18:39:38 Josh Wu wrote:
> In the function configure_geometry(), we will setup the ISI CFG2
> according to the sensor output format.
> 
> It make no sense to just read back the CFG2 register and just set part
> of it.
> 
> So just set up this register directly makes things simpler.
> Currently only support YUV format from camera sensor.
> 
> Signed-off-by: Josh Wu 

The default value of the register is all 0 so this should be good.

Reviewed-by: Laurent Pinchart 

> ---
> 
>  drivers/media/platform/soc_camera/atmel-isi.c | 20 +++-
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c
> b/drivers/media/platform/soc_camera/atmel-isi.c index 9070172..8bc40ca
> 100644
> --- a/drivers/media/platform/soc_camera/atmel-isi.c
> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
> @@ -105,24 +105,25 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg)
>  static int configure_geometry(struct atmel_isi *isi, u32 width,
>   u32 height, u32 code)
>  {
> - u32 cfg2, cr;
> + u32 cfg2;
> 
> + /* According to sensor's output format to set cfg2 */
>   switch (code) {
>   /* YUV, including grey */
>   case MEDIA_BUS_FMT_Y8_1X8:
> - cr = ISI_CFG2_GRAYSCALE;
> + cfg2 = ISI_CFG2_GRAYSCALE;
>   break;
>   case MEDIA_BUS_FMT_VYUY8_2X8:
> - cr = ISI_CFG2_YCC_SWAP_MODE_3;
> + cfg2 = ISI_CFG2_YCC_SWAP_MODE_3;
>   break;
>   case MEDIA_BUS_FMT_UYVY8_2X8:
> - cr = ISI_CFG2_YCC_SWAP_MODE_2;
> + cfg2 = ISI_CFG2_YCC_SWAP_MODE_2;
>   break;
>   case MEDIA_BUS_FMT_YVYU8_2X8:
> - cr = ISI_CFG2_YCC_SWAP_MODE_1;
> + cfg2 = ISI_CFG2_YCC_SWAP_MODE_1;
>   break;
>   case MEDIA_BUS_FMT_YUYV8_2X8:
> - cr = ISI_CFG2_YCC_SWAP_DEFAULT;
> + cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT;
>   break;
>   /* RGB, TODO */
>   default:
> @@ -130,17 +131,10 @@ static int configure_geometry(struct atmel_isi *isi,
> u32 width, }
> 
>   isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
> -
> - cfg2 = isi_readl(isi, ISI_CFG2);
> - /* Set YCC swap mode */
> - cfg2 &= ~ISI_CFG2_YCC_SWAP_MODE_MASK;
> - cfg2 |= cr;
>   /* Set width */
> - cfg2 &= ~(ISI_CFG2_IM_HSIZE_MASK);
>   cfg2 |= ((width - 1) << ISI_CFG2_IM_HSIZE_OFFSET) &
>   ISI_CFG2_IM_HSIZE_MASK;
>   /* Set height */
> - cfg2 &= ~(ISI_CFG2_IM_VSIZE_MASK);
>   cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET)
>   & ISI_CFG2_IM_VSIZE_MASK;
>   isi_writel(isi, ISI_CFG2, cfg2);

-- 
Regards,

Laurent Pinchart

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


[PATCH] media: atmel-isi: parse the DT parameters for vsync/hsync polarity

2015-07-31 Thread Josh Wu
This patch will get the DT parameters of vsync/hsync polarity, and pass to
the platform data.

Also add a debug information for test purpose.

Signed-off-by: Josh Wu 
---

 drivers/media/platform/soc_camera/atmel-isi.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index fe9247a..a7de55c 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -811,6 +811,11 @@ static int isi_camera_set_bus_param(struct 
soc_camera_device *icd)
if (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
cfg1 |= ISI_CFG1_PIXCLK_POL_ACTIVE_FALLING;
 
+   dev_dbg(icd->parent, "vsync is active %s, hsyc is active %s, pix clock 
is sampling %s\n",
+   common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW ? "low" : "high",
+   common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW ? "low" : "high",
+   common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING ? "fall" : "rise");
+
if (isi->pdata.has_emb_sync)
cfg1 |= ISI_CFG1_EMB_SYNC;
if (isi->pdata.full_mode)
@@ -898,6 +903,11 @@ static int atmel_isi_probe_dt(struct atmel_isi *isi,
goto err_probe_dt;
}
 
+   if (ep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
+   isi->pdata.hsync_act_low = true;
+   if (ep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
+   isi->pdata.vsync_act_low = true;
+
 err_probe_dt:
of_node_put(np);
 
-- 
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


[RFC PATCH v2 4/5] media: videobuf2: Define vb2_buf_type and vb2_memory

2015-07-31 Thread Junghak Sung
Define enum vb2_buf_type and enum vb2_memory for videobuf2-core. This
change requires translation functions that could covert v4l2-core stuffs
to videobuf2-core stuffs in videobuf2-v4l2.c file.
The v4l2-specific member variables(e.g. type, memory) remains in
struct vb2_queue for backward compatibility and performance of type translation.

Signed-off-by: Junghak Sung 
Signed-off-by: Geunyoung Kim 
Acked-by: Seung-Woo Kim 
Acked-by: Inki Dae 
---
 drivers/media/v4l2-core/videobuf2-core.c |  139 +++-
 drivers/media/v4l2-core/videobuf2-v4l2.c |  209 --
 include/media/videobuf2-core.h   |   99 +++---
 include/media/videobuf2-v4l2.h   |   12 +-
 4 files changed, 299 insertions(+), 160 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 0460a99..7888338 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -26,10 +26,9 @@
 
 #include 
 
-#include 
-
 int vb2_debug;
 module_param_named(debug, vb2_debug, int, 0644);
+EXPORT_SYMBOL_GPL(vb2_debug);
 
 static void __enqueue_in_driver(struct vb2_buffer *vb);
 static void __vb2_queue_cancel(struct vb2_queue *q);
@@ -41,7 +40,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
 {
struct vb2_queue *q = vb->vb2_queue;
enum dma_data_direction dma_dir =
-   V4L2_TYPE_IS_OUTPUT(q->type) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+   VB2_TYPE_IS_OUTPUT(q->vb2_type) ? DMA_TO_DEVICE : 
DMA_FROM_DEVICE;
void *mem_priv;
int plane;
 
@@ -120,6 +119,7 @@ void __vb2_plane_dmabuf_put(struct vb2_buffer *vb, struct 
vb2_plane *p)
dma_buf_put(p->dbuf);
memset(p, 0, sizeof(*p));
 }
+EXPORT_SYMBOL_GPL(__vb2_plane_dmabuf_put);
 
 /**
  * __vb2_buf_dmabuf_put() - release memory associated with
@@ -132,6 +132,7 @@ void __vb2_buf_dmabuf_put(struct vb2_buffer *vb)
for (plane = 0; plane < vb->num_planes; ++plane)
__vb2_plane_dmabuf_put(vb, &vb->planes[plane]);
 }
+EXPORT_SYMBOL_GPL(__vb2_buf_dmabuf_put);
 
 /**
  * __setup_lengths() - setup initial lengths for every plane in
@@ -196,7 +197,7 @@ static void __setup_offsets(struct vb2_queue *q, unsigned 
int n)
  *
  * Returns the number of buffers successfully allocated.
  */
-static int __vb2_queue_alloc(struct vb2_queue *q, unsigned int memory,
+static int __vb2_queue_alloc(struct vb2_queue *q, enum vb2_memory memory,
 unsigned int num_buffers, unsigned int num_planes)
 {
unsigned int buffer;
@@ -214,11 +215,11 @@ static int __vb2_queue_alloc(struct vb2_queue *q, 
unsigned int memory,
vb->state = VB2_BUF_STATE_DEQUEUED;
vb->vb2_queue = q;
vb->num_planes = num_planes;
-   call_bufop(q, init_buffer, vb, memory, q->type,
+   call_bufop(q, init_buffer, vb, memory,
q->num_buffers + buffer, num_planes);
 
/* Allocate video buffer memory for the MMAP type */
-   if (memory == V4L2_MEMORY_MMAP) {
+   if (memory == VB2_MEMORY_MMAP) {
ret = __vb2_buf_mem_alloc(vb);
if (ret) {
VB2_DEBUG(1, "failed allocating memory for "
@@ -245,7 +246,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, unsigned 
int memory,
}
 
__setup_lengths(q, buffer);
-   if (memory == V4L2_MEMORY_MMAP)
+   if (memory == VB2_MEMORY_MMAP)
__setup_offsets(q, buffer);
 
VB2_DEBUG(1, "allocated %d buffers, %d plane(s) each\n",
@@ -269,9 +270,9 @@ static void __vb2_free_mem(struct vb2_queue *q, unsigned 
int buffers)
continue;
 
/* Free MMAP buffers or release USERPTR buffers */
-   if (q->memory == V4L2_MEMORY_MMAP)
+   if (q->vb2_memory == VB2_MEMORY_MMAP)
__vb2_buf_mem_free(vb);
-   else if (q->memory == V4L2_MEMORY_DMABUF)
+   else if (q->vb2_memory == VB2_MEMORY_DMABUF)
__vb2_buf_dmabuf_put(vb);
else
__vb2_buf_userptr_put(vb);
@@ -388,7 +389,7 @@ static int __vb2_queue_free(struct vb2_queue *q, unsigned 
int buffers)
 
q->num_buffers -= buffers;
if (!q->num_buffers) {
-   q->memory = 0;
+   q->vb2_memory = 0;
INIT_LIST_HEAD(&q->queued_list);
}
return 0;
@@ -414,6 +415,7 @@ bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer 
*vb)
}
return false;
 }
+EXPORT_SYMBOL_GPL(__buffer_in_use);
 
 /**
  * __buffers_in_use() - return true if any buffers on the queue are in use and
@@ -432,7 +434,7 @@ static bool __buffers_in_use(struct vb2_queue *q)
 /**
  * vb2_core_querybuf() - query video buffer information
  * @q: videobuf queue
- * @typ

[RFC PATCH v2 1/5] media: videobuf2: Rename videobuf2-core to videobuf2-v4l2

2015-07-31 Thread Junghak Sung
Rename file name - from videobuf2-core.[ch] to videobuf2-v4l2.[ch]
This renaming patch should be accompanied by the modifications for all device
drivers that include this header file. It can be done with just running this
shell script.

replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
echo $file
sed "s/$str1/$str2/g" $file > $file.out
mv $file.out $file
done
}
replace "videobuf2-core" "videobuf2-v4l2" "include/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/"

Signed-off-by: Junghak Sung 
Signed-off-by: Geunyoung Kim 
Acked-by: Seung-Woo Kim 
Acked-by: Inki Dae 
---
 drivers/media/pci/solo6x10/solo6x10.h  |2 +-
 drivers/media/platform/coda/coda-bit.c |2 +-
 drivers/media/platform/coda/coda-common.c  |2 +-
 drivers/media/platform/coda/coda.h |2 +-
 drivers/media/platform/coda/trace.h|2 +-
 drivers/media/platform/exynos-gsc/gsc-core.h   |2 +-
 drivers/media/platform/exynos4-is/fimc-capture.c   |2 +-
 drivers/media/platform/exynos4-is/fimc-core.c  |2 +-
 drivers/media/platform/exynos4-is/fimc-core.h  |2 +-
 drivers/media/platform/exynos4-is/fimc-is.h|2 +-
 drivers/media/platform/exynos4-is/fimc-isp-video.c |2 +-
 drivers/media/platform/exynos4-is/fimc-isp-video.h |2 +-
 drivers/media/platform/exynos4-is/fimc-isp.h   |2 +-
 drivers/media/platform/exynos4-is/fimc-lite.c  |2 +-
 drivers/media/platform/exynos4-is/fimc-lite.h  |2 +-
 drivers/media/platform/exynos4-is/fimc-m2m.c   |2 +-
 drivers/media/platform/marvell-ccic/mcam-core.h|2 +-
 drivers/media/platform/omap3isp/ispvideo.h |2 +-
 drivers/media/platform/s3c-camif/camif-capture.c   |2 +-
 drivers/media/platform/s3c-camif/camif-core.c  |2 +-
 drivers/media/platform/s3c-camif/camif-core.h  |2 +-
 drivers/media/platform/s5p-g2d/g2d.c   |2 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.c|2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   |2 +-
 drivers/media/platform/s5p-tv/mixer.h  |2 +-
 drivers/media/platform/soc_camera/mx2_camera.c |2 +-
 drivers/media/platform/soc_camera/soc_camera.c |2 +-
 drivers/media/platform/ti-vpe/vpe.c|2 +-
 drivers/media/platform/vivid/vivid-core.h  |2 +-
 drivers/media/platform/vsp1/vsp1_video.c   |2 +-
 drivers/media/platform/vsp1/vsp1_video.h   |2 +-
 drivers/media/platform/xilinx/xilinx-dma.c |2 +-
 drivers/media/platform/xilinx/xilinx-dma.h |2 +-
 drivers/media/usb/go7007/go7007-priv.h |2 +-
 drivers/media/usb/stk1160/stk1160.h|2 +-
 drivers/media/usb/usbtv/usbtv-video.c  |2 +-
 drivers/media/usb/uvc/uvcvideo.h   |2 +-
 drivers/media/v4l2-core/Makefile   |2 +-
 drivers/media/v4l2-core/v4l2-ioctl.c   |2 +-
 drivers/media/v4l2-core/v4l2-mem2mem.c |2 +-
 drivers/media/v4l2-core/videobuf2-dma-contig.c |2 +-
 drivers/media/v4l2-core/videobuf2-dma-sg.c |2 +-
 drivers/media/v4l2-core/videobuf2-memops.c |2 +-
 .../{videobuf2-core.c => videobuf2-v4l2.c} |   10 +-
 drivers/media/v4l2-core/videobuf2-vmalloc.c|2 +-
 drivers/usb/gadget/function/uvc_queue.h|2 +-
 include/media/soc_camera.h |2 +-
 include/media/v4l2-mem2mem.h   |2 +-
 include/media/videobuf2-dma-contig.h   |2 +-
 include/media/videobuf2-dma-sg.h   |2 +-
 include/media/videobuf2-dvb.h  |2 +-
 include/media/videobuf2-memops.h   |2 +-
 .../media/{videobuf2-core.h => videobuf2-v4l2.h}   |2 +-
 include/media/videobuf2-vmalloc.h  |2 +-
 57 files changed, 61 insertions(+), 61 deletions(-)
 rename drivers/media/v4l2-core/{videobuf2-core.c => videobuf2-v4l2.c} (99%)
 rename include/media/{videobuf2-core.h => videobuf2-v4l2.h} (99%)

diff --git a/drivers/media/pci/solo6x10/solo6x10.h 
b/drivers/media/pci/solo6x10/solo6x10.h
index 27423d7..5cc9e9d 100644
--- a/drivers/media/pci/solo6x10/solo6x10.h
+++ b/drivers/media/pci/solo6x10/solo6x10.h
@@ -35,7 +35,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "solo6x10-regs.h"
 
diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index 3d434a4..d058447 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 

[RFC PATCH v2 0/5] Refactoring Videobuf2 for common use

2015-07-31 Thread Junghak Sung
Hello everybody,

This is the 2nd round for refactoring Videobuf2(a.k.a VB2).
The purpose of this patch series is to separate existing VB2 framework
into core part and V4L2 specific part. So that not only V4L2 but also other
frameworks can use them to manage buffer and utilize queue.

Why do we try to make the VB2 framework to be common?

As you may know, current DVB framework uses ringbuffer mechanism to demux
MPEG-2 TS data and pass it to userspace. However, this mechanism requires
extra memory copy because DVB framework provides only read() system call for
application - read() system call copies the kernel data to user-space buffer.
So if we can use VB2 framework which supports streaming I/O and buffer
sharing mechanism, then we could enhance existing DVB framework by removing
the extra memory copy - with VB2 framework, application can access the kernel
data directly through mmap system call.

We have a plan for this work as follows:
1. Separate existing VB2 framework into three parts - VB2 common, VB2-v4l2.
   Of course, this change will not affect other v4l2-based
   device drivers. This patch series corresponds to this step.

2. Add and implement new APIs for DVB streaming I/O.
   We can remove unnecessary memory copy between kernel-space and user-space
   by using these new APIs. However, we leaves legacy interfaces as-is
   for backward compatibility.

This patch series is the first step for it.
The previous version of this patch series can be found at [1].

[1] RFC PATCH v1 - http://www.spinics.net/lists/linux-media/msg90688.html

Changes since v1:
1. Divide patch set into more pieces
v1 was not reviewed normally because the 2/3 patch is failed to send to mailing
list with size problem - over 300kb. So I have divided the patch set into five
pieces and refined them neatly, which was pointed by Hans.

2. Add shell scripts for renaming patch
In case of renaming patch, shell scripts are included inside the body of the
patches by Mauro's advice. 1/5 and 5/5 patches include these scripts, which can
be used by reviewers or maintainers to regenerate big patch file if something
goes wrong during patch apply.

3. Remove dependency on v4l2 from videobuf2
In previous patch set, videobuf2-core uses v4l2-specific stuff as it is.
e.g. enum v4l2_buf_type and enum v4l2_memory. That prevented other frameworks
from using videobuf2 independently and made them forced to include
v4l2-specific stuff.
In this version, these dependent stuffs are replaced with VB2 own stuffs.
e.g. enum vb2_buf_type and enum vb2_memory. So, v4l2-specific header file isn't
required to use videobuf2 in other modules. Please, note that videobuf2 stuffs
will be translated to v4l2-specific stuffs in videobuf2-v4l2.c file for
backward compatibility.

4. Unify duplicated definitions
VB2_DEBUG() is newly defined in videobuf2-core header file in order to unify
duplicated macro functions that invoke callback functions implemented in vb2
backends - i.e., videobuf2-vmalloc and videobuf2-dma-sg - and queue relevant
callbacks of device drivers.
In previous patch set, these macro functions were defined
in both videobuf2-core.c and videobuf2-v4l2.c.

This patch series is base on media_tree.git [2] by Mauro & Hans's request.
And I applied this patches to my own git [3] which can be helpful to review.
My test boards are ubuntu PC(Intel i7-3770) and odroid-xu3(exynos5422). And
basic oprerations, e.g. reqbuf, querybuf, qbuf, dqbuf, are tested with
v4l-utils. But, more tests for the all ioctls will be required on many other
targets.

[2] media_tree.git - http://git.linuxtv.org/cgit.cgi/media_tree.git/
[3] jsung/dvb-vb2.git - http://git.linuxtv.org/cgit.cgi/jsung/dvb-vb2.git/

Any suggestions and comments are welcome.

Regards,
Junghak

Junghak Sung (5):
  media: videobuf2: Rename videobuf2-core to videobuf2-v4l2
  media: videobuf2: Restructurng struct vb2_buffer for common use.
  media: videobuf2: Divide videobuf2-core into 2 parts
  media: videobuf2: Define vb2_buf_type and vb2_memory
  media: videobuf2: Modify prefix for VB2 functions

 drivers/input/touchscreen/sur40.c  |   23 +-
 drivers/media/dvb-frontends/rtl2832_sdr.c  |   19 +-
 drivers/media/pci/cobalt/cobalt-alsa-pcm.c |4 +-
 drivers/media/pci/cobalt/cobalt-v4l2.c |8 +-
 drivers/media/pci/cx23885/cx23885-417.c|   15 +-
 drivers/media/pci/cx23885/cx23885-core.c   |   10 +-
 drivers/media/pci/cx23885/cx23885-dvb.c|   13 +-
 drivers/media/pci/cx23885/cx23885-vbi.c|   17 +-
 drivers/media/pci/cx23885/cx23885-video.c  |   23 +-
 drivers/media/pci/cx23885/cx23885.h|2 +-
 drivers/media/pci/cx25821/cx25821-video.c  |   22 +-
 drivers/media/pci/cx25821/cx25821.h|3 +-
 drivers/media/pci/cx88/cx88-blackbird.c|   17 +-
 drivers/media/pci/cx88/cx88-core.c |2 +-
 drivers/media/pci/cx88/cx88-dvb.c  |   15 +-
 drivers/me