[PATCH] dib700: stop flooding system ring buffer

2018-01-23 Thread Enrico Mioso
Stop flooding system ring buffer with messages like:
dib0700: stk7700ph_xc3028_callback: unknown command 2, arg 0
while tuning an Asus My Cinema-U3000Hybrid dvb card.

The correctness of this patch is opinable, but it's annoying me so much I
sent it anyway.

CC: linux-media@vger.kernel.org
CC: Sean Young 
CC: Piotr Oleszczyk 
CC: Andrey Konovalov 
CC: Andrew Morton 
CC: Alexey Dobriyan 
CC: Mauro Carvalho Chehab 
Signed-off-by: Enrico Mioso 
---
 drivers/media/usb/dvb-usb/dib0700_devices.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c 
b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 366b05529915..bc5d250ed2f2 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -432,8 +432,7 @@ static int stk7700ph_xc3028_callback(void *ptr, int 
component,
case XC2028_RESET_CLK:
break;
default:
-   err("%s: unknown command %d, arg %d\n", __func__,
-   command, arg);
+   break;
return -EINVAL;
}
return 0;
-- 
2.16.1



Darlehensangebot

2018-01-23 Thread 58094776
Schönen Tag,

Sie benötigen einen echten Kredit online Ihre Rechnungen zu sichern?
Startet ein neues Unternehmen? Sie benötigen einen persönlichen Kredit
oder Business-Darlehen? Wir bieten ein Darlehen von € 10.000 bis €
500,000.000.00 mit 2% Zinsen pro Jahr und auch mit einem
erschwinglichen Rückzahlungsbedingungen und Zustand. Ich suche für
Darlehen und Projektinvestmentfonds ? Wir halten professionelle
Exzellenz, unsere Definition von Exzellenz liegt in hervorragenden
Kundenservice, erschwingliche Zahlung und Rückzahlung Pläne, schnell
und einfach-Prozess.
Hochachtungsvoll

Freundliche Grüße,
Herr Kelly Williams


cron job: media_tree daily build: ERRORS

2018-01-23 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Wed Jan 24 05:00:20 CET 2018
media-tree git hash:4852fdca8818972d0ea5b5ce7114da628f9954a4
media_build git hash:   d17383327f00d45e6c07161876fb4f3d9d9358e1
v4l-utils git hash: c2cc9e17b1411865d40a0e7d3ab027204fc0cf19
gcc version:i686-linux-gcc (GCC) 7.1.0
sparse version: v0.5.0-3911-g6f737e1f
smatch version: v0.5.0-3911-g6f737e1f
host hardware:  x86_64
host os:4.14.0-364

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-arm-pxa: OK
linux-git-arm-stm32: 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.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.7.4-i686: ERRORS
linux-3.8-i686: ERRORS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: WARNINGS
linux-3.11.1-i686: ERRORS
linux-3.12.67-i686: ERRORS
linux-3.13.11-i686: ERRORS
linux-3.14.9-i686: ERRORS
linux-3.15.2-i686: ERRORS
linux-3.16.7-i686: ERRORS
linux-3.17.8-i686: ERRORS
linux-3.18.7-i686: ERRORS
linux-3.19-i686: ERRORS
linux-4.0.9-i686: ERRORS
linux-4.1.33-i686: ERRORS
linux-4.2.8-i686: ERRORS
linux-4.3.6-i686: ERRORS
linux-4.4.22-i686: ERRORS
linux-4.5.7-i686: ERRORS
linux-4.6.7-i686: ERRORS
linux-4.7.5-i686: ERRORS
linux-4.8-i686: ERRORS
linux-4.9.26-i686: ERRORS
linux-4.10.14-i686: WARNINGS
linux-4.11-i686: WARNINGS
linux-4.12.1-i686: WARNINGS
linux-4.13-i686: WARNINGS
linux-4.14-i686: WARNINGS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.4-x86_64: ERRORS
linux-3.8-x86_64: ERRORS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: WARNINGS
linux-3.11.1-x86_64: ERRORS
linux-3.12.67-x86_64: ERRORS
linux-3.13.11-x86_64: ERRORS
linux-3.14.9-x86_64: ERRORS
linux-3.15.2-x86_64: ERRORS
linux-3.16.7-x86_64: ERRORS
linux-3.17.8-x86_64: ERRORS
linux-3.18.7-x86_64: ERRORS
linux-3.19-x86_64: ERRORS
linux-4.0.9-x86_64: ERRORS
linux-4.1.33-x86_64: ERRORS
linux-4.2.8-x86_64: ERRORS
linux-4.3.6-x86_64: ERRORS
linux-4.4.22-x86_64: ERRORS
linux-4.5.7-x86_64: ERRORS
linux-4.6.7-x86_64: ERRORS
linux-4.7.5-x86_64: ERRORS
linux-4.8-x86_64: ERRORS
linux-4.9.26-x86_64: ERRORS
linux-4.10.14-x86_64: WARNINGS
linux-4.11-x86_64: WARNINGS
linux-4.12.1-x86_64: WARNINGS
linux-4.13-x86_64: WARNINGS
linux-4.14-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK
smatch: OK

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html


[PATCH] staging: imx-media-vdic: fix inconsistent IS_ERR and PTR_ERR

2018-01-23 Thread Gustavo A. R. Silva
Fix inconsistent IS_ERR and PTR_ERR in vdic_get_ipu_resources.
The proper pointer to be passed as argument is ch.

This issue was detected with the help of Coccinelle.

