Re: Using the coda driver with Gstreamer

2015-02-18 Thread Zahari Doychev

Hi Fabio,

On Mon, Dec 01, 2014 at 05:17:40PM -0200, Fabio Estevam wrote:
 On Tue, Nov 18, 2014 at 4:41 PM, Nicolas Dufresne
 nicolas.dufre...@collabora.com wrote:
 
  Ok, let us know when the switch is made. Assuming your goal is to get
  the HW decoder working, you should test with simpler pipeline. In your
  specific case, you should try and get this pipeline to preroll:
 
  gst-launch-1.0 \
filesrc location=/home/H264_test1_Talk inghead_mp4_480x360.mp4 \
! qtdemux ! h264parse ! v4l2video1dec ! fakesink
 
 After applying Philipp's dts patch:
 http://www.spinics.net/lists/arm-kernel/msg382314.html
 
 ,I am able to play the video clip with the following Gstreamer pipeline:
 
 gst-launch-1.0 filesrc
 location=/home/H264_test1_Talkinghead_mp4_480x360.mp4 ! qtdemux !
 h264parse ! v4l2video1dec ! videoconvert ! fbdevsink

I am using this pipeline with gstreamer 1.4.5 and current media branch but I am
getting very poor performance 1-2 fps when playing 800x400 video. Is it possible
that fbdevsink is too slow for that? Does anyone know what is going wrong?

Regards,

Zahari

Video Type:

root@imx6q-dmo-edm-qmx6:/# gst-discoverer-1.0 linux_800x480.mov -v
Analyzing file:///DemoVideos/linux_800x480.mov
Done discovering file:///DemoVideos/linux_800x480.mov
Missing plugins
 (gstreamer|1.0|gst-discoverer-1.0|MPEG-4 AAC decoder|decoder-audio/mpeg, 
mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, 
level=(string)2, base-profile=(string)lc, profile=(string)lc)

Topology:
  container: video/quicktime
audio: audio/mpeg, mpegversion=(int)4, framed=(boolean)true, 
stream-format=(string)raw, level=(string)2, base-profile=(string)lc, 
profile=(string)lc, codec_data=(buffer)120856e500, rate=(int)44100, 
channels=(int)1
  Codec:
audio/mpeg, mpegversion=(int)4, framed=(boolean)true, 
stream-format=(string)raw, level=(string)2, base-profile=(string)lc, 
profile=(string)lc, codec_data=(buffer)120856e500, rate=(int)44100, 
channels=(int)1
  Additional info:
None
  Stream ID: (null)
  Language: unknown
  Channels: 1
  Sample rate: 44100
  Depth: 0
  Bitrate: 0
  Max bitrate: 0
  Tags:
None
  
video: video/x-h264, stream-format=(string)avc, alignment=(string)au, 
level=(string)3.1, profile=(string)high, 
codec_data=(buffer)0164001fffe100176764001facd940c83da10303e9ea600f18319601000668ebe3cb22c0,
 width=(int)800, height=(int)480, framerate=(fraction)3/1001, 
pixel-aspect-ratio=(fraction)1/1
  Codec:
video/x-h264, stream-format=(string)avc, alignment=(string)au, 
level=(string)3.1, profile=(string)high, 
codec_data=(buffer)0164001fffe100176764001facd940c83da10303e9ea600f18319601000668ebe3cb22c0,
 width=(int)800, height=(int)480, framerate=(fraction)3/1001, 
pixel-aspect-ratio=(fraction)1/1
  Additional info:
None
  Stream ID: 
0b5ab36c52878431d95e588951bfa2cf80c530ad5deda45bf3f9fdd5a4d4a48f/001
  Width: 800
  Height: 480
  Depth: 24
  Frame rate: 3/1001
  Pixel aspect ratio: 1/1
  Interlaced: false
  Bitrate: 496256
  Max bitrate: 10069
  Tags:
taglist, application-name=(string)Lavf55.7.100, 
container-format=(string)Quicktime, video-codec=(string)H.264, 
language-code=(string)en, bitrate=(uint)496256, minimum-bitrate=(uint)10069, 
maximum-bitrate=(uint)10069;
  

Properties:
  Duration: 0:03:12.00600
  Seekable: yes
  Tags: 
  application name: Lavf55.7.100
  container format: Quicktime
  video codec: H.264
  language code: en
  bitrate: 496256
  minimum bitrate: 10069
  maximum bitrate: 10069
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag to vb2_fileio_flags

2015-02-18 Thread Kamil Debski
Hi,

 From: Hans Verkuil [mailto:hverk...@xs4all.nl]
 Sent: Wednesday, February 18, 2015 10:58 AM
 
 On 02/18/15 10:42, Kamil Debski wrote:
  Hi Hans,
 
  From: Hans Verkuil [mailto:hverk...@xs4all.nl]
  Sent: Tuesday, February 17, 2015 10:11 AM
 
  Hi Kamil,
 
  On 12/16/14 12:36, Kamil Debski wrote:
  The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the
  behavior of __fill_vb2_buffer function, so that if bytesused is 0
 it
  is set to the size of the buffer. However, bytesused set to 0 is
  used by older codec drivers as as indication used to mark the end
 of
  stream.
 
  To keep backward compatibility, this patch adds a flag passed to
 the
  vb2_queue_init function - VB2_FILEIO_ALLOW_ZERO_BYTESUSED. If the
  flag
  is set upon initialization of the queue, the videobuf2 keeps the
  value
  of bytesused intact and passes it to the driver.
 
  What is the status of this patch series?
 
  I have to admit that I had forgotten a bit about this patch, because
  of other important work. Thanks for reminding me :)
 
  Note that io_flags is really the wrong place for this flag, it
 should
  be io_modes. This flag has nothing to do with file I/O.
 
  What do you think about adding a separate flags field into the
  vb2_queue structure? This could be combined with changing io_flags to
  u8 or a bit field to save space.
 
 I think changing io_flags to a bitfield is a good idea.
 
   unsigned fileio_read_once:1;
   unsigned fileio_write_immediately:1;
   unsigned allow_zero_bytesused:1;
 
 However, going back to allow_zero_bytesused: this has been broken for
 quite some time without anyone complaining (other than you :-) ). 

If I remember correctly, it was Nicolas who reported to me the problem 
on the IRC.

 Might
 it not be better to just fix this properly by calling
 V4L2_DEC_CMD_STOP, as done here: https://www.mail-archive.com/linux-
 me...@vger.kernel.org/msg84916.html,
 and drop the support for zero bytesused to mark EOS entirely?

I think it would be good to have the backward compatibility for some time.

 I might be too optimistic here. Or perhaps at least add a pr_warn
 telling users to switch to V4L2_DEC_CMD_STOP since this will be removed
 in 2017 or whatever.

Where do you see the pr_warn? I guess it would be good if it was only
displayed once and only when the app uses bytesused == 0 to signal the
EOS. Do you think alike?


 
 Regards,
 
   Hans

Best wishes,
-- 
Kamil Debski
Samsung RD Institute Poland

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


RE: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag to vb2_fileio_flags

2015-02-18 Thread Kamil Debski
Hi Hans,

 From: Hans Verkuil [mailto:hverk...@xs4all.nl]
 Sent: Tuesday, February 17, 2015 10:11 AM
 
 Hi Kamil,
 
 On 12/16/14 12:36, Kamil Debski wrote:
  The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the
  behavior of __fill_vb2_buffer function, so that if bytesused is 0 it
  is set to the size of the buffer. However, bytesused set to 0 is used
  by older codec drivers as as indication used to mark the end of
 stream.
 
  To keep backward compatibility, this patch adds a flag passed to the
  vb2_queue_init function - VB2_FILEIO_ALLOW_ZERO_BYTESUSED. If the
 flag
  is set upon initialization of the queue, the videobuf2 keeps the
 value
  of bytesused intact and passes it to the driver.
 
 What is the status of this patch series?

I have to admit that I had forgotten a bit about this patch, because of
other
important work. Thanks for reminding me :)
 
 Note that io_flags is really the wrong place for this flag, it should
 be io_modes. This flag has nothing to do with file I/O.

What do you think about adding a separate flags field into the vb2_queue
structure? This could be combined with changing io_flags to u8 or a bit
field
to save space.

Best wishes,
-- 
Kamil Debski
Samsung RD Institute Poland

 
 Regards,
 
   Hans
 
 
  Reported-by: Nicolas Dufresne nicolas.dufre...@collabora.com
  Signed-off-by: Kamil Debski k.deb...@samsung.com
  ---
   drivers/media/v4l2-core/videobuf2-core.c |   33
 --
   include/media/videobuf2-core.h   |3 +++
   2 files changed, 30 insertions(+), 6 deletions(-)
 
  diff --git a/drivers/media/v4l2-core/videobuf2-core.c
  b/drivers/media/v4l2-core/videobuf2-core.c
  index d09a891..1068dbb 100644
  --- a/drivers/media/v4l2-core/videobuf2-core.c
  +++ b/drivers/media/v4l2-core/videobuf2-core.c
  @@ -1276,13 +1276,23 @@ static void __fill_vb2_buffer(struct
 vb2_buffer *vb, const struct v4l2_buffer *b
   * userspace clearly never bothered to set it and
   * it's a safe assumption that they really meant to
   * use the full plane sizes.
  +*
  +* Some drivers, e.g. old codec drivers, use
 bytesused
  +* == 0 as a way to indicate that streaming is
 finished.
  +* In that case, the driver should use the following
  +* io_flag VB2_FILEIO_ALLOW_ZERO_BYTESUSED to keep
 old
  +* userspace applications working.
   */
  for (plane = 0; plane  vb-num_planes; ++plane) {
  struct v4l2_plane *pdst =
v4l2_planes[plane];
  struct v4l2_plane *psrc =
b-m.planes[plane];
 
  -   pdst-bytesused = psrc-bytesused ?
  -   psrc-bytesused : pdst-length;
  +   if (vb-vb2_queue-io_flags 
  +   VB2_FILEIO_ALLOW_ZERO_BYTESUSED)
  +   pdst-bytesused = psrc-bytesused;
  +   else
  +   pdst-bytesused = psrc-bytesused ?
  +   psrc-bytesused :
pdst-length;
  pdst-data_offset = psrc-data_offset;
  }
  }
  @@ -1295,6 +1305,12 @@ static void __fill_vb2_buffer(struct
 vb2_buffer *vb, const struct v4l2_buffer *b
   *
   * If bytesused == 0 for the output buffer, then fall back
   * to the full buffer size as that's a sensible default.
  +*
  +* Some drivers, e.g. old codec drivers, use bytesused == 0
  +* as a way to indicate that streaming is finished. In that
  +* case, the driver should use the following io_flag
  +* VB2_FILEIO_ALLOW_ZERO_BYTESUSED to keep old userspace
  +* applications working.
   */
  if (b-memory == V4L2_MEMORY_USERPTR) {
  v4l2_planes[0].m.userptr = b-m.userptr; @@ -1306,11
 +1322,16 @@
  static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct
 v4l2_buffer *b
  v4l2_planes[0].length = b-length;
  }
 
  -   if (V4L2_TYPE_IS_OUTPUT(b-type))
  -   v4l2_planes[0].bytesused = b-bytesused ?
  -   b-bytesused : v4l2_planes[0].length;
  -   else
  +   if (V4L2_TYPE_IS_OUTPUT(b-type)) {
  +   if (vb-vb2_queue-io_flags 
  +   VB2_FILEIO_ALLOW_ZERO_BYTESUSED)
  +   v4l2_planes[0].bytesused = b-bytesused;
  +   else
  +   v4l2_planes[0].bytesused = b-bytesused ?
  +   b-bytesused :
v4l2_planes[0].length;
  +   } else {
  v4l2_planes[0].bytesused = 0;
  +   }
 
 

Re: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag to vb2_fileio_flags

2015-02-18 Thread Hans Verkuil
On 02/18/15 10:42, Kamil Debski wrote:
 Hi Hans,
 
 From: Hans Verkuil [mailto:hverk...@xs4all.nl]
 Sent: Tuesday, February 17, 2015 10:11 AM

 Hi Kamil,

 On 12/16/14 12:36, Kamil Debski wrote:
 The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the
 behavior of __fill_vb2_buffer function, so that if bytesused is 0 it
 is set to the size of the buffer. However, bytesused set to 0 is used
 by older codec drivers as as indication used to mark the end of
 stream.

 To keep backward compatibility, this patch adds a flag passed to the
 vb2_queue_init function - VB2_FILEIO_ALLOW_ZERO_BYTESUSED. If the
 flag
 is set upon initialization of the queue, the videobuf2 keeps the
 value
 of bytesused intact and passes it to the driver.

 What is the status of this patch series?
 
 I have to admit that I had forgotten a bit about this patch, because of
 other
 important work. Thanks for reminding me :)
  
 Note that io_flags is really the wrong place for this flag, it should
 be io_modes. This flag has nothing to do with file I/O.
 
 What do you think about adding a separate flags field into the vb2_queue
 structure? This could be combined with changing io_flags to u8 or a bit
 field
 to save space.

I think changing io_flags to a bitfield is a good idea.

unsigned fileio_read_once:1;
unsigned fileio_write_immediately:1;
unsigned allow_zero_bytesused:1;

However, going back to allow_zero_bytesused: this has been broken for
quite some time without anyone complaining (other than you :-) ). Might
it not be better to just fix this properly by calling V4L2_DEC_CMD_STOP,
as done here: 
https://www.mail-archive.com/linux-media@vger.kernel.org/msg84916.html,
and drop the support for zero bytesused to mark EOS entirely?

I might be too optimistic here. Or perhaps at least add a pr_warn telling
users to switch to V4L2_DEC_CMD_STOP since this will be removed in 2017 or
whatever.

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: [RFC PATCH 0/1] [media] pci: Add support for DVB PCIe cards from Prospero Technologies Ltd.

2015-02-18 Thread Philip Downer
Hi Antti,

On Tue, Feb 17, 2015 at 7:14 PM, Antti Palosaari cr...@iki.fi wrote:
 On 02/17/2015 08:22 PM, Philip Downer wrote:

 Hi Mauro,

 On Mon, Feb 16, 2015 at 11:47 PM, Mauro Carvalho Chehab
 mche...@osg.samsung.com wrote:

 Em Mon, 16 Feb 2015 22:01:07 +0200
 Antti Palosaari cr...@iki.fi escreveu:

 Moikka!

 On 02/16/2015 09:48 PM, Philip Downer wrote:

 The Vortex PCIe card by Prospero Technologies Ltd is a modular DVB card
 with a hardware demux, the card can support up to 8 modules which are
 fixed to the board at assembly time. Currently we only offer one
 configuration, 8 x Dibcom 7090p DVB-t tuners, but we will soon be
 releasing
 other configurations. There is also a connector for an infra-red
 receiver
 dongle on the board which supports RAW IR.

 The driver has been in testing on our systems (ARM Cortex-A9, Marvell
 Sheva,
 x86, x86-64) for longer than 6 months, so I'm confident that it works.
 However as this is the first Linux driver I've written, I'm sure there
 are
 some things that I've got wrong. One thing in particular which has been
 raised by one of our early testers is that we currently register all of
 our frontends as being attached to one adapter. This means the device
 is
 enumerated in /dev like this:

 /dev/dvb/adapter0/frontend0
 /dev/dvb/adapter0/dvr0
 /dev/dvb/adapter0/demux0

 /dev/dvb/adapter0/frontend1
 /dev/dvb/adapter0/dvr1
 /dev/dvb/adapter0/demux1

 /dev/dvb/adapter0/frontend2
 /dev/dvb/adapter0/dvr2
 /dev/dvb/adapter0/demux2

 etc.

 Whilst I think this is ok according to the spec, our tester has
 complained
 that it's incompatible with their software which expects to find just
 one
 frontend per adapter. So I'm wondering if someone could confirm if what
 I've done with regards to this is correct.


 As I understand all those tuners are independent (could be used same
 time) you should register those as a 8 adapters, each having single
 frontend, dvr and demux.


 Yeah, creating one adapter per device is the best solution, if you
 can't do things like:

  frontend0 - demux2 - dvr5


 Thanks for confirming what Antti said, I'll change the driver and resubmit
 it.


 Also, take care to fix issues to meet Kernel coding style and checkpatch.pl
 requirements where possible.

Sure, I had pushed this patch through checkpatch and fixed most
things, the only things I'm aware of that aren't fixed are line
lengths and one section with too many nested statements. However I've
read that line lengths are less of an issue these days in kernel code
and the section with too many nested statements came from dibcom
therefore I didn't want to refactor this, at least not without a lot
of testing. Please let me know if I'm wrong in my assumptions or if
I've missed something in generating this patch.

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


Re: [PATCH 1/2] vb2: Add VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag to vb2_fileio_flags

2015-02-18 Thread Hans Verkuil
On 02/18/15 11:31, Kamil Debski wrote:
 Hi,
 
 From: Hans Verkuil [mailto:hverk...@xs4all.nl]
 Sent: Wednesday, February 18, 2015 10:58 AM

 On 02/18/15 10:42, Kamil Debski wrote:
 Hi Hans,

 From: Hans Verkuil [mailto:hverk...@xs4all.nl]
 Sent: Tuesday, February 17, 2015 10:11 AM

 Hi Kamil,

 On 12/16/14 12:36, Kamil Debski wrote:
 The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the
 behavior of __fill_vb2_buffer function, so that if bytesused is 0
 it
 is set to the size of the buffer. However, bytesused set to 0 is
 used by older codec drivers as as indication used to mark the end
 of
 stream.

 To keep backward compatibility, this patch adds a flag passed to
 the
 vb2_queue_init function - VB2_FILEIO_ALLOW_ZERO_BYTESUSED. If the
 flag
 is set upon initialization of the queue, the videobuf2 keeps the
 value
 of bytesused intact and passes it to the driver.

 What is the status of this patch series?

 I have to admit that I had forgotten a bit about this patch, because
 of other important work. Thanks for reminding me :)

 Note that io_flags is really the wrong place for this flag, it
 should
 be io_modes. This flag has nothing to do with file I/O.

 What do you think about adding a separate flags field into the
 vb2_queue structure? This could be combined with changing io_flags to
 u8 or a bit field to save space.

 I think changing io_flags to a bitfield is a good idea.

  unsigned fileio_read_once:1;
  unsigned fileio_write_immediately:1;
  unsigned allow_zero_bytesused:1;

 However, going back to allow_zero_bytesused: this has been broken for
 quite some time without anyone complaining (other than you :-) ). 
 
 If I remember correctly, it was Nicolas who reported to me the problem 
 on the IRC.
 
 Might
 it not be better to just fix this properly by calling
 V4L2_DEC_CMD_STOP, as done here: https://www.mail-archive.com/linux-
 me...@vger.kernel.org/msg84916.html,
 and drop the support for zero bytesused to mark EOS entirely?
 
 I think it would be good to have the backward compatibility for some time.
 
 I might be too optimistic here. Or perhaps at least add a pr_warn
 telling users to switch to V4L2_DEC_CMD_STOP since this will be removed
 in 2017 or whatever.
 
 Where do you see the pr_warn? I guess it would be good if it was only
 displayed once and only when the app uses bytesused == 0 to signal the
 EOS. Do you think alike?

