[GIT PULL FOR v4.2] cobalt fixes and sparse/compiler warning fixes

2015-05-25 Thread Hans Verkuil
The following changes since commit 2a80f296422a01178d0a993479369e94f5830127:

  [media] dvb-core: fix 32-bit overflow during bandwidth calculation 
(2015-05-20 14:01:46 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git cobalt-fixes

for you to fetch changes up to 330a3e910e8832046267d0dbb5871b4aaf375a26:

  adv7604/cobalt: missing GPIOLIB dependency (2015-05-25 10:49:07 +0200)


Hans Verkuil (12):
  cobalt: fix irqs used for the adv7511 transmitter
  cobalt: fix 64-bit division link error
  cobalt: fix compiler warnings on 32 bit OSes
  e4000: fix compiler warning
  cobalt: fix sparse warnings
  cobalt: fix sparse warnings
  cobalt: fix sparse warnings
  cobalt: fix sparse warnings
  cobalt: fix sparse warnings
  cx24120: fix sparse warning
  saa7164: fix sparse warning
  adv7604/cobalt: missing GPIOLIB dependency

 drivers/media/dvb-frontends/cx24120.c |   2 +-
 drivers/media/i2c/Kconfig |   2 +-
 drivers/media/pci/cobalt/Kconfig  |   2 +-
 drivers/media/pci/cobalt/cobalt-cpld.c|   6 +--
 drivers/media/pci/cobalt/cobalt-driver.c  |  18 +--
 drivers/media/pci/cobalt/cobalt-driver.h  |  22 
 drivers/media/pci/cobalt/cobalt-flash.c   |  18 +++
 drivers/media/pci/cobalt/cobalt-i2c.c |  56 ++--
 drivers/media/pci/cobalt/cobalt-irq.c |  58 ++--
 drivers/media/pci/cobalt/cobalt-omnitek.c |  12 ++---
 drivers/media/pci/cobalt/cobalt-v4l2.c| 235 
--
 drivers/media/pci/saa7164/saa7164-i2c.c   |   2 +-
 drivers/media/tuners/e4000.c  |   2 +-
 13 files changed, 231 insertions(+), 204 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] lmedm04: Neaten logging

2015-05-25 Thread Joe Perches
Use a more current logging style.

o Use pr_fmt
o Add missing newlines to formats
o Remove used-once lme_debug macro incorporating it into dbg_info
o Remove unnecessary allocation error messages
o Remove unnecessary semicolons from #defines
o Remove info macro and convert uses to pr_info
o Fix spelling of snippet
o Use %phN extension

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/media/usb/dvb-usb-v2/lmedm04.c | 105 +++--
 1 file changed, 49 insertions(+), 56 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c 
b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index 5de6f7c..7e8e58b 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -67,6 +67,8 @@
  * M88RS2000 suffers from loss of lock.
  */
 #define DVB_USB_LOG_PREFIX LME2510(C)
+#define pr_fmt(fmt) DVB_USB_LOG_PREFIX :  fmt
+
 #include linux/usb.h
 #include linux/usb/input.h
 #include media/rc-core.h
@@ -84,25 +86,22 @@
 #include ts2020.h
 
 
-#define LME2510_C_S7395dvb-usb-lme2510c-s7395.fw;
-#define LME2510_C_LG   dvb-usb-lme2510c-lg.fw;
-#define LME2510_C_S0194dvb-usb-lme2510c-s0194.fw;
-#define LME2510_C_RS2000 dvb-usb-lme2510c-rs2000.fw;
-#define LME2510_LG dvb-usb-lme2510-lg.fw;
-#define LME2510_S0194  dvb-usb-lme2510-s0194.fw;
+#define LME2510_C_S7395dvb-usb-lme2510c-s7395.fw
+#define LME2510_C_LG   dvb-usb-lme2510c-lg.fw
+#define LME2510_C_S0194dvb-usb-lme2510c-s0194.fw
+#define LME2510_C_RS2000 dvb-usb-lme2510c-rs2000.fw
+#define LME2510_LG dvb-usb-lme2510-lg.fw
+#define LME2510_S0194  dvb-usb-lme2510-s0194.fw
 
 /* debug */
 static int dvb_usb_lme2510_debug;
-#define lme_debug(var, level, args...) do { \
-   if ((var = level)) \
-   pr_debug(DVB_USB_LOG_PREFIX:  args); \
+#define deb_info(level, fmt, ...)  \
+do {   \
+   if (dvb_usb_lme2510_debug = level) \
+   pr_debug(fmt, ##__VA_ARGS__);   \
 } while (0)
-#define deb_info(level, args...) lme_debug(dvb_usb_lme2510_debug, level, args)
-#define debug_data_snipet(level, name, p) \
-deb_info(level, name (%02x%02x%02x%02x%02x%02x%02x%02x), \
-   *p, *(p+1), *(p+2), *(p+3), *(p+4), \
-   *(p+5), *(p+6), *(p+7));
-#define info(args...) pr_info(DVB_USB_LOG_PREFIX: args)
+#define debug_data_snippet(level, name, p) \
+   deb_info(level, name  (%*phN)\n, 8, p)
 
 module_param_named(debug, dvb_usb_lme2510_debug, int, 0644);
 MODULE_PARM_DESC(debug, set debugging level (1=info (or-able)).);
@@ -182,10 +181,8 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
 
if (st-usb_buffer == NULL) {
st-usb_buffer = kmalloc(64, GFP_KERNEL);
-   if (st-usb_buffer == NULL) {
-   info(MEM Error no memory);
+   if (st-usb_buffer == NULL)
return -ENOMEM;
-   }
}
buff = st-usb_buffer;
 
@@ -234,7 +231,7 @@ static int lme2510_enable_pid(struct dvb_usb_device *d, u8 
index, u16 pid_out)
u8 pid_no = index * 2;
u8 pid_len = pid_no + 2;
int ret = 0;
-   deb_info(1, PID Setting Pid %04x, pid_out);
+   deb_info(1, PID Setting Pid %04x\n, pid_out);
 
if (st-pid_size == 0)
ret |= lme2510_stream_restart(d);
@@ -275,7 +272,7 @@ static void lme2510_int_response(struct urb *lme_urb)
case -ESHUTDOWN:
return;
default:
-   info(Error %x, lme_urb-status);
+   pr_info(Error %x\n, lme_urb-status);
break;
}
 
@@ -286,17 +283,17 @@ static void lme2510_int_response(struct urb *lme_urb)
 
