input_polldev interval (was Re: [sur40] Debugging a race condition)?

2015-03-25 Thread Florian Echtler
Sorry for the continued noise, but this bug/crash is proving quite difficult to 
nail down.

Currently, I'm setting the interval for input_polldev to 10 ms. However, with 
video data being retrieved at the same time, it's quite possible that one 
iteration of poll() will take longer than that. Could this ultimately be the 
reason? What happens if a new poll() call is scheduled before the previous one 
completes?

Best, Florian

On March 23, 2015 4:47:19 PM CET, Florian Echtler f...@butterbrot.org wrote:
Additional note: this happens almost never with the original code using
dma-contig, which is why I didn't catch it during testing. I've now
switched back and forth between the two versions multiple times, and
it's definitely a lot less stable with dma-sg and usb_sg_init/_wait.
Maybe that can help somebody in narrowing down the reason of the
problem?

Best, Florian

On 23.03.2015 12:57, Florian Echtler wrote:
 Hello everyone,
 
 now that I'm using the newly merged sur40 video driver in a
development
 environment, I've noticed that a custom V4L2 application we've been
 using in our lab will sometimes trigger a hard lockup of the machine
 (_nothing_ works anymore, no VT switching, no network, not even Magic
 SysRq).
 
 This doesn't happen with plain old cheese or v4l2-compliance, only
with
 our custom application and only under X11, i.e. as far as I can tell,
 when the input device is being polled at the same time. However, I
have
 a really hard time tracking this down, as even SysRq doesn't work
 anymore. A console continuously dumping dmesg or strace of our tool
 didn't really help, either.
 
 I assume that somehow the input_polldev thread is put to
sleep/waiting
 for a lock due to the video functions and that causes the lockup, but
I
 can't really tell where that might happen. Can somebody with better
 knowledge of the internals give some suggestions?
 
 Thanks  best regards, Florian
 

-- 
SENT FROM MY PDP-11
--
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 v1 09/11] DT: Add documentation for exynos4-is 'flashes' property

2015-03-25 Thread Jacek Anaszewski

Hi Sakari,

On 03/25/2015 02:06 AM, Sakari Ailus wrote:

Hi Jacek,

On Fri, Mar 20, 2015 at 04:03:29PM +0100, Jacek Anaszewski wrote:

This patch adds a description of 'flashes' property
to the samsung-fimc.txt.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Sylwester Nawrocki s.nawro...@samsung.com
---
  .../devicetree/bindings/media/samsung-fimc.txt |8 
  1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/samsung-fimc.txt 
b/Documentation/devicetree/bindings/media/samsung-fimc.txt
index 922d6f8..cb0e263 100644
--- a/Documentation/devicetree/bindings/media/samsung-fimc.txt
+++ b/Documentation/devicetree/bindings/media/samsung-fimc.txt
@@ -40,6 +40,13 @@ should be inactive. For the active-a state the camera port 
A must be activated
  and the port B deactivated and for the state active-b it should be the other
  way around.

+Optional properties:
+
+- flashes - Array of phandles to the flash LEDs that can be controlled by the
+   sub-devices contained in this media device. Flash LED is
+   represented by a child node of a flash LED device


This should be in
Documentation/devicetree/bindings/media/video-interfaces.txt.

Should flash devices be associated with sensors somehow rather than ISPs?
That's how they commonly are arranged, however that doesn't limit placing
them in silly places.

I'm not necessarily saying the flashes-property should be present in
sensor's DT nodes, but it'd be good to be able to make the association if
it's there.


I know of a SoC, which drives the flash from its on-chip ISP. The GPIO
connected to the flash controller's external strobe pin can be
configured so that the signal is routed to it from the ISP or from
CPU (for software strobe mode).

I think that Sylwester could say more in this subject.



+   (see Documentation/devicetree/bindings/leds/common.txt).
+
  The 'camera' node must include at least one 'fimc' child node.


@@ -166,6 +173,7 @@ Example:
clock-output-names = cam_a_clkout, cam_b_clkout;
pinctrl-names = default;
pinctrl-0 = cam_port_a_clk_active;
+   flashes = camera_flash, system_torch;
status = okay;
#address-cells = 1;
#size-cells = 1;


There will be other kind of devices that have somewhat similar relationship.
They just haven't been defined yet. Lens controllers or EEPROM for instance.
The two are an integral part of a module, something which is not modelled in
DT in any way, but perhaps should be.


Do you suggest using more generic name than 'flashes'?

--
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 v1 07/11] media: Add registration helpers for V4L2 flash sub-devices

2015-03-25 Thread Jacek Anaszewski

Hi Sakari,

On 03/25/2015 02:00 AM, Sakari Ailus wrote:

Hi Jacek,

On Tue, Mar 24, 2015 at 09:35:05AM +0100, Jacek Anaszewski wrote:
...

diff --git a/drivers/media/v4l2-core/v4l2-flash.c 
b/drivers/media/v4l2-core/v4l2-flash.c
new file mode 100644
index 000..804c2e4
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash.c
@@ -0,0 +1,607 @@
+/*
+ * 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.h
+#include ../../leds/leds.h


What do you need from leds.h? Shouldn't this be e.g. under include/linux
instead?


I need led_trigger_remove function.


It's exported but defined in what is obviously a private header file to the
framework. Could it be moved to include/linux/leds.h instead?



I guess so. I'll try to create a suitable patch.

--
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: [GIT PULL v2] of: Add of-graph helpers to loop over endpoints and find ports by id

2015-03-25 Thread Philipp Zabel
Hi Rob,

Am Dienstag, den 24.03.2015, 23:42 -0500 schrieb Rob Herring:
 On Tue, Mar 24, 2015 at 4:15 AM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:
  On Mon, Mar 23, 2015 at 05:29:02PM +0100, Heiko Stuebner wrote:
  Hi Rob, Philipp,
 
  Am Mittwoch, 11. März 2015, 09:51:21 schrieb Philipp Zabel:
   Am Dienstag, den 10.03.2015, 14:05 -0500 schrieb Rob Herring:
I've only been copied on this latest pull request and a version from
March of last year which Grant nak'ed. This series did not go to
devicetree list either. I'll take a look at the series.
  
   My bad, I should have copied you, too. Thanks for having a look now.
 
  any news on this?
 
  Because it looks like I'll need the of_graph_get_port_by_id functionality 
  in
  the short term, it'll be nice to not having to opencode this :-)
 
  Oh hell, you mean this still hasn't been merged for the next merge window?
 
  What's going on, Grant?
 
  Andrew, can you please take this if we send you the individual patches?
  If not, I'll merge it into my tree, and send it to Linus myself.  If
  Grant wakes up, we can address any comments he has at that time by
  additional patches.  (I'll give Grant an extra few days to reply to
  this mail...)
 
 I've merged this for 4.1. It is in my for-next branch[1].
 
 Rob
 
 [1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git

Thank you. Can I have your ok to merge the same into a pull requests
going out to the drm subsystem tree?

regards
Philipp

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


Re: [Linux-kernel] RFC: supporting adv7604.c under soc_camera/rcar_vin

2015-03-25 Thread William Towle

Hello again all,

  Previously I promised to comment further on progress with our work
supporting HDMI input on Lager. After studying commit 4c28078 [media]
rcar_vin: Add scaling support on Hans' subdev2 branch, I have come to
the conclusion that the following is actually reasonable behaviour when
no attempt to determine the resolution of the live stream (a non-VGA
720x576 in our case) has been made:


with
our modifications to adv7604.c we have seen a) recovery of a 640x480
image which is cropped rather than scaled, and/or b) recovery of a
2048x2048 image with the stream content in the top left corner.


  With our latest patchset, frame capture is essentially working and I
believe a solution is close, but the scaling changes introduce
behaviour that seems to be a regression for this particular test case
- see final point below. We have:

  1. ported code to subdev2 tree (with backward-compatibility for legacy
driver removed)
  2. adjusted adv7604.c to detect the ADV7612, adding calls to
get_fmt/set_fmt/enum_mbus_code pad ops to suit
  3. removed our attempt to query the driver's maximum resolution - the
scaling patch above configures the pre-clip/post-clip rectangles
sensibly without it
  4. modified our attempt to query the live resolution by doing this in
adv7604_fill_format() ... by reinstating adv761x_get_vid_info() as a
lightweight means of recovering the resolution, then using
query_dv_timings to update properly if state-timings is inconsistent
with its results; this leads to the need for:
  5. reverting the following, as not updating 'pix' with the (possibly
updated) resolution set_fmt returns leads to userland requesting an
inappropriately sized output buffer:
[commit 4c28078, static int rcar_vin_try_fmt(...)]
-   pix-width = mf.width;
-   pix-height = mf.height;
+   /* Adjust only if VIN cannot scale */
+   if (pix-width  mf.width * 2)
+   pix-width = mf.width * 2;
+   if (pix-height  mf.height * 3)
+   pix-height = mf.height * 3;

  Does this seem reasonable, or are there better ways of implementing
any of the above steps?

Cheers,
  Wills.
--
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: OMAP3 ISP previewer Y10 to UYVY conversion

2015-03-25 Thread Chris Whittenburg
Hi Sakari,

Thanks for the reply.

On Tue, Mar 24, 2015 at 6:51 PM, Sakari Ailus sakari.ai...@iki.fi wrote:
 Do you know if the sensor has black level correction enabled? It appears to
 have one, but I'm not completely sure what it does there. I'd check that it
 is indeed enabled.