Right, pr_warn_once() would do that.

As I discussed with Pawel on irc I also think we need to do a pr_warn_once
if the application doesn't set bytesused for output streams. Right now we
replace bytesused by length to cater for bad apps, but I really hate that.

I'd like to eventually require a proper setting for bytesused, but that
means apps need to be informed that they do something wrong. Unfortunately,
other than gstreamer I would expect that all those apps are closed source
running on embedded systems.

Nicolas, can you confirm that gstreamer is filling in bytesused for output
buffers correctly? (I.e., doesn't leave it to 0). I may have mentioned this
before, but have you run gstreamer with valgrind? valgrind 3.10 now supports
all v4l2 ioctls.

Regards,

Hans

 
 

 Regards,

  Hans
 
 Best wishes,
 

--
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 v01] Driver for Toshiba TC358743 CSI-2 to HDMI bridge

2015-02-18 Thread Philipp Zabel
Hi Mats,

Am Dienstag, den 17.02.2015, 16:53 +0100 schrieb Mats Randgaard
(matrandg):
  I think this calculation should include the blanking intervals.
 
 As far as I understand is only the active video from the HDMI interface 
 transferred on the CSI interface, so I think this calculation is 
 correct. We transfer 1080p60 video on four lanes with 823.5 Mbps/lane, 
 which would not have been possible if the blanking should have been 
 transferred as well ((2200 * 1125 * 60 * 24) bps / 823.5 Mbps/lane  = 
 4.33 lanes.

You are right, I confused the reference and minimum suitable CSI
lane speed fields in REF_02. There ought to be _some_ overhead though?
(1920 * 1080 * 60 * 24) bps = 746.496 Mbps, but REF_02 suggests a
minimum of 820.92 Mbps per lane (reference is 891 Mbps as expected).

[...]
  +  i2c_wr32(sd, HSTXVREGEN,
  +  ((lanes  0) ? MASK_CLM_HSTXVREGEN : 0x0) |
  +  ((lanes  0) ? MASK_D0M_HSTXVREGEN : 0x0) |
  +  ((lanes  1) ? MASK_D1M_HSTXVREGEN : 0x0) |
  +  ((lanes  2) ? MASK_D2M_HSTXVREGEN : 0x0) |
  +  ((lanes  3) ? MASK_D3M_HSTXVREGEN : 0x0));
  +
  +  i2c_wr32(sd, TXOPTIONCNTRL, MASK_CONTCLKMODE);
  Since anything below can't be undone without pulling CTXRST, I propose
  to split tc358743_set_csi into tc358743_set_csi (above) and
  tc358743_start_csi (below).
 
  To make this driver work with the Synopsys DesignWare MIPI CSI-2 Host
  Controller, there needs to be a time when the lanes are in stop state
  first, so the host can synchronize. I'd then like to call start_csi in
  s_stream only.
 
 With help from Toshiba we have now implemented start and stop of the CSI 
 interface without pulling CTXRST. You can see our solution in the next 
 RFC, and I would appreciate if you could test if that works fine for you 
 as well!

I'm looking forward to it.

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


[PATCH v2 1/3] vb2: split the io_flags member of vb2_queue, add allow_zero_bytesused flag

2015-02-18 Thread Kamil Debski
The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the behavior
of __fill_vb2_buffer function, so that if bytesused is 0 it is set to the
size of the buffer. However, bytesused set to 0 is used by older codec
drivers as as indication used to mark the end of stream.

This patch splits the io_flags member of vb2_queue into a bit field.
To keep backward compatibility, this patch adds a flag passed to the
vb2_queue_init function - allow_zero_bytesused. If the flag is set upon
initialization of the queue, the videobuf2 keeps the value of bytesused
intact in the OUTPUT queue and passes it to the driver.

Reported-by: Nicolas Dufresne nicolas.dufre...@collabora.com
Signed-off-by: Kamil Debski k.deb...@samsung.com
---
 drivers/media/v4l2-core/videobuf2-core.c |   44 ++
 include/media/videobuf2-core.h   |   17 
 2 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index bc08a82..e7e8ce5 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1276,13 +1276,22 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
const struct v4l2_buffer *b
 * userspace clearly never bothered to set it and
 * it's a safe assumption that they really meant to
 * use the full plane sizes.
+*
+* Some drivers, e.g. old codec drivers, use bytesused
+* == 0 as a way to indicate that streaming is finished.
+* In that case, the driver should use the
+* allow_zero_bytesused flag to keep old userspace
+* applications working.
 */
for (plane = 0; plane  vb-num_planes; ++plane) {
struct v4l2_plane *pdst = v4l2_planes[plane];
struct v4l2_plane *psrc = b-m.planes[plane];
 
-   pdst-bytesused = psrc-bytesused ?
-   psrc-bytesused : pdst-length;
+   if (vb-vb2_queue-allow_zero_bytesused)
+   pdst-bytesused = psrc-bytesused;
+   else
+   pdst-bytesused = psrc-bytesused ?
+   psrc-bytesused : pdst-length;
pdst-data_offset = psrc-data_offset;
}
}
@@ -1295,6 +1304,11 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
const struct v4l2_buffer *b
 *
 * If bytesused == 0 for the output buffer, then fall back
 * to the full buffer size as that's a sensible default.
+*
+* Some drivers, e.g. old codec drivers, use bytesused * == 0 as
+* a way to indicate that streaming is finished. In that case,
+* the driver should use the allow_zero_bytesused flag to keep
+* old userspace applications working.
 */
if (b-memory == V4L2_MEMORY_USERPTR) {
v4l2_planes[0].m.userptr = b-m.userptr;
@@ -1306,10 +1320,13 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
const struct v4l2_buffer *b
v4l2_planes[0].length = b-length;
}
 
-   if (V4L2_TYPE_IS_OUTPUT(b-type))
-   v4l2_planes[0].bytesused = b-bytesused ?
-   b-bytesused : v4l2_planes[0].length;
-   else
+   if (V4L2_TYPE_IS_OUTPUT(b-type)) {
+   if (vb-vb2_queue-allow_zero_bytesused)
+   v4l2_planes[0].bytesused = b-bytesused;
+   else
+   v4l2_planes[0].bytesused = b-bytesused ?
+   b-bytesused : v4l2_planes[0].length;
+   } else
v4l2_planes[0].bytesused = 0;
 
}
@@ -2760,7 +2777,8 @@ struct vb2_fileio_data {
unsigned int initial_index;
unsigned int q_count;
unsigned int dq_count;
-   unsigned int flags;
+   unsigned read_once:1;
+   unsigned write_immediately:1;
 };
 
 /**
@@ -2798,14 +2816,16 @@ static int __vb2_init_fileio(struct vb2_queue *q, int 
read)
 */
count = 1;
 
-   dprintk(3, setting up file io: mode %s, count %d, flags %08x\n,
-   (read) ? read : write, count, q-io_flags);
+   dprintk(3, setting up file io: mode %s, count %d, read_once %d, 
write_immediately %d, allow_zero_bytesused %d\n,
+   (read) ? read : write, count, q-fileio_read_once,
+   q-fileio_write_immediately, q-allow_zero_bytesused);
 

[PATCH v2 2/3] coda: set allow_zero_bytesused flag for vb2_queue_init

2015-02-18 Thread Kamil Debski
The coda driver interprets a buffer with bytesused equal to 0 as a special
case indicating end-of-stream. After vb2: fix bytesused == 0 handling
(8a75ffb) patch videobuf2 modified the value of bytesused if it was 0.
The allow_zero_bytesused flag was added to videobuf2 to keep
backward compatibility.

Signed-off-by: Kamil Debski k.deb...@samsung.com
---
 drivers/media/platform/coda/coda-common.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 6f32e6d..2d23f9a 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1541,6 +1541,13 @@ static int coda_queue_init(struct coda_ctx *ctx, struct 
vb2_queue *vq)
vq-buf_struct_size = sizeof(struct v4l2_m2m_buffer);
vq-timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
vq-lock = ctx-dev-dev_mutex;
+   /* One of means to indicate end-of-stream for coda is to set the
+* bytesused == 0. However by default videobuf2 handles videobuf
+* equal to 0 as a special case and changes its value to the size
+* of the buffer. Set the allow_zero_bytesused flag, so
+* that videobuf2 will keep the value of bytesused intact.
+*/
+   vq-allow_zero_bytesused = 1;
 
return vb2_queue_init(vq);
 }
-- 
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 v2 3/3] s5p-mfc: set allow_zero_bytesused flag for vb2_queue_init

2015-02-18 Thread Kamil Debski
The s5p-mfc driver interprets a buffer with bytesused equal to 0 as a
special case indicating end-of-stream. After vb2: fix bytesused == 0
handling (8a75ffb) patch videobuf2 modified the value of bytesused if it
was 0. The allow_zero_bytesused flag was added to videobuf2 to keep
backward compatibility.

Signed-off-by: Kamil Debski k.deb...@samsung.com
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 8e44a59..6b08488 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -843,6 +843,13 @@ static int s5p_mfc_open(struct file *file)
ret = -ENOENT;
goto err_queue_init;
}
+   /* One of means to indicate end-of-stream for MFC is to set the
+* bytesused == 0. However by default videobuf2 handles videobuf
+* equal to 0 as a special case and changes its value to the size
+* of the buffer. Set the allow_zero_bytesused flag so that videobuf2
+* will keep the value of bytesused intact.
+*/
+   q-allow_zero_bytesused = 1;
q-mem_ops = vb2_dma_contig_memops;
q-timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
ret = vb2_queue_init(q);
-- 
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: [PATCH v2 1/3] vb2: split the io_flags member of vb2_queue, add allow_zero_bytesused flag

2015-02-18 Thread Hans Verkuil
On 02/18/2015 06:07 PM, Kamil Debski wrote:
 The vb2: fix bytesused == 0 handling (8a75ffb) patch changed the behavior
 of __fill_vb2_buffer function, so that if bytesused is 0 it is set to the
 size of the buffer. However, bytesused set to 0 is used by older codec
 drivers as as indication used to mark the end of stream.
 
 This patch splits the io_flags member of vb2_queue into a bit field.
 To keep backward compatibility, this patch adds a flag passed to the
 vb2_queue_init function - allow_zero_bytesused. If the flag is set upon
 initialization of the queue, the videobuf2 keeps the value of bytesused
 intact in the OUTPUT queue and passes it to the driver.

Can you do this in two patches? One that changes io_flags to a bitfield,
and one adding the new flag.

See more remarks in videobuf2-core.h below.

 
 Reported-by: Nicolas Dufresne nicolas.dufre...@collabora.com
 Signed-off-by: Kamil Debski k.deb...@samsung.com
 ---
  drivers/media/v4l2-core/videobuf2-core.c |   44 
 ++
  include/media/videobuf2-core.h   |   17 
  2 files changed, 37 insertions(+), 24 deletions(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
 b/drivers/media/v4l2-core/videobuf2-core.c
 index bc08a82..e7e8ce5 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -1276,13 +1276,22 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
 const struct v4l2_buffer *b
* userspace clearly never bothered to set it and
* it's a safe assumption that they really meant to
* use the full plane sizes.
 +  *
 +  * Some drivers, e.g. old codec drivers, use bytesused
 +  * == 0 as a way to indicate that streaming is finished.
 +  * In that case, the driver should use the
 +  * allow_zero_bytesused flag to keep old userspace
 +  * applications working.
*/
   for (plane = 0; plane  vb-num_planes; ++plane) {
   struct v4l2_plane *pdst = v4l2_planes[plane];
   struct v4l2_plane *psrc = b-m.planes[plane];
  
 - pdst-bytesused = psrc-bytesused ?
 - psrc-bytesused : pdst-length;
 + if (vb-vb2_queue-allow_zero_bytesused)
 + pdst-bytesused = psrc-bytesused;
 + else
 + pdst-bytesused = psrc-bytesused ?
 + psrc-bytesused : pdst-length;
   pdst-data_offset = psrc-data_offset;
   }
   }
 @@ -1295,6 +1304,11 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
 const struct v4l2_buffer *b
*
* If bytesused == 0 for the output buffer, then fall back
* to the full buffer size as that's a sensible default.
 +  *
 +  * Some drivers, e.g. old codec drivers, use bytesused * == 0 as
 +  * a way to indicate that streaming is finished. In that case,
 +  * the driver should use the allow_zero_bytesused flag to keep
 +  * old userspace applications working.
*/
   if (b-memory == V4L2_MEMORY_USERPTR) {
   v4l2_planes[0].m.userptr = b-m.userptr;
 @@ -1306,10 +1320,13 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, 
 const struct v4l2_buffer *b
   v4l2_planes[0].length = b-length;
   }
  
 - if (V4L2_TYPE_IS_OUTPUT(b-type))
 - v4l2_planes[0].bytesused = b-bytesused ?
 - b-bytesused : v4l2_planes[0].length;
 - else
 + if (V4L2_TYPE_IS_OUTPUT(b-type)) {
 + if (vb-vb2_queue-allow_zero_bytesused)
 + v4l2_planes[0].bytesused = b-bytesused;
 + else
 + v4l2_planes[0].bytesused = b-bytesused ?
 + b-bytesused : v4l2_planes[0].length;
 + } else
   v4l2_planes[0].bytesused = 0;
  
   }
 @@ -2760,7 +2777,8 @@ struct vb2_fileio_data {
   unsigned int initial_index;
   unsigned int q_count;
   unsigned int dq_count;
 - unsigned int flags;
 + unsigned read_once:1;
 + unsigned write_immediately:1;
  };
  
  /**
 @@ -2798,14 +2816,16 @@ static int __vb2_init_fileio(struct vb2_queue *q, int 
 read)
*/
   count = 1;
  
 - dprintk(3, setting up file io: mode %s, count %d, flags %08x\n,
 - (read) ? read : write, count, q-io_flags);
 + dprintk(3, setting up file io: mode %s, count %d, read_once %d, 
 

Re: [PATCH] [media] soc-camera: Remove bogus devm_kfree() in soc_of_bind()

2015-02-18 Thread Sergei Shtylyov

Hello.

On 02/18/2015 07:32 PM, Geert Uytterhoeven wrote:


Unlike scan_async_group(), soc_of_bind() doesn't allocate its
soc_camera_async_client structure using devm_kzalloc(), but has it
embedded inside the soc_of_info structure.  Hence on failure, it must
not free it using devm_kfree(), as this will cause a warning, and may
cause slab corruption:


[...]


Fixes: 1ddc6a6caa94e1e1 ([media] soc_camera: add support for dt binding soc_camera 
drivers)
Cc: sta...@vger.kernel.org
Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
---
Triggered with shmobile-defconfig on r8a7791/koelsch.
---
  drivers/media/platform/soc_camera/soc_camera.c | 1 -
  1 file changed, 1 deletion(-)



diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index cee7b56f84049944..d8a072fe46035821 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1665,7 +1665,6 @@ eclkreg:
  eaddpdev:
platform_device_put(sasc-pdev);
  eallocpdev:
-   devm_kfree(ici-v4l2_dev.dev, sasc);


   Perhaps Ben meant 'info' ISO 'sasc'? This way it would make more sense.


dev_err(ici-v4l2_dev.dev, group probe failed: %d\n, ret);

return ret;


WBR, Sergei

--
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] [kbuild] Add and use IS_REACHABLE macro

2015-02-18 Thread Arnd Bergmann
In the media drivers, the v4l2 core knows about all submodules
and calls into them from a common function. However this cannot
work if the modules that get called are loadable and the
core is built-in. In that case we get

