cron job: media_tree daily build: WARNINGS

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

Results of the daily build of media_tree:

date:   Wed Mar 18 04:00:23 CET 2015
git branch: test
git hash:   3d945be05ac1e806af075e9315bc1b3409adae2b
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.19.0-1.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-rc1-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


Re: [PATCH 23/35 linux-next] [media] constify of_device_id array

2015-03-17 Thread Patrice Chotard

Hi Fabian

On 03/16/2015 08:54 PM, Fabian Frederick wrote:

of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick f...@skynet.be
---

...

  drivers/media/rc/st_rc.c | 2 +-


For this driver

Acked-by: Patrice Chotard patrice.chot...@st.com

Thanks

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


capture high resolution images from webcam

2015-03-17 Thread Oliver Lehmann

Hi,

I'm using v4l2 on FreeBSD but I hope this doesn't matter that much.
I got a new MS LifeCam Studio HD which makes quite good pictures
because of its focus possibilites.

When I use the original software provided by MS the autofocus
feature works damn good. With v4l2, autofocus is enabled but it
just does not focus. Disabling autofocus and setting focus manually
does work (and in my case this is sufficient)

Another point is, that this cam can record pictures with 8 megapixel
which results in 3840x2160 image files. This 8MP mode and the 1080p
mode is only available for snapshot pictures. The highest resolution
supported for videos is 720p.

All I want is recording snapshot images and I do not need the video
capability at all.

I wonder how I can capture those big 8MP images? With mplayer I'm
only able toe capture 720p at max. I guess because mplayer just
accesses the video mode and takes a single frame.

mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=1280:height=720  
-frames 1 -vo jpeg


I wonder if there is a possibility to access the cam in the
I-call-it-snapshot-mode to take single pictures with higher resolutions?

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


Re: [PATCH v3 0/5] Signalling last decoded frame by V4L2_BUF_FLAG_LAST and -EPIPE

2015-03-17 Thread Philipp Zabel
Hi,

Am Freitag, den 06.03.2015, 11:18 +0100 schrieb Philipp Zabel:
 At the V4L2 codec API session during ELC-E 2014, we agreed that for the 
 decoder
 draining flow, after a V4L2_DEC_CMD_STOP decoder command was issued, the last
 decoded buffer should get dequeued with a V4L2_BUF_FLAG_LAST set. After that,
 poll should immediately return and all following VIDIOC_DQBUF should return
 -EPIPE until the stream is stopped or decoding continued via 
 V4L2_DEC_CMD_START.
 (or STREAMOFF/STREAMON).
 
 Changes since v2:
  - Made V4L2_BUF_FLAG_LAST known to trace events
 
 regards
 Philipp
 
 Peter Seiderer (1):
   [media] videodev2: Add V4L2_BUF_FLAG_LAST
 
 Philipp Zabel (4):
   [media] videobuf2: return -EPIPE from DQBUF after the last buffer
   [media] coda: Set last buffer flag and fix EOS event
   [media] s5p-mfc: Set last buffer flag
   [media] DocBooc: mention mem2mem codecs for encoder/decoder commands
 
  Documentation/DocBook/media/v4l/io.xml | 10 
  .../DocBook/media/v4l/vidioc-decoder-cmd.xml   |  6 -
  .../DocBook/media/v4l/vidioc-encoder-cmd.xml   |  5 +++-
  Documentation/DocBook/media/v4l/vidioc-qbuf.xml|  8 +++
  drivers/media/platform/coda/coda-bit.c |  4 ++--
  drivers/media/platform/coda/coda-common.c  | 27 
 +-
  drivers/media/platform/coda/coda.h |  3 +++
  drivers/media/platform/s5p-mfc/s5p_mfc.c   |  1 +
  drivers/media/v4l2-core/v4l2-mem2mem.c | 10 +++-
  drivers/media/v4l2-core/videobuf2-core.c   | 18 ++-
  include/media/videobuf2-core.h | 10 
  include/trace/events/v4l2.h|  3 ++-
  include/uapi/linux/videodev2.h |  2 ++
  13 files changed, 84 insertions(+), 23 deletions(-)

are there any further changes that I should make to this series?

regards
Philipp

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


hyvää päivää

2015-03-17 Thread Loan
hyvää päivää

Hanki laina tänään Loan Engine, jonka korko on 3%. täyttää
Lomake jos kiinnostaa:

Sukupuoli:
Maa:
Tarvittava määrä:
Kesto:
Mission:

On monia syitä, miksi lainan voi auttaa

terveiset

Ana Paula
--
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/RFC v13 02/13] dt-binding: leds: Add common LED DT bindings macros

2015-03-17 Thread Bryan Wu
On Thu, Mar 12, 2015 at 8:45 AM, Jacek Anaszewski
j.anaszew...@samsung.com wrote:
 Add macros for defining boost mode and trigger type properties
 of flash LED devices.

Applied, thanks,
-Bryan

 Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
 Acked-by: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Bryan Wu coolo...@gmail.com
 Cc: Richard Purdie rpur...@rpsys.net
 ---
  include/dt-bindings/leds/common.h |   21 +
  1 file changed, 21 insertions(+)
  create mode 100644 include/dt-bindings/leds/common.h

 diff --git a/include/dt-bindings/leds/common.h 
 b/include/dt-bindings/leds/common.h
 new file mode 100644
 index 000..79fcef7
 --- /dev/null
 +++ b/include/dt-bindings/leds/common.h
 @@ -0,0 +1,21 @@
 +/*
 + * This header provides macros for the common LEDs device tree bindings.
 + *
 + * Copyright (C) 2015, Samsung Electronics Co., Ltd.
 + *
 + * Author: Jacek Anaszewski j.anaszew...@samsung.com
 + */
 +
 +#ifndef __DT_BINDINGS_LEDS_H__
 +#define __DT_BINDINGS_LEDS_H
 +
 +/* External trigger type */
 +#define LEDS_TRIG_TYPE_EDGE0
 +#define LEDS_TRIG_TYPE_LEVEL   1
 +
 +/* Boost modes */
 +#define LEDS_BOOST_OFF 0
 +#define LEDS_BOOST_ADAPTIVE1
 +#define LEDS_BOOST_FIXED   2
 +
 +#endif /* __DT_BINDINGS_LEDS_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


Re: Re: cx23885: DVBSky S952 dvb_register failed err = -22

2015-03-17 Thread Nibble Max
Hello Ole,

On 2015-03-18 02:32:54, Ole Ernst olebo...@gmx.com wrote:
Hi Max,

I get a chip_id of 0x81, which returns -ENODEV in the default branch of
the subsequent switch. So I guess my S952 is too old? :-( How hard would
it be to add support for it?

If it is m88ts2020, there is a tuner driver ts2020 in dvb-frontends 
directory.
If fail to load m88ts2022 driver, then try to load ts2020 driver.
m88ts2022 driver is an i2c driver, but ts2020 is traditional dvb-attach driver.
Please check the other code using ts2020 for reference.

Best Regards,
Max

Thanks,
Ole

Am 17.03.2015 um 02:53 schrieb Nibble Max:
 Hello,
 
 what is the chip_id debug output from m88ts2022 module?
 
 I think you maybe hold the old S952 card.
 Its satellite tuner is M88TS2020, not M88TS2022.
 
 Best Regards,
 Max
 On 2015-03-15 19:07:07, Ole Ernst olebo...@gmx.com wrote:
 Hi Antti,

 thanks for your quick response! Based on lsmod and modinfo I do have
 m88ts2022.

 $ lsmod | grep m88
 m88ts2022  16898  0
 regmap_i2c 12783  1 m88ts2022
 m88ds3103  21452  0
 i2c_mux12534  1 m88ds3103
 dvb_core  102038  4 cx23885,altera_ci,m88ds3103,videobuf2_dvb
 i2c_core   50240  13
 drm,i2c_i801,cx23885,cx25840,m88ts2022,i2c_mux,regmap_i2c,nvidia,v4l2_common,tveeprom,m88ds3103,tda18271,videodev

 $ modinfo m88ts2022
 filename:
 /lib/modules/3.19.1-1-ARCH/kernel/drivers/media/tuners/m88ts2022.ko.gz
 license:GPL
 author: Antti Palosaari cr...@iki.fi
 description:Montage M88TS2022 silicon tuner driver
 alias:  i2c:m88ts2022
 depends:i2c-core,regmap-i2c
 intree: Y
 vermagic:   3.19.1-1-ARCH SMP preempt mod_unload modversions

 Thanks,
 Ole

 Am 15.03.2015 um 11:49 schrieb Antti Palosaari:
 You don't have m88ts2022 driver installed.

 Antti

 On 03/15/2015 12:26 PM, Ole Ernst wrote:
 Hi,

 I added some printk in cx23885-dvb.c and the problem is in
 i2c_new_device:
 https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/media/pci/cx23885/cx23885-dvb.c?id=refs/tags/v3.19.1#n1935


 The returned client_tuner is not NULL, but client_tuner-dev.driver is.
 Hence it will goto frontend_detach, which will then return -EINVAL. Any
 idea why client_tuner-dev.driver is NULL?

 Thanks,
 Ole

 Am 14.03.2015 um 20:54 schrieb Ole Ernst:
 Hi,

 using linux-3.19.1-1 (Archlinux) I get the following output while
 booting without the media-build-tree provided by DVBSky:

 cx23885 driver version 0.0.4 loaded
 cx23885 :04:00.0: enabling device ( - 0002)
 CORE cx23885[0]: subsystem: 4254:0952, board: DVBSky S952
 [card=50,autodetected]
 cx25840 3-0044: cx23885 A/V decoder found @ 0x88 (cx23885[0])
 cx25840 3-0044: loaded v4l-cx23885-avcore-01.fw firmware (16382 bytes)
 cx23885_dvb_register() allocating 1 frontend(s)
 cx23885[0]: cx23885 based dvb card
 i2c i2c-2: m88ds3103_attach: chip_id=70
 i2c i2c-2: Added multiplexed i2c bus 4
 cx23885_dvb_register() dvb_register failed err = -22
 cx23885_dev_setup() Failed to register dvb adapters on VID_B
 cx23885_dvb_register() allocating 1 frontend(s)
 cx23885[0]: cx23885 based dvb card
 i2c i2c-1: m88ds3103_attach: chip_id=70
 i2c i2c-1: Added multiplexed i2c bus 4
 cx23885_dvb_register() dvb_register failed err = -22
 cx23885_dev_setup() Failed to register dvb on VID_C
 cx23885_dev_checkrevision() Hardware revision = 0xa5
 cx23885[0]/0: found at :04:00.0, rev: 4, irq: 17, latency: 0, mmio:
 0xf720

 Obviously there are no device in /dev/dvb. Using the media-build-tree
 works just fine though. The following firmware files are installed in
 /usr/lib/firmware:
 dvb-demod-m88ds3103.fw
 dvb-demod-m88rs6000.fw
 dvb-demod-si2168-a20-01.fw
 dvb-demod-si2168-a30-01.fw
 dvb-demod-si2168-b40-01.fw
 dvb-fe-ds300x.fw
 dvb-fe-ds3103.fw
 dvb-fe-rs6000.fw
 dvb-tuner-si2158-a20-01.fw

 Output of lspci -vvvnn:
 https://gist.githubusercontent.com/olebowle/6a4108363a9d1f7dd033/raw/lscpi


 I also set the module parameters debug, i2c_debug, irq_debug and
 irq_debug in cx23885.
 The output is pretty verbose and can be found here:
 https://gist.githubusercontent.com/olebowle/6a4108363a9d1f7dd033/raw/debug.log


 Thanks,
 Ole
 -- 
 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 1/5] [media] horus3a: Sony Horus3A DVB-S/S2 tuner driver