for (i = 0; i  offset; ++i) {
ibuf = (u8 *)rbuf[i*8];
-   deb_info(5, INT O/S C =%02x C/O=%02x Type =%02x%02x,
-   offset, i, ibuf[0], ibuf[1]);
+   deb_info(5, INT O/S C =%02x C/O=%02x Type =%02x%02x\n,
+offset, i, ibuf[0], ibuf[1]);
 
switch (ibuf[0]) {
case 0xaa:
-   debug_data_snipet(1, INT Remote data snipet, ibuf);
+   debug_data_snippet(1, INT Remote data snippet, ibuf);
if ((ibuf[4] + ibuf[5]) == 0xff) {
key = RC_SCANCODE_NECX((ibuf[2] ^ 0xff)  8 |
   (ibuf[3]  0) ? (ibuf[3] 
^ 0xff) : 0,
   ibuf[5]);
-   deb_info(1, INT Key =%08x, key);
+   deb_info(1, INT Key =%08x\n, key);
if (adap_to_d(adap)-rc_dev != NULL)
rc_keydown(adap_to_d(adap)-rc_dev,

Re: [PATCHv3 1/2] ARM: dts: exynos5420: add nodes for jpeg codec

2015-05-25 Thread Krzysztof Kozlowski
2015-03-09 21:32 GMT+09:00 Andrzej Pietrasiewicz andrze...@samsung.com:
 Add nodes for jpeg codec in Exynos5420 SoC.

 Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
 ---
  arch/arm/boot/dts/exynos5420.dtsi | 16 
  1 file changed, 16 insertions(+)

Acked-by: Krzysztof Kozlowski k.kozlow...@samsung.com

The patch adding bindings documentation and changing s5p-jpeg driver
was merged (7c15fd4bf3d3 merged in 4.1-rc1 cycle) so this can be
safely picked up by Samsung tree. Kukjin, can you apply it?

Best regards,
Krzysztof
--
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] au0828: Add support for media controller

2015-05-25 Thread Hans Verkuil
Hi Rafael,

Thank you for the patch!

I do have some comments, though, see below...

On 05/19/2015 04:16 AM, Rafael Lourenço de Lima Chehab wrote:
 Add support for analog and dvb tv using media controller
 
 Signed-off-by: Rafael Lourenço de Lima Chehab chehabraf...@gmail.com
 ---
 v2:cleanups
  drivers/media/dvb-frontends/au8522_decoder.c |  17 +
  drivers/media/dvb-frontends/au8522_priv.h|  12 
  drivers/media/usb/au0828/au0828-cards.c  |   2 -
  drivers/media/usb/au0828/au0828-core.c   | 100 
 +++
  drivers/media/usb/au0828/au0828-dvb.c|  10 +++
  drivers/media/usb/au0828/au0828-video.c  |  83 ++
  drivers/media/usb/au0828/au0828.h|   6 ++
  7 files changed, 228 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/dvb-frontends/au8522_decoder.c 
 b/drivers/media/dvb-frontends/au8522_decoder.c
 index 33aa9410b624..24990db7ba38 100644
 --- a/drivers/media/dvb-frontends/au8522_decoder.c
 +++ b/drivers/media/dvb-frontends/au8522_decoder.c
 @@ -731,6 +731,9 @@ static int au8522_probe(struct i2c_client *client,
   struct v4l2_subdev *sd;
   int instance;
   struct au8522_config *demod_config;
 +#ifdef CONFIG_MEDIA_CONTROLLER
 + int ret;
 +#endif
  
   /* Check if the adapter supports the needed features */
   if (!i2c_check_functionality(client-adapter,
 @@ -767,6 +770,20 @@ static int au8522_probe(struct i2c_client *client,
  
   sd = state-sd;
   v4l2_i2c_subdev_init(sd, client, au8522_ops);
 +#if defined(CONFIG_MEDIA_CONTROLLER)
 +
 + state-pads[AU8522_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
 + state-pads[AU8522_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
 + state-pads[AU8522_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
 + 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);
 + return ret;
 + }
 +#endif
  
   hdl = state-hdl;
   v4l2_ctrl_handler_init(hdl, 4);
 diff --git a/drivers/media/dvb-frontends/au8522_priv.h 
 b/drivers/media/dvb-frontends/au8522_priv.h
 index b8aca1c84786..ed6eb2675508 100644
 --- a/drivers/media/dvb-frontends/au8522_priv.h
 +++ b/drivers/media/dvb-frontends/au8522_priv.h
 @@ -39,6 +39,14 @@
  #define AU8522_DIGITAL_MODE 1
  #define AU8522_SUSPEND_MODE 2
  
 +enum au8522_media_pads {
 + AU8522_PAD_INPUT,
 + AU8522_PAD_VID_OUT,
 + AU8522_PAD_VBI_OUT,
 +
 + AU8522_NUM_PADS
 +};
 +
  struct au8522_state {
   struct i2c_client *c;
   struct i2c_adapter *i2c;
 @@ -68,6 +76,10 @@ struct au8522_state {
   u32 id;
   u32 rev;
   struct v4l2_ctrl_handler hdl;
 +
 +#ifdef CONFIG_MEDIA_CONTROLLER
 + struct media_pad pads[AU8522_NUM_PADS];
 +#endif
  };
  
  /* These are routines shared by both the VSB/QAM demodulator and the analog
 diff --git a/drivers/media/usb/au0828/au0828-cards.c 
 b/drivers/media/usb/au0828/au0828-cards.c
 index edc27355f271..6b469e8c4c6e 100644
 --- a/drivers/media/usb/au0828/au0828-cards.c
 +++ b/drivers/media/usb/au0828/au0828-cards.c
 @@ -195,8 +195,6 @@ void au0828_card_setup(struct au0828_dev *dev)
  
   dprintk(1, %s()\n, __func__);
  
 - dev-board = au0828_boards[dev-boardnr];
 -

Huh? Why is this removed?

   if (dev-i2c_rc == 0) {
   dev-i2c_client.addr = 0xa0  1;
   tveeprom_read(dev-i2c_client, eeprom, sizeof(eeprom));
 diff --git a/drivers/media/usb/au0828/au0828-core.c 
 b/drivers/media/usb/au0828/au0828-core.c
 index 082ae6ba492f..0378a2c99ebb 100644
 --- a/drivers/media/usb/au0828/au0828-core.c
 +++ b/drivers/media/usb/au0828/au0828-core.c
 @@ -127,8 +127,22 @@ static int recv_control_msg(struct au0828_dev *dev, u16 
 request, u32 value,
   return status;
  }
  
 +static void au0828_unregister_media_device(struct au0828_dev *dev)
 +{
 +
 +#ifdef CONFIG_MEDIA_CONTROLLER
 + if (dev-media_dev) {
 + media_device_unregister(dev-media_dev);
 + kfree(dev-media_dev);
 + dev-media_dev = NULL;
 + }
 +#endif
 +}
 +
  static void au0828_usb_release(struct au0828_dev *dev)
  {
 + au0828_unregister_media_device(dev);
 +
   /* I2C */
   au0828_i2c_unregister(dev);
  
 @@ -161,6 +175,8 @@ static void au0828_usb_disconnect(struct usb_interface 
 *interface)
   */
   dev-dev_state = DEV_DISCONNECTED;
  
 + au0828_unregister_media_device(dev);
 +
   au0828_rc_unregister(dev);
   /* Digital TV */
   au0828_dvb_unregister(dev);
 @@ -180,6 +196,81 @@ static void au0828_usb_disconnect(struct usb_interface 
 *interface)
   au0828_usb_release(dev);
  }
  
 +static void au0828_media_device_register(struct au0828_dev *dev,
 +   struct usb_device *udev)
 +{
 +#ifdef CONFIG_MEDIA_CONTROLLER
 + struct media_device *mdev;
 +  

Re: [PATCH v2] v4l: subdev: Add pad config allocator and init

2015-05-25 Thread Laurent Pinchart
Hi Hans,

On Monday 25 May 2015 00:25:36 Hans Verkuil wrote:
 On 05/24/2015 11:10 PM, Laurent Pinchart wrote:
  From: Laurent Pinchart laurent.pinch...@linaro.org
  
  Add a new subdev operation to initialize a subdev pad config array, and
  a helper function to allocate and initialize the array. This can be used
  by bridge drivers to implement try format based on subdev pad
  operations.
  
  Signed-off-by: Laurent Pinchart laurent.pinch...@linaro.org
  Acked-by: Vaibhav Hiremath vaibhav.hirem...@linaro.org
 
 Acked-by: Hans Verkuil hans.verk...@cisco.com
 
 Note that before this goes in there should be at least one subdev driver
 that implements init_cfg(). Perhaps adv7604?

I fully agree, this needs to be used by at least one subdev driver.

I'd go even further, I'd like to see v4l2_subdev_alloc_pad_config() used by a 
bridge driver, to implement VIDIOC_TRY_FMT. I've originally written the patch 
to implement VIDIOC_TRY_FMT (and VIDIOC_ENUM_FRAMESIZES) in a driver I'm 
developing, but it's not ready for submission to mainline yet.

Do you think a subdev driver is enough, or do we need a bridge too in order to 
merge this patch ?

  ---
  
   drivers/media/v4l2-core/v4l2-subdev.c | 19 ++-
   include/media/v4l2-subdev.h   | 10 ++
   2 files changed, 28 insertions(+), 1 deletion(-)
  
  Changes since v1:
  
  - Added v4l2_subdev_free_pad_config

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 0/4] [sur40] minor fixes performance improvements

2015-05-25 Thread Hans Verkuil
Hi Florian,

On 05/21/2015 02:29 PM, Florian Echtler wrote:
 This patch series adds several small fixes, features  performance
 improvements. Many thanks to Martin Kaltenbrunner for testing the
 original driver  submitting the patches. 
 
 Martin Kaltenbrunner (4):
   reduce poll interval to allow full 60 FPS framerate
   add frame size/frame rate query functions
   add extra debug output, remove noisy warning
   return BUF_STATE_ERROR if streaming stopped during acquisition
 
  drivers/input/touchscreen/sur40.c | 46 
 +--
  1 file changed, 44 insertions(+), 2 deletions(-)
 

The patches look good, but can you repost with better commit logs (i.e. not
just a subject line). Maintainers have become picky about that and without logs
Mauro most likely will not accept it. Actually, I'm not even going to try :-)

Regards,

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


Re: [PATCH 0/4] [sur40] minor fixes performance improvements

2015-05-25 Thread Hans Verkuil
On 05/25/2015 01:38 PM, Florian Echtler wrote:
 On 25.05.2015 13:22, Hans Verkuil wrote:
 On 05/21/2015 02:29 PM, Florian Echtler wrote:
 This patch series adds several small fixes, features  performance
 improvements. Many thanks to Martin Kaltenbrunner for testing the
 original driver  submitting the patches. 

 The patches look good, but can you repost with better commit logs (i.e. not
 just a subject line). Maintainers have become picky about that and without 
 logs
 Mauro most likely will not accept it. Actually, I'm not even going to try :-)
 
 OK, will do that later today. Should I just send it as a new patch
 series, or in reply to the first one? What's the best practice here?

New patch series, just prefixed with '[PATCHv2 x/4]'.

Thanks!

Hans

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


Re: [PATCH 0/9 v5] Helper to abstract vma handling in media layer

2015-05-25 Thread Hans Verkuil
Hi Jan,

On 05/13/2015 03:08 PM, Jan Kara wrote:
   Hello,
 
 I'm sending the fifth version of my patch series to abstract vma handling
 from the various media drivers. The patches got some review from mm people and
 testing from device driver guys so unless someone objects, patches will be
 queued in media tree for the next merge window.

What is the current status? I saw one comment for patch 9, so I assume it is not
quite ready yet.

Let me know when you think it is time to merge.

Regards,

Hans

 
 After this patch set drivers have to know much less details about vmas, their
 types, and locking. Also quite some code is removed from them. As a bonus
 drivers get automatically VM_FAULT_RETRY handling. The primary motivation for
 this series is to remove knowledge about mmap_sem locking from as many places 
 a
 possible so that we can change it with reasonable effort.
 
 The core of the series is the new helper get_vaddr_frames() which is given a
 virtual address and it fills in PFNs / struct page pointers (depending on VMA
 type) into the provided array. If PFNs correspond to normal pages it also 
 grabs
 references to these pages. The difference from get_user_pages() is that this
 function can also deal with pfnmap, and io mappings which is what the media
 drivers need.
 
 I have tested the patches with vivid driver so at least vb2 code got some
 exposure. Conversion of other drivers was just compile-tested (for x86 so e.g.
 exynos driver which is only for Samsung platform is completely untested).
 
   Honza
 Changes since v4:
 * Minor cleanups and fixes pointed out by Mel and Vlasta
 * Added Acked-by tags
 
 Changes since v3:
 * Added include linux/vmalloc.h into mm/gup.c as it's needed for some archs
 * Fixed error path for exynos driver
 
 Changes since v2:
 * Renamed functions and structures as Mel suggested
 * Other minor changes suggested by Mel
 * Rebased on top of 4.1-rc2
 * Changed functions to get pointer to array of pages / pfns to perform
   conversion if necessary. This fixes possible issue in the omap I may have
   introduced in v2 and generally makes the API less errorprone.
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

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


Re: [PATCH 0/4] [sur40] minor fixes performance improvements

2015-05-25 Thread Florian Echtler
On 25.05.2015 13:22, Hans Verkuil wrote:
 On 05/21/2015 02:29 PM, Florian Echtler wrote:
 This patch series adds several small fixes, features  performance
 improvements. Many thanks to Martin Kaltenbrunner for testing the
 original driver  submitting the patches. 
 
 The patches look good, but can you repost with better commit logs (i.e. not
 just a subject line). Maintainers have become picky about that and without 
 logs
 Mauro most likely will not accept it. Actually, I'm not even going to try :-)

OK, will do that later today. Should I just send it as a new patch
series, or in reply to the first one? What's the best practice here?

Best, Florian
-- 
SENT FROM MY DEC VT50 TERMINAL



signature.asc
Description: OpenPGP digital signature


[GIT PULL FOR v4.2] uvcvideo fixes

2015-05-25 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 2a80f296422a01178d0a993479369e94f5830127:

  [media] dvb-core: fix 32-bit overflow during bandwidth calculation 
(2015-05-20 14:01:46 -0300)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git uvc/next

for you to fetch changes up to a3dacb93b22f47c5f65dec9cf1c537ae4265d24c:

  uvcvideo: Remove unneeded device disconnected flag (2015-05-25 13:30:34 
+0300)


Laurent Pinchart (3):
  uvcvideo: Implement DMABUF exporter role
  uvcvideo: Fix incorrect bandwidth with Chicony device 04f2:b50b
  uvcvideo: Remove unneeded device disconnected flag

 drivers/media/usb/uvc/uvc_driver.c |  2 --
 drivers/media/usb/uvc/uvc_queue.c  | 12 
 drivers/media/usb/uvc/uvc_v4l2.c   | 16 +---
 drivers/media/usb/uvc/uvc_video.c  |  8 
 drivers/media/usb/uvc/uvcvideo.h   |  7 ++-
 5 files changed, 35 insertions(+), 10 deletions(-)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 08/20] media: soc_camera pad-aware driver initialisation

2015-05-25 Thread Laurent Pinchart
Hi Hans,

On Monday 25 May 2015 00:43:25 Hans Verkuil wrote:
 On 05/24/2015 11:50 PM, Laurent Pinchart wrote:
  On Sunday 24 May 2015 10:08:15 Hans Verkuil wrote:
  On 05/23/2015 08:32 PM, Laurent Pinchart wrote:
  On Thursday 21 May 2015 07:55:10 Hans Verkuil wrote:
  On 05/20/2015 06:39 PM, William Towle wrote:
  Add detection of source pad number for drivers aware of the media
  controller API, so that soc_camera/rcar_vin can create device nodes
  to support a driver such as adv7604.c (for HDMI on Lager) underneath.
  
  Signed-off-by: William Towle william.to...@codethink.co.uk
  Reviewed-by: Rob Taylor rob.tay...@codethink.co.uk
  ---
  
   drivers/media/platform/soc_camera/rcar_vin.c   |4 
   drivers/media/platform/soc_camera/soc_camera.c |   27 ++-
   include/media/soc_camera.h |1 +
   3 files changed, 31 insertions(+), 1 deletion(-)
  
  diff --git a/drivers/media/platform/soc_camera/rcar_vin.c
  b/drivers/media/platform/soc_camera/rcar_vin.c index 0f67646..b4e9b43
  100644
  --- a/drivers/media/platform/soc_camera/rcar_vin.c
  +++ b/drivers/media/platform/soc_camera/rcar_vin.c
  @@ -1364,8 +1364,12 @@ static int rcar_vin_get_formats(struct
  soc_camera_device *icd, unsigned int idx,
  struct v4l2_mbus_framefmt *mf = fmt.format;
  struct v4l2_rect rect;
  struct device *dev = icd-parent;
  +   struct media_pad *remote_pad;
  int shift;
  
  +   remote_pad = media_entity_remote_pad(
  +   icd-vdev-entity.pads[0]);
  +   fmt.pad = remote_pad-index;
  
  This won't work if CONFIG_MEDIA_CONTROLLER isn't defined. All these
  media calls would all have to be under #ifdef CONFIG_MEDIA_CONTROLLER.
  
  Unfortunately, if it is not defined, then you still have no way of
  finding the source pad.
  
  Laurent, do you think if it would make sense to add a new subdev core
  op that will return the default source pad (I'm saying 'default' in
  case there are more) of a subdev? That way it can be used in non-MC
  drivers. We never needed the source pad before, but now we do, and this
  op only needs to be implemented if the default source pad != 0.
  
  I'm not too fond of that. Is there something wrong with the method
  implemented in this patch ? Is the dependency on CONFIG_MEDIA_CONTROLLER
  an issue ?
  
  1) it's a heck of a lot of code just to get a simple source pad that the
  subdev knows anyway,
  
  I don't think the subdev knows. If a subdev has multiple source pads
  there's no concept of a default source. It all depends on how the subdevs
  are connected, and media_entity_remote_pad() is the right way to find
  out.

 Note that with 'source pad' I am referring to the output pad of a subdev
 (ADV7604_PAD_SOURCE in the case of the adv7604). There may be some confusion
 here.

That's what I had understood :-)

 In my experience subdevs in a capture path have usually multiple input
 (sink) pads, but only one output (source) pad. Subdevs in a video output
 path tend to have one input (sink) pad and multiple output (source) pads.
 
 The multiple inputs/outputs are things like composite, S-Video, HDMI, VGA,
 etc. and the single input/output pad is where the device is hooked up to
 the mediabus which in turn connects to a DMA engine.

There's still no concept of a default source in the general case, but I 
assume you want to target the most common case where the subdev will have a 
single source pad ? A new operation (or field) could possibly work in some 
cases, but I feel it's a hack that lacks genericity. The above change is 
pretty simple from a bridge driver point of view, it's a single function call 
that will return the index of the connected pad. Sure, there's a little bit 
more core behind it compared to reading a fixed value, but it doesn't seem 
much to me, especially given that, in most of the cases, there will be a 
single link to check.

  2) soc-camera doesn't use the media controller today, so this would add a
  dependency on the mc just for this,
  
  I agree that we shouldn't pull the whole MC userspace API in just for
  this, but the kernel side of the API should be available as pad-level
  operations depend on MC. We could split the CONFIG_MEDIA_CONTROLLER option
  in two.
 
 The way it is now is pretty OK. We just miss the information about the pad
 that feeds the dma capture path and for output we miss the the pad that is
 fed by the dma output path.
 
 Bridge drivers currently just assume pad 0 in all cases, but that's
 obviously not always right as the adv7604 illustrates.

It's indeed a bad assumption. Drivers that are MC-aware use the correct pad 
numbers. For drivers that are getting ported to the pad-level API without 
being MC-aware it's tempting to just hardcode the pad number to 0 as that's a 
common case when dealing with sensors, but that's plain wrong.

 The alternative would be to just hardcode 

Re: [PATCH v2] v4l: subdev: Add pad config allocator and init

2015-05-25 Thread Hans Verkuil
On 05/25/2015 01:21 PM, Laurent Pinchart wrote:
 Hi Hans,
 
 On Monday 25 May 2015 00:25:36 Hans Verkuil wrote:
 On 05/24/2015 11:10 PM, Laurent Pinchart wrote:
 From: Laurent Pinchart laurent.pinch...@linaro.org

 Add a new subdev operation to initialize a subdev pad config array, and
 a helper function to allocate and initialize the array. This can be used
 by bridge drivers to implement try format based on subdev pad
 operations.

 Signed-off-by: Laurent Pinchart laurent.pinch...@linaro.org
 Acked-by: Vaibhav Hiremath vaibhav.hirem...@linaro.org

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

 Note that before this goes in there should be at least one subdev driver
 that implements init_cfg(). Perhaps adv7604?
 
 I fully agree, this needs to be used by at least one subdev driver.
 
 I'd go even further, I'd like to see v4l2_subdev_alloc_pad_config() used by a 
 bridge driver, to implement VIDIOC_TRY_FMT. I've originally written the patch 
 to implement VIDIOC_TRY_FMT (and VIDIOC_ENUM_FRAMESIZES) in a driver I'm 
 developing, but it's not ready for submission to mainline yet.
 
 Do you think a subdev driver is enough, or do we need a bridge too in order 
 to 
 merge this patch ?

Ideally a bridge as well, but the one that needs it first is soc-camera, which
generally is a pain. On the other hand, it is a good non-trivial use-case.

Regards,

Hans

 
 ---

  drivers/media/v4l2-core/v4l2-subdev.c | 19 ++-
  include/media/v4l2-subdev.h   | 10 ++
  2 files changed, 28 insertions(+), 1 deletion(-)

 Changes since v1:

 - Added v4l2_subdev_free_pad_config
 

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


[GIT PULL FOR v4.2] More fixes

2015-05-25 Thread Hans Verkuil
This patch series merges various fixes and improves colorspace support.

It also contains the Y16_BE patches which were not merged the previous time for
no clear reason, and my patch updating the querycap error code description, 
this time
with a better commit log explaining why we cannot say for certain what the error
will be.

Regards,

Hans

The following changes since commit 2a80f296422a01178d0a993479369e94f5830127:

  [media] dvb-core: fix 32-bit overflow during bandwidth calculation 
(2015-05-20 14:01:46 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.2k

for you to fetch changes up to 4ec6c326de9d1a06444ebb54477b712850ce7f15:

  v4l2: correct two SDR format names (2015-05-25 13:33:37 +0200)


Antti Palosaari (2):
  vivid: SDR cap add 'CU08' Complex U8 format
  v4l2: correct two SDR format names

Hans Verkuil (9):
  DocBook/media: add missing entry for V4L2_PIX_FMT_Y16_BE
  ivtv: fix incorrect audio mode report in log_status
  DocBook/media: fix querycap error code
  videodev2.h: add COLORSPACE_DEFAULT
  DocBook/media: document COLORSPACE_DEFAULT
  videodev2.h: add COLORSPACE_RAW
  DocBook/media: document COLORSPACE_RAW.
  videodev2.h: add macros to map colorspace defaults
  vivid: use new V4L2_MAP_*_DEFAULT defines

Ricardo Ribalda Delgado (5):
  media/videobuf2-dma-sg: Fix handling of sg_table structure
  media/videobuf2-dma-contig: Save output from dma_map_sg
  media/videobuf2-dma-vmalloc: Save output from dma_map_sg
  media/v4l2-core: Add support for V4L2_PIX_FMT_Y16_BE
  media/vivid: Add support for Y16_BE format

 Documentation/DocBook/media/v4l/pixfmt-y16-be.xml   | 81 
+
 Documentation/DocBook/media/v4l/pixfmt.xml  | 13 ++
 Documentation/DocBook/media/v4l/vidioc-querycap.xml |  2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c |  3 ++-
 drivers/media/platform/vivid/vivid-core.c   |  7 --
 drivers/media/platform/vivid/vivid-core.h   |  2 ++
 drivers/media/platform/vivid/vivid-sdr-cap.c| 96 
-
 drivers/media/platform/vivid/vivid-sdr-cap.h|  2 ++
 drivers/media/platform/vivid/vivid-tpg.c| 60 
+-
 drivers/media/platform/vivid/vivid-vid-common.c |  8 +++
 drivers/media/v4l2-core/v4l2-ioctl.c|  5 ++--
 drivers/media/v4l2-core/videobuf2-dma-contig.c  |  6 ++---
 drivers/media/v4l2-core/videobuf2-dma-sg.c  | 22 ++---
 drivers/media/v4l2-core/videobuf2-vmalloc.c |  6 ++---
 include/uapi/linux/videodev2.h  | 40 
+++
 15 files changed, 278 insertions(+), 75 deletions(-)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-y16-be.xml
--
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


[PATCHv2 1/4] reduce poll interval to allow full 60 FPS framerate

2015-05-25 Thread Florian Echtler
The SUR40 hardware can deliver images at up to 60 FPS; at full USB2 bandwidth,
one raw frame will take about 11 ms to transmit. If the poll interval is above
5 ms, fully handling one frame will take longer than 16 ms and the overall 
frame rate will drop below 60 FPS. To get the full frame rate without blocking
all the time and still allowing for a bit of timing jitter, we reduce the poll
interval to 4 ms.

Signed-off-by: Martin Kaltenbrunner mo...@yuri.at
Signed-off-by: Florian Echtler f...@butterbrot.org
---
 drivers/input/touchscreen/sur40.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/sur40.c 
b/drivers/input/touchscreen/sur40.c
index a24eba5..e707b8d 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -125,7 +125,7 @@ struct sur40_image_header {
 #define VIDEO_PACKET_SIZE  16384
 
 /* polling interval (ms) */
-#define POLL_INTERVAL 10
+#define POLL_INTERVAL 4
 
 /* maximum number of contacts FIXME: this is a guess? */
 #define MAX_CONTACTS 64
-- 
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


[PATCHv2 2/4] add frame size/frame rate query functions

2015-05-25 Thread Florian Echtler
Add missing functions to query the single fixed frame size (960x540) and
supported frame rates. Technically, the SUR40 supports any arbitrary frame
rate up to 60 FPS, as it is polled and not interrupt-driven. For now, we
just report 30 and 60 FPS, which is sufficient to make most V4L2 tools work.

Signed-off-by: Martin Kaltenbrunner mo...@yuri.at
Signed-off-by: Florian Echtler f...@butterbrot.org
---
 drivers/input/touchscreen/sur40.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/drivers/input/touchscreen/sur40.c 
b/drivers/input/touchscreen/sur40.c
index e707b8d..d860d05 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -778,6 +778,33 @@ static int sur40_vidioc_enum_fmt(struct file *file, void 
*priv,
return 0;
 }
 
+static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
+   struct v4l2_frmsizeenum *f)
+{
+   if ((f-index != 0) || (f-pixel_format != V4L2_PIX_FMT_GREY))
+   return -EINVAL;
+
+   f-type = V4L2_FRMSIZE_TYPE_DISCRETE;
+   f-discrete.width  = sur40_video_format.width;
+   f-discrete.height = sur40_video_format.height;
+   return 0;
+}
+
+static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv,
+   struct v4l2_frmivalenum *f)
+{
+   if ((f-index  1) || (f-pixel_format != V4L2_PIX_FMT_GREY)
+   || (f-width  != sur40_video_format.width)
+   || (f-height != sur40_video_format.height))
+   return -EINVAL;
+
+   f-type = V4L2_FRMIVAL_TYPE_DISCRETE;
+   f-discrete.denominator  = 60/(f-index+1);
+   f-discrete.numerator = 1;
+   return 0;
+}
+
+
 static const struct usb_device_id sur40_table[] = {
{ USB_DEVICE(ID_MICROSOFT, ID_SUR40) },  /* Samsung SUR40 */
{ }  /* terminating null entry */
@@ -829,6 +856,9 @@ static const struct v4l2_ioctl_ops sur40_video_ioctl_ops = {
.vidioc_s_fmt_vid_cap   = sur40_vidioc_fmt,
.vidioc_g_fmt_vid_cap   = sur40_vidioc_fmt,
 
+   .vidioc_enum_framesizes = sur40_vidioc_enum_framesizes,
+   .vidioc_enum_frameintervals = sur40_vidioc_enum_frameintervals,
+
.vidioc_enum_input  = sur40_vidioc_enum_input,
.vidioc_g_input = sur40_vidioc_g_input,
.vidioc_s_input = sur40_vidioc_s_input,
-- 
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


[PATCHv2 3/4] add extra debug output, remove noisy warning

2015-05-25 Thread Florian Echtler
Add dev_dbg statements for easier future debugging; also change the warning
about packet ID mismatches to debug output to avoid flooding the logs. This
warning is only important in a very specific/rare use case when trying to
correlate input events with video data.

Signed-off-by: Martin Kaltenbrunner mo...@yuri.at
Signed-off-by: Florian Echtler f...@butterbrot.org
---
 drivers/input/touchscreen/sur40.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/sur40.c 
b/drivers/input/touchscreen/sur40.c
index d860d05..8add986 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -342,7 +342,7 @@ static void sur40_poll(struct input_polled_dev *polldev)
 * instead of at the end.
 */
if (packet_id != header-packet_id)
-   dev_warn(sur40-dev, packet ID mismatch\n);
+   dev_dbg(sur40-dev, packet ID mismatch\n);
 
packet_blobs = result / sizeof(struct sur40_blob);
dev_dbg(sur40-dev, received %d blobs\n, packet_blobs);
@@ -389,6 +389,8 @@ static void sur40_process_video(struct sur40_state *sur40)
list_del(new_buf-list);
spin_unlock(sur40-qlock);
 
+   dev_dbg(sur40-dev, buffer acquired\n);
+
/* retrieve data via bulk read */
result = usb_bulk_msg(sur40-usbdev,
usb_rcvbulkpipe(sur40-usbdev, VIDEO_ENDPOINT),
@@ -416,6 +418,8 @@ static void sur40_process_video(struct sur40_state *sur40)
goto err_poll;
}
 
+   dev_dbg(sur40-dev, header acquired\n);
+
sgt = vb2_dma_sg_plane_desc(new_buf-vb, 0);
 
result = usb_sg_init(sgr, sur40-usbdev,
@@ -432,11 +436,14 @@ static void sur40_process_video(struct sur40_state *sur40)
goto err_poll;
}
 
+   dev_dbg(sur40-dev, image acquired\n);
+
/* mark as finished */
v4l2_get_timestamp(new_buf-vb.v4l2_buf.timestamp);
new_buf-vb.v4l2_buf.sequence = sur40-sequence++;
new_buf-vb.v4l2_buf.field = V4L2_FIELD_NONE;
vb2_buffer_done(new_buf-vb, VB2_BUF_STATE_DONE);
+   dev_dbg(sur40-dev, buffer marked done\n);
return;
 
 err_poll:
-- 
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


[PATCHv2 0/4] [sur40] minor fixes performance improvements

2015-05-25 Thread Florian Echtler
This patch series adds several small fixes, features  performance
improvements. Many thanks to Martin Kaltenbrunner for testing the
original driver  submitting the patches. 

Martin Kaltenbrunner (4):
  reduce poll interval to allow full 60 FPS framerate
  add frame size/frame rate query functions
  add extra debug output, remove noisy warning
  return BUF_STATE_ERROR if streaming stopped during acquisition

 drivers/input/touchscreen/sur40.c | 46 +--
 1 file changed, 44 insertions(+), 2 deletions(-)

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


[PATCHv2 4/4] return BUF_STATE_ERROR if streaming stopped during acquisition

2015-05-25 Thread Florian Echtler
When stop_streaming is called while a frame is currently being retrieved, the
buffer being filled will still be returned with BUF_STATE_DONE. By resetting
the sequence number and checking before returning the buffer, it can now
correctly be returned with BUF_STATE_ERROR.

Signed-off-by: Martin Kaltenbrunner mo...@yuri.at
Signed-off-by: Florian Echtler f...@butterbrot.org
---
 drivers/input/touchscreen/sur40.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/input/touchscreen/sur40.c 
b/drivers/input/touchscreen/sur40.c
index 8add986..8be7b9b 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -438,6 +438,10 @@ static void sur40_process_video(struct sur40_state *sur40)
 
dev_dbg(sur40-dev, image acquired\n);
 
+   /* return error if streaming was stopped in the meantime */
+   if (sur40-sequence == -1)
+   goto err_poll;
+
/* mark as finished */
v4l2_get_timestamp(new_buf-vb.v4l2_buf.timestamp);
new_buf-vb.v4l2_buf.sequence = sur40-sequence++;
@@ -723,6 +727,7 @@ static int sur40_start_streaming(struct vb2_queue *vq, 
unsigned int count)
 static void sur40_stop_streaming(struct vb2_queue *vq)
 {
struct sur40_state *sur40 = vb2_get_drv_priv(vq);
+   sur40-sequence = -1;
 
/* Release all active buffers */
return_all_buffers(sur40, VB2_BUF_STATE_ERROR);
-- 
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


Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property

2015-05-25 Thread Sylwester Nawrocki
Hi,

On 23/05/15 14:03, Sakari Ailus wrote:
 On Thu, May 21, 2015 at 03:28:40PM +0200, Sylwester Nawrocki wrote:
 flash-leds = flash_xx image_sensor_x, ...;
 
 One more matter to consider: xenon flash devices.
 
 How about samsung,camera-flashes (and ti,camera-flashes)? After pondering
 this awhile, I'm ok with removing the vendor prefix as well.
 
 Let me know what you think.

I thought about it a bit more and I have some doubts about semantics
as above. I'm fine with 'camera-flashes' as far as name is concerned.

Perhaps we should put only phandles to leds or xenon flash devices
in the 'camera-flashes' property. I think it would be more future
proof in case there is more nodes needed to describe the camera flash
(or a camera module) than the above two. And phandles to corresponding
image sensor device nodes would be put in a separate property.

camera-flashes = flash_xx, ...
camera-flash-masters = image_sensor_x, ...

Then pairs at same index would describe a single flash, 0 would indicate
a null entry if needed.
Similarly we could create properties for other sub-devices of a camera
module, like lenses, etc.

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


[GIT PULL FOR v4.2] Various fixes

2015-05-25 Thread Hans Verkuil
The following changes since commit 2a80f296422a01178d0a993479369e94f5830127:

  [media] dvb-core: fix 32-bit overflow during bandwidth calculation 
(2015-05-20 14:01:46 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.2l

for you to fetch changes up to 151dc7fb65b0634a853645fe559dabef0ed59612:

  wl128x: Allow compile test of GPIO consumers if !GPIOLIB (2015-05-25 14:14:31 
+0200)


Florian Echtler (4):
  reduce poll interval to allow full 60 FPS framerate
  add frame size/frame rate query functions
  add extra debug output, remove noisy warning
  return BUF_STATE_ERROR if streaming stopped during acquisition

Geert Uytterhoeven (1):
  wl128x: Allow compile test of GPIO consumers if !GPIOLIB

 drivers/input/touchscreen/sur40.c  | 46 
--
 drivers/media/radio/wl128x/Kconfig |  4 ++--
 2 files changed, 46 insertions(+), 4 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Access to MPEG-TS?

2015-05-25 Thread Steven Toth
On Sun, May 24, 2015 at 7:25 PM,  tomsmith7...@openmailbox.org wrote:
 Hello,

 I'm working on an application that - among other things - should be able to
 identify the programs in a MPEG transport stream broadcasted via DVB-C. This
 is what I have figured out so far:

 1. Open the DVB frontend.
 2. Fill struct dvb_frontend_parameters with transponder frequency etc.
 3. Apply struct dvb_frontend_parameters with FE_SET_FRONTEND ioctl call.

 After performing these steps, I call the FE_READ_STATUS ioctl and the status
 is FE_HAS_LOCK.

 I should then parse the MPEG transport stream to identify the programs, pids
 etc. but my problem is that I don't know how to access the transport stream?
 I have tried to read the file descriptor returned from opening the frontend,
 but no MPEG data is found there.

 Can anyone point me in the right direction?

Open and configure the demux device, configure it for pid 0x2000 and
read from it once your frontend indicates you have signal lock.

Also, for your parsing needs, I suggest you don't re-invent the wheel.
Take a look at libdvbpsi.

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.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 v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property

2015-05-25 Thread Jacek Anaszewski

Hi,

On 05/25/2015 02:00 PM, Sylwester Nawrocki wrote:

Hi,

On 23/05/15 14:03, Sakari Ailus wrote:

On Thu, May 21, 2015 at 03:28:40PM +0200, Sylwester Nawrocki wrote:

flash-leds = flash_xx image_sensor_x, ...;


One more matter to consider: xenon flash devices.

How about samsung,camera-flashes (and ti,camera-flashes)? After pondering
this awhile, I'm ok with removing the vendor prefix as well.

Let me know what you think.


I thought about it a bit more and I have some doubts about semantics
as above. I'm fine with 'camera-flashes' as far as name is concerned.

Perhaps we should put only phandles to leds or xenon flash devices
in the 'camera-flashes' property. I think it would be more future
proof in case there is more nodes needed to describe the camera flash
(or a camera module) than the above two. And phandles to corresponding
image sensor device nodes would be put in a separate property.


Could you give examples of the cases you are thinking of?


camera-flashes = flash_xx, ...
camera-flash-masters = image_sensor_x, ...

Then pairs at same index would describe a single flash, 0 would indicate
a null entry if needed.


When it should be needed?


Similarly we could create properties for other sub-devices of a camera
module, like lenses, etc.



--
Best Regards,
Jacek Anaszewski
--
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 03/20] media: adv7604: chip info and formats for ADV7612

2015-05-25 Thread Guennadi Liakhovetski
Hi William,

Just a nitpick:

On Wed, 20 May 2015, William Towle wrote:

 Add support for the ADV7612 chip as implemented on Renesas' Lager
 board to adv7604.c, including lists for formats/colourspace/timing
 selection and an IRQ handler.
 
 Signed-off-by: William Towle william.to...@codethink.co.uk
 ---
  drivers/media/i2c/adv7604.c |   83 
 +--
  1 file changed, 81 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index be3f866..a2abb04 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c

[snip]

 @@ -2805,8 +2883,9 @@ static int adv76xx_probe(struct i2c_client *client,
   } else {
   val = (adv_smbus_read_byte_data_check(client, 0xea, false)  8)
   | (adv_smbus_read_byte_data_check(client, 0xeb, false)  
 0);
 - if (val != 0x2051) {
 - v4l2_info(sd, not an adv7611 on address 0x%x\n,
 + if ((state-info-type == ADV7611  val != 0x2051) ||
 + (state-info-type == ADV7612  val != 0x2041)) {
 + v4l2_info(sd, not an adv761x on address 0x%x\n,

A switch / case might look slightly better here.

Thanks
Guennadi

   client-addr  1);
   return -ENODEV;
   }
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/9 v5] Helper to abstract vma handling in media layer

2015-05-25 Thread Jan Kara
On Mon 25-05-15 13:37:56, Hans Verkuil wrote:
 Hi Jan,
 
 On 05/13/2015 03:08 PM, Jan Kara wrote:
Hello,
  
  I'm sending the fifth version of my patch series to abstract vma handling
  from the various media drivers. The patches got some review from mm people 
  and
  testing from device driver guys so unless someone objects, patches will be
  queued in media tree for the next merge window.
 
 What is the current status? I saw one comment for patch 9, so I assume it is 
 not
 quite ready yet.
 
 Let me know when you think it is time to merge.
  There was a minor comment to the exynos patch - I've sent updated version
of that patch as a reply to the comment. Do you want me to resend the whole
series? Otherwise I think you can just pick up the patches and merge them.
Thanks!

Honza

  After this patch set drivers have to know much less details about vmas, 
  their
  types, and locking. Also quite some code is removed from them. As a bonus
  drivers get automatically VM_FAULT_RETRY handling. The primary motivation 
  for
  this series is to remove knowledge about mmap_sem locking from as many 
  places a
  possible so that we can change it with reasonable effort.
  
  The core of the series is the new helper get_vaddr_frames() which is given a
  virtual address and it fills in PFNs / struct page pointers (depending on 
  VMA
  type) into the provided array. If PFNs correspond to normal pages it also 
  grabs
  references to these pages. The difference from get_user_pages() is that this
  function can also deal with pfnmap, and io mappings which is what the media
  drivers need.
  
  I have tested the patches with vivid driver so at least vb2 code got some
  exposure. Conversion of other drivers was just compile-tested (for x86 so 
  e.g.
  exynos driver which is only for Samsung platform is completely untested).
  
  Honza
  Changes since v4:
  * Minor cleanups and fixes pointed out by Mel and Vlasta
  * Added Acked-by tags
  
  Changes since v3:
  * Added include linux/vmalloc.h into mm/gup.c as it's needed for some 
  archs
  * Fixed error path for exynos driver
  
  Changes since v2:
  * Renamed functions and structures as Mel suggested
  * Other minor changes suggested by Mel
  * Rebased on top of 4.1-rc2
  * Changed functions to get pointer to array of pages / pfns to perform
conversion if necessary. This fixes possible issue in the omap I may have
introduced in v2 and generally makes the API less errorprone.
  --
  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
  
 
-- 
Jan Kara j...@suse.cz
SUSE Labs, CR
--
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 07/20] media: soc_camera: rcar_vin: Add BT.709 24-bit RGB888 input support

2015-05-25 Thread Guennadi Liakhovetski
Hi William,

How about this version of this patch:

https://patchwork.linuxtv.org/patch/28098/

? I personally like that one better, it seems clearer to me. This one 
first sets a bit to vnmp, then make another check and inverts it, whereas 
that version clearly sets it just for equal colour-spaces. I just never 
got with proper Sob and (maybe?) authorship.

Thanks
Guennadi

On Wed, 20 May 2015, William Towle wrote:

 From: Koji Matsuoka koji.matsuoka...@renesas.com
 
 Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
 Signed-off-by: Simon Horman horms+rene...@verge.net.au
 Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com
 
 Modified to use MEDIA_BUS_FMT_* constants
 
 Signed-off-by: William Towle william.to...@codethink.co.uk
 Reviewed-by: Rob Taylor rob.tay...@codethink.co.uk
 ---
  drivers/media/platform/soc_camera/rcar_vin.c |   15 +++
  1 file changed, 15 insertions(+)
 
 diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
 b/drivers/media/platform/soc_camera/rcar_vin.c
 index db7700b..0f67646 100644
 --- a/drivers/media/platform/soc_camera/rcar_vin.c
 +++ b/drivers/media/platform/soc_camera/rcar_vin.c
 @@ -98,6 +98,7 @@
  #define VNMC_INF_YUV10_BT656 (2  16)
  #define VNMC_INF_YUV10_BT601 (3  16)
  #define VNMC_INF_YUV16   (5  16)
 +#define VNMC_INF_RGB888  (6  16)
  #define VNMC_VUP (1  10)
  #define VNMC_IM_ODD  (0  3)
  #define VNMC_IM_ODD_EVEN (1  3)
 @@ -620,6 +621,10 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
  
   /* input interface */
   switch (icd-current_fmt-code) {
 + case MEDIA_BUS_FMT_RGB888_1X24:
 + /* BT.601/BT.709 24-bit RGB-888 */
 + vnmc |= VNMC_INF_RGB888;
 + break;
   case MEDIA_BUS_FMT_YUYV8_1X16:
   /* BT.601/BT.1358 16bit YCbCr422 */
   vnmc |= VNMC_INF_YUV16;
 @@ -679,6 +684,15 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
   if (output_is_yuv)
   vnmc |= VNMC_BPS;
  
 + /*
 +  * The above assumes YUV input, toggle BPS for RGB input.
 +  * RGB inputs can be detected by checking that the most-significant
 +  * two bits of INF are set. This corresponds to the bits
 +  * set in VNMC_INF_RGB888.
 +  */
 + if ((vnmc  VNMC_INF_RGB888) == VNMC_INF_RGB888)
 + vnmc ^= VNMC_BPS;
 +
   /* progressive or interlaced mode */
   interrupts = progressive ? VNIE_FIE : VNIE_EFE;
  
 @@ -1423,6 +1437,7 @@ static int rcar_vin_get_formats(struct 
 soc_camera_device *icd, unsigned int idx,
   case MEDIA_BUS_FMT_YUYV8_1X16:
   case MEDIA_BUS_FMT_YUYV8_2X8:
   case MEDIA_BUS_FMT_YUYV10_2X10:
 + case MEDIA_BUS_FMT_RGB888_1X24:
   if (cam-extra_fmt)
   break;
  
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v4.2] Helper to abstract vma handling in media layer

2015-05-25 Thread Hans Verkuil
This pull request merged Jan's vb2/mm patches to abstract vma handling.

See http://www.spinics.net/lists/linux-media/msg89653.html for more info.

Regards,

Hans

The following changes since commit 2a80f296422a01178d0a993479369e94f5830127:

  [media] dvb-core: fix 32-bit overflow during bandwidth calculation 
(2015-05-20 14:01:46 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.2m

for you to fetch changes up to a50e19d76fcff4d57b89e7bfea14565b1caeef13:

  drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames() 
(2015-05-25 16:28:05 +0200)


Jan Kara (8):
  mm: Provide new get_vaddr_frames() helper
  media: omap_vout: Convert omap_vout_uservirt_to_phys() to use 
get_vaddr_pfns()
  vb2: Provide helpers for mapping virtual addresses
  media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vector
  media: vb2: Convert vb2_vmalloc_get_userptr() to use frame vector
  media: vb2: Convert vb2_dc_get_userptr() to use frame vector
  media: vb2: Remove unused functions
  drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()

 drivers/gpu/drm/exynos/exynos_drm_g2d.c|  91 
++-
 drivers/gpu/drm/exynos/exynos_drm_gem.c|  97 
-
 drivers/media/platform/omap/omap_vout.c|  69 +++-
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 214 

 drivers/media/v4l2-core/videobuf2-dma-sg.c |  97 
++---
 drivers/media/v4l2-core/videobuf2-memops.c | 148 
--
 drivers/media/v4l2-core/videobuf2-vmalloc.c|  94 
+---
 include/linux/mm.h |  44 +++
 include/media/videobuf2-memops.h   |  11 ++--
 mm/gup.c   | 226 
+
 10 files changed, 466 insertions(+), 625 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property

2015-05-25 Thread Sylwester Nawrocki
On 25/05/15 14:50, Jacek Anaszewski wrote:
 On 23/05/15 14:03, Sakari Ailus wrote:
  On Thu, May 21, 2015 at 03:28:40PM +0200, Sylwester Nawrocki wrote:
  flash-leds = flash_xx image_sensor_x, ...;
 
  One more matter to consider: xenon flash devices.
 
  How about samsung,camera-flashes (and ti,camera-flashes)? After pondering
  this awhile, I'm ok with removing the vendor prefix as well.
 
  Let me know what you think.
 
  I thought about it a bit more and I have some doubts about semantics
  as above. I'm fine with 'camera-flashes' as far as name is concerned.
 
  Perhaps we should put only phandles to leds or xenon flash devices
  in the 'camera-flashes' property. I think it would be more future
  proof in case there is more nodes needed to describe the camera flash
  (or a camera module) than the above two. And phandles to corresponding
  image sensor device nodes would be put in a separate property.

 Could you give examples of the cases you are thinking of?

I don't have any examples in mind ATM, I just wanted to point out
the above convention might not be flexible enough. Especially since
we already know there is more sub-devices within the camera module
than just flashes and image sensors.

  camera-flashes = flash_xx, ...
  camera-flash-masters = image_sensor_x, ...
 
  Then pairs at same index would describe a single flash, 0 would indicate
  a null entry if needed.

 When it should be needed?

Not sure if there is a real use case for null entries, it was just to
note we can skip any entry if needed - probably an irrelevant comment.
I could imagine 2 LEDs of which one is only triggered in software, so
it wouldn't have a 'camera-flash-masters' entry.

  Similarly we could create properties for other sub-devices of a camera
  module, like lenses, etc.

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


Re: [PATCH 16/20] media: adv7180: Fix set_pad_format() passing wrong format

2015-05-25 Thread Guennadi Liakhovetski
On Wed, 20 May 2015, William Towle wrote:

 Return a usable format (and resolution) from adv7180_set_pad_format()
 in the TRY_FORMAT case
 
 Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
 Tested-by: William Towle william.to...@codethink.co.uk

Author?

 ---
  drivers/media/i2c/adv7180.c |6 --
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
 index 09a96df..ba0b92d5 100644
 --- a/drivers/media/i2c/adv7180.c
 +++ b/drivers/media/i2c/adv7180.c
 @@ -686,12 +686,14 @@ static int adv7180_set_pad_format(struct v4l2_subdev 
 *sd,
   adv7180_set_field_mode(state);
   adv7180_set_power(state, true);
   }
 + adv7180_mbus_fmt(sd, framefmt);
   } else {
   framefmt = v4l2_subdev_get_try_format(sd, cfg, 0);
   *framefmt = format-format;
 + adv7180_mbus_fmt(sd, framefmt);
 + format-format = *framefmt;

Wouldn't it be easier to:

+   adv7180_mbus_fmt(sd, format-format);
framefmt = v4l2_subdev_get_try_format(sd, cfg, 0);
*framefmt = format-format;

and also make adv7180_mbus_fmt() return void?

Thanks
Guennadi

   }
 -
 - return adv7180_mbus_fmt(sd, framefmt);
 + return 0;
  }
  
  static int adv7180_g_mbus_config(struct v4l2_subdev *sd,
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property

2015-05-25 Thread Jacek Anaszewski

On 05/25/2015 04:28 PM, Sylwester Nawrocki wrote:

On 25/05/15 14:50, Jacek Anaszewski wrote:

On 23/05/15 14:03, Sakari Ailus wrote:

On Thu, May 21, 2015 at 03:28:40PM +0200, Sylwester Nawrocki wrote:

flash-leds = flash_xx image_sensor_x, ...;


One more matter to consider: xenon flash devices.

How about samsung,camera-flashes (and ti,camera-flashes)? After pondering
this awhile, I'm ok with removing the vendor prefix as well.

Let me know what you think.


I thought about it a bit more and I have some doubts about semantics
as above. I'm fine with 'camera-flashes' as far as name is concerned.

Perhaps we should put only phandles to leds or xenon flash devices
in the 'camera-flashes' property. I think it would be more future
proof in case there is more nodes needed to describe the camera flash
(or a camera module) than the above two. And phandles to corresponding
image sensor device nodes would be put in a separate property.


Could you give examples of the cases you are thinking of?


I don't have any examples in mind ATM, I just wanted to point out
the above convention might not be flexible enough. Especially since
we already know there is more sub-devices within the camera module
than just flashes and image sensors.


camera-flashes = flash_xx, ...
camera-flash-masters = image_sensor_x, ...

Then pairs at same index would describe a single flash, 0 would indicate
a null entry if needed.


When it should be needed?


Not sure if there is a real use case for null entries, it was just to
note we can skip any entry if needed - probably an irrelevant comment.
I could imagine 2 LEDs of which one is only triggered in software, so
it wouldn't have a 'camera-flash-masters' entry.


Similarly we could create properties for other sub-devices of a camera
module, like lenses, etc.


I have had the ninth version of the patch set ready to send today,
so in view of your doubts I made the property samsung specific
so as not to prevent us from going further while we will be
discussing the implementation of the generic property.
The 9th version of the patch set has been just sent.

--
Best Regards,
Jacek Anaszewski
--
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 13/20] media: soc_camera: v4l2-compliance fixes for querycap

2015-05-25 Thread Guennadi Liakhovetski
Hi William,

On Wed, 20 May 2015, William Towle wrote:

 Fill in bus_info field and zero reserved field.
 
 Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk

If you're the author and the submitter of this patch, why is Rob's Sob 
here needed? Or is he the author?

Thanks
Guennadi

 Reviewed-by: William Towle william.to...@codethink.co.uk
 ---
  drivers/media/platform/soc_camera/soc_camera.c |2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
 b/drivers/media/platform/soc_camera/soc_camera.c
 index fd7497e..583c5e6 100644
 --- a/drivers/media/platform/soc_camera/soc_camera.c
 +++ b/drivers/media/platform/soc_camera/soc_camera.c
 @@ -954,6 +954,8 @@ static int soc_camera_querycap(struct file *file, void  
 *priv,
   WARN_ON(priv != file-private_data);
  
   strlcpy(cap-driver, ici-drv_name, sizeof(cap-driver));
 + strlcpy(cap-bus_info, platform:soc_camera, sizeof(cap-bus_info));
 + memset(cap-reserved, 0, sizeof(cap-reserved));
   return ici-ops-querycap(ici, cap);
  }
  
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 17/20] media: adv7604: Support V4L_FIELD_INTERLACED

2015-05-25 Thread Guennadi Liakhovetski
On Wed, 20 May 2015, William Towle wrote:

 When hardware reports interlaced input, correctly set field to
 V4L_FIELD_INTERLACED ini adv76xx_fill_format.
 
 Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
 Reviewed-by: William Towle william.to...@codethink.co.uk
 ---
  drivers/media/i2c/adv7604.c |7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index 4bde3e1..d77ee1f 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -1791,7 +1791,12 @@ static void adv76xx_fill_format(struct adv76xx_state 
 *state,
  
   format-width = state-timings.bt.width;
   format-height = state-timings.bt.height;
 - format-field = V4L2_FIELD_NONE;
 +
 + if (state-timings.bt.interlaced)
 + format-field= V4L2_FIELD_INTERLACED;
 + else
 + format-field= V4L2_FIELD_NONE;
 +

A space before = please.

Thanks
Guennadi

   format-colorspace = V4L2_COLORSPACE_SRGB;
  
   if (state-timings.bt.flags  V4L2_DV_FL_IS_CE_VIDEO)
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/3] media: atmel-isi: remove the useless code which disable isi

2015-05-25 Thread Guennadi Liakhovetski
Hi Josh,

On Tue, 12 May 2015, Josh Wu wrote:

 Hi, Guennadi
 
 On 5/12/2015 4:16 AM, Guennadi Liakhovetski wrote:
  Hi Josh,
  
  Thanks for the patch. I'm afraid I don't quite understand why it is
  needed, could you maybe explain a bit more? Is it because
  
  (1) during ISI configuration the pixel clock from the sensor is (usually)
  anyway disabled, so, we don't have to additionally disable the ISI,
  without the pixel clock the ISI is anyway already disabled.
  
  or
  
  (2) disabling the ISI at those locations below breaks something, because
  when the ISI is disabled, the functionality, that's later used isn't
  available.
  
  I assume it's (1), but if that's the case, then this patch is just
  cosmetic, right?
 Right, it is (1). This patch doesn't impact the function of isi.
 
 The point is when we disable the ISI, we need make sure ISI peripheral clock
 and pixel clock is enabled. And also need to check the status register or irq
 to know whether the disable operation is successful. So best way to disable
 ISI is to call atmel_isi_wait_status(isi, WAIT_ISI_DISABLE).
 
 From this point, the isi_write(isi, ISI_CTRL, ISI_CTRL_DIS) in
 atmel_isi_probe() is not useful as ISI peripheral clock is not enable yet.
 but the other two in configure_geometry(), isi_camera_set_bus_param() can work
 and may protect the case the ISI is not in off state.

Ok, thanks for the explanation.

 
  The ISI is anyway disabled, so, that operation simply has
  no effect, but also doesn't hurt. OTOH, if some sensor keeps its master
  clock running all the time, then switching the ISI off as in the current
  version helps save some power, unless it breaks anything?
 So what about to keep the isi_write(isi, ISI_CTRL, ISI_CTRL_DIS) in
 configure_geometry() and isi_camera_set_bus_param().
 Only remove it from atmel_isi_probe()?

Good, let's do that.

Thanks
Guennadi

 
 Best Regards,
 Josh Wu
 
  
  Thanks
  Guennadi
  
  On Thu, 9 Apr 2015, Josh Wu wrote:
  
   To program ISI control register, the pixel clock should be enabled.
   So without pixel clock (from sensor) enabled, disable ISI controller is
   not make sense. So this patch remove those code.
   
   Signed-off-by: Josh Wu josh...@atmel.com
   ---
   
   Changes in v2:
   - this file is new added.
   
 drivers/media/platform/soc_camera/atmel-isi.c | 5 -
 1 file changed, 5 deletions(-)
   
   diff --git a/drivers/media/platform/soc_camera/atmel-isi.c
   b/drivers/media/platform/soc_camera/atmel-isi.c
   index c125b1d..31254b4 100644
   --- a/drivers/media/platform/soc_camera/atmel-isi.c
   +++ b/drivers/media/platform/soc_camera/atmel-isi.c
   @@ -131,8 +131,6 @@ static int configure_geometry(struct atmel_isi *isi,
   u32 width,
 return -EINVAL;
 }
 -   isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
   -
 cfg2 = isi_readl(isi, ISI_CFG2);
 /* Set YCC swap mode */
 cfg2 = ~ISI_CFG2_YCC_SWAP_MODE_MASK;
   @@ -843,7 +841,6 @@ static int isi_camera_set_bus_param(struct
   soc_camera_device *icd)
 cfg1 |= ISI_CFG1_THMASK_BEATS_16;
 -   isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
 isi_writel(isi, ISI_CFG1, cfg1);
 return 0;
   @@ -1022,8 +1019,6 @@ static int atmel_isi_probe(struct platform_device
   *pdev)
 if (isi-pdata.data_width_flags  ISI_DATAWIDTH_10)
 isi-width_flags |= 1  9;
 -   isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
   -
 irq = platform_get_irq(pdev, 0);
 if (IS_ERR_VALUE(irq)) {
 ret = irq;
   -- 
   1.9.1
   
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] davinci_vpfe: minor cleanups

2015-05-25 Thread Lad Prabhakar
From: Lad, Prabhakar prabhakar.cse...@gmail.com

Hi Hans,

These patch series includes minor cleanups for davinci vpfe
driver.

Lad, Prabhakar (3):
  media: davinci_vpfe: clear the output_specs
  media: davinci_vpfe: set minimum required buffers to three
  media: davinci_vpfe: use monotonic timestamp

 drivers/staging/media/davinci_vpfe/dm365_resizer.c   |  1 +
 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h |  2 --
 drivers/staging/media/davinci_vpfe/vpfe_video.c  | 18 +-
 3 files changed, 6 insertions(+), 15 deletions(-)

-- 
2.1.4

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


[PATCH 1/3] media: davinci_vpfe: clear the output_specs

2015-05-25 Thread Lad Prabhakar
From: Lad, Prabhakar prabhakar.cse...@gmail.com

clear of the output_specs before passing it to the
configure_resizer_out_params(), so that no garbage values
are set.

This fixes following build warning:
drivers/staging/media/davinci_vpfe/dm365_resizer.c: In function 
'resizer_set_stream':
drivers/staging/media/davinci_vpfe/dm365_resizer.c:190:46: warning: 
'output_specs.vst_c'
may be used uninitialized in this function [-Wmaybe-uninitialized]
  param-ext_mem_param[index].rsz_sdr_ptr_s_c = output-vst_c;
  ^
drivers/staging/media/davinci_vpfe/dm365_resizer.c:316:30: note: 
'output_specs.vst_c' was declared here
  struct vpfe_rsz_output_spec output_specs;
  ^
Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/staging/media/davinci_vpfe/dm365_resizer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c 
b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index b649813..acb293e 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -321,6 +321,7 @@ static int resizer_configure_output_win(struct 
vpfe_resizer_device *resizer)
 
outformat = resizer-resizer_a.formats[RESIZER_PAD_SOURCE];
 
+   memset(output_specs, 0x0, sizeof(struct vpfe_rsz_output_spec));
output_specs.vst_y = param-user_config.vst;
if (outformat-code == MEDIA_BUS_FMT_YDYUYDYV8_1X16)
output_specs.vst_c = param-user_config.vst;
-- 
2.1.4

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


[PATCH 3/3] media: davinci_vpfe: use monotonic timestamp

2015-05-25 Thread Lad Prabhakar
From: Lad, Prabhakar prabhakar.cse...@gmail.com

V4L2 drivers should use MONOTONIC timestamps instead of gettimeofday,
which is affected by daylight savings time.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 6744192..87048a1 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -470,7 +470,7 @@ void vpfe_video_process_buffer_complete(struct 
vpfe_video_device *video)
 {
struct vpfe_pipeline *pipe = video-pipe;
 
-   do_gettimeofday(video-cur_frm-vb.v4l2_buf.timestamp);
+   v4l2_get_timestamp(video-cur_frm-vb.v4l2_buf.timestamp);
vb2_buffer_done(video-cur_frm-vb, VB2_BUF_STATE_DONE);
if (pipe-state == VPFE_PIPELINE_STREAM_CONTINUOUS)
video-cur_frm = video-next_frm;
@@ -1337,6 +1337,7 @@ static int vpfe_reqbufs(struct file *file, void *priv,
q-ops = video_qops;
q-mem_ops = vb2_dma_contig_memops;
q-buf_struct_size = sizeof(struct vpfe_cap_buffer);
+   q-timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
 
ret = vb2_queue_init(q);
if (ret) {
-- 
2.1.4

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


[PATCH 2/3] media: davinci_vpfe: set minimum required buffers to three

2015-05-25 Thread Lad Prabhakar
From: Lad, Prabhakar prabhakar.cse...@gmail.com

this patch sets nbuffers to three or more and drops the
unset member video_limit which just a copy paste from
earlier driver.

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h |  2 --
 drivers/staging/media/davinci_vpfe/vpfe_video.c  | 15 +++
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h 
b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h
index 2632a80..8ad8d74 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h
@@ -67,8 +67,6 @@ struct vpfe_device {
/* CCDC IRQs used when CCDC/ISIF output to SDRAM */
unsigned intccdc_irq0;
unsigned intccdc_irq1;
-   /* maximum video memory that is available*/
-   unsigned intvideo_limit;
/* media device */
struct media_device media_dev;
/* ccdc subdevice */
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 06d48d5..6744192 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -27,9 +27,6 @@
 #include vpfe.h
 #include vpfe_mc_capture.h
 
-/* minimum number of buffers needed in cont-mode */
-#define MIN_NUM_BUFFERS3
-
 static int debug;
 
 /* get v4l2 subdev pointer to external subdev which is active */
@@ -1088,20 +1085,14 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, const 
struct v4l2_format *fmt,
struct vpfe_fh *fh = vb2_get_drv_priv(vq);
struct vpfe_video_device *video = fh-video;
struct vpfe_device *vpfe_dev = video-vpfe_dev;
-   struct vpfe_pipeline *pipe = video-pipe;
unsigned long size;
 
v4l2_dbg(1, debug, vpfe_dev-v4l2_dev, vpfe_buffer_queue_setup\n);
size = video-fmt.fmt.pix.sizeimage;
 
-   if (vpfe_dev-video_limit) {
-   while (size * *nbuffers  vpfe_dev-video_limit)
-   (*nbuffers)--;
-   }
-   if (pipe-state == VPFE_PIPELINE_STREAM_CONTINUOUS) {
-   if (*nbuffers  MIN_NUM_BUFFERS)
-   *nbuffers = MIN_NUM_BUFFERS;
-   }
+   if (vq-num_buffers + *nbuffers  3)
+   *nbuffers = 3 - vq-num_buffers;
+
*nplanes = 1;
sizes[0] = size;
alloc_ctxs[0] = video-alloc_ctx;
-- 
2.1.4

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


Re: [PATCH 14/20] media: rcar_vin: Reject videobufs that are too small for current format

2015-05-25 Thread Guennadi Liakhovetski
On Wed, 20 May 2015, William Towle wrote:

 In videobuf_setup reject buffers that are too small for the configured
 format. Fixes v4l2-complience issue.
 
 Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
 Reviewed-by: William Towle william.to...@codethink.co.uk

Ditto: why Rob's Sob if you're the author?

Thanks
Guennadi

 ---
  drivers/media/platform/soc_camera/rcar_vin.c |3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
 b/drivers/media/platform/soc_camera/rcar_vin.c
 index 571ab20..222002a 100644
 --- a/drivers/media/platform/soc_camera/rcar_vin.c
 +++ b/drivers/media/platform/soc_camera/rcar_vin.c
 @@ -541,6 +541,9 @@ static int rcar_vin_videobuf_setup(struct vb2_queue *vq,
   unsigned int bytes_per_line;
   int ret;
  
 + if (fmt-fmt.pix.sizeimage  icd-sizeimage)
 + return -EINVAL;
 +
   xlate = soc_camera_xlate_by_fourcc(icd,
  fmt-fmt.pix.pixelformat);
   if (!xlate)
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 2/8] media: Add registration helpers for V4L2 flash sub-devices

2015-05-25 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-led-class.c |  671 
 include/media/v4l2-flash-led-class.h   |  148 ++
 4 files changed, 832 insertions(+)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash-led-class.c
 create mode 100644 include/media/v4l2-flash-led-class.h

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index f7a01a7..b4b0229 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 V4L2 flash API for LED flash class devices
+   depends on VIDEO_V4L2_SUBDEV_API
+   depends on LEDS_CLASS_FLASH
+   ---help---
+ Say Y here to enable V4L2 flash API support for LED flash
+ class drivers.
+
+ 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..dc3de00 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-led-class.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-led-class.c 
b/drivers/media/v4l2-core/v4l2-flash-led-class.c
new file mode 100644
index 000..7599415c
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
@@ -0,0 +1,671 @@
+/*
+ * 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/of.h
+#include linux/slab.h
+#include linux/types.h
+#include media/v4l2-flash-led-class.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)
+
+enum ctrl_init_data_id {
+   LED_MODE,
+   TORCH_INTENSITY,
+   FLASH_INTENSITY,
+   INDICATOR_INTENSITY,
+   FLASH_TIMEOUT,
+   STROBE_SOURCE,
+   /*
+* Only above values are applicable to
+* the 'ctrls' array in the struct v4l2_flash.
+*/
+   FLASH_STROBE,
+   STROBE_STOP,
+   STROBE_STATUS,
+   FLASH_FAULT,
+   NUM_FLASH_CTRLS,
+};
+
+static enum led_brightness __intensity_to_led_brightness(
+   struct v4l2_ctrl *ctrl, s32 intensity)
+{
+   intensity -= ctrl-minimum;
+   intensity /= (u32) 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-minimum)
+   ++intensity;
+
+   return intensity;
+}
+
+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 

[PATCH v9 1/8] Documentation: leds: Add description of v4l2-flash sub-device

2015-05-25 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
Cc: Richard Purdie rpur...@rpsys.net
---
 Documentation/leds/leds-class-flash.txt |   50 +++
 1 file changed, 50 insertions(+)

diff --git a/Documentation/leds/leds-class-flash.txt 
b/Documentation/leds/leds-class-flash.txt
index 19bb673..e8ba3dc 100644
--- a/Documentation/leds/leds-class-flash.txt
+++ b/Documentation/leds/leds-class-flash.txt
@@ -20,3 +20,53 @@ Following sysfs attributes are exposed for controlling flash 
LED devices:
- max_flash_timeout
- flash_strobe
- flash_fault
+
+
+V4L2 flash wrapper for flash LEDs
+=
+
+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. The function takes six arguments:
+- dev   : flash device, e.g. an I2C device
+- of_node   : of_node of the LED, may be NULL if the same as device's
+- fled_cdev : LED flash class device to wrap
+- iled_cdev : LED class device representing indicator LED associated with
+ the LED flash class device, may be NULL
+- ops : V4L2 specific ops
+   * external_strobe_set - defines the source of the flash LED strobe -
+   V4L2_CID_FLASH_STROBE control or external source, typically
+   a sensor, which makes it possible to synchronise the flash
+   strobe start with exposure start,
+   * intensity_to_led_brightness and led_brightness_to_intensity - perform
+   enum led_brightness - V4L2 intensity conversion in a device
+   specific manner - they can be used for devices with non-linear
+   LED current scale.
+- config : configuration for V4L2 Flash sub-device
+   * dev_name - the name of the media entity, unique in the system,
+   * flash_faults - bitmask of flash faults that the LED flash class
+   device can report; corresponding LED_FAULT* bit definitions are
+   available in linux/led-class-flash.h,
+   * torch_intensity - constraints for the LED in TORCH mode
+   in microamperes,
+   * indicator_intensity - constraints for the indicator LED
+   in microamperes,
+   * has_external_strobe - determines whether the flash strobe source
+   can be switched to external.
+
+On remove the v4l2_flash_release function has to be called, which takes one
+argument - struct v4l2_flash pointer returned previously by v4l2_flash_init.
+
+Please refer to drivers/leds/leds-max77693.c for an exemplary usage of the
+v4l2 flash wrapper.
+
+Once the V4L2 sub-device is registered by the driver which created the Media
+controller device, the sub-device node acts just as a node of a native V4L2
+flash API device would. The calls are simply routed to the LED flash 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 v9 6/8] exynos4-is: Improve the mechanism of async subdevs verification

2015-05-25 Thread Jacek Anaszewski
Avoid verifying bound async sensor sub-devices by their of_nodes,
which duplicates v4l2-async functionality, in favour of matching
them by the corresponding struct v4l2_async_subdev. The structures
are now being aggregated in the newly introduced struct fimc_async_subdevs
which allows for categorizing async sub-devices by their type upon
DT node parsing and recognizing the type easily when they're being bound.

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 |   34 +++--
 drivers/media/platform/exynos4-is/media-dev.h |8 --
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index f315ef9..ff36a3b 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -331,6 +331,8 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
   unsigned int index)
 {
struct fimc_source_info *pd = fmd-sensor[index].pdata;
+   struct v4l2_async_notifier *notifier = fmd-subdev_notifier;
+   struct v4l2_async_subdev *asd;
struct device_node *rem, *ep, *np;
struct v4l2_of_endpoint endpoint;
 
@@ -387,9 +389,11 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
if (WARN_ON(index = ARRAY_SIZE(fmd-sensor)))
return -EINVAL;
 
-   fmd-sensor[index].asd.match_type = V4L2_ASYNC_MATCH_OF;
-   fmd-sensor[index].asd.match.of.node = rem;
-   fmd-async_subdevs[index] = fmd-sensor[index].asd;
+   asd = fmd-async_subdevs.sensors[index];
+   asd-match_type = V4L2_ASYNC_MATCH_OF;
+   asd-match.of.node = rem;
+   notifier-subdevs[notifier-num_subdevs++] = asd;
+   fmd-sensor[index].asd = asd;
 
fmd-num_sensors++;
 
@@ -1272,12 +1276,13 @@ static int subdev_notifier_bound(struct 
v4l2_async_notifier *notifier,
 struct v4l2_async_subdev *asd)
 {
struct fimc_md *fmd = notifier_to_fimc_md(notifier);
+   struct fimc_async_subdevs *async_subdevs = fmd-async_subdevs;
struct fimc_sensor_info *si = NULL;
int i;
 
/* 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)
+   for (i = 0; i  ARRAY_SIZE(async_subdevs-sensors); i++)
+   if (fmd-sensor[i].asd == asd)
si = fmd-sensor[i];
 
if (si == NULL)
@@ -1317,6 +1322,19 @@ unlock:
return ret;
 }
 
+static int fimc_md_register_async_entities(struct fimc_md *fmd)
+{
+   struct device *dev = fmd-media_dev.dev;
+   struct v4l2_async_notifier *notifier = fmd-subdev_notifier;
+
+   notifier-subdevs = devm_kcalloc(dev, FIMC_MAX_SENSORS,
+   sizeof(*notifier-subdevs), GFP_KERNEL);
+   if (!notifier-subdevs)
+   return -ENOMEM;
+
+   return fimc_md_register_sensor_entities(fmd);
+}
+
 static int fimc_md_probe(struct platform_device *pdev)
 {
struct device *dev = pdev-dev;
@@ -1379,7 +1397,7 @@ static int fimc_md_probe(struct platform_device *pdev)
goto err_clk;
}
 
-   ret = fimc_md_register_sensor_entities(fmd);
+   ret = fimc_md_register_async_entities(fmd);
if (ret) {
mutex_unlock(fmd-media_dev.graph_mutex);
goto err_m_ent;
@@ -1402,8 +1420,6 @@ static int fimc_md_probe(struct platform_device *pdev)
}
 
if (fmd-num_sensors  0) {
-   fmd-subdev_notifier.subdevs = fmd-async_subdevs;
-   fmd-subdev_notifier.num_subdevs = fmd-num_sensors;
fmd-subdev_notifier.bound = subdev_notifier_bound;
fmd-subdev_notifier.complete = subdev_notifier_complete;
fmd-num_sensors = 0;
@@ -1412,6 +1428,8 @@ static int fimc_md_probe(struct platform_device *pdev)
fmd-subdev_notifier);
if (ret)
goto err_clk_p;
+   } else {
+   devm_kfree(dev, fmd-subdev_notifier.subdevs);
}
 
return 0;
diff --git a/drivers/media/platform/exynos4-is/media-dev.h 
b/drivers/media/platform/exynos4-is/media-dev.h
index 0321454..ff6d020 100644
--- a/drivers/media/platform/exynos4-is/media-dev.h
+++ b/drivers/media/platform/exynos4-is/media-dev.h
@@ -88,11 +88,15 @@ struct fimc_camclk_info {
  */
 struct fimc_sensor_info {
struct fimc_source_info pdata;
-   struct v4l2_async_subdev asd;
+   struct v4l2_async_subdev *asd;
struct v4l2_subdev *subdev;
struct fimc_dev *host;
 };
 
+struct fimc_async_subdevs {
+   struct v4l2_async_subdev sensors[FIMC_MAX_SENSORS];
+};

[PATCH v9 3/8] leds: max77693: add support for V4L2 Flash sub-device

2015-05-25 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...@iki.fi
---
 drivers/leds/leds-max77693.c |  129 --
 1 file changed, 123 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
index eecaa92..b8b0eec 100644
--- a/drivers/leds/leds-max77693.c
+++ b/drivers/leds/leds-max77693.c
@@ -20,6 +20,7 @@
 #include linux/regmap.h
 #include linux/slab.h
 #include linux/workqueue.h
+#include media/v4l2-flash-led-class.h
 
 #define MODE_OFF   0
 #define MODE_FLASH(a)  (1  (a))
@@ -62,6 +63,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;
@@ -627,7 +630,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;
@@ -674,6 +678,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;
 
cfg-label[fled_id] =
@@ -786,11 +797,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;
 
@@ -838,6 +850,71 @@ static void max77693_init_flash_settings(struct 
max77693_sub_led *sub_led,
setting-val = setting-max;
 }
 
+#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;
+}
+
+static void max77693_init_v4l2_flash_config(struct max77693_sub_led *sub_led,
+   struct max77693_led_config_data *led_cfg,
+   struct v4l2_flash_config *v4l2_sd_cfg)
+{
+   struct max77693_led_device *led = sub_led_to_led(sub_led);
+   struct device *dev = led-pdev-dev;
+   struct max77693_dev *iodev = dev_get_drvdata(dev-parent);
+   struct i2c_client *i2c = iodev-i2c;
+   struct led_flash_setting *s;
+
+   snprintf(v4l2_sd_cfg-dev_name, sizeof(v4l2_sd_cfg-dev_name),
+%s %d-%04x, sub_led-fled_cdev.led_cdev.name,
+i2c_adapter_id(i2c-adapter), i2c-addr);
+
+   s = v4l2_sd_cfg-torch_intensity;
+   s-min = TORCH_IOUT_MIN;
+   s-max = sub_led-fled_cdev.led_cdev.max_brightness * TORCH_IOUT_STEP;
+   s-step = TORCH_IOUT_STEP;
+   s-val = s-max;
+
+   /* Init flash faults config */
+   v4l2_sd_cfg-flash_faults = LED_FAULT_OVER_VOLTAGE |
+   LED_FAULT_SHORT_CIRCUIT |
+   LED_FAULT_OVER_CURRENT;
+
+   v4l2_sd_cfg-has_external_strobe = true;
+}
+
+static const struct v4l2_flash_ops v4l2_flash_ops = {
+   .external_strobe_set = max77693_led_external_strobe_set,
+};
+#else
+static inline void max77693_init_v4l2_flash_config(
+   struct 

[PATCH v9 0/8] LED / flash API integration

2015-05-25 Thread Jacek Anaszewski
This is ninth non-RFC version of LED / flash API integration
series [1]. It is based on linux_next-20150519 with patch [2].


Changes since v8

- switched from samsung,flash-leds to samsun,camera-flashes DT property
- improved async sub-devices matching for exynos4-is media device
- modified v4l2-flash-led-class wrapper to incorporate indicator
  LED class deviecs


Changes since v7


- Merged patches from Sakari for v4l2-flash-led-class and V4L2 related
  patches for leds-max77693 and leds-aat1290 drivers
- applied minor modifications to the both led drivers related patches
- modified exynos4-is media device to parse new samsung,flash-led
  property, instead of 'flashes' array
- added DT documentation for samsung,flash-led property


Changes since v5

- renamed v4l2-flash module to v4l2-flash-led-class and applied
  other related modifications spotted by Sakari
- fixed not released of_node reference in max77693-led driver


Changes since v4

- adapted leds-max77693 and leds-aat1290 drivers to the recent
  modifications in leds/common.txt bindings documentation and
  changed the behaviour when properties are missing
- modified DT bindings documenation for the aforementioned
  drivers
- removed unjustified use of goto in the leds-aat1290 driver
- fixed lack of of_node_put in leds-aat1290 driver, after parsing
  DT child node 
- removed patch adding 'skyworks' vendor prefix, as the entry
  has been recently added


Changes since v2

- improved leds/common DT bindings documentation
- improved max77693-led DT documentation
- fixed validation of DT confguration for leds-max77693 by
  minimal values in joint iouts case
- removed trigger-type property from leds-max77693 bindings
  and adjusted the driver accordingly
- improved LED Flash class documentation related to v4l2-flash sub-device
  initialization
- excluded from leds-aat1290 DT bindings documentation the part
  related to handling external strobe sources


Changes since v1


- excluded exynos4-is media device related patches, as there is
  consenus required related to flash devices handling in media device
  DT bindings
- modifications around LED Flash class settings and v4l2 flash config
  initialization in LED Flash class drivers and v4l2-flash wrapper
- switched to using DT node name as a device name for leds-max77693
  and leds-aat1290 drivers, in case DT 'label' property is absent
- dropped OF dependecy for v4l2-flash wrapper
- moved LED_FAULTS definitions from led-class-flash.h to uapi/linux/leds.h
- allowed for multiple clients of v4l2-flash sub-device

==
Changes since RFC v13:
==

- reduced number of patches - some of them have been merged
- slightly modified max77693-led device naming
- fixed issues in v4l2-flash helpers detected with yavta
- cleaned up AAT1290 device tree documentation
- added GPIOLIB dependecy to AAT1290 related entry in Kconfig

Thanks,
Jacek Anaszewski

[1] http://www.spinics.net/lists/kernel/msg1944538.html
[2] http://www.spinics.net/lists/linux-media/msg89839.html

Jacek Anaszewski (8):
  Documentation: leds: Add description of v4l2-flash sub-device
  media: Add registration helpers for V4L2 flash sub-devices
  leds: max77693: add support for V4L2 Flash sub-device
  DT: aat1290: Document handling external strobe sources
  leds: aat1290: add support for V4L2 Flash sub-device
  exynos4-is: Improve the mechanism of async subdevs verification
  DT: Add documentation for exynos4-is 'flashes' property
  exynos4-is: Add support for v4l2-flash subdevs

 .../devicetree/bindings/leds/leds-aat1290.txt  |   36 +-
 .../devicetree/bindings/media/samsung-fimc.txt |   10 +
 Documentation/leds/leds-class-flash.txt|   50 ++
 drivers/leds/Kconfig   |1 +
 drivers/leds/leds-aat1290.c|  137 +++-
 drivers/leds/leds-max77693.c   |  129 +++-
 drivers/media/platform/exynos4-is/media-dev.c  |   94 ++-
 drivers/media/platform/exynos4-is/media-dev.h  |   12 +-
 drivers/media/v4l2-core/Kconfig|   11 +
 drivers/media/v4l2-core/Makefile   |2 +
 drivers/media/v4l2-core/v4l2-flash-led-class.c |  671 
 include/media/v4l2-flash-led-class.h   |  148 +
 12 files changed, 1277 insertions(+), 24 deletions(-)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash-led-class.c
 create mode 100644 include/media/v4l2-flash-led-class.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 v9 4/8] DT: aat1290: Document handling external strobe sources

2015-05-25 Thread Jacek Anaszewski
This patch adds documentation for a pinctrl-names property.
The property, when present, is used for switching the source
of the strobe signal for the 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...@iki.fi
Cc: devicet...@vger.kernel.org
---
 .../devicetree/bindings/leds/leds-aat1290.txt  |   36 ++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/leds/leds-aat1290.txt 
b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
index ef88b9c..c05ed91 100644
--- a/Documentation/devicetree/bindings/leds/leds-aat1290.txt
+++ b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
@@ -2,7 +2,9 @@
 
 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.
+respectively. In order to add a capability of selecting the strobe signal 
source
+(e.g. CPU or camera sensor) there is an additional switch required, independent
+of the flash chip. The switch is controlled with pin control.
 
 Required properties:
 
@@ -10,6 +12,13 @@ Required properties:
 - flen-gpios : Must be device tree identifier of the flash device FL_EN pin.
 - enset-gpios : Must be device tree identifier of the flash device EN_SET pin.
 
+Optional properties:
+- pinctrl-names : Must contain entries: default, host, isp. Entries
+   default and host must refer to the same pin configuration
+   node, which sets the host as a strobe signal provider. Entry
+   isp must refer to the pin configuration node, which sets the
+   ISP as a strobe signal provider.
+
 A discrete LED element connected to the device must be represented by a child
 node - see Documentation/devicetree/bindings/leds/common.txt.
 
@@ -25,13 +34,22 @@ Required properties of the LED child node:
 Optional properties of the LED child node:
 - label : see Documentation/devicetree/bindings/leds/common.txt
 
-Example (by Ct = 220nF, Rset = 160kohm):
+Example (by Ct = 220nF, Rset = 160kohm and exynos4412-trats2 board with
+a switch that allows for routing strobe signal either from the host or from
+the camera sensor):
+
+#include exynos4412.dtsi
 
 aat1290 {
compatible = skyworks,aat1290;
flen-gpios = gpj1 1 GPIO_ACTIVE_HIGH;
enset-gpios = gpj1 2 GPIO_ACTIVE_HIGH;
 
+   pinctrl-names = default, host, isp;
+   pinctrl-0 = camera_flash_host;
+   pinctrl-1 = camera_flash_host;
+   pinctrl-2 = camera_flash_isp;
+
camera_flash: flash-led {
label = aat1290-flash;
led-max-microamp = 520833;
@@ -39,3 +57,17 @@ aat1290 {
flash-timeout-us = 194;
};
 };
+
+pinctrl_0 {
+   camera_flash_host: camera-flash-host {
+   samsung,pins = gpj1-0;
+   samsung,pin-function = 1;
+   samsung,pin-val = 0;
+   };
+
+   camera_flash_isp: camera-flash-isp {
+   samsung,pins = gpj1-0;
+   samsung,pin-function = 1;
+   samsung,pin-val = 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 v9 5/8] leds: aat1290: add support for V4L2 Flash sub-device

2015-05-25 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...@iki.fi
---
 drivers/leds/Kconfig|1 +
 drivers/leds/leds-aat1290.c |  137 +--
 2 files changed, 132 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index ec26dd1..244815e 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -47,6 +47,7 @@ config LEDS_AAT1290
depends on LEDS_CLASS_FLASH
depends on GPIOLIB
depends on OF
+   depends on PINCTRL
help
 This option enables support for the LEDs on the AAT1290.
 
diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
index 6ea1d54..d3215d5 100644
--- a/drivers/leds/leds-aat1290.c
+++ b/drivers/leds/leds-aat1290.c
@@ -17,9 +17,11 @@
 #include linux/module.h
 #include linux/mutex.h
 #include linux/of.h
+#include linux/pinctrl/consumer.h
 #include linux/platform_device.h
 #include linux/slab.h
 #include linux/workqueue.h
+#include media/v4l2-flash-led-class.h
 
 #define AAT1290_MOVIE_MODE_CURRENT_ADDR17
 #define AAT1290_MAX_MM_CURR_PERCENT_0  16
@@ -52,6 +54,8 @@ struct aat1290_led_config_data {
u32 max_flash_current;
/* maximum flash timeout */
u32 max_flash_tm;
+   /* external strobe capability */
+   bool has_external_strobe;
/* max LED brightness level */
enum led_brightness max_brightness;
 };
@@ -64,6 +68,8 @@ struct aat1290_led {
 
/* corresponding LED Flash class device */
struct led_classdev_flash fled_cdev;
+   /* V4L2 Flash device */
+   struct v4l2_flash *v4l2_flash;
 
/* FLEN pin */
struct gpio_desc *gpio_fl_en;
@@ -230,11 +236,15 @@ static int aat1290_led_flash_timeout_set(struct 
led_classdev_flash *fled_cdev,
 }
 
 static int aat1290_led_parse_dt(struct aat1290_led *led,
-   struct aat1290_led_config_data *cfg)
+   struct aat1290_led_config_data *cfg,
+   struct device_node **sub_node)
 {
struct led_classdev *led_cdev = led-fled_cdev.led_cdev;
struct device *dev = led-pdev-dev;
struct device_node *child_node;
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   struct pinctrl *pinctrl;
+#endif
int ret = 0;
 
led-gpio_fl_en = devm_gpiod_get(dev, flen);
@@ -251,6 +261,17 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
return ret;
}
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   pinctrl = devm_pinctrl_get_select_default(led-pdev-dev);
+   if (IS_ERR(pinctrl)) {
+   cfg-has_external_strobe = false;
+   dev_info(dev,
+No support for external strobe detected.\n);
+   } else {
+   cfg-has_external_strobe = true;
+   }
+#endif
+
child_node = of_get_next_available_child(dev-of_node, NULL);
if (!child_node) {
dev_err(dev, No DT child node found for connected LED.\n);
@@ -288,6 +309,8 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
 
of_node_put(child_node);
 
+   *sub_node = child_node;
+
return ret;
 }
 
@@ -316,7 +339,8 @@ int init_mm_current_scale(struct aat1290_led *led,
int i, max_mm_current =
AAT1290_MAX_MM_CURRENT(cfg-max_flash_current);
 
-   led-mm_current_scale = kzalloc(sizeof(max_mm_current_percent),
+   led-mm_current_scale = devm_kzalloc(led-pdev-dev,
+   sizeof(max_mm_current_percent),
GFP_KERNEL);
if (!led-mm_current_scale)
return -ENOMEM;
@@ -329,11 +353,12 @@ int init_mm_current_scale(struct aat1290_led *led,
 }
 
 static int aat1290_led_get_configuration(struct aat1290_led *led,
-   struct aat1290_led_config_data *cfg)
+   struct aat1290_led_config_data *cfg,
+   struct device_node **sub_node)
 {
int ret;
 
-   ret = aat1290_led_parse_dt(led, cfg);
+   ret = aat1290_led_parse_dt(led, cfg, sub_node);
if (ret  0)
return ret;
/*
@@ -346,7 +371,10 @@ static int aat1290_led_get_configuration(struct 
aat1290_led *led,
 
aat1290_led_validate_mm_current(led, cfg);
 
-   kfree(led-mm_current_scale);
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+#else
+   devm_kfree(led-pdev-dev, led-mm_current_scale);
+#endif
 
return 0;
 }
@@ -365,6 +393,88 @@ static void aat1290_init_flash_timeout(struct aat1290_led 
*led,
setting-val = 

[PATCH v9 8/8] exynos4-is: Add support for v4l2-flash subdevs

2015-05-25 Thread Jacek Anaszewski
This patch adds support for external v4l2-flash devices.
The support includes parsing camera-flashes DT property
and asynchronous sub-device 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 |   64 -
 drivers/media/platform/exynos4-is/media-dev.h |4 ++
 2 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index ff36a3b..9fca1d4 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -455,6 +455,52 @@ rpm_put:
return ret;
 }
 
+static int fimc_md_register_flash_entities(struct fimc_md *fmd)
+{
+   struct device_node *parent = fmd-pdev-dev.of_node, *np_sensor,
+   *np_flash;
+   struct v4l2_async_notifier *notifier = fmd-subdev_notifier;
+   struct v4l2_async_subdev *asd;
+   int i, j, num_flashes = 0, num_elems;
+
+   num_elems = of_property_count_elems_of_size(parent,
+   samsung,camera-flashes, sizeof(np_flash));
+   /* samsung,camera-flashes property is optional */
+   if (num_elems  0)
+   return 0;
+
+   /* samsung,camera-flashes array must have even number of elements */
+   if ((num_elems  1) || (num_elems  FIMC_MAX_SENSORS * 2))
+   return -EINVAL;
+
+   for (i = 0; i  num_elems; i += 2) {
+   np_sensor = of_parse_phandle(parent,
+samsung,camera-flashes, i);
+
+   for (j = 0; j  fmd-num_sensors; j++)
+   if (fmd-async_subdevs.sensors[j].match.of.node ==
+   np_sensor)
+   break;
+
+   of_node_put(np_sensor);
+
+   if (j == fmd-num_sensors)
+   continue;
+
+   np_flash = of_parse_phandle(parent, samsung,camera-flashes,
+   i + 1);
+
+   asd = fmd-async_subdevs.flashes[num_flashes++];
+   asd-match_type = V4L2_ASYNC_MATCH_OF;
+   asd-match.of.node = np_flash;
+   notifier-subdevs[notifier-num_subdevs++] = asd;
+
+   of_node_put(np_flash);
+   }
+
+   return 0;
+}
+
 static int __of_get_csis_id(struct device_node *np)
 {
u32 reg = 0;
@@ -1280,6 +1326,15 @@ static int subdev_notifier_bound(struct 
v4l2_async_notifier *notifier,
struct fimc_sensor_info *si = NULL;
int i;
 
+   /*
+* Flash sub-devices are controlled independently of ISP, and thus
+* verify only that the sub-device being matched was previously
+* registered.
+*/
+   for (i = 0; i  ARRAY_SIZE(async_subdevs-flashes); i++)
+   if (async_subdevs-flashes[i] == asd)
+   return 0;
+
/* Find platform data for this sensor subdev */
for (i = 0; i  ARRAY_SIZE(async_subdevs-sensors); i++)
if (fmd-sensor[i].asd == asd)
@@ -1326,13 +1381,18 @@ static int fimc_md_register_async_entities(struct 
fimc_md *fmd)
 {
struct device *dev = fmd-media_dev.dev;
struct v4l2_async_notifier *notifier = fmd-subdev_notifier;
+   int ret;
 
-   notifier-subdevs = devm_kcalloc(dev, FIMC_MAX_SENSORS,
+   notifier-subdevs = devm_kcalloc(dev, FIMC_MAX_ASYNC_ENTITIES,
sizeof(*notifier-subdevs), GFP_KERNEL);
if (!notifier-subdevs)
return -ENOMEM;
 
-   return fimc_md_register_sensor_entities(fmd);
+   ret = fimc_md_register_sensor_entities(fmd);
+   if (ret)
+   return -EINVAL;
+
+   return fimc_md_register_flash_entities(fmd);
 }
 
 static int fimc_md_probe(struct platform_device *pdev)
diff --git a/drivers/media/platform/exynos4-is/media-dev.h 
b/drivers/media/platform/exynos4-is/media-dev.h
index ff6d020..be9205c 100644
--- a/drivers/media/platform/exynos4-is/media-dev.h
+++ b/drivers/media/platform/exynos4-is/media-dev.h
@@ -33,7 +33,10 @@
 #define PINCTRL_STATE_IDLE idle
 
 #define FIMC_MAX_SENSORS   4
+#define FIMC_MAX_FLASHES   4
+#define FIMC_MAX_ASYNC_ENTITIES(FIMC_MAX_SENSORS + FIMC_MAX_FLASHES)
 #define FIMC_MAX_CAMCLKS   2
+
 #define DEFAULT_SENSOR_CLK_FREQ2400U
 
 /* LCD/ISP Writeback clocks (PIXELASYNCMx) */
@@ -95,6 +98,7 @@ struct fimc_sensor_info {
 
 struct fimc_async_subdevs {
struct v4l2_async_subdev sensors[FIMC_MAX_SENSORS];
+   struct v4l2_async_subdev flashes[FIMC_MAX_FLASHES];
 };
 
 struct cam_clk {
-- 
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  

[PATCH v9 7/8] DT: Add documentation for exynos4-is 'flashes' property

2015-05-25 Thread Jacek Anaszewski
This patch adds a description of 'samsung,camera-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
---
 .../devicetree/bindings/media/samsung-fimc.txt |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/samsung-fimc.txt 
b/Documentation/devicetree/bindings/media/samsung-fimc.txt
index 922d6f8..0554cad 100644
--- a/Documentation/devicetree/bindings/media/samsung-fimc.txt
+++ b/Documentation/devicetree/bindings/media/samsung-fimc.txt
@@ -40,6 +40,14 @@ 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:
+
+- samsung,camera-flashes - Array of pairs of phandles to the camera sensor
+   devices and flash LEDs respectively. The pairs must reflect the board
+   configuration, i.e. a sensor has to be able to strobe a flash LED by
+   hardware. 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 +174,8 @@ Example:
clock-output-names = cam_a_clkout, cam_b_clkout;
pinctrl-names = default;
pinctrl-0 = cam_port_a_clk_active;
+   samsung,camera-flashes = rear_camera rear_flash,
+front_camera front_flash;
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


Re: [PATCH 20/20] media: soc_camera: Add debugging for get_formats

2015-05-25 Thread Guennadi Liakhovetski
Hi William,

In principle, we could add these or a bunch of other useful debugging 
prints, but mostly they are are one-off - you used them for your 
debugging, then you throw them away until the next time. Do you really 
find them so valuable? Usually when a new code fragment is added, it can 
bring some debugging with it for others, apart from the code author to be 
able to debug it easier. Adding debugging to existing code isn't that 
useful IMHO.

Thanks
Guennadi

On Wed, 20 May 2015, William Towle wrote:

 From: Rob Taylor rob.tay...@codethink.co.uk
 
 Some helpful debugging for get_formats use, useful for debugging
 v4l2-compliance issues.
 
 Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
 Reviewed-by: William Towle william.to...@codethink.co.uk
 ---
  drivers/media/platform/soc_camera/soc_camera.c |7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
 b/drivers/media/platform/soc_camera/soc_camera.c
 index 583c5e6..503e9b6 100644
 --- a/drivers/media/platform/soc_camera/soc_camera.c
 +++ b/drivers/media/platform/soc_camera/soc_camera.c
 @@ -522,7 +522,7 @@ static int soc_camera_init_user_formats(struct 
 soc_camera_device *icd)
  
   /* Second pass - actually fill data formats */
   fmts = 0;
 - for (i = 0; i  raw_fmts; i++)
 + for (i = 0; i  raw_fmts; i++) {
   if (!ici-ops-get_formats) {
   code.index = i;
   v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, code);
 @@ -537,6 +537,8 @@ static int soc_camera_init_user_formats(struct 
 soc_camera_device *icd)
   goto egfmt;
   fmts += ret;
   }
 + dev_dbg(icd-pdev,  Format: %x %c%c%c%c, 
 icd-user_formats[fmts-1].code, 
 pixfmtstr(icd-user_formats[fmts-1].host_fmt-fourcc));
 + }
  
   icd-num_user_formats = fmts;
   icd-current_fmt = icd-user_formats[0];
 @@ -732,6 +734,8 @@ static int soc_camera_open(struct file *file)
* apart from someone else calling open() simultaneously, but
* .host_lock is protecting us against it.
*/
 +
 + dev_dbg(icd-pdev, %s:%d calling set_fmt with size %d x 
 %d,__func__, __LINE__, f.fmt.pix.width, f.fmt.pix.height);
   ret = soc_camera_set_fmt(icd, f);
   if (ret  0)
   goto esfmt;
 @@ -2234,6 +2238,7 @@ static int soc_camera_pdrv_probe(struct platform_device 
 *pdev)
   icd-user_width = DEFAULT_WIDTH;
   icd-user_height= DEFAULT_HEIGHT;
  
 + dev_dbg(icd-pdev, %s:%d setting default user size to %d x 
 %d,__func__, __LINE__, icd-user_width, icd-user_height);
   return soc_camera_device_register(icd);
  }
  
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 19/20] media: rcar_vin: Clean up format debugging statements

2015-05-25 Thread Guennadi Liakhovetski
Hi William,

On Wed, 20 May 2015, William Towle wrote:

 Pretty print fourcc and code in format debugging statements.
 
 Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
 Reviewed-by: William Towle william.to...@codethink.co.uk
 ---
  drivers/media/platform/soc_camera/rcar_vin.c |   22 +++---
  1 file changed, 15 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
 b/drivers/media/platform/soc_camera/rcar_vin.c
 index b530503..0bebca5 100644
 --- a/drivers/media/platform/soc_camera/rcar_vin.c
 +++ b/drivers/media/platform/soc_camera/rcar_vin.c

[snip]

 @@ -1720,11 +1725,14 @@ static int rcar_vin_try_fmt(struct soc_camera_device 
 *icd,
   int width, height;
   int ret;
  
 + dev_dbg(icd-parent, TRY_FMT(%c%c%c%c, %ux%u)\n,
 + pixfmtstr(pix-pixelformat), pix-width, pix-height);
 +

Why is this additional debugging needed? Doesn't an identical call in 
soc_camera_try_fmt() already print the same information just before 
calling rcar_vin_try_fmt()?

Thanks
Guennadi
--
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: [PATCHv3 1/4] phy: phy-core: Make GENERIC_PHY an invisible option

2015-05-25 Thread Arun Ramamurthy



On 15-05-14 05:52 PM, Felipe Balbi wrote:

Hi,

On Wed, Apr 22, 2015 at 04:04:10PM -0700, Arun Ramamurthy wrote:

Most of the phy providers use select to enable GENERIC_PHY. Since select
is only recommended when the config is not visible, GENERIC_PHY is changed
an invisible option. To maintain consistency, all phy providers are changed
to select GENERIC_PHY and all non-phy drivers use depends on when the
phy framework is explicity required. USB_MUSB_OMAP2PLUS has a cyclic
dependency, so it is left as select.

Signed-off-by: Arun Ramamurthy arun.ramamur...@broadcom.com
---
  drivers/ata/Kconfig   | 1 -
  drivers/media/platform/exynos4-is/Kconfig | 2 +-
  drivers/phy/Kconfig   | 4 ++--
  drivers/usb/host/Kconfig  | 4 ++--
  drivers/video/fbdev/exynos/Kconfig| 2 +-
  5 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 5f60155..6d2e881 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -301,7 +301,6 @@ config SATA_MV
tristate Marvell SATA support
depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
   ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
-   select GENERIC_PHY
help
  This option enables support for the Marvell Serial ATA family.
  Currently supports 88SX[56]0[48][01] PCI(-X) chips,
diff --git a/drivers/media/platform/exynos4-is/Kconfig 
b/drivers/media/platform/exynos4-is/Kconfig
index b7b2e47..b6f3eaa 100644
--- a/drivers/media/platform/exynos4-is/Kconfig
+++ b/drivers/media/platform/exynos4-is/Kconfig
@@ -31,7 +31,7 @@ config VIDEO_S5P_FIMC
  config VIDEO_S5P_MIPI_CSIS
tristate S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver
depends on REGULATOR
-   select GENERIC_PHY
+   depends on GENERIC_PHY
help
  This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2
  receiver (MIPI-CSIS) devices.
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 2962de2..edecdb1 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -5,7 +5,7 @@
  menu PHY Subsystem

  config GENERIC_PHY
-   bool PHY Core
+   bool
help
  Generic PHY support.

@@ -72,7 +72,7 @@ config PHY_MIPHY365X
  config PHY_RCAR_GEN2
tristate Renesas R-Car generation 2 USB PHY driver
depends on ARCH_SHMOBILE
-   depends on GENERIC_PHY
+   select GENERIC_PHY


so some you changed from depends to select...


help
  Support for USB PHY found on Renesas R-Car generation 2 SoCs.

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 5ad60e4..e2197e2 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -182,7 +182,7 @@ config USB_EHCI_HCD_SPEAR
  config USB_EHCI_HCD_STI
tristate Support for ST STiHxxx on-chip EHCI USB controller
depends on ARCH_STI  OF
-   select GENERIC_PHY
+   depends on GENERIC_PHY


while others you changed from select to depends.

NAK.

Felipe, I dont understand your concern, could you please explain it more 
detail?  The logic behind the changes is that in cases where there was 
an explicit dependency, I changed it to depends on and in other cases 
I changed it to selects. Thanks

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


Re: [PATCH v8 8/8] DT: samsung-fimc: Add examples for samsung,flash-led property

2015-05-25 Thread Sakari Ailus
Hi Sylwester,

On Mon, May 25, 2015 at 04:28:22PM +0200, Sylwester Nawrocki wrote:
 On 25/05/15 14:50, Jacek Anaszewski wrote:
  On 23/05/15 14:03, Sakari Ailus wrote:
   On Thu, May 21, 2015 at 03:28:40PM +0200, Sylwester Nawrocki wrote:
   flash-leds = flash_xx image_sensor_x, ...;
  
   One more matter to consider: xenon flash devices.
  
   How about samsung,camera-flashes (and ti,camera-flashes)? After 
   pondering
   this awhile, I'm ok with removing the vendor prefix as well.
  
   Let me know what you think.
  
   I thought about it a bit more and I have some doubts about semantics
   as above. I'm fine with 'camera-flashes' as far as name is concerned.
  
   Perhaps we should put only phandles to leds or xenon flash devices
   in the 'camera-flashes' property. I think it would be more future
   proof in case there is more nodes needed to describe the camera flash
   (or a camera module) than the above two. And phandles to corresponding
   image sensor device nodes would be put in a separate property.
 
  Could you give examples of the cases you are thinking of?
 
 I don't have any examples in mind ATM, I just wanted to point out
 the above convention might not be flexible enough. Especially since
 we already know there is more sub-devices within the camera module
 than just flashes and image sensors.

I have to admit I've never seen a camera module with an integrated flash.
The lens is part of the module but typically flash is not. That doesn't say
there aren't such devices though.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: ERRORS

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

Results of the daily build of media_tree:

date:   Tue May 26 04:00:15 CEST 2015
git branch: test
git hash:   2a80f296422a01178d0a993479369e94f5830127
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-3.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: 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-bf561: WARNINGS
linux-git-i686: WARNINGS
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: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0-i686: WARNINGS
linux-4.1-rc1-i686: WARNINGS
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: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: WARNINGS
linux-4.1-rc1-x86_64: WARNINGS
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Tuesday.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


QUICK, RELIABLE AFFORDABLE LOAN

2015-05-25 Thread Pacificwest Cash Loan
SEE DETAILS TO APPLY TODAY

PACIFICWEST FINANCE CASH LOAN - SEE DETAILS TO APPLY.pdf
Description: Adobe PDF document