[GIT PULL FOR v3.17] Two code fixes, two doc fixes

2014-07-25 Thread Hans Verkuil
Two vb2 patches: one fixes outdated comments, one fixes a poll bug w.r.t. output
streams (found while adding output streaming support to qv4l2).

One v4l2-ctrls enhancement: simplify how controls are set from within the kernel
and add a function to set a string controls.

One DocBook clarification how data_offset works.

Regards,

Hans

The following changes since commit 488046c237f3b78f91046d45662b318cd2415f64:

  [media] rc: Fix compilation of st_rc and sunxi-cir (2014-07-23 23:04:17 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.17f

for you to fetch changes up to 2c10f031e7bf44c22660deb2bf9d0c0be1bf8491:

  vb2: fix vb2_poll for output streams (2014-07-25 09:12:12 +0200)


Hans Verkuil (4):
  Docbook/media: improve data_offset/bytesused documentation
  v4l2-ctrls: add support for setting string controls
  vb2: fix videobuf2-core.h comments
  vb2: fix vb2_poll for output streams

 Documentation/DocBook/media/v4l/io.xml   |  7 ++-
 drivers/media/v4l2-core/v4l2-ctrls.c | 47 
---
 drivers/media/v4l2-core/videobuf2-core.c |  7 +++
 include/media/v4l2-ctrls.h   | 24 
 include/media/videobuf2-core.h   | 16 ++--
 5 files changed, 67 insertions(+), 34 deletions(-)
--
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


[GIT PULL FOR v3.17/18] miro/si4713 RDS enhancements

2014-07-25 Thread Hans Verkuil
Mauro,

I leave it to you whether to merge this for 3.17 or 3.18.

Note that this pull request includes (and requires) the patches from my earlier
pull request: https://patchwork.linuxtv.org/patch/25026/

The patches from that pull request are definitely for 3.17, but the miro and
si4713 enhancements are fine for 3.18 as well.

All tested and verified with my miropcm20 board and my si4713 board.
I've been sitting on this for quite some time waiting for the compound control
support to go in since the alternate frequency support required that.

Regards,

Hans

The following changes since commit 488046c237f3b78f91046d45662b318cd2415f64:

  [media] rc: Fix compilation of st_rc and sunxi-cir (2014-07-23 23:04:17 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.17g

for you to fetch changes up to cccea2f830ae3a739071883e5dea4c32161fcfcc:

  radio-miropcm20: add RDS support. (2014-07-25 09:20:45 +0200)


Hans Verkuil (10):
  Docbook/media: improve data_offset/bytesused documentation
  v4l2-ctrls: add support for setting string controls
  vb2: fix videobuf2-core.h comments
  vb2: fix vb2_poll for output streams
  v4l2-ctrls: add new RDS TX controls
  DocBook/media: document the new RDS TX controls
  si4713: add the missing RDS functionality.
  v4l2-ctrls: add RX RDS controls.
  DocBook/media: document the new RDS RX controls
  radio-miropcm20: add RDS support.

 Documentation/DocBook/media/v4l/controls.xml | 113 
++
 Documentation/DocBook/media/v4l/io.xml   |   7 +-
 drivers/media/radio/radio-miropcm20.c| 303 
++-
 drivers/media/radio/si4713/si4713.c  |  76 +++-
 drivers/media/radio/si4713/si4713.h  |   9 +++
 drivers/media/v4l2-core/v4l2-ctrls.c | 101 +++
 drivers/media/v4l2-core/videobuf2-core.c |   7 ++
 include/media/v4l2-ctrls.h   |  26 +++
 include/media/videobuf2-core.h   |  16 +++--
 include/uapi/linux/v4l2-controls.h   |  15 
 include/uapi/linux/videodev2.h   |   2 +
 11 files changed, 621 insertions(+), 54 deletions(-)
--
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 v6 3/6] rcar_vin: add devicetree support

2014-07-25 Thread Ben Dooks
On 23/07/14 19:23, Guennadi Liakhovetski wrote:
 Add support for devicetree probe for the rcar-vin
 driver.
 
 Signed-off-by: Ben Dooks ben.do...@codethink.co.uk
 [g.liakhovet...@gmx.de fix a typo, sort headers alphabetically]
 Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de
 ---
 
 Ben, is this version ok?

From looking at it, it seems ok.

I have been off work ill for the last couple of days, so have only
just seen these. I will try and get these reviewed/tests as soon
as possible.

Is there a git branch I could merge with our devel tree?

-- 
Ben Dooks   http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH] Docbook/media: improve data_offset/bytesused documentation

2014-07-25 Thread Hans Verkuil
On 07/21/2014 03:30 PM, Nicolas Dufresne wrote:
 Le lundi 21 juillet 2014 à 15:16 +0200, Hans Verkuil a écrit :
 + Note that data_offset is included in 
 structfieldbytesused/structfield.
 + So the size of the image in the plane is
 + 
 structfieldbytesused/structfield-structfielddata_offset/structfield 
 at
 + offset structfielddata_offset/structfield from the start 
 of the plane.
 
 This seem like messing applications a lot. Let's say you have a well
 known format, NV12, but your driver add some customer header at the
 beginning. Pretty much all the application in the world would work just
 fine ignoring that header, but in fact most of them will not work,
 because bytesused is including the header. Considering this wasn't
 documented before, I would strongly suggest to keep the bytesused as
 being the size for the format know by everyone.

1) data_offset applies *only* to drivers that use the multiplanar API (i.e. have
V4L2_CAP_VIDEO_CAPTURE/OUTPUT/M2M_MPLANE set). The older single planar API is 
not
touched by this. So only applications that can handle the mp API should take
data_offset into account.

2) I don't see how it matters whether or not bytesused includes the data_offset.
With a non-zero data_offset and an application that doesn't understand 
data_offset
it will be wrong either way. In the case of V4L2 'bytesused' has always been the
amount of data that is stored in the buffer. It makes no assumptions on what 
that
data contains. And that's not going to change.

I've added this patch to a pull request to at least get the documentation fixed,
because the documentation was really not clear on this topic, so that's a real
bug.

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


[PATCH] vb2: fix multiplanar read() with non-zero data_offset

2014-07-25 Thread Hans Verkuil
If this is a multiplanar buf_type and the plane we want to read has a
non-zero data_offset, then that data_offset was not taken into account.

Note that read() or write() for formats with more than one plane is currently
not allowed, hence the use of 'planes[0]' since this is only relevant for a
single-plane format.

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index c359006..0e3d927 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -2959,6 +2959,12 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, 
char __user *data, size_
buf-queued = 0;
buf-size = read ? vb2_get_plane_payload(q-bufs[index], 0)
 : vb2_plane_size(q-bufs[index], 0);
+   /* Compensate for data_offset on read in the multiplanar case. 
*/
+   if (is_multiplanar  read 
+   fileio-b.m.planes[0].data_offset  buf-size) {
+   buf-pos = fileio-b.m.planes[0].data_offset;
+   buf-size -= buf-pos;
+   }
} else {
buf = fileio-bufs[index];
}
--
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: fix multiplanar read() with non-zero data_offset

2014-07-25 Thread Hans Verkuil
On 07/25/14 11:09, Hans Verkuil wrote:
 If this is a multiplanar buf_type and the plane we want to read has a
 non-zero data_offset, then that data_offset was not taken into account.
 
 Note that read() or write() for formats with more than one plane is currently
 not allowed, hence the use of 'planes[0]' since this is only relevant for a
 single-plane format.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Forgot, sorry.

 
 diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
 b/drivers/media/v4l2-core/videobuf2-core.c
 index c359006..0e3d927 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -2959,6 +2959,12 @@ static size_t __vb2_perform_fileio(struct vb2_queue 
 *q, char __user *data, size_
   buf-queued = 0;
   buf-size = read ? vb2_get_plane_payload(q-bufs[index], 0)
: vb2_plane_size(q-bufs[index], 0);
 + /* Compensate for data_offset on read in the multiplanar case. 
 */
 + if (is_multiplanar  read 
 + fileio-b.m.planes[0].data_offset  buf-size) {
 + buf-pos = fileio-b.m.planes[0].data_offset;
 + buf-size -= buf-pos;
 + }
   } else {
   buf = fileio-bufs[index];
   }
 --
 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


[PATCH 1/2] Kconfig: fix tuners build warnings

2014-07-25 Thread Antti Palosaari
[next:master 7472/8702] warning: (USB_MSI2500) selects
MEDIA_TUNER_MSI001 which has unmet direct dependencies
((MEDIA_ANALOG_TV_SUPPORT || ..)  ..)

[next:master 7698/8702] warning: (MEDIA_TUNER  ..) selects
MEDIA_TUNER_XC5000 which has unmet direct dependencies
((MEDIA_ANALOG_TV_SUPPORT || ..)  ..)

Reported-by: kbuild test robot fengguang...@intel.com
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/tuners/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index 51edd10..d79fd1c 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -16,7 +16,7 @@ config MEDIA_TUNER
 
 menu Customize TV tuners
visible if !MEDIA_SUBDRV_AUTOSELECT
-   depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || 
MEDIA_RADIO_SUPPORT
+   depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || 
MEDIA_RADIO_SUPPORT || MEDIA_SDR_SUPPORT
 
 config MEDIA_TUNER_SIMPLE
tristate Simple tuner support
@@ -74,6 +74,7 @@ config MEDIA_TUNER_TEA5767
 config MEDIA_TUNER_MSI001
tristate Mirics MSi001
depends on MEDIA_SUPPORT  SPI  VIDEO_V4L2
+   default m if !MEDIA_SUBDRV_AUTOSELECT
help
  Mirics MSi001 silicon tuner driver.
 
-- 
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


[PATCH 2/2] Kconfig: rtl2832_sdr must depends on USB

2014-07-25 Thread Antti Palosaari
Fixes error:
[next:master 7435/8702] ERROR: usb_alloc_urb
[drivers/media/dvb-frontends/rtl2832_sdr.ko] undefined!

rtl2832_sdr driver implements own USB streaming for SDR data.
Logically that functionality belongs to USB interface driver, but
currently it is implemented here.

Reported-by: kbuild test robot fengguang...@intel.com
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index 78a95a6..5b8b04c 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -448,7 +448,7 @@ config DVB_RTL2832
 
 config DVB_RTL2832_SDR
tristate Realtek RTL2832 SDR
-   depends on DVB_CORE  I2C  I2C_MUX  VIDEO_V4L2  MEDIA_SDR_SUPPORT
+   depends on DVB_CORE  I2C  I2C_MUX  VIDEO_V4L2  
MEDIA_SDR_SUPPORT  USB
select DVB_RTL2832
select VIDEOBUF2_VMALLOC
default m if !MEDIA_SUBDRV_AUTOSELECT
-- 
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


[PATCH] libv4l-mplane: make it aware of the extended pix_format fields

2014-07-25 Thread Hans Verkuil
The v4l2_pix_format struct has been extended with new fields. Let libv4l-mplane
make use of that so that the v4l2_pix_format_mplane 'flags' field can be 
reported
in v4l2_pix_format as well.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

diff --git a/lib/libv4l-mplane/libv4l-mplane.c 
b/lib/libv4l-mplane/libv4l-mplane.c
index 5659dd5..a7b4f04 100644
--- a/lib/libv4l-mplane/libv4l-mplane.c
+++ b/lib/libv4l-mplane/libv4l-mplane.c
@@ -21,6 +21,7 @@
 #include stdint.h
 #include stdio.h
 #include stdlib.h
+#include stddef.h
 #include string.h
 #include unistd.h
 #include sys/syscall.h
@@ -142,6 +143,9 @@ static int querycap_ioctl(int fd, unsigned long int cmd,
if (cap-device_caps  V4L2_CAP_VIDEO_OUTPUT_MPLANE)
cap-device_caps |= V4L2_CAP_VIDEO_OUTPUT;
 
+   cap-capabilities |= V4L2_CAP_EXT_PIX_FORMAT;
+   cap-device_caps |= V4L2_CAP_EXT_PIX_FORMAT;
+
/*
 * Don't report mplane caps, as this will be handled via
 * this plugin
@@ -166,6 +170,32 @@ static int convert_type(int type)
}
 }
 
+static void sanitize_format(struct v4l2_format *fmt)
+{
+   unsigned int offset;
+
+   /*
+* The v4l2_pix_format structure has been extended with fields that were
+* not previously required to be set to zero by applications. The priv
+* field, when set to a magic value, indicates the the extended fields
+* are valid. We support these extended fields since struct
+* v4l2_pix_format_mplane supports those fields as well.
+*
+* So this function will sanitize v4l2_pix_format if priv != PRIV_MAGIC
+* by setting priv to that value and zeroing the remaining fields.
+*/
+
+   if (fmt-fmt.pix.priv == V4L2_PIX_FMT_PRIV_MAGIC)
+   return;
+
+   fmt-fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
+
+   offset = offsetof(struct v4l2_pix_format, priv)
+  + sizeof(fmt-fmt.pix.priv);
+   memset(((char *)fmt-fmt.pix) + offset, 0,
+  sizeof(fmt-fmt.pix) - offset);
+}
+
 static int try_set_fmt_ioctl(int fd, unsigned long int cmd,
 struct v4l2_format *arg)
 {
@@ -188,12 +218,15 @@ static int try_set_fmt_ioctl(int fd, unsigned long int 
cmd,
return SYS_IOCTL(fd, cmd, arg);
}
 
+   sanitize_format(org);
+
fmt.fmt.pix_mp.width = org-fmt.pix.width;
fmt.fmt.pix_mp.height = org-fmt.pix.height;
fmt.fmt.pix_mp.pixelformat = org-fmt.pix.pixelformat;
fmt.fmt.pix_mp.field = org-fmt.pix.field;
fmt.fmt.pix_mp.colorspace = org-fmt.pix.colorspace;
fmt.fmt.pix_mp.num_planes = 1;
+   fmt.fmt.pix_mp.flags = org-fmt.pix.flags;
fmt.fmt.pix_mp.plane_fmt[0].bytesperline = org-fmt.pix.bytesperline;
fmt.fmt.pix_mp.plane_fmt[0].sizeimage = org-fmt.pix.sizeimage;
 
@@ -208,7 +241,7 @@ static int try_set_fmt_ioctl(int fd, unsigned long int cmd,
org-fmt.pix.colorspace = fmt.fmt.pix_mp.colorspace;
org-fmt.pix.bytesperline = fmt.fmt.pix_mp.plane_fmt[0].bytesperline;
org-fmt.pix.sizeimage = fmt.fmt.pix_mp.plane_fmt[0].sizeimage;
-   org-fmt.pix.priv = 0;
+   org-fmt.pix.flags = fmt.fmt.pix_mp.flags;
 
return 0;
 }
@@ -239,12 +272,14 @@ static int create_bufs_ioctl(int fd, unsigned long int 
cmd,
cbufs.index = arg-index;
cbufs.count = arg-count;
cbufs.memory = arg-memory;
+   sanitize_format(org);
fmt-fmt.pix_mp.width = org-fmt.pix.width;
fmt-fmt.pix_mp.height = org-fmt.pix.height;
fmt-fmt.pix_mp.pixelformat = org-fmt.pix.pixelformat;
fmt-fmt.pix_mp.field = org-fmt.pix.field;
fmt-fmt.pix_mp.colorspace = org-fmt.pix.colorspace;
fmt-fmt.pix_mp.num_planes = 1;
+   fmt-fmt.pix_mp.flags = org-fmt.pix.flags;
fmt-fmt.pix_mp.plane_fmt[0].bytesperline = org-fmt.pix.bytesperline;
fmt-fmt.pix_mp.plane_fmt[0].sizeimage = org-fmt.pix.sizeimage;
 
@@ -259,6 +294,7 @@ static int create_bufs_ioctl(int fd, unsigned long int cmd,
org-fmt.pix.colorspace = fmt-fmt.pix_mp.colorspace;
org-fmt.pix.bytesperline = fmt-fmt.pix_mp.plane_fmt[0].bytesperline;
org-fmt.pix.sizeimage = fmt-fmt.pix_mp.plane_fmt[0].sizeimage;
+   org-fmt.pix.flags = fmt-fmt.pix_mp.flags;
 
return ret;
 }
@@ -288,6 +324,7 @@ static int get_fmt_ioctl(int fd, unsigned long int cmd, 
struct v4l2_format *arg)
if (ret)
return ret;
 
+   memset(org-fmt.pix, 0, sizeof(org-fmt.pix));
org-fmt.pix.width = fmt.fmt.pix_mp.width;
org-fmt.pix.height = fmt.fmt.pix_mp.height;
org-fmt.pix.pixelformat = fmt.fmt.pix_mp.pixelformat;
@@ -295,7 +332,8 @@ static int get_fmt_ioctl(int fd, unsigned long int cmd, 
struct v4l2_format *arg)
org-fmt.pix.colorspace = fmt.fmt.pix_mp.colorspace;
org-fmt.pix.bytesperline = fmt.fmt.pix_mp.plane_fmt[0].bytesperline;
org-fmt.pix.sizeimage = 

[PATCH v3 0/3] media: atmel-isi: Add DT support for Atmel ISI driver

2014-07-25 Thread Josh Wu
This patch series add DT support for atmel ISI driver. It can support the
common v4l2 DT interfaces.

v2 - v3:
  support bus-width property for atmel-isi endpoint.

v1 - v2:
  modified the device tree binding document to remove an optonal property.

Josh Wu (3):
  atmel-isi: add v4l2 async probe support
  atmel-isi: convert the pdata from pointer to structure
  atmel-isi: add primary DT support

 .../devicetree/bindings/media/atmel-isi.txt| 51 +
 drivers/media/platform/soc_camera/atmel-isi.c  | 89 +++---
 include/media/atmel-isi.h  |  4 +
 3 files changed, 132 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/atmel-isi.txt

-- 
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/3] media: atmel-isi: add v4l2 async probe support

2014-07-25 Thread Josh Wu
Signed-off-by: Josh Wu josh...@atmel.com
---
v2 - v3:
  no change.

 drivers/media/platform/soc_camera/atmel-isi.c | 5 +
 include/media/atmel-isi.h | 4 
 2 files changed, 9 insertions(+)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 14bc886..802c203 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -987,6 +987,11 @@ static int atmel_isi_probe(struct platform_device *pdev)
soc_host-v4l2_dev.dev  = pdev-dev;
soc_host-nr= pdev-id;
 
+   if (isi-pdata.asd_sizes) {
+   soc_host-asd = isi-pdata.asd;
+   soc_host-asd_sizes = isi-pdata.asd_sizes;
+   }
+
ret = soc_camera_host_register(soc_host);
if (ret) {
dev_err(pdev-dev, Unable to register soc camera host\n);
diff --git a/include/media/atmel-isi.h b/include/media/atmel-isi.h
index 2b02347..c2e5703 100644
--- a/include/media/atmel-isi.h
+++ b/include/media/atmel-isi.h
@@ -106,6 +106,8 @@
 #define ISI_DATAWIDTH_80x01
 #define ISI_DATAWIDTH_10   0x02
 
+struct v4l2_async_subdev;
+
 struct isi_platform_data {
u8 has_emb_sync;
u8 emb_crc_sync;
@@ -118,6 +120,8 @@ struct isi_platform_data {
u32 frate;
/* Using for ISI_MCK */
u32 mck_hz;
+   struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
+   int *asd_sizes; /* 0-terminated array of asd group sizes */
 };
 
 #endif /* __ATMEL_ISI_H__ */
-- 
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 2/3] media: atmel-isi: convert the pdata from pointer to structure

2014-07-25 Thread Josh Wu
Now the platform data is initialized by allocation of isi
structure. In the future, we use pdata to store the dt parameters.

Signed-off-by: Josh Wu josh...@atmel.com
---
v2 - v3:
  use sizeof(isi-pdata) instead of using sizeof(struct).

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

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 802c203..74af560 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -84,7 +84,7 @@ struct atmel_isi {
struct clk  *mck;
unsigned intirq;
 
-   struct isi_platform_data*pdata;
+   struct isi_platform_datapdata;
u16 width_flags;/* max 12 bits */
 
struct list_headvideo_buffer_list;
@@ -350,7 +350,7 @@ static void start_dma(struct atmel_isi *isi, struct 
frame_buffer *buffer)
 
cfg1 = ~ISI_CFG1_FRATE_DIV_MASK;
/* Enable linked list */
-   cfg1 |= isi-pdata-frate | ISI_CFG1_DISCR;
+   cfg1 |= isi-pdata.frate | ISI_CFG1_DISCR;
 
/* Enable codec path and ISI */
ctrl = ISI_CTRL_CDC | ISI_CTRL_EN;
@@ -795,7 +795,7 @@ static int isi_camera_set_bus_param(struct 
soc_camera_device *icd)
/* Make choises, based on platform preferences */
if ((common_flags  V4L2_MBUS_HSYNC_ACTIVE_HIGH) 
(common_flags  V4L2_MBUS_HSYNC_ACTIVE_LOW)) {
-   if (isi-pdata-hsync_act_low)
+   if (isi-pdata.hsync_act_low)
common_flags = ~V4L2_MBUS_HSYNC_ACTIVE_HIGH;
else
common_flags = ~V4L2_MBUS_HSYNC_ACTIVE_LOW;
@@ -803,7 +803,7 @@ static int isi_camera_set_bus_param(struct 
soc_camera_device *icd)
 
if ((common_flags  V4L2_MBUS_VSYNC_ACTIVE_HIGH) 
(common_flags  V4L2_MBUS_VSYNC_ACTIVE_LOW)) {
-   if (isi-pdata-vsync_act_low)
+   if (isi-pdata.vsync_act_low)
common_flags = ~V4L2_MBUS_VSYNC_ACTIVE_HIGH;
else
common_flags = ~V4L2_MBUS_VSYNC_ACTIVE_LOW;
@@ -811,7 +811,7 @@ static int isi_camera_set_bus_param(struct 
soc_camera_device *icd)
 
if ((common_flags  V4L2_MBUS_PCLK_SAMPLE_RISING) 
(common_flags  V4L2_MBUS_PCLK_SAMPLE_FALLING)) {
-   if (isi-pdata-pclk_act_falling)
+   if (isi-pdata.pclk_act_falling)
common_flags = ~V4L2_MBUS_PCLK_SAMPLE_RISING;
else
common_flags = ~V4L2_MBUS_PCLK_SAMPLE_FALLING;
@@ -833,9 +833,9 @@ 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;
 
-   if (isi-pdata-has_emb_sync)
+   if (isi-pdata.has_emb_sync)
cfg1 |= ISI_CFG1_EMB_SYNC;
-   if (isi-pdata-full_mode)
+   if (isi-pdata.full_mode)
cfg1 |= ISI_CFG1_FULL_MODE;
 
isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
@@ -910,7 +910,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
if (IS_ERR(isi-pclk))
return PTR_ERR(isi-pclk);
 
-   isi-pdata = pdata;
+   memcpy(isi-pdata, pdata, sizeof(isi-pdata));
isi-active = NULL;
spin_lock_init(isi-lock);
INIT_LIST_HEAD(isi-video_buffer_list);
@@ -926,7 +926,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
/* Set ISI_MCK's frequency, it should be faster than pixel
 * clock.
 */
-   ret = clk_set_rate(isi-mck, pdata-mck_hz);
+   ret = clk_set_rate(isi-mck, isi-pdata.mck_hz);
if (ret  0)
return ret;
}
@@ -960,9 +960,9 @@ static int atmel_isi_probe(struct platform_device *pdev)
goto err_ioremap;
}
 
-   if (pdata-data_width_flags  ISI_DATAWIDTH_8)
+   if (isi-pdata.data_width_flags  ISI_DATAWIDTH_8)
isi-width_flags = 1  7;
-   if (pdata-data_width_flags  ISI_DATAWIDTH_10)
+   if (isi-pdata.data_width_flags  ISI_DATAWIDTH_10)
isi-width_flags |= 1  9;
 
isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
-- 
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 3/3] media: atmel-isi: add primary DT support

2014-07-25 Thread Josh Wu
This patch add the DT support for Atmel ISI driver.
It use the same v4l2 DT interface that defined in video-interfaces.txt.

Signed-off-by: Josh Wu josh...@atmel.com
Cc: devicet...@vger.kernel.org
Reviewed-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
v2 - v3:
  add bus-width property support.
  add error handling when calling atmel_isi_probe_dt().

v1 - v2:
  refine the binding document.
  add port node description.
  removed the optional property.

 .../devicetree/bindings/media/atmel-isi.txt| 51 +
 drivers/media/platform/soc_camera/atmel-isi.c  | 64 +-
 2 files changed, 113 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/atmel-isi.txt

diff --git a/Documentation/devicetree/bindings/media/atmel-isi.txt 
b/Documentation/devicetree/bindings/media/atmel-isi.txt
new file mode 100644
index 000..17e71b7
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/atmel-isi.txt
@@ -0,0 +1,51 @@
+Atmel Image Sensor Interface (ISI) SoC Camera Subsystem
+--
+
+Required properties:
+- compatible: must be atmel,at91sam9g45-isi
+- reg: physical base address and length of the registers set for the device;
+- interrupts: should contain IRQ line for the ISI;
+- clocks: list of clock specifiers, corresponding to entries in
+  the clock-names property;
+- clock-names: must contain isi_clk, which is the isi peripherial clock.
+
+ISI supports a single port node with parallel bus. It should contain one
+'port' child node with child 'endpoint' node. Please refer to the bindings
+defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+   isi: isi@f0034000 {
+   compatible = atmel,at91sam9g45-isi;
+   reg = 0xf0034000 0x4000;
+   interrupts = 37 IRQ_TYPE_LEVEL_HIGH 5;
+
+   clocks = isi_clk;
+   clock-names = isi_clk;
+
+   pinctrl-names = default;
+   pinctrl-0 = pinctrl_isi;
+
+   port {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   isi_0: endpoint {
+   remote-endpoint = ov2640_0;
+   bus-width = 8;
+   };
+   };
+   };
+
+   i2c1: i2c@f0018000 {
+   ov2640: camera@0x30 {
+   compatible = omnivision,ov2640;
+   reg = 0x30;
+
+   port {
+   ov2640_0: endpoint {
+   remote-endpoint = isi_0;
+   bus-width = 8;
+   };
+   };
+   };
+   };
diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 74af560..ca4e43e 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -25,6 +25,7 @@
 #include media/atmel-isi.h
 #include media/soc_camera.h
 #include media/soc_mediabus.h
+#include media/v4l2-of.h
 #include media/videobuf2-dma-contig.h
 
 #define MAX_BUFFER_NUM 32
@@ -33,6 +34,7 @@
 #define VID_LIMIT_BYTES(16 * 1024 * 1024)
 #define MIN_FRAME_RATE 15
 #define FRAME_INTERVAL_MILLI_SEC   (1000 / MIN_FRAME_RATE)
+#define ISI_DEFAULT_MCLK_FREQ  2500
 
 /* Frame buffer descriptor */
 struct fbd {
@@ -883,6 +885,50 @@ static int atmel_isi_remove(struct platform_device *pdev)
return 0;
 }
 
+static int atmel_isi_probe_dt(struct atmel_isi *isi,
+   struct platform_device *pdev)
+{
+   struct device_node *np= pdev-dev.of_node;
+   struct v4l2_of_endpoint ep;
+   int err;
+
+   /* Default settings for ISI */
+   isi-pdata.full_mode = 1;
+   isi-pdata.mck_hz = ISI_DEFAULT_MCLK_FREQ;
+   isi-pdata.frate = ISI_CFG1_FRATE_CAPTURE_ALL;
+
+   np = of_graph_get_next_endpoint(np, NULL);
+   if (!np) {
+   dev_err(pdev-dev, Could not find the endpoint\n);
+   return -EINVAL;
+   }
+
+   err = v4l2_of_parse_endpoint(np, ep);
+   if (err) {
+   dev_err(pdev-dev, Could not parse the endpoint\n);
+   goto err_probe_dt;
+   }
+
+   switch (ep.bus.parallel.bus_width) {
+   case 8:
+   isi-pdata.data_width_flags = ISI_DATAWIDTH_8;
+   break;
+   case 10:
+   isi-pdata.data_width_flags = ISI_DATAWIDTH_10;
+   break;
+   default:
+   dev_err(pdev-dev, Not supported bus width: %d\n,
+   ep.bus.parallel.bus_width);
+   err = -EINVAL;
+   goto err_probe_dt;
+   }
+
+err_probe_dt:
+   of_node_put(np);
+
+   return err;
+}
+
 static int 

[next:master 7707/8903] drivers/media/pci/solo6x10/solo6x10-disp.c:221 solo_set_motion_block() error: potential null dereference 'buf'. (kzalloc returns null)

2014-07-25 Thread kbuild test robot
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   5a7439efd1c5c416f768fc550048ca130cf4bf99
commit: 28cae868cd245b6bb2f27bce807e9d78afcf8ea2 [7707/8903] [media] solo6x10: 
move out of staging into drivers/media/pci.

drivers/media/pci/solo6x10/solo6x10-disp.c:221 solo_set_motion_block() error: 
potential null dereference 'buf'.  (kzalloc returns null)

vim +/buf +221 drivers/media/pci/solo6x10/solo6x10-disp.c

dcae5dacb drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-25  205  (ch * SOLO_MOT_THRESH_SIZE * 2),
dcae5dacb drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-25  206  val, SOLO_MOT_THRESH_SIZE);
dcae5dacb drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-25  207  }
dcae5dacb drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-25  208  
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  209  int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch,
4063a3c78 drivers/staging/media/solo6x10/solo6x10-disp.c Hans Verkuil 
2014-06-10  210   const u16 *thresholds)
dcae5dacb drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-25  211  {
761f9aa23 drivers/staging/media/solo6x10/solo6x10-disp.c Hans Verkuil 
2014-02-07  212   const unsigned size = sizeof(u16) * 64;
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  213   u32 off = SOLO_MOT_FLAG_AREA + ch * SOLO_MOT_THRESH_SIZE * 2;
761f9aa23 drivers/staging/media/solo6x10/solo6x10-disp.c Hans Verkuil 
2014-02-07  214   u16 *buf;
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  215   int x, y;
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  216   int ret = 0;
dcae5dacb drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-25  217  
761f9aa23 drivers/staging/media/solo6x10/solo6x10-disp.c Hans Verkuil 
2014-02-07  218   buf = kzalloc(size, GFP_KERNEL);
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  219   for (y = 0; y  SOLO_MOTION_SZ; y++) {
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  220   for (x = 0; x  SOLO_MOTION_SZ; x++)
4063a3c78 drivers/staging/media/solo6x10/solo6x10-disp.c Hans Verkuil 
2014-06-10 @221   buf[x] = cpu_to_le16(thresholds[y * 
SOLO_MOTION_SZ + x]);
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  222   ret |= solo_p2m_dma(solo_dev, 1, buf,
761f9aa23 drivers/staging/media/solo6x10/solo6x10-disp.c Hans Verkuil 
2014-02-07  223   SOLO_MOTION_EXT_ADDR(solo_dev) + off + y * 
size,
761f9aa23 drivers/staging/media/solo6x10/solo6x10-disp.c Hans Verkuil 
2014-02-07  224   size, 0, 0);
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  225   }
761f9aa23 drivers/staging/media/solo6x10/solo6x10-disp.c Hans Verkuil 
2014-02-07  226   kfree(buf);
f5df0b7ff drivers/staging/media/solo6x10/disp.c  Hans Verkuil 
2013-03-18  227   return ret;
faa4fd2a0 drivers/staging/solo6x10/solo6010-disp.c   Ben Collins  
2010-06-17  228  }
faa4fd2a0 drivers/staging/solo6x10/solo6010-disp.c   Ben Collins  
2010-06-17  229  