2015-03-17 Thread Mauro Carvalho Chehab
Em Wed, 18 Mar 2015 02:11:52 +0200
Antti Palosaari cr...@iki.fi escreveu:

 On 03/05/2015 10:54 AM, Mauro Carvalho Chehab wrote:
  Em Mon, 02 Feb 2015 12:22:32 +0300
  Kozlov Sergey se...@netup.ru escreveu:
 
  diff --git a/MAINTAINERS b/MAINTAINERS
  index ddb9ac8..a3a1767 100644
  --- a/MAINTAINERS
  +++ b/MAINTAINERS
  @@ -4365,6 +4365,15 @@ W:  http://linuxtv.org
S:   Odd Fixes
F:   drivers/media/usb/hdpvr/
 
  +HORUS3A MEDIA DRIVER
 
  Not a big issue, but could you please rename it to:
  MEDIA DRIVERS FOR HORUS3A
 
  We're trying to better organize the media entries at MAINTAINERS, at
  least for the new drivers.
 
 What the *ell is that new rule? MAINTAINERS file clearly says entries 
 should be alphabetical order,

Yes, whatever name is given, the MAINTAINERS entries should be in 
alphabetical order.

 but on the other-hand there seems to be 
 PCI and ARM specific stuff already grouped. Is that some new way?

Yeah, there is a tendency to try to group the entries on a similar
way on other subsystems.

So, Laurent proposed to do that for new drivers.

That's said, it makes no sense to rename the existing entries, as such
patch would likely make lots of people unhappy by causing a great number
of merge conflicts, but, as grouping the new entries seem to help
some people that manually looks at MAINTAINERS, it sounds a good
idea to do it for new drivers.

One advantage of grouping the entries for new drivers is that this
reduces the merge conflicts at MAINTAINERS, as it reduces the risk of
two subsystems to touch at the same part of the file.

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 v2 25/26] omap3isp: Move to videobuf2

2015-03-17 Thread Tim Nordell

Hi -

On 04/21/14 07:29, Laurent Pinchart wrote:

Replace the custom buffers queue implementation with a videobuf2 queue.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com