The ar0130cs does have black level correction enabled by default.

My thought is that since the 12-bit data from the CCDC looked ok, that
it was something outside the sensor itself.

 I've captured the 12-bit data from the CCDC, downconverted it to Y8,
 and verified it looks ok, and is not washed out, so I'm suspecting the
 isp previewer is doing something wrong in the simple Y10 to UYVY
 conversion.

 Not necessarily wrong, the black level correction might be enabled by
 default, with the default configuration which works for most sensors (64 for
 10-bit data, 16 for 8-bit etc.).

Ok, I will check this.  You are referring to the Camera ISP VPBE
Preview Black Adjustment which is controlled by PRV_BLKADJOFF
register?

I also found that there are contrast and brightness settings in the
previewer which can be adjusted.  I'm not changing them from defaults,
so I thought the Y values would just get truncated to 8 bits and
mapped into the UYVY without being significantly altered.

Would your thought be the black level is more likely the issue rather
than brightness/contrast?

Is there anywhere else I should look?

Thanks,
Chris
--
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: input_polldev interval (was Re: [sur40] Debugging a race condition)?

2015-03-25 Thread Dmitry Torokhov
On March 24, 2015 11:52:54 PM PDT, Florian Echtler f...@butterbrot.org wrote:
Sorry for the continued noise, but this bug/crash is proving quite
difficult to nail down.

Currently, I'm setting the interval for input_polldev to 10 ms.
However, with video data being retrieved at the same time, it's quite
possible that one iteration of poll() will take longer than that. Could
this ultimately be the reason? What happens if a new poll() call is
scheduled before the previous one completes?

This can't happen as we schedule the next poll only after current one completes.

Hi Florian,
Thanks.

-- 
Dmitry
--
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: input_polldev interval (was Re: [sur40] Debugging a race condition)?

2015-03-25 Thread Florian Echtler
Hello Dmitry,

On 25.03.2015 14:23, Dmitry Torokhov wrote:
 On March 24, 2015 11:52:54 PM PDT, Florian Echtler f...@butterbrot.org 
 wrote:
 Currently, I'm setting the interval for input_polldev to 10 ms.
 However, with video data being retrieved at the same time, it's quite
 possible that one iteration of poll() will take longer than that. Could
 this ultimately be the reason? What happens if a new poll() call is
 scheduled before the previous one completes?
 
 This can't happen as we schedule the next poll only after current one 
 completes.
 
Thanks - any other suggestions how to debug such a complete freeze? I
have the following options enabled in my kernel config:

CONFIG_LOCKUP_DETECTOR=y
CONFIG_HARDLOCKUP_DETECTOR=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
CONFIG_EARLY_PRINTK_EFI=y

Unfortunately, even after the system is frozen for several minutes, I
never get to see a panic message. Maybe it's there on the console
somewhere, but the screen never switches away from X (and as mentioned
earlier, I think this bug can only be triggered from within X). Network
also freezes, so I don't think netconsole will help?

Best, Florian
-- 
SENT FROM MY DEC VT50 TERMINAL



signature.asc
Description: OpenPGP digital signature


Re: [GIT PULL v2] of: Add of-graph helpers to loop over endpoints and find ports by id

2015-03-25 Thread Rob Herring
On Wed, Mar 25, 2015 at 4:15 AM, Philipp Zabel p.za...@pengutronix.de wrote:
 Hi Rob,

 Am Dienstag, den 24.03.2015, 23:42 -0500 schrieb Rob Herring:
 On Tue, Mar 24, 2015 at 4:15 AM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:
  On Mon, Mar 23, 2015 at 05:29:02PM +0100, Heiko Stuebner wrote:
  Hi Rob, Philipp,
 
  Am Mittwoch, 11. März 2015, 09:51:21 schrieb Philipp Zabel:
   Am Dienstag, den 10.03.2015, 14:05 -0500 schrieb Rob Herring:
I've only been copied on this latest pull request and a version from
March of last year which Grant nak'ed. This series did not go to
devicetree list either. I'll take a look at the series.
  
   My bad, I should have copied you, too. Thanks for having a look now.
 
  any news on this?
 
  Because it looks like I'll need the of_graph_get_port_by_id functionality 
  in
  the short term, it'll be nice to not having to opencode this :-)
 
  Oh hell, you mean this still hasn't been merged for the next merge window?
 
  What's going on, Grant?
 
  Andrew, can you please take this if we send you the individual patches?
  If not, I'll merge it into my tree, and send it to Linus myself.  If
  Grant wakes up, we can address any comments he has at that time by
  additional patches.  (I'll give Grant an extra few days to reply to
  this mail...)

 I've merged this for 4.1. It is in my for-next branch[1].

 Rob

 [1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git

 Thank you. Can I have your ok to merge the same into a pull requests
 going out to the drm subsystem tree?

Sure.

Rob
--
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] coda: drop dma_sync_single_for_device in coda_bitstream_queue

2015-03-25 Thread Philipp Zabel
Issuing a cache flush for the whole bitstream buffer is not optimal in the first
place when only a part of it was written. But given that the buffer is mapped in
writecombine mode, it is not needed at all.

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

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index d39789d..d336cb6 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -181,10 +181,6 @@ static int coda_bitstream_queue(struct coda_ctx *ctx,
if (n  src_size)
return -ENOSPC;
 
-   dma_sync_single_for_device(ctx-dev-plat_dev-dev,
-  ctx-bitstream.paddr, ctx-bitstream.size,
-  DMA_TO_DEVICE);
-
src_buf-v4l2_buf.sequence = ctx-qsequence++;
 
return 0;
-- 
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 v1.1 14/15] omap3isp: Add support for the Device Tree

2015-03-25 Thread Sakari Ailus
Hi Laurent,

Thanks again for the comments!