drivers/built-in.o: In function `set_type':
drivers/media/v4l2-core/tuner-core.c:301: undefined reference to 
`tea5767_attach'
drivers/media/v4l2-core/tuner-core.c:307: undefined reference to 
`tea5761_attach'
drivers/media/v4l2-core/tuner-core.c:349: undefined reference to 
`tda9887_attach'
drivers/media/v4l2-core/tuner-core.c:405: undefined reference to `xc4000_attach'

This was working previously, until the IS_ENABLED() macro was used
to replace the construct like

 #if defined(CONFIG_DVB_CX24110) || (defined(CONFIG_DVB_CX24110_MODULE)  
defined(MODULE))

with the difference that the new code no longer checks whether it is being
built as a loadable module itself.

To fix this, this new patch adds an 'IS_REACHABLE' macro, which evaluates
true in exactly the condition that was used previously. The downside
of this is that this trades an obvious link error for a more subtle
runtime failure, but it is clear that the change that introduced the
link error was unintentional and it seems better to revert it for
now. Also, a similar change was originally created by Trent Piepho
and then reverted by teh change to the IS_ENABLED macro.

Ideally Kconfig would be used to avoid the case of a broken dependency,
or the code restructured in a way to turn around the dependency, but either
way would require much larger changes here.

Signed-off-by: Arnd Bergmann a...@arndb.de
Fixes: 7b34be71db53 ([media] use IS_ENABLED() macro)
See-also: c5dec9fb248e (V4L/DVB (4751): Fix DBV_FE_CUSTOMISE for card drivers 
compiled into kernel)
---

dirstat:
  69.2% drivers/media/dvb-frontends/
   0.8% drivers/media/pci/cx23885/
  25.5% drivers/media/tuners/
   4.2% include/linux/
 116 files changed, 125 insertions(+), 116 deletions(-)

diff --git a/drivers/media/dvb-frontends/a8293.h 
b/drivers/media/dvb-frontends/a8293.h
index b6ef6427cfa5..5f0411939ffc 100644
--- a/drivers/media/dvb-frontends/a8293.h
+++ b/drivers/media/dvb-frontends/a8293.h
@@ -27,7 +27,7 @@ struct a8293_config {
u8 i2c_addr;
 };
 
-#if IS_ENABLED(CONFIG_DVB_A8293)
+#if IS_REACHABLE(CONFIG_DVB_A8293)
 extern struct dvb_frontend *a8293_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, const struct a8293_config *cfg);
 #else
diff --git a/drivers/media/dvb-frontends/af9013.h 
b/drivers/media/dvb-frontends/af9013.h
index 09273b2cd310..1dcc936e1661 100644
--- a/drivers/media/dvb-frontends/af9013.h
+++ b/drivers/media/dvb-frontends/af9013.h
@@ -103,7 +103,7 @@ struct af9013_config {
u8 gpio[4];
 };
 
-#if IS_ENABLED(CONFIG_DVB_AF9013)
+#if IS_REACHABLE(CONFIG_DVB_AF9013)
 extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
struct i2c_adapter *i2c);
 #else
diff --git a/drivers/media/dvb-frontends/atbm8830.h 
b/drivers/media/dvb-frontends/atbm8830.h
index 8e0ac98f8d08..5446d13fdfe8 100644
--- a/drivers/media/dvb-frontends/atbm8830.h
+++ b/drivers/media/dvb-frontends/atbm8830.h
@@ -61,7 +61,7 @@ struct atbm8830_config {
u8 agc_hold_loop;
 };
 
-#if IS_ENABLED(CONFIG_DVB_ATBM8830)
+#if IS_REACHABLE(CONFIG_DVB_ATBM8830)
 extern struct dvb_frontend *atbm8830_attach(const struct atbm8830_config 
*config,
struct i2c_adapter *i2c);
 #else
diff --git a/drivers/media/dvb-frontends/au8522.h 
b/drivers/media/dvb-frontends/au8522.h
index 612251958855..dde61582c158 100644
--- a/drivers/media/dvb-frontends/au8522.h
+++ b/drivers/media/dvb-frontends/au8522.h
@@ -61,7 +61,7 @@ struct au8522_config {
enum au8522_if_freq qam_if;
 };
 
-#if IS_ENABLED(CONFIG_DVB_AU8522_DTV)
+#if IS_REACHABLE(CONFIG_DVB_AU8522_DTV)
 extern struct dvb_frontend *au8522_attach(const struct au8522_config *config,
  struct i2c_adapter *i2c);
 #else
diff --git a/drivers/media/dvb-frontends/bcm3510.h 
b/drivers/media/dvb-frontends/bcm3510.h
index 5bd56b1623bf..ff66492fb940 100644
--- a/drivers/media/dvb-frontends/bcm3510.h
+++ b/drivers/media/dvb-frontends/bcm3510.h
@@ -34,7 +34,7 @@ struct bcm3510_config
int (*request_firmware)(struct dvb_frontend* fe, const struct firmware 
**fw, char* name);
 };
 
-#if IS_ENABLED(CONFIG_DVB_BCM3510)
+#if IS_REACHABLE(CONFIG_DVB_BCM3510)
 extern struct dvb_frontend* bcm3510_attach(const struct bcm3510_config* config,
   struct i2c_adapter* i2c);
 #else
diff --git a/drivers/media/dvb-frontends/cx22700.h 
b/drivers/media/dvb-frontends/cx22700.h
index 382a7b1f3618..e0a764868e6f 100644
--- a/drivers/media/dvb-frontends/cx22700.h
+++ b/drivers/media/dvb-frontends/cx22700.h
@@ -31,7 +31,7 @@ struct cx22700_config
u8 demod_address;
 };
 
-#if IS_ENABLED(CONFIG_DVB_CX22700)
+#if IS_REACHABLE(CONFIG_DVB_CX22700)
 extern struct dvb_frontend* cx22700_attach(const struct cx22700_config* 

Re: [PATCH] [media] soc-camera: Remove bogus devm_kfree() in soc_of_bind()

2015-02-18 Thread Guennadi Liakhovetski
On Wed, 18 Feb 2015, Sergei Shtylyov wrote:

 Hello.
 
 On 02/18/2015 07:32 PM, Geert Uytterhoeven wrote:
 
  Unlike scan_async_group(), soc_of_bind() doesn't allocate its
  soc_camera_async_client structure using devm_kzalloc(), but has it
  embedded inside the soc_of_info structure.  Hence on failure, it must
  not free it using devm_kfree(), as this will cause a warning, and may
  cause slab corruption:
 
 [...]
 
  Fixes: 1ddc6a6caa94e1e1 ([media] soc_camera: add support for dt binding
  soc_camera drivers)
  Cc: sta...@vger.kernel.org
  Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
  ---
  Triggered with shmobile-defconfig on r8a7791/koelsch.
  ---
drivers/media/platform/soc_camera/soc_camera.c | 1 -
1 file changed, 1 deletion(-)
 
  diff --git a/drivers/media/platform/soc_camera/soc_camera.c
  b/drivers/media/platform/soc_camera/soc_camera.c
  index cee7b56f84049944..d8a072fe46035821 100644
  --- a/drivers/media/platform/soc_camera/soc_camera.c
  +++ b/drivers/media/platform/soc_camera/soc_camera.c
  @@ -1665,7 +1665,6 @@ eclkreg:
eaddpdev:
  platform_device_put(sasc-pdev);
eallocpdev:
  -   devm_kfree(ici-v4l2_dev.dev, sasc);
 
Perhaps Ben meant 'info' ISO 'sasc'? This way it would make more sense.

Agree. Geert, could you double-check and respin?

Thanks
Guennadi

 
  dev_err(ici-v4l2_dev.dev, group probe failed: %d\n, ret);
  
  return ret;
 
 WBR, Sergei
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] [media] tuner-core: fix compilation if the media controller is not defined

2015-02-18 Thread Lad, Prabhakar
On Wed, Feb 18, 2015 at 3:29 PM, Mauro Carvalho Chehab
mche...@osg.samsung.com wrote:
 drivers/media/v4l2-core/tuner-core.c:440:7: error: 'struct v4l2_subdev' has 
 no member named 'entity'
  t-sd.entity.name = t-name;

 Reported-by: kbuild test robot fengguang...@intel.com
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com

Regards,
--Prabhakar Lad
--
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: Using the coda driver with Gstreamer

2015-02-18 Thread Zahari Doychev
On Wed, Feb 18, 2015 at 08:34:43AM -0500, Nicolas Dufresne wrote:
 
 Le 2015-02-18 03:42, Zahari Doychev a écrit :
 gst-launch-1.0 filesrc
 location=/home/H264_test1_Talkinghead_mp4_480x360.mp4 ! qtdemux !
 h264parse ! v4l2video1dec ! videoconvert ! fbdevsink
 I am using this pipeline with gstreamer 1.4.5 and current media branch but I 
 am
 getting very poor performance 1-2 fps when playing 800x400 video. Is it 
 possible
 that fbdevsink is too slow for that? Does anyone know what is going wrong?
 In this context, you most likely have a conversion happening in videoconvert
 followed by a copy at fbdevsink. Framebuffer device is not a very good
 solution if performance matter (no possible zero-copy). Specially if the
 selected framebuffer color format does not match the decoded format.

So can you tell me if there are some drivers and plugins that can do this
in efficient way. Is there some work going on in this directions. I suppose
glimagesink maybe will be a good way to go.

Regards,

Zahari


--
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/RFC v11 01/20] leds: flash: document sysfs interface

2015-02-18 Thread Jacek Anaszewski
Add a documentation of LED Flash class specific sysfs attributes.

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
---
 Documentation/ABI/testing/sysfs-class-led-flash |  104 +++
 1 file changed, 104 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-led-flash

diff --git a/Documentation/ABI/testing/sysfs-class-led-flash 
b/Documentation/ABI/testing/sysfs-class-led-flash
new file mode 100644
index 000..c941d21
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-led-flash
@@ -0,0 +1,104 @@
+What:  /sys/class/leds/led/flash_brightness
+Date:  February 2015
+KernelVersion: 3.20
+Contact:   Jacek Anaszewski j.anaszew...@samsung.com
+Description:   read/write
+   Set the brightness of this LED in the flash strobe mode, in
+   microamperes. The file is created only for the flash LED devices
+   that support setting flash brightness.
+
+   The value is between 0 and
+   /sys/class/leds/led/max_flash_brightness.
+
+What:  /sys/class/leds/led/max_flash_brightness
+Date:  February 2015
+KernelVersion: 3.20
+Contact:   Jacek Anaszewski j.anaszew...@samsung.com
+Description:   read only
+   Maximum brightness level for this LED in the flash strobe mode,
+   in microamperes.
+
+What:  /sys/class/leds/led/flash_timeout
+Date:  February 2015
+KernelVersion: 3.20
+Contact:   Jacek Anaszewski j.anaszew...@samsung.com
+Description:   read/write
+   Hardware timeout for flash, in microseconds. The flash strobe
+   is stopped after this period of time has passed from the start
+   of the strobe. The file is created only for the flash LED
+   devices that support setting flash timeout.
+
+What:  /sys/class/leds/led/max_flash_timeout
+Date:  February 2015
+KernelVersion: 3.20
+Contact:   Jacek Anaszewski j.anaszew...@samsung.com
+Description:   read only
+   Maximum flash timeout for this LED, in microseconds.
+
+What:  /sys/class/leds/led/flash_strobe
+Date:  February 2015
+KernelVersion: 3.20
+Contact:   Jacek Anaszewski j.anaszew...@samsung.com
+Description:   read/write
+   Flash strobe state. When written with 1 it triggers flash strobe
+   and when written with 0 it turns the flash off.
+
+   On read 1 means that flash is currently strobing and 0 means
+   that flash is off.
+
+What:  /sys/class/leds/led/flash_sync_strobe
+Date:  February 2015
+KernelVersion: 3.20
+Contact:   Jacek Anaszewski j.anaszew...@samsung.com
+Description:   read/write
+   Identifier of the LED to synchronize the flash strobe with.
+   0 stands for no synchronization. Usually the LEDs available for
+   flash strobing are driven by the same flash LED device. The LEDs
+   available for flash strobe synchronization can be obtained by
+   reading the /sys/class/leds/led/available_sync_leds attribute.
+
+   On read the currently selected LED is displayed in the format:
+   led_id.led_name
+
+What:  /sys/class/leds/led/available_sync_leds
+Date:  February 2015
+KernelVersion: 3.20
+Contact:   Jacek Anaszewski j.anaszew...@samsung.com
+Description:   read/write
+   Space separated list of LEDs available for flash strobe
+   synchronization, displayed in the format:
+
+   led1_id.led1_name led2_id.led2_name led3_id.led3_name etc.
+
+What:  /sys/class/leds/led/flash_fault
+Date:  February 2015
+KernelVersion: 3.20
+Contact:   Jacek Anaszewski j.anaszew...@samsung.com
+Description:   read only
+   Space separated list of flash faults that may have occurred.
+   Flash faults are re-read after strobing the flash. Possible
+   flash faults:
+
+   * led-over-voltage - flash controller voltage to the flash LED
+   has exceeded the limit specific to the flash controller
+   * flash-timeout-exceeded - the flash strobe was still on when
+   the timeout set by the user has expired; not all flash
+   controllers may set this in all such conditions
+   * controller-over-temperature - the flash controller has
+   overheated
+   * controller-short-circuit - the short circuit protection
+   of the flash controller has been triggered
+   * led-power-supply-over-current - current in the LED power
+   supply has exceeded the limit specific to the flash
+   controller
+   * 

[PATCH/RFC v11 00/20] LED / flash API integration

2015-02-18 Thread Jacek Anaszewski
This patch set is a follow-up of the LED / flash API integration
series [1]. It is based on linux-next_20150218.


Changes since version 10 :


- added to the v4l2-flash sub-device driver the support for flash
  LED devices with non-linear brightness setting
- improved current setting in the max77693-led driver 
- added ABI documentation for flash LED sysfs attributes
- improved synchronized LEDs related sysfs attributes in the
  LED Flash class
- applied various fixes and cleanups


Changes since version 9 :


- switched to assigning sub-led related of_node to led_cdev-dev-of_node
  member which allowed for avoiding modifications around v4l-async
- reimplemented max77693 flash cell driver to avoid extensive use
  of macros
- added led-sources DT property and switched to using it
- switched to reporting flash faults in the LED subsystem in the form
  of human readable strings
- added available_sync_leds sysfs attribute to the LED Flash class
  and changed the semantics of flash_sync_strobe attribute
- made LED subsystem flash faults not depending on the V4L2 Flash ones
- applied various fixes and cleanups


Changes since version 8:


- added a new way of registering async sub-device
- switched to matching flash leds by DT phandles
- improved Device Tree bindings documentation
- split the drivers patches to LED Flash class
  and V4L2 Flash part
- fixed indicator leds handling in v4l2-flash
- applied various fixes an cleanups


Changes since version 7:


- removed explicit support for indicator leds from
  LED Flash class - indicator leds will be registered
  as a separate LED Flash class devices
- added flash_sync_strobe sysfs attribute and related
  V4L2_CID_FLASH_SYNC_STROBE control
- changed the way of matching V4L2 Flash sub-devices
  in a media device, which entailed modification in
  v4l2-async driver
- modified max77693 DT bindings documentation
- applied various fixes an cleanups


Changes since version 6:


- removed addition of public LED subsystem API for setting
  torch brightness in favour of internal API for
  synchronous and asynchronous led brightness level setting
- fixed possible race condition upon creating LED Flash class
  related sysfs attributes


Changes since version 5:


- removed flash manager framework - its implementation needs
  further thorough discussion.
- removed external strobe facilities from the LED Flash Class
  and provided external_strobe_set op in v4l2-flash. LED subsystem
  should be strobe provider agnostic.

Thanks,
Jacek Anaszewski

[1] https://lkml.org/lkml/2014/7/11/914

Jacek Anaszewski (20):
  leds: flash: document sysfs interface
  leds: flash: Improve sync strobe related sysfs attributes
  Documentation: leds: Add description of LED Flash class extension
  dt-binding: leds: Add common LED DT bindings macros
  mfd: max77693: Modify flash cell name identifiers
  mfd: max77693: Remove struct max77693_led_platform_data
  mfd: max77693: add TORCH_IOUT_MASK macro
  mfd: max77693: Adjust FLASH_EN_SHIFT and TORCH_EN_SHIFT macros
  leds: Add support for max77693 mfd flash cell
  DT: Add documentation for the mfd Maxim max77693
  leds: Add driver for AAT1290 current regulator
  of: Add Skyworks Solutions, Inc. vendor prefix
  DT: Add documentation for the Skyworks AAT1290
  exynos4-is: Add support for v4l2-flash subdevs
  v4l2-ctrls: Add V4L2_CID_FLASH_SYNC_STROBE control
  media: Add registration helpers for V4L2 flash sub-devices
  Documentation: leds: Add description of v4l2-flash sub-device
  DT: Add documentation for exynos4-is 'flashes' property
  leds: max77693: add support for V4L2 Flash sub-device
  leds: aat1290: add support for V4L2 Flash sub-device

 Documentation/ABI/testing/sysfs-class-led-flash|  104 ++
 Documentation/DocBook/media/v4l/controls.xml   |9 +
 .../devicetree/bindings/leds/leds-aat1290.txt  |   43 +
 .../devicetree/bindings/media/samsung-fimc.txt |8 +
 Documentation/devicetree/bindings/mfd/max77693.txt |   61 +
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 Documentation/leds/leds-class-flash.txt|   45 +
 drivers/leds/Kconfig   |   17 +
 drivers/leds/Makefile  |2 +
 drivers/leds/led-class-flash.c |6 +-
 drivers/leds/leds-aat1290.c|  570 ++
 drivers/leds/leds-max77693.c   | 1191 
 drivers/media/platform/exynos4-is/media-dev.c  |   36 +-
 drivers/media/platform/exynos4-is/media-dev.h  |   13 +-
 drivers/media/v4l2-core/Kconfig|   11 +
 drivers/media/v4l2-core/Makefile   |2 +
 

[PATCH/RFC v11 03/20] Documentation: leds: Add description of LED Flash class extension

2015-02-18 Thread Jacek Anaszewski
The documentation being added contains overall description of the
LED Flash Class and the related sysfs attributes.

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
---
 Documentation/leds/leds-class-flash.txt |   32 +++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/leds/leds-class-flash.txt

diff --git a/Documentation/leds/leds-class-flash.txt 
b/Documentation/leds/leds-class-flash.txt
new file mode 100644
index 000..ff03a66
--- /dev/null
+++ b/Documentation/leds/leds-class-flash.txt
@@ -0,0 +1,32 @@
+
+Flash LED handling under Linux
+==
+
+Some LED devices provide two modes - torch and flash. In the LED subsystem
+those modes are supported by LED class (see Documentation/leds/leds-class.txt)
+and LED Flash class respectively. The torch mode related features are enabled
+by default and the flash ones only if a driver declares it by setting
+LED_DEV_CAP_FLASH flag.
+
+In order to enable support for flash LEDs CONFIG_LEDS_CLASS_FLASH symbol
+must be defined in the kernel config. A flash LED driver must register
+in the LED subsystem with led_classdev_flash_register function to gain flash
+related capabilities.
+
+There are flash LED devices which can control more than one LED and allow for
+strobing the sub-LEDs synchronously. A LED will be strobed synchronously with
+the one whose identifier is written to the flash_sync_strobe sysfs attribute.
+The list of available sub-LED identifiers can be read from the 
available_sync_leds
+sysfs attribute. In order to enable the related settings the driver must set
+LED_DEV_CAP_SYNC_STROBE flag.
+
+Following sysfs attributes are exposed for controlling flash LED devices:
+(see Documentation/ABI/testing/sysfs-class-led-flash)
+   - flash_brightness
+   - max_flash_brightness
+   - flash_timeout
+   - max_flash_timeout
+   - flash_strobe
+   - available_sync_leds
+   - flash_sync_strobe
+   - flash_fault
-- 
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/RFC v11 08/20] mfd: max77693: Adjust FLASH_EN_SHIFT and TORCH_EN_SHIFT macros

2015-02-18 Thread Jacek Anaszewski
Modify FLASH_EN_SHIFT and TORCH_EN_SHIFT macros to work properly
when passed enum max77693_fled values (0 for FLED1 and 1 for FLED2)
from leds-max77693 driver. Previous definitions were compatible with
one of the previous RFC versions of leds-max77693.c driver, which was
not merged.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Chanwoo Choi cw00.c...@samsung.com
Cc: Lee Jones lee.jo...@linaro.org
---
 include/linux/mfd/max77693-private.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mfd/max77693-private.h 
b/include/linux/mfd/max77693-private.h
index 8770ce1..51633ea 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -114,8 +114,8 @@ enum max77693_pmic_reg {
 #define FLASH_EN_FLASH 0x1
 #define FLASH_EN_TORCH 0x2
 #define FLASH_EN_ON0x3
-#define FLASH_EN_SHIFT(x)  (6 - ((x) - 1) * 2)
-#define TORCH_EN_SHIFT(x)  (2 - ((x) - 1) * 2)
+#define FLASH_EN_SHIFT(x)  (6 - (x) * 2)
+#define TORCH_EN_SHIFT(x)  (2 - (x) * 2)
 
 /* MAX77693 MAX_FLASH1 register */
 #define MAX_FLASH1_MAX_FL_EN   0x80
-- 
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/RFC v11 05/20] mfd: max77693: Modify flash cell name identifiers

2015-02-18 Thread Jacek Anaszewski
Change flash cell identifiers from max77693-flash to max77693-led
to avoid confusion with NOR/NAND Flash.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Lee Jones lee.jo...@linaro.org
---
 drivers/mfd/max77693.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index a159593..cb14afa 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -53,8 +53,8 @@ static const struct mfd_cell max77693_devs[] = {
.of_compatible = maxim,max77693-haptic,
},
{
-   .name = max77693-flash,
-   .of_compatible = maxim,max77693-flash,
+   .name = max77693-led,
+   .of_compatible = maxim,max77693-led,
},
 };
 
-- 
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/RFC v11 02/20] leds: flash: Improve sync strobe related sysfs attributes

2015-02-18 Thread Jacek Anaszewski
Current format of synchronized strobe related attributes introduces
problems when it comes to parsing. Avoding the usage of square brackets
and colons makes the parsing more convenient.

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
---
 drivers/leds/led-class-flash.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c
index 4a19fd4..a2da52e 100644
--- a/drivers/leds/led-class-flash.c
+++ b/drivers/leds/led-class-flash.c
@@ -224,11 +224,11 @@ static ssize_t available_sync_leds_show(struct device 
*dev,
char *pbuf = buf;
int i, buf_len;
 
-   buf_len = sprintf(pbuf, [0: none] );
+   buf_len = sprintf(pbuf, 0.none );
pbuf += buf_len;
 
for (i = 0; i  fled_cdev-num_sync_leds; ++i) {
-   buf_len = sprintf(pbuf, [%d: %s] , i + 1,
+   buf_len = sprintf(pbuf, %d.%s , i + 1,
  fled_cdev-sync_leds[i]-led_cdev.name);
pbuf += buf_len;
}
@@ -281,7 +281,7 @@ static ssize_t flash_sync_strobe_show(struct device *dev,
sync_led_name = (char *)
fled_cdev-sync_leds[sled_id - 1]-led_cdev.name;
 
-   return sprintf(buf, [%d: %s]\n, sled_id, sync_led_name);
+   return sprintf(buf, %d.%s\n, sled_id, sync_led_name);
 }
 static DEVICE_ATTR_RW(flash_sync_strobe);
 
-- 
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/RFC v11 04/20] dt-binding: leds: Add common LED DT bindings macros

2015-02-18 Thread Jacek Anaszewski
Add macros for defining boost mode and trigger type properties
of flash LED devices.

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/max77693.h |   21 +
 1 file changed, 21 insertions(+)
 create mode 100644 include/dt-bindings/leds/max77693.h

diff --git a/include/dt-bindings/leds/max77693.h 
b/include/dt-bindings/leds/max77693.h
new file mode 100644
index 000..79fcef7
--- /dev/null
+++ b/include/dt-bindings/leds/max77693.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


[PATCH/RFC v11 07/20] mfd: max77693: add TORCH_IOUT_MASK macro

2015-02-18 Thread Jacek Anaszewski
Add a macro for obtaining the mask of ITORCH register bit fields
related either to FLED1 or FLED2 current output. The expected
arguments are TORCH_IOUT1_SHIFT or TORCH_IOUT2_SHIFT.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Chanwoo Choi cw00.c...@samsung.com
Cc: Lee Jones lee.jo...@linaro.org
---
 include/linux/mfd/max77693-private.h |1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/mfd/max77693-private.h 
b/include/linux/mfd/max77693-private.h
index 955dd99..8770ce1 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -87,6 +87,7 @@ enum max77693_pmic_reg {
 /* MAX77693 ITORCH register */
 #define TORCH_IOUT1_SHIFT  0
 #define TORCH_IOUT2_SHIFT  4
+#define TORCH_IOUT_MASK(x) (0xf  (x))
 #define TORCH_IOUT_MIN 15625
 #define TORCH_IOUT_MAX 25
 #define TORCH_IOUT_STEP15625
-- 
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/RFC v11 06/20] mfd: max77693: Remove struct max77693_led_platform_data

2015-02-18 Thread Jacek Anaszewski
The flash part of the max77693 device will depend only on OF, and thus
will not use board files. Since there are no other users of the
struct max77693_led_platform_data its existence is unjustified.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Chanwoo Choi cw00.c...@samsung.com
Cc: Lee Jones lee.jo...@linaro.org
---
 include/linux/mfd/max77693.h |   13 -
 1 file changed, 13 deletions(-)

diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index f0b6585..ce894b6 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -87,19 +87,6 @@ enum max77693_led_boost_mode {
MAX77693_LED_BOOST_FIXED,
 };
 
-struct max77693_led_platform_data {
-   u32 fleds[2];
-   u32 iout_torch[2];
-   u32 iout_flash[2];
-   u32 trigger[2];
-   u32 trigger_type[2];
-   u32 num_leds;
-   u32 boost_mode;
-   u32 flash_timeout;
-   u32 boost_vout;
-   u32 low_vsys;
-};
-
 /* MAX77693 */
 
 struct max77693_platform_data {
-- 
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/RFC v11 09/20] leds: Add support for max77693 mfd flash cell

2015-02-18 Thread Jacek Anaszewski
This patch adds led-flash support to Maxim max77693 chipset.
A device can be exposed to user space through LED subsystem
sysfs interface. Device supports up to two leds which can
work in flash and torch mode. The leds can be triggered
externally or by software.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
Cc: Lee Jones lee.jo...@linaro.org
Cc: Chanwoo Choi cw00.c...@samsung.com
---
 drivers/leds/Kconfig |   10 +
 drivers/leds/Makefile|1 +
 drivers/leds/leds-max77693.c | 1058 ++
 3 files changed, 1069 insertions(+)
 create mode 100644 drivers/leds/leds-max77693.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 95029df..ff9c21b 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -464,6 +464,16 @@ config LEDS_TCA6507
  LED driver chips accessed via the I2C bus.
  Driver support brightness control and hardware-assisted blinking.
 
+config LEDS_MAX77693
+   tristate LED support for MAX77693 Flash
+   depends on LEDS_CLASS_FLASH
+   depends on MFD_MAX77693
+   depends on OF
+   help
+ This option enables support for the flash part of the MAX77693
+ multifunction device. It has build in control for two leds in flash
+ and torch mode.
+
 config LEDS_MAX8997
tristate LED support for MAX8997 PMIC
depends on LEDS_CLASS  MFD_MAX8997
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index cbba921..57ca62b 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -52,6 +52,7 @@ obj-$(CONFIG_LEDS_MC13783)+= leds-mc13783.o
 obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
 obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
 obj-$(CONFIG_LEDS_ASIC3)   += leds-asic3.o
+obj-$(CONFIG_LEDS_MAX77693)+= leds-max77693.o
 obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
 obj-$(CONFIG_LEDS_LM355x)  += leds-lm355x.o
 obj-$(CONFIG_LEDS_BLINKM)  += leds-blinkm.o
diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
new file mode 100644
index 000..45d50d9
--- /dev/null
+++ b/drivers/leds/leds-max77693.c
@@ -0,0 +1,1058 @@
+/*
+ * LED Flash class driver for the flash cell of max77693 mfd.
+ *
+ * Copyright (C) 2015, Samsung Electronics Co., Ltd.
+ *
+ * Authors: Jacek Anaszewski j.anaszew...@samsung.com
+ *  Andrzej Hajda a.ha...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include asm/div64.h
+#include linux/led-class-flash.h
+#include linux/mfd/max77693.h
+#include linux/mfd/max77693-private.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/platform_device.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/workqueue.h
+
+#define MODE_OFF   0
+#define MODE_FLASH(a)  (1  (a))
+#define MODE_TORCH(a)  (1  (2 + (a)))
+#define MODE_FLASH_EXTERNAL(a) (1  (4 + (a)))
+
+#define MODE_FLASH_MASK(MODE_FLASH(FLED1) | MODE_FLASH(FLED2) 
| \
+MODE_FLASH_EXTERNAL(FLED1) | \
+MODE_FLASH_EXTERNAL(FLED2))
+#define MODE_TORCH_MASK(MODE_TORCH(FLED1) | MODE_TORCH(FLED2))
+
+#define FLED1_IOUT (1  0)
+#define FLED2_IOUT (1  1)
+
+enum max77693_fled {
+   FLED1,
+   FLED2,
+};
+
+enum max77693_led_mode {
+   FLASH,
+   TORCH,
+};
+
+struct max77693_led_config_data {
+   const char *label[2];
+   u32 iout_torch_max[2];
+   u32 iout_flash_max[2];
+   u32 flash_timeout[2];
+   u32 num_leds;
+   u32 boost_mode;
+   u32 boost_vout;
+   u32 low_vsys;
+   u32 trigger_type;
+};
+
+struct max77693_sub_led {
+   /* related FLED output identifier */
+   int fled_id;
+   /* related LED Flash class device */
+   struct led_classdev_flash fled_cdev;
+   /* assures led-triggers compatibility */
+   struct work_struct work_brightness_set;
+
+   /* brightness cache */
+   unsigned int torch_brightness;
+   /* flash timeout cache */
+   unsigned int flash_timeout;
+   /* flash faults that may have occurred */
+   u32 flash_faults;
+};
+
+struct max77693_led_device {
+   /* parent mfd regmap */
+   struct regmap *regmap;
+   /* platform device data */
+   struct platform_device *pdev;
+   /* secures access to the device */
+   struct mutex lock;
+
+   /* sub led data */
+   struct max77693_sub_led sub_leds[2];
+
+   /* maximum torch current values for FLED outputs */
+   u32 iout_torch_max[2];
+   /* maximum flash 

[PATCH/RFC v11 11/20] leds: Add driver for AAT1290 current regulator

2015-02-18 Thread Jacek Anaszewski
This patch adds a driver for the 1.5A Step-Up Current Regulator
for Flash LEDs. The device is programmed through a Skyworks proprietary
AS2Cwire serial digital interface.

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
---
 drivers/leds/Kconfig|7 +
 drivers/leds/Makefile   |1 +
 drivers/leds/leds-aat1290.c |  407 +++
 3 files changed, 415 insertions(+)
 create mode 100644 drivers/leds/leds-aat1290.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index ff9c21b..d70fc7b 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -39,6 +39,13 @@ config LEDS_88PM860X
  This option enables support for on-chip LED drivers found on Marvell
  Semiconductor 88PM8606 PMIC.
 
+config LEDS_AAT1290
+   tristate LED support for the AAT1290
+   depends on LEDS_CLASS_FLASH
+   depends on OF
+   help
+This option enables support for the LEDs on the AAT1290.
+
 config LEDS_LM3530
tristate LCD Backlight driver for LM3530
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 57ca62b..b802251 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
 
 # LED Platform Drivers
 obj-$(CONFIG_LEDS_88PM860X)+= leds-88pm860x.o
+obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
 obj-$(CONFIG_LEDS_BD2802)  += leds-bd2802.o
 obj-$(CONFIG_LEDS_LOCOMO)  += leds-locomo.o
 obj-$(CONFIG_LEDS_LM3530)  += leds-lm3530.o
diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
new file mode 100644
index 000..b217f0a
--- /dev/null
+++ b/drivers/leds/leds-aat1290.c
@@ -0,0 +1,407 @@
+/*
+ * LED Flash class driver for the AAT1290
+ * 1.5A Step-Up Current Regulator for Flash LEDs
+ *
+ * Copyright (C) 2015, Samsung Electronics Co., Ltd.
+ * Author: Jacek Anaszewski j.anaszew...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include linux/delay.h
+#include linux/gpio.h
+#include linux/led-class-flash.h
+#include linux/leds.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/of.h
+#include linux/of_gpio.h
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/workqueue.h
+
+#define AAT1290_MOVIE_MODE_CURRENT_ADDR17
+#define AAT1290_MAX_MM_CURR_PERCENT_0  16
+#define AAT1290_MAX_MM_CURR_PERCENT_1001
+
+#define AAT1290_FLASH_SAFETY_TIMER_ADDR18
+
+#define AAT1290_MOVIE_MODE_CONFIG_ADDR 19
+#define AAT1290_MOVIE_MODE_OFF 1
+#define AAT1290_MOVIE_MODE_ON  3
+
+#define AAT1290_MM_CURRENT_RATIO_ADDR  20
+#define AAT1290_MM_TO_FL_1_92  1
+
+#define AAT1290_MM_TO_FL_RATIO 1000 / 1920
+#define AAT1290_MAX_MM_CURRENT(fl_max) (fl_max * AAT1290_MM_TO_FL_RATIO)
+
+#define AAT1290_LATCH_TIME_MIN_US  500
+#define AAT1290_LATCH_TIME_MAX_US  1000
+#define AAT1290_EN_SET_TICK_TIME_US1
+#define AAT1290_FLEN_OFF_DELAY_TIME_US 10
+#define AAT1290_FLASH_TM_NUM_LEVELS16
+#define AAT1290_MM_CURRENT_SCALE_SIZE  15
+
+struct aat1290_led_settings {
+   struct led_flash_setting flash_timeout;
+};
+
+struct aat1290_led {
+   /* platform device data */
+   struct platform_device *pdev;
+   /* secures access to the device */
+   struct mutex lock;
+
+   /* related LED Flash class device */
+   struct led_classdev_flash fled_cdev;
+
+   /* FLEN pin */
+   int flen_gpio;
+   /* EN|SET pin  */
+   int en_set_gpio;
+
+   /* maximum flash timeout */
+   u32 max_flash_tm;
+   /* maximum LED current in flash mode */
+   u32 max_flash_current;
+   /* device mode */
+   bool movie_mode;
+
+   /* brightness cache */
+   unsigned int torch_brightness;
+   /* assures led-triggers compatibility */
+   struct work_struct work_brightness_set;
+};
+
+static struct aat1290_led *fled_cdev_to_led(
+   struct led_classdev_flash *fled_cdev)
+{
+   return container_of(fled_cdev, struct aat1290_led, fled_cdev);
+}
+
+static void aat1290_as2cwire_write(struct aat1290_led *led, int addr, int 
value)
+{
+   int i;
+
+   gpio_set_value(led-flen_gpio, 0);
+   gpio_set_value(led-en_set_gpio, 0);
+
+   udelay(AAT1290_FLEN_OFF_DELAY_TIME_US);
+
+   /* write address */
+   for (i = 0; i  addr; ++i) {
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led-en_set_gpio, 0);
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led-en_set_gpio, 1);
+   }
+
+   

[PATCH/RFC v11 10/20] DT: Add documentation for the mfd Maxim max77693

2015-02-18 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
the flash cell of the Maxim max77693 multifunctional device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Lee Jones lee.jo...@linaro.org
Cc: Chanwoo Choi cw00.c...@samsung.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
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
---
 Documentation/devicetree/bindings/mfd/max77693.txt |   61 
 1 file changed, 61 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt 
b/Documentation/devicetree/bindings/mfd/max77693.txt
index 38e6440..ab8fbd5 100644
--- a/Documentation/devicetree/bindings/mfd/max77693.txt
+++ b/Documentation/devicetree/bindings/mfd/max77693.txt
@@ -76,7 +76,53 @@ Optional properties:
 Valid values: 430, 470, 480, 490
 Default: 430
 
+- led : the LED submodule device node
+
+There are two LED outputs available - FLED1 and FLED2. Each of them can
+control a separate LED or they can be connected together to double
+the maximum current for a single connected LED. One LED is represented
+by one child node.
+
+Required properties:
+- compatible : Must be maxim,max77693-led.
+
+Optional properties:
+- maxim,trigger-type : Flash trigger type.
+   Possible trigger types:
+   LEDS_TRIG_TYPE_EDGE (0) - Rising edge of the signal triggers
+   the flash,
+   LEDS_TRIG_TYPE_LEVEL (1) - Strobe pulse length controls duration
+   of the flash.
+- maxim,boost-mode :
+   In boost mode the device can produce up to 1.2A of total current
+   on both outputs. The maximum current on each output is reduced
+   to 625mA then. If not enabled explicitly, boost setting defaults to
+   LEDS_BOOST_FIXED in case both current sources are used.
+   Possible values:
+   LEDS_BOOST_OFF (0) - no boost,
+   LEDS_BOOST_ADAPTIVE (1) - adaptive mode,
+   LEDS_BOOST_FIXED (2) - fixed mode.
+- maxim,boost-mvout : Output voltage of the boost module in millivolts.
+- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired
+   if chip estimates that system voltage could drop below this level due
+   to flash power consumption.
+
+Required properties of the LED child node:
+- label : see Documentation/devicetree/bindings/leds/common.txt
+- led-sources : see Documentation/devicetree/bindings/leds/common.txt;
+   device current output identifiers: 0 - FLED1, 1 - FLED2
+
+Optional properties of the LED child node:
+- max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 15625 - 25
+- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 15625 - 100
+- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 62500 - 100
+
 Example:
+#include dt-bindings/leds/max77693.h
+
max77693@66 {
compatible = maxim,max77693;
reg = 0x66;
@@ -117,5 +163,20 @@ Example:
maxim,thermal-regulation-celsius = 75;
maxim,battery-overcurrent-microamp = 300;
maxim,charge-input-threshold-microvolt = 430;
+
+   led {
+   compatible = maxim,max77693-led;
+   maxim,trigger-type = LEDS_TRIG_TYPE_LEVEL;
+   maxim,boost-mode = LEDS_BOOST_FIXED;
+   maxim,boost-mvout = 5000;
+   maxim,mvsys-min = 2400;
+
+   camera_flash: flash-led {
+   label = max77693-flash1;
+   led-sources = 0, 1;
+   max-microamp = 50;
+   flash-max-microamp = 125;
+   flash-timeout-us = 100;
+   };
};
};
-- 
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/RFC v11 17/20] Documentation: leds: Add description of v4l2-flash sub-device

2015-02-18 Thread Jacek Anaszewski
This patch extends LED Flash class documention by
the description of interactions with v4l2-flash sub-device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Sakari Ailus sakari.ai...@linux.intel.com
Cc: Bryan Wu coolo...@gmail.com
Cc: Richard Purdie rpur...@rpsys.net
---
 Documentation/leds/leds-class-flash.txt |   13 +
 1 file changed, 13 insertions(+)

diff --git a/Documentation/leds/leds-class-flash.txt 
b/Documentation/leds/leds-class-flash.txt
index ff03a66..dc46ae0 100644
--- a/Documentation/leds/leds-class-flash.txt
+++ b/Documentation/leds/leds-class-flash.txt
@@ -30,3 +30,16 @@ Following sysfs attributes are exposed for controlling flash 
LED devices:
- available_sync_leds
- flash_sync_strobe
- flash_fault
+
+A LED subsystem driver can be controlled also from the level of VideoForLinux2
+subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to
+be defined in the kernel config. The driver must call the v4l2_flash_init
+function to get registered in the V4L2 subsystem. On remove the
+v4l2_flash_release function has to be called (see media/v4l2-flash.h).
+
+After proper initialization a V4L2 Flash sub-device is created. The sub-device
+exposes a number of V4L2 controls, which allow for controlling a LED Flash 
class
+device with use of its internal kernel API.
+Opening the V4L2 Flash sub-device makes the LED subsystem sysfs interface
+unavailable. The interface is re-enabled after the V4L2 Flash sub-device
+is closed.
-- 
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/RFC v11 14/20] exynos4-is: Add support for v4l2-flash subdevs

2015-02-18 Thread Jacek Anaszewski
This patch adds support for external v4l2-flash devices.
The support includes parsing flashes DT property
and asynchronous subdevice registration.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/exynos4-is/media-dev.c |   36 +++--
 drivers/media/platform/exynos4-is/media-dev.h |   13 -
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index f315ef9..8dd0e5d 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -451,6 +451,25 @@ rpm_put:
return ret;
 }
 
+static void fimc_md_register_flash_entities(struct fimc_md *fmd)
+{
+   struct device_node *parent = fmd-pdev-dev.of_node;
+   struct device_node *np;
+   int i = 0;
+
+   do {
+   np = of_parse_phandle(parent, flashes, i);
+   if (np) {
+   fmd-flash[fmd-num_flashes].asd.match_type =
+   V4L2_ASYNC_MATCH_OF;
+   fmd-flash[fmd-num_flashes].asd.match.of.node = np;
+   fmd-num_flashes++;
+   fmd-async_subdevs[fmd-num_sensors + i] =
+   fmd-flash[i].asd;
+   }
+   } while (np  (++i  FIMC_MAX_FLASHES));
+}
+
 static int __of_get_csis_id(struct device_node *np)
 {
u32 reg = 0;
@@ -1275,6 +1294,15 @@ static int subdev_notifier_bound(struct 
v4l2_async_notifier *notifier,
struct fimc_sensor_info *si = NULL;
int i;
 
+   /* Register flash subdev if detected any */
+   for (i = 0; i  ARRAY_SIZE(fmd-flash); i++) {
+   if (fmd-flash[i].asd.match.of.node == subdev-dev-of_node) {
+   fmd-flash[i].subdev = subdev;
+   fmd-num_flashes++;
+   return 0;
+   }
+   }
+
/* Find platform data for this sensor subdev */
for (i = 0; i  ARRAY_SIZE(fmd-sensor); i++)
if (fmd-sensor[i].asd.match.of.node == subdev-dev-of_node)
@@ -1385,6 +1413,8 @@ static int fimc_md_probe(struct platform_device *pdev)
goto err_m_ent;
}
 
+   fimc_md_register_flash_entities(fmd);
+
mutex_unlock(fmd-media_dev.graph_mutex);
 
ret = device_create_file(pdev-dev, dev_attr_subdev_conf_mode);
@@ -1401,12 +1431,14 @@ static int fimc_md_probe(struct platform_device *pdev)
goto err_attr;
}
 
-   if (fmd-num_sensors  0) {
+   if (fmd-num_sensors  0 || fmd-num_flashes  0) {
fmd-subdev_notifier.subdevs = fmd-async_subdevs;
-   fmd-subdev_notifier.num_subdevs = fmd-num_sensors;
+   fmd-subdev_notifier.num_subdevs = fmd-num_sensors +
+   fmd-num_flashes;
fmd-subdev_notifier.bound = subdev_notifier_bound;
fmd-subdev_notifier.complete = subdev_notifier_complete;
fmd-num_sensors = 0;
+   fmd-num_flashes = 0;
 
ret = v4l2_async_notifier_register(fmd-v4l2_dev,
fmd-subdev_notifier);
diff --git a/drivers/media/platform/exynos4-is/media-dev.h 
b/drivers/media/platform/exynos4-is/media-dev.h
index 0321454..feff9c8 100644
--- a/drivers/media/platform/exynos4-is/media-dev.h
+++ b/drivers/media/platform/exynos4-is/media-dev.h
@@ -34,6 +34,8 @@
 
 #define FIMC_MAX_SENSORS   4
 #define FIMC_MAX_CAMCLKS   2
+#define FIMC_MAX_FLASHES   2
+#define FIMC_MAX_ASYNC_SUBDEVS (FIMC_MAX_SENSORS + FIMC_MAX_FLASHES)
 #define DEFAULT_SENSOR_CLK_FREQ2400U
 
 /* LCD/ISP Writeback clocks (PIXELASYNCMx) */
@@ -93,6 +95,11 @@ struct fimc_sensor_info {
struct fimc_dev *host;
 };
 
+struct fimc_flash_info {
+   struct v4l2_subdev *subdev;
+   struct v4l2_async_subdev asd;
+};
+
 struct cam_clk {
struct clk_hw hw;
struct fimc_md *fmd;
@@ -104,6 +111,8 @@ struct cam_clk {
  * @csis: MIPI CSIS subdevs data
  * @sensor: array of registered sensor subdevs
  * @num_sensors: actual number of registered sensors
+ * @flash: array of registered flash subdevs
+ * @num_flashes: actual number of registered flashes
  * @camclk: external sensor clock information
  * @fimc: array of registered fimc devices
  * @fimc_is: fimc-is data structure
@@ -123,6 +132,8 @@ struct fimc_md {
struct fimc_csis_info csis[CSIS_MAX_ENTITIES];
struct fimc_sensor_info sensor[FIMC_MAX_SENSORS];
int num_sensors;
+   struct fimc_flash_info flash[FIMC_MAX_FLASHES];
+   int num_flashes;
struct fimc_camclk_info camclk[FIMC_MAX_CAMCLKS];
struct clk *wbclk[FIMC_MAX_WBCLKS];
struct 

[PATCH/RFC v11 12/20] of: Add Skyworks Solutions, Inc. vendor prefix

2015-02-18 Thread Jacek Anaszewski
Use skyworks as the vendor prefix for the Skyworks Solutions, Inc.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@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
---
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 389ca13..9276e7f 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -153,6 +153,7 @@ ricoh   Ricoh Co. Ltd.
 rockchip   Fuzhou Rockchip Electronics Co., Ltd
 samsungSamsung Semiconductor
 sandiskSandisk Corporation
+skyworks   Skyworks Solutions, Inc.
 sbsSmart Battery System
 schindler  Schindler
 seagateSeagate Technology PLC
-- 
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/RFC v11 18/20] DT: Add documentation for exynos4-is 'flashes' property

2015-02-18 Thread Jacek Anaszewski
This patch adds a description of 'flashes' property
to the samsung-fimc.txt.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: 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
---
 .../devicetree/bindings/media/samsung-fimc.txt |8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/samsung-fimc.txt 
b/Documentation/devicetree/bindings/media/samsung-fimc.txt
index 922d6f8..cb0e263 100644
--- a/Documentation/devicetree/bindings/media/samsung-fimc.txt
+++ b/Documentation/devicetree/bindings/media/samsung-fimc.txt
@@ -40,6 +40,13 @@ should be inactive. For the active-a state the camera port 
A must be activated
 and the port B deactivated and for the state active-b it should be the other
 way around.
 
+Optional properties:
+
+- flashes - Array of phandles to the flash LEDs that can be controlled by the
+   sub-devices contained in this media device. Flash LED is
+   represented by a child node of a flash LED device
+   (see Documentation/devicetree/bindings/leds/common.txt).
+
 The 'camera' node must include at least one 'fimc' child node.
 
 
@@ -166,6 +173,7 @@ Example:
clock-output-names = cam_a_clkout, cam_b_clkout;
pinctrl-names = default;
pinctrl-0 = cam_port_a_clk_active;
+   flashes = camera_flash, system_torch;
status = okay;
#address-cells = 1;
#size-cells = 1;
-- 
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/RFC v11 16/20] media: Add registration helpers for V4L2 flash sub-devices

2015-02-18 Thread Jacek Anaszewski
This patch adds helper functions for registering/unregistering
LED Flash class devices as V4L2 sub-devices. The functions should
be called from the LED subsystem device driver. In case the
support for V4L2 Flash sub-devices is disabled in the kernel
config the functions' empty versions will be used.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/Kconfig  |   11 +
 drivers/media/v4l2-core/Makefile |2 +
 drivers/media/v4l2-core/v4l2-flash.c |  640 ++
 include/media/v4l2-flash.h   |  146 
 4 files changed, 799 insertions(+)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
 create mode 100644 include/media/v4l2-flash.h

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index ba7e21a..f034f1a 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV
 tristate
 depends on VIDEOBUF2_CORE
 
+# Used by LED subsystem flash drivers
+config V4L2_FLASH_LED_CLASS
+   tristate Enable support for Flash sub-devices
+   depends on VIDEO_V4L2_SUBDEV_API
+   depends on LEDS_CLASS_FLASH
+   ---help---
+ Say Y here to enable support for Flash sub-devices, which allow
+ to control LED class devices with use of V4L2 Flash controls.
+
+ When in doubt, say N.
+
 # Used by drivers that need Videobuf modules
 config VIDEOBUF_GEN
tristate
diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile
index 63d29f2..44e858c 100644
--- a/drivers/media/v4l2-core/Makefile
+++ b/drivers/media/v4l2-core/Makefile
@@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o
 
 obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
 
+obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash.o
+
 obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
 obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
 obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
diff --git a/drivers/media/v4l2-core/v4l2-flash.c 
b/drivers/media/v4l2-core/v4l2-flash.c
new file mode 100644
index 000..bb38216
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash.c
@@ -0,0 +1,640 @@
+/*
+ * V4L2 Flash LED sub-device registration helpers.
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd
+ * Author: Jacek Anaszewski j.anaszew...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/led-class-flash.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/slab.h
+#include linux/types.h
+#include media/v4l2-flash.h
+
+#define has_flash_op(v4l2_flash, op)   \
+   (v4l2_flash  v4l2_flash-ops-op)
+
+#define call_flash_op(v4l2_flash, op, arg) \
+   (has_flash_op(v4l2_flash, op) ? \
+   v4l2_flash-ops-op(v4l2_flash, arg) :  \
+   -EINVAL)
+
+static enum led_brightness __intensity_to_led_brightness(
+   struct v4l2_ctrl *ctrl,
+   s32 intensity)
+{
+   s64 intensity64 = intensity - ctrl-minimum;
+
+   do_div(intensity64, ctrl-step);
+
+   /*
+* Indicator LEDs, unlike torch LEDs, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Therefore it must be possible to set it to 0 level which in
+* the LED subsystem reflects LED_OFF state.
+*/
+   if (ctrl-id != V4L2_CID_FLASH_INDICATOR_INTENSITY)
+   ++intensity64;
+
+   return intensity64;
+}
+
+static s32 __led_brightness_to_intensity(struct v4l2_ctrl *ctrl,
+enum led_brightness brightness)
+{
+   /*
+* Indicator LEDs, unlike torch LEDs, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Do not decrement brightness read from the LED subsystem for
+* indicator LED as it may equal 0. For torch LEDs this function
+* is called only when V4L2_FLASH_LED_MODE_TORCH is set and the
+* brightness read is guaranteed to be greater than 0. In the mode
+* V4L2_FLASH_LED_MODE_NONE the cached torch intensity value is used.
+*/
+   if (ctrl-id != V4L2_CID_FLASH_INDICATOR_INTENSITY)
+   --brightness;
+
+   return (brightness * ctrl-step) + ctrl-minimum;
+}
+
+static void v4l2_flash_set_led_brightness(struct v4l2_flash *v4l2_flash,
+   struct v4l2_ctrl *ctrl)
+{
+   struct v4l2_ctrl **ctrls = v4l2_flash-ctrls;
+   enum led_brightness brightness;
+
+   if 

[PATCH/RFC v11 15/20] v4l2-ctrls: Add V4L2_CID_FLASH_SYNC_STROBE control

2015-02-18 Thread Jacek Anaszewski
Add V4L2_CID_FLASH_SYNC_STROBE control for determining
whether a flash device strobe has to be synchronized
with other flash leds controller by the same device.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Sakari Ailus sakari.ai...@iki.fi
---
 Documentation/DocBook/media/v4l/controls.xml |9 +
 drivers/media/v4l2-core/v4l2-ctrls.c |2 ++
 include/uapi/linux/v4l2-controls.h   |1 +
 3 files changed, 12 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 4e9462f..434d020 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4562,6 +4562,15 @@ interface and may change in the future./para
after strobe during which another strobe will not be
possible. This is a read-only control./entry
  /row
+ row
+entry 
spanname=idconstantV4L2_CID_FLASH_SYNC_STROBE/constant/entry
+entrymenu/entry
+ /row
+ row
+   entry spanname=descrSynchronized strobe: whether the flash
+   should be strobed synchronously with the other one controlled
+   by the same device./entry
+ /row
  rowentry/entry/row
/tbody
   /tgroup
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 45c5b47..4bc7e00 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -846,6 +846,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_FLASH_FAULT:  return Faults;
case V4L2_CID_FLASH_CHARGE: return Charge;
case V4L2_CID_FLASH_READY:  return Ready to Strobe;
+   case V4L2_CID_FLASH_SYNC_STROBE:return Synchronize Strobe;
 
/* JPEG encoder controls */
/* Keep the order of the 'case's the same as in v4l2-controls.h! */
@@ -1041,6 +1042,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_TUNE_DEEMPHASIS:
case V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL:
case V4L2_CID_DETECT_MD_MODE:
+   case V4L2_CID_FLASH_SYNC_STROBE:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_LINK_FREQ:
diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index 9f6e108..7084696 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -837,6 +837,7 @@ enum v4l2_flash_strobe_source {
 
 #define V4L2_CID_FLASH_CHARGE  (V4L2_CID_FLASH_CLASS_BASE + 11)
 #define V4L2_CID_FLASH_READY   (V4L2_CID_FLASH_CLASS_BASE + 12)
+#define V4L2_CID_FLASH_SYNC_STROBE (V4L2_CID_FLASH_CLASS_BASE + 13)
 
 
 /* JPEG-class control IDs */
-- 
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/RFC v11 13/20] DT: Add documentation for the Skyworks AAT1290

2015-02-18 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
1.5A Step-Up Current Regulator for Flash LEDs.

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
---
 .../devicetree/bindings/leds/leds-aat1290.txt  |   43 
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-aat1290.txt 
b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
new file mode 100644
index 000..78aa7da
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
@@ -0,0 +1,43 @@
+* Skyworks Solutions, Inc. AAT1290 Current Regulator for Flash LEDs
+
+The device is controlled through two pins: FL_EN and EN_SET. The pins when,
+asserted high, enable flash strobe and movie mode (max 1/2 of flash current)
+respectively. In order to add a capability of selecting the strobe signal 
source
+(e.g. GPIO or camera sensor) there is an additional switch required, 
independent
+of the flash chip.
+
+Such a switch is provided on the exynos4412-trats2 board. The switch is
+configured so that it is possible to change EN_SET and FL_EN signal sources
+simultaneously with one GPIO. This gpio can be provided in the third element
+of 'gpios ' property.
+
+Required properties:
+
+- compatible : Must be skyworks,aat1290.
+- gpios : Two gpio pins in order FLEN, EN/SET, and optional third
+ HW_FLASH_EN gpio for controlling the HW_FLASH_SW mux.
+
+The LED connected to the device must be represented by a child node -
+see Documentation/devicetree/bindings/leds/common.txt.
+
+Required properties of the LED child node:
+- label : see Documentation/devicetree/bindings/leds/common.txt
+- flash-max-microamp : Maximum intensity in microamperes of the flash LED -
+  it can be calculated using following formula:
+  I = 1A * 162kohm / Rset
+- flash-timeout-us : Maximum flash timeout in microseconds -
+it can be calculated using following formula:
+T = 8.82 * 10^9 * Ct.
+
+Example (by Ct = 220nF, Rset = 160kohm)
+
+aat1290 {
+   compatible = skyworks,aat1290;
+   gpios = gpj1 1 0, gpj1 2 0, gpj1 0 0;
+
+   camera_flash: flash-led {
+   label = aat1290-flash;
+   flash-max-microamp = 1012500
+   flash-timeout-us = 194;
+   };
+};
-- 
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/RFC v11 20/20] leds: aat1290: add support for V4L2 Flash sub-device

2015-02-18 Thread Jacek Anaszewski
Add support for V4L2 Flash sub-device to the aat1290 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

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
Cc: Sakari Ailus sakari.ai...@linux.intel.com
---
 drivers/leds/leds-aat1290.c |  163 +++
 1 file changed, 163 insertions(+)

diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
index b217f0a..0e32be7 100644
--- a/drivers/leds/leds-aat1290.c
+++ b/drivers/leds/leds-aat1290.c
@@ -20,6 +20,7 @@
 #include linux/of_gpio.h
 #include linux/platform_device.h
 #include linux/slab.h
+#include media/v4l2-flash.h
 #include linux/workqueue.h
 
 #define AAT1290_MOVIE_MODE_CURRENT_ADDR17
@@ -46,6 +47,9 @@
 #define AAT1290_MM_CURRENT_SCALE_SIZE  15
 
 struct aat1290_led_settings {
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   struct led_flash_setting torch_brightness;
+#endif
struct led_flash_setting flash_timeout;
 };
 
@@ -57,11 +61,19 @@ struct aat1290_led {
 
/* related LED Flash class device */
struct led_classdev_flash fled_cdev;
+   /* V4L2 Flash device */
+   struct v4l2_flash *v4l2_flash;
 
/* FLEN pin */
int flen_gpio;
/* EN|SET pin  */
int en_set_gpio;
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   /* chooses flash strobe source - external or SoC gpio */
+   int ext_strobe_gpio;
+   /* movie mode current scale */
+   int *mm_current_scale;
+#endif
 
/* maximum flash timeout */
u32 max_flash_tm;
@@ -279,6 +291,15 @@ static void aat1290_init_flash_settings(struct aat1290_led 
*led,
 {
struct led_flash_setting *setting;
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   /* Init flash intensity setting */
+   setting = s-torch_brightness;
+   setting-min = led-mm_current_scale[0];
+   setting-max = led-mm_current_scale[AAT1290_MM_CURRENT_SCALE_SIZE - 1];
+   setting-step = 1;
+   setting-val = setting-max;
+#endif
+
/* Init flash timeout setting */
setting = s-flash_timeout;
setting-min = led-max_flash_tm / AAT1290_FLASH_TM_NUM_LEVELS;
@@ -287,6 +308,97 @@ static void aat1290_init_flash_settings(struct aat1290_led 
*led,
setting-val = setting-max;
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+enum led_brightness aat1290_intensity_to_brightness(
+   struct v4l2_flash *v4l2_flash,
+   s32 intensity)
+{
+   struct led_classdev_flash *fled_cdev = v4l2_flash-fled_cdev;
+   struct aat1290_led *led = fled_cdev_to_led(fled_cdev);
+   int i;
+
+   for (i = AAT1290_MM_CURRENT_SCALE_SIZE - 1; i = 0; --i)
+   if (intensity = led-mm_current_scale[i])
+   return i + 1;
+
+   return 1;
+}
+
+s32 aat1290_brightness_to_intensity(struct v4l2_flash *v4l2_flash,
+   enum led_brightness brightness)
+{
+   struct led_classdev_flash *fled_cdev = v4l2_flash-fled_cdev;
+   struct aat1290_led *led = fled_cdev_to_led(fled_cdev);
+
+   return led-mm_current_scale[brightness - 1];
+}
+
+static int aat1290_led_external_strobe_set(struct v4l2_flash *v4l2_flash,
+   bool enable)
+{
+   struct aat1290_led *led = fled_cdev_to_led(v4l2_flash-fled_cdev);
+
+   led-movie_mode = false;
+   gpio_set_value(led-flen_gpio, 0);
+   gpio_set_value(led-en_set_gpio, 0);
+   gpio_set_value(led-ext_strobe_gpio, enable);
+
+   return 0;
+}
+
+int init_mm_current_scale(struct aat1290_led *led)
+{
+   int max_mm_current_percent[] = { 20, 22, 25, 28, 32, 36, 40, 45, 50, 56,
+   63, 71, 79, 89, 100 };
+   int i, max_mm_current = AAT1290_MAX_MM_CURRENT(led-max_flash_current);
+
+   led-mm_current_scale = devm_kzalloc(led-pdev-dev,
+   sizeof(max_mm_current_percent),
+   GFP_KERNEL);
+   if (!led-mm_current_scale)
+   return -ENOMEM;
+
+   for (i = 0; i  AAT1290_MM_CURRENT_SCALE_SIZE; ++i)
+   led-mm_current_scale[i] = max_mm_current *
+ max_mm_current_percent[i] / 100;
+
+   return 0;
+}
+
+static void aat1290_init_v4l2_ctrl_config(struct aat1290_led *led,
+   struct aat1290_led_settings *s,
+   struct v4l2_flash_ctrl_config *config)
+{
+   struct led_flash_setting *setting;
+   struct v4l2_ctrl_config *c;
+
+   c = config-intensity;
+   setting = s-torch_brightness;
+   c-min = setting-min;
+   c-max = setting-max;
+   c-step = 

[PATCH/RFC v11 19/20] leds: max77693: add support for V4L2 Flash sub-device

2015-02-18 Thread Jacek Anaszewski
Add support for V4L2 Flash sub-device to the max77693 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

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
Cc: Sakari Ailus sakari.ai...@linux.intel.com
---
 drivers/leds/leds-max77693.c |  149 +++---
 1 file changed, 141 insertions(+), 8 deletions(-)

diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
index 45d50d9..af06ca7 100644
--- a/drivers/leds/leds-max77693.c
+++ b/drivers/leds/leds-max77693.c
@@ -21,6 +21,7 @@
 #include linux/regmap.h
 #include linux/slab.h
 #include linux/workqueue.h
+#include media/v4l2-flash.h
 
 #define MODE_OFF   0
 #define MODE_FLASH(a)  (1  (a))
@@ -64,6 +65,8 @@ struct max77693_sub_led {
struct led_classdev_flash fled_cdev;
/* assures led-triggers compatibility */
struct work_struct work_brightness_set;
+   /* V4L2 Flash device */
+   struct v4l2_flash *v4l2_flash;
 
/* brightness cache */
unsigned int torch_brightness;
@@ -640,6 +643,32 @@ unlock:
return ret;
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+static int max77693_led_external_strobe_set(
+   struct v4l2_flash *v4l2_flash,
+   bool enable)
+{
+   struct max77693_sub_led *sub_led =
+   flcdev_to_sub_led(v4l2_flash-fled_cdev);
+   struct max77693_led_device *led = sub_led_to_led(sub_led);
+   int fled_id = sub_led-fled_id;
+   int ret;
+
+   mutex_lock(led-lock);
+
+   if (enable)
+   ret = max77693_add_mode(led, MODE_FLASH_EXTERNAL(fled_id));
+   else
+   ret = max77693_clear_mode(led, MODE_FLASH_EXTERNAL(fled_id));
+
+   mutex_unlock(led-lock);
+
+   return ret;
+}
+#else
+#define max77693_led_external_strobe_set(v4l2_flash, enable) (NULL)
+#endif
+
 static int max77693_led_flash_fault_get(
struct led_classdev_flash *fled_cdev,
u32 *fault)
@@ -688,7 +717,8 @@ static int max77693_led_flash_timeout_set(
 }
 
 static int max77693_led_parse_dt(struct max77693_led_device *led,
-   struct max77693_led_config_data *cfg)
+   struct max77693_led_config_data *cfg,
+   struct device_node **sub_nodes)
 {
struct device *dev = led-pdev-dev;
struct max77693_sub_led *sub_leds = led-sub_leds;
@@ -734,6 +764,13 @@ static int max77693_led_parse_dt(struct 
max77693_led_device *led,
return -EINVAL;
}
 
+   if (sub_nodes[fled_id]) {
+   dev_err(dev,
+   Conflicting \led-sources\ DT properties\n);
+   return -EINVAL;
+   }
+
+   sub_nodes[fled_id] = child_node;
sub_leds[fled_id].fled_id = fled_id;
 
ret = of_property_read_string(child_node, label,
@@ -825,11 +862,12 @@ static void max77693_led_validate_configuration(struct 
max77693_led_device *led,
 }
 
 static int max77693_led_get_configuration(struct max77693_led_device *led,
-   struct max77693_led_config_data *cfg)
+   struct max77693_led_config_data *cfg,
+   struct device_node **sub_nodes)
 {
int ret;
 
-   ret = max77693_led_parse_dt(led, cfg);
+   ret = max77693_led_parse_dt(led, cfg, sub_nodes);
if (ret  0)
return ret;
 
@@ -853,6 +891,12 @@ static const struct led_flash_ops flash_ops = {
.fault_get  = max77693_led_flash_fault_get,
 };
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+static const struct v4l2_flash_ops v4l2_flash_ops = {
+   .external_strobe_set = max77693_led_external_strobe_set,
+};
+#endif
+
 static void max77693_init_flash_settings(struct max77693_led_device *led,
 int fled_id,
 struct max77693_led_config_data *cfg,
@@ -887,6 +931,46 @@ static void max77693_init_flash_settings(struct 
max77693_led_device *led,
setting-val = setting-max;
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+static void max77693_init_v4l2_ctrl_config(int fled_id,
+   struct max77693_led_settings *s,
+   struct v4l2_flash_ctrl_config *config)
+{
+   struct led_flash_setting *setting;
+   struct v4l2_ctrl_config *c;
+
+   c = config-intensity;
+   setting = s-torch_brightness;
+   c-min = setting-min;
+   c-max = setting-max;
+   c-step = setting-step;
+   c-def = setting-val;
+
+   c = 

Re: Using the coda driver with Gstreamer

2015-02-18 Thread Nicolas Dufresne


Le 2015-02-18 03:42, Zahari Doychev a écrit :

gst-launch-1.0 filesrc
location=/home/H264_test1_Talkinghead_mp4_480x360.mp4 ! qtdemux !
h264parse ! v4l2video1dec ! videoconvert ! fbdevsink

I am using this pipeline with gstreamer 1.4.5 and current media branch but I am
getting very poor performance 1-2 fps when playing 800x400 video. Is it possible
that fbdevsink is too slow for that? Does anyone know what is going wrong?
In this context, you most likely have a conversion happening in 
videoconvert followed by a copy at fbdevsink. Framebuffer device is not 
a very good solution if performance matter (no possible zero-copy). 
Specially if the selected framebuffer color format does not match the 
decoded format.


Nicolas
--
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/7] [media] dvb core: rename the media controller entities

2015-02-18 Thread Mauro Carvalho Chehab
Prefix all DVB media controller entities with dvb- and use dash
instead of underline at the names.

Requested-by: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
index 2835924955a4..d0e3f9d85f34 100644
--- a/drivers/media/dvb-core/dmxdev.c
+++ b/drivers/media/dvb-core/dmxdev.c
@@ -1141,7 +1141,7 @@ static const struct dvb_device dvbdev_demux = {
.users = 1,
.writers = 1,
 #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
-   .name = demux,
+   .name = dvb-demux,
 #endif
.fops = dvb_demux_fops
 };
@@ -1217,7 +1217,7 @@ static const struct dvb_device dvbdev_dvr = {
.readers = 1,
.users = 1,
 #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
-   .name = dvr,
+   .name = dvb-dvr,
 #endif
.fops = dvb_dvr_fops
 };
diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c 
b/drivers/media/dvb-core/dvb_ca_en50221.c
index 2bf28eb97a64..55a217f0ad0e 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb-core/dvb_ca_en50221.c
@@ -1644,7 +1644,7 @@ static const struct dvb_device dvbdev_ca = {
.readers = 1,
.writers = 1,
 #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
-   .name = ca_en50221,
+   .name = dvb-ca-en50221,
 #endif
.fops = dvb_ca_fops,
 };
diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
index 40990058b4bc..1508d918205d 100644
--- a/drivers/media/dvb-core/dvb_net.c
+++ b/drivers/media/dvb-core/dvb_net.c
@@ -1467,7 +1467,7 @@ static const struct dvb_device dvbdev_net = {
.users = 1,
.writers = 1,
 #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
-   .name = dvb net,
+   .name = dvb-net,
 #endif
.fops = dvb_net_fops,
 };
-- 
2.1.0

--
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/7] [media] dvb-frontend: remove a warning

2015-02-18 Thread Mauro Carvalho Chehab
if CONFIG_MEDIA_CONTROLLER_DVB is not selected, it is now
producing this warning:

drivers/media/dvb-core/dvb_frontend.c: In function ‘dvb_frontend_thread’:
drivers/media/dvb-core/dvb_frontend.c:695:6: warning: unused variable ‘ret’ 
[-Wunused-variable]
  int ret;
  ^

Reported-by: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index aa5306908193..d7d390c5c7c3 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -692,7 +692,9 @@ static int dvb_frontend_thread(void *data)
struct dvb_frontend_private *fepriv = fe-frontend_priv;
fe_status_t s;
enum dvbfe_algo algo;
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
int ret;
+#endif
 
bool re_tune = false;
bool semheld = false;
-- 
2.1.0

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


[PATCH 5/7] [media] cx25840: better document the media controller TODO

2015-02-18 Thread Mauro Carvalho Chehab
Analog video inputs are the tuner, plus composite, svideo, etc,
 e. g. the input pat should actually be like:

___
TUNER  | |
| |
SVIDEO ... | cx25840 |
| |
COMPOSITE1 ... |_|

(in the above, dashes represent the enabled link, and periods
represent the disabled ones)

In other words, if we want to properly represent the pipeline,
it should be possible to see via the media controller if the tuner
is being used as an image source, or if the source is something else.

I didn't map those other inputs here yet, due to a few things:
- The extra inputs would require subdevs that won't be controlled
- I was in doubt about the best way for doing that
- That would likely require some extra setup for cx25840 caller
  drivers, in order to represent what of the possible internal
  inputs are actually used on each specific board

Actually, at least for now, I was unable to see much benefit
on adding such map now, so let's just document it, as this could
be added later on, as needed.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/i2c/cx25840/cx25840-core.c 
b/drivers/media/i2c/cx25840/cx25840-core.c
index bdb5bb6b58da..cb4e03de9b75 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -5182,7 +5182,20 @@ static int cx25840_probe(struct i2c_client *client,
sd = state-sd;
v4l2_i2c_subdev_init(sd, client, cx25840_ops);
 #if defined(CONFIG_MEDIA_CONTROLLER)
-   /* TODO: need to represent analog inputs too */
+   /*
+* TODO: add media controller support for analog video inputs like
+* composite, svideo, etc.
+* A real input pad for this analog demod would be like:
+* ___
+* TUNER  | |
+* | |
+* SVIDEO ... | cx25840 |
+* | |
+* COMPOSITE1 ... |_|
+*
+* However, at least for now, there's no much gain on modelling
+* those extra inputs. So, let's add it only when needed.
+*/
state-pads[0].flags = MEDIA_PAD_FL_SINK;   /* Tuner or input */
state-pads[1].flags = MEDIA_PAD_FL_SOURCE; /* Video */
state-pads[2].flags = MEDIA_PAD_FL_SOURCE; /* VBI */
-- 
2.1.0

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


[PATCH 7/7] [media] cx231xx: enable the analog tuner at buffer setup

2015-02-18 Thread Mauro Carvalho Chehab
buf_prepare callback is called for every queued buffer. This is
an overkill. Call it at buf_setup, as this should be enough.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 87c9e27505f4..f9e885fa153f 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -100,6 +100,75 @@ static struct cx231xx_fmt format[] = {
 };
 
 
+static int cx231xx_enable_analog_tuner(struct cx231xx *dev)
+{
+#ifdef CONFIG_MEDIA_CONTROLLER
+   struct media_device *mdev = dev-media_dev;
+   struct media_entity  *entity, *decoder = NULL, *source;
+   struct media_link *link, *found_link = NULL;
+   int i, ret, active_links = 0;
+
+   if (!mdev)
+   return 0;
+
+   /*
+* This will find the tuner that it is connected into the decoder.
+* Technically, this is not 100% correct, as the device may be
+* using an analog input instead of the tuner. However, as we can't
+* do DVB streaming  while the DMA engine is being used for V4L2,
+* this should be enough for the actual needs.
+*/
+   media_device_for_each_entity(entity, mdev) {
+   if (entity-type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
+   decoder = entity;
+   break;
+   }
+   }
+   if (!decoder)
+   return 0;
+
+   for (i = 0; i  decoder-num_links; i++) {
+   link = decoder-links[i];
+   if (link-sink-entity == decoder) {
+   found_link = link;
+   if (link-flags  MEDIA_LNK_FL_ENABLED)
+   active_links++;
+   break;
+   }
+   }
+
+   if (active_links == 1 || !found_link)
+   return 0;
+
+   source = found_link-source-entity;
+   for (i = 0; i  source-num_links; i++) {
+   struct media_entity *sink;
+   int flags = 0;
+
+   link = source-links[i];
+   sink = link-sink-entity;
+
+   if (sink == entity)
+   flags = MEDIA_LNK_FL_ENABLED;
+
+   ret = media_entity_setup_link(link, flags);
+   if (ret) {
+   dev_err(dev-dev,
+   Couldn't change link %s-%s to %s. Error %d\n,
+   source-name, sink-name,
+   flags ? enabled : disabled,
+   ret);
+   return ret;
+   } else
+   dev_dbg(dev-dev,
+   link %s-%s was %s\n,
+   source-name, sink-name,
+   flags ? ENABLED : disabled);
+   }
+#endif
+   return 0;
+}
+
 /* --
Video buffer and parser functions
--*/
@@ -667,6 +736,9 @@ buffer_setup(struct videobuf_queue *vq, unsigned int 
*count, unsigned int *size)
if (*count  CX231XX_MIN_BUF)
*count = CX231XX_MIN_BUF;
 
+
+   cx231xx_enable_analog_tuner(dev);
+
return 0;
 }
 
@@ -703,75 +775,6 @@ static void free_buffer(struct videobuf_queue *vq, struct 
cx231xx_buffer *buf)
buf-vb.state = VIDEOBUF_NEEDS_INIT;
 }
 
-static int cx231xx_enable_analog_tuner(struct cx231xx *dev)
-{
-#ifdef CONFIG_MEDIA_CONTROLLER
-   struct media_device *mdev = dev-media_dev;
-   struct media_entity  *entity, *decoder = NULL, *source;
-   struct media_link *link, *found_link = NULL;
-   int i, ret, active_links = 0;
-
-   if (!mdev)
-   return 0;
-
-   /*
-* This will find the tuner that it is connected into the decoder.
-* Technically, this is not 100% correct, as the device may be
-* using an analog input instead of the tuner. However, as we can't
-* do DVB streaming  while the DMA engine is being used for V4L2,
-* this should be enough for the actual needs.
-*/
-   media_device_for_each_entity(entity, mdev) {
-   if (entity-type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
-   decoder = entity;
-   break;
-   }
-   }
-   if (!decoder)
-   return 0;
-
-   for (i = 0; i  decoder-num_links; i++) {
-   link = decoder-links[i];
-   if (link-sink-entity == decoder) {
-   found_link = link;
-   if (link-flags  MEDIA_LNK_FL_ENABLED)
-   active_links++;
-   break;
-   }
-   }
-
-   if (active_links == 1 || !found_link)
-   return 0;
-
-   source = found_link-source-entity;
-  

Re: [PATCH 4/7] [media] dvb core: rename the media controller entities

2015-02-18 Thread Hans Verkuil
Hi Mauro,

On 02/18/2015 04:29 PM, Mauro Carvalho Chehab wrote:
 Prefix all DVB media controller entities with dvb- and use dash
 instead of underline at the names.
 
 Requested-by: Hans Verkuil hverk...@xs4all.nl
  ^^

For these foo-by lines please keep my hans.verk...@cisco.com email.
It's my way of thanking Cisco for allowing me to do this work. Not a
big deal, but if you can change that before committing?

Acked-by: Hans Verkuil hans.verk...@cisco.com

Regards,

Hans

 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
 
 diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
 index 2835924955a4..d0e3f9d85f34 100644
 --- a/drivers/media/dvb-core/dmxdev.c
 +++ b/drivers/media/dvb-core/dmxdev.c
 @@ -1141,7 +1141,7 @@ static const struct dvb_device dvbdev_demux = {
   .users = 1,
   .writers = 1,
  #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
 - .name = demux,
 + .name = dvb-demux,
  #endif
   .fops = dvb_demux_fops
  };
 @@ -1217,7 +1217,7 @@ static const struct dvb_device dvbdev_dvr = {
   .readers = 1,
   .users = 1,
  #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
 - .name = dvr,
 + .name = dvb-dvr,
  #endif
   .fops = dvb_dvr_fops
  };
 diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c 
 b/drivers/media/dvb-core/dvb_ca_en50221.c
 index 2bf28eb97a64..55a217f0ad0e 100644
 --- a/drivers/media/dvb-core/dvb_ca_en50221.c
 +++ b/drivers/media/dvb-core/dvb_ca_en50221.c
 @@ -1644,7 +1644,7 @@ static const struct dvb_device dvbdev_ca = {
   .readers = 1,
   .writers = 1,
  #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
 - .name = ca_en50221,
 + .name = dvb-ca-en50221,
  #endif
   .fops = dvb_ca_fops,
  };
 diff --git a/drivers/media/dvb-core/dvb_net.c 
 b/drivers/media/dvb-core/dvb_net.c
 index 40990058b4bc..1508d918205d 100644
 --- a/drivers/media/dvb-core/dvb_net.c
 +++ b/drivers/media/dvb-core/dvb_net.c
 @@ -1467,7 +1467,7 @@ static const struct dvb_device dvbdev_net = {
   .users = 1,
   .writers = 1,
  #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
 - .name = dvb net,
 + .name = dvb-net,
  #endif
   .fops = dvb_net_fops,
  };
 

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


Re: [PATCH 5/7] [media] cx25840: better document the media controller TODO

2015-02-18 Thread Hans Verkuil
On 02/18/2015 04:29 PM, Mauro Carvalho Chehab wrote:
 Analog video inputs are the tuner, plus composite, svideo, etc,
  e. g. the input pat should actually be like:
 
 ___
 TUNER  | |
 | |
 SVIDEO ... | cx25840 |
 | |
 COMPOSITE1 ... |_|
 
 (in the above, dashes represent the enabled link, and periods
 represent the disabled ones)
 
 In other words, if we want to properly represent the pipeline,
 it should be possible to see via the media controller if the tuner
 is being used as an image source, or if the source is something else.
 
 I didn't map those other inputs here yet, due to a few things:
 - The extra inputs would require subdevs that won't be controlled
 - I was in doubt about the best way for doing that
 - That would likely require some extra setup for cx25840 caller
   drivers, in order to represent what of the possible internal
   inputs are actually used on each specific board
 
 Actually, at least for now, I was unable to see much benefit
 on adding such map now, so let's just document it, as this could
 be added later on, as needed.
 
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

Acked-by: Hans Verkuil hans.verk...@cisco.com

 
 diff --git a/drivers/media/i2c/cx25840/cx25840-core.c 
 b/drivers/media/i2c/cx25840/cx25840-core.c
 index bdb5bb6b58da..cb4e03de9b75 100644
 --- a/drivers/media/i2c/cx25840/cx25840-core.c
 +++ b/drivers/media/i2c/cx25840/cx25840-core.c
 @@ -5182,7 +5182,20 @@ static int cx25840_probe(struct i2c_client *client,
   sd = state-sd;
   v4l2_i2c_subdev_init(sd, client, cx25840_ops);
  #if defined(CONFIG_MEDIA_CONTROLLER)
 - /* TODO: need to represent analog inputs too */
 + /*
 +  * TODO: add media controller support for analog video inputs like
 +  * composite, svideo, etc.
 +  * A real input pad for this analog demod would be like:
 +  * ___
 +  * TUNER  | |
 +  * | |
 +  * SVIDEO ... | cx25840 |
 +  * | |
 +  * COMPOSITE1 ... |_|
 +  *
 +  * However, at least for now, there's no much gain on modelling
 +  * those extra inputs. So, let's add it only when needed.
 +  */
   state-pads[0].flags = MEDIA_PAD_FL_SINK;   /* Tuner or input */
   state-pads[1].flags = MEDIA_PAD_FL_SOURCE; /* Video */
   state-pads[2].flags = MEDIA_PAD_FL_SOURCE; /* VBI */
 

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


Re: [PATCH 6/7] [media] cx231xx: Improve the media controller comment

2015-02-18 Thread Hans Verkuil
On 02/18/2015 04:30 PM, Mauro Carvalho Chehab wrote:
 There are two problems at the comment:
 - it is badly idented;
 - its comment doesn't mean anything.
 
 Fix it.
 
 Requested-by: Hans Verkuil hverk...@xs4all.nl
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
 
 diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
 b/drivers/media/usb/cx231xx/cx231xx-video.c
 index 634763535d60..87c9e27505f4 100644
 --- a/drivers/media/usb/cx231xx/cx231xx-video.c
 +++ b/drivers/media/usb/cx231xx/cx231xx-video.c
 @@ -714,12 +714,13 @@ static int cx231xx_enable_analog_tuner(struct cx231xx 
 *dev)
   if (!mdev)
   return 0;
  
 -/*
 - * This will find the tuner that it is connected into the decoder.
 - * Technically, this is not 100% correct, as the device may be using an
 - * analog input instead of the tuner. However, we can't use the DVB for dvb
 - * while the DMA engine is being used for V4L2.
 - */
 + /*
 +  * This will find the tuner that it is connected into the decoder.

s/that it is/that is/

 +  * Technically, this is not 100% correct, as the device may be
 +  * using an analog input instead of the tuner. However, as we can't
 +  * do DVB streaming  while the DMA engine is being used for V4L2,

Two spaces between 'streaming' and 'while'. I know, a nitpick :-)

With those changes:

Acked-by: Hans Verkuil hans.verk...@cisco.com

Regards,

Hans

 +  * this should be enough for the actual needs.
 +  */
   media_device_for_each_entity(entity, mdev) {
   if (entity-type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
   decoder = entity;
 

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


Re: [PATCH 7/7] [media] cx231xx: enable the analog tuner at buffer setup

2015-02-18 Thread Hans Verkuil
On 02/18/2015 04:30 PM, Mauro Carvalho Chehab wrote:
 buf_prepare callback is called for every queued buffer. This is
 an overkill. Call it at buf_setup, as this should be enough.
 
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
 
 diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
 b/drivers/media/usb/cx231xx/cx231xx-video.c
 index 87c9e27505f4..f9e885fa153f 100644
 --- a/drivers/media/usb/cx231xx/cx231xx-video.c
 +++ b/drivers/media/usb/cx231xx/cx231xx-video.c
 @@ -100,6 +100,75 @@ static struct cx231xx_fmt format[] = {
  };
  
  
 +static int cx231xx_enable_analog_tuner(struct cx231xx *dev)
 +{
 +#ifdef CONFIG_MEDIA_CONTROLLER
 + struct media_device *mdev = dev-media_dev;
 + struct media_entity  *entity, *decoder = NULL, *source;
 + struct media_link *link, *found_link = NULL;
 + int i, ret, active_links = 0;
 +
 + if (!mdev)
 + return 0;
 +
 + /*
 +  * This will find the tuner that it is connected into the decoder.

s/that it is/that is/

 +  * Technically, this is not 100% correct, as the device may be
 +  * using an analog input instead of the tuner. However, as we can't
 +  * do DVB streaming  while the DMA engine is being used for V4L2,

s/streaming  while/streaming while/

With those changes:

Acked-by: Hans Verkuil hans.verk...@cisco.com

Regards,

Hans

 +  * this should be enough for the actual needs.
 +  */
 + media_device_for_each_entity(entity, mdev) {
 + if (entity-type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
 + decoder = entity;
 + break;
 + }
 + }
 + if (!decoder)
 + return 0;
 +
 + for (i = 0; i  decoder-num_links; i++) {
 + link = decoder-links[i];
 + if (link-sink-entity == decoder) {
 + found_link = link;
 + if (link-flags  MEDIA_LNK_FL_ENABLED)
 + active_links++;
 + break;
 + }
 + }
 +
 + if (active_links == 1 || !found_link)
 + return 0;
 +
 + source = found_link-source-entity;
 + for (i = 0; i  source-num_links; i++) {
 + struct media_entity *sink;
 + int flags = 0;
 +
 + link = source-links[i];
 + sink = link-sink-entity;
 +
 + if (sink == entity)
 + flags = MEDIA_LNK_FL_ENABLED;
 +
 + ret = media_entity_setup_link(link, flags);
 + if (ret) {
 + dev_err(dev-dev,
 + Couldn't change link %s-%s to %s. Error %d\n,
 + source-name, sink-name,
 + flags ? enabled : disabled,
 + ret);
 + return ret;
 + } else
 + dev_dbg(dev-dev,
 + link %s-%s was %s\n,
 + source-name, sink-name,
 + flags ? ENABLED : disabled);
 + }
 +#endif
 + return 0;
 +}
 +
  /* --
   Video buffer and parser functions
 --*/
 @@ -667,6 +736,9 @@ buffer_setup(struct videobuf_queue *vq, unsigned int 
 *count, unsigned int *size)
   if (*count  CX231XX_MIN_BUF)
   *count = CX231XX_MIN_BUF;
  
 +
 + cx231xx_enable_analog_tuner(dev);
 +
   return 0;
  }
  
 @@ -703,75 +775,6 @@ static void free_buffer(struct videobuf_queue *vq, 
 struct cx231xx_buffer *buf)
   buf-vb.state = VIDEOBUF_NEEDS_INIT;
  }
  
 -static int cx231xx_enable_analog_tuner(struct cx231xx *dev)
 -{
 -#ifdef CONFIG_MEDIA_CONTROLLER
 - struct media_device *mdev = dev-media_dev;
 - struct media_entity  *entity, *decoder = NULL, *source;
 - struct media_link *link, *found_link = NULL;
 - int i, ret, active_links = 0;
 -
 - if (!mdev)
 - return 0;
 -
 - /*
 -  * This will find the tuner that it is connected into the decoder.
 -  * Technically, this is not 100% correct, as the device may be
 -  * using an analog input instead of the tuner. However, as we can't
 -  * do DVB streaming  while the DMA engine is being used for V4L2,
 -  * this should be enough for the actual needs.
 -  */
 - media_device_for_each_entity(entity, mdev) {
 - if (entity-type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
 - decoder = entity;
 - break;
 - }
 - }
 - if (!decoder)
 - return 0;
 -
 - for (i = 0; i  decoder-num_links; i++) {
 - link = decoder-links[i];
 - if (link-sink-entity == decoder) {
 - found_link = link;
 - if (link-flags  MEDIA_LNK_FL_ENABLED)
 - active_links++;
 - 

[PATCH 3/7] [media] tuner-core: fix compilation if the media controller is not defined

2015-02-18 Thread Mauro Carvalho Chehab
drivers/media/v4l2-core/tuner-core.c:440:7: error: 'struct v4l2_subdev' has no 
member named 'entity'
 t-sd.entity.name = t-name;

Reported-by: kbuild test robot fengguang...@intel.com
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/v4l2-core/tuner-core.c 
b/drivers/media/v4l2-core/tuner-core.c
index 9a83b27a7e8f..abdcffabcb59 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -437,7 +437,9 @@ static void set_type(struct i2c_client *c, unsigned int 
type,
t-name = analog_ops-info.name;
}
 
+#ifdef CONFIG_MEDIA_CONTROLLER
t-sd.entity.name = t-name;
+#endif
 
tuner_dbg(type set to %s\n, t-name);
 
-- 
2.1.0

--
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/7] [media] cx231xx: fix compilation if the media controller is not defined

2015-02-18 Thread Mauro Carvalho Chehab
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_usb_probe’:
drivers/media/usb/cx231xx/cx231xx-cards.c:1589:15: error: ‘struct v4l2_device’ 
has no member named ‘mdev’
  dev-v4l2_dev.mdev = dev-media_dev;
   ^
drivers/media/usb/cx231xx/cx231xx-cards.c:1589:26: error: ‘struct cx231xx’ has 
no member named ‘media_dev’
  dev-v4l2_dev.mdev = dev-media_dev;
  ^
scripts/Makefile.build:257: recipe for target 
'drivers/media/usb/cx231xx/cx231xx-cards.o' failed

Reported-by: kbuild test robot fengguang...@intel.com
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c 
b/drivers/media/usb/cx231xx/cx231xx-cards.c
index dfc7010cff7f..372b70eb042c 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -1586,7 +1586,9 @@ static int cx231xx_usb_probe(struct usb_interface 
*interface,
cx231xx_media_device_register(dev, udev);
 
/* Create v4l2 device */
+#ifdef CONFIG_MEDIA_CONTROLLER
dev-v4l2_dev.mdev = dev-media_dev;
+#endif
retval = v4l2_device_register(interface-dev, dev-v4l2_dev);
if (retval) {
dev_err(d, v4l2_device_register failed\n);
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c 
b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index e8c054c4ac8c..44229a2c2d32 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -540,7 +540,9 @@ static int register_dvb(struct cx231xx_dvb *dvb,
 
/* register network adapter */
dvb_net_init(dvb-adapter, dvb-net, dvb-demux.dmx);
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
dvb_create_media_graph(dev-media_dev);
+#endif
return 0;
 
 fail_fe_conn:
-- 
2.1.0

--
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/7] [media] cx231xx: Improve the media controller comment

2015-02-18 Thread Mauro Carvalho Chehab
There are two problems at the comment:
- it is badly idented;
- its comment doesn't mean anything.

Fix it.

Requested-by: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 634763535d60..87c9e27505f4 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -714,12 +714,13 @@ static int cx231xx_enable_analog_tuner(struct cx231xx 
*dev)
if (!mdev)
return 0;
 
-/*
- * This will find the tuner that it is connected into the decoder.
- * Technically, this is not 100% correct, as the device may be using an
- * analog input instead of the tuner. However, we can't use the DVB for dvb
- * while the DMA engine is being used for V4L2.
- */
+   /*
+* This will find the tuner that it is connected into the decoder.
+* Technically, this is not 100% correct, as the device may be
+* using an analog input instead of the tuner. However, as we can't
+* do DVB streaming  while the DMA engine is being used for V4L2,
+* this should be enough for the actual needs.
+*/
media_device_for_each_entity(entity, mdev) {
if (entity-type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
decoder = entity;
-- 
2.1.0

--
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] soc-camera: Remove bogus devm_kfree() in soc_of_bind()

2015-02-18 Thread Geert Uytterhoeven
Unlike scan_async_group(), soc_of_bind() doesn't allocate its
soc_camera_async_client structure using devm_kzalloc(), but has it
embedded inside the soc_of_info structure.  Hence on failure, it must
not free it using devm_kfree(), as this will cause a warning, and may
cause slab corruption:

soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
[ cut here ]
WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:887 devm_kfree+0x30/0x40()
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 
3.19.0-shmobile-08386-g37feb0d093cb2d8e #128
Hardware name: Generic R8A7791 (Flattened Device Tree)
Backtrace:
[c0011e7c] (dump_backtrace) from [c0012024] (show_stack+0x18/0x1c)
 r6:c05a923b r5:0009 r4: r3:00204140
[c001200c] (show_stack) from [c048ed30] (dump_stack+0x78/0x94)
[c048ecb8] (dump_stack) from [c002687c] (warn_slowpath_common+0x8c/0xb8)
 r4: r3:
[c00267f0] (warn_slowpath_common) from [c0026980] 
(warn_slowpath_null+0x24/0x2c)
 r8:ee7d8214 r7:ed83b810 r6:ed83bc20 r5:fffa r4:ed83e510
[c002695c] (warn_slowpath_null) from [c025e0cc] (devm_kfree+0x30/0x40)
[c025e09c] (devm_kfree) from [c032bbf4] 
(soc_of_bind.isra.14+0x194/0x1d4)
[c032ba60] (soc_of_bind.isra.14) from [c032c6b8] 
(soc_camera_host_register+0x208/0x31c)
 r9:0070 r8:ee7e05d0 r7:ee153210 r6: r5:ee7e0218 r4:ed83bc20
[c032c4b0] (soc_camera_host_register) from [c032e80c] 
(rcar_vin_probe+0x1f4/0x238)
 r8:ee153200 r7:0008 r6:ee153210 r5:ed83bc10 r4:c066319c r3:00c0
[c032e618] (rcar_vin_probe) from [c025c334] 
(platform_drv_probe+0x50/0xa0)
 r10: r9:c0662fa8 r8: r7:c06a3700 r6:c0662fa8 r5:ee153210
 r4:
[c025c2e4] (platform_drv_probe) from [c025af08] 
(driver_probe_device+0xc4/0x208)
 r6:c06a36f4 r5: r4:ee153210 r3:c025c2e4
[c025ae44] (driver_probe_device) from [c025b108] 
(__driver_attach+0x70/0x94)
 r9:c066f9c0 r8:c0624a98 r7:c065b790 r6:c0662fa8 r5:ee153244 r4:ee153210
[c025b098] (__driver_attach) from [c025984c] 
(bus_for_each_dev+0x74/0x98)
 r6:c025b098 r5:c0662fa8 r4: r3:0001
[c02597d8] (bus_for_each_dev) from [c025b1dc] (driver_attach+0x20/0x28)
 r6:ed83c200 r5: r4:c0662fa8
[c025b1bc] (driver_attach) from [c025a00c] (bus_add_driver+0xdc/0x1c4)
[c0259f30] (bus_add_driver) from [c025b8f4] (driver_register+0xa4/0xe8)
 r7:c0624a98 r6: r5:c060b010 r4:c0662fa8
[c025b850] (driver_register) from [c025ccd0] 
(__platform_driver_register+0x50/0x64)
 r5:c060b010 r4:ed8394c0
[c025cc80] (__platform_driver_register) from [c060b028] 
(rcar_vin_driver_init+0x18/0x20)
[c060b010] (rcar_vin_driver_init) from [c05edde8] 
(do_one_initcall+0x108/0x1b8)
[c05edce0] (do_one_initcall) from [c05edfb4] 
(kernel_init_freeable+0x11c/0x1e4)
 r9:c066f9c0 r8:c066f9c0 r7:c062eab0 r6:c06252c4 r5:00ad r4:0006
[c05ede98] (kernel_init_freeable) from [c048c3d0] 
(kernel_init+0x10/0xec)
 r9: r8: r7: r6: r5:c048c3c0 r4:
[c048c3c0] (kernel_init) from [c000eba0] (ret_from_fork+0x14/0x34)
 r4: r3:ee04e000
---[ end trace e3a984cc0335c8a0 ]---
rcar_vin e6ef1000.video: group probe failed: -6

Fixes: 1ddc6a6caa94e1e1 ([media] soc_camera: add support for dt binding 
soc_camera drivers)
Cc: sta...@vger.kernel.org
Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
---
Triggered with shmobile-defconfig on r8a7791/koelsch.
---
 drivers/media/platform/soc_camera/soc_camera.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index cee7b56f84049944..d8a072fe46035821 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1665,7 +1665,6 @@ eclkreg:
 eaddpdev:
platform_device_put(sasc-pdev);
 eallocpdev:
-   devm_kfree(ici-v4l2_dev.dev, sasc);
dev_err(ici-v4l2_dev.dev, group probe failed: %d\n, ret);
 
return ret;
-- 
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


0.led_name 2.other.led.name in /sysfs Re: [PATCH/RFC v11 01/20] leds: flash: document sysfs interface

2015-02-18 Thread Pavel Machek

On Wed 2015-02-18 17:20:22, Jacek Anaszewski wrote:
 Add a documentation of LED Flash class specific sysfs attributes.
 
 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

NAK-ed-by: Pavel Machek

 +What:/sys/class/leds/led/available_sync_leds
 +Date:February 2015
 +KernelVersion:   3.20
 +Contact: Jacek Anaszewski j.anaszew...@samsung.com
 +Description: read/write
 + Space separated list of LEDs available for flash strobe
 + synchronization, displayed in the format:
 +
 + led1_id.led1_name led2_id.led2_name led3_id.led3_name etc.

Multiple values per file, with all the problems we had in /proc. I
assume led_id is an integer? What prevents space or dot in led name?

   Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.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: [PATCHv4 16/25] [media] cx25840: fill the media controller entity

2015-02-18 Thread Lad, Prabhakar
Hi Mauro,

Thanks for the patch.

On Fri, Feb 13, 2015 at 10:57 PM, Mauro Carvalho Chehab
mche...@osg.samsung.com wrote:
 Instead of keeping the media controller entity not initialized,
 fill it and create the pads for cx25840.

 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

 diff --git a/drivers/media/i2c/cx25840/cx25840-core.c 
 b/drivers/media/i2c/cx25840/cx25840-core.c
 index 573e08826b9b..bdb5bb6b58da 100644
 --- a/drivers/media/i2c/cx25840/cx25840-core.c
 +++ b/drivers/media/i2c/cx25840/cx25840-core.c
 @@ -5137,6 +5137,9 @@ static int cx25840_probe(struct i2c_client *client,
 int default_volume;
 u32 id;
 u16 device_id;
 +#if defined(CONFIG_MEDIA_CONTROLLER)
 +   int ret;
 +#endif

 /* Check if the adapter supports the needed features */
 if (!i2c_check_functionality(client-adapter, 
 I2C_FUNC_SMBUS_BYTE_DATA))
 @@ -5178,6 +5181,21 @@ static int cx25840_probe(struct i2c_client *client,

 sd = state-sd;
 v4l2_i2c_subdev_init(sd, client, cx25840_ops);
 +#if defined(CONFIG_MEDIA_CONTROLLER)
 +   /* TODO: need to represent analog inputs too */
 +   state-pads[0].flags = MEDIA_PAD_FL_SINK;   /* Tuner or input */
 +   state-pads[1].flags = MEDIA_PAD_FL_SOURCE; /* Video */
 +   state-pads[2].flags = MEDIA_PAD_FL_SOURCE; /* VBI */
Macros for 0,1,2 would make it more readable.

 +   sd-entity.type = MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
 +
 +   ret = media_entity_init(sd-entity, ARRAY_SIZE(state-pads),
 +   state-pads, 0);
 +   if (ret  0) {
 +   v4l_info(client, failed to initialize media entity!\n);
 +   kfree(state);
not needed as state is allocated using devm_kzalloc()

 +   return -ENODEV;
return ret instead ?

 +   }
 +#endif

 switch (id) {
 case CX23885_AV:
 diff --git a/drivers/media/i2c/cx25840/cx25840-core.h 
 b/drivers/media/i2c/cx25840/cx25840-core.h
 index 37bc04217c44..17b409f55445 100644
 --- a/drivers/media/i2c/cx25840/cx25840-core.h
 +++ b/drivers/media/i2c/cx25840/cx25840-core.h
 @@ -64,6 +64,9 @@ struct cx25840_state {
 wait_queue_head_t fw_wait;/* wake up when the fw load is finished 
 */
 struct work_struct fw_work;   /* work entry for fw load */
 struct cx25840_ir_state *ir_state;
 +#if defined(CONFIG_MEDIA_CONTROLLER)
 +   struct media_padpads[3];
Macro for 3 ?

Cheers,
--Prabhakar Lad
--
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 00/15] media: blackfin: bfin_capture enhancements

2015-02-18 Thread Lad, Prabhakar
Hi Hans

On Mon, Feb 16, 2015 at 11:42 AM, Hans Verkuil hverk...@xs4all.nl wrote:
 On 02/02/2015 12:24 PM, Hans Verkuil wrote:
 On 01/30/2015 04:49 PM, Lad, Prabhakar wrote:
 Hello Scott,

 On Thu, Jan 22, 2015 at 10:18 PM, Lad, Prabhakar
 prabhakar.cse...@gmail.com wrote:
 This patch series, enhances blackfin capture driver with
 vb2 helpers.

 Changes for v2:
 --
 Only patches 5/15 and 8/15 as per Scott's suggestions.

 Lad, Prabhakar (15):
   media: blackfin: bfin_capture: drop buf_init() callback
   media: blackfin: bfin_capture: release buffers in case
 start_streaming() call back fails
   media: blackfin: bfin_capture: set min_buffers_needed
   media: blackfin: bfin_capture: improve buf_prepare() callback
   media: blackfin: bfin_capture: improve queue_setup() callback
   media: blackfin: bfin_capture: use vb2_fop_mmap/poll
   media: blackfin: bfin_capture: use v4l2_fh_open and vb2_fop_release
   media: blackfin: bfin_capture: use vb2_ioctl_* helpers
   media: blackfin: bfin_capture: make sure all buffers are returned on
 stop_streaming() callback
   media: blackfin: bfin_capture: return -ENODATA for *std calls
   media: blackfin: bfin_capture: return -ENODATA for *dv_timings calls
   media: blackfin: bfin_capture: add support for vidioc_create_bufs
   media: blackfin: bfin_capture: add support for VB2_DMABUF
   media: blackfin: bfin_capture: add support for VIDIOC_EXPBUF
   media: blackfin: bfin_capture: set v4l2 buffer sequence

  drivers/media/platform/blackfin/bfin_capture.c | 311 
 -
  1 file changed, 99 insertions(+), 212 deletions(-)

 Can you ACK the series ? so that its easier for Hans to pick it up.

 ping!

 Scott, I can't take it unless you Ack it. Actually, I'd like to see a
 'Tested-by' tag.

 And if you are testing anyway, then I would really like to see the output
 of 'v4l2-compliance -s', using the v4l2-compliance from the latest 
 v4l-utils.git.

 I'm curious to see the results of that.

 Ping! Again, I need an Ack.

Oops I need to respin fixing one of the patch.

Cheers,
--Prabhakar Lad
--
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 v2] Adding NV{12,21} and Y{U,V}12 pixel formats support.

2015-02-18 Thread Miguel Casas-Sanchez

This is the second attempt at creating a patch doing
that while respecting the pattern movements, crops,
and other artifacts that can be added to the generated
frames. 

Hope it addresses Hans' comments on the first patch.
It should create properly moving patterns, border,
square and noise. SAV/EAV are left out for the new
formats, but can be pulled in if deemed interesting/
necessary. New formats' descriptions are shorter.
Needless to say, previous formats should work 100% 
the same as before.

Text is, still, printed as Y only. I think the 
goal of the text is not pixel-value-based comparisons,
but human reading. Please let me know otherwise.

It needed quite some refactoring of the original
tpg_fillbuffer() function:
- the internal code generating the video buffer
  line-by-line are factored out into a function
  tpg_fill_oneline(). const added wherever it made
  sense.
- this new tpg_fill_oneline() is used by both
  new functions tpg_fillbuffer_packed() and
  tpg_fillbuffer_planar().
- tpg_fillbuffer_packed() does the non-planar
  formats' buffer composition, so it does, or should
  do, pretty much the same as vivid did before this
  patch.

Tested via both guvcview and qv4l2, checking formats,
patterns, pattern movements, box and frame checkboxes.

Hope I managed to get the patch correctly into the mail
i.e. no spurious wraparounds, no whitespaces etc :)

Signed-off-by: Miguel Casas-Sanchez mca...@chromium.org
---
 drivers/media/platform/vivid/vivid-kthread-cap.c |   6 +-
 drivers/media/platform/vivid/vivid-tpg.c | 481 ---
 drivers/media/platform/vivid/vivid-tpg.h |  24 +-
 drivers/media/platform/vivid/vivid-vid-common.c  |  28 ++
 4 files changed, 383 insertions(+), 156 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-kthread-cap.c 
b/drivers/media/platform/vivid/vivid-kthread-cap.c
index 39a67cf..93c6ca3 100644
--- a/drivers/media/platform/vivid/vivid-kthread-cap.c
+++ b/drivers/media/platform/vivid/vivid-kthread-cap.c
@@ -669,8 +669,7 @@ static void vivid_thread_vid_cap_tick(struct vivid_dev 
*dev, int dropped_bufs)
if (vid_cap_buf) {
/* Fill buffer */
vivid_fillbuff(dev, vid_cap_buf);
-   dprintk(dev, 1, filled buffer %d\n,
-   vid_cap_buf-vb.v4l2_buf.index);
+   dprintk(dev, 1, filled buffer %d\n, 
vid_cap_buf-vb.v4l2_buf.index);
 
/* Handle overlay */
if (dev-overlay_cap_owner  dev-fb_cap.base 
@@ -679,8 +678,7 @@ static void vivid_thread_vid_cap_tick(struct vivid_dev 
*dev, int dropped_bufs)
 
vb2_buffer_done(vid_cap_buf-vb, dev-dqbuf_error ?
VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
-   dprintk(dev, 2, vid_cap buffer %d done\n,
-   vid_cap_buf-vb.v4l2_buf.index);
+   dprintk(dev, 2, vid_cap buffer %d done\n, 
vid_cap_buf-vb.v4l2_buf.index);
}
 
if (vbi_cap_buf) {
diff --git a/drivers/media/platform/vivid/vivid-tpg.c 
b/drivers/media/platform/vivid/vivid-tpg.c
index 34493f4..802ba2c 100644
--- a/drivers/media/platform/vivid/vivid-tpg.c
+++ b/drivers/media/platform/vivid/vivid-tpg.c
@@ -140,6 +140,10 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
if (!tpg-random_line[plane])
return -ENOMEM;
}
+   tpg-scratchpad_line = vzalloc(max_w * 2);
+   if (!tpg-scratchpad_line)
+   return -ENOMEM;
+
return 0;
 }
 
@@ -193,6 +197,10 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_UYVY:
case V4L2_PIX_FMT_YVYU:
case V4L2_PIX_FMT_VYUY:
+   case V4L2_PIX_FMT_NV12:
+   case V4L2_PIX_FMT_NV21:
+   case V4L2_PIX_FMT_YUV420:
+   case V4L2_PIX_FMT_YVU420:
tpg-is_yuv = true;
break;
default:
@@ -224,12 +232,32 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
case V4L2_PIX_FMT_ABGR32:
tpg-twopixelsize[0] = 2 * 4;
break;
+   case V4L2_PIX_FMT_NV12:
+   case V4L2_PIX_FMT_NV21:
+   case V4L2_PIX_FMT_YUV420:
+   case V4L2_PIX_FMT_YVU420:
+   tpg-twopixelsize[0] = 3;
+   break;
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV61M:
tpg-twopixelsize[0] = 2;
tpg-twopixelsize[1] = 2;
break;
}
+
+   switch (fourcc) {
+   case V4L2_PIX_FMT_NV12:
+   case V4L2_PIX_FMT_NV21:
+   case V4L2_PIX_FMT_YUV420:
+   case V4L2_PIX_FMT_YVU420:
+   tpg-vertical_downsampling = 2;
+   tpg-horizontal_downsampling = 2;
+   break;
+   default:
+   tpg-vertical_downsampling = 0;
+   tpg-horizontal_downsampling = 0;
+   }
+
return true;
 }
 
@@ -271,6 +299,12 @@ void tpg_reset_source(struct tpg_data *tpg, unsigned 
width, unsigned height,
  

cron job: media_tree daily build: ABI WARNING

2015-02-18 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:   Thu Feb 19 04:00:18 CET 2015
git branch: test
git hash:   135f9be9194cf7778eb73594aa55791b229cf27c
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-41-g6c2d743
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.18.0-5.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: WARNINGS
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: 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: WARNINGS
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-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
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
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Thursday.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: Can the patch adding support for the Tasco USB microscope be queued up?

2015-02-18 Thread Steven Zakulec
Here are the results of running lsusb -v -d '1871:0516' on my system
that has the patch applied:
Thanks for your help here!


Bus 001 Device 104: ID 1871:0516 Aveo Technology Corp.
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass  239 Miscellaneous Device
  bDeviceSubClass 2 ?
  bDeviceProtocol 1 Interface Association
  bMaxPacketSize064
  idVendor   0x1871 Aveo Technology Corp.
  idProduct  0x0516
  bcdDevice3.07
  iManufacturer   1 AVEO Technology Corp.
  iProduct2 USB2.0 Camera
  iSerial 0
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength  411
bNumInterfaces  2
bConfigurationValue 1
iConfiguration  0
bmAttributes 0x80
  (Bus Powered)
MaxPower  500mA
Interface Association:
  bLength 8
  bDescriptorType11
  bFirstInterface 0
  bInterfaceCount 2
  bFunctionClass255 Vendor Specific Class
  bFunctionSubClass   3
  bFunctionProtocol   0
  iFunction   2 USB2.0 Camera
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  1
  bInterfaceProtocol  0
  iInterface  2 USB2.0 Camera
  ** UNRECOGNIZED:  0d 24 01 00 01 4d 00 80 c3 c9 01 01 01
  ** UNRECOGNIZED:  12 24 02 01 01 02 00 00 00 00 00 00 00 00 03 00 00 00
  ** UNRECOGNIZED:  09 24 03 02 01 01 00 04 00
  ** UNRECOGNIZED:  0b 24 05 03 01 00 00 02 1b 04 00
  ** UNRECOGNIZED:  1a 24 06 04 52 f2 b8 aa d1 8e 72 49 8c ed 96
b1 7f 04 40 8b 01 01 03 01 03 00
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85  EP 5 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   7
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber1
  bAlternateSetting   0
  bNumEndpoints   0
  bInterfaceClass14 Video
  bInterfaceSubClass  2 Video Streaming
  bInterfaceProtocol  0
  iInterface  0
  VideoStreaming Interface Descriptor:
bLength14
bDescriptorType36
bDescriptorSubtype  1 (INPUT_HEADER)
bNumFormats 1
wTotalLength  207
bEndPointAddress  131
bmInfo  0
bTerminalLink   2
bStillCaptureMethod 2
bTriggerSupport 1
bTriggerUsage   0
bControlSize1
bmaControls( 0)27
  VideoStreaming Interface Descriptor:
bLength27
bDescriptorType36
bDescriptorSubtype  4 (FORMAT_UNCOMPRESSED)
bFormatIndex1
bNumFrameDescriptors5
guidFormat
{59555932--1000-8000-00aa00389b71}
bBitsPerPixel  16
bDefaultFrameIndex  1
bAspectRatioX   0
bAspectRatioY   0
bmInterlaceFlags 0x00
  Interlaced stream or variable: No
  Fields per frame: 2 fields
  Field 1 first: No
  Field pattern: Field 1 only
  bCopyProtect  0
  VideoStreaming Interface Descriptor:
bLength30
bDescriptorType36
bDescriptorSubtype  5 (FRAME_UNCOMPRESSED)
bFrameIndex 1
bmCapabilities   0x00
  Still image unsupported
wWidth640
wHeight   480
dwMinBitRate147456000
dwMaxBitRate147456000
dwMaxVideoFrameBufferSize  614400
dwDefaultFrameInterval 33
bFrameIntervalType  1
dwFrameInterval( 0)33
  VideoStreaming Interface Descriptor:
bLength30
bDescriptorType36

Re: [BUG, workaround] HVR-2200/saa7164 problem with C7 power state

2015-02-18 Thread David Harty

On 02/17/2015 04:47 AM, dCrypt wrote:
So the PCI Express change hasn't seemed to help either. Any other 
ideas? David --


My system stops working at least once a day.  Does anyone have any 
suggestions to try? latest module builds? other firmwares?  I notice 
there are several up on the http://www.steventoth.net/linux/hvr22xx/ 
site, would any of those work better?


Is there a better card to use?  the HVR-2200 and saa7164 are effectively 
unusable at this point.


Thanks,

David

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