I realize this is late (it's in the kernel now), but I'm noticing that 
this does not appear to properly support the scatter-gather buffers that 
were previously supported as far as I recall (and can tell with what was 
removed with this patch), especially when using USERPTR.  You can 
observe this using yavta with the -u parameter.  Can you confirm if 
this works for you?  I get the following output from the kernel when 
attempting to stream a 640x480 UYVY framebuffer:


[  111.381256] contiguous mapping is too small 589824/614400

- Tim

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


Re: [PATCH 1/5] [media] horus3a: Sony Horus3A DVB-S/S2 tuner driver

2015-03-17 Thread Antti Palosaari

On 03/05/2015 10:54 AM, Mauro Carvalho Chehab wrote:

Em Mon, 02 Feb 2015 12:22:32 +0300
Kozlov Sergey se...@netup.ru escreveu:



diff --git a/MAINTAINERS b/MAINTAINERS
index ddb9ac8..a3a1767 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4365,6 +4365,15 @@ W:   http://linuxtv.org
  S:Odd Fixes
  F:drivers/media/usb/hdpvr/

+HORUS3A MEDIA DRIVER


Not a big issue, but could you please rename it to:
MEDIA DRIVERS FOR HORUS3A

We're trying to better organize the media entries at MAINTAINERS, at
least for the new drivers.


What the *ell is that new rule? MAINTAINERS file clearly says entries 
should be alphabetical order, but on the other-hand there seems to be 
PCI and ARM specific stuff already grouped. Is that some new way?


regards
Antti

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


Re: cx23885: DVBSky S952 dvb_register failed err = -22

2015-03-17 Thread Ole Ernst
Hi Max,

I get a chip_id of 0x81, which returns -ENODEV in the default branch of
the subsequent switch. So I guess my S952 is too old? :-( How hard would
it be to add support for it?

Thanks,
Ole

Am 17.03.2015 um 02:53 schrieb Nibble Max:
 Hello,
 
 what is the chip_id debug output from m88ts2022 module?
 
 I think you maybe hold the old S952 card.
 Its satellite tuner is M88TS2020, not M88TS2022.
 
 Best Regards,
 Max
 On 2015-03-15 19:07:07, Ole Ernst olebo...@gmx.com wrote:
 Hi Antti,

 thanks for your quick response! Based on lsmod and modinfo I do have
 m88ts2022.

 $ lsmod | grep m88
 m88ts2022  16898  0
 regmap_i2c 12783  1 m88ts2022
 m88ds3103  21452  0
 i2c_mux12534  1 m88ds3103
 dvb_core  102038  4 cx23885,altera_ci,m88ds3103,videobuf2_dvb
 i2c_core   50240  13
 drm,i2c_i801,cx23885,cx25840,m88ts2022,i2c_mux,regmap_i2c,nvidia,v4l2_common,tveeprom,m88ds3103,tda18271,videodev

 $ modinfo m88ts2022
 filename:
 /lib/modules/3.19.1-1-ARCH/kernel/drivers/media/tuners/m88ts2022.ko.gz
 license:GPL
 author: Antti Palosaari cr...@iki.fi
 description:Montage M88TS2022 silicon tuner driver
 alias:  i2c:m88ts2022
 depends:i2c-core,regmap-i2c
 intree: Y
 vermagic:   3.19.1-1-ARCH SMP preempt mod_unload modversions

 Thanks,
 Ole

 Am 15.03.2015 um 11:49 schrieb Antti Palosaari:
 You don't have m88ts2022 driver installed.

 Antti

 On 03/15/2015 12:26 PM, Ole Ernst wrote:
 Hi,

 I added some printk in cx23885-dvb.c and the problem is in
 i2c_new_device:
 https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/media/pci/cx23885/cx23885-dvb.c?id=refs/tags/v3.19.1#n1935


 The returned client_tuner is not NULL, but client_tuner-dev.driver is.
 Hence it will goto frontend_detach, which will then return -EINVAL. Any
 idea why client_tuner-dev.driver is NULL?

 Thanks,
 Ole

 Am 14.03.2015 um 20:54 schrieb Ole Ernst:
 Hi,

 using linux-3.19.1-1 (Archlinux) I get the following output while
 booting without the media-build-tree provided by DVBSky:

 cx23885 driver version 0.0.4 loaded
 cx23885 :04:00.0: enabling device ( - 0002)
 CORE cx23885[0]: subsystem: 4254:0952, board: DVBSky S952
 [card=50,autodetected]
 cx25840 3-0044: cx23885 A/V decoder found @ 0x88 (cx23885[0])
 cx25840 3-0044: loaded v4l-cx23885-avcore-01.fw firmware (16382 bytes)
 cx23885_dvb_register() allocating 1 frontend(s)
 cx23885[0]: cx23885 based dvb card
 i2c i2c-2: m88ds3103_attach: chip_id=70
 i2c i2c-2: Added multiplexed i2c bus 4
 cx23885_dvb_register() dvb_register failed err = -22
 cx23885_dev_setup() Failed to register dvb adapters on VID_B
 cx23885_dvb_register() allocating 1 frontend(s)
 cx23885[0]: cx23885 based dvb card
 i2c i2c-1: m88ds3103_attach: chip_id=70
 i2c i2c-1: Added multiplexed i2c bus 4
 cx23885_dvb_register() dvb_register failed err = -22
 cx23885_dev_setup() Failed to register dvb on VID_C
 cx23885_dev_checkrevision() Hardware revision = 0xa5
 cx23885[0]/0: found at :04:00.0, rev: 4, irq: 17, latency: 0, mmio:
 0xf720

 Obviously there are no device in /dev/dvb. Using the media-build-tree
 works just fine though. The following firmware files are installed in
 /usr/lib/firmware:
 dvb-demod-m88ds3103.fw
 dvb-demod-m88rs6000.fw
 dvb-demod-si2168-a20-01.fw
 dvb-demod-si2168-a30-01.fw
 dvb-demod-si2168-b40-01.fw
 dvb-fe-ds300x.fw
 dvb-fe-ds3103.fw
 dvb-fe-rs6000.fw
 dvb-tuner-si2158-a20-01.fw

 Output of lspci -vvvnn:
 https://gist.githubusercontent.com/olebowle/6a4108363a9d1f7dd033/raw/lscpi


 I also set the module parameters debug, i2c_debug, irq_debug and
 irq_debug in cx23885.
 The output is pretty verbose and can be found here:
 https://gist.githubusercontent.com/olebowle/6a4108363a9d1f7dd033/raw/debug.log


 Thanks,
 Ole
 -- 
 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 2/9] mm: Provide new get_vaddr_pfns() helper

2015-03-17 Thread Jan Kara
Provide new function get_vaddr_pfns().  This function maps virtual
addresses from given start and fills given array with page frame numbers of
the corresponding pages. If given start belongs to a normal vma, the function
grabs reference to each of the pages to pin them in memory. If start
belongs to VM_IO | VM_PFNMAP vma, we don't touch page structures. Caller
should make sure pfns aren't reused for anything else while he is using
them.

This function is created for various drivers to simplify handling of
their buffers.

Signed-off-by: Jan Kara j...@suse.cz
---
 include/linux/mm.h |  38 +++
 mm/gup.c   | 180 +
 2 files changed, 218 insertions(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 47a93928b90f..a5045df92454 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1279,6 +1279,44 @@ long get_user_pages_unlocked(struct task_struct *tsk, 
struct mm_struct *mm,
int write, int force, struct page **pages);
 int get_user_pages_fast(unsigned long start, int nr_pages, int write,
struct page **pages);
+
+/* Container for pinned pfns / pages */
+struct pinned_pfns {
+   unsigned int nr_allocated_pfns; /* Number of pfns we have space for */
+   unsigned int nr_pfns;   /* Number of pfns stored in pfns array 
*/
+   unsigned int got_ref:1; /* Did we pin pfns by getting page ref? 
*/
+   unsigned int is_pages:1;/* Does array contain pages or pfns? */
+   void *ptrs[0];  /* Array of pinned pfns / pages.
+* Use pfns_vector_pages() or
+* pfns_vector_pfns() for access */
+};
+
+struct pinned_pfns *pfns_vector_create(int nr_pfns);
+void pfns_vector_destroy(struct pinned_pfns *pfns);
+int get_vaddr_pfns(unsigned long start, int nr_pfns, int write, int force,
+  struct pinned_pfns *pfns);
+void put_vaddr_pfns(struct pinned_pfns *pfns);
+int pfns_vector_to_pages(struct pinned_pfns *pfns);
+
+static inline int pfns_vector_count(struct pinned_pfns *pfns)
+{
+   return pfns-nr_pfns;
+}
+
+static inline struct page **pfns_vector_pages(struct pinned_pfns *pfns)
+{
+   if (!pfns-is_pages)
+   return NULL;
+   return (struct page **)(pfns-ptrs);
+}
+
+static inline unsigned long *pfns_vector_pfns(struct pinned_pfns *pfns)
+{
+   if (pfns-is_pages)
+   return NULL;
+   return (unsigned long *)(pfns-ptrs);
+}
+
 struct kvec;
 int get_kernel_pages(const struct kvec *iov, int nr_pages, int write,
struct page **pages);
diff --git a/mm/gup.c b/mm/gup.c
index a6e24e246f86..63903913ab04 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -819,6 +819,186 @@ long get_user_pages(struct task_struct *tsk, struct 
mm_struct *mm,
 EXPORT_SYMBOL(get_user_pages);
 
 /**
+ * get_vaddr_pfns() - map virtual addresses to pfns
+ * @start: starting user address
+ * @nr_pfns:   number of pfns from start to map
+ * @write: whether pages will be written to by the caller
+ * @force: whether to force write access even if user mapping is
+ * readonly. This will result in the page being COWed even
+ * in MAP_SHARED mappings. You do not want this.
+ * @pfns:  structure which receives pfns of the pages mapped.
+ * It should have space for at least nr_pfns pfns.
+ *
+ * This function maps virtual addresses from @start and fills @pfns structure
+ * with page frame numbers of corresponding pages. If @start belongs to a
+ * normal vma, the function grabs reference to each of the pages to pin them in
+ * memory. If @start belongs to VM_IO | VM_PFNMAP vma, we don't touch page
+ * structures. Caller should make sure pfns aren't reused for anything else
+ * while he is using them.
+ *
+ * This function takes care of grabbing mmap_sem as necessary.
+ */
+int get_vaddr_pfns(unsigned long start, int nr_pfns, int write, int force,
+  struct pinned_pfns *pfns)
+{
+   struct mm_struct *mm = current-mm;
+   struct vm_area_struct *vma;
+   int ret = 0;
+   int err;
+
+   if (nr_pfns = 0)
+   return 0;
+
+   if (nr_pfns  pfns-nr_allocated_pfns)
+   nr_pfns = pfns-nr_allocated_pfns;
+
+   down_read(mm-mmap_sem);
+   vma = find_vma_intersection(mm, start, start + 1);
+   if (!vma) {
+   ret = -EFAULT;
+   goto out;
+   }
+   if (!(vma-vm_flags  (VM_IO | VM_PFNMAP))) {
+   pfns-got_ref = 1;
+   pfns-is_pages = 1;
+   ret = get_user_pages(current, mm, start, nr_pfns, write, force,
+pfns_vector_pages(pfns), NULL);
+   goto out;
+   }
+
+   pfns-got_ref = 0;
+   pfns-is_pages = 0;
+   do {
+   unsigned long *nums = pfns_vector_pfns(pfns);
+
+   while (ret  nr_pfns  

[PATCH 0/9 v2] Helper to abstract vma handling in media layer

2015-03-17 Thread Jan Kara
  Hello,

  After a long pause I'm sending second version of my patch series to abstract
vma handling from the various media drivers. After this patch set drivers have
to know much less details about vmas, their types, and locking. My motivation
for the series is that I want to change get_user_pages() locking and I want to
handle subtle locking details in as few places as possible.

The core of the series is the new helper get_vaddr_pfns() which is given a
virtual address and it fills in PFNs into provided array. If PFNs correspond to
normal pages it also grabs references to these pages. The difference from
get_user_pages() is that this function can also deal with pfnmap, mixed, and io
mappings which is what the media drivers need.

I have tested the patches with vivid driver so at least vb2 code got some
exposure. Conversion of other drivers was just compile-tested so I'd like to
ask respective maintainers if they could have a look.  Also I'd like to ask mm
folks to check patch 2/9 implementing the helper. Thanks!

Honza
--
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 8/9] media: vb2: Remove unused functions

2015-03-17 Thread Jan Kara
Conversion to the use of pinned pfns made some functions unused. Remove
them. Also there's no need to lock mmap_sem in __buf_prepare() anymore.

Signed-off-by: Jan Kara j...@suse.cz
---
 drivers/media/v4l2-core/videobuf2-memops.c | 114 -
 include/media/videobuf2-memops.h   |   6 --
 2 files changed, 120 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-memops.c 
b/drivers/media/v4l2-core/videobuf2-memops.c
index 80ade22b920c..08daaa5c4e2d 100644
--- a/drivers/media/v4l2-core/videobuf2-memops.c
+++ b/drivers/media/v4l2-core/videobuf2-memops.c
@@ -23,120 +23,6 @@
 #include media/videobuf2-memops.h
 
 /**
- * vb2_get_vma() - acquire and lock the virtual memory area
- * @vma:   given virtual memory area
- *
- * This function attempts to acquire an area mapped in the userspace for
- * the duration of a hardware operation. The area is locked by performing
- * the same set of operation that are done when process calls fork() and
- * memory areas are duplicated.
- *
- * Returns a copy of a virtual memory region on success or NULL.
- */
-struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
-{
-   struct vm_area_struct *vma_copy;
-
-   vma_copy = kmalloc(sizeof(*vma_copy), GFP_KERNEL);
-   if (vma_copy == NULL)
-   return NULL;
-
-   if (vma-vm_ops  vma-vm_ops-open)
-   vma-vm_ops-open(vma);
-
-   if (vma-vm_file)
-   get_file(vma-vm_file);
-
-   memcpy(vma_copy, vma, sizeof(*vma));
-
-   vma_copy-vm_mm = NULL;
-   vma_copy-vm_next = NULL;
-   vma_copy-vm_prev = NULL;
-
-   return vma_copy;
-}
-EXPORT_SYMBOL_GPL(vb2_get_vma);
-
-/**
- * vb2_put_userptr() - release a userspace virtual memory area
- * @vma:   virtual memory region associated with the area to be released
- *
- * This function releases the previously acquired memory area after a hardware
- * operation.
- */
-void vb2_put_vma(struct vm_area_struct *vma)
-{
-   if (!vma)
-   return;
-
-   if (vma-vm_ops  vma-vm_ops-close)
-   vma-vm_ops-close(vma);
-
-   if (vma-vm_file)
-   fput(vma-vm_file);
-
-   kfree(vma);
-}
-EXPORT_SYMBOL_GPL(vb2_put_vma);
-
-/**
- * vb2_get_contig_userptr() - lock physically contiguous userspace mapped 
memory
- * @vaddr: starting virtual address of the area to be verified
- * @size:  size of the area
- * @res_paddr: will return physical address for the given vaddr
- * @res_vma:   will return locked copy of struct vm_area for the given area
- *
- * This function will go through memory area of size @size mapped at @vaddr and
- * verify that the underlying physical pages are contiguous. If they are
- * contiguous the virtual memory area is locked and a @res_vma is filled with
- * the copy and @res_pa set to the physical address of the buffer.
- *
- * Returns 0 on success.
- */
-int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
-  struct vm_area_struct **res_vma, dma_addr_t *res_pa)
-{
-   struct mm_struct *mm = current-mm;
-   struct vm_area_struct *vma;
-   unsigned long offset, start, end;
-   unsigned long this_pfn, prev_pfn;
-   dma_addr_t pa = 0;
-
-   start = vaddr;
-   offset = start  ~PAGE_MASK;
-   end = start + size;
-
-   vma = find_vma(mm, start);
-
-   if (vma == NULL || vma-vm_end  end)
-   return -EFAULT;
-
-   for (prev_pfn = 0; start  end; start += PAGE_SIZE) {
-   int ret = follow_pfn(vma, start, this_pfn);
-   if (ret)
-   return ret;
-
-   if (prev_pfn == 0)
-   pa = this_pfn  PAGE_SHIFT;
-   else if (this_pfn != prev_pfn + 1)
-   return -EFAULT;
-
-   prev_pfn = this_pfn;
-   }
-
-   /*
-* Memory is contigous, lock vma and return to the caller
-*/
-   *res_vma = vb2_get_vma(vma);
-   if (*res_vma == NULL)
-   return -ENOMEM;
-
-   *res_pa = pa + offset;
-   return 0;
-}
-EXPORT_SYMBOL_GPL(vb2_get_contig_userptr);
-
-/**
  * vb2_create_pfnvec() - map virtual addresses to pfns
  * @start: Virtual user address where we start mapping
  * @length:Length of a range to map
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index 868f9c1cd92d..01b4325947f1 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -31,12 +31,6 @@ struct vb2_vmarea_handler {
 
 extern const struct vm_operations_struct vb2_common_vm_ops;
 
-int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
-  struct vm_area_struct **res_vma, dma_addr_t *res_pa);
-
-struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
-void vb2_put_vma(struct vm_area_struct *vma);
-
 struct pinned_pfns *vb2_create_pfnvec(unsigned long start, unsigned long 
length,
 

[PATCH 7/9] media: vb2: Convert vb2_dc_get_userptr() to use pfns vector

2015-03-17 Thread Jan Kara
Convert vb2_dc_get_userptr() to use passed vector of pfns. When we are
doing that there's no need to allocate page array and some code can be
simplified.

Signed-off-by: Jan Kara j...@suse.cz
---
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 213 -
 1 file changed, 32 insertions(+), 181 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c 
b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index 96eceabb307b..d3cefc5c98bc 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -32,15 +32,13 @@ struct vb2_dc_buf {
dma_addr_t  dma_addr;
enum dma_data_direction dma_dir;
struct sg_table *dma_sgt;
+   struct pinned_pfns  *pfns;
 
/* MMAP related */
struct vb2_vmarea_handler   handler;
atomic_trefcount;
struct sg_table *sgt_base;
 
-   /* USERPTR related */
-   struct vm_area_struct   *vma;
-
/* DMABUF related */
struct dma_buf_attachment   *db_attach;
 };
@@ -49,24 +47,6 @@ struct vb2_dc_buf {
 /*scatterlist table functions*/
 /*/
 
-
-static void vb2_dc_sgt_foreach_page(struct sg_table *sgt,
-   void (*cb)(struct page *pg))
-{
-   struct scatterlist *s;
-   unsigned int i;
-
-   for_each_sg(sgt-sgl, s, sgt-orig_nents, i) {
-   struct page *page = sg_page(s);
-   unsigned int n_pages = PAGE_ALIGN(s-offset + s-length)
-PAGE_SHIFT;
-   unsigned int j;
-
-   for (j = 0; j  n_pages; ++j, ++page)
-   cb(page);
-   }
-}
-
 static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
 {
struct scatterlist *s;
@@ -423,92 +403,12 @@ static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, 
unsigned long flags)
 /*   callbacks for USERPTR buffers   */
 /*/
 
-static inline int vma_is_io(struct vm_area_struct *vma)
-{
-   return !!(vma-vm_flags  (VM_IO | VM_PFNMAP));
-}
-
-static int vb2_dc_get_user_pfn(unsigned long start, int n_pages,
-   struct vm_area_struct *vma, unsigned long *res)
-{
-   unsigned long pfn, start_pfn, prev_pfn;
-   unsigned int i;
-   int ret;
-
-   if (!vma_is_io(vma))
-   return -EFAULT;
-
-   ret = follow_pfn(vma, start, pfn);
-   if (ret)
-   return ret;
-
-   start_pfn = pfn;
-   start += PAGE_SIZE;
-
-   for (i = 1; i  n_pages; ++i, start += PAGE_SIZE) {
-   prev_pfn = pfn;
-   ret = follow_pfn(vma, start, pfn);
-
-   if (ret) {
-   pr_err(no page for address %lu\n, start);
-   return ret;
-   }
-   if (pfn != prev_pfn + 1)
-   return -EINVAL;
-   }
-
-   *res = start_pfn;
-   return 0;
-}
-
-static int vb2_dc_get_user_pages(unsigned long start, struct page **pages,
-   int n_pages, struct vm_area_struct *vma,
-   enum dma_data_direction dma_dir)
-{
-   if (vma_is_io(vma)) {
-   unsigned int i;
-
-   for (i = 0; i  n_pages; ++i, start += PAGE_SIZE) {
-   unsigned long pfn;
-   int ret = follow_pfn(vma, start, pfn);
-
-   if (!pfn_valid(pfn))
-   return -EINVAL;
-
-   if (ret) {
-   pr_err(no page for address %lu\n, start);
-   return ret;
-   }
-   pages[i] = pfn_to_page(pfn);
-   }
-   } else {
-   int n;
-
-   n = get_user_pages(current, current-mm, start  PAGE_MASK,
-   n_pages, dma_dir == DMA_FROM_DEVICE, 1, pages, NULL);
-   /* negative error means that no page was pinned */
-   n = max(n, 0);
-   if (n != n_pages) {
-   pr_err(got only %d of %d user pages\n, n, n_pages);
-   while (n)
-   put_page(pages[--n]);
-   return -EFAULT;
-   }
-   }
-
-   return 0;
-}
-
-static void vb2_dc_put_dirty_page(struct page *page)
-{
-   set_page_dirty_lock(page);
-   put_page(page);
-}
-
 static void vb2_dc_put_userptr(void *buf_priv)
 {
struct vb2_dc_buf *buf = buf_priv;
struct sg_table *sgt = buf-dma_sgt;
+   int i;
+   struct page **pages;
 
if (sgt) {
DEFINE_DMA_ATTRS(attrs);
@@ -520,15 +420,13 @@ static void vb2_dc_put_userptr(void *buf_priv)
 */
dma_unmap_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents,
   buf-dma_dir, 

[PATCH 3/9] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()

2015-03-17 Thread Jan Kara
Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns() instead of
hand made mapping of virtual address to physical address. Also the
function leaked page reference from get_user_pages() so fix that by
properly release the reference when omap_vout_buffer_release() is
called.

Signed-off-by: Jan Kara j...@suse.cz
---
 drivers/media/platform/omap/omap_vout.c | 67 +++--
 1 file changed, 31 insertions(+), 36 deletions(-)

diff --git a/drivers/media/platform/omap/omap_vout.c 
b/drivers/media/platform/omap/omap_vout.c
index ba2d8f973d58..e7d342bb71dd 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -195,46 +195,34 @@ static int omap_vout_try_format(struct v4l2_pix_format 
*pix)
 }
 
 /*
- * omap_vout_uservirt_to_phys: This inline function is used to convert user
- * space virtual address to physical address.
+ * omap_vout_get_userptr: Convert user space virtual address to physical
+ * address.
  */
-static unsigned long omap_vout_uservirt_to_phys(unsigned long virtp)
+static int omap_vout_get_userptr(struct videobuf_buffer *vb, u32 virtp,
+u32 *physp)
 {
-   unsigned long physp = 0;
-   struct vm_area_struct *vma;
-   struct mm_struct *mm = current-mm;
+   struct pinned_pfns *pfns;
+   int ret;
 
/* For kernel direct-mapped memory, take the easy way */
-   if (virtp = PAGE_OFFSET)
-   return virt_to_phys((void *) virtp);
-
-   down_read(current-mm-mmap_sem);
-   vma = find_vma(mm, virtp);
-   if (vma  (vma-vm_flags  VM_IO)  vma-vm_pgoff) {
-   /* this will catch, kernel-allocated, mmaped-to-usermode
-  addresses */
-   physp = (vma-vm_pgoff  PAGE_SHIFT) + (virtp - vma-vm_start);
-   up_read(current-mm-mmap_sem);
-   } else {
-   /* otherwise, use get_user_pages() for general userland pages */
-   int res, nr_pages = 1;
-   struct page *pages;
+   if (virtp = PAGE_OFFSET) {
+   *physp = virt_to_phys((void *)virtp);
+   return 0;
+   }
 
-   res = get_user_pages(current, current-mm, virtp, nr_pages, 1,
-   0, pages, NULL);
-   up_read(current-mm-mmap_sem);
+   pfns = pfns_vector_create(1);
+   if (!pfns)
+   return -ENOMEM;
 
-   if (res == nr_pages) {
-   physp =  __pa(page_address(pages[0]) +
-   (virtp  ~PAGE_MASK));
-   } else {
-   printk(KERN_WARNING VOUT_NAME
-   get_user_pages failed\n);
-   return 0;
-   }
+   ret = get_vaddr_pfns(virtp, 1, 1, 0, pfns);
+   if (ret != 1) {
+   pfns_vector_destroy(pfns);
+   return -EINVAL;
}
+   *physp = __pfn_to_phys(pfns_vector_pfns(pfns)[0]);
+   vb-priv = pfns;
 
-   return physp;
+   return 0;
 }
 
 /*
@@ -788,11 +776,15 @@ static int omap_vout_buffer_prepare(struct videobuf_queue 
*q,
 * address of the buffer
 */
if (V4L2_MEMORY_USERPTR == vb-memory) {
+   int ret;
+
if (0 == vb-baddr)
return -EINVAL;
/* Physical address */
-   vout-queued_buf_addr[vb-i] = (u8 *)
-   omap_vout_uservirt_to_phys(vb-baddr);
+   ret = omap_vout_get_userptr(vb, vb-baddr,
+   (u32 *)vout-queued_buf_addr[vb-i]);
+   if (ret  0)
+   return ret;
} else {
unsigned long addr, dma_addr;
unsigned long size;
@@ -841,9 +833,12 @@ static void omap_vout_buffer_release(struct videobuf_queue 
*q,
struct omap_vout_device *vout = q-priv_data;
 
vb-state = VIDEOBUF_NEEDS_INIT;
+   if (vb-memory == V4L2_MEMORY_USERPTR  vb-priv) {
+   struct pinned_pfns *pfns = vb-priv;
 
-   if (V4L2_MEMORY_MMAP != vout-memory)
-   return;
+   put_vaddr_pfns(pfns);
+   pfns_vector_destroy(pfns);
+   }
 }
 
 /*
-- 
2.1.4

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


[PATCH 6/9] media: vb2: Convert vb2_vmalloc_get_userptr() to use pfns vector

2015-03-17 Thread Jan Kara
Convert vb2_vmalloc_get_userptr() to use passed vector of pfns. When we
are doing that there's no need to allocate page array and some code can
be simplified.

Signed-off-by: Jan Kara j...@suse.cz
---
 drivers/media/v4l2-core/videobuf2-vmalloc.c | 94 +++--
 1 file changed, 36 insertions(+), 58 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c 
b/drivers/media/v4l2-core/videobuf2-vmalloc.c
index c060cf9662fa..eb1d9971c54e 100644
--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
@@ -23,11 +23,9 @@
 
 struct vb2_vmalloc_buf {
void*vaddr;
-   struct page **pages;
-   struct vm_area_struct   *vma;
+   struct pinned_pfns  *pfns;
enum dma_data_direction dma_dir;
unsigned long   size;
-   unsigned intn_pages;
atomic_trefcount;
struct vb2_vmarea_handler   handler;
struct dma_buf  *dbuf;
@@ -76,10 +74,8 @@ static void *vb2_vmalloc_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
 enum dma_data_direction dma_dir)
 {
struct vb2_vmalloc_buf *buf;
-   unsigned long first, last;
-   int n_pages, offset;
-   struct vm_area_struct *vma;
-   dma_addr_t physp;
+   struct pinned_pfns *pfns;
+   int n_pages, offset, i;
 
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
if (!buf)
@@ -88,53 +84,36 @@ static void *vb2_vmalloc_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
buf-dma_dir = dma_dir;
offset = vaddr  ~PAGE_MASK;
buf-size = size;
-
-   down_read(current-mm-mmap_sem);
-   vma = find_vma(current-mm, vaddr);
-   if (vma  (vma-vm_flags  VM_PFNMAP)  (vma-vm_pgoff)) {
-   if (vb2_get_contig_userptr(vaddr, size, vma, physp))
-   goto fail_pages_array_alloc;
-   buf-vma = vma;
-   buf-vaddr = (__force void *)ioremap_nocache(physp, size);
-   if (!buf-vaddr)
-   goto fail_pages_array_alloc;
+   pfns = vb2_create_pfnvec(vaddr, size, dma_dir == DMA_FROM_DEVICE);
+   if (IS_ERR(pfns))
+   goto fail_pfnvec_create;
+   buf-pfns = pfns;
+   n_pages = pfns_vector_count(pfns);
+   if (pfns_vector_to_pages(pfns)  0) {
+   unsigned long *nums = pfns_vector_pfns(pfns);
+
+   /*
+* We cannot get page pointers for these pfns. Check memory is
+* physically contiguous and use direct mapping.
+*/
+   for (i = 1; i  n_pages; i++)
+   if (nums[i-1] + 1 != nums[i])
+   goto fail_map;
+   buf-vaddr = (__force void *)
+   ioremap_nocache(nums[0]  PAGE_SHIFT, size);
} else {
-   first = vaddr  PAGE_SHIFT;
-   last  = (vaddr + size - 1)  PAGE_SHIFT;
-   buf-n_pages = last - first + 1;
-   buf-pages = kzalloc(buf-n_pages * sizeof(struct page *),
-GFP_KERNEL);
-   if (!buf-pages)
-   goto fail_pages_array_alloc;
-
-   /* current-mm-mmap_sem is taken by videobuf2 core */
-   n_pages = get_user_pages(current, current-mm,
-vaddr  PAGE_MASK, buf-n_pages,
-dma_dir == DMA_FROM_DEVICE,
-1, /* force */
-buf-pages, NULL);
-   if (n_pages != buf-n_pages)
-   goto fail_get_user_pages;
-
-   buf-vaddr = vm_map_ram(buf-pages, buf-n_pages, -1,
+   buf-vaddr = vm_map_ram(pfns_vector_pages(pfns), n_pages, -1,
PAGE_KERNEL);
-   if (!buf-vaddr)
-   goto fail_get_user_pages;
}
-   up_read(current-mm-mmap_sem);
 
+   if (!buf-vaddr)
+   goto fail_map;
buf-vaddr += offset;
return buf;
 
-fail_get_user_pages:
-   pr_debug(get_user_pages requested/got: %d/%d]\n, n_pages,
-buf-n_pages);
-   while (--n_pages = 0)
-   put_page(buf-pages[n_pages]);
-   kfree(buf-pages);
-
-fail_pages_array_alloc:
-   up_read(current-mm-mmap_sem);
+fail_map:
+   vb2_destroy_pfnvec(pfns);
+fail_pfnvec_create:
kfree(buf);
 
return NULL;
@@ -145,22 +124,21 @@ static void vb2_vmalloc_put_userptr(void *buf_priv)
struct vb2_vmalloc_buf *buf = buf_priv;
unsigned long vaddr = (unsigned long)buf-vaddr  PAGE_MASK;
unsigned int i;
+   struct page **pages;
+   unsigned int n_pages;
 
-   down_read(current-mm-mmap_sem);
-   if 

[PATCH 4/9] vb2: Provide helpers for mapping virtual addresses

2015-03-17 Thread Jan Kara
Provide simple helper functions to map virtual address range into an
array of pfns.

Signed-off-by: Jan Kara j...@suse.cz
---
 drivers/media/v4l2-core/videobuf2-memops.c | 57 ++
 include/media/videobuf2-memops.h   |  4 +++
 2 files changed, 61 insertions(+)

diff --git a/drivers/media/v4l2-core/videobuf2-memops.c 
b/drivers/media/v4l2-core/videobuf2-memops.c
index 81c1ad8b2cf1..80ade22b920c 100644
--- a/drivers/media/v4l2-core/videobuf2-memops.c
+++ b/drivers/media/v4l2-core/videobuf2-memops.c
@@ -137,6 +137,63 @@ int vb2_get_contig_userptr(unsigned long vaddr, unsigned 
long size,
 EXPORT_SYMBOL_GPL(vb2_get_contig_userptr);
 
 /**
+ * vb2_create_pfnvec() - map virtual addresses to pfns
+ * @start: Virtual user address where we start mapping
+ * @length:Length of a range to map
+ * @write: Should we map for writing into the area
+ *
+ * This function allocates and fills in a vector with pfns corresponding to
+ * virtual address range passed in arguments. If pfns have corresponding pages,
+ * page references are also grabbed to pin pages in memory. The function
+ * returns pointer to the vector on success and error pointer in case of
+ * failure. Returned vector needs to be freed via vb2_destroy_pfnvec().
+ */
+struct pinned_pfns *vb2_create_pfnvec(unsigned long start, unsigned long 
length,
+ bool write)
+{
+   int ret;
+   unsigned long first, last;
+   unsigned long nr;
+   struct pinned_pfns *pfns;
+
+   first = start  PAGE_SHIFT;
+   last = (start + length - 1)  PAGE_SHIFT;
+   nr = last - first + 1;
+   pfns = pfns_vector_create(nr);
+   if (!pfns)
+   return ERR_PTR(-ENOMEM);
+   ret = get_vaddr_pfns(start, nr, write, 1, pfns);
+   if (ret  0)
+   goto out_destroy;
+   /* We accept only complete set of PFNs */
+   if (ret != nr) {
+   ret = -EFAULT;
+   goto out_release;
+   }
+   return pfns;
+out_release:
+   put_vaddr_pfns(pfns);
+out_destroy:
+   pfns_vector_destroy(pfns);
+   return ERR_PTR(ret);
+}
+EXPORT_SYMBOL(vb2_create_pfnvec);
+
+/**
+ * vb2_destroy_pfnvec() - release vector of mapped pfns
+ * @pfns:  vector of pfns to release
+ *
+ * This releases references to all pages in the vector @pfns (if corresponding
+ * pfns are backed by pages) and frees the passed vector.
+ */
+void vb2_destroy_pfnvec(struct pinned_pfns *pfns)
+{
+   put_vaddr_pfns(pfns);
+   pfns_vector_destroy(pfns);
+}
+EXPORT_SYMBOL(vb2_destroy_pfnvec);
+
+/**
  * vb2_common_vm_open() - increase refcount of the vma
  * @vma:   virtual memory region for the mapping
  *
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index f05444ca8c0c..868f9c1cd92d 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -15,6 +15,7 @@
 #define _MEDIA_VIDEOBUF2_MEMOPS_H
 
 #include media/videobuf2-core.h
+#include linux/mm.h
 
 /**
  * vb2_vmarea_handler - common vma refcount tracking handler
@@ -36,5 +37,8 @@ int vb2_get_contig_userptr(unsigned long vaddr, unsigned long 
size,
 struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
 void vb2_put_vma(struct vm_area_struct *vma);
 
+struct pinned_pfns *vb2_create_pfnvec(unsigned long start, unsigned long 
length,
+ bool write);
+void vb2_destroy_pfnvec(struct pinned_pfns *pfns);
 
 #endif
-- 
2.1.4

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


Re: [PATCH v3 0/5] Signalling last decoded frame by V4L2_BUF_FLAG_LAST and -EPIPE

2015-03-17 Thread Hans Verkuil
On 03/17/2015 11:46 AM, Philipp Zabel wrote:
 Hi,
 
 Am Freitag, den 06.03.2015, 11:18 +0100 schrieb Philipp Zabel:
 At the V4L2 codec API session during ELC-E 2014, we agreed that for the 
 decoder
 draining flow, after a V4L2_DEC_CMD_STOP decoder command was issued, the last
 decoded buffer should get dequeued with a V4L2_BUF_FLAG_LAST set. After that,
 poll should immediately return and all following VIDIOC_DQBUF should return
 -EPIPE until the stream is stopped or decoding continued via 
 V4L2_DEC_CMD_START.
 (or STREAMOFF/STREAMON).

 Changes since v2:
  - Made V4L2_BUF_FLAG_LAST known to trace events

 regards
 Philipp

 Peter Seiderer (1):
   [media] videodev2: Add V4L2_BUF_FLAG_LAST

 Philipp Zabel (4):
   [media] videobuf2: return -EPIPE from DQBUF after the last buffer
   [media] coda: Set last buffer flag and fix EOS event
   [media] s5p-mfc: Set last buffer flag
   [media] DocBooc: mention mem2mem codecs for encoder/decoder commands

  Documentation/DocBook/media/v4l/io.xml | 10 
  .../DocBook/media/v4l/vidioc-decoder-cmd.xml   |  6 -
  .../DocBook/media/v4l/vidioc-encoder-cmd.xml   |  5 +++-
  Documentation/DocBook/media/v4l/vidioc-qbuf.xml|  8 +++
  drivers/media/platform/coda/coda-bit.c |  4 ++--
  drivers/media/platform/coda/coda-common.c  | 27 
 +-
  drivers/media/platform/coda/coda.h |  3 +++
  drivers/media/platform/s5p-mfc/s5p_mfc.c   |  1 +
  drivers/media/v4l2-core/v4l2-mem2mem.c | 10 +++-
  drivers/media/v4l2-core/videobuf2-core.c   | 18 ++-
  include/media/videobuf2-core.h | 10 
  include/trace/events/v4l2.h|  3 ++-
  include/uapi/linux/videodev2.h |  2 ++
  13 files changed, 84 insertions(+), 23 deletions(-)
 
 are there any further changes that I should make to this series?

I'd like to see some Acks, esp. from Kamil and Pawel.

I'll take another look as well, probably on Friday.

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 2/5] gpu: ipu-v3: Add mem2mem image conversion support to IC

2015-03-17 Thread Philipp Zabel
This patch adds support for mem2mem scaling and colorspace conversion
using the IC module's post-processing task.

Scaling images larger than 1024x1024 is supported by tiling over multiple
IC scaling runs. Since the IDMAC and IC units have interesting and different
alignment limitations for buffer base addresses (left edges) and burst size
(row lengths), depending on input and output pixel formats, the tile rectangles
and scaling coefficients are chosen to minimize distortion. Due to possible
overlap, the tiles have to be rendered right to left and bottom to top.
Up to 7 pixels (depending on frame sizes and scaling factor) have to be
available after the end of the frame if the width is not burst size aligned.
The tiling code has a parameter to optionally round frame sizes up or down
and avoid overdraw in compositing scenarios.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
Signed-off-by: Lucas Stach l.st...@pengutronix.de
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/gpu/ipu-v3/ipu-ic.c | 813 +++-
 include/video/imx-ipu-v3.h  |  34 +-
 2 files changed, 830 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c
index ad75588..39ee388 100644
--- a/drivers/gpu/ipu-v3/ipu-ic.c
+++ b/drivers/gpu/ipu-v3/ipu-ic.c
@@ -15,6 +15,7 @@
 #include linux/errno.h
 #include linux/spinlock.h
 #include linux/bitrev.h
+#include linux/interrupt.h
 #include linux/io.h
 #include linux/err.h
 #include ipu-prv.h
@@ -96,6 +97,15 @@ struct ic_task_bitfields {
u32 ic_cmb_galpha_bit;
 };
 
+struct ic_task_channels {
+   u8 in;
+   u8 out;
+   u8 rot_in;
+   u8 rot_out;
+   u8 in_prev;
+   u8 in_next;
+};
+
 static const struct ic_task_regoffs ic_task_reg[IC_NUM_TASKS] = {
[IC_TASK_ENCODER] = {
.rsc = IC_PRP_ENC_RSC,
@@ -138,12 +148,53 @@ static const struct ic_task_bitfields 
ic_task_bit[IC_NUM_TASKS] = {
},
 };
 
+static const struct ic_task_channels ic_task_ch[IC_NUM_TASKS] = {
+   [IC_TASK_ENCODER] = {
+   .in = IPUV3_CHANNEL_MEM_IC_PRP_VF,
+   .out = IPUV3_CHANNEL_IC_PRP_ENC_MEM,
+   .rot_in = IPUV3_CHANNEL_MEM_ROT_ENC,
+   .rot_out = IPUV3_CHANNEL_ROT_ENC_MEM,
+   },
+   [IC_TASK_VIEWFINDER] = {
+   .in = IPUV3_CHANNEL_MEM_VDI_CUR,
+   .out = IPUV3_CHANNEL_IC_PRP_VF_MEM,
+   .rot_in = IPUV3_CHANNEL_MEM_ROT_VF,
+   .rot_out = IPUV3_CHANNEL_ROT_VF_MEM,
+   .in_prev = IPUV3_CHANNEL_MEM_VDI_PREV,
+   .in_next = IPUV3_CHANNEL_MEM_VDI_NEXT,
+   },
+   [IC_TASK_POST_PROCESSOR] = {
+   .in = IPUV3_CHANNEL_MEM_IC_PP,
+   .out = IPUV3_CHANNEL_IC_PP_MEM,
+   .rot_in = IPUV3_CHANNEL_MEM_ROT_PP,
+   .rot_out = IPUV3_CHANNEL_ROT_PP_MEM,
+   },
+};
+
+struct image_convert_ctx {
+   void (*complete)(void *ctx, int err);
+   void *complete_context;
+
+   struct list_head list;
+   struct ipu_image in;
+   struct ipu_image in_n;
+   struct ipu_image in_p;
+   struct ipu_image out;
+
+   void *freep;
+
+   bool rotate:1;
+
+   u32 rsc;
+};
+
 struct ipu_ic_priv;
 
 struct ipu_ic {
enum ipu_ic_task task;
const struct ic_task_regoffs *reg;
const struct ic_task_bitfields *bit;
+   const struct ic_task_channels *ch;
 
enum ipu_color_space in_cs, g_in_cs;
enum ipu_color_space out_cs;
@@ -152,6 +203,19 @@ struct ipu_ic {
bool in_use;
 
struct ipu_ic_priv *priv;
+
+   struct ipuv3_channel *input_channel_p;
+   struct ipuv3_channel *input_channel;
+   struct ipuv3_channel *input_channel_n;
+   struct ipuv3_channel *output_channel;
+   struct ipuv3_channel *rotation_input_channel;
+   struct ipuv3_channel *rotation_output_channel;
+
+   struct list_head image_list;
+
+   struct workqueue_struct *workqueue;
+   struct work_struct work;
+   struct completion complete;
 };
 
 struct ipu_ic_priv {
@@ -168,7 +232,8 @@ static inline u32 ipu_ic_read(struct ipu_ic *ic, unsigned 
offset)
return readl(ic-priv-base + offset);
 }
 
-static inline void ipu_ic_write(struct ipu_ic *ic, u32 value, unsigned offset)
+static inline void ipu_ic_write(struct ipu_ic *ic, u32 value,
+   unsigned offset)
 {
writel(value, ic-priv-base + offset);
 }
@@ -446,32 +511,35 @@ int ipu_ic_task_init(struct ipu_ic *ic,
 int in_width, int in_height,
 int out_width, int out_height,
 enum ipu_color_space in_cs,
-enum ipu_color_space out_cs)
+enum ipu_color_space out_cs,
+u32 rsc)
 {
struct ipu_ic_priv *priv = ic-priv;
-   u32 reg, downsize_coeff, resize_coeff;
+   u32 downsize_coeff, resize_coeff;
unsigned long 

[PATCH 4/5] [media] imx-ipu: Add ipu media common code

2015-03-17 Thread Philipp Zabel
From: Sascha Hauer s.ha...@pengutronix.de

Add video4linux API routines common to drivers for units that
accept or provide video data via the i.MX IPU IDMAC channels,
such as scaler or deinterlacer drivers.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
Signed-off-by: Lucas Stach l.st...@pengutronix.de
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/Kconfig   |   2 +
 drivers/media/platform/Makefile  |   1 +
 drivers/media/platform/imx/Kconfig   |   2 +
 drivers/media/platform/imx/Makefile  |   1 +
 drivers/media/platform/imx/imx-ipu.c | 313 +++
 drivers/media/platform/imx/imx-ipu.h |  35 
 6 files changed, 354 insertions(+)
 create mode 100644 drivers/media/platform/imx/Kconfig
 create mode 100644 drivers/media/platform/imx/Makefile
 create mode 100644 drivers/media/platform/imx/imx-ipu.c
 create mode 100644 drivers/media/platform/imx/imx-ipu.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index d9b872b..650a9a6 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -29,6 +29,8 @@ config VIDEO_VIA_CAMERA
 
 source drivers/media/platform/davinci/Kconfig
 
+source drivers/media/platform/imx/Kconfig
+
 source drivers/media/platform/omap/Kconfig
 
 source drivers/media/platform/blackfin/Kconfig
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 3ec1547..2e35581 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_SOC_CAMERA)  += soc_camera/
 
 obj-$(CONFIG_VIDEO_RENESAS_VSP1)   += vsp1/
 
+obj-y  += imx/
 obj-y  += omap/
 
 obj-$(CONFIG_VIDEO_AM437X_VPFE)+= am437x/
diff --git a/drivers/media/platform/imx/Kconfig 
b/drivers/media/platform/imx/Kconfig
new file mode 100644
index 000..a90c973
--- /dev/null
+++ b/drivers/media/platform/imx/Kconfig
@@ -0,0 +1,2 @@
+config VIDEO_IMX_IPU_COMMON
+   tristate
diff --git a/drivers/media/platform/imx/Makefile 
b/drivers/media/platform/imx/Makefile
new file mode 100644
index 000..5de119c
--- /dev/null
+++ b/drivers/media/platform/imx/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_VIDEO_IMX_IPU_COMMON) += imx-ipu.o
diff --git a/drivers/media/platform/imx/imx-ipu.c 
b/drivers/media/platform/imx/imx-ipu.c
new file mode 100644
index 000..c1b8637
--- /dev/null
+++ b/drivers/media/platform/imx/imx-ipu.c
@@ -0,0 +1,313 @@
+/*
+ * i.MX IPUv3 common v4l2 support
+ *
+ * Copyright (C) 2011 Sascha Hauer, Pengutronix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include linux/module.h
+#include media/v4l2-common.h
+#include media/v4l2-dev.h
+#include media/v4l2-ioctl.h
+
+#include imx-ipu.h
+
+static struct ipu_fmt ipu_fmt_yuv[] = {
+   {
+   .fourcc = V4L2_PIX_FMT_YUV420,
+   .name = YUV 4:2:0 planar, YCbCr,
+   .bytes_per_pixel = 1,
+   }, {
+   .fourcc = V4L2_PIX_FMT_YVU420,
+   .name = YUV 4:2:0 planar, YCrCb,
+   .bytes_per_pixel = 1,
+   }, {
+   .fourcc = V4L2_PIX_FMT_YUV422P,
+   .name = YUV 4:2:2 planar, YCbCr,
+   .bytes_per_pixel = 1,
+   }, {
+   .fourcc = V4L2_PIX_FMT_NV12,
+   .name = YUV 4:2:0 partial interleaved, YCbCr,
+   .bytes_per_pixel = 1,
+   }, {
+   .fourcc = V4L2_PIX_FMT_UYVY,
+   .name = 4:2:2, packed, UYVY,
+   .bytes_per_pixel = 2,
+   }, {
+   .fourcc = V4L2_PIX_FMT_YUYV,
+   .name = 4:2:2, packed, YUYV,
+   .bytes_per_pixel = 2,
+   },
+};
+
+static struct ipu_fmt ipu_fmt_rgb[] = {
+   {
+   .fourcc = V4L2_PIX_FMT_RGB32,
+   .name = RGB888,
+   .bytes_per_pixel = 4,
+   }, {
+   .fourcc = V4L2_PIX_FMT_RGB24,
+   .name = RGB24,
+   .bytes_per_pixel = 3,
+   }, {
+   .fourcc = V4L2_PIX_FMT_BGR24,
+   .name = BGR24,
+   .bytes_per_pixel = 3,
+   }, {
+   .fourcc = V4L2_PIX_FMT_RGB565,
+   .name = RGB565,
+   .bytes_per_pixel = 2,
+   },
+   {
+   .fourcc = V4L2_PIX_FMT_BGR32,
+   .name = BGR888,
+   .bytes_per_pixel = 4,
+   },
+};
+
+struct ipu_fmt *ipu_find_fmt_yuv(unsigned int pixelformat)
+{
+   struct ipu_fmt *fmt;
+   int i;
+
+   for (i = 0; i  

[PATCH 5/5] [media] imx-ipu: Add i.MX IPUv3 scaler driver

2015-03-17 Thread Philipp Zabel
From: Sascha Hauer s.ha...@pengutronix.de

This patch adds support for hardware accelerated scaling and color
space conversion between memory buffers using the IPUv3 IC.
Since the maximum output size of the IC unit is 1024x1024 pixels, multiple
IC tasks with overlapping tiles are used internally to scale and convert
larger frames.

The IC operates with a burst size of at least 8 pixels. Depending on the
frame width and scaling factor, up to 7 junk pixels may be written after
the end of the frame. The sizeimage is increased accordingly.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
Signed-off-by: Michael Olbrich m.olbr...@pengutronix.de
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/gpu/ipu-v3/ipu-ic.c |  28 +-
 drivers/media/platform/imx/Kconfig  |   9 +
 drivers/media/platform/imx/Makefile |   1 +
 drivers/media/platform/imx/imx-ipu-scaler.c | 869 
 drivers/media/platform/imx/imx-ipu.c|   2 +-
 drivers/media/platform/imx/imx-ipu.h|   1 +
 6 files changed, 882 insertions(+), 28 deletions(-)
 create mode 100644 drivers/media/platform/imx/imx-ipu-scaler.c

diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c
index 39ee388..984f68f 100644
--- a/drivers/gpu/ipu-v3/ipu-ic.c
+++ b/drivers/gpu/ipu-v3/ipu-ic.c
@@ -701,7 +701,6 @@ static struct image_convert_ctx 
*ipu_image_convert_next(struct ipu_ic *ic)
 {
struct ipu_ic_priv *priv = ic-priv;
struct ipuv3_channel *ch_in = ic-input_channel;
-   struct ipuv3_channel *ch_in_p, *ch_in_n;
struct ipuv3_channel *ch_out = ic-output_channel;
struct image_convert_ctx *ctx;
struct ipu_image *in_p, *in, *in_n;
@@ -748,32 +747,7 @@ static struct image_convert_ctx 
*ipu_image_convert_next(struct ipu_ic *ic)
ipu_cpmem_set_burstsize(ch_in, inburst);
ipu_cpmem_set_burstsize(ch_out, outburst);
 
-   if (ctx-deinterlace) {
-   ch_in_p = ic-input_channel_p;
-   ch_in_n = ic-input_channel_n;
-
-   ipu_cpmem_zero(ch_in_p);
-   ipu_cpmem_zero(ch_in_n);
-
-   ipu_ic_task_idma_init(ic, ic-input_channel_p,
- in_p-rect.width, in_p-rect.height,
- inburst, IPU_ROTATE_NONE);
-   ipu_ic_task_idma_init(ic, ic-input_channel_n,
- in_n-rect.width, in_n-rect.height,
- inburst, IPU_ROTATE_NONE);
-
-   ipu_cpmem_set_image(ch_in_p, ctx-in_p);
-   ipu_cpmem_set_image(ch_in_n, ctx-in_n);
-
-   ipu_cpmem_set_burstsize(ch_in_p, inburst);
-   ipu_cpmem_set_burstsize(ch_in_n, inburst);
-   }
-
-
-   if (ctx-deinterlace)
-   in_height = in-rect.height * 2;
-   else
-   in_height = in-rect.height;
+   in_height = in-rect.height;
 
dev_dbg(priv-ipu-dev, %s: %dx%d(%dx%d@%d,%d) - 
%dx%d(%dx%d@%d,%d)\n,
__func__, in-pix.width, in-pix.height,
diff --git a/drivers/media/platform/imx/Kconfig 
b/drivers/media/platform/imx/Kconfig
index a90c973..4694367 100644
--- a/drivers/media/platform/imx/Kconfig
+++ b/drivers/media/platform/imx/Kconfig
@@ -1,2 +1,11 @@
 config VIDEO_IMX_IPU_COMMON
tristate
+
+config VIDEO_IMX_IPU_SCALER
+   tristate i.MX5/6 IPUv3 based image scaler driver
+   depends on VIDEO_DEV  IMX_IPUV3_CORE
+   select VIDEOBUF2_DMA_CONTIG
+   select VIDEO_IMX_IPU_COMMON
+   select V4L2_MEM2MEM_DEV
+   ---help---
+ This is a v4l2 scaler video driver for the IPUv3 on i.MX5/6.
diff --git a/drivers/media/platform/imx/Makefile 
b/drivers/media/platform/imx/Makefile
index 5de119c..f20aa0b 100644
--- a/drivers/media/platform/imx/Makefile
+++ b/drivers/media/platform/imx/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_VIDEO_IMX_IPU_COMMON) += imx-ipu.o
+obj-$(CONFIG_VIDEO_IMX_IPU_SCALER) += imx-ipu-scaler.o
diff --git a/drivers/media/platform/imx/imx-ipu-scaler.c 
b/drivers/media/platform/imx/imx-ipu-scaler.c
new file mode 100644
index 000..9cf8a70
--- /dev/null
+++ b/drivers/media/platform/imx/imx-ipu-scaler.c
@@ -0,0 +1,869 @@
+/*
+ * i.MX IPUv3 scaler driver
+ *
+ * Copyright (C) 2011 Sascha Hauer, Pengutronix
+ *
+ * based on the mem2mem test driver
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include linux/module.h
+#include linux/delay.h
+#include linux/fs.h
+#include linux/version.h
+#include linux/sched.h

[PATCH 1/5] gpu: ipu-v3: Add missing IDMAC channel names

2015-03-17 Thread Philipp Zabel
This patch adds the remaining missing IDMAC channel names: all VDIC channels
for deinterlacing and combining, the separate alpha channels for the MEM-IC
and MEM-DC ASYNC channels, and the DC read / command / output mask channels.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 include/video/imx-ipu-v3.h | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 73390c1..459508e 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -96,20 +96,34 @@ enum ipu_channel_irq {
 #define IPUV3_CHANNEL_CSI2  2
 #define IPUV3_CHANNEL_CSI3  3
 #define IPUV3_CHANNEL_VDI_MEM_IC_VF 5
+#define IPUV3_CHANNEL_MEM_VDI_PREV  8
+#define IPUV3_CHANNEL_MEM_VDI_CUR   9
+#define IPUV3_CHANNEL_MEM_VDI_NEXT 10
 #define IPUV3_CHANNEL_MEM_IC_PP11
 #define IPUV3_CHANNEL_MEM_IC_PRP_VF12
+#define IPUV3_CHANNEL_VDI_MEM_RECENT   13
 #define IPUV3_CHANNEL_G_MEM_IC_PRP_VF  14
 #define IPUV3_CHANNEL_G_MEM_IC_PP  15
+#define IPUV3_CHANNEL_G_MEM_IC_PRP_VF_ALPHA17
+#define IPUV3_CHANNEL_G_MEM_IC_PP_ALPHA18
+#define IPUV3_CHANNEL_MEM_VDI_PLANE1_COMB_ALPHA19
 #define IPUV3_CHANNEL_IC_PRP_ENC_MEM   20
 #define IPUV3_CHANNEL_IC_PRP_VF_MEM21
 #define IPUV3_CHANNEL_IC_PP_MEM22
 #define IPUV3_CHANNEL_MEM_BG_SYNC  23
 #define IPUV3_CHANNEL_MEM_BG_ASYNC 24
+#define IPUV3_CHANNEL_MEM_VDI_PLANE1_COMB  25
+#define IPUV3_CHANNEL_MEM_VDI_PLANE3_COMB  26
 #define IPUV3_CHANNEL_MEM_FG_SYNC  27
 #define IPUV3_CHANNEL_MEM_DC_SYNC  28
 #define IPUV3_CHANNEL_MEM_FG_ASYNC 29
 #define IPUV3_CHANNEL_MEM_FG_SYNC_ALPHA31
+#define IPUV3_CHANNEL_MEM_FG_ASYNC_ALPHA   33
+#define IPUV3_CHANNEL_DC_MEM_READ  40
 #define IPUV3_CHANNEL_MEM_DC_ASYNC 41
+#define IPUV3_CHANNEL_MEM_DC_COMMAND   42
+#define IPUV3_CHANNEL_MEM_DC_COMMAND2  43
+#define IPUV3_CHANNEL_MEM_DC_OUTPUT_MASK   44
 #define IPUV3_CHANNEL_MEM_ROT_ENC  45
 #define IPUV3_CHANNEL_MEM_ROT_VF   46
 #define IPUV3_CHANNEL_MEM_ROT_PP   47
@@ -117,6 +131,7 @@ enum ipu_channel_irq {
 #define IPUV3_CHANNEL_ROT_VF_MEM   49
 #define IPUV3_CHANNEL_ROT_PP_MEM   50
 #define IPUV3_CHANNEL_MEM_BG_SYNC_ALPHA51
+#define IPUV3_CHANNEL_MEM_BG_ASYNC_ALPHA   52
 
 int ipu_map_irq(struct ipu_soc *ipu, int irq);
 int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel,
-- 
2.1.4

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


[PATCH 0/5] i.MX5/6 mem2mem scaler

2015-03-17 Thread Philipp Zabel
Hi,

this series uses the IPU IC post-processing task, to implement
a mem2mem device for scaling and colorspace conversion.

regards
Philipp

Philipp Zabel (3):
  gpu: ipu-v3: Add missing IDMAC channel names
  gpu: ipu-v3: Add mem2mem image conversion support to IC
  gpu: ipu-v3: Register scaler platform device

Sascha Hauer (2):
  [media] imx-ipu: Add ipu media common code
  [media] imx-ipu: Add i.MX IPUv3 scaler driver

 drivers/gpu/ipu-v3/ipu-common.c |   2 +
 drivers/gpu/ipu-v3/ipu-ic.c | 787 -
 drivers/media/platform/Kconfig  |   2 +
 drivers/media/platform/Makefile |   1 +
 drivers/media/platform/imx/Kconfig  |  11 +
 drivers/media/platform/imx/Makefile |   2 +
 drivers/media/platform/imx/imx-ipu-scaler.c | 869 
 drivers/media/platform/imx/imx-ipu.c| 313 ++
 drivers/media/platform/imx/imx-ipu.h|  36 ++
 include/video/imx-ipu-v3.h  |  49 +-
 10 files changed, 2055 insertions(+), 17 deletions(-)
 create mode 100644 drivers/media/platform/imx/Kconfig
 create mode 100644 drivers/media/platform/imx/Makefile
 create mode 100644 drivers/media/platform/imx/imx-ipu-scaler.c
 create mode 100644 drivers/media/platform/imx/imx-ipu.c
 create mode 100644 drivers/media/platform/imx/imx-ipu.h

-- 
2.1.4

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