:: The code at line 221 was first introduced by commit
:: 4063a3c781071e46aaf08e79c99ea822cbc0f089 [media] solo6x10: implement the 
new motion detection controls

:: TO: Hans Verkuil hans.verk...@cisco.com
:: CC: Mauro Carvalho Chehab m.che...@samsung.com

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
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] solo6x10: fix potential null dereference

2014-07-25 Thread Hans Verkuil
drivers/media/pci/solo6x10/solo6x10-disp.c:221 solo_set_motion_block() error: 
potential null dereference 
'buf'.  (kzalloc returns null)

Also propagate this error up the chain.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Reported-by: kbuild test robot fengguang...@intel.com

diff --git a/drivers/media/pci/solo6x10/solo6x10-disp.c 
b/drivers/media/pci/solo6x10/solo6x10-disp.c
index ed88ab4..5ea9cac 100644
--- a/drivers/media/pci/solo6x10/solo6x10-disp.c
+++ b/drivers/media/pci/solo6x10/solo6x10-disp.c
@@ -216,6 +216,8 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch,
int ret = 0;
 
buf = kzalloc(size, GFP_KERNEL);
+   if (buf == NULL)
+   return -ENOMEM;
for (y = 0; y  SOLO_MOTION_SZ; y++) {
for (x = 0; x  SOLO_MOTION_SZ; x++)
buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + 
x]);
diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c 
b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
index 2e07b49..d12083f 100644
--- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
@@ -1137,11 +1137,13 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
solo_enc-motion_enabled = ctrl-val  
V4L2_DETECT_MD_MODE_DISABLED;
if (ctrl-val) {
if (solo_enc-motion_global)
-   solo_set_motion_threshold(solo_dev, 
solo_enc-ch,
+   err = solo_set_motion_threshold(solo_dev, 
solo_enc-ch,
solo_enc-motion_thresh);
else
-   solo_set_motion_block(solo_dev, solo_enc-ch,
+   err = solo_set_motion_block(solo_dev, 
solo_enc-ch,
solo_enc-md_thresholds-p_cur.p_u16);
+   if (err)
+   return err;
}
solo_motion_toggle(solo_enc, ctrl-val);
return 0;
@@ -1152,8 +1154,7 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
break;
case V4L2_CID_OSD_TEXT:
strcpy(solo_enc-osd_text, ctrl-p_new.p_char);
-   err = solo_osd_print(solo_enc);
-   return err;
+   return solo_osd_print(solo_enc);
default:
return -EINVAL;
}
--
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/v4l2-ctrl: Support for pixel type

2014-07-25 Thread Ricardo Ribalda Delgado
Now that we have compound controls and support for array of controls it
might be a good idea to create a new type to describe individual pixels
(points).

This types of control can be used to provide the user a list of dead
pixels.

Please consider this PATCH as an RFC to find out if this kind of
control whould be useful for anybody else. If there is a need for this
kind of control I will resend this patch with changes in the
Documentation and the required changes on v4l-utils.

Thanks!

Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 8 
 include/media/v4l2-ctrls.h   | 2 ++
 include/uapi/linux/videodev2.h   | 7 +++
 3 files changed, 17 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 004e7e8..441a2c8 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1209,6 +1209,9 @@ static bool std_equal(const struct v4l2_ctrl *ctrl, u32 
idx,
return ptr1.p_u8[idx] == ptr2.p_u8[idx];
case V4L2_CTRL_TYPE_U16:
return ptr1.p_u16[idx] == ptr2.p_u16[idx];
+   case V4L2_CTRL_TYPE_POINT:
+   return memcmp(ptr1.p_point[idx], ptr2.p_point[idx],
+ sizeof(ptr1.p_point[idx]));
default:
if (ctrl-is_int)
return ptr1.p_s32[idx] == ptr2.p_s32[idx];
@@ -1289,6 +1292,9 @@ static void std_log(const struct v4l2_ctrl *ctrl)
case V4L2_CTRL_TYPE_U16:
pr_cont(%u, (unsigned)*ptr.p_u16);
break;
+   case V4L2_CTRL_TYPE_POINT:
+   pr_cont((%u,%u), ptr.p_point-x, ptr.p_point-y);
+   break;
default:
pr_cont(unknown type %d, ctrl-type);
break;
@@ -1346,6 +1352,8 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 
idx,
return ROUND_TO_RANGE(ptr.p_u8[idx], u8, ctrl);
case V4L2_CTRL_TYPE_U16:
return ROUND_TO_RANGE(ptr.p_u16[idx], u16, ctrl);
+   case V4L2_CTRL_TYPE_POINT:
+   return 0;
 
case V4L2_CTRL_TYPE_BOOLEAN:
ptr.p_s32[idx] = !!ptr.p_s32[idx];
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 8c4edd6..41ea629 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -42,6 +42,7 @@ struct poll_table_struct;
  * @p_u8:  Pointer to a 8-bit unsigned value.
  * @p_u16: Pointer to a 16-bit unsigned value.
  * @p_char:Pointer to a string.
+ * @p_pint:Pointer to a v4l2_point structure.
  * @p: Pointer to a compound value.
  */
 union v4l2_ctrl_ptr {
@@ -50,6 +51,7 @@ union v4l2_ctrl_ptr {
u8 *p_u8;
u16 *p_u16;
char *p_char;
+   struct v4l2_point *p_point;
void *p;
 };
 
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 5fd4202..6d5a2e1 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -218,6 +218,11 @@ struct v4l2_rect {
__u32   height;
 };
 
+struct v4l2_point {
+   __u32   x;
+   __u32   y;
+};
+
 struct v4l2_fract {
__u32   numerator;
__u32   denominator;
@@ -1288,6 +1293,7 @@ struct v4l2_ext_control {
char *string;
__u8 *p_u8;
__u16 *p_u16;
+   struct v4l2_point *p_point;
void *ptr;
};
 } __attribute__ ((packed));
@@ -1320,6 +1326,7 @@ enum v4l2_ctrl_type {
V4L2_CTRL_COMPOUND_TYPES = 0x0100,
V4L2_CTRL_TYPE_U8= 0x0100,
V4L2_CTRL_TYPE_U16   = 0x0101,
+   V4L2_CTRL_TYPE_POINT = 0x0102,
 };
 
 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
-- 
2.0.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: [ATTN] Please review/check the REVIEWv4 compound control patch series

2014-07-25 Thread Ricardo Ribalda Delgado
Hello Hans


Guess it is too late, but just so you know. I have successfully uses
this patches to implement a dead pixel array list.

Tested-by: Ricardo Ribalda ricardo.riba...@gmail.com
Thanked-by: Ricardo Ribalda ricardo.riba...@gmail.com  :)

Thanks!

On Thu, Jul 17, 2014 at 3:56 PM, Ricardo Ribalda Delgado
ricardo.riba...@gmail.com wrote:
 Hello Hans

 I am planning to test this patchset for dead pixels by the end of this
 week and the beggining of the next. I am thinking about comparing the
 performance a list of deadpixels against a list of all pixels with
 their property (ok pixel, dead pixel, white pixel, slow pixel...)

 Will write back (hopefully) soon

 Regards!

 On Thu, Jun 12, 2014 at 2:08 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Mauro  anyone else with an interest,

 I'd appreciate it if this patch series was reviewed, in particular
 with respect to the handling of multi-dimensional arrays:

 http://www.mail-archive.com/linux-media@vger.kernel.org/msg75929.html

 This patch series incorporates all comments from the REVIEWv3 series
 except for two (see the cover letter of the patch series for details),

 If support for arrays with more than 8 dimensions is really needed,
 then I would like to know asap so I can implement that in time for
 3.17.

 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



 --
 Ricardo Ribalda



-- 
Ricardo Ribalda
--
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: [ATTN] Please review/check the REVIEWv4 compound control patch series

2014-07-25 Thread Hans Verkuil
Hi Ricardo,

On 07/25/14 13:52, Ricardo Ribalda Delgado wrote:
 Hello Hans
 
 
 Guess it is too late, but just so you know. I have successfully uses
 this patches to implement a dead pixel array list.
 
 Tested-by: Ricardo Ribalda ricardo.riba...@gmail.com
 Thanked-by: Ricardo Ribalda ricardo.riba...@gmail.com  :)

Nevertheless nice to hear about this!

BTW, are you planning on upstreaming this driver? Or do you need to
have multi-selection support first? That needs the compound control
support as well, so at least it's closer to becoming a reality.

Regards,

Hans

 
 Thanks!
 
 On Thu, Jul 17, 2014 at 3:56 PM, Ricardo Ribalda Delgado
 ricardo.riba...@gmail.com wrote:
 Hello Hans

 I am planning to test this patchset for dead pixels by the end of this
 week and the beggining of the next. I am thinking about comparing the
 performance a list of deadpixels against a list of all pixels with
 their property (ok pixel, dead pixel, white pixel, slow pixel...)

 Will write back (hopefully) soon

 Regards!

 On Thu, Jun 12, 2014 at 2:08 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Mauro  anyone else with an interest,

 I'd appreciate it if this patch series was reviewed, in particular
 with respect to the handling of multi-dimensional arrays:

 http://www.mail-archive.com/linux-media@vger.kernel.org/msg75929.html

 This patch series incorporates all comments from the REVIEWv3 series
 except for two (see the cover letter of the patch series for details),

 If support for arrays with more than 8 dimensions is really needed,
 then I would like to know asap so I can implement that in time for
 3.17.

 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



 --
 Ricardo Ribalda
 
 
 

--
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: [ATTN] Please review/check the REVIEWv4 compound control patch series

2014-07-25 Thread Ricardo Ribalda Delgado
Hello Hans

I still need the multiselection support first. Right now it is done by
a modified g/s_selection ioctl.

I would love to upstream the driver, but maybe it is not the right
moment right now. We are selling a mainly to a couple of customers and
the total size of the drivers is  16000 lines of code, plus 200 MB in
firmware files.

Once we are ready to launch the product to a wider market we will
upstream it, now it will just annoy a lot of people.

Thanks



On Fri, Jul 25, 2014 at 1:56 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Ricardo,

 On 07/25/14 13:52, Ricardo Ribalda Delgado wrote:
 Hello Hans


 Guess it is too late, but just so you know. I have successfully uses
 this patches to implement a dead pixel array list.

 Tested-by: Ricardo Ribalda ricardo.riba...@gmail.com
 Thanked-by: Ricardo Ribalda ricardo.riba...@gmail.com  :)

 Nevertheless nice to hear about this!

 BTW, are you planning on upstreaming this driver? Or do you need to
 have multi-selection support first? That needs the compound control
 support as well, so at least it's closer to becoming a reality.

 Regards,

 Hans


 Thanks!

 On Thu, Jul 17, 2014 at 3:56 PM, Ricardo Ribalda Delgado
 ricardo.riba...@gmail.com wrote:
 Hello Hans

 I am planning to test this patchset for dead pixels by the end of this
 week and the beggining of the next. I am thinking about comparing the
 performance a list of deadpixels against a list of all pixels with
 their property (ok pixel, dead pixel, white pixel, slow pixel...)

 Will write back (hopefully) soon

 Regards!

 On Thu, Jun 12, 2014 at 2:08 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Mauro  anyone else with an interest,

 I'd appreciate it if this patch series was reviewed, in particular
 with respect to the handling of multi-dimensional arrays:

 http://www.mail-archive.com/linux-media@vger.kernel.org/msg75929.html

 This patch series incorporates all comments from the REVIEWv3 series
 except for two (see the cover letter of the patch series for details),

 If support for arrays with more than 8 dimensions is really needed,
 then I would like to know asap so I can implement that in time for
 3.17.

 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



 --
 Ricardo Ribalda







-- 
Ricardo Ribalda
--
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: [ATTN] Please review/check the REVIEWv4 compound control patch series

2014-07-25 Thread Hans Verkuil
On 07/25/14 14:09, Ricardo Ribalda Delgado wrote:
 Hello Hans
 
 I still need the multiselection support first. Right now it is done by
 a modified g/s_selection ioctl.
 
 I would love to upstream the driver, but maybe it is not the right
 moment right now. We are selling a mainly to a couple of customers and
 the total size of the drivers is  16000 lines of code, plus 200 MB in
 firmware files.

I was thinking of just the sensor driver, not the other components.
That would provide a proper use-case for both the dead pixel array
and multi-selection.

I assume that the sensor driver is a lot smaller? Does it need fw as well?

Regards,

Hans

 
 Once we are ready to launch the product to a wider market we will
 upstream it, now it will just annoy a lot of people.
 
 Thanks
 
 
 
 On Fri, Jul 25, 2014 at 1:56 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Ricardo,

 On 07/25/14 13:52, Ricardo Ribalda Delgado wrote:
 Hello Hans


 Guess it is too late, but just so you know. I have successfully uses
 this patches to implement a dead pixel array list.

 Tested-by: Ricardo Ribalda ricardo.riba...@gmail.com
 Thanked-by: Ricardo Ribalda ricardo.riba...@gmail.com  :)

 Nevertheless nice to hear about this!

 BTW, are you planning on upstreaming this driver? Or do you need to
 have multi-selection support first? That needs the compound control
 support as well, so at least it's closer to becoming a reality.

 Regards,

 Hans


 Thanks!

 On Thu, Jul 17, 2014 at 3:56 PM, Ricardo Ribalda Delgado
 ricardo.riba...@gmail.com wrote:
 Hello Hans

 I am planning to test this patchset for dead pixels by the end of this
 week and the beggining of the next. I am thinking about comparing the
 performance a list of deadpixels against a list of all pixels with
 their property (ok pixel, dead pixel, white pixel, slow pixel...)

 Will write back (hopefully) soon

 Regards!

 On Thu, Jun 12, 2014 at 2:08 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Mauro  anyone else with an interest,

 I'd appreciate it if this patch series was reviewed, in particular
 with respect to the handling of multi-dimensional arrays:

 http://www.mail-archive.com/linux-media@vger.kernel.org/msg75929.html

 This patch series incorporates all comments from the REVIEWv3 series
 except for two (see the cover letter of the patch series for details),

 If support for arrays with more than 8 dimensions is really needed,
 then I would like to know asap so I can implement that in time for
 3.17.

 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



 --
 Ricardo Ribalda




 
 
 

--
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: msi2500: move msi3101 out of staging and rename

2014-07-25 Thread Dan Carpenter
Hello Antti Palosaari,

The patch fd8b5f502929: msi2500: move msi3101 out of staging and
rename from Jul 13, 2014, leads to the following static checker
warning:

drivers/media/usb/msi2500/msi2500.c:887 msi2500_stop_streaming()
 error: we previously assumed 's-udev' could be null (see line 880)

drivers/media/usb/msi2500/msi2500.c
   872  static void msi2500_stop_streaming(struct vb2_queue *vq)
   873  {
   874  struct msi2500_state *s = vb2_get_drv_priv(vq);
   875  
   876  dev_dbg(s-udev-dev, %s:\n, __func__);
   877  
   878  mutex_lock(s-v4l2_lock);
   879  
   880  if (s-udev)
^^^
Check.

   881  msi2500_isoc_cleanup(s);
   882  
   883  msi2500_cleanup_queued_bufs(s);
   884  
   885  /* according to tests, at least 700us delay is required  */
   886  msleep(20);
   887  if (!msi2500_ctrl_msg(s, CMD_STOP_STREAMING, 0)) {
 ^^
Unchecked dereference if you have debugging enabled.

   888  /* sleep USB IF / ADC */
   889  msi2500_ctrl_msg(s, CMD_WREG, 0x0103);
   890  }

regards,
dan carpenter
--
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: [ATTN] Please review/check the REVIEWv4 compound control patch series

2014-07-25 Thread Ricardo Ribalda Delgado
Hi Hans!

 I was thinking of just the sensor driver, not the other components.
 That would provide a proper use-case for both the dead pixel array
 and multi-selection.

 I assume that the sensor driver is a lot smaller? Does it need fw as well?


We support multiple sensors. The one that requires dead-pixel
correction is: FPA-320x256-C

Unfortunately, the chip only outputs the data as an analog output. The
data is processed by an FPGA. The FPGA requires firmware (the
bitstream).

I guess most of the code is useless for anybody else, if they don't
have access to the proper hw.

Thanks

Ricardo
--
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 v2 06/29] [media] coda: Add encoder/decoder support for CODA960

2014-07-25 Thread Fabio Estevam
Hi Robert,

On Mon, Jul 21, 2014 at 4:07 AM, Robert Schwebel
r.schwe...@pengutronix.de wrote:
 Hi Fabio,

 On Fri, Jul 11, 2014 at 02:33:18PM +0200, Robert Schwebel wrote:
 On Wed, Jul 02, 2014 at 09:16:42PM +0200, Robert Schwebel wrote:
   It would be really nice if the firmware was available in the
   linux-firmware repository. Do you think this would be possible?
  
   Best wishes,
   --
   Kamil Debski
   Samsung RD Institute Poland
 
  I tried to convince Freescale to put the firmware into linux-firmware
  for 15 months now, but recently got no reply any more.
 
  Fabio, Shawn, could you try to discuss this with the responsible folks
  inside FSL again? Maybe responsibilities have changed in the meantime
  and I might have tried to talk to the wrong people.

 Any news?

 Did you get some feedback? I didn't.

I am adding Jeff Kudrick on Cc as he was looking into 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


[PATCH v3 0/9] Support for Exynos3250 SoC in the s5p-jpeg driver

2014-07-25 Thread Sylwester Nawrocki
This patch series adds support for the JPEG codec IP found on the
Exynos3250 SoCs. Supported raw formats are: YUYV, YVYU, UYVY, VYUY,
RGB565, RGB565X, RGB32, NV12, NV21. Support for the hardware scaling
and cropping features is added.

Changes since v2 (only patches 1/9, 2/9, 9/9):
 - the IP function clock renamed from sclk-jpeg to sclk and made
   optional regardless of the device compatible string,
 - fixed compilation warning in jpeg-hw-exynos3250.c.

Changes since v1:
 - added default case to the switch statement in the function
   exynos3250_jpeg_dec_scaling_ratiofunction
 - removed not supported DT properties
 - improved DT documentation
 - updated Kconfig entry
 - corrected DTS maintainer email in the commit message

Jacek Anaszewski (9):
  [media] s5p-jpeg: Document sclk-jpeg clock for Exynos3250 SoC
  s5p-jpeg: Add support for Exynos3250 SoC
  s5p-jpeg: return error immediately after get_byte fails
  s5p-jpeg: Adjust jpeg_bound_align_image to Exynos3250 needs
  s5p-jpeg: fix g_selection op
  s5p-jpeg: Assure proper crop rectangle initialization
  s5p-jpeg: Prevent erroneous downscaling for Exynos3250 SoC
  s5p-jpeg: add chroma subsampling adjustment for Exynos3250
  ARM: dts: exynos3250: add JPEG codec device node

 .../bindings/media/exynos-jpeg-codec.txt   |   12 +-
 arch/arm/boot/dts/exynos3250.dtsi  |9 +
 drivers/media/platform/Kconfig |5 +-
 drivers/media/platform/s5p-jpeg/Makefile   |2 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.c|  660 ++--
 drivers/media/platform/s5p-jpeg/jpeg-core.h|   32 +-
 .../media/platform/s5p-jpeg/jpeg-hw-exynos3250.c   |  487 +++
 .../media/platform/s5p-jpeg/jpeg-hw-exynos3250.h   |   60 ++
 drivers/media/platform/s5p-jpeg/jpeg-regs.h|  247 +++-
 9 files changed, 1455 insertions(+), 59 deletions(-)
 create mode 100644 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c
 create mode 100644 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.h

--
1.7.9.5

--
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 9/9] ARM: dts: exynos3250: add JPEG codec device node

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

Cc: Kukjin Kim kgene@samsung.com
Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 arch/arm/boot/dts/exynos3250.dtsi |9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/exynos3250.dtsi 
b/arch/arm/boot/dts/exynos3250.dtsi
index 3e678fa..46a864d 100644
--- a/arch/arm/boot/dts/exynos3250.dtsi
+++ b/arch/arm/boot/dts/exynos3250.dtsi
@@ -206,6 +206,15 @@
interrupts = 0 240 0;
};

+   jpeg-codec@1183 {
+   compatible = samsung,exynos3250-jpeg;
+   reg = 0x1183 0x1000;
+   interrupts = 0 171 0;
+   clocks = cmu CLK_JPEG, cmu CLK_SCLK_JPEG;
+   clock-names = jpeg, sclk;
+   samsung,power-domain = pd_cam;
+   };
+
mshc_0: mshc@1251 {
compatible = samsung,exynos5250-dw-mshc;
reg = 0x1251 0x1000;
--
1.7.9.5

--
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/9] s5p-jpeg: Adjust jpeg_bound_align_image to Exynos3250 needs

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

The jpeg_bound_align_image function needs to know the context
in which it is called, as it needs to align image dimensions in
a slight different manner for Exynos3250, which crops pixels
for specific values in case the format is RGB.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c |   25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index a3f8862..5ef7f5b 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1133,7 +1133,8 @@ static struct s5p_jpeg_fmt *s5p_jpeg_find_format(struct 
s5p_jpeg_ctx *ctx,
return NULL;
 }

-static void jpeg_bound_align_image(u32 *w, unsigned int wmin, unsigned int 
wmax,
+static void jpeg_bound_align_image(struct s5p_jpeg_ctx *ctx,
+  u32 *w, unsigned int wmin, unsigned int wmax,
   unsigned int walign,
   u32 *h, unsigned int hmin, unsigned int hmax,
   unsigned int halign)
@@ -1145,13 +1146,27 @@ static void jpeg_bound_align_image(u32 *w, unsigned int 
wmin, unsigned int wmax,

w_step = 1  walign;
h_step = 1  halign;
+
+   if (ctx-jpeg-variant-version == SJPEG_EXYNOS3250) {
+   /*
+* Rightmost and bottommost pixels are cropped by the
+* Exynos3250 JPEG IP for RGB formats, for the specific
+* width and height values respectively. This assignment
+* will result in v4l_bound_align_image returning dimensions
+* reduced by 1 for the aforementioned cases.
+*/
+   if (w_step == 4  ((width  3) == 1)) {
+   wmax = width;
+   hmax = height;
+   }
+   }
+
v4l_bound_align_image(w, wmin, wmax, walign, h, hmin, hmax, halign, 0);

if (*w  width  (*w + w_step)  wmax)
*w += w_step;
if (*h  height  (*h + h_step)  hmax)
*h += h_step;
-
 }

 static int vidioc_try_fmt(struct v4l2_format *f, struct s5p_jpeg_fmt *fmt,
@@ -1167,12 +1182,12 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct 
s5p_jpeg_fmt *fmt,
/* V4L2 specification suggests the driver corrects the format struct
 * if any of the dimensions is unsupported */
if (q_type == FMT_TYPE_OUTPUT)
-   jpeg_bound_align_image(pix-width, S5P_JPEG_MIN_WIDTH,
+   jpeg_bound_align_image(ctx, pix-width, S5P_JPEG_MIN_WIDTH,
   S5P_JPEG_MAX_WIDTH, 0,
   pix-height, S5P_JPEG_MIN_HEIGHT,
   S5P_JPEG_MAX_HEIGHT, 0);
else
-   jpeg_bound_align_image(pix-width, S5P_JPEG_MIN_WIDTH,
+   jpeg_bound_align_image(ctx, pix-width, S5P_JPEG_MIN_WIDTH,
   S5P_JPEG_MAX_WIDTH, fmt-h_align,
   pix-height, S5P_JPEG_MIN_HEIGHT,
   S5P_JPEG_MAX_HEIGHT, fmt-v_align);
@@ -1294,7 +1309,7 @@ static int exynos4_jpeg_get_output_buffer_size(struct 
s5p_jpeg_ctx *ctx,
else
wh_align = 1;

-   jpeg_bound_align_image(w, S5P_JPEG_MIN_WIDTH,
+   jpeg_bound_align_image(ctx, w, S5P_JPEG_MIN_WIDTH,
   S5P_JPEG_MAX_WIDTH, wh_align,
   h, S5P_JPEG_MIN_HEIGHT,
   S5P_JPEG_MAX_HEIGHT, wh_align);
--
1.7.9.5

--
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 3/9] s5p-jpeg: return error immediately after get_byte fails

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

When parsing JPEG header s5p_jpeg_parse_hdr function should return
immediately in case there was an error while reading a byte.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 126199e..a3f8862 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -906,14 +906,14 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data 
*result,
while (notfound) {
c = get_byte(jpeg_buffer);
if (c == -1)
-   break;
+   return false;
if (c != 0xff)
continue;
do
c = get_byte(jpeg_buffer);
while (c == 0xff);
if (c == -1)
-   break;
+   return false;
if (c == 0)
continue;
length = 0;
--
1.7.9.5

--
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 8/9] s5p-jpeg: add chroma subsampling adjustment for Exynos3250

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

Take into account limitations specific to the Exynos3250 SoC,
regarding setting the chroma subsampling control's value.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c |   59 +--
 1 file changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index eb13fdf..e66acbc 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1603,36 +1603,53 @@ static int s5p_jpeg_g_volatile_ctrl(struct v4l2_ctrl 
*ctrl)
return 0;
 }

-static int s5p_jpeg_try_ctrl(struct v4l2_ctrl *ctrl)
+static int s5p_jpeg_adjust_subs_ctrl(struct s5p_jpeg_ctx *ctx, int *ctrl_val)
 {
-   struct s5p_jpeg_ctx *ctx = ctrl_to_ctx(ctrl);
-   unsigned long flags;
-   int ret = 0;
-
-   spin_lock_irqsave(ctx-jpeg-slock, flags);
-
-   if (ctrl-id == V4L2_CID_JPEG_CHROMA_SUBSAMPLING) {
-   if (ctx-jpeg-variant-version == SJPEG_S5P)
-   goto error_free;
+   switch (ctx-jpeg-variant-version) {
+   case SJPEG_S5P:
+   return 0;
+   case SJPEG_EXYNOS3250:
+   /*
+* The exynos3250 device can produce JPEG image only
+* of 4:4:4 subsampling when given RGB32 source image.
+*/
+   if (ctx-out_q.fmt-fourcc == V4L2_PIX_FMT_RGB32)
+   *ctrl_val = 0;
+   break;
+   case SJPEG_EXYNOS4:
/*
 * The exynos4x12 device requires input raw image fourcc
 * to be V4L2_PIX_FMT_GREY if gray jpeg format
 * is to be set.
 */
if (ctx-out_q.fmt-fourcc != V4L2_PIX_FMT_GREY 
-   ctrl-val == V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY) {
-   ret = -EINVAL;
-   goto error_free;
-   }
-   /*
-* The exynos4x12 device requires resulting jpeg subsampling
-* not to be lower than the input raw image subsampling.
-*/
-   if (ctx-out_q.fmt-subsampling  ctrl-val)
-   ctrl-val = ctx-out_q.fmt-subsampling;
+   *ctrl_val == V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY)
+   return -EINVAL;
+   break;
}

-error_free:
+   /*
+* The exynos4x12 and exynos3250 devices require resulting
+* jpeg subsampling not to be lower than the input raw image
+* subsampling.
+*/
+   if (ctx-out_q.fmt-subsampling  *ctrl_val)
+   *ctrl_val = ctx-out_q.fmt-subsampling;
+
+   return 0;
+}
+
+static int s5p_jpeg_try_ctrl(struct v4l2_ctrl *ctrl)
+{
+   struct s5p_jpeg_ctx *ctx = ctrl_to_ctx(ctrl);
+   unsigned long flags;
+   int ret = 0;
+
+   spin_lock_irqsave(ctx-jpeg-slock, flags);
+
+   if (ctrl-id == V4L2_CID_JPEG_CHROMA_SUBSAMPLING)
+   ret = s5p_jpeg_adjust_subs_ctrl(ctx, ctrl-val);
+
spin_unlock_irqrestore(ctx-jpeg-slock, flags);
return ret;
 }
--
1.7.9.5

--
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 7/9] s5p-jpeg: Prevent erroneous downscaling for Exynos3250 SoC

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

JPEG codec on Exynos3250 SoC produces broken raw image if a JPEG
image is decoded to YUV420 format and downscaled by a factor
greater than 2. Prevent this by asserting downscale ratio to 2.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c |   18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 3e3d94d..eb13fdf 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1317,12 +1317,16 @@ static int exynos4_jpeg_get_output_buffer_size(struct 
s5p_jpeg_ctx *ctx,
return w * h * fmt_depth  3;
 }

+static int exynos3250_jpeg_try_downscale(struct s5p_jpeg_ctx *ctx,
+  struct v4l2_rect *r);
+
 static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f)
 {
struct vb2_queue *vq;
struct s5p_jpeg_q_data *q_data = NULL;
struct v4l2_pix_format *pix = f-fmt.pix;
struct v4l2_ctrl *ctrl_subs;
+   struct v4l2_rect scale_rect;
unsigned int f_type;

vq = v4l2_m2m_get_vq(ct-fh.m2m_ctx, f-type);
@@ -1382,6 +1386,20 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, 
struct v4l2_format *f)
ct-crop_rect.width = pix-width;
ct-crop_rect.height = pix-height;
}
+
+   /*
+* Prevent downscaling to YUV420 format by more than 2
+* for Exynos3250 SoC as it produces broken raw image
+* in such cases.
+*/
+   if (ct-mode == S5P_JPEG_DECODE 
+   f_type == FMT_TYPE_CAPTURE 
+   ct-jpeg-variant-version == SJPEG_EXYNOS3250 
+   pix-pixelformat == V4L2_PIX_FMT_YUV420 
+   ct-scale_factor  2) {
+   scale_rect.width = ct-out_q.w / 2;
+   scale_rect.height = ct-out_q.h / 2;
+   exynos3250_jpeg_try_downscale(ct, scale_rect);
}

return 0;
--
1.7.9.5

--
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/9] s5p-jpeg: fix g_selection op

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

V4L2_SEL_TGT_COMPOSE_DEFAULT switch case should select whole
available area of the image and V4L2_SEL_TGT_COMPOSE
should apply user settings.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 5ef7f5b..d11357f 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1505,21 +1505,23 @@ static int s5p_jpeg_g_selection(struct file *file, void 
*priv,
case V4L2_SEL_TGT_CROP:
case V4L2_SEL_TGT_CROP_BOUNDS:
case V4L2_SEL_TGT_CROP_DEFAULT:
-   case V4L2_SEL_TGT_COMPOSE:
case V4L2_SEL_TGT_COMPOSE_DEFAULT:
s-r.width = ctx-out_q.w;
s-r.height = ctx-out_q.h;
+   s-r.left = 0;
+   s-r.top = 0;
break;
+   case V4L2_SEL_TGT_COMPOSE:
case V4L2_SEL_TGT_COMPOSE_BOUNDS:
case V4L2_SEL_TGT_COMPOSE_PADDED:
-   s-r.width = ctx-cap_q.w;
-   s-r.height = ctx-cap_q.h;
+   s-r.width = ctx-crop_rect.width;
+   s-r.height =  ctx-crop_rect.height;
+   s-r.left = ctx-crop_rect.left;
+   s-r.top = ctx-crop_rect.top;
break;
default:
return -EINVAL;
}
-   s-r.left = 0;
-   s-r.top = 0;
return 0;
 }

--
1.7.9.5

--
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/9] [media] s5p-jpeg: Document sclk-jpeg clock for Exynos3250 SoC

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

JPEG IP on Exynos3250 SoC requires enabling two clock gates
for its operation. This patch documents this requirement.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Rob Herring robh...@kernel.org
Cc: Pawel Moll pawel.m...@arm.com
Cc: Mark Rutland mark.rutl...@arm.com
Cc: Ian Campbell ijc+devicet...@hellion.org.uk
Cc: Kumar Gala ga...@codeaurora.org
Cc: devicet...@vger.kernel.org
---
 .../bindings/media/exynos-jpeg-codec.txt   |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt 
b/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
index 937b755..bf52ed4 100644
--- a/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
+++ b/Documentation/devicetree/bindings/media/exynos-jpeg-codec.txt
@@ -3,9 +3,13 @@ Samsung S5P/EXYNOS SoC series JPEG codec
 Required properties:

 - compatible   : should be one of:
- samsung,s5pv210-jpeg, samsung,exynos4210-jpeg;
+ samsung,s5pv210-jpeg, samsung,exynos4210-jpeg,
+ samsung,exynos3250-jpeg;
 - reg  : address and length of the JPEG codec IP register set;
 - interrupts   : specifies the JPEG codec IP interrupt;
-- clocks   : should contain the JPEG codec IP gate clock specifier, from 
the
- common clock bindings;
-- clock-names  : should contain jpeg entry.
+- clock-names   : should contain:
+  - jpeg for the core gate clock,
+  - sclk for the special clock (optional).
+- clocks   : should contain the clock specifier and clock ID list
+ matching entries in the clock-names property; from
+ the common clock bindings.
--
1.7.9.5

--
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/9] s5p-jpeg: Assure proper crop rectangle initialization

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

Assure proper crop_rect initialization in case
the user space doesn't call S_SELECTION ioctl.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index d11357f..3e3d94d 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1367,6 +1367,21 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, 
struct v4l2_format *f)
V4L2_CID_JPEG_CHROMA_SUBSAMPLING);
if (ctrl_subs)
v4l2_ctrl_s_ctrl(ctrl_subs, q_data-fmt-subsampling);
+   ct-crop_altered = false;
+   }
+
+   /*
+* For decoding init crop_rect with capture buffer dimmensions which
+* contain aligned dimensions of the input JPEG image and do it only
+* if crop rectangle hasn't been altered by the user space e.g. with
+* S_SELECTION ioctl. For encoding assign output buffer dimensions.
+*/
+   if (!ct-crop_altered 
+   ((ct-mode == S5P_JPEG_DECODE  f_type == FMT_TYPE_CAPTURE) ||
+(ct-mode == S5P_JPEG_ENCODE  f_type == FMT_TYPE_OUTPUT))) {
+   ct-crop_rect.width = pix-width;
+   ct-crop_rect.height = pix-height;
+   }
}

return 0;
--
1.7.9.5

--
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 2/9] s5p-jpeg: Add support for Exynos3250 SoC

2014-07-25 Thread Sylwester Nawrocki
From: Jacek Anaszewski j.anaszew...@samsung.com

This patch adds support for jpeg codec on Exynos3250 SoC to
the s5p-jpeg driver. Supported raw formats are: YUYV, YVYU, UYVY,
VYUY, RGB565, RGB565X, RGB32, NV12, NV21. The support includes
also scaling and cropping features.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/Kconfig |5 +-
 drivers/media/platform/s5p-jpeg/Makefile   |2 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.c|  527 +++-
 drivers/media/platform/s5p-jpeg/jpeg-core.h|   32 +-
 .../media/platform/s5p-jpeg/jpeg-hw-exynos3250.c   |  487 ++
 .../media/platform/s5p-jpeg/jpeg-hw-exynos3250.h   |   60 +++
 drivers/media/platform/s5p-jpeg/jpeg-regs.h|  247 -
 7 files changed, 1338 insertions(+), 22 deletions(-)
 create mode 100644 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c
 create mode 100644 drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 433f0bf..6d86646 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -167,12 +167,13 @@ config VIDEO_SAMSUNG_S5P_G2D
  2d graphics accelerator.

 config VIDEO_SAMSUNG_S5P_JPEG
-   tristate Samsung S5P/Exynos4 JPEG codec driver
+   tristate Samsung S5P/Exynos3250/Exynos4 JPEG codec driver
depends on VIDEO_DEV  VIDEO_V4L2  (PLAT_S5P || ARCH_EXYNOS)
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
---help---
- This is a v4l2 driver for Samsung S5P and EXYNOS4 JPEG codec
+ This is a v4l2 driver for Samsung S5P, EXYNOS3250
+ and EXYNOS4 JPEG codec

 config VIDEO_SAMSUNG_S5P_MFC