Fixes: 0b2e9e7947e7 ("media: staging/imx: remove confusing IS_ERR_OR_NULL 
usage")
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/staging/media/imx/imx-media-vdic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx-media-vdic.c 
b/drivers/staging/media/imx/imx-media-vdic.c
index 433474d..ed35684 100644
--- a/drivers/staging/media/imx/imx-media-vdic.c
+++ b/drivers/staging/media/imx/imx-media-vdic.c
@@ -177,7 +177,7 @@ static int vdic_get_ipu_resources(struct vdic_priv *priv)
priv->vdi_in_ch = ch;
 
ch = ipu_idmac_get(priv->ipu, IPUV3_CHANNEL_MEM_VDI_NEXT);
-   if (IS_ERR(priv->vdi_in_ch_n)) {
+   if (IS_ERR(ch)) {
err_chan = IPUV3_CHANNEL_MEM_VDI_NEXT;
ret = PTR_ERR(ch);
goto out_err_chan;
-- 
2.7.4



Re: [PATCH] staging: media: remove unused VIDEO_ATOMISP_OV8858 kconfig

2018-01-23 Thread Greg Kroah-Hartman
On Tue, Jan 23, 2018 at 07:31:27PM +0200, Andy Shevchenko wrote:
> On Tue, Jan 23, 2018 at 4:37 PM, Corentin Labbe  wrote:
> > Nothing in kernel use VIDEO_ATOMISP_OV8858 since commit 3a81c7660f80 
> > ("media: staging: atomisp: Remove IMX sensor support")
> > Lets remove this kconfig option.
> 
> First of all, I hardly understand how that change is related.
> Second, did you check Makefile?

I don't see it being used in any Makefile, what file do you see it:
$ git grep VIDEO_ATOMISP_OV8858
drivers/staging/media/atomisp/i2c/Kconfig:config VIDEO_ATOMISP_OV8858

So it should be removed.

thanks,

greg k-h


[PATCH] venus: hfi: use true for boolean values

2018-01-23 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/media/platform/qcom/venus/hfi_msgs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c 
b/drivers/media/platform/qcom/venus/hfi_msgs.c
index a681ae5..90c93d9 100644
--- a/drivers/media/platform/qcom/venus/hfi_msgs.c
+++ b/drivers/media/platform/qcom/venus/hfi_msgs.c
@@ -659,10 +659,10 @@ static u32 init_done_read_prop(struct venus_core *core, 
struct venus_inst *inst,
prop->buffer_type == HFI_BUFFER_OUTPUT2) {
switch (prop->data[i]) {
case HFI_BUFFER_MODE_STATIC:
-   inst->cap_bufs_mode_static = 1;
+   inst->cap_bufs_mode_static = 
true;
break;
case HFI_BUFFER_MODE_DYNAMIC:
-   inst->cap_bufs_mode_dynamic = 1;
+   inst->cap_bufs_mode_dynamic = 
true;
break;
default:
break;
-- 
2.7.4



[PATCH] ov13858: Use false for boolean value

2018-01-23 Thread Gustavo A. R. Silva
Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/media/i2c/ov13858.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
index bf7d06f..e547133 100644
--- a/drivers/media/i2c/ov13858.c
+++ b/drivers/media/i2c/ov13858.c
@@ -1565,7 +1565,7 @@ static int __maybe_unused ov13858_resume(struct device 
*dev)
 
 error:
ov13858_stop_streaming(ov13858);
-   ov13858->streaming = 0;
+   ov13858->streaming = false;
return ret;
 }
 
-- 
2.7.4



Re: [PATCH] staging: media: remove unused VIDEO_ATOMISP_OV8858 kconfig

2018-01-23 Thread Andy Shevchenko
On Tue, Jan 23, 2018 at 4:37 PM, Corentin Labbe  wrote:
> Nothing in kernel use VIDEO_ATOMISP_OV8858 since commit 3a81c7660f80 ("media: 
> staging: atomisp: Remove IMX sensor support")
> Lets remove this kconfig option.

First of all, I hardly understand how that change is related.
Second, did you check Makefile?
Third, the files are in the folder (for OV8858).

Taking all above into account, it seems NACK, though regression might
be made by renaming patch from Sakari (no, it's not).
So, it looks like it was never enabled in the first place.

Anyway, do you have hardware to test? This is *most* important reason
why to accept or decline a change to the driver.

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCHv2 2/9] media: convert g/s_parm to g/s_frame_interval in subdevs

2018-01-23 Thread Hans Verkuil
On 23/01/18 15:47, jacopo mondi wrote:
> Hi Hans,
> 
> On Mon, Jan 22, 2018 at 01:31:18PM +0100, Hans Verkuil wrote:
>> From: Hans Verkuil 
>>
>> --- a/drivers/media/platform/atmel/atmel-isi.c
>> +++ b/drivers/media/platform/atmel/atmel-isi.c
>> @@ -689,22 +689,14 @@ static int isi_g_parm(struct file *file, void *fh, 
>> struct v4l2_streamparm *a)
>>  {
>>  struct atmel_isi *isi = video_drvdata(file);
>>
>> -if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
>> -return -EINVAL;
>> -
>> -a->parm.capture.readbuffers = 2;
>> -return v4l2_subdev_call(isi->entity.subdev, video, g_parm, a);
>> +return v4l2_g_parm_cap(video_devdata(file), isi->entity.subdev, a);
>>  }
>>
>>  static int isi_s_parm(struct file *file, void *fh, struct v4l2_streamparm 
>> *a)
>>  {
>>  struct atmel_isi *isi = video_drvdata(file);
>>
>> -if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
>> -return -EINVAL;
> 
> I've now tested the right version with CEU, and v4l2-compliance
> reports:
> 
> fail: v4l2-test-formats.cpp(1218): Video Capture cap not set, but
> G/S_PARM worked

Oops, that's a bug in v4l2-compliance. The public API for g/s_parm has
been relaxed a bit by this patch in that we now allow both CAPTURE and
CAPTURE_MPLANE. But v4l2-compliance hasn't been updated for that change
yet.

Regards,

Hans

> 
> To get rid of this error I had to refuse V4L2_BUF_TYPE_VIDEO_CAPTURE
> type in g/s_parm as my driver only supports VIDEO_CAPTURE_MPLANE type.
> 
> static int ceu_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
> {
>   struct ceu_device *ceudev = video_drvdata(file);
> 
>   if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
>   return -EINVAL;
> 
>   return v4l2_s_parm_cap(video_devdata(file), ceudev->sd->v4l2_sd, a);
> }
> 
> To make sure the same error does not happen for atmel-isi/isc and other
> platform drivers this patch modifies, I would keep the checks on
> a->type you have removed here.
> 
> I now wonder if the following test in the newly added v4l2_g/s_parm_cap()
> still makes sense if platform drivers have to check for the correct
> buffer type anyhow (the same for the _cap name suffix)
> 
> int v4l2_g_parm_cap(struct video_device *vdev,
> struct v4l2_subdev *sd, struct v4l2_streamparm *a)
> {
> struct v4l2_subdev_frame_interval ival = { 0 };
> int ret;
> 
>   if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
>   a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
>   return -EINVAL;
> 
> Thanks
>j
> 
>> -
>> -a->parm.capture.readbuffers = 2;
>> -return v4l2_subdev_call(isi->entity.subdev, video, s_parm, a);
>> +return v4l2_s_parm_cap(video_devdata(file), isi->entity.subdev, a);
>>  }
>>
>>  static int isi_enum_framesizes(struct file *file, void *fh,
>> diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
>> b/drivers/media/platform/blackfin/bfin_capture.c
>> index 41f179117fb0..b7660b1000fd 100644
>> --- a/drivers/media/platform/blackfin/bfin_capture.c
>> +++ b/drivers/media/platform/blackfin/bfin_capture.c
>> @@ -712,24 +712,18 @@ static int bcap_querycap(struct file *file, void  
>> *priv,
>>  return 0;
>>  }
>>
>> -static int bcap_g_parm(struct file *file, void *fh,
>> -struct v4l2_streamparm *a)
>> +static int bcap_g_parm(struct file *file, void *fh, struct v4l2_streamparm 
>> *a)
>>  {
>>  struct bcap_device *bcap_dev = video_drvdata(file);
>>
>> -if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
>> -return -EINVAL;
>> -return v4l2_subdev_call(bcap_dev->sd, video, g_parm, a);
>> +return v4l2_g_parm_cap(video_devdata(file), bcap_dev->sd, a);
>>  }
>>
>> -static int bcap_s_parm(struct file *file, void *fh,
>> -struct v4l2_streamparm *a)
>> +static int bcap_s_parm(struct file *file, void *fh, struct v4l2_streamparm 
>> *a)
>>  {
>>  struct bcap_device *bcap_dev = video_drvdata(file);
>>
>> -if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
>> -return -EINVAL;
>> -return v4l2_subdev_call(bcap_dev->sd, video, s_parm, a);
>> +return v4l2_s_parm_cap(video_devdata(file), bcap_dev->sd, a);
>>  }
>>
>>  static int bcap_log_status(struct file *file, void *priv)
>> diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c 
>> b/drivers/media/platform/marvell-ccic/mcam-core.c
>> index 7b7250b1cff8..80670142 100644
>> --- a/drivers/media/platform/marvell-ccic/mcam-core.c
>> +++ b/drivers/media/platform/marvell-ccic/mcam-core.c
>> @@ -1443,24 +1443,24 @@ static int mcam_vidioc_s_input(struct file *filp, 
>> void *priv, unsigned int i)
>>   * the level which controls the number of read buffers.
>>   */
>>  static int mcam_vidioc_g_parm(struct file *filp, void *priv,
>> -struct v4l2_streamparm *parms)
>> +struct v4l2_streamparm *a)
>>  {
>>  struct mcam_camera *cam = video_drvdata(filp);
>>  int ret;
>>
>> -

Re: [PATCHv2 2/9] media: convert g/s_parm to g/s_frame_interval in subdevs

2018-01-23 Thread jacopo mondi
Hi Hans,

On Mon, Jan 22, 2018 at 01:31:18PM +0100, Hans Verkuil wrote:
> From: Hans Verkuil 
>
> --- a/drivers/media/platform/atmel/atmel-isi.c
> +++ b/drivers/media/platform/atmel/atmel-isi.c
> @@ -689,22 +689,14 @@ static int isi_g_parm(struct file *file, void *fh, 
> struct v4l2_streamparm *a)
>  {
>   struct atmel_isi *isi = video_drvdata(file);
>
> - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> - return -EINVAL;
> -
> - a->parm.capture.readbuffers = 2;
> - return v4l2_subdev_call(isi->entity.subdev, video, g_parm, a);
> + return v4l2_g_parm_cap(video_devdata(file), isi->entity.subdev, a);
>  }
>
>  static int isi_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
>  {
>   struct atmel_isi *isi = video_drvdata(file);
>
> - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> - return -EINVAL;

I've now tested the right version with CEU, and v4l2-compliance
reports:

fail: v4l2-test-formats.cpp(1218): Video Capture cap not set, but
G/S_PARM worked

To get rid of this error I had to refuse V4L2_BUF_TYPE_VIDEO_CAPTURE
type in g/s_parm as my driver only supports VIDEO_CAPTURE_MPLANE type.

static int ceu_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
{
struct ceu_device *ceudev = video_drvdata(file);

if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
return -EINVAL;

return v4l2_s_parm_cap(video_devdata(file), ceudev->sd->v4l2_sd, a);
}

To make sure the same error does not happen for atmel-isi/isc and other
platform drivers this patch modifies, I would keep the checks on
a->type you have removed here.

I now wonder if the following test in the newly added v4l2_g/s_parm_cap()
still makes sense if platform drivers have to check for the correct
buffer type anyhow (the same for the _cap name suffix)

int v4l2_g_parm_cap(struct video_device *vdev,
struct v4l2_subdev *sd, struct v4l2_streamparm *a)
{
struct v4l2_subdev_frame_interval ival = { 0 };
int ret;

if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
return -EINVAL;

Thanks
   j

> -
> - a->parm.capture.readbuffers = 2;
> - return v4l2_subdev_call(isi->entity.subdev, video, s_parm, a);
> + return v4l2_s_parm_cap(video_devdata(file), isi->entity.subdev, a);
>  }
>
>  static int isi_enum_framesizes(struct file *file, void *fh,
> diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
> b/drivers/media/platform/blackfin/bfin_capture.c
> index 41f179117fb0..b7660b1000fd 100644
> --- a/drivers/media/platform/blackfin/bfin_capture.c
> +++ b/drivers/media/platform/blackfin/bfin_capture.c
> @@ -712,24 +712,18 @@ static int bcap_querycap(struct file *file, void  *priv,
>   return 0;
>  }
>
> -static int bcap_g_parm(struct file *file, void *fh,
> - struct v4l2_streamparm *a)
> +static int bcap_g_parm(struct file *file, void *fh, struct v4l2_streamparm 
> *a)
>  {
>   struct bcap_device *bcap_dev = video_drvdata(file);
>
> - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> - return -EINVAL;
> - return v4l2_subdev_call(bcap_dev->sd, video, g_parm, a);
> + return v4l2_g_parm_cap(video_devdata(file), bcap_dev->sd, a);
>  }
>
> -static int bcap_s_parm(struct file *file, void *fh,
> - struct v4l2_streamparm *a)
> +static int bcap_s_parm(struct file *file, void *fh, struct v4l2_streamparm 
> *a)
>  {
>   struct bcap_device *bcap_dev = video_drvdata(file);
>
> - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> - return -EINVAL;
> - return v4l2_subdev_call(bcap_dev->sd, video, s_parm, a);
> + return v4l2_s_parm_cap(video_devdata(file), bcap_dev->sd, a);
>  }
>
>  static int bcap_log_status(struct file *file, void *priv)
> diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c 
> b/drivers/media/platform/marvell-ccic/mcam-core.c
> index 7b7250b1cff8..80670142 100644
> --- a/drivers/media/platform/marvell-ccic/mcam-core.c
> +++ b/drivers/media/platform/marvell-ccic/mcam-core.c
> @@ -1443,24 +1443,24 @@ static int mcam_vidioc_s_input(struct file *filp, 
> void *priv, unsigned int i)
>   * the level which controls the number of read buffers.
>   */
>  static int mcam_vidioc_g_parm(struct file *filp, void *priv,
> - struct v4l2_streamparm *parms)
> + struct v4l2_streamparm *a)
>  {
>   struct mcam_camera *cam = video_drvdata(filp);
>   int ret;
>
> - ret = sensor_call(cam, video, g_parm, parms);
> - parms->parm.capture.readbuffers = n_dma_bufs;
> + ret = v4l2_g_parm_cap(video_devdata(filp), cam->sensor, a);
> + a->parm.capture.readbuffers = n_dma_bufs;
>   return ret;
>  }
>
>  static int mcam_vidioc_s_parm(struct file *filp, void *priv,
> - struct v4l2_streamparm *parms)
> + struct v4l2_streamparm *a)
>  {
>   struct 

[PATCH] staging: media: remove unused VIDEO_ATOMISP_OV8858 kconfig

2018-01-23 Thread Corentin Labbe
Nothing in kernel use VIDEO_ATOMISP_OV8858 since commit 3a81c7660f80 ("media: 
staging: atomisp: Remove IMX sensor support")
Lets remove this kconfig option.

Signed-off-by: Corentin Labbe 
---
 drivers/staging/media/atomisp/i2c/Kconfig | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/Kconfig 
b/drivers/staging/media/atomisp/i2c/Kconfig
index db054d3c7ed6..f7f7177b9b37 100644
--- a/drivers/staging/media/atomisp/i2c/Kconfig
+++ b/drivers/staging/media/atomisp/i2c/Kconfig
@@ -28,18 +28,6 @@ config VIDEO_ATOMISP_GC2235
 
 It currently only works with the atomisp driver.
 
-config VIDEO_ATOMISP_OV8858
-   tristate "Omnivision ov8858 sensor support"
-   depends on ACPI
-   depends on I2C && VIDEO_V4L2 && VIDEO_ATOMISP
-   ---help---
-This is a Video4Linux2 sensor-level driver for the Omnivision
-ov8858 RAW sensor.
-
-OV8858 is a 8M raw sensor.
-
-It currently only works with the atomisp driver.
-
 config VIDEO_ATOMISP_MSRLIST_HELPER
tristate "Helper library to load, parse and apply large register lists."
depends on I2C
-- 
2.13.6



[PATCH v2] media: ov5640: add JPEG support

2018-01-23 Thread Hugues Fruchet
Add YUV422 encoded JPEG support.

Signed-off-by: Hugues Fruchet 
---
version 2:
  - Revisit code as per Sakari suggestions:
- fix lock scheme
- fix switch back to non-JPEG output while sensor powered
See https://www.mail-archive.com/linux-media@vger.kernel.org/msg124979.html

 drivers/media/i2c/ov5640.c | 90 --
 1 file changed, 88 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index e2dd352..faa4502 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,10 @@
 
 #define OV5640_DEFAULT_SLAVE_ID 0x3c
 
+#define OV5640_JPEG_SIZE_MAX (5 * SZ_1M)
+
+#define OV5640_REG_SYS_RESET02 0x3002
+#define OV5640_REG_SYS_CLOCK_ENABLE02  0x3006
 #define OV5640_REG_SYS_CTRL0   0x3008
 #define OV5640_REG_CHIP_ID 0x300a
 #define OV5640_REG_IO_MIPI_CTRL00  0x300e
@@ -114,6 +119,7 @@ struct ov5640_pixfmt {
 };
 
 static const struct ov5640_pixfmt ov5640_formats[] = {
+   { MEDIA_BUS_FMT_JPEG_1X8, V4L2_COLORSPACE_JPEG, },
{ MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_SRGB, },
{ MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_SRGB, },
{ MEDIA_BUS_FMT_RGB565_2X8_LE, V4L2_COLORSPACE_SRGB, },
@@ -220,6 +226,8 @@ struct ov5640_dev {
 
bool pending_mode_change;
bool streaming;
+
+   unsigned int jpeg_size;
 };
 
 static inline struct ov5640_dev *to_ov5640_dev(struct v4l2_subdev *sd)
@@ -1910,11 +1918,50 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd,
return ret;
 }
 
+static int ov5640_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
+struct v4l2_mbus_frame_desc *fd)
+{
+   struct ov5640_dev *sensor = to_ov5640_dev(sd);
+
+   if (pad != 0 || !fd)
+   return -EINVAL;
+
+   mutex_lock(>lock);
+   fd->entry[0].length = sensor->jpeg_size;
+   mutex_unlock(>lock);
+   fd->entry[0].pixelcode = MEDIA_BUS_FMT_JPEG_1X8;
+   fd->entry[0].flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX;
+   fd->num_entries = 1;
+
+   return 0;
+}
+
+static int ov5640_set_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
+struct v4l2_mbus_frame_desc *fd)
+{
+   struct ov5640_dev *sensor = to_ov5640_dev(sd);
+
+   if (pad != 0 || !fd)
+   return -EINVAL;
+
+   fd->entry[0].flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX;
+   fd->num_entries = 1;
+   mutex_lock(>lock);
+   fd->entry[0].length = clamp_t(u32, fd->entry[0].length,
+ sensor->fmt.width * sensor->fmt.height,
+ OV5640_JPEG_SIZE_MAX);
+   sensor->jpeg_size = fd->entry[0].length;
+   mutex_unlock(>lock);
+
+   return 0;
+}
+
 static int ov5640_set_framefmt(struct ov5640_dev *sensor,
   struct v4l2_mbus_framefmt *format)
 {
int ret = 0;
bool is_rgb = false;
+   bool is_jpeg = false;
u8 val;
 
switch (format->code) {
@@ -1936,6 +1983,11 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor,
val = 0x61;
is_rgb = true;
break;
+   case MEDIA_BUS_FMT_JPEG_1X8:
+   /* YUV422, YUYV */
+   val = 0x30;
+   is_jpeg = true;
+   break;
default:
return -EINVAL;
}
@@ -1946,8 +1998,40 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor,
return ret;
 
/* FORMAT MUX CONTROL: ISP YUV or RGB */
-   return ov5640_write_reg(sensor, OV5640_REG_ISP_FORMAT_MUX_CTRL,
-   is_rgb ? 0x01 : 0x00);
+   ret = ov5640_write_reg(sensor, OV5640_REG_ISP_FORMAT_MUX_CTRL,
+  is_rgb ? 0x01 : 0x00);
+   if (ret)
+   return ret;
+
+   /*
+* TIMING TC REG21:
+* - [5]:   JPEG enable
+*/
+   ret = ov5640_mod_reg(sensor, OV5640_REG_TIMING_TC_REG21,
+BIT(5), is_jpeg ? BIT(5) : 0);
+   if (ret)
+   return ret;
+
+   /*
+* SYSTEM RESET02:
+* - [4]:   Reset JFIFO
+* - [3]:   Reset SFIFO
+* - [2]:   Reset JPEG
+*/
+   ret = ov5640_mod_reg(sensor, OV5640_REG_SYS_RESET02,
+BIT(4) | BIT(3) | BIT(2),
+is_jpeg ? 0 : (BIT(4) | BIT(3) | BIT(2)));
+   if (ret)
+   return ret;
+
+   /*
+* CLOCK ENABLE02:
+* - [5]:   Enable JPEG 2x clock
+* - [3]:   Enable JPEG clock
+*/
+   return ov5640_mod_reg(sensor, OV5640_REG_SYS_CLOCK_ENABLE02,
+ BIT(5) | BIT(3),
+ is_jpeg ? (BIT(5) | BIT(3)) : 0);
 }

Re: [GIT PULL for 4.16] CIO2 compiler warning fix

2018-01-23 Thread Mauro Carvalho Chehab
Em Tue, 23 Jan 2018 14:56:01 +0200
Sakari Ailus  escreveu:

> On Tue, Jan 23, 2018 at 10:40:13AM -0200, Mauro Carvalho Chehab wrote:
> > Em Wed, 10 Jan 2018 00:35:18 +0200
> > Sakari Ailus  escreveu:
> >   
> > > Hi Mauro,
> > > 
> > > Here's compile warning fix for the Intel IPU3 CIO2 driver from Arnd.
> > > 
> > > Please pull.
> > > 
> > > 
> > > The following changes since commit 
> > > e3ee691dbf24096ea51b3200946b11d68ce75361:
> > > 
> > >   media: ov5640: add support of RGB565 and YUYV formats (2018-01-05 
> > > 12:54:14 -0500)
> > > 
> > > are available in the git repository at:
> > > 
> > >   ssh://linuxtv.org/git/sailus/media_tree.git ipu3
> > > 
> > > for you to fetch changes up to 0bf3352560b82c12380823f035f5fb2171683f23:
> > > 
> > >   media: intel-ipu3: cio2: mark more PM functions as __maybe_unused 
> > > (2018-01-09 13:16:07 +0200)
> > > 
> > > 
> > > Arnd Bergmann (1):
> > >   media: intel-ipu3: cio2: mark more PM functions as __maybe_unused
> > > 
> > >  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)  
> > 
> > I got more changes than mentioned above:
> > 
> > git pull logs
> > Updating e3ee691dbf24..8d677b031a4f
> > Fast-forward
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 9 -
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > Something wrong happened here.  
> 
> Ah, this is an older CIO2 pull request I've already replaced in Patchwork.
> The new one is here, sent on 19th:
> 
> 

Please always mark the older one as Superseded before sending a new
pull request.

> 




Cheers,
Mauro


Re: [PATCH] media: lirc: Fix uninitialized variable in ir_lirc_transmit_ir()

2018-01-23 Thread Sean Young
On Wed, Jan 10, 2018 at 12:36:23PM +0300, Dan Carpenter wrote:
> The "txbuf" is uninitialized when we call ir_raw_encode_scancode() so
> this failure path would lead to a crash.

Thanks for reporting this issue, however I'm afraid that the issue has
already been resolved:

https://www.mail-archive.com/linux-media@vger.kernel.org/msg123672.html

and:

https://git.linuxtv.org/media_tree.git/commit/?id=8d25e15d94a2d7b60c28d3a30e4e0e780cab2056

Many thanks,

Sean


> 
> Fixes: a74b2bff5945 ("media: lirc: do not pass ERR_PTR to kfree")
> Signed-off-by: Dan Carpenter 
> 
> diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
> index fae42f120aa4..5efe9cd2309a 100644
> --- a/drivers/media/rc/lirc_dev.c
> +++ b/drivers/media/rc/lirc_dev.c
> @@ -295,7 +295,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, 
> const char __user *buf,
>   ret = ir_raw_encode_scancode(scan.rc_proto, scan.scancode,
>raw, LIRCBUF_SIZE);
>   if (ret < 0)
> - goto out_kfree;
> + goto out_free_raw;
>  
>   count = ret;
>  
> @@ -366,6 +366,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, 
> const char __user *buf,
>   return n;
>  out_kfree:
>   kfree(txbuf);
> +out_free_raw:
>   kfree(raw);
>  out_unlock:
>   mutex_unlock(>lock);


Re: [PATCH] media: dw9714: annotate a __be16 integer value

2018-01-23 Thread Sakari Ailus
Hi Mauro,

On Tue, Jan 23, 2018 at 07:57:14AM -0500, Mauro Carvalho Chehab wrote:
> As warned:
>drivers/media/i2c/dw9714.c: warning: incorrect type in initializer 
> (different base types):  => 64:19
> 
> Signed-off-by: Mauro Carvalho Chehab 

Acked-by: Sakari Ailus 

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi


[PATCH] media: dw9714: annotate a __be16 integer value

2018-01-23 Thread Mauro Carvalho Chehab
As warned:
   drivers/media/i2c/dw9714.c: warning: incorrect type in initializer 
(different base types):  => 64:19

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/i2c/dw9714.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c
index 57460da1..8dbbf0f917df 100644
--- a/drivers/media/i2c/dw9714.c
+++ b/drivers/media/i2c/dw9714.c
@@ -60,7 +60,7 @@ static inline struct dw9714_device *sd_to_dw9714_vcm(struct 
v4l2_subdev *subdev)
 static int dw9714_i2c_write(struct i2c_client *client, u16 data)
 {
int ret;
-   u16 val = cpu_to_be16(data);
+   __be16 val = cpu_to_be16(data);
 
ret = i2c_master_send(client, (const char *), sizeof(val));
if (ret != sizeof(val)) {
-- 
2.14.3



Re: [GIT PULL for 4.16] CIO2 compiler warning fix

2018-01-23 Thread Sakari Ailus
On Tue, Jan 23, 2018 at 10:40:13AM -0200, Mauro Carvalho Chehab wrote:
> Em Wed, 10 Jan 2018 00:35:18 +0200
> Sakari Ailus  escreveu:
> 
> > Hi Mauro,
> > 
> > Here's compile warning fix for the Intel IPU3 CIO2 driver from Arnd.
> > 
> > Please pull.
> > 
> > 
> > The following changes since commit e3ee691dbf24096ea51b3200946b11d68ce75361:
> > 
> >   media: ov5640: add support of RGB565 and YUYV formats (2018-01-05 
> > 12:54:14 -0500)
> > 
> > are available in the git repository at:
> > 
> >   ssh://linuxtv.org/git/sailus/media_tree.git ipu3
> > 
> > for you to fetch changes up to 0bf3352560b82c12380823f035f5fb2171683f23:
> > 
> >   media: intel-ipu3: cio2: mark more PM functions as __maybe_unused 
> > (2018-01-09 13:16:07 +0200)
> > 
> > 
> > Arnd Bergmann (1):
> >   media: intel-ipu3: cio2: mark more PM functions as __maybe_unused
> > 
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> I got more changes than mentioned above:
> 
> git pull logs
> Updating e3ee691dbf24..8d677b031a4f
> Fast-forward
>  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> Something wrong happened here.

Ah, this is an older CIO2 pull request I've already replaced in Patchwork.
The new one is here, sent on 19th:



-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi


Re: [GIT PULL for 4.16] CIO2 compiler warning fix

2018-01-23 Thread Sakari Ailus
On Tue, Jan 23, 2018 at 10:40:13AM -0200, Mauro Carvalho Chehab wrote:
> Em Wed, 10 Jan 2018 00:35:18 +0200
> Sakari Ailus  escreveu:
> 
> > Hi Mauro,
> > 
> > Here's compile warning fix for the Intel IPU3 CIO2 driver from Arnd.
> > 
> > Please pull.
> > 
> > 
> > The following changes since commit e3ee691dbf24096ea51b3200946b11d68ce75361:
> > 
> >   media: ov5640: add support of RGB565 and YUYV formats (2018-01-05 
> > 12:54:14 -0500)
> > 
> > are available in the git repository at:
> > 
> >   ssh://linuxtv.org/git/sailus/media_tree.git ipu3
> > 
> > for you to fetch changes up to 0bf3352560b82c12380823f035f5fb2171683f23:
> > 
> >   media: intel-ipu3: cio2: mark more PM functions as __maybe_unused 
> > (2018-01-09 13:16:07 +0200)
> > 
> > 
> > Arnd Bergmann (1):
> >   media: intel-ipu3: cio2: mark more PM functions as __maybe_unused
> > 
> >  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> I got more changes than mentioned above:
> 
> git pull logs
> Updating e3ee691dbf24..8d677b031a4f
> Fast-forward
>  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> Something wrong happened here.

Oops. There was an additional patch but I forgot to replace the pull
request. I'll do that now.

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi


Re: [GIT PULL for 4.16] CIO2 compiler warning fix

2018-01-23 Thread Mauro Carvalho Chehab
Em Wed, 10 Jan 2018 00:35:18 +0200
Sakari Ailus  escreveu:

> Hi Mauro,
> 
> Here's compile warning fix for the Intel IPU3 CIO2 driver from Arnd.
> 
> Please pull.
> 
> 
> The following changes since commit e3ee691dbf24096ea51b3200946b11d68ce75361:
> 
>   media: ov5640: add support of RGB565 and YUYV formats (2018-01-05 12:54:14 
> -0500)
> 
> are available in the git repository at:
> 
>   ssh://linuxtv.org/git/sailus/media_tree.git ipu3
> 
> for you to fetch changes up to 0bf3352560b82c12380823f035f5fb2171683f23:
> 
>   media: intel-ipu3: cio2: mark more PM functions as __maybe_unused 
> (2018-01-09 13:16:07 +0200)
> 
> 
> Arnd Bergmann (1):
>   media: intel-ipu3: cio2: mark more PM functions as __maybe_unused
> 
>  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

I got more changes than mentioned above:

git pull logs
Updating e3ee691dbf24..8d677b031a4f
Fast-forward
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

Something wrong happened here.

Regards,
Mauro



Cheers,
Mauro


[PULL FOR 4.16] Sensor driver fixes

2018-01-23 Thread Sakari Ailus
Hi Mauro,

Here are sensor driver fixes for 4.16, on top of the master branch.

Please pull.


The following changes since commit e3ee691dbf24096ea51b3200946b11d68ce75361:

  media: ov5640: add support of RGB565 and YUYV formats (2018-01-05 12:54:14 
-0500)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git fixes-4.16-1

for you to fetch changes up to c308222e2056eda4e2ab03a2f925f783e4a1678c:

  media: i2c: ov7740: use gpio/consumer.h instead of gpio.h (2018-01-23 
13:53:16 +0200)


Arnd Bergmann (1):
  media: i2c: ov7740: use gpio/consumer.h instead of gpio.h

Hugues Fruchet (1):
  media: ov5640: fix spurious streamon failures

Sakari Ailus (1):
  media: entity: Add a nop variant of media_entity_cleanup

 drivers/media/i2c/mt9m111.c  | 2 --
 drivers/media/i2c/ov2640.c   | 4 
 drivers/media/i2c/ov2659.c   | 4 
 drivers/media/i2c/ov5640.c   | 1 +
 drivers/media/i2c/ov7670.c   | 4 
 drivers/media/i2c/ov7740.c   | 4 +---
 drivers/media/i2c/tvp514x.c  | 4 
 include/media/media-entity.h | 6 +-
 8 files changed, 7 insertions(+), 22 deletions(-)

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi


Re: [PATCH v2] media: dw9807: Add dw9807 vcm driver

2018-01-23 Thread Sakari Ailus
Hi Andy,

Thanks for the patch.

On Tue, Jan 23, 2018 at 12:30:57AM +0800, Andy Yeh wrote:
> From: Alan Chiang 
> 
> DW9807 is a 10 bit DAC from Dongwoon, designed for linear
> control of voice coil motor.
> 
> This driver creates a V4L2 subdevice and
> provides control to set the desired focus.
> 
> Signed-off-by: Andy Yeh 
> Signed-off-by: Sakari Ailus 

Hmm. I don't remember this.

> ---
> v2: changed author
> 
>  .../bindings/media/i2c/dongwoon,dw9807.txt |   9 +
>  MAINTAINERS|   7 +
>  drivers/media/i2c/Kconfig  |  10 +
>  drivers/media/i2c/Makefile |   1 +
>  drivers/media/i2c/dw9807.c | 387 
> +
>  5 files changed, 414 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807.txt
>  create mode 100644 drivers/media/i2c/dw9807.c
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807.txt 
> b/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807.txt
> new file mode 100644
> index 000..1771cd0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807.txt
> @@ -0,0 +1,9 @@
> +Dngwoon Anatech DW9807 voice coil lens driver

"Dongwoon"

Please split the DT bindings to a separate patch.

> +
> +DW9807 is a 10-bit DAC with current sink capability. It is intended for
> +controlling voice coil lenses.
> +
> +Mandatory properties:
> +
> +- compatible: "dongwoon,dw9807"
> +- reg: I2C slave address
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9c9db44..32b536b 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4377,6 +4377,13 @@ T: git git://linuxtv.org/media_tree.git
>  S:   Maintained
>  F:   drivers/media/i2c/dw9714.c
>  
> +DONGWOON DW9807 LENS VOICE COIL DRIVER
> +M:   Sakari Ailus 
> +L:   linux-media@vger.kernel.org
> +T:   git git://linuxtv.org/media_tree.git
> +S:   Maintained
> +F:   drivers/media/i2c/dw9807.c
> +
>  DOUBLETALK DRIVER
>  M:   "James R. Van Zandt" 
>  L:   blinux-l...@redhat.com
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index cabde37..bcd4bf1 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -325,6 +325,16 @@ config VIDEO_DW9714
> capability. This is designed for linear control of
> voice coil motors, controlled via I2C serial interface.
>  
> +config VIDEO_DW9807
> + tristate "DW9807 lens voice coil support"
> + depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
> + depends on VIDEO_V4L2_SUBDEV_API
> + ---help---
> +   This is a driver for the DW9807 camera lens voice coil.
> +   DW9807 is a 10 bit DAC with 100mA output current sink
> +   capability. This is designed for linear control of
> +   voice coil motors, controlled via I2C serial interface.
> +
>  config VIDEO_SAA7110
>   tristate "Philips SAA7110 video decoder"
>   depends on VIDEO_V4L2 && I2C
> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
> index cf1e0f1..4bf7d00 100644
> --- a/drivers/media/i2c/Makefile
> +++ b/drivers/media/i2c/Makefile
> @@ -23,6 +23,7 @@ obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o
>  obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o
>  obj-$(CONFIG_VIDEO_AD5820)  += ad5820.o
>  obj-$(CONFIG_VIDEO_DW9714)  += dw9714.o
> +obj-$(CONFIG_VIDEO_DW9807)  += dw9807.o
>  obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o
>  obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o
>  obj-$(CONFIG_VIDEO_ADV7180) += adv7180.o
> diff --git a/drivers/media/i2c/dw9807.c b/drivers/media/i2c/dw9807.c
> new file mode 100644
> index 000..f068771
> --- /dev/null
> +++ b/drivers/media/i2c/dw9807.c
> @@ -0,0 +1,387 @@
> +/*

SPDX license header, please.

> + * Copyright (c) 2017 Intel Corporation.

Happy new year! :-)

> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version
> + * 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define DW9807_NAME  "dw9807"
> +#define DW9807_MAX_FOCUS_POS 1023
> +/*
> + * This sets the minimum granularity for the focus positions.
> + * A value of 1 gives maximum accuracy for a desired focus position
> + */
> +#define DW9807_FOCUS_STEPS   1
> +/*
> + * This acts as the minimum granularity of lens movement.
> + * Keep this value power of 2, so the control steps can be
> + * uniformly adjusted for gradual lens movement, with desired
> + * number of control 

[bug report] V4L/DVB(7872): mxl5005s: checkpatch.pl compliance

2018-01-23 Thread Dan Carpenter
Hello Steven Toth,

The patch d211017b9544: "V4L/DVB(7872): mxl5005s: checkpatch.pl
compliance" from May 1, 2008, leads to the following static checker
warning:

drivers/media/tuners/mxl5005s.c:1817 MXL_BlockInit()
warn: both sides of ternary the same: '1'

drivers/media/tuners/mxl5005s.c
  1812  }
  1813  
  1814  /* Charge Pump Control Dig  Ana */
  1815  status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, state->Mode ? 5 
: 8);
  1816  status += MXL_ControlWrite(fe,
  1817  RFSYN_EN_CHP_HIGAIN, state->Mode ? 1 : 1);
 ^^^
  1818  status += MXL_ControlWrite(fe, EN_CHP_LIN_B, state->Mode ? 0 : 
0);
 ^^^
What do these mean?  What are they supposed to do?

  1819  

regards,
dan carpenter


Re: Tons of input devices for USB camera in monitor

2018-01-23 Thread Bastien Nocera
On Thu, 2017-11-23 at 18:03 +0100, Bastien Nocera wrote:
> Hey,
> 
> My monitor, a Dell S2340T, has a builtin webcam. There's no camera
> button for it, though that wasn't a problem up until recently.

> Did I miss a fix going in for this problem? Do I need to try and
> bisect
> it?

This is still a problem with Fedora's 4.14.11-300.fc27.x86_64.

Anyone?


Re: [PATCH v4 3/9] v4l: platform: Add Renesas CEU driver

2018-01-23 Thread Philippe Ombredanne
On Fri, Jan 12, 2018 at 2:38 PM, jacopo mondi  wrote:
> Hi Philippe, Laurent, Geert,
>
> On Fri, Jan 12, 2018 at 11:36:31AM +0100, Philippe Ombredanne wrote:
>> On Tue, Jan 9, 2018 at 5:25 PM, Jacopo Mondi  
>> wrote:
>> > Add driver for Renesas Capture Engine Unit (CEU).
>>
>> 
>>
>> > --- /dev/null
>> > +++ b/drivers/media/platform/renesas-ceu.c
>> > @@ -0,0 +1,1648 @@
>> > +// SPDX-License-Identifier: GPL-2.0
>>
>> 
>>
>> > +MODULE_DESCRIPTION("Renesas CEU camera driver");
>> > +MODULE_AUTHOR("Jacopo Mondi ");
>> > +MODULE_LICENSE("GPL");
>>
>> Jacopo,
>> the MODULE_LICENSE does not match the SPDX tag. Per module.h "GPL"
>> means GPL-2.0 or later ;)
>>
>> It should be instead:
>>
>> > +MODULE_LICENSE("GPL v2");
>>
>> ... to match your
>>
>> > +// SPDX-License-Identifier: GPL-2.0
>
> I will update this in next v5.
> Laurent, Geert: I'll keep SPDX identifier to "GPL-2.0" until kernel
> doc does not get updated.

Thanks. Sorry for the late reply!

-- 
Cordially
Philippe Ombredanne


[bug report] [media] s5p-mfc: use MFC_BUF_FLAG_EOS to identify last buffers in decoder capture queue

2018-01-23 Thread Dan Carpenter
Hello Andrzej Hajda,

The patch 4d0b0ed63660: "[media] s5p-mfc: use MFC_BUF_FLAG_EOS to
identify last buffers in decoder capture queue" from Oct 7, 2015,
leads to the following static checker warning:

drivers/media/platform/s5p-mfc/s5p_mfc_dec.c:658 vidioc_dqbuf()
error: buffer overflow 'ctx->dst_bufs' 32 user_rl = '0-u32max'

drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
   635  /* Dequeue a buffer */
   636  static int vidioc_dqbuf(struct file *file, void *priv, struct 
v4l2_buffer *buf)
   637  {
   638  const struct v4l2_event ev = {
   639  .type = V4L2_EVENT_EOS
   640  };
   641  struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
   642  int ret;
   643  
   644  if (ctx->state == MFCINST_ERROR) {
   645  mfc_err_limited("Call on DQBUF after unrecoverable 
error\n");
   646  return -EIO;
   647  }
   648  
   649  switch (buf->type) {
   650  case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
   651  return vb2_dqbuf(>vq_src, buf, file->f_flags & 
O_NONBLOCK);
   652  case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
   653  ret = vb2_dqbuf(>vq_dst, buf, file->f_flags & 
O_NONBLOCK);
   654  if (ret)
   655  return ret;
   656  
   657  if (ctx->state == MFCINST_FINISHED &&
   658  (ctx->dst_bufs[buf->index].flags & 
MFC_BUF_FLAG_EOS))
   ^^
Smatch is complaining that "buf->index" is not capped.  So far as I can
see this is true.  I would have expected it to be checked in
check_array_args() or video_usercopy() but I couldn't find the check.

   659  v4l2_event_queue_fh(>fh, );
   660  return 0;
   661  default:
   662  return -EINVAL;
   663  }
   664  }


regards,
dan carpenter


[PATCH v6 2/2] media: V3s: Add support for Allwinner CSI.

2018-01-23 Thread Yong Deng
Allwinner V3s SoC features two CSI module. CSI0 is used for MIPI CSI-2
interface and CSI1 is used for parallel interface. This is not
documented in datasheet but by test and guess.

This patch implement a v4l2 framework driver for it.

Currently, the driver only support the parallel interface. MIPI-CSI2,
ISP's support are not included in this patch.

Tested-by: Maxime Ripard 
Signed-off-by: Yong Deng 
---
 MAINTAINERS|   8 +
 drivers/media/platform/Kconfig |   1 +
 drivers/media/platform/Makefile|   2 +
 drivers/media/platform/sunxi/sun6i-csi/Kconfig |   9 +
 drivers/media/platform/sunxi/sun6i-csi/Makefile|   3 +
 drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 908 +
 drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h | 143 
 .../media/platform/sunxi/sun6i-csi/sun6i_csi_reg.h | 196 +
 .../media/platform/sunxi/sun6i-csi/sun6i_video.c   | 753 +
 .../media/platform/sunxi/sun6i-csi/sun6i_video.h   |  53 ++
 10 files changed, 2076 insertions(+)
 create mode 100644 drivers/media/platform/sunxi/sun6i-csi/Kconfig
 create mode 100644 drivers/media/platform/sunxi/sun6i-csi/Makefile
 create mode 100644 drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
 create mode 100644 drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h
 create mode 100644 drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_reg.h
 create mode 100644 drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
 create mode 100644 drivers/media/platform/sunxi/sun6i-csi/sun6i_video.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 9501403..b792fe5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3783,6 +3783,14 @@ M:   Jaya Kumar 
 S: Maintained
 F: sound/pci/cs5535audio/
 
+CSI DRIVERS FOR ALLWINNER V3s
+M: Yong Deng 
+L: linux-media@vger.kernel.org
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: drivers/media/platform/sunxi/sun6i-csi/
+F: Documentation/devicetree/bindings/media/sun6i-csi.txt
+
 CW1200 WLAN driver
 M: Solomon Peachy 
 S: Maintained
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index fd0c998..41017e3 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -150,6 +150,7 @@ source "drivers/media/platform/am437x/Kconfig"
 source "drivers/media/platform/xilinx/Kconfig"
 source "drivers/media/platform/rcar-vin/Kconfig"
 source "drivers/media/platform/atmel/Kconfig"
+source "drivers/media/platform/sunxi/sun6i-csi/Kconfig"
 
 config VIDEO_TI_CAL
tristate "TI CAL (Camera Adaptation Layer) driver"
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 003b0bb..e6e9ce7 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -97,3 +97,5 @@ obj-$(CONFIG_VIDEO_QCOM_CAMSS)+= 
qcom/camss-8x16/
 obj-$(CONFIG_VIDEO_QCOM_VENUS) += qcom/venus/
 
 obj-y  += meson/
+
+obj-$(CONFIG_VIDEO_SUN6I_CSI)  += sunxi/sun6i-csi/
diff --git a/drivers/media/platform/sunxi/sun6i-csi/Kconfig 
b/drivers/media/platform/sunxi/sun6i-csi/Kconfig
new file mode 100644
index 000..314188a
--- /dev/null
+++ b/drivers/media/platform/sunxi/sun6i-csi/Kconfig
@@ -0,0 +1,9 @@
+config VIDEO_SUN6I_CSI
+   tristate "Allwinner V3s Camera Sensor Interface driver"
+   depends on VIDEO_V4L2 && COMMON_CLK && VIDEO_V4L2_SUBDEV_API && HAS_DMA
+   depends on ARCH_SUNXI || COMPILE_TEST
+   select VIDEOBUF2_DMA_CONTIG
+   select REGMAP_MMIO
+   select V4L2_FWNODE
+   ---help---
+  Support for the Allwinner Camera Sensor Interface Controller on V3s.
diff --git a/drivers/media/platform/sunxi/sun6i-csi/Makefile 
b/drivers/media/platform/sunxi/sun6i-csi/Makefile
new file mode 100644
index 000..213cb6b
--- /dev/null
+++ b/drivers/media/platform/sunxi/sun6i-csi/Makefile
@@ -0,0 +1,3 @@
+sun6i-csi-y += sun6i_video.o sun6i_csi.o
+
+obj-$(CONFIG_VIDEO_SUN6I_CSI) += sun6i-csi.o
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c 
b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
new file mode 100644
index 000..9c341f0
--- /dev/null
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -0,0 +1,908 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2011-2018 Magewell Electronics Co., Ltd. (Nanjing)
+ * All rights reserved.
+ * Author: Yong Deng 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sun6i_csi.h"
+#include "sun6i_csi_reg.h"
+
+#define MODULE_NAME"sun6i-csi"
+
+struct sun6i_csi_dev {
+   struct sun6i_csicsi;
+   struct device   

[PATCH v6 1/2] dt-bindings: media: Add Allwinner V3s Camera Sensor Interface (CSI)

2018-01-23 Thread Yong Deng
Add binding documentation for Allwinner V3s CSI.

Reviewed-by: Rob Herring 
Signed-off-by: Yong Deng 
---
 .../devicetree/bindings/media/sun6i-csi.txt| 59 ++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/sun6i-csi.txt

diff --git a/Documentation/devicetree/bindings/media/sun6i-csi.txt 
b/Documentation/devicetree/bindings/media/sun6i-csi.txt
new file mode 100644
index 000..2ff47a9
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/sun6i-csi.txt
@@ -0,0 +1,59 @@
+Allwinner V3s Camera Sensor Interface
+-
+
+Allwinner V3s SoC features two CSI module. CSI0 is used for MIPI CSI-2
+interface and CSI1 is used for parallel interface.
+
+Required properties:
+  - compatible: value must be "allwinner,sun8i-v3s-csi"
+  - reg: base address and size of the memory-mapped region.
+  - interrupts: interrupt associated to this IP
+  - clocks: phandles to the clocks feeding the CSI
+* bus: the CSI interface clock
+* mod: the CSI module clock
+* ram: the CSI DRAM clock
+  - clock-names: the clock names mentioned above
+  - resets: phandles to the reset line driving the CSI
+
+Each CSI node should contain one 'port' child node with one child 'endpoint'
+node, according to the bindings defined in
+Documentation/devicetree/bindings/media/video-interfaces.txt. As mentioned
+above, the endpoint's bus type should be MIPI CSI-2 for CSI0 and parallel or
+Bt656 for CSI1.
+
+Endpoint node properties for CSI1
+-
+
+- remote-endpoint  : (required) a phandle to the bus receiver's endpoint
+  node
+- bus-width:   : (required) must be 8, 10, 12 or 16
+- pclk-sample  : (optional) (default: sample on falling edge)
+- hsync-active : (only required for parallel)
+- vsync-active : (only required for parallel)
+
+Example:
+
+csi1: csi@1cb4000 {
+   compatible = "allwinner,sun8i-v3s-csi";
+   reg = <0x01cb4000 0x1000>;
+   interrupts = ;
+   clocks = < CLK_BUS_CSI>,
+< CLK_CSI1_SCLK>,
+< CLK_DRAM_CSI>;
+   clock-names = "bus", "mod", "ram";
+   resets = < RST_BUS_CSI>;
+
+   port {
+   /* Parallel bus endpoint */
+   csi1_ep: endpoint {
+   remote-endpoint = <_ep>;
+   bus-width = <16>;
+
+   /* If hsync-active/vsync-active are missing,
+  embedded BT.656 sync is used */
+   hsync-active = <0>; /* Active low */
+   vsync-active = <0>; /* Active low */
+   pclk-sample = <1>;  /* Rising */
+   };
+   };
+};
-- 
1.8.3.1



[PATCH v6 0/2] Initial Allwinner V3s CSI Support

2018-01-23 Thread Yong Deng
This patchset add initial support for Allwinner V3s CSI.

Allwinner V3s SoC features two CSI module. CSI0 is used for MIPI CSI-2
interface and CSI1 is used for parallel interface. This is not
documented in datasheet but by test and guess.

This patchset implement a v4l2 framework driver and add a binding 
documentation for it. 

Currently, the driver only support the parallel interface. And has been
tested with a BT1120 signal which generating from FPGA. The following
fetures are not support with this patchset:
  - ISP 
  - MIPI-CSI2
  - Master clock for camera sensor
  - Power regulator for the front end IC

Changes in v6:
  * Add Rob Herring's review tag.
  * Fix a NULL pointer dereference by picking Maxime Ripard's patch.
  * Add Maxime Ripard's test tag.

Changes in v5:
  * Using the new SPDX tags.
  * Fix MODULE_LICENSE.
  * Add many default cases and warning messages.
  * Detail the parallel bus properties
  * Fix some spelling and syntax mistakes.

Changes in v4:
  * Deal with the CSI 'INNER QUEUE'.
CSI will lookup the next dma buffer for next frame before the
the current frame done IRQ triggered. This is not documented
but reported by Ondřej Jirman.
The BSP code has workaround for this too. It skip to mark the
first buffer as frame done for VB2 and pass the second buffer
to CSI in the first frame done ISR call. Then in second frame
done ISR call, it mark the first buffer as frame done for VB2
and pass the third buffer to CSI. And so on. The bad thing is
that the first buffer will be written twice and the first frame
is dropped even the queued buffer is sufficient.
So, I make some improvement here. Pass the next buffer to CSI
just follow starting the CSI. In this case, the first frame
will be stored in first buffer, second frame in second buffer.
This mothed is used to avoid dropping the first frame, it
would also drop frame when lacking of queued buffer.
  * Fix: using a wrong mbus_code when getting the supported formats
  * Change all fourcc to pixformat
  * Change some function names

Changes in v3:
  * Get rid of struct sun6i_csi_ops
  * Move sun6i-csi to new directory drivers/media/platform/sunxi
  * Merge sun6i_csi.c and sun6i_csi_v3s.c into sun6i_csi.c
  * Use generic fwnode endpoints parser
  * Only support a single subdev to make things simple
  * Many complaintion fix

Changes in v2: 
  * Change sunxi-csi to sun6i-csi
  * Rebase to media_tree master branch 

Following is the 'v4l2-compliance -s -f' output, I have test this
with both interlaced and progressive signal:

# ./v4l2-compliance -s -f
v4l2-compliance SHA   : 6049ea8bd64f9d78ef87ef0c2b3dc9b5de1ca4a1

Driver Info:
Driver name   : sun6i-video
Card type : sun6i-csi
Bus info  : platform:csi
Driver version: 4.15.0
Capabilities  : 0x8421
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps   : 0x0421
Video Capture
Streaming
Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 0 Private Controls: 0

Format