On Sun, Mar 22, 2015 at 10:26:39PM +0200, Laurent Pinchart wrote:
 Hi Sakari,
 
 Thank you for the patch. This looks good to me, except that there's one last 
 bug I've spotted. Please see below.
 
 On Saturday 21 March 2015 00:05:04 Sakari Ailus wrote:
  Add the ISP device to omap3 DT include file and add support to the driver to
  use it.
  
  Also obtain information on the external entities and the ISP configuration
  related to them through the Device Tree in addition to the platform data.
  
  Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
  ---
  since v1:
  
  - Print endpoint name in debug message when parsing an endpoint.
  
  - Rename lane-polarity property as lane-polarities.
  
  - Print endpoint name with the interface if the interface is invalid.
  
  - Remove assignment to two variables at the same time.
  
  - Fix multiple sub-device support in isp_of_parse_nodes().
  
  - Put of_node properly in isp_of_parse_nodes() (requires Philipp Zabel's
patch of: Decrement refcount of previous endpoint in
of_graph_get_next_endpoint.
  
  - Rename return value variable rval as ret to be consistent with the rest of
  the driver.
  
  - Read the register offset from the syscom property's first argument.
  
   drivers/media/platform/omap3isp/isp.c   |  218 ++--
   drivers/media/platform/omap3isp/isp.h   |   11 ++
   drivers/media/platform/omap3isp/ispcsiphy.c |7 +
   3 files changed, 224 insertions(+), 12 deletions(-)
  
  diff --git a/drivers/media/platform/omap3isp/isp.c
  b/drivers/media/platform/omap3isp/isp.c index 992e74c..92a859e 100644
  --- a/drivers/media/platform/omap3isp/isp.c
  +++ b/drivers/media/platform/omap3isp/isp.c
 
 [snip]
 
  +static int isp_of_parse_nodes(struct device *dev,
  + struct v4l2_async_notifier *notifier)
  +{
  +   struct device_node *node;
  +
  +   notifier-subdevs = devm_kcalloc(
  +   dev, ISP_MAX_SUBDEVS, sizeof(*notifier-subdevs), GFP_KERNEL);
  +   if (!notifier-subdevs)
  +   return -ENOMEM;
  +
  +   while ((node = of_graph_get_next_endpoint(dev-of_node, node)) 
  +  notifier-num_subdevs  ISP_MAX_SUBDEVS) {
 
 If the first condition evaluates to true and the second one to false, the 
 loop 
 will be exited without releasing the reference to the DT node. You could just 
 switch the two conditions to fix this.

Oh, I missed this. I'll resend the set.

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


[PATCH v2 06/15] omap3isp: Refactor device configuration structs for Device Tree

2015-03-25 Thread Sakari Ailus
Make omap3isp configuration data structures more suitable for consumption by
the DT by separating the I2C bus information of all the sub-devices in a
group and the ISP bus information from each other. The ISP bus information
is made a pointer instead of being directly embedded in the struct.

In the case of the DT only the sensor specific information on the ISP bus
configuration is retained. The structs are renamed to reflect that.

After this change the structs needed to describe device configuration can be
allocated and accessed separately without those needed only in the case of
platform data. The platform data related structs can be later removed once
the support for platform data can be removed.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Igor Grinberg grinb...@compulab.co.il
Acked-by: Igor Grinberg grinb...@compulab.co.il (for cm-t35)
---
 arch/arm/mach-omap2/board-cm-t35.c  |   57 +++---
 drivers/media/platform/omap3isp/isp.c   |   86 +--
 drivers/media/platform/omap3isp/isp.h   |2 +-
 drivers/media/platform/omap3isp/ispccdc.c   |   26 
 drivers/media/platform/omap3isp/ispccp2.c   |   22 +++
 drivers/media/platform/omap3isp/ispcsi2.c   |8 +--
 drivers/media/platform/omap3isp/ispcsiphy.c |   21 ---
 include/media/omap3isp.h|   34 +--
 8 files changed, 119 insertions(+), 137 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 91738a1..b5dfbc1 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -492,51 +492,36 @@ static struct twl4030_platform_data cm_t35_twldata = {
 #include media/omap3isp.h
 #include devices.h
 
-static struct i2c_board_info cm_t35_isp_i2c_boardinfo[] = {
+static struct isp_platform_subdev cm_t35_isp_subdevs[] = {
{
-   I2C_BOARD_INFO(mt9t001, 0x5d),
-   },
-   {
-   I2C_BOARD_INFO(tvp5150, 0x5c),
-   },
-};
-
-static struct isp_subdev_i2c_board_info cm_t35_isp_primary_subdevs[] = {
-   {
-   .board_info = cm_t35_isp_i2c_boardinfo[0],
-   .i2c_adapter_id = 3,
-   },
-   { NULL, 0, },
-};
-
-static struct isp_subdev_i2c_board_info cm_t35_isp_secondary_subdevs[] = {
-   {
-   .board_info = cm_t35_isp_i2c_boardinfo[1],
+   .board_info = (struct i2c_board_info){
+   I2C_BOARD_INFO(mt9t001, 0x5d)
+   },
.i2c_adapter_id = 3,
-   },
-   { NULL, 0, },
-};
-
-static struct isp_v4l2_subdevs_group cm_t35_isp_subdevs[] = {
-   {
-   .subdevs = cm_t35_isp_primary_subdevs,
-   .interface = ISP_INTERFACE_PARALLEL,
-   .bus = {
-   .parallel = {
-   .clk_pol = 1,
+   .bus = (struct isp_bus_cfg){
+   .interface = ISP_INTERFACE_PARALLEL,
+   .bus = {
+   .parallel = {
+   .clk_pol = 1,
+   },
},
},
},
{
-   .subdevs = cm_t35_isp_secondary_subdevs,
-   .interface = ISP_INTERFACE_PARALLEL,
-   .bus = {
-   .parallel = {
-   .clk_pol = 0,
+   .board_info = (struct i2c_board_info){
+   I2C_BOARD_INFO(tvp5150, 0x5c),
+   },
+   .i2c_adapter_id = 3,
+   .bus = (struct isp_bus_cfg){
+   .interface = ISP_INTERFACE_PARALLEL,
+   .bus = {
+   .parallel = {
+   .clk_pol = 0,
+   },
},
},
},
-   { NULL, 0, },
+   { 0 },
 };
 
 static struct isp_platform_data cm_t35_isp_pdata = {
diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 537377b..1b5c6df 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -447,7 +447,7 @@ static void isp_core_init(struct isp_device *isp, int idle)
  */
 void omap3isp_configure_bridge(struct isp_device *isp,
   enum ccdc_input_entity input,
-  const struct isp_parallel_platform_data *pdata,
+  const struct isp_parallel_cfg *parcfg,
   unsigned int shift, unsigned int bridge)
 {
u32 ispctrl_val;
@@ -462,8 +462,8 @@ void omap3isp_configure_bridge(struct isp_device *isp,
switch (input) {
case CCDC_INPUT_PARALLEL:
ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_PARALLEL;
-   ispctrl_val |= pdata-clk_pol  

[PATCH v2 07/15] omap3isp: Rename regulators to better suit the Device Tree

2015-03-25 Thread Sakari Ailus
Rename VDD_CSIPHY1 as vdd-csiphy1 and VDD_CSIPHY2 as vdd-csiphy2.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/isp.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 1b5c6df..c045318 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2292,8 +2292,8 @@ static int isp_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, isp);
 
/* Regulators */
-   isp-isp_csiphy1.vdd = devm_regulator_get(pdev-dev, VDD_CSIPHY1);
-   isp-isp_csiphy2.vdd = devm_regulator_get(pdev-dev, VDD_CSIPHY2);
+   isp-isp_csiphy1.vdd = devm_regulator_get(pdev-dev, vdd-csiphy1);
+   isp-isp_csiphy2.vdd = devm_regulator_get(pdev-dev, vdd-csiphy2);
 
/* Clocks
 *
-- 
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 v2 00/15] omap3isp driver DT support

2015-03-25 Thread Sakari Ailus
Hi folks,

Here's an update to the omap3isp DT support patchset. v1 can be found here:

URL:http://www.spinics.net/lists/linux-media/msg87733.html

Changes since v1:

patch 10:

- Add Kconfig dependency to MFD_SYSCON

patch 12:

- Rename lane-polarity property as lane-polarities

patch 13:

- Add node name to warning print when there are too few lane polarities.

patch 14:

- Fix comment about sub-device node registration in isp_register_entities().

- Add endpoint name to a debug print in isp_of_parse_node().

- Rework isp_of_parse_nodes(). Fixed issue with putting the acquired nodes,
  and correctly register multiple async sub-devices.

- Rename rval as ret.

- Obtain syscon register index from DT.

Patch 15:

- Fix the number of users.

-- 
Kind regards,
Sakari

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


[PATCH v2 01/15] omap3isp: Fix error handling in probe

2015-03-25 Thread Sakari Ailus
The mutex was not destroyed correctly if dma_coerce_mask_and_coherent()
failed for some reason.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/isp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index deca809..fb193b6 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2252,7 +2252,7 @@ static int isp_probe(struct platform_device *pdev)
 
ret = dma_coerce_mask_and_coherent(isp-dev, DMA_BIT_MASK(32));
if (ret)
-   return ret;
+   goto error;
 
platform_set_drvdata(pdev, isp);
 
-- 
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 v2 11/15] omap3isp: Replace many MMIO regions by two

2015-03-25 Thread Sakari Ailus
The omap3isp MMIO register block is contiguous in the MMIO register space
apart from the fact that the ISP IOMMU register block is in the middle of
the area. Ioremap it at two occasions, and keep the rest of the layout of
the register space internal to the omap3isp driver.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/devices.c |   66 +--
 arch/arm/mach-omap2/omap34xx.h|   36 +--
 drivers/media/platform/omap3isp/isp.c |  113 +
 drivers/media/platform/omap3isp/isp.h |4 +-
 4 files changed, 66 insertions(+), 153 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index e945957..990338f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -74,72 +74,12 @@ omap_postcore_initcall(omap3_l3_init);
 static struct resource omap3isp_resources[] = {
{
.start  = OMAP3430_ISP_BASE,
-   .end= OMAP3430_ISP_END,
+   .end= OMAP3430_ISP_BASE + 0x12fc,
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP3430_ISP_CCP2_BASE,
-   .end= OMAP3430_ISP_CCP2_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_CCDC_BASE,
-   .end= OMAP3430_ISP_CCDC_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_HIST_BASE,
-   .end= OMAP3430_ISP_HIST_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_H3A_BASE,
-   .end= OMAP3430_ISP_H3A_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_PREV_BASE,
-   .end= OMAP3430_ISP_PREV_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_RESZ_BASE,
-   .end= OMAP3430_ISP_RESZ_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_SBL_BASE,
-   .end= OMAP3430_ISP_SBL_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_CSI2A_REGS1_BASE,
-   .end= OMAP3430_ISP_CSI2A_REGS1_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3430_ISP_CSIPHY2_BASE,
-   .end= OMAP3430_ISP_CSIPHY2_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3630_ISP_CSI2A_REGS2_BASE,
-   .end= OMAP3630_ISP_CSI2A_REGS2_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3630_ISP_CSI2C_REGS1_BASE,
-   .end= OMAP3630_ISP_CSI2C_REGS1_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3630_ISP_CSIPHY1_BASE,
-   .end= OMAP3630_ISP_CSIPHY1_END,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP3630_ISP_CSI2C_REGS2_BASE,
-   .end= OMAP3630_ISP_CSI2C_REGS2_END,
+   .start  = OMAP3430_ISP_BASE2,
+   .end= OMAP3430_ISP_BASE2 + 0x0600,
.flags  = IORESOURCE_MEM,
},
{
diff --git a/arch/arm/mach-omap2/omap34xx.h b/arch/arm/mach-omap2/omap34xx.h
index c0d1b4b..ed0024d 100644
--- a/arch/arm/mach-omap2/omap34xx.h
+++ b/arch/arm/mach-omap2/omap34xx.h
@@ -46,39 +46,9 @@
 
 #define OMAP34XX_IC_BASE   0x4820
 
-#define OMAP3430_ISP_BASE  (L4_34XX_BASE + 0xBC000)
-#define OMAP3430_ISP_CBUFF_BASE(OMAP3430_ISP_BASE + 0x0100)
-#define OMAP3430_ISP_CCP2_BASE (OMAP3430_ISP_BASE + 0x0400)
-#define OMAP3430_ISP_CCDC_BASE (OMAP3430_ISP_BASE + 0x0600)
-#define OMAP3430_ISP_HIST_BASE (OMAP3430_ISP_BASE + 0x0A00)
-#define OMAP3430_ISP_H3A_BASE  (OMAP3430_ISP_BASE + 0x0C00)
-#define OMAP3430_ISP_PREV_BASE (OMAP3430_ISP_BASE + 0x0E00)
-#define OMAP3430_ISP_RESZ_BASE (OMAP3430_ISP_BASE + 0x1000)
-#define OMAP3430_ISP_SBL_BASE  (OMAP3430_ISP_BASE + 0x1200)
-#define OMAP3430_ISP_MMU_BASE  (OMAP3430_ISP_BASE + 0x1400)
-#define OMAP3430_ISP_CSI2A_REGS1_BASE  (OMAP3430_ISP_BASE + 0x1800)
-#define OMAP3430_ISP_CSIPHY2_BASE  (OMAP3430_ISP_BASE + 0x1970)
-#define OMAP3630_ISP_CSI2A_REGS2_BASE  

[PATCH v2 10/15] omap3isp: Move the syscon register out of the ISP register maps

2015-03-25 Thread Sakari Ailus
The syscon register isn't part of the ISP, use it through the syscom driver
regmap instead. The syscom block is considered to be from 343x on ISP
revision 2.0 whereas 15.0 is assumed to have 3630 syscon.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/devices.c   |   10 --
 drivers/media/platform/Kconfig  |1 +
 drivers/media/platform/omap3isp/isp.c   |   20 
 drivers/media/platform/omap3isp/isp.h   |   19 +--
 drivers/media/platform/omap3isp/ispcsiphy.c |   20 +---
 5 files changed, 43 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1afb50d..e945957 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -143,16 +143,6 @@ static struct resource omap3isp_resources[] = {
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE,
-   .end= OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE 
+ 3,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = OMAP343X_CTRL_BASE + 
OMAP3630_CONTROL_CAMERA_PHY_CTRL,
-   .end= OMAP343X_CTRL_BASE + 
OMAP3630_CONTROL_CAMERA_PHY_CTRL + 3,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
.start  = 24 + OMAP_INTC_START,
.flags  = IORESOURCE_IRQ,
}
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 2e30be5..272dc8c 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -90,6 +90,7 @@ config VIDEO_OMAP3
select ARM_DMA_USE_IOMMU
select OMAP_IOMMU
select VIDEOBUF2_DMA_CONTIG
+   select MFD_SYSCON
---help---
  Driver for an OMAP 3 camera controller.
 
diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 68d7edfc..83b4368 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -51,6 +51,7 @@
 #include linux/dma-mapping.h
 #include linux/i2c.h
 #include linux/interrupt.h
+#include linux/mfd/syscon.h
 #include linux/module.h
 #include linux/omap-iommu.h
 #include linux/platform_device.h
@@ -94,8 +95,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
   1  OMAP3_ISP_IOMEM_RESZ |
   1  OMAP3_ISP_IOMEM_SBL |
   1  OMAP3_ISP_IOMEM_CSI2A_REGS1 |
-  1  OMAP3_ISP_IOMEM_CSIPHY2 |
-  1  OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE,
+  1  OMAP3_ISP_IOMEM_CSIPHY2,
+   .syscon_offset = 0xdc,
+   .phy_type = ISP_PHY_TYPE_3430,
},
{
.isp_rev = ISP_REVISION_15_0,
@@ -112,8 +114,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
   1  OMAP3_ISP_IOMEM_CSI2A_REGS2 |
   1  OMAP3_ISP_IOMEM_CSI2C_REGS1 |
   1  OMAP3_ISP_IOMEM_CSIPHY1 |
-  1  OMAP3_ISP_IOMEM_CSI2C_REGS2 |
-  1  OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL,
+  1  OMAP3_ISP_IOMEM_CSI2C_REGS2,
+   .syscon_offset = 0x2f0,
+   .phy_type = ISP_PHY_TYPE_3630,
},
 };
 
@@ -2352,6 +2355,15 @@ static int isp_probe(struct platform_device *pdev)
}
}
 
+   isp-syscon = syscon_regmap_lookup_by_pdevname(syscon.0);
+   if (IS_ERR(isp-syscon)) {
+   ret = PTR_ERR(isp-syscon);
+   goto error_isp;
+   }
+
+   isp-syscon_offset = isp_res_maps[m].syscon_offset;
+   isp-phy_type = isp_res_maps[m].phy_type;
+
/* IOMMU */
ret = isp_attach_iommu(isp);
if (ret  0) {
diff --git a/drivers/media/platform/omap3isp/isp.h 
b/drivers/media/platform/omap3isp/isp.h
index 9535524..03d2129 100644
--- a/drivers/media/platform/omap3isp/isp.h
+++ b/drivers/media/platform/omap3isp/isp.h
@@ -59,8 +59,6 @@ enum isp_mem_resources {
OMAP3_ISP_IOMEM_CSI2C_REGS1,
OMAP3_ISP_IOMEM_CSIPHY1,
OMAP3_ISP_IOMEM_CSI2C_REGS2,
-   OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE,
-   OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL,
OMAP3_ISP_IOMEM_LAST
 };
 
@@ -93,14 +91,25 @@ enum isp_subclk_resource {
 /* ISP2P: OMAP 36xx */
 #define ISP_REVISION_15_0  0xF0
 
+#define ISP_PHY_TYPE_3430  0
+#define ISP_PHY_TYPE_3630  1
+
+struct regmap;
+
 /*
  * struct isp_res_mapping - Map ISP io resources to ISP revision.
  * @isp_rev: ISP_REVISION_x_x
  * @map: bitmap for enum isp_mem_resources
+ * @syscon_offset: offset of the syscon register for 343x / 3630
+ *   

[PATCH v2 13/15] v4l: of: Read lane-polarities endpoint property

2015-03-25 Thread Sakari Ailus
Add lane_polarities field to struct v4l2_of_bus_mipi_csi2 and write the
contents of the lane-polarities property to it. The field tells the polarity
of the physical lanes starting from the first one. Any unused lanes are
ignored, i.e. only the polarity of the used lanes is specified.

Also rework reading the data-lanes property a little.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/v4l2-core/v4l2-of.c |   41 +
 include/media/v4l2-of.h   |3 +++
 2 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-of.c 
b/drivers/media/v4l2-core/v4l2-of.c
index b4ed9a9..58e401f 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -19,11 +19,10 @@
 
 #include media/v4l2-of.h
 
-static void v4l2_of_parse_csi_bus(const struct device_node *node,
- struct v4l2_of_endpoint *endpoint)
+static int v4l2_of_parse_csi_bus(const struct device_node *node,
+struct v4l2_of_endpoint *endpoint)
 {
struct v4l2_of_bus_mipi_csi2 *bus = endpoint-bus.mipi_csi2;
-   u32 data_lanes[ARRAY_SIZE(bus-data_lanes)];
struct property *prop;
bool have_clk_lane = false;
unsigned int flags = 0;
@@ -32,16 +31,34 @@ static void v4l2_of_parse_csi_bus(const struct device_node 
*node,
prop = of_find_property(node, data-lanes, NULL);
if (prop) {
const __be32 *lane = NULL;
-   int i;
+   unsigned int i;
 
-   for (i = 0; i  ARRAY_SIZE(data_lanes); i++) {
-   lane = of_prop_next_u32(prop, lane, data_lanes[i]);
+   for (i = 0; i  ARRAY_SIZE(bus-data_lanes); i++) {
+   lane = of_prop_next_u32(prop, lane, v);
if (!lane)
break;
+   bus-data_lanes[i] = v;
}
bus-num_data_lanes = i;
-   while (i--)
-   bus-data_lanes[i] = data_lanes[i];
+   }
+
+   prop = of_find_property(node, lane-polarities, NULL);
+   if (prop) {
+   const __be32 *polarity = NULL;
+   unsigned int i;
+
+   for (i = 0; i  ARRAY_SIZE(bus-lane_polarities); i++) {
+   polarity = of_prop_next_u32(prop, polarity, v);
+   if (!polarity)
+   break;
+   bus-lane_polarities[i] = v;
+   }
+
+   if (i  1 + bus-num_data_lanes /* clock + data */) {
+   pr_warn(%s: too few lane-polarities entries (need %u, 
got %u)\n,
+   node-full_name, 1 + bus-num_data_lanes, i);
+   return -EINVAL;
+   }
}
 
if (!of_property_read_u32(node, clock-lanes, v)) {
@@ -56,6 +73,8 @@ static void v4l2_of_parse_csi_bus(const struct device_node 
*node,
 
bus-flags = flags;
endpoint-bus_type = V4L2_MBUS_CSI2;
+
+   return 0;
 }
 
 static void v4l2_of_parse_parallel_bus(const struct device_node *node,
@@ -127,11 +146,15 @@ static void v4l2_of_parse_parallel_bus(const struct 
device_node *node,
 int v4l2_of_parse_endpoint(const struct device_node *node,
   struct v4l2_of_endpoint *endpoint)
 {
+   int rval;
+
of_graph_parse_endpoint(node, endpoint-base);
endpoint-bus_type = 0;
memset(endpoint-bus, 0, sizeof(endpoint-bus));
 
-   v4l2_of_parse_csi_bus(node, endpoint);
+   rval = v4l2_of_parse_csi_bus(node, endpoint);
+   if (rval)
+   return rval;
/*
 * Parse the parallel video bus properties only if none
 * of the MIPI CSI-2 specific properties were found.
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index 70fa7b7..2de42c5 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -29,12 +29,15 @@ struct device_node;
  * @data_lanes: an array of physical data lane indexes
  * @clock_lane: physical lane index of the clock lane
  * @num_data_lanes: number of data lanes
+ * @lane_polarities: polarity of the lanes. The order is the same of
+ *the physical lanes.
  */
 struct v4l2_of_bus_mipi_csi2 {
unsigned int flags;
unsigned char data_lanes[4];
unsigned char clock_lane;
unsigned short num_data_lanes;
+   bool lane_polarities[5];
 };
 
 /**
-- 
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 v2 14/15] omap3isp: Add support for the Device Tree

2015-03-25 Thread Sakari Ailus
Add the ISP device to omap3 DT include file and add support to the driver to
use it.

Also obtain information on the external entities and the ISP configuration
related to them through the Device Tree in addition to the platform data.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/media/platform/omap3isp/isp.c   |  218 +--
 drivers/media/platform/omap3isp/isp.h   |   11 ++
 drivers/media/platform/omap3isp/ispcsiphy.c |7 +
 3 files changed, 224 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 992e74c..e12484e 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -64,6 +64,7 @@
 
 #include media/v4l2-common.h
 #include media/v4l2-device.h
+#include media/v4l2-of.h
 
 #include isp.h
 #include ispreg.h
@@ -1991,6 +1992,13 @@ static int isp_register_entities(struct isp_device *isp)
if (ret  0)
goto done;
 
+   /*
+* Device Tree --- the external sub-devices will be registered
+* later. The same goes for the sub-device node registration.
+*/
+   if (isp-dev-of_node)
+   return 0;
+
/* Register external entities */
for (isp_subdev = pdata ? pdata-subdevs : NULL;
 isp_subdev  isp_subdev-board_info; isp_subdev++) {
@@ -2016,8 +2024,10 @@ static int isp_register_entities(struct isp_device *isp)
ret = v4l2_device_register_subdev_nodes(isp-v4l2_dev);
 
 done:
-   if (ret  0)
+   if (ret  0) {
isp_unregister_entities(isp);
+   v4l2_async_notifier_unregister(isp-notifier);
+   }
 
return ret;
 }
@@ -2232,6 +2242,7 @@ static int isp_remove(struct platform_device *pdev)
 {
struct isp_device *isp = platform_get_drvdata(pdev);
 
+   v4l2_async_notifier_unregister(isp-notifier);
isp_unregister_entities(isp);
isp_cleanup_modules(isp);
isp_xclk_cleanup(isp);
@@ -2243,6 +2254,156 @@ static int isp_remove(struct platform_device *pdev)
return 0;
 }
 
+enum isp_of_phy {
+   ISP_OF_PHY_PARALLEL = 0,
+   ISP_OF_PHY_CSIPHY1,
+   ISP_OF_PHY_CSIPHY2,
+};
+
+static int isp_of_parse_node(struct device *dev, struct device_node *node,
+struct isp_async_subdev *isd)
+{
+   struct isp_bus_cfg *buscfg = isd-bus;
+   struct v4l2_of_endpoint vep;
+   unsigned int i;
+
+   v4l2_of_parse_endpoint(node, vep);
+
+   dev_dbg(dev, parsing endpoint %s, interface %u\n, node-full_name,
+   vep.base.port);
+
+   switch (vep.base.port) {
+   case ISP_OF_PHY_PARALLEL:
+   buscfg-interface = ISP_INTERFACE_PARALLEL;
+   buscfg-bus.parallel.data_lane_shift =
+   vep.bus.parallel.data_shift;
+   buscfg-bus.parallel.clk_pol =
+   !!(vep.bus.parallel.flags
+   V4L2_MBUS_PCLK_SAMPLE_FALLING);
+   buscfg-bus.parallel.hs_pol =
+   !!(vep.bus.parallel.flags  V4L2_MBUS_VSYNC_ACTIVE_LOW);
+   buscfg-bus.parallel.vs_pol =
+   !!(vep.bus.parallel.flags  V4L2_MBUS_HSYNC_ACTIVE_LOW);
+   buscfg-bus.parallel.fld_pol =
+   !!(vep.bus.parallel.flags  V4L2_MBUS_FIELD_EVEN_LOW);
+   buscfg-bus.parallel.data_pol =
+   !!(vep.bus.parallel.flags  V4L2_MBUS_DATA_ACTIVE_LOW);
+   break;
+
+   case ISP_OF_PHY_CSIPHY1:
+   case ISP_OF_PHY_CSIPHY2:
+   /* FIXME: always assume CSI-2 for now. */
+   switch (vep.base.port) {
+   case ISP_OF_PHY_CSIPHY1:
+   buscfg-interface = ISP_INTERFACE_CSI2C_PHY1;
+   break;
+   case ISP_OF_PHY_CSIPHY2:
+   buscfg-interface = ISP_INTERFACE_CSI2A_PHY2;
+   break;
+   }
+   buscfg-bus.csi2.lanecfg.clk.pos = vep.bus.mipi_csi2.clock_lane;
+   buscfg-bus.csi2.lanecfg.clk.pol =
+   vep.bus.mipi_csi2.lane_polarities[0];
+   dev_dbg(dev, clock lane polarity %u, pos %u\n,
+   buscfg-bus.csi2.lanecfg.clk.pol,
+   buscfg-bus.csi2.lanecfg.clk.pos);
+
+   for (i = 0; i  ISP_CSIPHY2_NUM_DATA_LANES; i++) {
+   buscfg-bus.csi2.lanecfg.data[i].pos =
+   vep.bus.mipi_csi2.data_lanes[i];
+   buscfg-bus.csi2.lanecfg.data[i].pol =
+   vep.bus.mipi_csi2.lane_polarities[i + 1];
+   dev_dbg(dev, data lane %u polarity %u, pos %u\n, i,
+   buscfg-bus.csi2.lanecfg.data[i].pol,
+   buscfg-bus.csi2.lanecfg.data[i].pos);
+   }
+
+   /*
+* 

[PATCH v2 03/15] omap3isp: Separate external link creation from platform data parsing

2015-03-25 Thread Sakari Ailus
Move the code which connects the external entity to an ISP entity into a
separate function. This disconnects it from parsing the platform data.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/isp.c |  143 +
 1 file changed, 72 insertions(+), 71 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 4ab674d..f694615 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1832,6 +1832,77 @@ isp_register_subdev_group(struct isp_device *isp,
return sensor;
 }
 
+static int isp_link_entity(
+   struct isp_device *isp, struct media_entity *entity,
+   enum isp_interface_type interface)
+{
+   struct media_entity *input;
+   unsigned int flags;
+   unsigned int pad;
+   unsigned int i;
+
+   /* Connect the sensor to the correct interface module.
+* Parallel sensors are connected directly to the CCDC, while
+* serial sensors are connected to the CSI2a, CCP2b or CSI2c
+* receiver through CSIPHY1 or CSIPHY2.
+*/
+   switch (interface) {
+   case ISP_INTERFACE_PARALLEL:
+   input = isp-isp_ccdc.subdev.entity;
+   pad = CCDC_PAD_SINK;
+   flags = 0;
+   break;
+
+   case ISP_INTERFACE_CSI2A_PHY2:
+   input = isp-isp_csi2a.subdev.entity;
+   pad = CSI2_PAD_SINK;
+   flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED;
+   break;
+
+   case ISP_INTERFACE_CCP2B_PHY1:
+   case ISP_INTERFACE_CCP2B_PHY2:
+   input = isp-isp_ccp2.subdev.entity;
+   pad = CCP2_PAD_SINK;
+   flags = 0;
+   break;
+
+   case ISP_INTERFACE_CSI2C_PHY1:
+   input = isp-isp_csi2c.subdev.entity;
+   pad = CSI2_PAD_SINK;
+   flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED;
+   break;
+
+   default:
+   dev_err(isp-dev, %s: invalid interface type %u\n, __func__,
+   interface);
+   return -EINVAL;
+   }
+
+   /*
+* Not all interfaces are available on all revisions of the
+* ISP. The sub-devices of those interfaces aren't initialised
+* in such a case. Check this by ensuring the num_pads is
+* non-zero.
+*/
+   if (!input-num_pads) {
+   dev_err(isp-dev, %s: invalid input %u\n, entity-name,
+   interface);
+   return -EINVAL;
+   }
+
+   for (i = 0; i  entity-num_pads; i++) {
+   if (entity-pads[i].flags  MEDIA_PAD_FL_SOURCE)
+   break;
+   }
+   if (i == entity-num_pads) {
+   dev_err(isp-dev, %s: no source pad in external entity\n,
+   __func__);
+   return -EINVAL;
+   }
+
+   return media_entity_create_link(entity, i, input, pad, flags);
+}
+
 static int isp_register_entities(struct isp_device *isp)
 {
struct isp_platform_data *pdata = isp-pdata;
@@ -1895,10 +1966,6 @@ static int isp_register_entities(struct isp_device *isp)
/* Register external entities */
for (subdevs = pdata-subdevs; subdevs  subdevs-subdevs; ++subdevs) {
struct v4l2_subdev *sensor;
-   struct media_entity *input;
-   unsigned int flags;
-   unsigned int pad;
-   unsigned int i;
 
sensor = isp_register_subdev_group(isp, subdevs-subdevs);
if (sensor == NULL)
@@ -1906,73 +1973,7 @@ static int isp_register_entities(struct isp_device *isp)
 
sensor-host_priv = subdevs;
 
-   /* Connect the sensor to the correct interface module. Parallel
-* sensors are connected directly to the CCDC, while serial
-* sensors are connected to the CSI2a, CCP2b or CSI2c receiver
-* through CSIPHY1 or CSIPHY2.
-*/
-   switch (subdevs-interface) {
-   case ISP_INTERFACE_PARALLEL:
-   input = isp-isp_ccdc.subdev.entity;
-   pad = CCDC_PAD_SINK;
-   flags = 0;
-   break;
-
-   case ISP_INTERFACE_CSI2A_PHY2:
-   input = isp-isp_csi2a.subdev.entity;
-   pad = CSI2_PAD_SINK;
-   flags = MEDIA_LNK_FL_IMMUTABLE
- | MEDIA_LNK_FL_ENABLED;
-   break;
-
-   case ISP_INTERFACE_CCP2B_PHY1:
-   case ISP_INTERFACE_CCP2B_PHY2:
-   input = isp-isp_ccp2.subdev.entity;
-   pad = CCP2_PAD_SINK;
-   flags = 0;
-   break;
-
-   case 

[PATCH v2 15/15] omap3isp: Deprecate platform data support

2015-03-25 Thread Sakari Ailus
Print a warning when the driver is used with platform data. Existing
platform data users should move to DT now.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/isp.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index e12484e..ff8f633 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2456,6 +2456,8 @@ static int isp_probe(struct platform_device *pdev)
isp-syscon = syscon_regmap_lookup_by_pdevname(syscon.0);
if (IS_ERR(isp-syscon))
return PTR_ERR(isp-syscon);
+   dev_warn(pdev-dev,
+Platform data support is deprecated! Please move to 
DT now!\n);
}
 
isp-autoidle = autoidle;
-- 
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 v2 12/15] dt: bindings: Add lane-polarity property to endpoint nodes

2015-03-25 Thread Sakari Ailus
Add lane-polarity property to endpoint nodes. This essentially tells that
the order of the differential signal wires is inverted.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/devicetree/bindings/media/video-interfaces.txt |6 ++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt 
b/Documentation/devicetree/bindings/media/video-interfaces.txt
index 571b4c6..9cd2a36 100644
--- a/Documentation/devicetree/bindings/media/video-interfaces.txt
+++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
@@ -106,6 +106,12 @@ Optional endpoint properties
 - link-frequencies: Allowed data bus frequencies. For MIPI CSI-2, for
   instance, this is the actual frequency of the bus, not bits per clock per
   lane value. An array of 64-bit unsigned integers.
+- lane-polarities: an array of polarities of the lanes starting from the clock
+  lane and followed by the data lanes in the same order as in data-lanes.
+  Valid values are 0 (normal) and 1 (inverted). The length of the array
+  should be the combined length of data-lanes and clock-lanes properties.
+  If the lane-polarities property is omitted, the value must be interpreted
+  as 0 (normal). This property is valid for serial busses only.
 
 
 Example
-- 
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 v2 09/15] omap3isp: Replace mmio_base_phys array with the histogram block base

2015-03-25 Thread Sakari Ailus
Only the histogram sub-block driver uses the physical address. Do not store
it for other sub-blocks.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/isp.c |3 ++-
 drivers/media/platform/omap3isp/isp.h |6 +++---
 drivers/media/platform/omap3isp/isphist.c |3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index c045318..68d7edfc 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2247,7 +2247,8 @@ static int isp_map_mem_resource(struct platform_device 
*pdev,
if (IS_ERR(isp-mmio_base[res]))
return PTR_ERR(isp-mmio_base[res]);
 
-   isp-mmio_base_phys[res] = mem-start;
+   if (res == OMAP3_ISP_IOMEM_HIST)
+   isp-mmio_hist_base_phys = mem-start;
 
return 0;
 }
diff --git a/drivers/media/platform/omap3isp/isp.h 
b/drivers/media/platform/omap3isp/isp.h
index b932a6f..9535524 100644
--- a/drivers/media/platform/omap3isp/isp.h
+++ b/drivers/media/platform/omap3isp/isp.h
@@ -138,8 +138,8 @@ struct isp_xclk {
  * @irq_num: Currently used IRQ number.
  * @mmio_base: Array with kernel base addresses for ioremapped ISP register
  * regions.
- * @mmio_base_phys: Array with physical L4 bus addresses for ISP register
- *  regions.
+ * @mmio_hist_base_phys: Physical L4 bus address for ISP hist block register
+ *  region.
  * @mapping: IOMMU mapping
  * @stat_lock: Spinlock for handling statistics
  * @isp_mutex: Mutex for serializing requests to ISP.
@@ -175,7 +175,7 @@ struct isp_device {
unsigned int irq_num;
 
void __iomem *mmio_base[OMAP3_ISP_IOMEM_LAST];
-   unsigned long mmio_base_phys[OMAP3_ISP_IOMEM_LAST];
+   unsigned long mmio_hist_base_phys;
 
struct dma_iommu_mapping *mapping;
 
diff --git a/drivers/media/platform/omap3isp/isphist.c 
b/drivers/media/platform/omap3isp/isphist.c
index 738b946..7138b04 100644
--- a/drivers/media/platform/omap3isp/isphist.c
+++ b/drivers/media/platform/omap3isp/isphist.c
@@ -193,8 +193,7 @@ static int hist_buf_dma(struct ispstat *hist)
omap3isp_flush(hist-isp);
 
memset(cfg, 0, sizeof(cfg));
-   cfg.src_addr = hist-isp-mmio_base_phys[OMAP3_ISP_IOMEM_HIST]
-+ ISPHIST_DATA;
+   cfg.src_addr = hist-isp-mmio_hist_base_phys + ISPHIST_DATA;
cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
cfg.src_maxburst = hist-buf_size / 4;
 
-- 
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 v2 02/15] omap3isp: Avoid a BUG_ON() in media_entity_create_link()

2015-03-25 Thread Sakari Ailus
If an uninitialised v4l2_subdev struct was passed to
media_entity_create_link(), one of the BUG_ON()'s in the function will be
hit since media_entity.num_pads will be zero. Avoid this by checking whether
the num_pads field is non-zero for the interface.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/isp.c |   13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index fb193b6..4ab674d 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1946,6 +1946,19 @@ static int isp_register_entities(struct isp_device *isp)
goto done;
}
 
+   /*
+* Not all interfaces are available on all revisions
+* of the ISP. The sub-devices of those interfaces
+* aren't initialised in such a case. Check this by
+* ensuring the num_pads is non-zero.
+*/
+   if (!input-num_pads) {
+   dev_err(isp-dev, %s: invalid input %u\n,
+   entity-name, subdevs-interface);
+   ret = -EINVAL;
+   goto done;
+   }
+
for (i = 0; i  sensor-entity.num_pads; i++) {
if (sensor-entity.pads[i].flags  MEDIA_PAD_FL_SOURCE)
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


Re: [PATCH v2 06/15] omap3isp: Refactor device configuration structs for Device Tree

2015-03-25 Thread Tony Lindgren
* Sakari Ailus sakari.ai...@iki.fi [150325 16:00]:
 Make omap3isp configuration data structures more suitable for consumption by
 the DT by separating the I2C bus information of all the sub-devices in a
 group and the ISP bus information from each other. The ISP bus information
 is made a pointer instead of being directly embedded in the struct.
 
 In the case of the DT only the sensor specific information on the ISP bus
 configuration is retained. The structs are renamed to reflect that.
 
 After this change the structs needed to describe device configuration can be
 allocated and accessed separately without those needed only in the case of
 platform data. The platform data related structs can be later removed once
 the support for platform data can be removed.
 
 Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
 Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Igor Grinberg grinb...@compulab.co.il
 Acked-by: Igor Grinberg grinb...@compulab.co.il (for cm-t35)

There arch/arm/mach-omap2 changes here are OK to merge along with
the driver changes:

Acked-by: Tony Lindgren t...@atomide.com

 ---
  arch/arm/mach-omap2/board-cm-t35.c  |   57 +++---
  drivers/media/platform/omap3isp/isp.c   |   86 
 +--
  drivers/media/platform/omap3isp/isp.h   |2 +-
  drivers/media/platform/omap3isp/ispccdc.c   |   26 
  drivers/media/platform/omap3isp/ispccp2.c   |   22 +++
  drivers/media/platform/omap3isp/ispcsi2.c   |8 +--
  drivers/media/platform/omap3isp/ispcsiphy.c |   21 ---
  include/media/omap3isp.h|   34 +--
  8 files changed, 119 insertions(+), 137 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
 b/arch/arm/mach-omap2/board-cm-t35.c
 index 91738a1..b5dfbc1 100644
 --- a/arch/arm/mach-omap2/board-cm-t35.c
 +++ b/arch/arm/mach-omap2/board-cm-t35.c
 @@ -492,51 +492,36 @@ static struct twl4030_platform_data cm_t35_twldata = {
  #include media/omap3isp.h
  #include devices.h
  
 -static struct i2c_board_info cm_t35_isp_i2c_boardinfo[] = {
 +static struct isp_platform_subdev cm_t35_isp_subdevs[] = {
   {
 - I2C_BOARD_INFO(mt9t001, 0x5d),
 - },
 - {
 - I2C_BOARD_INFO(tvp5150, 0x5c),
 - },
 -};
 -
 -static struct isp_subdev_i2c_board_info cm_t35_isp_primary_subdevs[] = {
 - {
 - .board_info = cm_t35_isp_i2c_boardinfo[0],
 - .i2c_adapter_id = 3,
 - },
 - { NULL, 0, },
 -};
 -
 -static struct isp_subdev_i2c_board_info cm_t35_isp_secondary_subdevs[] = {
 - {
 - .board_info = cm_t35_isp_i2c_boardinfo[1],
 + .board_info = (struct i2c_board_info){
 + I2C_BOARD_INFO(mt9t001, 0x5d)
 + },
   .i2c_adapter_id = 3,
 - },
 - { NULL, 0, },
 -};
 -
 -static struct isp_v4l2_subdevs_group cm_t35_isp_subdevs[] = {
 - {
 - .subdevs = cm_t35_isp_primary_subdevs,
 - .interface = ISP_INTERFACE_PARALLEL,
 - .bus = {
 - .parallel = {
 - .clk_pol = 1,
 + .bus = (struct isp_bus_cfg){
 + .interface = ISP_INTERFACE_PARALLEL,
 + .bus = {
 + .parallel = {
 + .clk_pol = 1,
 + },
   },
   },
   },
   {
 - .subdevs = cm_t35_isp_secondary_subdevs,
 - .interface = ISP_INTERFACE_PARALLEL,
 - .bus = {
 - .parallel = {
 - .clk_pol = 0,
 + .board_info = (struct i2c_board_info){
 + I2C_BOARD_INFO(tvp5150, 0x5c),
 + },
 + .i2c_adapter_id = 3,
 + .bus = (struct isp_bus_cfg){
 + .interface = ISP_INTERFACE_PARALLEL,
 + .bus = {
 + .parallel = {
 + .clk_pol = 0,
 + },
   },
   },
   },
 - { NULL, 0, },
 + { 0 },
  };
  
  static struct isp_platform_data cm_t35_isp_pdata = {
 diff --git a/drivers/media/platform/omap3isp/isp.c 
 b/drivers/media/platform/omap3isp/isp.c
 index 537377b..1b5c6df 100644
 --- a/drivers/media/platform/omap3isp/isp.c
 +++ b/drivers/media/platform/omap3isp/isp.c
 @@ -447,7 +447,7 @@ static void isp_core_init(struct isp_device *isp, int 
 idle)
   */
  void omap3isp_configure_bridge(struct isp_device *isp,
  enum ccdc_input_entity input,
 -const struct isp_parallel_platform_data *pdata,
 +const struct isp_parallel_cfg *parcfg,
  unsigned int shift, unsigned int bridge)
  {
   u32 ispctrl_val;
 @@ -462,8 +462,8 @@ void omap3isp_configure_bridge(struct 

[GIT PULL FOR v4.1] [v2] OMAP3 ISP DT support other fixes

2015-03-25 Thread Laurent Pinchart
Hi Mauro,

This pull request supersedes [GIT PULL FOR v4.1] OMAP3 ISP fixes. It 
contains all the patches of the previous pull request, plus OMAP3 ISP DT 
support.

Board code and platform changes have been acked by the appropriate maintainers 
to the best of my knowledge.

The following changes since commit 3d945be05ac1e806af075e9315bc1b3409adae2b:

  [media] mn88473: simplify bandwidth registers setting code (2015-03-03 
13:09:12 -0300)

are available in the git repository at:

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

for you to fetch changes up to af62d8469b359ccd2d3b9bab5fa147074d4a8619:

  omap3isp: Deprecate platform data support (2015-03-26 01:09:16 +0200)


Lad, Prabhakar (1):
  media: omap3isp: video: drop setting of vb2 buffer state to 
VB2_BUF_STATE_ACTIVE

Laurent Pinchart (4):
  media: omap3isp: video: Don't call vb2 mmap with queue lock held
  media: omap3isp: video: Use v4l2_get_timestamp()
  media: omap3isp: hist: Move histogram DMA to DMA engine
  omap3isp: DT support for clocks

Sakari Ailus (14):
  omap3isp: Fix error handling in probe
  omap3isp: Avoid a BUG_ON() in media_entity_create_link()
  omap3isp: Separate external link creation from platform data parsing
  omap3isp: Platform data could be NULL
  omap3isp: Refactor device configuration structs for Device Tree
  omap3isp: Rename regulators to better suit the Device Tree
  omap3isp: Calculate vpclk_div for CSI-2
  omap3isp: Replace mmio_base_phys array with the histogram block base
  omap3isp: Move the syscon register out of the ISP register maps
  omap3isp: Replace many MMIO regions by two
  dt: bindings: Add lane-polarity property to endpoint nodes
  v4l: of: Read lane-polarities endpoint property
  omap3isp: Add support for the Device Tree
  omap3isp: Deprecate platform data support

 .../devicetree/bindings/media/video-interfaces.txt  |   6 +
 arch/arm/mach-omap2/board-cm-t35.c  |  57 +--
 arch/arm/mach-omap2/devices.c   |  76 +---
 arch/arm/mach-omap2/omap34xx.h  |  36 +-
 drivers/media/platform/Kconfig  |   1 +
 drivers/media/platform/omap3isp/isp.c   | 555 +++
 drivers/media/platform/omap3isp/isp.h   |  42 +-
 drivers/media/platform/omap3isp/ispccdc.c   |  26 +-
 drivers/media/platform/omap3isp/ispccp2.c   |  22 +-
 drivers/media/platform/omap3isp/ispcsi2.c   |  14 +-
 drivers/media/platform/omap3isp/ispcsiphy.c |  48 +-
 drivers/media/platform/omap3isp/isph3a_aewb.c   |   1 -
 drivers/media/platform/omap3isp/isph3a_af.c |   1 -
 drivers/media/platform/omap3isp/isphist.c   | 127 +++---
 drivers/media/platform/omap3isp/ispstat.c   |   2 +-
 drivers/media/platform/omap3isp/ispstat.h   |   5 +-
 drivers/media/platform/omap3isp/ispvideo.c  |  20 +-
 drivers/media/v4l2-core/v4l2-of.c   |  41 +-
 include/media/omap3isp.h|  36 +-
 include/media/v4l2-of.h |   3 +
 20 files changed, 665 insertions(+), 454 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: drivers/media/usb/au0828/au0828-video.c:1741:1-3: WARNING: end returns can be simpified if negative or 0 value

2015-03-25 Thread Julia Lawall
The function does only return 0 or a negative constant, but it seems like
a matter of personal prefernce - shorter vs more explicit.

julia

On Wed, 25 Mar 2015, kbuild test robot wrote:

 TO: Shuah Khan shua...@osg.samsung.com
 CC: Mauro Carvalho Chehab m.che...@samsung.com
 CC: linux-media@vger.kernel.org
 CC: Hans Verkuil hans.verk...@cisco.com

 tree:   git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
 master
 head:   c875f421097a55d9126159957a2d812b91c9ce8c
 commit: 05439b1a36935992785c4f28f6693e73820321cb [media] media: au0828 - 
 convert to use videobuf2
 date:   7 weeks ago
 :: branch date: 9 hours ago
 :: commit date: 7 weeks ago

  drivers/media/usb/au0828/au0828-video.c:1741:1-3: WARNING: end returns can 
  be simpified if negative or 0 value

 git remote add linus 
 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 git remote update linus
 git checkout 05439b1a36935992785c4f28f6693e73820321cb
 vim +1741 drivers/media/usb/au0828/au0828-video.c

 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1725 q-mem_ops = vb2_vmalloc_memops;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1726
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1727 rc = vb2_queue_init(q);
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1728 if (rc  0)
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1729 return rc;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1730
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1731 /* Setup Videobuf2 for VBI capture */
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1732 q = dev-vb_vbiq;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1733 q-type = V4L2_BUF_TYPE_VBI_CAPTURE;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1734 q-io_modes = VB2_READ | VB2_MMAP | VB2_USERPTR | 
 VB2_DMABUF;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1735 q-timestamp_flags = 
 V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1736 q-drv_priv = dev;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1737 q-buf_struct_size = sizeof(struct au0828_buffer);
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1738 q-ops = au0828_vbi_qops;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1739 q-mem_ops = vb2_vmalloc_memops;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1740
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29 @1741 rc = vb2_queue_init(q);
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1742 if (rc  0)
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1743 return rc;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1744
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1745 return 0;
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1746  }
 05439b1a drivers/media/usb/au0828/au0828-video.c   Shuah Khan
 2015-01-29  1747
 8b2f0795 drivers/media/video/au0828/au0828-video.c Devin Heitmueller 
 2009-03-11  1748  
 /**/
 8b2f0795 drivers/media/video/au0828/au0828-video.c Devin Heitmueller 
 2009-03-11  1749

 ---
 0-DAY kernel test infrastructureOpen Source Technology Center
 http://lists.01.org/mailman/listinfo/kbuild Intel Corporation

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


Re:Re:hi

2015-03-25 Thread kp
Bäste herr
iphone 6,280 €
moto.camera, Mobiltelefon, laptop.moto.watch, gitarr .
sjöfarten är gratis
w eb : ereaaal . com


[PATCH v2 05/15] omap3isp: Platform data could be NULL

2015-03-25 Thread Sakari Ailus
Only check for call platform data callback functions if there's platform
data. Also take care of a few other cases where the NULL pdata pointer could
have been accessed, and remove the check for NULL dev-platform_data
pointer.

Removing the check for NULL dev-platform_data isn't strictly needed by the
DT support but there's no harm from that either: the device now can be used
without sensors, for instance.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/isp.c  |   10 --
 drivers/media/platform/omap3isp/ispvideo.c |6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 82499cd..537377b 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -330,8 +330,8 @@ static int isp_xclk_init(struct isp_device *isp)
if (np)
continue;
 
-   if (pdata-xclks[i].con_id == NULL 
-   pdata-xclks[i].dev_id == NULL)
+   if (!pdata || (pdata-xclks[i].con_id == NULL 
+  pdata-xclks[i].dev_id == NULL))
continue;
 
xclk-lookup = kzalloc(sizeof(*xclk-lookup), GFP_KERNEL);
@@ -1989,7 +1989,8 @@ static int isp_register_entities(struct isp_device *isp)
goto done;
 
/* Register external entities */
-   for (subdevs = pdata-subdevs; subdevs  subdevs-subdevs; ++subdevs) {
+   for (subdevs = pdata ? pdata-subdevs : NULL;
+subdevs  subdevs-subdevs; ++subdevs) {
struct v4l2_subdev *sensor;
 
sensor = isp_register_subdev_group(isp, subdevs-subdevs);
@@ -2271,9 +2272,6 @@ static int isp_probe(struct platform_device *pdev)
int ret;
int i, m;
 
-   if (pdata == NULL)
-   return -EINVAL;
-
isp = devm_kzalloc(pdev-dev, sizeof(*isp), GFP_KERNEL);
if (!isp) {
dev_err(pdev-dev, could not allocate memory\n);
diff --git a/drivers/media/platform/omap3isp/ispvideo.c 
b/drivers/media/platform/omap3isp/ispvideo.c
index 0b5967e..d285af1 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -1018,7 +1018,7 @@ isp_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
 
pipe-entities = 0;
 
-   if (video-isp-pdata-set_constraints)
+   if (video-isp-pdata  video-isp-pdata-set_constraints)
video-isp-pdata-set_constraints(video-isp, true);
pipe-l3_ick = clk_get_rate(video-isp-clock[ISP_CLK_L3_ICK]);
pipe-max_rate = pipe-l3_ick;
@@ -1100,7 +1100,7 @@ err_set_stream:
 err_check_format:
media_entity_pipeline_stop(video-video.entity);
 err_pipeline_start:
-   if (video-isp-pdata-set_constraints)
+   if (video-isp-pdata  video-isp-pdata-set_constraints)
video-isp-pdata-set_constraints(video-isp, false);
/* The DMA queue must be emptied here, otherwise CCDC interrupts that
 * will get triggered the next time the CCDC is powered up will try to
@@ -1161,7 +1161,7 @@ isp_video_streamoff(struct file *file, void *fh, enum 
v4l2_buf_type type)
video-queue = NULL;
video-error = false;
 
-   if (video-isp-pdata-set_constraints)
+   if (video-isp-pdata  video-isp-pdata-set_constraints)
video-isp-pdata-set_constraints(video-isp, false);
media_entity_pipeline_stop(video-video.entity);
 
-- 
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 v2 08/15] omap3isp: Calculate vpclk_div for CSI-2

2015-03-25 Thread Sakari Ailus
The video port clock is l3_ick divided by vpclk_div. This clock must be high
enough for the external pixel rate. The video port requires two clock cycles
to process a pixel.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/ispcsi2.c |8 +++-
 include/media/omap3isp.h  |2 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/omap3isp/ispcsi2.c 
b/drivers/media/platform/omap3isp/ispcsi2.c
index 14d279d..97cdfeb 100644
--- a/drivers/media/platform/omap3isp/ispcsi2.c
+++ b/drivers/media/platform/omap3isp/ispcsi2.c
@@ -548,6 +548,7 @@ int omap3isp_csi2_reset(struct isp_csi2_device *csi2)
 
 static int csi2_configure(struct isp_csi2_device *csi2)
 {
+   struct isp_pipeline *pipe = to_isp_pipeline(csi2-subdev.entity);
const struct isp_bus_cfg *buscfg;
struct isp_device *isp = csi2-isp;
struct isp_csi2_timing_cfg *timing = csi2-timing[0];
@@ -570,7 +571,12 @@ static int csi2_configure(struct isp_csi2_device *csi2)
csi2-frame_skip = 0;
v4l2_subdev_call(sensor, sensor, g_skip_frames, csi2-frame_skip);
 
-   csi2-ctrl.vp_out_ctrl = buscfg-bus.csi2.vpclk_div;
+   csi2-ctrl.vp_out_ctrl =
+   clamp_t(unsigned int, pipe-l3_ick / pipe-external_rate - 1,
+   1, 3);
+   dev_dbg(isp-dev, %s: l3_ick %lu, external_rate %u, vp_out_ctrl %u\n,
+   __func__, pipe-l3_ick,  pipe-external_rate,
+   csi2-ctrl.vp_out_ctrl);
csi2-ctrl.frame_mode = ISP_CSI2_FRAME_IMMEDIATE;
csi2-ctrl.ecc_enable = buscfg-bus.csi2.crc;
 
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index 39e0748..0f0c08b 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -129,11 +129,9 @@ struct isp_ccp2_cfg {
 /**
  * struct isp_csi2_cfg - CSI2 interface configuration
  * @crc: Enable the cyclic redundancy check
- * @vpclk_div: Video port output clock control
  */
 struct isp_csi2_cfg {
unsigned crc:1;
-   unsigned vpclk_div:2;
struct isp_csiphy_lanes_cfg lanecfg;
 };
 
-- 
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 v2 04/15] omap3isp: DT support for clocks

2015-03-25 Thread Sakari Ailus
From: Laurent Pinchart laurent.pinch...@ideasonboard.com

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/omap3isp/isp.c |   25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index f694615..82499cd 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -279,9 +279,21 @@ static const struct clk_init_data isp_xclk_init_data = {
.num_parents = 1,
 };
 
+static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void 
*data)
+{
+   unsigned int idx = clkspec-args[0];
+   struct isp_device *isp = data;
+
+   if (idx = ARRAY_SIZE(isp-xclks))
+   return ERR_PTR(-ENOENT);
+
+   return isp-xclks[idx].clk;
+}
+
 static int isp_xclk_init(struct isp_device *isp)
 {
struct isp_platform_data *pdata = isp-pdata;
+   struct device_node *np = isp-dev-of_node;
struct clk_init_data init;
unsigned int i;
 
@@ -312,6 +324,12 @@ static int isp_xclk_init(struct isp_device *isp)
if (IS_ERR(xclk-clk))
return PTR_ERR(xclk-clk);
 
+   /* When instantiated from DT we don't need to register clock
+* aliases.
+*/
+   if (np)
+   continue;
+
if (pdata-xclks[i].con_id == NULL 
pdata-xclks[i].dev_id == NULL)
continue;
@@ -327,13 +345,20 @@ static int isp_xclk_init(struct isp_device *isp)
clkdev_add(xclk-lookup);
}
 
+   if (np)
+   of_clk_add_provider(np, isp_xclk_src_get, isp);
+
return 0;
 }
 
 static void isp_xclk_cleanup(struct isp_device *isp)
 {
+   struct device_node *np = isp-dev-of_node;
unsigned int i;
 
+   if (np)
+   of_clk_del_provider(np);
+
for (i = 0; i  ARRAY_SIZE(isp-xclks); ++i) {
struct isp_xclk *xclk = isp-xclks[i];
 
-- 
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: OMAP3 ISP previewer Y10 to UYVY conversion

2015-03-25 Thread Sakari Ailus
Hi Chris,

On Wed, Mar 25, 2015 at 09:12:56AM -0500, Chris Whittenburg wrote:
 Hi Sakari,
 
 Thanks for the reply.
 
 On Tue, Mar 24, 2015 at 6:51 PM, Sakari Ailus sakari.ai...@iki.fi wrote:
  Do you know if the sensor has black level correction enabled? It appears to
  have one, but I'm not completely sure what it does there. I'd check that it
  is indeed enabled.
 
 The ar0130cs does have black level correction enabled by default.
 
 My thought is that since the 12-bit data from the CCDC looked ok, that
 it was something outside the sensor itself.

I think I might have misunderstood your original mail. I thought the images
from CCDC were bad.

  I've captured the 12-bit data from the CCDC, downconverted it to Y8,
  and verified it looks ok, and is not washed out, so I'm suspecting the
  isp previewer is doing something wrong in the simple Y10 to UYVY
  conversion.
 
  Not necessarily wrong, the black level correction might be enabled by
  default, with the default configuration which works for most sensors (64 for
  10-bit data, 16 for 8-bit etc.).
 
 Ok, I will check this.  You are referring to the Camera ISP VPBE
 Preview Black Adjustment which is controlled by PRV_BLKADJOFF
 register?

I guess it wasn't. The value appears to be zero by default, which makes
sense.

 I also found that there are contrast and brightness settings in the
 previewer which can be adjusted.  I'm not changing them from defaults,
 so I thought the Y values would just get truncated to 8 bits and
 mapped into the UYVY without being significantly altered.
 
 Would your thought be the black level is more likely the issue rather
 than brightness/contrast?

I haven't used this part of the ISP, perhaps Laurent has.

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

2015-03-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:   Thu Mar 26 04:00:19 CET 2015
git branch: test
git hash:   8a56b6b5fd6ff92b7e27d870b803b11b751660c2
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.19.0-1.slh.1-amd64

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

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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