tristate Samsung S5P MFC Video Codec
diff --git a/drivers/media/platform/s5p-jpeg/Makefile 
b/drivers/media/platform/s5p-jpeg/Makefile
index a1a9169..9e5f214 100644
--- a/drivers/media/platform/s5p-jpeg/Makefile
+++ b/drivers/media/platform/s5p-jpeg/Makefile
@@ -1,2 +1,2 @@
-s5p-jpeg-objs := jpeg-core.o jpeg-hw-exynos4.o jpeg-hw-s5p.o
+s5p-jpeg-objs := jpeg-core.o jpeg-hw-exynos3250.o jpeg-hw-exynos4.o 
jpeg-hw-s5p.o
 obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg.o
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c 
b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 0dcb796..126199e 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1,6 +1,6 @@
 /* linux/drivers/media/platform/s5p-jpeg/jpeg-core.c
  *
- * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
  * http://www.samsung.com
  *
  * Author: Andrzej Pietrasiewicz andrze...@samsung.com
@@ -32,6 +32,7 @@
 #include jpeg-core.h
 #include jpeg-hw-s5p.h
 #include jpeg-hw-exynos4.h
+#include jpeg-hw-exynos3250.h
 #include jpeg-regs.h

 static struct s5p_jpeg_fmt sjpeg_formats[] = {
@@ -41,6 +42,7 @@ static struct s5p_jpeg_fmt sjpeg_formats[] = {
.flags  = SJPEG_FMT_FLAG_ENC_CAPTURE |
  SJPEG_FMT_FLAG_DEC_OUTPUT |
  SJPEG_FMT_FLAG_S5P |
+ SJPEG_FMT_FLAG_EXYNOS3250 |
  SJPEG_FMT_FLAG_EXYNOS4,
},
{
@@ -70,6 +72,19 @@ static struct s5p_jpeg_fmt sjpeg_formats[] = {
.subsampling= V4L2_JPEG_CHROMA_SUBSAMPLING_422,
},
{
+   .name   = YUV 4:2:2 packed, YCbYCr,
+   .fourcc = V4L2_PIX_FMT_YUYV,
+   .depth  = 16,
+   .colplanes  = 1,
+   .h_align= 2,
+   .v_align= 0,
+   .flags  = SJPEG_FMT_FLAG_ENC_OUTPUT |
+ SJPEG_FMT_FLAG_DEC_CAPTURE |
+ SJPEG_FMT_FLAG_EXYNOS3250 |
+ SJPEG_FMT_NON_RGB,
+   .subsampling= V4L2_JPEG_CHROMA_SUBSAMPLING_422,
+   },
+   {
.name   = YUV 4:2:2 packed, YCrYCb,
.fourcc = V4L2_PIX_FMT_YVYU,
.depth  = 16,
@@ -83,6 +98,45 @@ static struct s5p_jpeg_fmt sjpeg_formats[] = {
.subsampling= V4L2_JPEG_CHROMA_SUBSAMPLING_422,
},
{
+   .name   = YUV 4:2:2 packed, YCrYCb,
+   .fourcc = V4L2_PIX_FMT_YVYU,
+   .depth  = 16,
+   .colplanes  = 1,
+   .h_align= 2,
+   .v_align= 0,
+   .flags  = SJPEG_FMT_FLAG_ENC_OUTPUT |
+ SJPEG_FMT_FLAG_DEC_CAPTURE |
+ SJPEG_FMT_FLAG_EXYNOS3250 |
+ SJPEG_FMT_NON_RGB,
+   

[PATCH 6/6] media: soc_camera: rcar_vin: Add r8a7794 device support

2014-07-25 Thread Ulrich Hecht
From: Koji Matsuoka koji.matsuoka...@renesas.com

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Cc: linux-media@vger.kernel.org

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

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index e594230..86d98cd 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1391,6 +1391,7 @@ static struct soc_camera_host_ops rcar_vin_host_ops = {
 };
 
 static struct platform_device_id rcar_vin_id_table[] = {
+   { r8a7794-vin,  RCAR_GEN2 },
{ r8a7791-vin,  RCAR_GEN2 },
{ r8a7790-vin,  RCAR_GEN2 },
{ r8a7779-vin,  RCAR_H1 },
-- 
1.8.4.5

--
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 04/11] [media] coda: Propagate the correct error on devm_request_threaded_irq()

2014-07-25 Thread Philipp Zabel
From: Fabio Estevam fabio.este...@freescale.com

If devm_request_threaded_irq() fails, we should better propagate the real error.

Also, print out the error code in the dev_err message.

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-common.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 31d0a2f..ab4b4c3 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1843,10 +1843,12 @@ static int coda_probe(struct platform_device *pdev)
return irq;
}
 
-   if (devm_request_threaded_irq(pdev-dev, irq, NULL, coda_irq_handler,
-   IRQF_ONESHOT, dev_name(pdev-dev), dev)  0) {
-   dev_err(pdev-dev, failed to request irq\n);
-   return -ENOENT;
+   ret = devm_request_threaded_irq(pdev-dev, irq, NULL,
+   coda_irq_handler, IRQF_ONESHOT,
+   dev_name(pdev-dev), dev);
+   if (ret  0) {
+   dev_err(pdev-dev, failed to request irq: %d\n, ret);
+   return ret;
}
 
dev-rstc = devm_reset_control_get_optional(pdev-dev, NULL);
-- 
2.0.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 10/11] [media] coda: improve allocation error messages

2014-07-25 Thread Philipp Zabel
Produce some error messages when internal buffer allocation
fails, for example because the CMA region is too small.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-bit.c| 4 +++-
 drivers/media/platform/coda/coda-common.c | 6 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index cc9afb7..fcc676c 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1375,8 +1375,10 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
}
 
ret = coda_alloc_framebuffers(ctx, q_data_dst, src_fourcc);
-   if (ret  0)
+   if (ret  0) {
+   v4l2_err(dev-v4l2_dev, failed to allocate framebuffers\n);
return ret;
+   }
 
/* Tell the decoder how many frame buffers we allocated. */
coda_write(dev, ctx-num_internal_frames, CODA_CMD_SET_FRAME_BUF_NUM);
diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 5a113c5..425e279 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -971,8 +971,12 @@ int coda_alloc_aux_buf(struct coda_dev *dev, struct 
coda_aux_buf *buf,
 {
buf-vaddr = dma_alloc_coherent(dev-plat_dev-dev, size, buf-paddr,
GFP_KERNEL);
-   if (!buf-vaddr)
+   if (!buf-vaddr) {
+   v4l2_err(dev-v4l2_dev,
+Failed to allocate %s buffer of size %u\n,
+name, size);
return -ENOMEM;
+   }
 
buf-size = size;
 
-- 
2.0.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 07/11] [media] coda: skip calling coda_find_codec in encoder try_fmt_vid_out

2014-07-25 Thread Philipp Zabel
We know that it will return NULL in this case, so we can just as well
skip it altogether.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-common.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index c84634b..c38c8bd 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -426,15 +426,16 @@ static int coda_try_fmt_vid_out(struct file *file, void 
*priv,
struct v4l2_format *f)
 {
struct coda_ctx *ctx = fh_to_ctx(priv);
-   const struct coda_codec *codec;
+   const struct coda_codec *codec = NULL;
 
/* Determine codec by encoded format, returns NULL if raw or invalid */
-   codec = coda_find_codec(ctx-dev, f-fmt.pix.pixelformat,
-   V4L2_PIX_FMT_YUV420);
-   if (!codec  ctx-inst_type == CODA_INST_DECODER) {
-   codec = coda_find_codec(ctx-dev, V4L2_PIX_FMT_H264,
+   if (ctx-inst_type == CODA_INST_DECODER) {
+   codec = coda_find_codec(ctx-dev, f-fmt.pix.pixelformat,
V4L2_PIX_FMT_YUV420);
if (!codec)
+   codec = coda_find_codec(ctx-dev, V4L2_PIX_FMT_H264,
+   V4L2_PIX_FMT_YUV420);
+   if (!codec)
return -EINVAL;
}
 
-- 
2.0.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 02/11] [media] coda: request BIT processor interrupt by name

2014-07-25 Thread Philipp Zabel
Request the main coda interrupt using its name, bit, if available.
Fall back to requesting the first interrupt for backwards compatibility.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index c6ad956..65c7a12 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1835,7 +1835,9 @@ static int coda_probe(struct platform_device *pdev)
return PTR_ERR(dev-regs_base);
 
/* IRQ */
-   irq = platform_get_irq(pdev, 0);
+   irq = platform_get_irq_byname(pdev, bit);
+   if (irq  0)
+   irq = platform_get_irq(pdev, 0);
if (irq  0) {
dev_err(pdev-dev, failed to get irq resource\n);
return -ENOENT;
-- 
2.0.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 11/11] [media] coda: fix timestamp list handling

2014-07-25 Thread Philipp Zabel
From: Michael Olbrich m.olbr...@pengutronix.de

Lock modification of the timestamp list with bitstream_mutex and do not
try to remove a timestamp element if the list is empty. This can happen
if the userspace feeds us garbage or multiple encoded frames in a single
buffer.

Signed-off-by: Michael Olbrich m.olbr...@pengutronix.de
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-bit.c| 27 ++-
 drivers/media/platform/coda/coda-common.c |  2 ++
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index fcc676c..1e7a243 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1696,18 +1696,27 @@ static void coda_finish_decode(struct coda_ctx *ctx)
v4l2_err(dev-v4l2_dev,
 decoded frame index out of range: %d\n, decoded_idx);
} else {
-   ts = list_first_entry(ctx-timestamp_list,
- struct coda_timestamp, list);
-   list_del(ts-list);
val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
val -= ctx-sequence_offset;
-   if (val != (ts-sequence  0x)) {
-   v4l2_err(dev-v4l2_dev,
-sequence number mismatch (%d(%d) != %d)\n,
-val, ctx-sequence_offset, ts-sequence);
+   mutex_lock(ctx-bitstream_mutex);
+   if (!list_empty(ctx-timestamp_list)) {
+   ts = list_first_entry(ctx-timestamp_list,
+ struct coda_timestamp, list);
+   list_del(ts-list);
+   if (val != (ts-sequence  0x)) {
+   v4l2_err(dev-v4l2_dev,
+sequence number mismatch (%d(%d) != 
%d)\n,
+val, ctx-sequence_offset, 
ts-sequence);
+   }
+   ctx-frame_timestamps[decoded_idx] = *ts;
+   kfree(ts);
+   } else {
+   v4l2_err(dev-v4l2_dev, empty timestamp list!\n);
+   memset(ctx-frame_timestamps[decoded_idx], 0,
+  sizeof(struct coda_timestamp));
+   ctx-frame_timestamps[decoded_idx].sequence = val;
}
-   ctx-frame_timestamps[decoded_idx] = *ts;
-   kfree(ts);
+   mutex_unlock(ctx-bitstream_mutex);
 
val = coda_read(dev, CODA_RET_DEC_PIC_TYPE)  0x7;
if (val == 0)
diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 425e279..6cb8349 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1116,12 +1116,14 @@ static void coda_stop_streaming(struct vb2_queue *q)
if (!ctx-streamon_out  !ctx-streamon_cap) {
struct coda_timestamp *ts;
 
+   mutex_lock(ctx-bitstream_mutex);
while (!list_empty(ctx-timestamp_list)) {
ts = list_first_entry(ctx-timestamp_list,
  struct coda_timestamp, list);
list_del(ts-list);
kfree(ts);
}
+   mutex_unlock(ctx-bitstream_mutex);
kfifo_init(ctx-bitstream_fifo,
ctx-bitstream.vaddr, ctx-bitstream.size);
ctx-runcounter = 0;
-- 
2.0.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 08/11] [media] coda: increase max vertical frame size to 1088

2014-07-25 Thread Philipp Zabel
This patch increases the maximum vertical frame size reported
by enum_fmt and accepted by try_fmt/s_fmt from 1080 to 1088.
Since for 16x16-pixel macroblocks 1080p will be rounded up to
this anyway, we may as well admit that we support it.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-common.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index c38c8bd..da5dd2f 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -39,7 +39,6 @@
 #include media/videobuf2-dma-contig.h
 
 #include coda.h
-#include coda_regs.h
 
 #define CODA_NAME  coda
 
@@ -122,15 +121,15 @@ static const struct coda_codec codadx6_codecs[] = {
 static const struct coda_codec coda7_codecs[] = {
CODA_CODEC(CODA7_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, 
V4L2_PIX_FMT_H264,   1280, 720),
CODA_CODEC(CODA7_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420, 
V4L2_PIX_FMT_MPEG4,  1280, 720),
-   CODA_CODEC(CODA7_MODE_DECODE_H264, V4L2_PIX_FMT_H264,   
V4L2_PIX_FMT_YUV420, 1920, 1080),
-   CODA_CODEC(CODA7_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
V4L2_PIX_FMT_YUV420, 1920, 1080),
+   CODA_CODEC(CODA7_MODE_DECODE_H264, V4L2_PIX_FMT_H264,   
V4L2_PIX_FMT_YUV420, 1920, 1088),
+   CODA_CODEC(CODA7_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
V4L2_PIX_FMT_YUV420, 1920, 1088),
 };
 
 static const struct coda_codec coda9_codecs[] = {
-   CODA_CODEC(CODA9_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, 
V4L2_PIX_FMT_H264,   1920, 1080),
-   CODA_CODEC(CODA9_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420, 
V4L2_PIX_FMT_MPEG4,  1920, 1080),
-   CODA_CODEC(CODA9_MODE_DECODE_H264, V4L2_PIX_FMT_H264,   
V4L2_PIX_FMT_YUV420, 1920, 1080),
-   CODA_CODEC(CODA9_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
V4L2_PIX_FMT_YUV420, 1920, 1080),
+   CODA_CODEC(CODA9_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, 
V4L2_PIX_FMT_H264,   1920, 1088),
+   CODA_CODEC(CODA9_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420, 
V4L2_PIX_FMT_MPEG4,  1920, 1088),
+   CODA_CODEC(CODA9_MODE_DECODE_H264, V4L2_PIX_FMT_H264,   
V4L2_PIX_FMT_YUV420, 1920, 1088),
+   CODA_CODEC(CODA9_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
V4L2_PIX_FMT_YUV420, 1920, 1088),
 };
 
 static bool coda_format_is_yuv(u32 fourcc)
-- 
2.0.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 01/11] [media] coda: remove unnecessary peek at next destination buffer from coda_finish_decode

2014-07-25 Thread Philipp Zabel
The return value of this call to v4l2_m2m_next_dst_buf() is never used.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-bit.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index 1d2716d..cc9afb7 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1580,8 +1580,6 @@ static void coda_finish_decode(struct coda_ctx *ctx)
u32 err_mb;
u32 val;
 
-   dst_buf = v4l2_m2m_next_dst_buf(ctx-fh.m2m_ctx);
-
/* Update kfifo out pointer from coda bitstream read pointer */
coda_kfifo_sync_from_device(ctx);
 
-- 
2.0.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 05/11] [media] coda: dequeue buffers if start_streaming fails

2014-07-25 Thread Philipp Zabel
The core warns if we keep queued buffers around in the error case.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-common.c | 34 +++
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index ab4b4c3..126b967 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1005,6 +1005,7 @@ static int coda_start_streaming(struct vb2_queue *q, 
unsigned int count)
struct coda_ctx *ctx = vb2_get_drv_priv(q);
struct v4l2_device *v4l2_dev = ctx-dev-v4l2_dev;
struct coda_q_data *q_data_src, *q_data_dst;
+   struct vb2_buffer *buf;
u32 dst_fourcc;
int ret = 0;
 
@@ -1016,17 +1017,23 @@ static int coda_start_streaming(struct vb2_queue *q, 
unsigned int count)
coda_fill_bitstream(ctx);
mutex_unlock(ctx-bitstream_mutex);
 
-   if (coda_get_bitstream_payload(ctx)  512)
-   return -EINVAL;
+   if (coda_get_bitstream_payload(ctx)  512) {
+   ret = -EINVAL;
+   goto err;
+   }
} else {
-   if (count  1)
-   return -EINVAL;
+   if (count  1) {
+   ret = -EINVAL;
+   goto err;
+   }
}
 
ctx-streamon_out = 1;
} else {
-   if (count  1)
-   return -EINVAL;
+   if (count  1) {
+   ret = -EINVAL;
+   goto err;
+   }
 
ctx-streamon_cap = 1;
}
@@ -1047,7 +1054,8 @@ static int coda_start_streaming(struct vb2_queue *q, 
unsigned int count)
 q_data_dst-fourcc);
if (!ctx-codec) {
v4l2_err(v4l2_dev, couldn't tell instance type.\n);
-   return -EINVAL;
+   ret = -EINVAL;
+   goto err;
}
 
ret = ctx-ops-start_streaming(ctx);
@@ -1055,11 +1063,21 @@ static int coda_start_streaming(struct vb2_queue *q, 
unsigned int count)
if (ret == -EAGAIN)
return 0;
else if (ret  0)
-   return ret;
+   goto err;
}
 
ctx-initialized = 1;
return ret;
+
+err:
+   if (q-type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
+   while ((buf = v4l2_m2m_src_buf_remove(ctx-fh.m2m_ctx)))
+   v4l2_m2m_buf_done(buf, VB2_BUF_STATE_DEQUEUED);
+   } else {
+   while ((buf = v4l2_m2m_dst_buf_remove(ctx-fh.m2m_ctx)))
+   v4l2_m2m_buf_done(buf, VB2_BUF_STATE_DEQUEUED);
+   }
+   return ret;
 }
 
 static void coda_stop_streaming(struct vb2_queue *q)
-- 
2.0.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 03/11] [media] coda: Return the real error on platform_get_irq()

2014-07-25 Thread Philipp Zabel
From: Fabio Estevam fabio.este...@freescale.com

No need to return a 'fake' return value on platform_get_irq() failure.

Propagate the real error instead.

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 65c7a12..31d0a2f 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1840,7 +1840,7 @@ static int coda_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq  0) {
dev_err(pdev-dev, failed to get irq resource\n);
-   return -ENOENT;
+   return irq;
}
 
if (devm_request_threaded_irq(pdev-dev, irq, NULL, coda_irq_handler,
-- 
2.0.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 06/11] [media] coda: dequeue buffers on streamoff

2014-07-25 Thread Philipp Zabel
This is needed to decrease the q-owned_by_drv_count to zero before
__vb2_queue_cancel is called, to avoid the WARN_ON therein.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-common.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 126b967..c84634b 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1084,6 +1084,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
 {
struct coda_ctx *ctx = vb2_get_drv_priv(q);
struct coda_dev *dev = ctx-dev;
+   struct vb2_buffer *buf;
 
if (q-type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
v4l2_dbg(1, coda_debug, dev-v4l2_dev,
@@ -1091,7 +1092,11 @@ static void coda_stop_streaming(struct vb2_queue *q)
ctx-streamon_out = 0;
 
coda_bit_stream_end_flag(ctx);
+
ctx-isequence = 0;
+
+   while ((buf = v4l2_m2m_src_buf_remove(ctx-fh.m2m_ctx)))
+   v4l2_m2m_buf_done(buf, VB2_BUF_STATE_ERROR);
} else {
v4l2_dbg(1, coda_debug, dev-v4l2_dev,
 %s: capture\n, __func__);
@@ -1099,6 +1104,9 @@ static void coda_stop_streaming(struct vb2_queue *q)
 
ctx-osequence = 0;
ctx-sequence_offset = 0;
+
+   while ((buf = v4l2_m2m_dst_buf_remove(ctx-fh.m2m_ctx)))
+   v4l2_m2m_buf_done(buf, VB2_BUF_STATE_ERROR);
}
 
if (!ctx-streamon_out  !ctx-streamon_cap) {
-- 
2.0.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 09/11] [media] coda: add an intermediate debug level

2014-07-25 Thread Philipp Zabel
Dumping all register accesses drowns other debugging messages
in the log. Add a less verbose debug level.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda/coda-common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index da5dd2f..5a113c5 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -58,7 +58,7 @@
 
 int coda_debug;
 module_param(coda_debug, int, 0644);
-MODULE_PARM_DESC(coda_debug, Debug level (0-1));
+MODULE_PARM_DESC(coda_debug, Debug level (0-2));
 
 struct coda_fmt {
char *name;
@@ -67,7 +67,7 @@ struct coda_fmt {
 
 void coda_write(struct coda_dev *dev, u32 data, u32 reg)
 {
-   v4l2_dbg(1, coda_debug, dev-v4l2_dev,
+   v4l2_dbg(2, coda_debug, dev-v4l2_dev,
 %s: data=0x%x, reg=0x%x\n, __func__, data, reg);
writel(data, dev-regs_base + reg);
 }
@@ -76,7 +76,7 @@ unsigned int coda_read(struct coda_dev *dev, u32 reg)
 {
u32 data;
data = readl(dev-regs_base + reg);
-   v4l2_dbg(1, coda_debug, dev-v4l2_dev,
+   v4l2_dbg(2, coda_debug, dev-v4l2_dev,
 %s: data=0x%x, reg=0x%x\n, __func__, data, reg);
return data;
 }
-- 
2.0.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 00/11] CODA Cleanup fixes

2014-07-25 Thread Philipp Zabel
Hi,

the following series applies on top of the previous Split CODA driver into
multiple files series. It contains various accumulated fixes, including
dequeueing of buffers in stop_streaming and after start_streaming failure,
a crash fix for the timestamp list handling, better error reporting, and
the interrupt request by name in preparation for the second JPEG interrupt
on CODA960.

regards
Philipp

Fabio Estevam (2):
  [media] coda: Return the real error on platform_get_irq()
  [media] coda: Propagate the correct error on
devm_request_threaded_irq()

Michael Olbrich (1):
  [media] coda: fix timestamp list handling

Philipp Zabel (8):
  [media] coda: remove unnecessary peek at next destination buffer from
coda_finish_decode
  [media] coda: request BIT processor interrupt by name
  [media] coda: dequeue buffers if start_streaming fails
  [media] coda: dequeue buffers on streamoff
  [media] coda: skip calling coda_find_codec in encoder try_fmt_vid_out
  [media] coda: increase max vertical frame size to 1088
  [media] coda: add an intermediate debug level
  [media] coda: improve allocation error messages

 drivers/media/platform/coda/coda-bit.c| 33 +++
 drivers/media/platform/coda/coda-common.c | 96 +--
 2 files changed, 87 insertions(+), 42 deletions(-)

-- 
2.0.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: [PATCH 04/10] [media] s5p-mfc: Don't allocate codec buffers on STREAMON.

2014-07-25 Thread Nicolas Dufresne
Le lundi 19 mai 2014 à 18:03 +0530, Arun Kumar K a écrit :
 From: Pawel Osciak posc...@chromium.org
 
 Currently, we allocate private codec buffers on STREAMON, which may fail
 if we are out of memory. We don't check for failure though, which will
 make us crash with the codec accessing random memory.
 
 We shouldn't be failing STREAMON with out of memory errors though. So move
 the allocation of private codec buffers to REQBUFS for OUTPUT queue. Also,
 move MFC instance opening and closing to REQBUFS as well, as it's tied to
 allocation and deallocation of private codec buffers.
 
 Signed-off-by: Pawel Osciak posc...@chromium.org
 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
  drivers/media/platform/s5p-mfc/s5p_mfc.c  |8 +++
  drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c |1 +
  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c  |   30 
 +++--
  3 files changed, 18 insertions(+), 21 deletions(-)
 
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc.c
 index 861087c..70f728f 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
 @@ -643,6 +643,7 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv)
  
   case S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET:
   clear_work_bit(ctx);
 + ctx-inst_no = MFC_NO_INSTANCE_SET;
   ctx-state = MFCINST_FREE;
   wake_up(ctx-queue);
   goto irq_cleanup_hw;
 @@ -763,7 +764,7 @@ static int s5p_mfc_open(struct file *file)
   goto err_bad_node;
   }
   ctx-fh.ctrl_handler = ctx-ctrl_handler;
 - ctx-inst_no = -1;
 + ctx-inst_no = MFC_NO_INSTANCE_SET;
   /* Load firmware if this is the first instance */
   if (dev-num_inst == 1) {
   dev-watchdog_timer.expires = jiffies +
 @@ -873,12 +874,11 @@ static int s5p_mfc_release(struct file *file)
   vb2_queue_release(ctx-vq_dst);
   /* Mark context as idle */
   clear_work_bit_irqsave(ctx);
 - /* If instance was initialised then
 + /* If instance was initialised and not yet freed,
* return instance and free resources */
 - if (ctx-inst_no != MFC_NO_INSTANCE_SET) {
 + if (ctx-state != MFCINST_FREE  ctx-state != MFCINST_INIT) {
   mfc_debug(2, Has to free instance\n);
   s5p_mfc_close_mfc_inst(dev, ctx);
 - ctx-inst_no = MFC_NO_INSTANCE_SET;
   }
   /* hardware locking scheme */
   if (dev-curr_ctx == ctx-num)
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 index 6f6e50a..6c3f8f7 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
 @@ -459,5 +459,6 @@ void s5p_mfc_close_mfc_inst(struct s5p_mfc_dev *dev, 
 struct s5p_mfc_ctx *ctx)
   if (ctx-type == MFCINST_DECODER)
   s5p_mfc_hw_call(dev-mfc_ops, release_dec_desc_buffer, ctx);
  
 + ctx-inst_no = MFC_NO_INSTANCE_SET;
   ctx-state = MFCINST_FREE;
  }
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 index 995cee2..a4e6668 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 @@ -475,11 +475,11 @@ static int reqbufs_output(struct s5p_mfc_dev *dev, 
 struct s5p_mfc_ctx *ctx,
   ret = vb2_reqbufs(ctx-vq_src, reqbufs);
   if (ret)
   goto out;
 + s5p_mfc_close_mfc_inst(dev, ctx);

This so far seems to prevent us from probing memory type support. We
Initially call reqbufs(count = 0) for this, but this calls seems to
triggers a firmware error later if we do so. Any advise ?

   ctx-src_bufs_cnt = 0;
 + ctx-output_state = QUEUE_FREE;
   } else if (ctx-output_state == QUEUE_FREE) {
 - /* Can only request buffers after the instance
 -  * has been opened.
 -  */
 + /* Can only request buffers when we have a valid format set. */
   WARN_ON(ctx-src_bufs_cnt != 0);
   if (ctx-state != MFCINST_INIT) {
   mfc_err(Reqbufs called in an invalid state\n);
 @@ -493,6 +493,13 @@ static int reqbufs_output(struct s5p_mfc_dev *dev, 
 struct s5p_mfc_ctx *ctx,
   if (ret)
   goto out;
  
 + ret = s5p_mfc_open_mfc_inst(dev, ctx);
 + if (ret) {
 + reqbufs-count = 0;
 + vb2_reqbufs(ctx-vq_src, reqbufs);
 + goto out;
 + }
 +
   ctx-output_state = QUEUE_BUFS_REQUESTED;
   } else {
   mfc_err(Buffers have already been requested\n);
 @@ -594,7 +601,7 @@ static int vidioc_querybuf(struct file *file, void *priv,
   return -EINVAL;
   }
   mfc_debug(2, State: %d, buf-type: %d\n, ctx-state, buf-type);
 - 

em28xx vb2 warnings

2014-07-25 Thread Frank Schäfer
Hi Hans,

I'm getting the following warnings with the em28xx driver on streaming stop:

[ 7597.346168] WARNING: CPU: 1 PID: 3730 at
drivers/media/v4l2-core/videobuf2-core.c:2126
__vb2_queue_cancel+0xf5/0x150 [videobuf2_core]()
[ 7597.346171] Modules linked in: em28xx_rc snd_usb_audio ov2640
soc_camera soc_mediabus em28xx_v4l videobuf2_core videobuf2_vmalloc
videobuf2_memops snd_usbmidi_lib snd_rawmidi em28xx xt_pkttype xt_LOG
xt_limit bnep af_packet bluetooth ip6t_REJECT xt_tcpudp
nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT iptable_raw
xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables
rc_hauppauge ir_kbd_i2c arc4 tuner_simple tuner_types rtl8187 mac80211
tda9887 fuse tda8290 snd_hda_codec_analog tuner snd_hda_codec_hdmi
snd_hda_codec_generic sr_mod cdrom snd_hda_intel snd_hda_controller
snd_hda_codec msp3400 snd_hwdep cfg80211 bttv snd_pcm v4l2_common
snd_seq ppdev powernow_k8
[ 7597.346230]  snd_timer snd_seq_device pcspkr videodev serio_raw snd
firewire_ohci firewire_core k8temp rfkill eeprom_93cx6 i2c_nforce2
usb_storage videobuf_dma_sg videobuf_core btcx_risc pata_jmicron rc_core
usblp soundcore forcedeth crc_itu_t tveeprom ata_generic floppy sata_nv
pata_amd asus_atk0110 parport_pc parport button sg dm_mod autofs4 radeon
ttm drm_kms_helper drm fan thermal processor thermal_sys i2c_algo_bit
scsi_dh_hp_sw scsi_dh_emc scsi_dh_rdac scsi_dh_alua scsi_dh
[ 7597.346268] CPU: 1 PID: 3730 Comm: qv4l2 Tainted: GW
3.16.0-rc6-0.1-desktop+ #18
[ 7597.346271] Hardware name: System manufacturer System Product Name [...]
[ 7597.346273]    e09d9d3c c0780b62  e09d9d6c
c0243359 c091deec
[ 7597.346279]  0001 0e92 f870a4a4 084e f87054e5 f87054e5
e6905040 e2f61640
[ 7597.346285]  ef85f4c8 e09d9d7c c02433ed 0009  e09d9d94
f87054e5 e2ef6550
[ 7597.346290] Call Trace:
[ 7597.346300]  [c0780b62] dump_stack+0x48/0x69
[ 7597.346305]  [c0243359] warn_slowpath_common+0x79/0x90
[ 7597.346312]  [f87054e5] ? __vb2_queue_cancel+0xf5/0x150
[videobuf2_core]
[ 7597.346318]  [f87054e5] ? __vb2_queue_cancel+0xf5/0x150
[videobuf2_core]
[ 7597.346322]  [c02433ed] warn_slowpath_null+0x1d/0x20
[ 7597.346327]  [f87054e5] __vb2_queue_cancel+0xf5/0x150 [videobuf2_core]
[ 7597.346333]  [f8706b35] vb2_internal_streamoff+0x35/0x90
[videobuf2_core]
[ 7597.346338]  [c04b7cbb] ? _copy_from_user+0x3b/0x50
[ 7597.346344]  [f8706bc5] vb2_streamoff+0x35/0x60 [videobuf2_core]
[ 7597.346350]  [c0699433] ? __sys_recvmsg+0x43/0x70
[ 7597.346356]  [f8706c27] vb2_ioctl_streamoff+0x37/0x40 [videobuf2_core]
[ 7597.346371]  [f7c56805] v4l_streamoff+0x15/0x20 [videodev]
[ 7597.346382]  [f7c5962c] __video_do_ioctl+0x1fc/0x280 [videodev]
[ 7597.346394]  [f7c5908e] video_usercopy+0x1ce/0x550 [videodev]
[ 7597.346399]  [c038aac7] ? fsnotify+0x1e7/0x2b0
[ 7597.346410]  [f7c59422] video_ioctl2+0x12/0x20 [videodev]
[ 7597.346421]  [f7c59430] ? video_ioctl2+0x20/0x20 [videodev]
[ 7597.346430]  [f7c55615] v4l2_ioctl+0xe5/0x120 [videodev]
[ 7597.346439]  [f7c55530] ? v4l2_open+0xf0/0xf0 [videodev]
[ 7597.346443]  [c03668e2] do_vfs_ioctl+0x2e2/0x4d0
[ 7597.346449]  [c0356a3c] ? vfs_write+0x13c/0x1c0
[ 7597.346452]  [c03575df] ? vfs_writev+0x2f/0x50
[ 7597.346455]  [c0366b28] SyS_ioctl+0x58/0x80
[ 7597.346460]  [c07870ec] sysenter_do_call+0x12/0x16
[ 7597.346463] ---[ end trace 16421a251cba8f63 ]---


There have been quite a few vb2 changes recently.
Any idea what's wrong ? Could you take a look at this ?

Regards,
Frank





--
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/4] em28xx-v4l: get rid of field users in struct em28xx_v4l2

2014-07-25 Thread Frank Schäfer
Instead of counting the number of opened file handles, use function
v4l2_fh_is_singular_file() in em28xx_v4l2_open() and em28xx_v4l2_close() to
determine if the file handle is the first/last opened one.

Signed-off-by: Frank Schäfer fschaefer@googlemail.com
---
 drivers/media/usb/em28xx/em28xx-video.c | 23 +--
 drivers/media/usb/em28xx/em28xx.h   |  1 -
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
b/drivers/media/usb/em28xx/em28xx-video.c
index 3a7ec3b..087ccf9 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1883,9 +1883,8 @@ static int em28xx_v4l2_open(struct file *filp)
return -EINVAL;
}
 
-   em28xx_videodbg(open dev=%s type=%s users=%d\n,
-   video_device_node_name(vdev), v4l2_type_names[fh_type],
-   v4l2-users);
+   em28xx_videodbg(open dev=%s type=%s\n,
+   video_device_node_name(vdev), v4l2_type_names[fh_type]);
 
if (mutex_lock_interruptible(dev-lock))
return -ERESTARTSYS;
@@ -1898,7 +1897,9 @@ static int em28xx_v4l2_open(struct file *filp)
return ret;
}
 
-   if (v4l2-users == 0) {
+   if (v4l2_fh_is_singular_file(filp)) {
+   em28xx_videodbg(first opened filehandle, initializing 
device\n);
+
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
 
if (vdev-vfl_type != VFL_TYPE_RADIO)
@@ -1909,6 +1910,8 @@ static int em28xx_v4l2_open(struct file *filp)
 * of some i2c devices
 */
em28xx_wake_i2c(dev);
+   } else {
+   em28xx_videodbg(further filehandles are already opened\n);
}
 
if (vdev-vfl_type == VFL_TYPE_RADIO) {
@@ -1918,7 +1921,6 @@ static int em28xx_v4l2_open(struct file *filp)
 
kref_get(dev-ref);
kref_get(v4l2-ref);
-   v4l2-users++;
 
mutex_unlock(dev-lock);
 
@@ -2025,12 +2027,11 @@ static int em28xx_v4l2_close(struct file *filp)
struct em28xx_v4l2*v4l2 = dev-v4l2;
int  errCode;
 
-   em28xx_videodbg(users=%d\n, v4l2-users);
-
-   vb2_fop_release(filp);
mutex_lock(dev-lock);
 
-   if (v4l2-users == 1) {
+   if (v4l2_fh_is_singular_file(filp)) {
+   em28xx_videodbg(last opened filehandle, shutting down 
device\n);
+
/* No sense to try to write to the device */
if (dev-disconnected)
goto exit;
@@ -2049,10 +2050,12 @@ static int em28xx_v4l2_close(struct file *filp)
em28xx_errdev(cannot change alternate number to 
0 (error=%i)\n, errCode);
}
+   } else {
+   em28xx_videodbg(further opened filehandles left\n);
}
 
 exit:
-   v4l2-users--;
+   vb2_fop_release(filp);
kref_put(v4l2-ref, em28xx_free_v4l2);
mutex_unlock(dev-lock);
kref_put(dev-ref, em28xx_free_device);
diff --git a/drivers/media/usb/em28xx/em28xx.h 
b/drivers/media/usb/em28xx/em28xx.h
index 4360338..84ef8ef 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -524,7 +524,6 @@ struct em28xx_v4l2 {
int sensor_yres;
int sensor_xtal;
 
-   int users;  /* user count for exclusive use */
int streaming_users;/* number of actively streaming users */
 
u32 frequency;  /* selected tuner frequency */
-- 
1.8.4.5

--
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/4] em28xx-v4l: simplify em28xx_v4l2_open() by using v4l2_fh_open()

2014-07-25 Thread Frank Schäfer
Instead of calling

...
struct v4l2_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL);
filp-private_data = fh;
v4l2_fh_init(fh, vdev);
v4l2_fh_add(fh);
...

simply use function v4l2_fh_open() which does all of these calls for us.

Signed-off-by: Frank Schäfer fschaefer@googlemail.com
---
 drivers/media/usb/em28xx/em28xx-video.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
b/drivers/media/usb/em28xx/em28xx-video.c
index 4eb4a6a..3a7ec3b 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1868,7 +1868,7 @@ static int em28xx_v4l2_open(struct file *filp)
struct em28xx *dev = video_drvdata(filp);
struct em28xx_v4l2 *v4l2 = dev-v4l2;
enum v4l2_buf_type fh_type = 0;
-   struct v4l2_fh *fh;
+   int ret;
 
switch (vdev-vfl_type) {
case VFL_TYPE_GRABBER:
@@ -1889,14 +1889,14 @@ static int em28xx_v4l2_open(struct file *filp)
 
if (mutex_lock_interruptible(dev-lock))
return -ERESTARTSYS;
-   fh = kzalloc(sizeof(struct v4l2_fh), GFP_KERNEL);
-   if (!fh) {
-   em28xx_errdev(em28xx-video.c: Out of memory?!\n);
+
+   ret = v4l2_fh_open(filp);
+   if (ret) {
+   em28xx_errdev(%s: v4l2_fh_open() returned error %d\n,
+ __func__, ret);
mutex_unlock(dev-lock);
-   return -ENOMEM;
+   return ret;
}
-   v4l2_fh_init(fh, vdev);
-   filp-private_data = fh;
 
if (v4l2-users == 0) {
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
@@ -1921,7 +1921,6 @@ static int em28xx_v4l2_open(struct file *filp)
v4l2-users++;
 
mutex_unlock(dev-lock);
-   v4l2_fh_add(fh);
 
return 0;
 }
-- 
1.8.4.5

--
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/4] some em28xx-v4l cleanup patches

2014-07-25 Thread Frank Schäfer
This patch series consists of 4 cleanup patches for the em28xx-v4l module.

Frank Schäfer (4):
  em28xx-v4l: simplify some pointers in em28xx_init_camera()
  em28xx-v4l: get rid of struct em28xx_fh
  em28xx-v4l: simplify em28xx_v4l2_open() by using v4l2_fh_open()
  em28xx-v4l: get rid of field users in struct em28xx_v4l2

 drivers/media/usb/em28xx/em28xx-camera.c |   4 +-
 drivers/media/usb/em28xx/em28xx-video.c  | 113 ---
 drivers/media/usb/em28xx/em28xx.h|   8 ---
 3 files changed, 47 insertions(+), 78 deletions(-)

-- 
1.8.4.5

--
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/4] em28xx-v4l: simplify some pointers in em28xx_init_camera()

2014-07-25 Thread Frank Schäfer
Pointer v4l2 can be used instead of dev-v4l2, which saves some characters.

Signed-off-by: Frank Schäfer fschaefer@googlemail.com
---
 drivers/media/usb/em28xx/em28xx-camera.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-camera.c 
b/drivers/media/usb/em28xx/em28xx-camera.c
index 12d4c03..6d2ea9a 100644
--- a/drivers/media/usb/em28xx/em28xx-camera.c
+++ b/drivers/media/usb/em28xx/em28xx-camera.c
@@ -366,7 +366,7 @@ int em28xx_init_camera(struct em28xx *dev)
v4l2-sensor_xtal = 430;
pdata.xtal = v4l2-sensor_xtal;
if (NULL ==
-   v4l2_i2c_new_subdev_board(dev-v4l2-v4l2_dev, adap,
+   v4l2_i2c_new_subdev_board(v4l2-v4l2_dev, adap,
  mt9v011_info, NULL)) {
ret = -ENODEV;
break;
@@ -423,7 +423,7 @@ int em28xx_init_camera(struct em28xx *dev)
v4l2-sensor_yres = 480;
 
subdev =
-v4l2_i2c_new_subdev_board(dev-v4l2-v4l2_dev, adap,
+v4l2_i2c_new_subdev_board(v4l2-v4l2_dev, adap,
   ov2640_info, NULL);
if (NULL == subdev) {
ret = -ENODEV;
-- 
1.8.4.5

--
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/4] em28xx-v4l: get rid of struct em28xx_fh

2014-07-25 Thread Frank Schäfer
struct em28xx_fh isn't needed anymore because the only used field which is left 
is struct v4l2_fh fh.
Use struct v4l2_fh directly and remvove struct em28xx_fh.

Signed-off-by: Frank Schäfer fschaefer@googlemail.com
---
 drivers/media/usb/em28xx/em28xx-video.c | 83 -
 drivers/media/usb/em28xx/em28xx.h   |  7 ---
 2 files changed, 29 insertions(+), 61 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
b/drivers/media/usb/em28xx/em28xx-video.c
index 3f8b5aa..4eb4a6a 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1227,8 +1227,7 @@ static void scale_to_size(struct em28xx *dev,
 static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
 {
-   struct em28xx_fh  *fh  = priv;
-   struct em28xx *dev = fh-dev;
+   struct em28xx *dev = video_drvdata(file);
struct em28xx_v4l2*v4l2 = dev-v4l2;
 
f-fmt.pix.width = v4l2-width;
@@ -1261,8 +1260,7 @@ static struct em28xx_fmt *format_by_fourcc(unsigned int 
fourcc)
 static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
 {
-   struct em28xx_fh  *fh= priv;
-   struct em28xx *dev   = fh-dev;
+   struct em28xx *dev   = video_drvdata(file);
struct em28xx_v4l2*v4l2  = dev-v4l2;
unsigned int  width  = f-fmt.pix.width;
unsigned int  height = f-fmt.pix.height;
@@ -1355,8 +1353,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void 
*priv,
 
 static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
 {
-   struct em28xx_fh   *fh  = priv;
-   struct em28xx  *dev = fh-dev;
+   struct em28xx *dev = video_drvdata(file);
 
*norm = dev-v4l2-norm;
 
@@ -1365,8 +1362,7 @@ static int vidioc_g_std(struct file *file, void *priv, 
v4l2_std_id *norm)
 
 static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *norm)
 {
-   struct em28xx_fh   *fh  = priv;
-   struct em28xx  *dev = fh-dev;
+   struct em28xx *dev = video_drvdata(file);
 
v4l2_device_call_all(dev-v4l2-v4l2_dev, 0, video, querystd, norm);
 
@@ -1375,8 +1371,7 @@ static int vidioc_querystd(struct file *file, void *priv, 
v4l2_std_id *norm)
 
 static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
 {
-   struct em28xx_fh   *fh   = priv;
-   struct em28xx  *dev  = fh-dev;
+   struct em28xx  *dev  = video_drvdata(file);
struct em28xx_v4l2 *v4l2 = dev-v4l2;
struct v4l2_format f;
 
@@ -1408,8 +1403,7 @@ static int vidioc_s_std(struct file *file, void *priv, 
v4l2_std_id norm)
 static int vidioc_g_parm(struct file *file, void *priv,
 struct v4l2_streamparm *p)
 {
-   struct em28xx_fh   *fh   = priv;
-   struct em28xx  *dev  = fh-dev;
+   struct em28xx  *dev  = video_drvdata(file);
struct em28xx_v4l2 *v4l2 = dev-v4l2;
int rc = 0;
 
@@ -1427,8 +1421,7 @@ static int vidioc_g_parm(struct file *file, void *priv,
 static int vidioc_s_parm(struct file *file, void *priv,
 struct v4l2_streamparm *p)
 {
-   struct em28xx_fh   *fh  = priv;
-   struct em28xx  *dev = fh-dev;
+   struct em28xx *dev = video_drvdata(file);
 
p-parm.capture.readbuffers = EM28XX_MIN_BUF;
return v4l2_device_call_until_err(dev-v4l2-v4l2_dev,
@@ -1450,8 +1443,7 @@ static const char *iname[] = {
 static int vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *i)
 {
-   struct em28xx_fh   *fh  = priv;
-   struct em28xx  *dev = fh-dev;
+   struct em28xx *dev = video_drvdata(file);
unsigned int   n;
 
n = i-index;
@@ -1479,8 +1471,7 @@ static int vidioc_enum_input(struct file *file, void 
*priv,
 
 static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
 {
-   struct em28xx_fh   *fh  = priv;
-   struct em28xx  *dev = fh-dev;
+   struct em28xx *dev = video_drvdata(file);
 
*i = dev-ctl_input;
 
@@ -1489,8 +1480,7 @@ static int vidioc_g_input(struct file *file, void *priv, 
unsigned int *i)
 
 static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
 {
-   struct em28xx_fh   *fh  = priv;
-   struct em28xx  *dev = fh-dev;
+   struct em28xx *dev = video_drvdata(file);
 
if (i = MAX_EM28XX_INPUT)
return -EINVAL;
@@ -1503,8 +1493,7 @@ static int vidioc_s_input(struct file *file, void *priv, 
unsigned int i)
 
 static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
 {
-   struct em28xx_fh   *fh= priv;
-   struct em28xx  *dev   = fh-dev;
+   struct em28xx *dev = video_drvdata(file);
 
switch (a-index) {
case EM28XX_AMUX_VIDEO:
@@ -1543,8 

[PATCH] em28xx-v4l: fix disabling ioctl VIDIOC_S_PARM for vbi devices

2014-07-25 Thread Frank Schäfer
Fixes an old copy+paste bug that has survived all recent code
changes in this code area.

Signed-off-by: Frank Schäfer fschaefer@googlemail.com
---
 drivers/media/usb/em28xx/em28xx-video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
b/drivers/media/usb/em28xx/em28xx-video.c
index 087ccf9..90dec29 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -2528,7 +2528,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
v4l2-vbi_dev-queue-lock = v4l2-vb_vbi_queue_lock;
 
/* disable inapplicable ioctls */
-   v4l2_disable_ioctl(v4l2-vdev, VIDIOC_S_PARM);
+   v4l2_disable_ioctl(v4l2-vbi_dev, VIDIOC_S_PARM);
if (dev-tuner_type == TUNER_ABSENT) {
v4l2_disable_ioctl(v4l2-vbi_dev, VIDIOC_G_TUNER);
v4l2_disable_ioctl(v4l2-vbi_dev, VIDIOC_S_TUNER);
-- 
1.8.4.5

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


v4l2-ctrls: negative integer control values broken

2014-07-25 Thread Frank Schäfer
Hans,

sorry for bothering you with another issue on friday evening. :-/
But it seems that commit 958c7c7e65 ([media] v4l2-ctrls: fix corner
case in round-to-range code) introduced a regression for controls which
are using a negative integer value range.
All negative values are mapped to the maximum (positive) value (check
em28xx brightness, red and blue balance bridge controls for example).
Reverting this commit makes them working again.
At a first glance I can't find a mistake...

Have a nice weekend,
Frank

--
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: v4l2-ctrls: negative integer control values broken

2014-07-25 Thread Hans Verkuil
On 07/25/2014 08:25 PM, Frank Schäfer wrote:
 Hans,
 
 sorry for bothering you with another issue on friday evening. :-/
 But it seems that commit 958c7c7e65 ([media] v4l2-ctrls: fix corner
 case in round-to-range code) introduced a regression for controls which
 are using a negative integer value range.
 All negative values are mapped to the maximum (positive) value (check
 em28xx brightness, red and blue balance bridge controls for example).
 Reverting this commit makes them working again.
 At a first glance I can't find a mistake...

I'll take a look at this this weekend. Thanks for reporting this!

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


[PATCH] drivers/media/pci/solo6x10/solo6x10-disp.c: check kzalloc() result

2014-07-25 Thread Andrey Utkin
Signed-off-by: Andrey Utkin andrey.ut...@corp.bluecherry.net
---
 drivers/media/pci/solo6x10/solo6x10-disp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/pci/solo6x10/solo6x10-disp.c 
b/drivers/media/pci/solo6x10/solo6x10-disp.c
index ed88ab4..93cbbb1 100644
--- a/drivers/media/pci/solo6x10/solo6x10-disp.c
+++ b/drivers/media/pci/solo6x10/solo6x10-disp.c
@@ -216,6 +216,8 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch,
int ret = 0;
 
buf = kzalloc(size, GFP_KERNEL);
+   if (!buf)
+   return -ENOMEM;
for (y = 0; y  SOLO_MOTION_SZ; y++) {
for (x = 0; x  SOLO_MOTION_SZ; x++)
buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + 
x]);
-- 
1.8.5.5

--
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] drivers/media/pci/solo6x10/solo6x10-disp.c: check kzalloc() result

2014-07-25 Thread Andrey Utkin
Please ignore. I didn't notice that Hans has already posted a patch
fixing that and more.

-- 
Bluecherry developer.
--
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: em28xx vb2 warnings

2014-07-25 Thread Hans Verkuil
On 07/25/2014 06:20 PM, Frank Schäfer wrote:
 Hi Hans,
 
 I'm getting the following warnings with the em28xx driver on streaming stop:
 
 [ 7597.346168] WARNING: CPU: 1 PID: 3730 at
 drivers/media/v4l2-core/videobuf2-core.c:2126
 __vb2_queue_cancel+0xf5/0x150 [videobuf2_core]()
 [ 7597.346171] Modules linked in: em28xx_rc snd_usb_audio ov2640
 soc_camera soc_mediabus em28xx_v4l videobuf2_core videobuf2_vmalloc
 videobuf2_memops snd_usbmidi_lib snd_rawmidi em28xx xt_pkttype xt_LOG
 xt_limit bnep af_packet bluetooth ip6t_REJECT xt_tcpudp
 nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT iptable_raw
 xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns
 nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables
 xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables
 rc_hauppauge ir_kbd_i2c arc4 tuner_simple tuner_types rtl8187 mac80211
 tda9887 fuse tda8290 snd_hda_codec_analog tuner snd_hda_codec_hdmi
 snd_hda_codec_generic sr_mod cdrom snd_hda_intel snd_hda_controller
 snd_hda_codec msp3400 snd_hwdep cfg80211 bttv snd_pcm v4l2_common
 snd_seq ppdev powernow_k8
 [ 7597.346230]  snd_timer snd_seq_device pcspkr videodev serio_raw snd
 firewire_ohci firewire_core k8temp rfkill eeprom_93cx6 i2c_nforce2
 usb_storage videobuf_dma_sg videobuf_core btcx_risc pata_jmicron rc_core
 usblp soundcore forcedeth crc_itu_t tveeprom ata_generic floppy sata_nv
 pata_amd asus_atk0110 parport_pc parport button sg dm_mod autofs4 radeon
 ttm drm_kms_helper drm fan thermal processor thermal_sys i2c_algo_bit
 scsi_dh_hp_sw scsi_dh_emc scsi_dh_rdac scsi_dh_alua scsi_dh
 [ 7597.346268] CPU: 1 PID: 3730 Comm: qv4l2 Tainted: GW
 3.16.0-rc6-0.1-desktop+ #18
 [ 7597.346271] Hardware name: System manufacturer System Product Name [...]
 [ 7597.346273]    e09d9d3c c0780b62  e09d9d6c
 c0243359 c091deec
 [ 7597.346279]  0001 0e92 f870a4a4 084e f87054e5 f87054e5
 e6905040 e2f61640
 [ 7597.346285]  ef85f4c8 e09d9d7c c02433ed 0009  e09d9d94
 f87054e5 e2ef6550
 [ 7597.346290] Call Trace:
 [ 7597.346300]  [c0780b62] dump_stack+0x48/0x69
 [ 7597.346305]  [c0243359] warn_slowpath_common+0x79/0x90
 [ 7597.346312]  [f87054e5] ? __vb2_queue_cancel+0xf5/0x150
 [videobuf2_core]
 [ 7597.346318]  [f87054e5] ? __vb2_queue_cancel+0xf5/0x150
 [videobuf2_core]
 [ 7597.346322]  [c02433ed] warn_slowpath_null+0x1d/0x20
 [ 7597.346327]  [f87054e5] __vb2_queue_cancel+0xf5/0x150 [videobuf2_core]
 [ 7597.346333]  [f8706b35] vb2_internal_streamoff+0x35/0x90
 [videobuf2_core]
 [ 7597.346338]  [c04b7cbb] ? _copy_from_user+0x3b/0x50
 [ 7597.346344]  [f8706bc5] vb2_streamoff+0x35/0x60 [videobuf2_core]
 [ 7597.346350]  [c0699433] ? __sys_recvmsg+0x43/0x70
 [ 7597.346356]  [f8706c27] vb2_ioctl_streamoff+0x37/0x40 [videobuf2_core]
 [ 7597.346371]  [f7c56805] v4l_streamoff+0x15/0x20 [videodev]
 [ 7597.346382]  [f7c5962c] __video_do_ioctl+0x1fc/0x280 [videodev]
 [ 7597.346394]  [f7c5908e] video_usercopy+0x1ce/0x550 [videodev]
 [ 7597.346399]  [c038aac7] ? fsnotify+0x1e7/0x2b0
 [ 7597.346410]  [f7c59422] video_ioctl2+0x12/0x20 [videodev]
 [ 7597.346421]  [f7c59430] ? video_ioctl2+0x20/0x20 [videodev]
 [ 7597.346430]  [f7c55615] v4l2_ioctl+0xe5/0x120 [videodev]
 [ 7597.346439]  [f7c55530] ? v4l2_open+0xf0/0xf0 [videodev]
 [ 7597.346443]  [c03668e2] do_vfs_ioctl+0x2e2/0x4d0
 [ 7597.346449]  [c0356a3c] ? vfs_write+0x13c/0x1c0
 [ 7597.346452]  [c03575df] ? vfs_writev+0x2f/0x50
 [ 7597.346455]  [c0366b28] SyS_ioctl+0x58/0x80
 [ 7597.346460]  [c07870ec] sysenter_do_call+0x12/0x16
 [ 7597.346463] ---[ end trace 16421a251cba8f63 ]---
 
 
 There have been quite a few vb2 changes recently.
 Any idea what's wrong ? Could you take a look at this ?

What it means is that the driver appears not to have given back all
buffers to the vb2 core. I do see that this doesn't happen in
start_streaming if an error occurs there (queued buffers should be
returned to state DEQUEUED in that case), but stop_streaming seems to
return it perfectly fine. If in your test case start_streaming failed,
then that would explain it.

Enable the VIDEO_ADV_DEBUG config option which will dump an overview of
the vb2 ops: mismatched counts should be reported.

I'm not sure if I can test this this weekend: I have two em28xx devices,
one is at work, the other is a Hauppauge 930C, but the analog support for
that one is missing in the driver (even though it still creates a video
node!).

It will probably be Tuesday evening before I can test.

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 v2 0/9] rc: Add IR encode based wakeup filtering

2014-07-25 Thread James Hogan
Hi Mauro,

On Wednesday 23 July 2014 16:39:36 Mauro Carvalho Chehab wrote:
 Em Fri, 14 Mar 2014 23:04:10 +
 
 James Hogan ja...@albanarts.com escreveu:
  A recent discussion about proposed interfaces for setting up the
  hardware wakeup filter lead to the conclusion that it could help to have
  the generic capability to encode and modulate scancodes into raw IR
  events so that drivers for hardware with a low level wake filter (on the
  level of pulse/space durations) can still easily implement the higher
  level scancode interface that is proposed.
  
  I posted an RFC patchset showing how this could work, and Antti Seppälä
  posted additional patches to support rc5-sz and nuvoton-cir. This
  patchset improves the original RFC patches and combines  updates
  Antti's patches.
  
  I'm happy these patches are a good start at tackling the problem, as
  long as Antti is happy with them and they work for him of course.
  
  Future work could include:
   - Encoders for more protocols.
   - Carrier signal events (no use unless a driver makes use of it).
  
  Patch 1 adds the new encode API.
  Patches 2-3 adds some modulation helpers.
  Patches 4-6 adds some raw encode implementations.
  Patch 7 adds some rc-core support for encode based wakeup filtering.
  Patch 8 adds debug loopback of encoded scancode when filter set.
  Patch 9 (untested) adds encode based wakeup filtering to nuvoton-cir.
 
  Changes in v2:
 Any news about this patch series? There are some comments about them,
 so I'll be tagging it as changes requested at patchwork, waiting
 for a v3 (or is it already there in the middle of the 49 patches from
 David?).

This patch series seems to have been forgotten. I do have a few changes on top 
of v2 to address the review comments, so as you say I should probably rebase 
and do a v3 at some point.

Cheers
James
--
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 00/28] IPUv3 prep for video capture

2014-07-25 Thread Steve Longerbeam
On 07/23/2014 06:17 AM, Laurent Pinchart wrote:
 Hi Steve,

 On Thursday 17 July 2014 13:44:12 Steve Longerbeam wrote:
 On 07/17/2014 04:10 AM, Hans Verkuil wrote:
 Hi Steve,

 I don't know what your plan is, but when you want to mainline this it is
 the gpu subsystem that needs to review it. I noticed it wasn't
 cross-posted
 to the dri-devel mailinglist.
 Hi Hans,

 I'm reworking these patches, I've merged in some of the changes
 posted by Philip Zabel ([RFC PATCH 00/26] i.MX5/6 IPUv3 CSI/IC),
 specifically I've decided to use their version of ipu-ic.c, and
 also brought in their video-mux subdev driver. So I'm fine with
 cancelling this patch set.

 When/if I post the reworked v4l2 drivers that implement the media
 entity/device framework I will post the ipu-v3 specific changes
 to dri-devel as well.

 The reason I like Philip's version of ipu-ic is that it implements
 tiling to allow resizing output frames larger than 1024x1024. We
 (Mentor Graphics) did the same IC tiling, but it was done inside
 a separate mem2mem driver. By moving the tiling into ipu-ic, it
 allows 1024x1024 resizing to be part of an imx-ipuv3-ic media
 entity, and this entity can be part of multiple video pipelines
 (capture, video output, mem2mem).

 I am a bit worried about the amount of v4l2-specific stuff that is going
 into drivers/gpu/ipu-v3. Do things like csc and csi really belong there
 instead of under drivers/media?
 The current philosophy of the ipu-v3 driver seems to be that it is a
 library of IPU register-level primitives, so ipu-csi and ipu-ic follow
 that model. There will be nothing v4l2-specific in ipu-csi and ipu-ic,
 although the v4l2 subdev's will be the only clients of ipu-csi and
 ipu-ic.

Hi Laurent,

 I have a bit of trouble following up, due to my lack of knowledge of the 
 Freescale platforms. It would help if you could explain briefly how the 
 various IPU modules interact with each other at the hardware and software 
 level, and what the acronyms stand for (I assume IPU means Image Processing 
 Unit, CSI means Camera Serial Interface, but I don't know what IC is in this 
 context).

Yes, IPU and CSI are acronyms as you describe. IC stands for Image
Converter. The IC carries out scaling, color-space conversion, and
rotation. The IC has three independent task sub-blocks that can carry
out those three operations concurrently using some kind of task time-
sharing mechanism. The three IC tasks are referred to as pre-processing
for encode (PRP ENC), pre-processing for viewfinder (PRP VF) and
post-processing (PP). So for example, a video capture pipeline could
be actively streaming the PRP ENC task while a mem2mem pipeline
could concurrently be using the PP task.


 Are the CSI receivers linked to the graphics IP cores at the hardware level ?]

Yes, the raw frames from the CSI can be directed to either memory, the
IC, or to a video deinterlacing controller (VDIC).

The IPU contains a custom DMA controller (the IDMAC). There is a set
of ~64 IDMAC channels that are dedicated to specific video pipelines.
IDMAC channels can be linked together in hardware (a frame-completion
signal from a source channel can trigger start of DMA in a sink channel).

Here is one example hardware video pipeline in i.MX6 (there are many
more). This example is to send raw interlaced frames from the CSI to
the VDIC, and then the progressive frames to IC PRP VF task for additional
scaling/CSC/rotation:

CSI0 -- VDIC -- IC PRP VF --- idmac channel 21 --- memory


If you're interested in knowing more about the i.MX6 you can pick
up Freescale's TRM at:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6Qfpsp=1tab=Documentation_Tab

The i.MX6 TRM is of poor quality, not good enough for actual register-level
programming in many areas, especially the IPU chapter. But good enough for
getting a general overview.

Steve

--
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 v4 1/2] media: soc_camera: pxa_camera device-tree support

2014-07-25 Thread Robert Jarzmik
Guennadi Liakhovetski g.liakhovet...@gmx.de writes:

 Thanks for a quick test! One question: to test this you also needed a 
 version of Ben's soc_camera: add support for dt binding soc_camera 
 drivers patch, right?
Yes.

 Did you use the last version from Ben or my amended version, that I sent
 yesterday?
Ben's version.

 If you didn't use my version, would it be possible for you to test it and
 reply with your tested-by if all looks ok?
Of course, as soon as I find it. And yes, linux-media periodically drops me from
the list members, so I didn't receive it ...

You must be speaking of [PATCH v6 4/6] soc_camera: add support for dt binding
soc_camera drivers ... If you could send it to me by mail I wouldn't have to
fight with Google, spinics and others, and I'll concentrate on the testing side
:)

Cheers.

-- 
Robert
--
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 16/49] rc-core: use an IDA rather than a bitmap

2014-07-25 Thread Mauro Carvalho Chehab
As I commented on a private e-mail, based on the patch descriptions:

Patch 17 deserves a bigger explanation. Well, the best is if you
could send a separate RFC describing what you have in mind with
patches 16-29, for our discussions, explaining what usage are you
expecting for a non-LIRC chardev, as its description doesn't help
at all, and why LIRC's way doesn't fulfill our needs any more.

Patch 18 looks silly... why to replicate evdev on a separate device?

Patches 19 and 20 might make sense, but why not use LIRC instead?

As patch 16 is also part of this change, I'm skipping those patches
from my review. Please re-submit latter after some RFC discussions
about the API changes that are being proposed by those patches.

Thanks,

Em Fri, 04 Apr 2014 01:32:36 +0200
David Härdeman da...@hardeman.nu escreveu:

 This patch changes rc-core to use an IDA rather than a bitmap to assign
 unique numbers to each rc device. This is in preparation for introducing
 rc-core chardevs.
 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/rc/ir-raw.c  |2 +-
  drivers/media/rc/rc-main.c |   40 
  include/media/rc-core.h|4 ++--
  3 files changed, 23 insertions(+), 23 deletions(-)
 
 diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
 index 2a7f858..aed2997 100644
 --- a/drivers/media/rc/ir-raw.c
 +++ b/drivers/media/rc/ir-raw.c
 @@ -271,7 +271,7 @@ int ir_raw_event_register(struct rc_dev *dev)
  
   spin_lock_init(dev-raw-lock);
   dev-raw-thread = kthread_run(ir_raw_event_thread, dev-raw,
 -rc%ld, dev-devno);
 +rc%u, dev-minor);
  
   if (IS_ERR(dev-raw-thread)) {
   rc = PTR_ERR(dev-raw-thread);
 diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
 index 2788102..42268f3 100644
 --- a/drivers/media/rc/rc-main.c
 +++ b/drivers/media/rc/rc-main.c
 @@ -18,17 +18,15 @@
  #include linux/input.h
  #include linux/leds.h
  #include linux/slab.h
 +#include linux/idr.h
  #include linux/device.h
  #include linux/module.h
  #include rc-core-priv.h
  
 -/* Bitmap to store allocated device numbers from 0 to IRRCV_NUM_DEVICES - 1 
 */
 -#define IRRCV_NUM_DEVICES  256
 -static DECLARE_BITMAP(ir_core_dev_number, IRRCV_NUM_DEVICES);
 -
  /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */
  #define IR_TAB_MIN_SIZE  256
  #define IR_TAB_MAX_SIZE  8192
 +#define RC_DEV_MAX   256
  
  /* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */
  #define IR_KEYPRESS_TIMEOUT 250
 @@ -38,6 +36,9 @@ static LIST_HEAD(rc_map_list);
  static DEFINE_SPINLOCK(rc_map_lock);
  static struct led_trigger *led_feedback;
  
 +/* Used to keep track of rc devices */
 +static DEFINE_IDA(rc_ida);
 +
  static struct rc_map_list *seek_rc_map(const char *name)
  {
   struct rc_map_list *map = NULL;
 @@ -1442,7 +1443,9 @@ int rc_register_device(struct rc_dev *dev)
   static bool raw_init = false; /* raw decoders loaded? */
   struct rc_map *rc_map;
   const char *path;
 - int rc, devno, attr = 0;
 + int attr = 0;
 + int minor;
 + int rc;
  
   if (!dev || !dev-map_name)
   return -EINVAL;
 @@ -1462,13 +1465,13 @@ int rc_register_device(struct rc_dev *dev)
   if (dev-close)
   dev-input_dev-close = ir_close;
  
 - do {
 - devno = find_first_zero_bit(ir_core_dev_number,
 - IRRCV_NUM_DEVICES);
 - /* No free device slots */
 - if (devno = IRRCV_NUM_DEVICES)
 - return -ENOMEM;
 - } while (test_and_set_bit(devno, ir_core_dev_number));
 + minor = ida_simple_get(rc_ida, 0, RC_DEV_MAX, GFP_KERNEL);
 + if (minor  0)
 + return minor;
 +
 + dev-minor = minor;
 + dev_set_name(dev-dev, rc%u, dev-minor);
 + dev_set_drvdata(dev-dev, dev);
  
   dev-dev.groups = dev-sysfs_groups;
   dev-sysfs_groups[attr++] = rc_dev_protocol_attr_grp;
 @@ -1488,9 +1491,6 @@ int rc_register_device(struct rc_dev *dev)
*/
   mutex_lock(dev-lock);
  
 - dev-devno = devno;
 - dev_set_name(dev-dev, rc%ld, dev-devno);
 - dev_set_drvdata(dev-dev, dev);
   rc = device_add(dev-dev);
   if (rc)
   goto out_unlock;
 @@ -1558,8 +1558,8 @@ int rc_register_device(struct rc_dev *dev)
  
   mutex_unlock(dev-lock);
  
 - IR_dprintk(1, Registered rc%ld (driver: %s, remote: %s, mode %s)\n,
 -dev-devno,
 + IR_dprintk(1, Registered rc%u (driver: %s, remote: %s, mode %s)\n,
 +dev-minor,
  dev-driver_name ? dev-driver_name : unknown,
  rc_map-name ? rc_map-name : unknown,
  dev-driver_type == RC_DRIVER_IR_RAW ? raw : cooked);
 @@ -1578,7 +1578,7 @@ out_dev:
   device_del(dev-dev);
  out_unlock:
   mutex_unlock(dev-lock);
 - clear_bit(dev-devno, 

Re: [PATCH 31/49] rc-core: split rc-main.c into rc-main.c and rc-keytable.c

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:33:52 +0200
David Härdeman da...@hardeman.nu escreveu:

 rc-main.c is getting quite large and contains two distinct parts, one
 related to the chardev (fops, sysfs, etc) and one related to all
 key functionality. Split off the key functionality to a separate file in
 preparation for the coming patches.
 
 I've done the splitting as a separate patch with the absolute minimum changes
 (making some methods non-static) because it's nigh impossible to review
 code changes and this code of split in the same patch.

The idea makes sense for me. Please rebase it and re-send before the
chardev stuff. Better to do it earlier and not depending on the RFC
discussions that could take some time.

Regards,
Mauro

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/rc/Makefile   |2 
  drivers/media/rc/rc-core-priv.h |   17 +
  drivers/media/rc/rc-keytable.c  |  851 
 +++
  drivers/media/rc/rc-main.c  |  853 
 +--
  4 files changed, 883 insertions(+), 840 deletions(-)
  create mode 100644 drivers/media/rc/rc-keytable.c
 
 diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
 index d326d4d..de08ee6 100644
 --- a/drivers/media/rc/Makefile
 +++ b/drivers/media/rc/Makefile
 @@ -1,4 +1,4 @@
 -rc-core-objs := rc-main.o ir-raw.o
 +rc-core-objs := rc-main.o rc-keytable.o ir-raw.o
  
  obj-y += keymaps/
  
 diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
 index aacc192..6da8a0d 100644
 --- a/drivers/media/rc/rc-core-priv.h
 +++ b/drivers/media/rc/rc-core-priv.h
 @@ -155,9 +155,26 @@ int ir_raw_handler_register(struct ir_raw_handler 
 *ir_raw_handler);
  void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler);
  void ir_raw_init(void);
  
 +/*
 + * Methods from rc-keytable.c to be used internally
 + */
 +void ir_timer_keyup(unsigned long cookie);
 +int rc_input_open(struct input_dev *idev);
 +void rc_input_close(struct input_dev *idev);
 +int ir_setkeytable(struct rc_dev *dev, const struct rc_map *from);
 +void ir_free_table(struct rc_map *rc_map);
 +int ir_getkeycode(struct input_dev *idev,
 +   struct input_keymap_entry *ke);
 +int ir_setkeycode(struct input_dev *idev,
 +   const struct input_keymap_entry *ke,
 +   unsigned int *old_keycode);
 +
  /* Only to be used by rc-core and ir-lirc-codec */
  void rc_init_ir_rx(struct rc_dev *dev, struct rc_ir_rx *rx);
  
 +/* Only to be used by rc-keytable.c */
 +extern struct led_trigger *led_feedback;
 +
  /*
   * Decoder initialization code
   *
 diff --git a/drivers/media/rc/rc-keytable.c b/drivers/media/rc/rc-keytable.c
 new file mode 100644
 index 000..25faeba
 --- /dev/null
 +++ b/drivers/media/rc/rc-keytable.c
 @@ -0,0 +1,851 @@
 +/* rc-keytable.c - Remote Controller keytable handling
 + *
 + * Copyright (C) 2009-2010 by Mauro Carvalho Chehab
 + *
 + * 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 version 2 of the License.
 + *
 + *  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 media/rc-core.h
 +#include linux/spinlock.h
 +#include linux/delay.h
 +#include linux/input.h
 +#include linux/leds.h
 +#include linux/slab.h
 +#include linux/sched.h
 +#include linux/idr.h
 +#include linux/device.h
 +#include linux/module.h
 +#include linux/poll.h
 +#include rc-core-priv.h
 +
 +/* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */
 +#define IR_TAB_MIN_SIZE  256
 +#define IR_TAB_MAX_SIZE  8192
 +
 +/* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */
 +#define IR_KEYPRESS_TIMEOUT 250
 +
 +/* Used to keep track of known keymaps */
 +static LIST_HEAD(rc_map_list);
 +static DEFINE_SPINLOCK(rc_map_lock);
 +
 +static struct rc_map_list *seek_rc_map(const char *name)
 +{
 + struct rc_map_list *map = NULL;
 +
 + spin_lock(rc_map_lock);
 + list_for_each_entry(map, rc_map_list, list) {
 + if (!strcmp(name, map-map.name)) {
 + spin_unlock(rc_map_lock);
 + return map;
 + }
 + }
 + spin_unlock(rc_map_lock);
 +
 + return NULL;
 +}
 +
 +struct rc_map *rc_map_get(const char *name)
 +{
 +
 + struct rc_map_list *map;
 +
 + map = seek_rc_map(name);
 +#ifdef MODULE
 + if (!map) {
 + int rc = request_module(%s, name);
 + if (rc  0) {
 + printk(KERN_ERR Couldn't load IR keymap %s\n, name);
 + return NULL;
 + }
 + msleep(20); /* Give some time for IR to register */
 +
 + map = seek_rc_map(name);

Re: [PATCH 32/49] rc-core: prepare for multiple keytables

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:33:57 +0200
David Härdeman da...@hardeman.nu escreveu:

 Introduce struct rc_keytable which essentially maintains an input device
 and a table with scancode,protocol - keycode mappings. Move the relevant
 members from struct rc_dev into struct rc_keytable.

I can't apply this patch (and probably the other patches above patch 31,
because of the file split.

 This is in preparation for supporting multiple keytables, where each
 keytable would correspond to one physical remote controller, each with
 its own keymap and input device for reporting events to userspace.

Again, it deserves some RFC discussions. Why do you need multiple
keytables? How to update them from userspace without breaking the
existing support? 

Also, there are some devices where it is an impossible goal. For
example, there are several dib0700 devices that are identical to
the dibcom SDK hardware. Even the USB ID is the same. The only thing
that differs one device from the others is the IR layout.

This is solved at Kernel level with a table with several devices
inside it.

Ok, we could still use multiple keytables and associate those
generic USB ID to those tables, but it seems overkill, at least
at a first glance.

P.S.: I'll just tag the patches related to multiple keytables
as Changes requested just like this one without further notice,
as I'm expecting you to submit this patch series as a separate
patchset, after we have an agreement on your RFC.

Regards,
Mauro

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/rc/rc-core-priv.h |   16 +-
  drivers/media/rc/rc-keytable.c  |  341 
 ++-
  drivers/media/rc/rc-main.c  |  224 +++---
  include/media/rc-core.h |   62 +--
  4 files changed, 338 insertions(+), 305 deletions(-)
 
 diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
 index 6da8a0d..7a7770e 100644
 --- a/drivers/media/rc/rc-core-priv.h
 +++ b/drivers/media/rc/rc-core-priv.h
 @@ -158,16 +158,12 @@ void ir_raw_init(void);
  /*
   * Methods from rc-keytable.c to be used internally
   */
 -void ir_timer_keyup(unsigned long cookie);
 -int rc_input_open(struct input_dev *idev);
 -void rc_input_close(struct input_dev *idev);
 -int ir_setkeytable(struct rc_dev *dev, const struct rc_map *from);
 -void ir_free_table(struct rc_map *rc_map);
 -int ir_getkeycode(struct input_dev *idev,
 -   struct input_keymap_entry *ke);
 -int ir_setkeycode(struct input_dev *idev,
 -   const struct input_keymap_entry *ke,
 -   unsigned int *old_keycode);
 +void rc_keytable_keyup(struct rc_keytable *kt);
 +void rc_keytable_repeat(struct rc_keytable *kt);
 +void rc_keytable_keydown(struct rc_keytable *kt, enum rc_type protocol,
 +  u32 scancode, u8 toggle, bool autokeyup);
 +int rc_keytable_add(struct rc_dev *dev, struct rc_map *rc_map);
 +void rc_keytable_del(struct rc_dev *dev);
  
  /* Only to be used by rc-core and ir-lirc-codec */
  void rc_init_ir_rx(struct rc_dev *dev, struct rc_ir_rx *rx);
 diff --git a/drivers/media/rc/rc-keytable.c b/drivers/media/rc/rc-keytable.c
 index 25faeba..0f1b817 100644
 --- a/drivers/media/rc/rc-keytable.c
 +++ b/drivers/media/rc/rc-keytable.c
 @@ -187,7 +187,7 @@ static int ir_resize_table(struct rc_map *rc_map, gfp_t 
 gfp_flags)
  
  /**
   * ir_update_mapping() - set a keycode in the scancode-keycode table
 - * @dev: the struct rc_dev device descriptor
 + * @kt:  the struct rc_keytable
   * @rc_map:  scancode table to be adjusted
   * @index:   index of the mapping that needs to be updated
   * @keycode: the desired keycode
 @@ -196,7 +196,7 @@ static int ir_resize_table(struct rc_map *rc_map, gfp_t 
 gfp_flags)
   * This routine is used to update scancode-keycode mapping at given
   * position.
   */
 -static unsigned int ir_update_mapping(struct rc_dev *dev,
 +static unsigned int ir_update_mapping(struct rc_keytable *kt,
 struct rc_map *rc_map,
 unsigned int index,
 unsigned int new_keycode)
 @@ -221,16 +221,16 @@ static unsigned int ir_update_mapping(struct rc_dev 
 *dev,
  (unsigned long long)rc_map-scan[index].scancode,
  new_keycode);
   rc_map-scan[index].keycode = new_keycode;
 - __set_bit(new_keycode, dev-input_dev-keybit);
 + __set_bit(new_keycode, kt-idev-keybit);
   }
  
   if (old_keycode != KEY_RESERVED) {
   /* A previous mapping was updated... */
 - __clear_bit(old_keycode, dev-input_dev-keybit);
 + __clear_bit(old_keycode, kt-idev-keybit);
   /* ... but another scancode might use the same keycode */
   for (i = 0; i  rc_map-len; i++) {
   if (rc_map-scan[i].keycode == old_keycode) {
 - 

Re: [PATCH 37/49] rc-core: allow empty keymaps

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:34:23 +0200
David Härdeman da...@hardeman.nu escreveu:

 Remove the RC_MAP_EMPTY hack and instead allow for empty keymaps.

Doesn't apply anymore, but makes sense.

There's just one thing that we need to double check: if a given
device is with an empty keytable, it doesn't make sense to start
IR polling, as IR polling costs power.

So, we need to be sure that we'll only call the IR start method
if the table is filled.

I think the current behavior already takes this into account, but
we need to test it.

Regards,
Mauro

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/i2c/ir-kbd-i2c.c |4 +--
  drivers/media/pci/cx88/cx88-input.c|6 -
  drivers/media/pci/ivtv/ivtv-i2c.c  |2 +-
  drivers/media/rc/gpio-ir-recv.c|2 +-
  drivers/media/rc/img-ir/img-ir-hw.c|1 -
  drivers/media/rc/img-ir/img-ir-raw.c   |1 -
  drivers/media/rc/rc-keytable.c |3 +++
  drivers/media/rc/rc-loopback.c |1 -
  drivers/media/rc/rc-main.c |   33 
 ++--
  drivers/media/usb/dvb-usb-v2/af9015.c  |4 ---
  drivers/media/usb/dvb-usb-v2/af9035.c  |4 ---
  drivers/media/usb/dvb-usb-v2/az6007.c  |4 ++-
  drivers/media/usb/dvb-usb-v2/rtl28xxu.c|4 ---
  drivers/media/usb/dvb-usb/dvb-usb-remote.c |4 +--
  drivers/media/usb/em28xx/em28xx-cards.c|1 -
  include/media/rc-map.h |1 -
  16 files changed, 11 insertions(+), 64 deletions(-)
 
 diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
 index 8311f1a..5393558 100644
 --- a/drivers/media/i2c/ir-kbd-i2c.c
 +++ b/drivers/media/i2c/ir-kbd-i2c.c
 @@ -309,7 +309,6 @@ static int ir_probe(struct i2c_client *client, const 
 struct i2c_device_id *id)
   name= Pixelview;
   ir-get_key = get_key_pixelview;
   rc_type = RC_BIT_OTHER;
 - ir_codes= RC_MAP_EMPTY;
   break;
   case 0x18:
   case 0x1f:
 @@ -323,7 +322,6 @@ static int ir_probe(struct i2c_client *client, const 
 struct i2c_device_id *id)
   name= KNC One;
   ir-get_key = get_key_knc1;
   rc_type = RC_BIT_OTHER;
 - ir_codes= RC_MAP_EMPTY;
   break;
   case 0x6b:
   name= FusionHDTV;
 @@ -405,7 +403,7 @@ static int ir_probe(struct i2c_client *client, const 
 struct i2c_device_id *id)
   ir-rc = rc;
  
   /* Make sure we are all setup before going on */
 - if (!name || !ir-get_key || !rc_type || !ir_codes) {
 + if (!name || !ir-get_key || !rc_type) {
   dprintk(1, : Unsupported device at address 0x%02x\n,
   addr);
   err = -ENODEV;
 diff --git a/drivers/media/pci/cx88/cx88-input.c 
 b/drivers/media/pci/cx88/cx88-input.c
 index 3f1342c..cb587ce 100644
 --- a/drivers/media/pci/cx88/cx88-input.c
 +++ b/drivers/media/pci/cx88/cx88-input.c
 @@ -437,11 +437,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev 
 *pci)
   break;
   }
  
 - if (!ir_codes) {
 - err = -ENODEV;
 - goto err_out_free;
 - }
 -
   /*
* The usage of mask_keycode were very convenient, due to several
* reasons. Among others, the scancode tables were using the scancode
 @@ -612,7 +607,6 @@ void cx88_i2c_init_ir(struct cx88_core *core)
   core-init_data.name = cx88 Leadtek PVR 2000 remote;
   core-init_data.type = RC_BIT_UNKNOWN;
   core-init_data.get_key = get_key_pvr2000;
 - core-init_data.ir_codes = RC_MAP_EMPTY;
   break;
   }
  
 diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c 
 b/drivers/media/pci/ivtv/ivtv-i2c.c
 index 1a41ba5..846bb51 100644
 --- a/drivers/media/pci/ivtv/ivtv-i2c.c
 +++ b/drivers/media/pci/ivtv/ivtv-i2c.c
 @@ -222,7 +222,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, 
 const char *type, u8 addr)
   init_data-get_key = get_key_adaptec;
   init_data-name = itv-card_name;
   /* FIXME: The protocol and RC_MAP needs to be corrected */
 - init_data-ir_codes = RC_MAP_EMPTY;
 + /* init_data-ir_codes = RC_MAP_? */
   init_data-type = RC_BIT_UNKNOWN;
   break;
   }
 diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
 index 5985308..7d01560 100644
 --- a/drivers/media/rc/gpio-ir-recv.c
 +++ b/drivers/media/rc/gpio-ir-recv.c
 @@ -148,7 +148,7 @@ static int gpio_ir_recv_probe(struct platform_device 
 *pdev)
   rcdev-allowed_protocols = pdata-allowed_protos;
   else
   rcdev-allowed_protocols = RC_BIT_ALL;
 - rcdev-map_name = pdata-map_name ?: RC_MAP_EMPTY;
 + rcdev-map_name = pdata-map_name;
  
   gpio_dev-rcdev = rcdev;
   gpio_dev-gpio_nr = 

Re: [PATCH 39/49] rc-core: make IR raw handling a separate module

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:34:33 +0200
David Härdeman da...@hardeman.nu escreveu:

 Make drivers/media/rc/rc-ir-raw.c a separate kernel module.
 
 Drivers which use IR decoding must use these functions:
   rc_register_ir_raw_device()
   rc_unregister_ir_raw_device()
 instead of:
   rc_register_device()
   rc_unregister_device()
 
 This allows scancode drivers to skip lots of unnecessary functionality.

Makes sense to me. Please rebase.

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/common/siano/smsir.c  |5 +-
  drivers/media/common/siano/smsir.h  |2 -
  drivers/media/i2c/cx25840/cx25840-ir.c  |2 -
  drivers/media/pci/cx23885/cx23885-input.c   |   13 +---
  drivers/media/pci/cx23885/cx23888-ir.c  |2 -
  drivers/media/pci/cx88/cx88-input.c |   18 +++---
  drivers/media/pci/dm1105/dm1105.c   |1 
  drivers/media/pci/saa7134/saa7134-input.c   |   14 +++--
  drivers/media/pci/saa7134/saa7134.h |2 -
  drivers/media/rc/Makefile   |3 +
  drivers/media/rc/ati_remote.c   |1 
  drivers/media/rc/ene_ir.c   |9 +--
  drivers/media/rc/fintek-cir.c   |7 +-
  drivers/media/rc/gpio-ir-recv.c |9 +--
  drivers/media/rc/iguanair.c |7 +-
  drivers/media/rc/img-ir/img-ir-raw.c|7 +-
  drivers/media/rc/imon.c |1 
  drivers/media/rc/ite-cir.c  |9 +--
  drivers/media/rc/mceusb.c   |7 +-
  drivers/media/rc/nuvoton-cir.c  |7 +-
  drivers/media/rc/rc-core-priv.h |   10 ++-
  drivers/media/rc/rc-ir-raw.c|   39 +
  drivers/media/rc/rc-loopback.c  |7 +-
  drivers/media/rc/rc-main.c  |   36 +---
  drivers/media/rc/redrat3.c  |7 +-
  drivers/media/rc/streamzap.c|7 +-
  drivers/media/rc/ttusbir.c  |9 +--
  drivers/media/rc/winbond-cir.c  |9 +--
  drivers/media/usb/dvb-usb-v2/dvb_usb.h  |5 +-
  drivers/media/usb/dvb-usb-v2/dvb_usb_core.c |   12 +++-
  drivers/media/usb/dvb-usb-v2/rtl28xxu.c |2 -
  drivers/media/usb/dvb-usb/dvb-usb-remote.c  |9 ++-
  drivers/media/usb/dvb-usb/dvb-usb.h |5 +-
  drivers/media/usb/dvb-usb/technisat-usb2.c  |2 -
  drivers/media/usb/em28xx/em28xx-input.c |5 --
  drivers/media/usb/tm6000/tm6000-input.c |1 
  include/media/rc-core.h |   73 +---
  include/media/rc-ir-raw.h   |   83 
 +++
  38 files changed, 222 insertions(+), 225 deletions(-)
  create mode 100644 include/media/rc-ir-raw.h
 
 diff --git a/drivers/media/common/siano/smsir.c 
 b/drivers/media/common/siano/smsir.c
 index 273043e..f6938f4 100644
 --- a/drivers/media/common/siano/smsir.c
 +++ b/drivers/media/common/siano/smsir.c
 @@ -87,14 +87,13 @@ int sms_ir_init(struct smscore_device_t *coredev)
  #endif
  
   dev-priv = coredev;
 - dev-driver_type = RC_DRIVER_IR_RAW;
   dev-allowed_protocols = RC_BIT_ALL;
   dev-map_name = sms_get_board(board_id)-rc_codes;
   dev-driver_name = MODULE_NAME;
  
   sms_log(Input device (IR) %s is set for key events, dev-input_name);
  
 - err = rc_register_device(dev);
 + err = rc_register_ir_raw_device(dev);
   if (err  0) {
   sms_err(Failed to register device);
   rc_free_device(dev);
 @@ -108,7 +107,7 @@ int sms_ir_init(struct smscore_device_t *coredev)
  void sms_ir_exit(struct smscore_device_t *coredev)
  {
   if (coredev-ir.dev)
 - rc_unregister_device(coredev-ir.dev);
 + rc_unregister_ir_raw_device(coredev-ir.dev);
  
   sms_log();
  }
 diff --git a/drivers/media/common/siano/smsir.h 
 b/drivers/media/common/siano/smsir.h
 index fc8b792..05a2b01 100644
 --- a/drivers/media/common/siano/smsir.h
 +++ b/drivers/media/common/siano/smsir.h
 @@ -28,7 +28,7 @@ along with this program.  If not, see 
 http://www.gnu.org/licenses/.
  #define __SMS_IR_H__
  
  #include linux/input.h
 -#include media/rc-core.h
 +#include media/rc-ir-raw.h
  
  #define IR_DEFAULT_TIMEOUT   100
  
 diff --git a/drivers/media/i2c/cx25840/cx25840-ir.c 
 b/drivers/media/i2c/cx25840/cx25840-ir.c
 index e6588ee..119d4e8 100644
 --- a/drivers/media/i2c/cx25840/cx25840-ir.c
 +++ b/drivers/media/i2c/cx25840/cx25840-ir.c
 @@ -25,7 +25,7 @@
  #include linux/kfifo.h
  #include linux/module.h
  #include media/cx25840.h
 -#include media/rc-core.h
 +#include media/rc-ir-raw.h
  
  #include cx25840-core.h
  
 diff --git a/drivers/media/pci/cx23885/cx23885-input.c 
 b/drivers/media/pci/cx23885/cx23885-input.c
 index 1940c18..e2ba28d 100644
 --- a/drivers/media/pci/cx23885/cx23885-input.c
 +++ b/drivers/media/pci/cx23885/cx23885-input.c
 @@ -36,7 +36,7 @@
   */
  
  #include 

Re: [PATCH 40/49] rc-ir-raw: simplify locking

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:34:38 +0200
David Härdeman da...@hardeman.nu escreveu:

 Simplify and improve the locking in rc-ir-raw by making better use of
 the existing kfifo functionality and by using RCU where possible.

Please rebase.

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/rc/rc-core-priv.h |6 +-
  drivers/media/rc/rc-ir-raw.c|  124 
 ---
  2 files changed, 55 insertions(+), 75 deletions(-)
 
 diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
 index 0b32ef8..c3de26b 100644
 --- a/drivers/media/rc/rc-core-priv.h
 +++ b/drivers/media/rc/rc-core-priv.h
 @@ -37,11 +37,13 @@ struct ir_raw_handler {
   int (*raw_unregister)(struct rc_dev *dev);
  };
  
 +/* max number of pulse/space transitions to buffer */
 +#define RC_MAX_IR_EVENTS 512
 +
  struct ir_raw_event_ctrl {
   struct list_headlist;   /* to keep track of raw 
 clients */
   struct task_struct  *thread;
 - spinlock_t  lock;
 - struct kfifo_rec_ptr_1  kfifo;  /* fifo for the 
 pulse/space durations */
 + DECLARE_KFIFO(kfifo, struct ir_raw_event, RC_MAX_IR_EVENTS); /* for 
 pulse/space durations */
   ktime_t last_event; /* when last event 
 occurred */
   enum raw_event_type last_type;  /* last event type */
   struct rc_dev   *dev;   /* pointer to the 
 parent rc_dev */
 diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
 index 86f5aa7..9631825 100644
 --- a/drivers/media/rc/rc-ir-raw.c
 +++ b/drivers/media/rc/rc-ir-raw.c
 @@ -21,15 +21,12 @@
  #include linux/freezer.h
  #include rc-core-priv.h
  
 -/* Define the max number of pulse/space transitions to buffer */
 -#define MAX_IR_EVENT_SIZE  512
 -
 -/* Used to keep track of IR raw clients, protected by ir_raw_handler_lock */
 +/* IR raw clients/handlers, writers synchronize with ir_raw_mutex */
 +static DEFINE_MUTEX(ir_raw_mutex);
  static LIST_HEAD(ir_raw_client_list);
 -
 -/* Used to handle IR raw handler extensions */
 -static DEFINE_MUTEX(ir_raw_handler_lock);
  static LIST_HEAD(ir_raw_handler_list);
 +
 +/* protocols supported by the currently loaded decoders */
  static u64 available_protocols;
  
  static int ir_raw_event_thread(void *data)
 @@ -37,32 +34,19 @@ static int ir_raw_event_thread(void *data)
   struct ir_raw_event ev;
   struct ir_raw_handler *handler;
   struct ir_raw_event_ctrl *raw = (struct ir_raw_event_ctrl *)data;
 - int retval;
  
   while (!kthread_should_stop()) {
 -
 - spin_lock_irq(raw-lock);
 - retval = kfifo_len(raw-kfifo);
 -
 - if (retval  sizeof(ev)) {
 + if (kfifo_out(raw-kfifo, ev, 1) == 0) {
   set_current_state(TASK_INTERRUPTIBLE);
 -
 - if (kthread_should_stop())
 - set_current_state(TASK_RUNNING);
 -
 - spin_unlock_irq(raw-lock);
   schedule();
   continue;
   }
  
 - retval = kfifo_out(raw-kfifo, ev, sizeof(ev));
 - spin_unlock_irq(raw-lock);
 -
 - mutex_lock(ir_raw_handler_lock);
 - list_for_each_entry(handler, ir_raw_handler_list, list)
 + rcu_read_lock();
 + list_for_each_entry_rcu(handler, ir_raw_handler_list, list)
   handler-decode(raw-dev, ev);
 + rcu_read_unlock();
   raw-prev_ev = ev;
 - mutex_unlock(ir_raw_handler_lock);
   }
  
   return 0;
 @@ -76,7 +60,8 @@ static int ir_raw_event_thread(void *data)
   * This routine (which may be called from an interrupt context) stores a
   * pulse/space duration for the raw ir decoding state machines. Pulses are
   * signalled as positive values and spaces as negative values. A zero value
 - * will reset the decoding state machines.
 + * will reset the decoding state machines. Drivers are responsible for
 + * synchronizing calls to this function.
   */
  int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev)
  {
 @@ -86,7 +71,7 @@ int ir_raw_event_store(struct rc_dev *dev, struct 
 ir_raw_event *ev)
   IR_dprintk(2, sample: (%05dus %s)\n,
  TO_US(ev-duration), TO_STR(ev-pulse));
  
 - if (kfifo_in(dev-raw-kfifo, ev, sizeof(*ev)) != sizeof(*ev))
 + if (kfifo_in(dev-raw-kfifo, ev, 1) != 1)
   return -ENOMEM;
  
   return 0;
 @@ -258,14 +243,8 @@ EXPORT_SYMBOL_GPL(ir_raw_get_tx_event);
   */
  void ir_raw_event_handle(struct rc_dev *dev)
  {
 - unsigned long flags;
 -
 - if (!dev-raw)
 - return;
 -
 - spin_lock_irqsave(dev-raw-lock, flags);
 - wake_up_process(dev-raw-thread);
 - spin_unlock_irqrestore(dev-raw-lock, flags);
 + if (dev-raw)
 + 

Re: [PATCH 41/49] rc-core: rename mutex

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:34:43 +0200
David Härdeman da...@hardeman.nu escreveu:

 Having a mutex named lock is a bit misleading.

Please rebase.

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/rc/img-ir/img-ir-hw.c |4 ++-
  drivers/media/rc/rc-main.c  |   42 
 ++-
  include/media/rc-core.h |5 ++--
  3 files changed, 25 insertions(+), 26 deletions(-)
 
 diff --git a/drivers/media/rc/img-ir/img-ir-hw.c 
 b/drivers/media/rc/img-ir/img-ir-hw.c
 index 5bc7903..a9abbb4 100644
 --- a/drivers/media/rc/img-ir/img-ir-hw.c
 +++ b/drivers/media/rc/img-ir/img-ir-hw.c
 @@ -666,11 +666,11 @@ static void img_ir_set_protocol(struct img_ir_priv 
 *priv, u64 proto)
  {
   struct rc_dev *rdev = priv-hw.rdev;
  
 - mutex_lock(rdev-lock);
 + mutex_lock(rdev-mutex);
   rdev-enabled_protocols = proto;
   rdev-allowed_wakeup_protocols = proto;
   rdev-enabled_wakeup_protocols = proto;
 - mutex_unlock(rdev-lock);
 + mutex_unlock(rdev-mutex);
  }
  
  /* Set up IR decoders */
 diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
 index 7caca4f..bd4dfab 100644
 --- a/drivers/media/rc/rc-main.c
 +++ b/drivers/media/rc/rc-main.c
 @@ -109,7 +109,7 @@ int rc_open(struct rc_dev *dev)
  {
   int err = 0;
  
 - mutex_lock(dev-lock);
 + mutex_lock(dev-mutex);
  
   if (dev-dead)
   err = -ENODEV;
 @@ -119,7 +119,7 @@ int rc_open(struct rc_dev *dev)
   dev-users--;
   }
  
 - mutex_unlock(dev-lock);
 + mutex_unlock(dev-mutex);
  
   return err;
  }
 @@ -127,12 +127,12 @@ EXPORT_SYMBOL_GPL(rc_open);
  
  void rc_close(struct rc_dev *dev)
  {
 - mutex_lock(dev-lock);
 + mutex_lock(dev-mutex);
  
   if (!dev-dead  !--dev-users  dev-close)
   dev-close(dev);
  
 - mutex_unlock(dev-lock);
 + mutex_unlock(dev-mutex);
  }
  EXPORT_SYMBOL_GPL(rc_close);
  
 @@ -322,7 +322,7 @@ struct rc_filter_attribute {
   * It returns the protocol names of supported protocols.
   * Enabled protocols are printed in brackets.
   *
 - * dev-lock is taken to guard against races between store_protocols and
 + * dev-mutex is taken to guard against races between store_protocols and
   * show_protocols.
   */
  static ssize_t show_protocols(struct device *device,
 @@ -339,7 +339,7 @@ static ssize_t show_protocols(struct device *device,
   return -EINVAL;
  
   rc_event(dev, RC_KEY, RC_KEY_REPEAT, 1);
 - mutex_lock(dev-lock);
 + mutex_lock(dev-mutex);
  
   if (fattr-type == RC_FILTER_NORMAL) {
   enabled = dev-enabled_protocols;
 @@ -349,7 +349,7 @@ static ssize_t show_protocols(struct device *device,
   allowed = dev-allowed_wakeup_protocols;
   }
  
 - mutex_unlock(dev-lock);
 + mutex_unlock(dev-mutex);
  
   IR_dprintk(1, %s: allowed - 0x%llx, enabled - 0x%llx\n,
  __func__, (long long)allowed, (long long)enabled);
 @@ -449,7 +449,7 @@ static int parse_protocol_change(u64 *protocols, const 
 char *buf)
   * See parse_protocol_change() for the valid commands.
   * Returns @len on success or a negative error code.
   *
 - * dev-lock is taken to guard against races between store_protocols and
 + * dev-mutex is taken to guard against races between store_protocols and
   * show_protocols.
   */
  static ssize_t store_protocols(struct device *device,
 @@ -488,7 +488,7 @@ static ssize_t store_protocols(struct device *device,
   return -EINVAL;
   }
  
 - mutex_lock(dev-lock);
 + mutex_lock(dev-mutex);
  
   old_protocols = *current_protocols;
   new_protocols = old_protocols;
 @@ -532,7 +532,7 @@ static ssize_t store_protocols(struct device *device,
   rc = len;
  
  out:
 - mutex_unlock(dev-lock);
 + mutex_unlock(dev-mutex);
   return rc;
  }
  
 @@ -550,7 +550,7 @@ out:
   * Bits of the filter value corresponding to set bits in the filter mask are
   * compared against input scancodes and non-matching scancodes are discarded.
   *
 - * dev-lock is taken to guard against races between store_filter and
 + * dev-mutex is taken to guard against races between store_filter and
   * show_filter.
   */
  static ssize_t show_filter(struct device *device,
 @@ -571,12 +571,12 @@ static ssize_t show_filter(struct device *device,
   else
   filter = dev-scancode_wakeup_filter;
  
 - mutex_lock(dev-lock);
 + mutex_lock(dev-mutex);
   if (fattr-mask)
   val = filter-mask;
   else
   val = filter-data;
 - mutex_unlock(dev-lock);
 + mutex_unlock(dev-mutex);
  
   return sprintf(buf, %#x\n, val);
  }
 @@ -597,7 +597,7 @@ static ssize_t show_filter(struct device *device,
   * Bits of the filter value corresponding to set bits in the filter mask are
   * compared against input scancodes and non-matching scancodes are discarded.
   *
 - * dev-lock is taken to guard against 

Re: [PATCH 44/49] rc-core: don't report scancodes via input devices

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:34:58 +0200
David Härdeman da...@hardeman.nu escreveu:

 The scancode that is reported via the input device(s) is now incomplete
 (missing the protocol) and redundant.

Not true yet, and I'm not sure if this is the right direction. Why?

Let's discuss it together with the RFC related to the usage of chardevs.


 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/rc/rc-keytable.c |   21 +
  1 file changed, 5 insertions(+), 16 deletions(-)
 
 diff --git a/drivers/media/rc/rc-keytable.c b/drivers/media/rc/rc-keytable.c
 index 5709ae6..23a66c7 100644
 --- a/drivers/media/rc/rc-keytable.c
 +++ b/drivers/media/rc/rc-keytable.c
 @@ -645,17 +645,10 @@ void rc_keytable_repeat(struct rc_keytable *kt)
   unsigned long flags;
  
   spin_lock_irqsave(kt-key_lock, flags);
 -
 - input_event(kt-idev, EV_MSC, MSC_SCAN, kt-last_scancode);
 - input_sync(kt-idev);
 -
 - if (!kt-key_pressed)
 - goto out;
 -
 - kt-keyup_jiffies = jiffies + msecs_to_jiffies(RC_KEYPRESS_TIMEOUT);
 - mod_timer(kt-timer_keyup, kt-keyup_jiffies);
 -
 -out:
 + if (kt-key_pressed) {
 + kt-keyup_jiffies = jiffies + 
 msecs_to_jiffies(RC_KEYPRESS_TIMEOUT);
 + mod_timer(kt-timer_keyup, kt-keyup_jiffies);
 + }
   spin_unlock_irqrestore(kt-key_lock, flags);
  }
  
 @@ -695,8 +688,6 @@ void rc_keytable_keydown(struct rc_keytable *kt, enum 
 rc_type protocol,
   if (new_event)
   rc_do_keyup(kt, false);
  
 - input_event(kt-idev, EV_MSC, MSC_SCAN, scancode);
 -
   if (new_event  keycode != KEY_RESERVED) {
   /* Register a keypress */
   kt-key_pressed = true;
 @@ -710,8 +701,8 @@ void rc_keytable_keydown(struct rc_keytable *kt, enum 
 rc_type protocol,
  kt-dev-input_name, keycode, protocol,
  (long long unsigned)scancode);
   input_report_key(kt-idev, keycode, 1);
 + input_sync(kt-idev);
   }
 - input_sync(kt-idev);
  
   if (autoup  kt-key_pressed) {
   kt-keyup_jiffies = jiffies + 
 msecs_to_jiffies(RC_KEYPRESS_TIMEOUT);
 @@ -811,8 +802,6 @@ struct rc_keytable *rc_keytable_create(struct rc_dev 
 *dev, const char *name,
   idev-close = rc_input_close;
   set_bit(EV_KEY, idev-evbit);
   set_bit(EV_REP, idev-evbit);
 - set_bit(EV_MSC, idev-evbit);
 - set_bit(MSC_SCAN, idev-mscbit);
   input_set_drvdata(idev, kt);
   setup_timer(kt-timer_keyup, rc_timer_keyup, (unsigned long)kt);
  
 
 --
 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 45/49] rc-ir-raw: add various rc_events

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:35:03 +0200
David Härdeman da...@hardeman.nu escreveu:

 Reporting pulse/space events via the /dev/rc/rcX device node is an
 important step towards having feature parity with LIRC.

Why to duplicate LIRC?

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/media/rc/rc-ir-raw.c |   11 +++
  1 file changed, 11 insertions(+)
 
 diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
 index bf5215b..3b68975 100644
 --- a/drivers/media/rc/rc-ir-raw.c
 +++ b/drivers/media/rc/rc-ir-raw.c
 @@ -71,6 +71,17 @@ int ir_raw_event_store(struct rc_dev *dev, struct 
 ir_raw_event *ev)
   IR_dprintk(2, sample: (%05dus %s)\n,
  TO_US(ev-duration), TO_STR(ev-pulse));
  
 + if (ev-reset)
 + rc_event(dev, RC_IR, RC_IR_RESET, 1);
 + else if (ev-carrier_report)
 + rc_event(dev, RC_IR, RC_IR_CARRIER, ev-carrier);
 + else if (ev-timeout)
 + rc_event(dev, RC_IR, RC_IR_STOP, 1);
 + else if (ev-pulse)
 + rc_event(dev, RC_IR, RC_IR_PULSE, ev-duration);
 + else
 + rc_event(dev, RC_IR, RC_IR_SPACE, ev-duration);
 +
   if (kfifo_in(dev-raw-kfifo, ev, 1) != 1)
   return -ENOMEM;
  
 
 --
 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 46/49] rc-core: use struct rc_event for all rc communication

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:35:08 +0200
David Härdeman da...@hardeman.nu escreveu:

 Remove struct ir_raw_event and use struct rc_event in all stages
 of IR processing. This should help future flexibility and also
 cuts down on the confusing number of structs that are flying
 around in rc-*.

You should rebase this one. Please also add a better explanation,
as I didn't get what you want to do here nor why.

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  drivers/hid/hid-picolcd_cir.c  |   18 +++--
  drivers/media/common/siano/smsir.c |7 +-
  drivers/media/i2c/cx25840/cx25840-ir.c |   94 
 +++-
  drivers/media/pci/cx23885/cx23885-input.c  |   11 +--
  drivers/media/pci/cx23885/cx23888-ir.c |   91 ++-
  drivers/media/pci/cx88/cx88-input.c|   13 +++-
  drivers/media/rc/ene_ir.c  |   12 ++--
  drivers/media/rc/fintek-cir.c  |   21 +++---
  drivers/media/rc/iguanair.c|   17 ++---
  drivers/media/rc/ir-jvc-decoder.c  |   48 +++---
  drivers/media/rc/ir-lirc-codec.c   |   28 
  drivers/media/rc/ir-mce_kbd-decoder.c  |   34 +-
  drivers/media/rc/ir-nec-decoder.c  |   51 ---
  drivers/media/rc/ir-rc5-decoder.c  |   32 +-
  drivers/media/rc/ir-rc6-decoder.c  |   48 +++---
  drivers/media/rc/ir-sanyo-decoder.c|   46 +++---
  drivers/media/rc/ir-sharp-decoder.c|   49 +++
  drivers/media/rc/ir-sony-decoder.c |   42 +++--
  drivers/media/rc/ite-cir.c |   19 ++
  drivers/media/rc/ite-cir.h |2 -
  drivers/media/rc/mceusb.c  |   15 +++-
  drivers/media/rc/nuvoton-cir.c |   18 +++--
  drivers/media/rc/rc-core-priv.h|   40 +++-
  drivers/media/rc/rc-ir-raw.c   |   89 +++
  drivers/media/rc/rc-loopback.c |   14 +---
  drivers/media/rc/redrat3.c |   34 --
  drivers/media/rc/streamzap.c   |   62 +-
  drivers/media/rc/ttusbir.c |   31 -
  drivers/media/rc/winbond-cir.c |   23 +++
  drivers/media/usb/dvb-usb-v2/rtl28xxu.c|6 +-
  drivers/media/usb/dvb-usb/technisat-usb2.c |   15 +++-
  include/media/rc-ir-raw.h  |   47 +-
  32 files changed, 548 insertions(+), 529 deletions(-)
 
 diff --git a/drivers/hid/hid-picolcd_cir.c b/drivers/hid/hid-picolcd_cir.c
 index 59d5eb1..1f9021f 100644
 --- a/drivers/hid/hid-picolcd_cir.c
 +++ b/drivers/hid/hid-picolcd_cir.c
 @@ -45,7 +45,7 @@ int picolcd_raw_cir(struct picolcd_data *data,
  {
   unsigned long flags;
   int i, w, sz;
 - DEFINE_IR_RAW_EVENT(rawir);
 + DEFINE_IR_RAW_EVENT(ev);
  
   /* ignore if rc_dev is NULL or status is shunned */
   spin_lock_irqsave(data-lock, flags);
 @@ -67,14 +67,18 @@ int picolcd_raw_cir(struct picolcd_data *data,
*/
   sz = size  0 ? min((int)raw_data[0], size-1) : 0;
   for (i = 0; i+1  sz; i += 2) {
 - init_ir_raw_event(rawir);
   w = (raw_data[i]  8) | (raw_data[i+1]);
 - rawir.pulse = !!(w  0x8000);
 - rawir.duration = US_TO_NS(rawir.pulse ? (65536 - w) : w);
 + if (w  0x8000) {
 + ev.code = RC_IR_PULSE;
 + ev.val = US_TO_NS(65536 - w);
 + } else {
 + ev.code = RC_IR_SPACE;
 + ev.val = US_TO_NS(w);
 + }
   /* Quirk!! - see above */
 - if (i == 0  rawir.duration  1500)
 - rawir.duration -= 1500;
 - ir_raw_event_store(data-rc_dev, rawir);
 + if (i == 0  ev.val  1500)
 + ev.val -= 1500;
 + ir_raw_event_store(data-rc_dev, ev);
   }
   ir_raw_event_handle(data-rc_dev);
  
 diff --git a/drivers/media/common/siano/smsir.c 
 b/drivers/media/common/siano/smsir.c
 index f6938f4..3959a572 100644
 --- a/drivers/media/common/siano/smsir.c
 +++ b/drivers/media/common/siano/smsir.c
 @@ -38,12 +38,11 @@ void sms_ir_event(struct smscore_device_t *coredev, const 
 char *buf, int len)
  {
   int i;
   const s32 *samples = (const void *)buf;
 + DEFINE_IR_RAW_EVENT(ev);
  
   for (i = 0; i  len  2; i++) {
 - DEFINE_IR_RAW_EVENT(ev);
 -
 - ev.duration = abs(samples[i]) * 1000; /* Convert to ns */
 - ev.pulse = (samples[i]  0) ? false : true;
 + ev.val = US_TO_NS(abs(samples[i]));
 + ev.code = (samples[i]  0) ? RC_IR_SPACE : RC_IR_PULSE;
  
   ir_raw_event_store(coredev-ir.dev, ev);
   }
 diff --git a/drivers/media/i2c/cx25840/cx25840-ir.c 
 b/drivers/media/i2c/cx25840/cx25840-ir.c
 index 119d4e8..1672f0e 100644
 --- 

[PATCH] rc-core: don't use dynamic_pr_debug for IR_dprintk()

2014-07-25 Thread Mauro Carvalho Chehab
The hole point of IR_dprintk() is that, once a level is
given at debug parameter, all enabled IR parsers will show their
debug messages.

While converting it to dynamic_printk might be a good idea,
right now it just makes very hard to debug the drivers, as
one needs to both pass debug=1 or debug=2 to rc-core and
to use the dynamic printk to enable all the desired lines.

That doesn't make sense!

So, revert to the old way, as a single line is changed,
and the debug parameter will now work as expected.

Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
---
 include/media/rc-core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 3047837db1cc..2c7fbca40b69 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -26,7 +26,7 @@ extern int rc_core_debug;
 #define IR_dprintk(level, fmt, ...)\
 do {   \
if (rc_core_debug = level) \
-   pr_debug(%s:  fmt, __func__, ##__VA_ARGS__);  \
+   printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__);  \
 } while (0)
 
 enum rc_driver_type {
-- 
1.9.3

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


cron job: media_tree daily build: ERRORS

2014-07-25 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 Jul 26 04:00:23 CEST 2014
git branch: test
git hash:   488046c237f3b78f91046d45662b318cd2415f64
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-16-g1db35d0
host hardware:  x86_64
host os:3.15-5.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: ERRORS
linux-2.6.34.7-i686: ERRORS
linux-2.6.35.9-i686: ERRORS
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: 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-rc1-i686: OK
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: ERRORS
linux-2.6.34.7-x86_64: ERRORS
linux-2.6.35.9-x86_64: ERRORS
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: 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-rc1-x86_64: OK
apps: OK
spec-git: OK
ABI WARNING: change for arm-at91
ABI WARNING: change for arm-davinci
ABI WARNING: change for arm-exynos
ABI WARNING: change for arm-mx
ABI WARNING: change for arm-omap
ABI WARNING: change for arm-omap1
ABI WARNING: change for arm-pxa
ABI WARNING: change for blackfin
ABI WARNING: change for i686
ABI WARNING: change for m32r
ABI WARNING: change for mips
ABI WARNING: change for powerpc64
ABI WARNING: change for sh
ABI WARNING: change for x86_64
sparse: WARNINGS

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: Ping: [PATCH 0/10] drivers/media/rc/ati_remote.c tweaks

2014-07-25 Thread Mauro Carvalho Chehab
Em 6 Jun 2014 23:26:22 -0400
George Spelvin li...@horizon.com escreveu:

 Just a ping... has anyone looked at this?
 (David Härdeman added to recipients list.)
 
 The series can be found in the linux-media archives stating at
 
 mid:2014051113.14427.qm...@ns.horizon.com
 http://www.spinics.net/lists/linux-media/msg76435.html
 http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/77678
 
 or I'm happy to re-mail it.

As nobody replied, I'm assuming that people are ok with those
changes, so I'll apply.

Regards,
Mauro
--
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] V4L2: fix VIDIOC_CREATE_BUFS 32-bit compatibility mode data copy-back

2014-07-25 Thread Mauro Carvalho Chehab
Em Sat, 31 May 2014 01:36:16 +0200
Laurent Pinchart laurent.pinch...@ideasonboard.com escreveu:

 Hi Guennadi,
 
 Thank you for the patch.
 
 On Saturday 31 May 2014 01:26:38 Guennadi Liakhovetski wrote:
  Similar to an earlier patch,
 
 Could you please mention the commit ID in the commit message ?
 
  fixing reading user-space data for the
  VIDIOC_CREATE_BUFS ioctl() in 32-bit compatibility mode, this patch fixes
  writing back of the possibly modified struct to the user. However, unlike
  the former bug, this one is much less harmful, because it only results in
  the kernel failing to write the .type field back to the user, but in fact
  this is likely unneeded, because the kernel will hardly want to change
  that field. Therefore this bug is more of a theoretical nature.
  
  Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de
 
 Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 
  ---
  
  Not tested yet, I'll (try not to forget to) test it next week.

What's the status of this patch? The above message is scary...

Was it tested already?

Regards,
Mauro


  
   drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 10 ++
   1 file changed, 6 insertions(+), 4 deletions(-)
  
  diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
  b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 7e2411c..c86a7e8
  100644
  --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
  +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
  @@ -222,6 +222,9 @@ static int get_v4l2_create32(struct v4l2_create_buffers
  *kp, struct v4l2_create_
  
   static int __put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32
  __user *up) {
  +   if (put_user(kp-type, up-type))
  +   return -EFAULT;
  +
  switch (kp-type) {
  case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT:
  @@ -248,8 +251,7 @@ static int __put_v4l2_format32(struct v4l2_format *kp,
  struct v4l2_format32 __us
  
   static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32
  __user *up) {
  -   if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) ||
  -   put_user(kp-type, up-type))
  +   if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)))
  return -EFAULT;
  return __put_v4l2_format32(kp, up);
   }
  @@ -257,8 +259,8 @@ static int put_v4l2_format32(struct v4l2_format *kp,
  struct v4l2_format32 __user static int put_v4l2_create32(struct
  v4l2_create_buffers *kp, struct v4l2_create_buffers32 __user *up) {
  if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_create_buffers32)) 
  ||
  -   copy_to_user(up, kp, offsetof(struct v4l2_create_buffers32,
  format.fmt)))
  -   return -EFAULT;
  +   copy_to_user(up, kp, offsetof(struct v4l2_create_buffers32, 
  format)))
  +   return -EFAULT;
  return __put_v4l2_format32(kp-format, up-format);
   }
 
--
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


[linuxtv-media:master 353/499] ERROR: usb_kill_urb undefined!

2014-07-25 Thread kbuild test robot
tree:   git://linuxtv.org/media_tree.git master
head:   d6740d86deda4acc8dc2cf196ccb9d8eb30bcb9a
commit: 77bbb2b049c1c3e935f5bec510bec337d94ae8f8 [353/499] rtl2832_sdr: move 
from staging to media
config: i386-randconfig-j1-07260922 (attached as .config)

Note: the linuxtv-media/master HEAD d6740d86deda4acc8dc2cf196ccb9d8eb30bcb9a 
builds fine.
  It only hurts bisectibility.

All error/warnings:

 ERROR: usb_kill_urb undefined!
 ERROR: usb_free_coherent undefined!
 ERROR: usb_submit_urb undefined!
   ERROR: __udivdi3 undefined!
 ERROR: usb_alloc_coherent undefined!
 ERROR: usb_free_urb undefined!
 ERROR: usb_alloc_urb undefined!

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

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

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

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

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

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_PREEMPT_RCU is not set
CONFIG_RCU_STALL_COMMON=y
CONFIG_RCU_FANOUT=32
CONFIG_RCU_FANOUT_LEAF=16
CONFIG_RCU_FANOUT_EXACT=y
CONFIG_RCU_FAST_NO_HZ=y
CONFIG_TREE_RCU_TRACE=y
CONFIG_RCU_NOCB_CPU=y
CONFIG_RCU_NOCB_CPU_NONE=y
# CONFIG_RCU_NOCB_CPU_ZERO is not set
# CONFIG_RCU_NOCB_CPU_ALL is not set
CONFIG_IKCONFIG=y
CONFIG_LOG_BUF_SHIFT=17
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_ARCH_WANTS_PROT_NUMA_PROT_NONE=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
CONFIG_CGROUP_FREEZER=y
# CONFIG_CGROUP_DEVICE is not set
# CONFIG_CPUSETS is not set
# CONFIG_CGROUP_CPUACCT is not set
CONFIG_RESOURCE_COUNTERS=y
# CONFIG_MEMCG is not set
# CONFIG_CGROUP_HUGETLB is not set
# CONFIG_CGROUP_PERF is not set
# CONFIG_CGROUP_SCHED is not set
CONFIG_CHECKPOINT_RESTORE=y
CONFIG_NAMESPACES=y
# CONFIG_UTS_NS is not set
CONFIG_USER_NS=y
# CONFIG_PID_NS is not set
# CONFIG_NET_NS is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=
CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
CONFIG_RD_LZMA=y
# CONFIG_RD_XZ is not set
CONFIG_RD_LZO=y
# CONFIG_RD_LZ4 is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y