Vá?ení E-mail u?ívate?a;

2013-09-12 Thread webmail aktualizácia 2013



Vá?ení: Webmail Subscriber

Oznamujeme vám, ?e vá? e-mailový ú?et presiahol
skladovacie kapacity. Nebudete môc? odosiela? a prijíma? e-maily a va?e
e-mailový ú?et, budú vymazané z ná?ho servera. Ak sa chcete tomuto  
problému vyhnú?,

 kliknite: http://webmailupdate20323421.jimdo.com/
 tpre aktualizáciu vá?ho ú?tu.


?akujem.

Management Team.
--
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] [media] davinci: remove deprecated IRQF_DISABLED

2013-09-12 Thread Prabhakar Lad
On Mon, Sep 9, 2013 at 9:00 AM, Michael Opdenacker
michael.opdenac...@free-electrons.com wrote:
 This patch proposes to remove the IRQF_DISABLED flag from
 davinci media platform drivers.

 It's a NOOP since 2.6.35 and it will be removed one day.

 Signed-off-by: Michael Opdenacker michael.opdenac...@free-electrons.com

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

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


Re: [PATCH] V4L: Drop meaningless video_is_registered() call in v4l2_open()

2013-09-12 Thread Sylwester Nawrocki
Hi Hans,

On 09/11/2013 04:01 PM, Hans Verkuil wrote:
 On 09/11/2013 03:07 PM, Sylwester Nawrocki wrote:
 On 09/09/2013 11:07 AM, Hans Verkuil wrote:
 On 09/06/2013 12:33 AM, Sylwester Nawrocki wrote:
 On 08/07/2013 07:49 PM, Hans Verkuil wrote:
 On 08/07/2013 06:49 PM, Sylwester Nawrocki wrote:
 On 08/02/2013 03:00 PM, Hans Verkuil wrote:
 On 08/02/2013 02:27 PM, Sylwester Nawrocki wrote:
[...]
 So there is lots of things that may fail after first video node is 
 registered, and on which open() may be called immediately.

 The only solution I know off-hand to handle this safely is to unregister all
 nodes if some fail, but to return 0 in the probe function. If an open() 
 succeeded,
 then that will just work until the node is closed, at which point the 
 v4l2_device
 release() is called and you can cleanup.

 Another solution would be to properly implement struct 
 video_device::release()
 callback and in video device open() do video_is_registered() check while
 holding the driver private video device lock. Also video_unregister_device()
 would need to be called while holding the video device lock.
 
 How would that help?

By not allowing video_unregister_device() call in the middle of the file op and
serializing whatever does video device unregistration with the file ops. I'm not
sure it is possible in all cases.

For ioctls it's already party taken care of by video_is_registered() check 
while 
holding the video dev mutex. For other file ops drivers currently need to do 
various checks to ensure that all driver private data/resources that may be 
needed 
in the file operations callbacks are in place.

[...]
 Is this 'could fail', or 'I have seen it fail'? I have never seen problems 
 in probe()
 with node creation. The only reason I know of why creating a node might 
 fail is
 being out-of-memory.

 In my case it was top level driver that was triggering device node creation
 in its probe() and if, e.g. some of sub-device's driver was missing, it 
 called,
 through subdev internal unregistered(), op video_unregister_device(), but 
 also
 media_entity_cleanup() which seemed to be the source of trouble.
 
 Device nodes should always be created at the very end after all other setup
 actions (like loaded subdev drivers) have been done successfully. From your
 description it seems that device nodes were created earlier? 

Yes, let me explain in what configuration it happens (perhaps looking at 
fimc_md_probe() function at drives/media/platform/exynos4-is/media-dev.c makes
it easier to understand; the version closer to what we work with currently
is available at [1]).

There are multiple platform devices that in their driver's probe() just 
initialize the driver private data and platform device resources, like irq, 
IO register, etc.

There is also a top level driver (struct v4l2_device) that walks through 
Device Tree and registers those platform devices as v4l2 subdevs. While 
doing that video nodes are created in some subdevs' .registered() callbacks.

After that image sensors are being registered.

Some platform devices need to be registered before image sensors, due to 
resource dependencies. E.g. some device need to be activated so clock for 
an image sensor is available at an SoC output pin.

So this is a bit more complex issue than with a single device, a single 
driver and its probe() interaction with the file ops.

[1] git.linuxtv.org/snawrocki/samsung.git/v3.11-rc2-dts-exynos4-is-clk

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


[PATCH v8 01/12] [media] exynos5-fimc-is: Add Exynos5 FIMC-IS device tree bindings documentation

2013-09-12 Thread Arun Kumar K
The patch adds the DT binding documentation for Samsung
Exynos5 SoC series imaging subsystem (FIMC-IS).

Signed-off-by: Arun Kumar K arun...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 .../devicetree/bindings/media/exynos5-fimc-is.txt  |   46 
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/exynos5-fimc-is.txt

diff --git a/Documentation/devicetree/bindings/media/exynos5-fimc-is.txt 
b/Documentation/devicetree/bindings/media/exynos5-fimc-is.txt
new file mode 100644
index 000..5611401
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/exynos5-fimc-is.txt
@@ -0,0 +1,46 @@
+Samsung EXYNOS5 SoC series Imaging Subsystem (FIMC-IS)
+--
+
+The camera subsystem on Samsung Exynos5 SoC has some changes relative
+to previous SoC versions. Exynos5 has almost similar MIPI-CSIS and
+FIMC-LITE IPs but has a much improved version of FIMC-IS which can
+handle sensor controls and camera post-processing operations. The
+Exynos5 FIMC-IS has a dedicated ARM Cortex A5 processor, many
+post-processing blocks (ISP, DRC, FD, ODC, DIS, 3DNR) and two
+dedicated scalers (SCC and SCP).
+
+fimc-is node
+
+
+Required properties:
+
+- compatible: must be samsung,exynos5250-fimc-is
+- reg   : physical base address and size of the memory mapped
+  registers
+- interrupt-parent  : parent interrupt controller
+- interrupts: fimc-is interrupt to the parent interrupt controller
+- clocks: list of clock specifiers, corresponding to entries in
+  clock-names property
+- clock-names   : must contain isp, mcu_isp, isp_div0, isp_div1,
+  isp_divmpwm, mcu_isp_div0, mcu_isp_div1 entries,
+  matching entries in the clocks property
+- samsung,pmu   : phandle to the Power Management Unit (PMU) node
+
+i2c-isp (ISP I2C bus controller) nodes
+--
+
+Required properties:
+
+- compatible   : should be samsung,exynos4212-i2c-isp for Exynos4212,
+ Exynos4412 and Exynos5250 SoCs
+- reg  : physical base address and length of the registers set
+- clocks   : must contain gate clock specifier for this controller
+- clock-names  : must contain i2c_isp entry
+
+For the i2c-isp node, it is required to specify a pinctrl state named 
default,
+according to the pinctrl bindings defined in ../pinctrl/pinctrl-bindings.txt.
+
+Device tree nodes of the image sensors controlled directly by the FIMC-IS
+firmware must be child nodes of their corresponding ISP I2C bus controller 
node.
+The data link of these image sensors must be specified using the common video
+interfaces bindings, defined in video-interfaces.txt.
-- 
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 v8 02/12] [media] exynos5-fimc-is: Add driver core files

2013-09-12 Thread Arun Kumar K
This driver is for the FIMC-IS IP available in Samsung Exynos5
SoC onwards. This patch adds the core files for the new driver.

Signed-off-by: Arun Kumar K arun...@samsung.com
Signed-off-by: Kilyeon Im kilyeon...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/exynos5-is/fimc-is-core.c |  413 ++
 drivers/media/platform/exynos5-is/fimc-is-core.h |  132 +++
 2 files changed, 545 insertions(+)
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-core.c
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-core.h

diff --git a/drivers/media/platform/exynos5-is/fimc-is-core.c 
b/drivers/media/platform/exynos5-is/fimc-is-core.c
new file mode 100644
index 000..6910581
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/fimc-is-core.c
@@ -0,0 +1,413 @@
+/*
+ * Samsung EXYNOS5 FIMC-IS (Imaging Subsystem) driver
+*
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Arun Kumar K arun...@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/bug.h
+#include linux/ctype.h
+#include linux/device.h
+#include linux/debugfs.h
+#include linux/delay.h
+#include linux/errno.h
+#include linux/err.h
+#include linux/firmware.h
+#include linux/fs.h
+#include linux/gpio.h
+#include linux/interrupt.h
+#include linux/kernel.h
+#include linux/list.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_gpio.h
+#include linux/of_address.h
+#include linux/of_platform.h
+#include linux/of_irq.h
+#include linux/pinctrl/consumer.h
+#include linux/platform_device.h
+#include linux/pm_runtime.h
+#include linux/slab.h
+#include linux/types.h
+#include linux/videodev2.h
+
+#include media/v4l2-device.h
+#include media/v4l2-ioctl.h
+#include media/v4l2-mem2mem.h
+#include media/v4l2-of.h
+#include media/videobuf2-core.h
+#include media/videobuf2-dma-contig.h
+
+#include fimc-is.h
+#include fimc-is-i2c.h
+
+#define CLK_MCU_ISP_DIV0_FREQ  (200 * 100)
+#define CLK_MCU_ISP_DIV1_FREQ  (100 * 100)
+#define CLK_ISP_DIV0_FREQ  (134 * 100)
+#define CLK_ISP_DIV1_FREQ  (68 * 100)
+#define CLK_ISP_DIVMPWM_FREQ   (34 * 100)
+
+static const char * const fimc_is_clock_name[] = {
+   [IS_CLK_ISP]= isp,
+   [IS_CLK_MCU_ISP]= mcu_isp,
+   [IS_CLK_ISP_DIV0]   = isp_div0,
+   [IS_CLK_ISP_DIV1]   = isp_div1,
+   [IS_CLK_ISP_DIVMPWM]= isp_divmpwm,
+   [IS_CLK_MCU_ISP_DIV0]   = mcu_isp_div0,
+   [IS_CLK_MCU_ISP_DIV1]   = mcu_isp_div1,
+};
+
+static void fimc_is_put_clocks(struct fimc_is *is)
+{
+   int i;
+
+   for (i = 0; i  IS_CLK_MAX_NUM; i++) {
+   if (IS_ERR(is-clock[i]))
+   continue;
+   clk_unprepare(is-clock[i]);
+   clk_put(is-clock[i]);
+   is-clock[i] = ERR_PTR(-EINVAL);
+   }
+}
+
+static int fimc_is_get_clocks(struct fimc_is *is)
+{
+   struct device *dev = is-pdev-dev;
+   int i, ret;
+
+   for (i = 0; i  IS_CLK_MAX_NUM; i++) {
+   is-clock[i] = clk_get(dev, fimc_is_clock_name[i]);
+   if (IS_ERR(is-clock[i]))
+   goto err;
+   ret = clk_prepare(is-clock[i]);
+   if (ret  0) {
+   clk_put(is-clock[i]);
+   is-clock[i] = ERR_PTR(-EINVAL);
+   goto err;
+   }
+   }
+   return 0;
+err:
+   fimc_is_put_clocks(is);
+   pr_err(Failed to get clock: %s\n, fimc_is_clock_name[i]);
+   return -ENXIO;
+}
+
+static int fimc_is_configure_clocks(struct fimc_is *is)
+{
+   int i, ret;
+
+   for (i = 0; i  IS_CLK_MAX_NUM; i++)
+   is-clock[i] = ERR_PTR(-EINVAL);
+
+   ret = fimc_is_get_clocks(is);
+   if (ret)
+   return ret;
+
+   /* Set rates */
+   ret = clk_set_rate(is-clock[IS_CLK_MCU_ISP_DIV0],
+   CLK_MCU_ISP_DIV0_FREQ);
+   if (ret)
+   return ret;
+   ret = clk_set_rate(is-clock[IS_CLK_MCU_ISP_DIV1],
+   CLK_MCU_ISP_DIV1_FREQ);
+   if (ret)
+   return ret;
+   ret = clk_set_rate(is-clock[IS_CLK_ISP_DIV0], CLK_ISP_DIV0_FREQ);
+   if (ret)
+   return ret;
+   ret = clk_set_rate(is-clock[IS_CLK_ISP_DIV1], CLK_ISP_DIV1_FREQ);
+   if (ret)
+   return ret;
+   ret = clk_set_rate(is-clock[IS_CLK_ISP_DIVMPWM],
+   CLK_ISP_DIVMPWM_FREQ);
+   return ret;
+}
+
+static void fimc_is_pipelines_destroy(struct fimc_is *is)
+{
+   int i;
+
+   for (i = 0; i  is-drvdata-num_instances; i++)
+   fimc_is_pipeline_destroy(is-pipeline[i]);
+}
+
+static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index,
+  

[PATCH v8 00/12] Exynos5 IS driver

2013-09-12 Thread Arun Kumar K
The patch series add support for Exynos5 camera subsystem. It
re-uses mipi-csis and fimc-lite from exynos4-is and adds a new
media device and fimc-is device drivers for exynos5.
The media device supports asynchronos subdev registration for the
fimc-is sensors and is tested on top of the patch series from Sylwester
for exynos4-is [1].

[1] http://www.mail-archive.com/linux-media@vger.kernel.org/msg64653.html

Changes from v7
---
- Addressed few DT related review comments from Sylwester
http://www.mail-archive.com/linux-media@vger.kernel.org/msg66403.html
- Few fixes added after some regression testing

Changes from v6
---
- Addressed DT binding doc review comments from Sylwester
http://www.mail-archive.com/linux-media@vger.kernel.org/msg65771.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg65772.html

Changes from v5
---
- Addressed review comments from Sylwester
http://www.mail-archive.com/linux-media@vger.kernel.org/msg65578.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg65605.html

Changes from v4
---
- Addressed all review comments from Sylwester
- Added separate PMU node as suggested by Stephen Warren
- Added phandle based discovery of subdevs instead of node name

Changes from v3
---
- Dropped the RFC tag
- Addressed all review comments from Sylwester and Sachin
- Removed clock provider for media dev
- Added s5k4e5 sensor devicetree binding doc

Changes from v2
---
- Added exynos5 media device driver from Shaik to this series
- Added ISP pipeline support in media device driver
- Based on Sylwester's latest exynos4-is development
- Asynchronos registration of sensor subdevs
- Made independent IS-sensor support
- Add s5k4e5 sensor driver
- Addressed review comments from Sylwester, Hans, Andrzej, Sachin

Changes from v1
---
- Addressed all review comments from Sylwester
- Made sensor subdevs as independent i2c devices
- Lots of cleanup
- Debugfs support added
- Removed PMU global register access

Arun Kumar K (12):
  [media] exynos5-fimc-is: Add Exynos5 FIMC-IS device tree bindings
documentation
  [media] exynos5-fimc-is: Add driver core files
  [media] exynos5-fimc-is: Add common driver header files
  [media] exynos5-fimc-is: Add register definition and context header
  [media] exynos5-fimc-is: Add isp subdev
  [media] exynos5-fimc-is: Add scaler subdev
  [media] exynos5-fimc-is: Add sensor interface
  [media] exynos5-fimc-is: Add the hardware pipeline control
  [media] exynos5-fimc-is: Add the hardware interface module
  [media] exynos5-is: Add Kconfig and Makefile
  V4L: s5k6a3: Change sensor min/max resolutions
  V4L: Add driver for s5k4e5 image sensor

 .../devicetree/bindings/media/exynos5-fimc-is.txt  |   46 +
 .../devicetree/bindings/media/i2c/s5k4e5.txt   |   45 +
 drivers/media/i2c/Kconfig  |8 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/s5k4e5.c |  347 
 drivers/media/i2c/s5k6a3.c |   10 +-
 drivers/media/platform/Kconfig |1 +
 drivers/media/platform/Makefile|1 +
 drivers/media/platform/exynos5-is/Kconfig  |   20 +
 drivers/media/platform/exynos5-is/Makefile |7 +
 drivers/media/platform/exynos5-is/fimc-is-cmd.h|  187 +++
 drivers/media/platform/exynos5-is/fimc-is-core.c   |  413 +
 drivers/media/platform/exynos5-is/fimc-is-core.h   |  132 ++
 drivers/media/platform/exynos5-is/fimc-is-err.h|  257 +++
 .../media/platform/exynos5-is/fimc-is-interface.c  |  810 ++
 .../media/platform/exynos5-is/fimc-is-interface.h  |  124 ++
 drivers/media/platform/exynos5-is/fimc-is-isp.c|  534 ++
 drivers/media/platform/exynos5-is/fimc-is-isp.h|   90 ++
 .../media/platform/exynos5-is/fimc-is-metadata.h   |  767 +
 drivers/media/platform/exynos5-is/fimc-is-param.h  | 1159 +
 .../media/platform/exynos5-is/fimc-is-pipeline.c   | 1708 
 .../media/platform/exynos5-is/fimc-is-pipeline.h   |  129 ++
 drivers/media/platform/exynos5-is/fimc-is-regs.h   |  105 ++
 drivers/media/platform/exynos5-is/fimc-is-scaler.c |  476 ++
 drivers/media/platform/exynos5-is/fimc-is-scaler.h |  106 ++
 drivers/media/platform/exynos5-is/fimc-is-sensor.c |   45 +
 drivers/media/platform/exynos5-is/fimc-is-sensor.h |   65 +
 drivers/media/platform/exynos5-is/fimc-is.h|  160 ++
 28 files changed, 7749 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/exynos5-fimc-is.txt
 create mode 100644 Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
 create mode 100644 drivers/media/i2c/s5k4e5.c
 create mode 100644 drivers/media/platform/exynos5-is/Kconfig
 create mode 100644 drivers/media/platform/exynos5-is/Makefile
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-cmd.h
 create mode 100644 

[PATCH v8 05/12] [media] exynos5-fimc-is: Add isp subdev

2013-09-12 Thread Arun Kumar K
fimc-is driver takes video data input from the ISP video node
which is added in this patch. This node accepts Bayer input
buffers which is given from the IS sensors.

Signed-off-by: Arun Kumar K arun...@samsung.com
Signed-off-by: Kilyeon Im kilyeon...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/exynos5-is/fimc-is-isp.c |  534 +++
 drivers/media/platform/exynos5-is/fimc-is-isp.h |   90 
 2 files changed, 624 insertions(+)
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-isp.c
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-isp.h

diff --git a/drivers/media/platform/exynos5-is/fimc-is-isp.c 
b/drivers/media/platform/exynos5-is/fimc-is-isp.c
new file mode 100644
index 000..7bd603f
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/fimc-is-isp.c
@@ -0,0 +1,534 @@
+/*
+ * Samsung EXYNOS5250 FIMC-IS (Imaging Subsystem) driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ *  Arun Kumar K arun...@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 media/v4l2-ioctl.h
+#include media/videobuf2-dma-contig.h
+
+#include fimc-is.h
+
+#define ISP_DRV_NAME fimc-is-isp
+
+static const struct fimc_is_fmt formats[] = {
+   {
+   .name   = Bayer GR-BG 8bits,
+   .fourcc = V4L2_PIX_FMT_SGRBG8,
+   .depth  = { 8 },
+   .num_planes = 1,
+   },
+   {
+   .name   = Bayer GR-BG 10bits,
+   .fourcc = V4L2_PIX_FMT_SGRBG10,
+   .depth  = { 16 },
+   .num_planes = 1,
+   },
+   {
+   .name   = Bayer GR-BG 12bits,
+   .fourcc = V4L2_PIX_FMT_SGRBG12,
+   .depth  = { 16 },
+   .num_planes = 1,
+   },
+};
+#define NUM_FORMATS ARRAY_SIZE(formats)
+
+static const struct fimc_is_fmt *find_format(struct v4l2_format *f)
+{
+   unsigned int i;
+
+   for (i = 0; i  NUM_FORMATS; i++)
+   if (formats[i].fourcc == f-fmt.pix_mp.pixelformat)
+   return formats[i];
+   return NULL;
+}
+
+static int isp_video_output_start_streaming(struct vb2_queue *vq,
+   unsigned int count)
+{
+   struct fimc_is_isp *isp = vb2_get_drv_priv(vq);
+
+   set_bit(STATE_RUNNING, isp-output_state);
+   return 0;
+}
+
+static int isp_video_output_stop_streaming(struct vb2_queue *vq)
+{
+   struct fimc_is_isp *isp = vb2_get_drv_priv(vq);
+   struct fimc_is_buf *buf;
+
+   /* Release unused buffers */
+   while (!list_empty(isp-wait_queue)) {
+   buf = fimc_is_isp_wait_queue_get(isp);
+   vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
+   }
+   while (!list_empty(isp-run_queue)) {
+   buf = fimc_is_isp_run_queue_get(isp);
+   vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
+   }
+
+   clear_bit(STATE_RUNNING, isp-output_state);
+   return 0;
+}
+
+static int isp_video_output_queue_setup(struct vb2_queue *vq,
+   const struct v4l2_format *pfmt,
+   unsigned int *num_buffers, unsigned int *num_planes,
+   unsigned int sizes[], void *allocators[])
+{
+   struct fimc_is_isp *isp = vb2_get_drv_priv(vq);
+   const struct fimc_is_fmt *fmt = isp-fmt;
+   unsigned int wh, i;
+
+   if (!fmt)
+   return -EINVAL;
+
+   *num_planes = fmt-num_planes;
+   wh = isp-width * isp-height;
+
+   for (i = 0; i  *num_planes; i++) {
+   allocators[i] = isp-alloc_ctx;
+   sizes[i] = (wh * fmt-depth[i]) / 8;
+   }
+   return 0;
+}
+
+static int isp_video_output_buffer_init(struct vb2_buffer *vb)
+{
+   struct fimc_is_buf *buf = container_of(vb, struct fimc_is_buf, vb);
+
+   buf-paddr[0] = vb2_dma_contig_plane_dma_addr(vb, 0);
+   return 0;
+}
+
+static int isp_video_output_buffer_prepare(struct vb2_buffer *vb)
+{
+   struct vb2_queue *vq = vb-vb2_queue;
+   struct fimc_is_isp *isp = vb2_get_drv_priv(vq);
+   unsigned long size;
+
+   size = (isp-width * isp-height * isp-fmt-depth[0]) / 8;
+   if (vb2_plane_size(vb, 0)  size) {
+   v4l2_err(isp-subdev, User buffer too small (%ld  %ld)\n,
+vb2_plane_size(vb, 0), size);
+   return -EINVAL;
+   }
+   vb2_set_plane_payload(vb, 0, size);
+
+   return 0;
+}
+
+static void isp_video_output_buffer_queue(struct vb2_buffer *vb)
+{
+   struct vb2_queue *vq = vb-vb2_queue;
+   struct fimc_is_isp *isp = vb2_get_drv_priv(vq);
+   struct fimc_is_buf *buf = container_of(vb, struct fimc_is_buf, vb);
+
+   

[PATCH v8 10/12] [media] exynos5-is: Add Kconfig and Makefile

2013-09-12 Thread Arun Kumar K
Adds Kconfig and Makefile for exynos5-is driver files.

Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
Signed-off-by: Arun Kumar K arun...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/Kconfig |1 +
 drivers/media/platform/Makefile|1 +
 drivers/media/platform/exynos5-is/Kconfig  |   20 
 drivers/media/platform/exynos5-is/Makefile |7 +++
 4 files changed, 29 insertions(+)
 create mode 100644 drivers/media/platform/exynos5-is/Kconfig
 create mode 100644 drivers/media/platform/exynos5-is/Makefile

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 08de865..4b0475e 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -123,6 +123,7 @@ config VIDEO_S3C_CAMIF
 
 source drivers/media/platform/soc_camera/Kconfig
 source drivers/media/platform/exynos4-is/Kconfig
+source drivers/media/platform/exynos5-is/Kconfig
 source drivers/media/platform/s5p-tv/Kconfig
 
 endif # V4L_PLATFORM_DRIVERS
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index eee28dd..40bf09f 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_TV)+= s5p-tv/
 
 obj-$(CONFIG_VIDEO_SAMSUNG_S5P_G2D)+= s5p-g2d/
 obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC) += exynos-gsc/
+obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS5_CAMERA) += exynos5-is/
 
 obj-$(CONFIG_BLACKFIN)  += blackfin/
 
diff --git a/drivers/media/platform/exynos5-is/Kconfig 
b/drivers/media/platform/exynos5-is/Kconfig
new file mode 100644
index 000..b67d11a
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/Kconfig
@@ -0,0 +1,20 @@
+config VIDEO_SAMSUNG_EXYNOS5_CAMERA
+   bool Samsung Exynos5 SoC Camera Media Device driver
+   depends on VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API  PM_RUNTIME
+   depends on VIDEO_SAMSUNG_EXYNOS4_IS
+   help
+ This is a V4L2 media device driver for Exynos5 SoC series
+ camera subsystem.
+
+if VIDEO_SAMSUNG_EXYNOS5_CAMERA
+
+config VIDEO_SAMSUNG_EXYNOS5_FIMC_IS
+   tristate Samsung Exynos5 SoC FIMC-IS driver
+   depends on I2C  OF
+   depends on VIDEO_EXYNOS4_FIMC_IS
+   select VIDEOBUF2_DMA_CONTIG
+   help
+ This is a V4L2 driver for Samsung Exynos5 SoC series Imaging
+ Subsystem known as FIMC-IS.
+
+endif #VIDEO_SAMSUNG_EXYNOS5_MDEV
diff --git a/drivers/media/platform/exynos5-is/Makefile 
b/drivers/media/platform/exynos5-is/Makefile
new file mode 100644
index 000..6cdb037
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/Makefile
@@ -0,0 +1,7 @@
+ccflags-y += -Idrivers/media/platform/exynos4-is
+exynos5-fimc-is-objs := fimc-is-core.o fimc-is-isp.o fimc-is-scaler.o
+exynos5-fimc-is-objs += fimc-is-pipeline.o fimc-is-interface.o fimc-is-sensor.o
+exynos-mdevice-objs := exynos5-mdev.o
+
+obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS5_FIMC_IS) += exynos5-fimc-is.o
+obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS5_CAMERA) += exynos-mdevice.o
-- 
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 v8 07/12] [media] exynos5-fimc-is: Add sensor interface

2013-09-12 Thread Arun Kumar K
Some sensors to be used with fimc-is are exclusively controlled
by the fimc-is firmware. This minimal sensor driver provides
the required info for the firmware to configure the sensors
sitting on I2C bus.

Signed-off-by: Arun Kumar K arun...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/exynos5-is/fimc-is-sensor.c |   45 ++
 drivers/media/platform/exynos5-is/fimc-is-sensor.h |   65 
 2 files changed, 110 insertions(+)
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-sensor.c
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-sensor.h

diff --git a/drivers/media/platform/exynos5-is/fimc-is-sensor.c 
b/drivers/media/platform/exynos5-is/fimc-is-sensor.c
new file mode 100644
index 000..475f1c3
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/fimc-is-sensor.c
@@ -0,0 +1,45 @@
+/*
+ * Samsung EXYNOS5250 FIMC-IS (Imaging Subsystem) driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Arun Kumar K arun...@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 fimc-is-sensor.h
+
+static const struct sensor_drv_data s5k6a3_drvdata = {
+   .id = FIMC_IS_SENSOR_ID_S5K6A3,
+   .open_timeout   = S5K6A3_OPEN_TIMEOUT,
+   .setfile_name   = exynos5_s5k6a3_setfile.bin,
+};
+
+static const struct sensor_drv_data s5k4e5_drvdata = {
+   .id = FIMC_IS_SENSOR_ID_S5K4E5,
+   .open_timeout   = S5K4E5_OPEN_TIMEOUT,
+   .setfile_name   = exynos5_s5k4e5_setfile.bin,
+};
+
+static const struct of_device_id fimc_is_sensor_of_ids[] = {
+   {
+   .compatible = samsung,s5k6a3,
+   .data   = s5k6a3_drvdata,
+   },
+   {
+   .compatible = samsung,s5k4e5,
+   .data   = s5k4e5_drvdata,
+   },
+   {  }
+};
+
+const struct sensor_drv_data *exynos5_is_sensor_get_drvdata(
+   struct device_node *node)
+{
+   const struct of_device_id *of_id;
+
+   of_id = of_match_node(fimc_is_sensor_of_ids, node);
+   return of_id ? of_id-data : NULL;
+}
diff --git a/drivers/media/platform/exynos5-is/fimc-is-sensor.h 
b/drivers/media/platform/exynos5-is/fimc-is-sensor.h
new file mode 100644
index 000..0ba5733
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/fimc-is-sensor.h
@@ -0,0 +1,65 @@
+/*
+ * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Arun Kumar K arun...@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.
+ */
+#ifndef FIMC_IS_SENSOR_H_
+#define FIMC_IS_SENSOR_H_
+
+#include linux/of.h
+#include linux/types.h
+
+#define S5K6A3_OPEN_TIMEOUT2000 /* ms */
+#define S5K6A3_SENSOR_WIDTH1392
+#define S5K6A3_SENSOR_HEIGHT   1392
+
+#define S5K4E5_OPEN_TIMEOUT2000 /* ms */
+#define S5K4E5_SENSOR_WIDTH2560
+#define S5K4E5_SENSOR_HEIGHT   1920
+
+#define SENSOR_WIDTH_PADDING   16
+#define SENSOR_HEIGHT_PADDING  10
+
+enum fimc_is_sensor_id {
+   FIMC_IS_SENSOR_ID_S5K3H2 = 1,
+   FIMC_IS_SENSOR_ID_S5K6A3,
+   FIMC_IS_SENSOR_ID_S5K4E5,
+   FIMC_IS_SENSOR_ID_S5K3H7,
+   FIMC_IS_SENSOR_ID_CUSTOM,
+   FIMC_IS_SENSOR_ID_END
+};
+
+struct sensor_drv_data {
+   enum fimc_is_sensor_id id;
+   /* sensor open timeout in ms */
+   unsigned short open_timeout;
+   char *setfile_name;
+};
+
+/**
+ * struct fimc_is_sensor - fimc-is sensor data structure
+ * @drvdata: a pointer to the sensor's parameters data structure
+ * @i2c_bus: ISP I2C bus index (0...1)
+ * @width: sensor active width
+ * @height: sensor active height
+ * @pixel_width: sensor effective pixel width (width + padding)
+ * @pixel_height: sensor effective pixel height (height + padding)
+ */
+struct fimc_is_sensor {
+   const struct sensor_drv_data *drvdata;
+   unsigned int i2c_bus;
+   unsigned int width;
+   unsigned int height;
+   unsigned int pixel_width;
+   unsigned int pixel_height;
+};
+
+const struct sensor_drv_data *exynos5_is_sensor_get_drvdata(
+   struct device_node *node);
+
+#endif /* FIMC_IS_SENSOR_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 v8 04/12] [media] exynos5-fimc-is: Add register definition and context header

2013-09-12 Thread Arun Kumar K
This patch adds the register definition file for the fimc-is driver
and also the header file containing the main context for the driver.

Signed-off-by: Arun Kumar K arun...@samsung.com
Signed-off-by: Kilyeon Im kilyeon...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/exynos5-is/fimc-is-regs.h |  105 ++
 drivers/media/platform/exynos5-is/fimc-is.h  |  160 ++
 2 files changed, 265 insertions(+)
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-regs.h
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is.h

diff --git a/drivers/media/platform/exynos5-is/fimc-is-regs.h 
b/drivers/media/platform/exynos5-is/fimc-is-regs.h
new file mode 100644
index 000..06aa466
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/fimc-is-regs.h
@@ -0,0 +1,105 @@
+/*
+ * Samsung Exynos5 SoC series FIMC-IS driver
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd
+ * Arun Kumar K arun...@samsung.com
+ * Kil-yeon Lim kilyeon...@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.
+ */
+
+#ifndef FIMC_IS_REGS_H
+#define FIMC_IS_REGS_H
+
+/* WDT_ISP register */
+#define WDT0x0017
+/* MCUCTL register */
+#define MCUCTL 0x0018
+/* MCU Controller Register */
+#define MCUCTLR(MCUCTL+0x00)
+#define MCUCTLR_AXI_ISPX_AWCACHE(x)((x)  16)
+#define MCUCTLR_AXI_ISPX_ARCACHE(x)((x)  12)
+#define MCUCTLR_MSWRST (1  0)
+/* Boot Base OFfset Address Register */
+#define BBOAR  (MCUCTL+0x04)
+#define BBOAR_BBOA(x)  ((x)  0)
+
+/* Interrupt Generation Register 0 from Host CPU to VIC */
+#define INTGR0 (MCUCTL+0x08)
+#define INTGR0_INTGC(n)(1  ((n) + 16))
+#define INTGR0_INTGD(n)(1  (n))
+
+/* Interrupt Clear Register 0 from Host CPU to VIC */
+#define INTCR0 (MCUCTL+0x0c)
+#define INTCR0_INTCC(n)(1  ((n) + 16))
+#define INTCR0_INTCD(n)(1  (n))
+
+/* Interrupt Mask Register 0 from Host CPU to VIC */
+#define INTMR0 (MCUCTL+0x10)
+#define INTMR0_INTMC(n)(1  ((n) + 16))
+#define INTMR0_INTMD(n)(1  (n))
+
+/* Interrupt Status Register 0 from Host CPU to VIC */
+#define INTSR0 (MCUCTL+0x14)
+#define INTSR0_GET_INTSD(n, x) (((x)  (n))  0x1)
+#define INTSR0_GET_INTSC(n, x) (((x)  ((n) + 16))  0x1)
+
+/* Interrupt Mask Status Register 0 from Host CPU to VIC */
+#define INTMSR0(MCUCTL+0x18)
+#define INTMSR0_GET_INTMSD(n, x)   (((x)  (n))  0x1)
+#define INTMSR0_GET_INTMSC(n, x)   (((x)  ((n) + 16))  0x1)
+
+/* Interrupt Generation Register 1 from ISP CPU to Host IC */
+#define INTGR1 (MCUCTL+0x1c)
+#define INTGR1_INTGC(n)(1  (n))
+
+/* Interrupt Clear Register 1 from ISP CPU to Host IC */
+#define INTCR1 (MCUCTL+0x20)
+#define INTCR1_INTCC(n)(1  (n))
+
+/* Interrupt Mask Register 1 from ISP CPU to Host IC */
+#define INTMR1 (MCUCTL+0x24)
+#define INTMR1_INTMC(n)(1  (n))
+
+/* Interrupt Status Register 1 from ISP CPU to Host IC */
+#define INTSR1 (MCUCTL+0x28)
+/* Interrupt Mask Status Register 1 from ISP CPU to Host IC */
+#define INTMSR1(MCUCTL+0x2c)
+/* Interrupt Clear Register 2 from ISP BLK's interrupts to Host IC */
+#define INTCR2 (MCUCTL+0x30)
+#define INTCR2_INTCC(n)(1  (n))
+
+/* Interrupt Mask Register 2 from ISP BLK's interrupts to Host IC */
+#define INTMR2 (MCUCTL+0x34)
+#define INTMR2_INTMCIS(n)  (1  (n))
+
+/* Interrupt Status Register 2 from ISP BLK's interrupts to Host IC */
+#define INTSR2 (MCUCTL+0x38)
+/* Interrupt Mask Status Register 2 from ISP BLK's interrupts to Host IC */
+#define INTMSR2(MCUCTL+0x3c)
+/* General Purpose Output Control Register (0~17) */
+#define GPOCTLR(MCUCTL+0x40)
+#define GPOCTLR_GPOG(n, x) ((x)  (n))
+
+/* General Purpose Pad Output Enable Register (0~17) */
+#define GPOENCTLR  (MCUCTL+0x44)
+#define GPOENCTLR_GPOEN0(n, x) ((x)  (n))
+
+/* General Purpose Input Control Register (0~17) */
+#define GPICTLR(MCUCTL+0x48)
+
+/* IS Shared Registers between ISP CPU and HOST CPU */
+#define ISSR(n)(MCUCTL + 0x80 + (n))
+
+/* PMU for FIMC-IS*/
+#define 

[PATCH v8 06/12] [media] exynos5-fimc-is: Add scaler subdev

2013-09-12 Thread Arun Kumar K
FIMC-IS has two hardware scalers named as scaler-codec and
scaler-preview. This patch adds the common code handling the
video nodes and subdevs of both the scalers.

Signed-off-by: Arun Kumar K arun...@samsung.com
Signed-off-by: Kilyeon Im kilyeon...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/platform/exynos5-is/fimc-is-scaler.c |  476 
 drivers/media/platform/exynos5-is/fimc-is-scaler.h |  106 +
 2 files changed, 582 insertions(+)
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-scaler.c
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-scaler.h

diff --git a/drivers/media/platform/exynos5-is/fimc-is-scaler.c 
b/drivers/media/platform/exynos5-is/fimc-is-scaler.c
new file mode 100644
index 000..029eb8b
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/fimc-is-scaler.c
@@ -0,0 +1,476 @@
+/*
+ * Samsung EXYNOS5250 FIMC-IS (Imaging Subsystem) driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ *  Arun Kumar K arun...@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 media/v4l2-ioctl.h
+#include media/videobuf2-dma-contig.h
+
+#include fimc-is.h
+
+#define IS_SCALER_DRV_NAME fimc-is-scaler
+
+static const struct fimc_is_fmt formats[] = {
+   {
+   .name   = YUV 4:2:0 3p MultiPlanar,
+   .fourcc = V4L2_PIX_FMT_YUV420M,
+   .depth  = {8, 2, 2},
+   .num_planes = 3,
+   },
+   {
+   .name   = YUV 4:2:0 2p MultiPlanar,
+   .fourcc = V4L2_PIX_FMT_NV12M,
+   .depth  = {8, 4},
+   .num_planes = 2,
+   },
+   {
+   .name   = YUV 4:2:2 1p MultiPlanar,
+   .fourcc = V4L2_PIX_FMT_NV16,
+   .depth  = {16},
+   .num_planes = 1,
+   },
+};
+#define NUM_FORMATS ARRAY_SIZE(formats)
+
+static const struct fimc_is_fmt *find_format(struct v4l2_format *f)
+{
+   unsigned int i;
+
+   for (i = 0; i  NUM_FORMATS; i++) {
+   if (formats[i].fourcc == f-fmt.pix_mp.pixelformat)
+   return formats[i];
+   }
+   return NULL;
+}
+
+static int scaler_video_capture_start_streaming(struct vb2_queue *vq,
+   unsigned int count)
+{
+   struct fimc_is_scaler *ctx = vb2_get_drv_priv(vq);
+   int ret;
+
+   ret = fimc_is_pipeline_scaler_start(ctx-pipeline,
+   ctx-scaler_id,
+   vq-num_buffers,
+   ctx-fmt-num_planes);
+   if (ret) {
+   v4l2_err(ctx-subdev, Scaler start failed.\n);
+   return -EINVAL;
+   }
+
+   set_bit(STATE_RUNNING, ctx-capture_state);
+   return 0;
+}
+
+static int scaler_video_capture_stop_streaming(struct vb2_queue *vq)
+{
+   struct fimc_is_scaler *ctx = vb2_get_drv_priv(vq);
+   struct fimc_is_buf *buf;
+   int ret;
+
+   ret = fimc_is_pipeline_scaler_stop(ctx-pipeline, ctx-scaler_id);
+   if (ret)
+   v4l2_info(ctx-subdev, Scaler already stopped.\n);
+
+   /* Release un-used buffers */
+   while (!list_empty(ctx-wait_queue)) {
+   buf = fimc_is_scaler_wait_queue_get(ctx);
+   vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
+   }
+   while (!list_empty(ctx-run_queue)) {
+   buf = fimc_is_scaler_run_queue_get(ctx);
+   vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
+   }
+
+   clear_bit(STATE_RUNNING, ctx-capture_state);
+   return 0;
+}
+
+static int scaler_video_capture_queue_setup(struct vb2_queue *vq,
+   const struct v4l2_format *pfmt,
+   unsigned int *num_buffers, unsigned int *num_planes,
+   unsigned int sizes[], void *allocators[])
+{
+   struct fimc_is_scaler *ctx = vb2_get_drv_priv(vq);
+   const struct fimc_is_fmt *fmt = ctx-fmt;
+   unsigned int wh;
+   int i;
+
+   if (!fmt)
+   return -EINVAL;
+
+   *num_planes = fmt-num_planes;
+   wh = ctx-width * ctx-height;
+
+   for (i = 0; i  *num_planes; i++) {
+   allocators[i] = ctx-alloc_ctx;
+   sizes[i] = (wh * fmt-depth[i]) / 8;
+   }
+   return 0;
+}
+
+static int scaler_video_capture_buffer_init(struct vb2_buffer *vb)
+{
+   struct vb2_queue *vq = vb-vb2_queue;
+   struct fimc_is_scaler *ctx = vb2_get_drv_priv(vq);
+   struct fimc_is_buf *buf = container_of(vb, struct fimc_is_buf, vb);
+   const struct fimc_is_fmt *fmt;
+   int i;
+
+   fmt = ctx-fmt;
+   for (i = 0; i  fmt-num_planes; i++)
+   buf-paddr[i] = vb2_dma_contig_plane_dma_addr(vb, i);
+
+   

[PATCH v8 11/12] V4L: s5k6a3: Change sensor min/max resolutions

2013-09-12 Thread Arun Kumar K
s5k6a3 sensor has actual pixel resolution of 1408x1402 against
the active resolution 1392x1392. The real resolution is needed
when raw sensor SRGB data is dumped to memory by fimc-lite.

Signed-off-by: Arun Kumar K arun...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 drivers/media/i2c/s5k6a3.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/s5k6a3.c b/drivers/media/i2c/s5k6a3.c
index ccbb4fc..e70e217 100644
--- a/drivers/media/i2c/s5k6a3.c
+++ b/drivers/media/i2c/s5k6a3.c
@@ -25,10 +25,12 @@
 #include media/v4l2-async.h
 #include media/v4l2-subdev.h
 
-#define S5K6A3_SENSOR_MAX_WIDTH1392
-#define S5K6A3_SENSOR_MAX_HEIGHT   1392
-#define S5K6A3_SENSOR_MIN_WIDTH32
-#define S5K6A3_SENSOR_MIN_HEIGHT   32
+#define S5K6A3_SENSOR_MAX_WIDTH1408
+#define S5K6A3_SENSOR_MAX_HEIGHT   1402
+#define S5K6A3_SENSOR_ACTIVE_WIDTH 1392
+#define S5K6A3_SENSOR_ACTIVE_HEIGHT1392
+#define S5K6A3_SENSOR_MIN_WIDTH(32 + 16)
+#define S5K6A3_SENSOR_MIN_HEIGHT   (32 + 10)
 
 #define S5K6A3_DEF_PIX_WIDTH   1296
 #define S5K6A3_DEF_PIX_HEIGHT  732
-- 
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 v8 09/12] [media] exynos5-fimc-is: Add the hardware interface module

2013-09-12 Thread Arun Kumar K
The hardware interface module finally sends the commands to the
FIMC-IS firmware and runs the interrupt handler for getting the
responses.

Signed-off-by: Arun Kumar K arun...@samsung.com
Signed-off-by: Kilyeon Im kilyeon...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 .../media/platform/exynos5-is/fimc-is-interface.c  |  810 
 .../media/platform/exynos5-is/fimc-is-interface.h  |  124 +++
 2 files changed, 934 insertions(+)
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-interface.c
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-interface.h

diff --git a/drivers/media/platform/exynos5-is/fimc-is-interface.c 
b/drivers/media/platform/exynos5-is/fimc-is-interface.c
new file mode 100644
index 000..c5da6ff
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/fimc-is-interface.c
@@ -0,0 +1,810 @@
+/*
+ * Samsung EXYNOS5 FIMC-IS (Imaging Subsystem) driver
+*
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Kil-yeon Lim kilyeon...@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/debugfs.h
+#include linux/seq_file.h
+#include fimc-is.h
+#include fimc-is-cmd.h
+#include fimc-is-regs.h
+
+#define init_request_barrier(itf) mutex_init(itf-request_barrier)
+#define enter_request_barrier(itf) mutex_lock(itf-request_barrier)
+#define exit_request_barrier(itf) mutex_unlock(itf-request_barrier)
+
+static inline void itf_get_cmd(struct fimc_is_interface *itf,
+   struct fimc_is_msg *msg, unsigned int index)
+{
+   struct is_common_reg __iomem *com_regs = itf-com_regs;
+
+   memset(msg, 0, sizeof(*msg));
+
+   switch (index) {
+   case INTR_GENERAL:
+   msg-command = com_regs-ihcmd;
+   msg-instance = com_regs-ihc_sensorid;
+   memcpy(msg-param, com_regs-ihc_param,
+   4 * sizeof(msg-param[0]));
+   break;
+   case INTR_SCC_FDONE:
+   msg-command = IHC_FRAME_DONE;
+   msg-instance = com_regs-scc_sensor_id;
+   memcpy(msg-param, com_regs-scc_param,
+   3 * sizeof(msg-param[0]));
+   break;
+   case INTR_SCP_FDONE:
+   msg-command = IHC_FRAME_DONE;
+   msg-instance = com_regs-scp_sensor_id;
+   memcpy(msg-param, com_regs-scp_param,
+   3 * sizeof(msg-param[0]));
+   break;
+   case INTR_META_DONE:
+   msg-command = IHC_FRAME_DONE;
+   msg-instance = com_regs-meta_sensor_id;
+   msg-param[0] = com_regs-meta_param1;
+   break;
+   case INTR_SHOT_DONE:
+   msg-command = IHC_FRAME_DONE;
+   msg-instance = com_regs-shot_sensor_id;
+   memcpy(msg-param, com_regs-shot_param,
+   2 * sizeof(msg-param[0]));
+   break;
+   default:
+   dev_err(itf-dev, %s Unknown command\n, __func__);
+   break;
+   }
+}
+
+static inline unsigned int itf_get_intr(struct fimc_is_interface *itf)
+{
+   unsigned int status;
+   struct is_common_reg __iomem *com_regs = itf-com_regs;
+
+   status = readl(itf-regs + INTMSR1) | com_regs-ihcmd_iflag |
+   com_regs-scc_iflag |
+   com_regs-scp_iflag |
+   com_regs-meta_iflag |
+   com_regs-shot_iflag;
+
+   return status;
+}
+
+static void itf_set_state(struct fimc_is_interface *itf,
+   unsigned long state)
+{
+   unsigned long flags;
+   spin_lock_irqsave(itf-slock_state, flags);
+   __set_bit(state, itf-state);
+   spin_unlock_irqrestore(itf-slock_state, flags);
+}
+
+static void itf_clr_state(struct fimc_is_interface *itf,
+   unsigned long state)
+{
+   unsigned long flags;
+   spin_lock_irqsave(itf-slock_state, flags);
+   __clear_bit(state, itf-state);
+   spin_unlock_irqrestore(itf-slock_state, flags);
+}
+
+static int itf_get_state(struct fimc_is_interface *itf,
+   unsigned long state)
+{
+   int ret = 0;
+   unsigned long flags;
+
+   spin_lock_irqsave(itf-slock_state, flags);
+   ret = test_bit(state, itf-state);
+   spin_unlock_irqrestore(itf-slock_state, flags);
+   return ret;
+}
+
+static void itf_init_wakeup(struct fimc_is_interface *itf)
+{
+   itf_set_state(itf, IS_IF_STATE_INIT);
+   wake_up(itf-irq_queue);
+}
+
+void itf_busy_wakeup(struct fimc_is_interface *itf)
+{
+   itf_clr_state(itf, IS_IF_STATE_BUSY);
+   wake_up(itf-irq_queue);
+}
+
+static int itf_wait_hw_ready(struct fimc_is_interface *itf)
+{
+   int t;
+   for (t = TRY_RECV_AWARE_COUNT; t = 0; t--) {
+   unsigned int cfg = readl(itf-regs + INTMSR0);
+   

[PATCH v8 12/12] V4L: Add driver for s5k4e5 image sensor

2013-09-12 Thread Arun Kumar K
This patch adds subdev driver for Samsung S5K4E5 raw image sensor.
Like s5k6a3, it is also another fimc-is firmware controlled
sensor. This minimal sensor driver doesn't do any I2C communications
as its done by ISP firmware. It can be updated if needed to a
regular sensor driver by adding the I2C communication.

Signed-off-by: Arun Kumar K arun...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 .../devicetree/bindings/media/i2c/s5k4e5.txt   |   45 +++
 drivers/media/i2c/Kconfig  |8 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/s5k4e5.c |  347 
 4 files changed, 401 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
 create mode 100644 drivers/media/i2c/s5k4e5.c

diff --git a/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt 
b/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
new file mode 100644
index 000..f8394b6
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
@@ -0,0 +1,45 @@
+* Samsung S5K4E5 Raw Image Sensor
+
+S5K4E5 is a raw image sensor with maximum resolution of 2560x1920
+pixels. Data transfer is carried out via MIPI CSI-2 port and controls
+via I2C bus.
+
+Required Properties:
+- compatible   : must be samsung,s5k4e5
+- reg  : I2C device address
+- reset-gpios  : specifier of a GPIO connected to the RESET pin
+- clocks   : should contain the sensor's EXTCLK clock specifier, from
+ the common clock bindings
+- clock-names  : should contain extclk entry
+- svdda-supply : core voltage supply
+- svddio-supply: I/O voltage supply
+
+Optional Properties:
+- clock-frequency : the frequency at which the extclk clock should be
+   configured to operate, in Hz; if this property is not
+   specified default 24 MHz value will be used
+
+The device node should be added to respective control bus controller
+(e.g. I2C0) nodes and linked to the csis port node, using the common
+video interfaces bindings, defined in video-interfaces.txt.
+
+Example:
+
+   i2c-isp@1313 {
+   s5k4e5@20 {
+   compatible = samsung,s5k4e5;
+   reg = 0x20;
+   gpios = gpx1 2 1;
+   clock-frequency = 2400;
+   clocks = clock 129;
+   clock-names = mclk;
+   svdda-supply = ...;
+   svddio-supply = ...;
+   port {
+   is_s5k4e5_ep: endpoint {
+   data-lanes = 1 2 3 4;
+   remote-endpoint = csis0_ep;
+   };
+   };
+   };
+   };
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index f7e9147..271028b 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -572,6 +572,14 @@ config VIDEO_S5K6A3
  This is a V4L2 sensor-level driver for Samsung S5K6A3 raw
  camera sensor.
 
+config VIDEO_S5K4E5
+   tristate Samsung S5K4E5 sensor support
+   depends on MEDIA_CAMERA_SUPPORT
+   depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API  OF
+   ---help---
+ This is a V4L2 sensor-level driver for Samsung S5K4E5 raw
+ camera sensor.
+
 config VIDEO_S5K4ECGX
 tristate Samsung S5K4ECGX sensor support
 depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index cf3cf03..0aeed8e 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -65,6 +65,7 @@ obj-$(CONFIG_VIDEO_SR030PC30) += sr030pc30.o
 obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o
 obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
 obj-$(CONFIG_VIDEO_S5K6A3) += s5k6a3.o
+obj-$(CONFIG_VIDEO_S5K4E5) += s5k4e5.o
 obj-$(CONFIG_VIDEO_S5K4ECGX)   += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
diff --git a/drivers/media/i2c/s5k4e5.c b/drivers/media/i2c/s5k4e5.c
new file mode 100644
index 000..639062b
--- /dev/null
+++ b/drivers/media/i2c/s5k4e5.c
@@ -0,0 +1,347 @@
+/*
+ * Samsung S5K4E5 image sensor driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Arun Kumar K arun...@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/clk.h
+#include linux/delay.h
+#include linux/device.h
+#include linux/errno.h
+#include linux/gpio.h
+#include linux/i2c.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of_gpio.h
+#include linux/pm_runtime.h
+#include linux/regulator/consumer.h
+#include linux/slab.h
+#include 

[PATCH v8 08/12] [media] exynos5-fimc-is: Add the hardware pipeline control

2013-09-12 Thread Arun Kumar K
This patch adds the crucial hardware pipeline control for the
fimc-is driver. All the subdev nodes will call this pipeline
interfaces to reach the hardware. Responsibilities of this module
involves configuring and maintaining the hardware pipeline involving
multiple sub-ips like ISP, DRC, Scalers, ODC, 3DNR, FD etc.

Signed-off-by: Arun Kumar K arun...@samsung.com
Signed-off-by: Kilyeon Im kilyeon...@samsung.com
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
 .../media/platform/exynos5-is/fimc-is-pipeline.c   | 1708 
 .../media/platform/exynos5-is/fimc-is-pipeline.h   |  129 ++
 2 files changed, 1837 insertions(+)
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-pipeline.c
 create mode 100644 drivers/media/platform/exynos5-is/fimc-is-pipeline.h

diff --git a/drivers/media/platform/exynos5-is/fimc-is-pipeline.c 
b/drivers/media/platform/exynos5-is/fimc-is-pipeline.c
new file mode 100644
index 000..a73d952
--- /dev/null
+++ b/drivers/media/platform/exynos5-is/fimc-is-pipeline.c
@@ -0,0 +1,1708 @@
+/*
+ * Samsung EXYNOS5 FIMC-IS (Imaging Subsystem) driver
+*
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Arun Kumar K arun...@samsung.com
+ * Kil-yeon Lim kilyeon...@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 fimc-is.h
+#include fimc-is-pipeline.h
+#include fimc-is-metadata.h
+#include fimc-is-regs.h
+#include fimc-is-cmd.h
+#include media/videobuf2-dma-contig.h
+#include linux/delay.h
+
+/* Default setting values */
+#define DEFAULT_PREVIEW_STILL_WIDTH1280
+#define DEFAULT_PREVIEW_STILL_HEIGHT   720
+#define DEFAULT_CAPTURE_VIDEO_WIDTH1920
+#define DEFAULT_CAPTURE_VIDEO_HEIGHT   1080
+#define DEFAULT_CAPTURE_STILL_WIDTH2560
+#define DEFAULT_CAPTURE_STILL_HEIGHT   1920
+#define DEFAULT_CAPTURE_STILL_CROP_WIDTH   2560
+#define DEFAULT_CAPTURE_STILL_CROP_HEIGHT  1440
+#define DEFAULT_PREVIEW_VIDEO_WIDTH640
+#define DEFAULT_PREVIEW_VIDEO_HEIGHT   480
+
+/* Init params for pipeline devices */
+static const struct sensor_param init_sensor_param = {
+   .frame_rate = {
+   .frame_rate = 30,
+   },
+};
+
+static const struct isp_param init_isp_param = {
+   .control = {
+   .cmd = CONTROL_COMMAND_START,
+   .bypass = CONTROL_BYPASS_DISABLE,
+   },
+   .otf_input = {
+   .cmd = OTF_INPUT_COMMAND_DISABLE,
+   .width = DEFAULT_CAPTURE_STILL_WIDTH,
+   .height = DEFAULT_CAPTURE_STILL_HEIGHT,
+   .format = OTF_INPUT_FORMAT_BAYER,
+   .bitwidth = OTF_INPUT_BIT_WIDTH_10BIT,
+   .order = OTF_INPUT_ORDER_BAYER_GR_BG,
+   .frametime_max = 3,
+   },
+   .dma1_input = {
+   .cmd = DMA_INPUT_COMMAND_DISABLE,
+   },
+   .dma2_input = {
+   .cmd = DMA_INPUT_COMMAND_DISABLE,
+   },
+   .aa = {
+   .cmd = ISP_AA_COMMAND_START,
+   },
+   .flash = {
+   .cmd = ISP_FLASH_COMMAND_DISABLE,
+   .redeye = ISP_FLASH_REDEYE_DISABLE,
+   },
+   .awb = {
+   .cmd = ISP_AWB_COMMAND_AUTO,
+   },
+   .effect = {
+   .cmd = ISP_IMAGE_EFFECT_DISABLE,
+   },
+   .iso = {
+   .cmd = ISP_ISO_COMMAND_AUTO,
+   },
+   .adjust = {
+   .cmd = ISP_ADJUST_COMMAND_AUTO,
+   },
+   .metering = {
+   .cmd = ISP_METERING_COMMAND_CENTER,
+   .win_width = DEFAULT_CAPTURE_STILL_WIDTH,
+   .win_height = DEFAULT_CAPTURE_STILL_HEIGHT,
+   },
+   .afc = {
+   .cmd = ISP_AFC_COMMAND_AUTO,
+   },
+   .otf_output = {
+   .cmd = OTF_OUTPUT_COMMAND_ENABLE,
+   .width = DEFAULT_CAPTURE_STILL_WIDTH,
+   .height = DEFAULT_CAPTURE_STILL_HEIGHT,
+   .format = OTF_OUTPUT_FORMAT_YUV444,
+   .bitwidth = OTF_OUTPUT_BIT_WIDTH_12BIT,
+   .order = OTF_OUTPUT_ORDER_BAYER_GR_BG,
+   },
+   .dma1_output = {
+   .cmd = DMA_OUTPUT_COMMAND_DISABLE,
+   .width = DEFAULT_CAPTURE_STILL_WIDTH,
+   .height = DEFAULT_CAPTURE_STILL_HEIGHT,
+   .format = DMA_INPUT_FORMAT_YUV444,
+   .bitwidth = DMA_INPUT_BIT_WIDTH_8BIT,
+   .plane = 1,
+   .order = DMA_INPUT_ORDER_YCBCR,
+   },
+   .dma2_output = {
+   .cmd = DMA_OUTPUT_COMMAND_DISABLE,
+   .width = DEFAULT_CAPTURE_STILL_WIDTH,
+   .height = DEFAULT_CAPTURE_STILL_HEIGHT,
+   .format = DMA_OUTPUT_FORMAT_BAYER,
+   .bitwidth = DMA_OUTPUT_BIT_WIDTH_12BIT,
+   .plane = 1,
+   .order = 

[PATCH] SOLO6x10: Remove unused #define SOLO_DEFAULT_GOP

2013-09-12 Thread Krzysztof Hałasa
Signed-off-by: Krzysztof Hałasa khal...@piap.pl

diff --git a/drivers/staging/media/solo6x10/solo6x10.h 
b/drivers/staging/media/solo6x10/solo6x10.h
index 6f91d2e..f1bbb8c 100644
--- a/drivers/staging/media/solo6x10/solo6x10.h
+++ b/drivers/staging/media/solo6x10/solo6x10.h
@@ -94,7 +94,6 @@
 #define SOLO_ENC_MODE_HD1  1
 #define SOLO_ENC_MODE_D1   9
 
-#define SOLO_DEFAULT_GOP   30
 #define SOLO_DEFAULT_QP3
 
 #ifndef V4L2_BUF_FLAG_MOTION_ON
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] SOLO6x10: don't do DMA from stack in solo_dma_vin_region().

2013-09-12 Thread Krzysztof Hałasa
Signed-off-by: Krzysztof Hałasa khal...@piap.pl

diff --git a/drivers/staging/media/solo6x10/solo6x10-disp.c 
b/drivers/staging/media/solo6x10/solo6x10-disp.c
index 32d9953..884512e 100644
--- a/drivers/staging/media/solo6x10/solo6x10-disp.c
+++ b/drivers/staging/media/solo6x10/solo6x10-disp.c
@@ -176,18 +176,26 @@ static void solo_vout_config(struct solo_dev *solo_dev)
 static int solo_dma_vin_region(struct solo_dev *solo_dev, u32 off,
   u16 val, int reg_size)
 {
-   u16 buf[64];
-   int i;
-   int ret = 0;
+   u16 *buf;
+   const int n = 64, size = n * sizeof(*buf);
+   int i, ret = 0;
+
+   if (!(buf = kmalloc(size, GFP_KERNEL)))
+   return -ENOMEM;
 
-   for (i = 0; i  sizeof(buf)  1; i++)
+   for (i = 0; i  n; i++)
buf[i] = cpu_to_le16(val);
 
-   for (i = 0; i  reg_size; i += sizeof(buf))
-   ret |= solo_p2m_dma(solo_dev, 1, buf,
-   SOLO_MOTION_EXT_ADDR(solo_dev) + off + i,
-   sizeof(buf), 0, 0);
+   for (i = 0; i  reg_size; i += size) {
+   ret = solo_p2m_dma(solo_dev, 1, buf,
+  SOLO_MOTION_EXT_ADDR(solo_dev) + off + i,
+  size, 0, 0);
+
+   if (ret)
+   break;
+   }
 
+   kfree(buf);
return ret;
 }
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] SOLO6x10: Fix video encoding on big-endian systems.

2013-09-12 Thread Krzysztof Hałasa
Signed-off-by: Krzysztof Hałasa khal...@piap.pl

diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c 
b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
index a4c5896..e501287 100644
--- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
@@ -95,38 +95,11 @@ static unsigned char vop_6110_pal_cif[] = {
0x01, 0x68, 0xce, 0x32, 0x28, 0x00, 0x00, 0x00,
 };
 
-struct vop_header {
-   /* VE_STATUS0 */
-   u32 mpeg_size:20, sad_motion_flag:1, video_motion_flag:1, vop_type:2,
-   channel:5, source_fl:1, interlace:1, progressive:1;
-
-   /* VE_STATUS1 */
-   u32 vsize:8, hsize:8, last_queue:4, nop0:8, scale:4;
-
-   /* VE_STATUS2 */
-   u32 mpeg_off;
-
-   /* VE_STATUS3 */
-   u32 jpeg_off;
-
-   /* VE_STATUS4 */
-   u32 jpeg_size:20, interval:10, nop1:2;
-
-   /* VE_STATUS5/6 */
-   u32 sec, usec;
-
-   /* VE_STATUS7/8/9 */
-   u32 nop2[3];
-
-   /* VE_STATUS10 */
-   u32 mpeg_size_alt:20, nop3:12;
-
-   u32 end_nops[5];
-} __packed;
+typedef __le32 vop_header[16];
 
 struct solo_enc_buf {
enum solo_enc_types type;
-   struct vop_header   *vh;
+   const vop_header*vh;
int motion;
 };
 
@@ -430,8 +403,64 @@ static int solo_send_desc(struct solo_enc_dev *solo_enc, 
int skip,
 solo_enc-desc_count - 1);
 }
 
+/* Extract values from VOP header - VE_STATUSxx */
+static inline int vop_interlaced(const vop_header *vh)
+{
+   return (__le32_to_cpu((*vh)[0])  30)  1;
+}
+
+static inline u8 vop_channel(const vop_header *vh)
+{
+   return (__le32_to_cpu((*vh)[0])  24)  0x1F;
+}
+
+static inline u8 vop_type(const vop_header *vh)
+{
+   return (__le32_to_cpu((*vh)[0])  22)  3;
+}
+
+static inline u32 vop_mpeg_size(const vop_header *vh)
+{
+   return __le32_to_cpu((*vh)[0])  0xF;
+}
+
+static inline u8 vop_hsize(const vop_header *vh)
+{
+   return (__le32_to_cpu((*vh)[1])  8)  0xFF;
+}
+
+static inline u8 vop_vsize(const vop_header *vh)
+{
+   return __le32_to_cpu((*vh)[1])  0xFF;
+}
+
+static inline u32 vop_mpeg_offset(const vop_header *vh)
+{
+   return __le32_to_cpu((*vh)[2]);
+}
+
+static inline u32 vop_jpeg_offset(const vop_header *vh)
+{
+   return __le32_to_cpu((*vh)[3]);
+}
+
+static inline u32 vop_jpeg_size(const vop_header *vh)
+{
+   return __le32_to_cpu((*vh)[4])  0xF;
+}
+
+static inline u32 vop_sec(const vop_header *vh)
+{
+   return __le32_to_cpu((*vh)[5]);
+}
+
+static inline u32 vop_usec(const vop_header *vh)
+{
+   return __le32_to_cpu((*vh)[6]);
+}
+
 static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
-   struct vb2_buffer *vb, struct vop_header *vh)
+ struct vb2_buffer *vb, const vop_header *vh)
 {
struct solo_dev *solo_dev = solo_enc-solo_dev;
struct vb2_dma_sg_desc *vbuf = vb2_dma_sg_plane_desc(vb, 0);
@@ -440,29 +469,30 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
 
vb-v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
 
-   if (vb2_plane_size(vb, 0)  vh-jpeg_size + solo_enc-jpeg_len)
+   if (vb2_plane_size(vb, 0)  vop_jpeg_size(vh) + solo_enc-jpeg_len)
return -EIO;
 
sg_copy_from_buffer(vbuf-sglist, vbuf-num_pages,
solo_enc-jpeg_header,
solo_enc-jpeg_len);
 
-   frame_size = (vh-jpeg_size + solo_enc-jpeg_len + (DMA_ALIGN - 1))
+   frame_size = (vop_jpeg_size(vh) + solo_enc-jpeg_len + (DMA_ALIGN - 1))
 ~(DMA_ALIGN - 1);
-   vb2_set_plane_payload(vb, 0, vh-jpeg_size + solo_enc-jpeg_len);
+   vb2_set_plane_payload(vb, 0, vop_jpeg_size(vh) + solo_enc-jpeg_len);
 
dma_map_sg(solo_dev-pdev-dev, vbuf-sglist, vbuf-num_pages,
DMA_FROM_DEVICE);
-   ret = solo_send_desc(solo_enc, solo_enc-jpeg_len, vbuf, vh-jpeg_off,
-   frame_size, SOLO_JPEG_EXT_ADDR(solo_dev),
-   SOLO_JPEG_EXT_SIZE(solo_dev));
+   ret = solo_send_desc(solo_enc, solo_enc-jpeg_len, vbuf,
+vop_jpeg_offset(vh) - SOLO_JPEG_EXT_ADDR(solo_dev),
+frame_size, SOLO_JPEG_EXT_ADDR(solo_dev),
+SOLO_JPEG_EXT_SIZE(solo_dev));
dma_unmap_sg(solo_dev-pdev-dev, vbuf-sglist, vbuf-num_pages,
DMA_FROM_DEVICE);
return ret;
 }
 
 static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
-   struct vb2_buffer *vb, struct vop_header *vh)
+   struct vb2_buffer *vb, const vop_header *vh)
 {
struct solo_dev *solo_dev = solo_enc-solo_dev;
struct vb2_dma_sg_desc *vbuf = vb2_dma_sg_plane_desc(vb, 0);
@@ -470,11 +500,11 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
int skip = 0;
int ret;
 
-   if (vb2_plane_size(vb, 0)  

[PATCH] SOLO6x10: Fix video headers on certain hardware.

2013-09-12 Thread Krzysztof Hałasa
On certain platforms a sequence of dma_map_sg() and dma_unmap_sg()
discards data previously stored in the buffers. Build video headers
only after the DMA is completed.

Signed-off-by: Krzysztof Hałasa khal...@piap.pl

diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c 
b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
index e501287..7a2fd98 100644
--- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
@@ -472,14 +472,11 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
if (vb2_plane_size(vb, 0)  vop_jpeg_size(vh) + solo_enc-jpeg_len)
return -EIO;
 
-   sg_copy_from_buffer(vbuf-sglist, vbuf-num_pages,
-   solo_enc-jpeg_header,
-   solo_enc-jpeg_len);
-
frame_size = (vop_jpeg_size(vh) + solo_enc-jpeg_len + (DMA_ALIGN - 1))
 ~(DMA_ALIGN - 1);
vb2_set_plane_payload(vb, 0, vop_jpeg_size(vh) + solo_enc-jpeg_len);
 
+   /* may discard all previous data in vbuf-sglist */
dma_map_sg(solo_dev-pdev-dev, vbuf-sglist, vbuf-num_pages,
DMA_FROM_DEVICE);
ret = solo_send_desc(solo_enc, solo_enc-jpeg_len, vbuf,
@@ -488,6 +485,11 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
 SOLO_JPEG_EXT_SIZE(solo_dev));
dma_unmap_sg(solo_dev-pdev-dev, vbuf-sglist, vbuf-num_pages,
DMA_FROM_DEVICE);
+
+   /* add the header only after dma_unmap_sg() */
+   sg_copy_from_buffer(vbuf-sglist, vbuf-num_pages,
+   solo_enc-jpeg_header, solo_enc-jpeg_len);
+
return ret;
 }
 
@@ -505,12 +507,7 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
 
/* If this is a key frame, add extra header */
if (!vop_type(vh)) {
-   sg_copy_from_buffer(vbuf-sglist, vbuf-num_pages,
-   solo_enc-vop,
-   solo_enc-vop_len);
-
skip = solo_enc-vop_len;
-
vb-v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh) + 
solo_enc-vop_len);
} else {
@@ -524,6 +521,7 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
frame_size = (vop_mpeg_size(vh) + skip + (DMA_ALIGN - 1))
 ~(DMA_ALIGN - 1);
 
+   /* may discard all previous data in vbuf-sglist */
dma_map_sg(solo_dev-pdev-dev, vbuf-sglist, vbuf-num_pages,
DMA_FROM_DEVICE);
ret = solo_send_desc(solo_enc, skip, vbuf, frame_off, frame_size,
@@ -531,6 +529,11 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
SOLO_MP4E_EXT_SIZE(solo_dev));
dma_unmap_sg(solo_dev-pdev-dev, vbuf-sglist, vbuf-num_pages,
DMA_FROM_DEVICE);
+
+   /* add the header only after dma_unmap_sg() */
+   if (!vop_type(vh))
+   sg_copy_from_buffer(vbuf-sglist, vbuf-num_pages,
+   solo_enc-vop, solo_enc-vop_len);
return ret;
 }
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/4] [media] exynos-scaler: Add core functionality for the SCALER driver

2013-09-12 Thread Shaik Ameer Basha
This patch adds the core functionality for the SCALER driver.

Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
---
 drivers/media/platform/exynos-scaler/scaler.c | 1261 +
 drivers/media/platform/exynos-scaler/scaler.h |  385 
 2 files changed, 1646 insertions(+)
 create mode 100644 drivers/media/platform/exynos-scaler/scaler.c
 create mode 100644 drivers/media/platform/exynos-scaler/scaler.h

diff --git a/drivers/media/platform/exynos-scaler/scaler.c 
b/drivers/media/platform/exynos-scaler/scaler.c
new file mode 100644
index 000..c22707c
--- /dev/null
+++ b/drivers/media/platform/exynos-scaler/scaler.c
@@ -0,0 +1,1261 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Samsung EXYNOS5 SoC series SCALER driver
+ *
+ * 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/clk.h
+#include linux/interrupt.h
+#include linux/module.h
+#include linux/of_platform.h
+#include linux/pm_runtime.h
+
+#include scaler-regs.h
+
+#define SCALER_CLOCK_GATE_NAME scaler
+
+static const struct scaler_fmt scaler_formats[] = {
+   {
+   .name   = YUV 4:2:0 non-contig. 2p, Y/CbCr,
+   .pixelformat= V4L2_PIX_FMT_NV12M,
+   .depth  = { 8, 4 },
+   .color  = SCALER_YUV420,
+   .color_order= SCALER_CBCR,
+   .num_planes = 2,
+   .num_comp   = 2,
+   .scaler_color   = SCALER_YUV420_2P_Y_UV,
+   .flags  = (SCALER_FMT_SRC | SCALER_FMT_DST),
+
+   }, {
+   .name   = YUV 4:2:0 contig. 2p, Y/CbCr,
+   .pixelformat= V4L2_PIX_FMT_NV12,
+   .depth  = { 12 },
+   .color  = SCALER_YUV420,
+   .color_order= SCALER_CBCR,
+   .num_planes = 1,
+   .num_comp   = 2,
+   .scaler_color   = SCALER_YUV420_2P_Y_UV,
+   .flags  = (SCALER_FMT_SRC | SCALER_FMT_DST),
+   }, {
+   .name   = YUV 4:2:0 n.c. 2p, Y/CbCr tiled,
+   .pixelformat= V4L2_PIX_FMT_NV12MT_16X16,
+   .depth  = { 8, 4 },
+   .color  = SCALER_YUV420,
+   .color_order= SCALER_CBCR,
+   .num_planes = 2,
+   .num_comp   = 2,
+   .scaler_color   = SCALER_YUV420_2P_Y_UV,
+   .flags  = (SCALER_FMT_SRC | SCALER_FMT_TILED),
+   }, {
+   .name   = YUV 4:2:2 contig. 2p, Y/CbCr,
+   .pixelformat= V4L2_PIX_FMT_NV16,
+   .depth  = { 16 },
+   .color  = SCALER_YUV422,
+   .color_order= SCALER_CBCR,
+   .num_planes = 1,
+   .num_comp   = 2,
+   .scaler_color   = SCALER_YUV422_2P_Y_UV,
+   .flags  = (SCALER_FMT_SRC | SCALER_FMT_DST),
+   }, {
+   .name   = YUV 4:4:4 contig. 2p, Y/CbCr,
+   .pixelformat= V4L2_PIX_FMT_NV24,
+   .depth  = { 24 },
+   .color  = SCALER_YUV444,
+   .color_order= SCALER_CBCR,
+   .num_planes = 1,
+   .num_comp   = 2,
+   .scaler_color   = SCALER_YUV444_2P_Y_UV,
+   .flags  = (SCALER_FMT_SRC | SCALER_FMT_DST),
+   }, {
+   .name   = RGB565,
+   .pixelformat= V4L2_PIX_FMT_RGB565X,
+   .depth  = { 16 },
+   .color  = SCALER_RGB,
+   .num_planes = 1,
+   .num_comp   = 1,
+   .scaler_color   = SCALER_RGB565,
+   .flags  = (SCALER_FMT_SRC | SCALER_FMT_DST),
+   }, {
+   .name   = XRGB-1555, 16 bpp,
+   .pixelformat= V4L2_PIX_FMT_RGB555,
+   .depth  = { 16 },
+   .color  = SCALER_RGB,
+   .num_planes = 1,
+   .num_comp   = 1,
+   .scaler_color   = SCALER_ARGB1555,
+   .flags  = (SCALER_FMT_SRC | SCALER_FMT_DST),
+   }, {
+   .name   = XRGB-, 32 bpp,
+   .pixelformat= V4L2_PIX_FMT_RGB32,
+   .depth  = { 32 },
+   .color  = SCALER_RGB,
+   .num_planes = 1,
+   .num_comp   = 1,
+   .scaler_color   = SCALER_ARGB,
+   .flags  = (SCALER_FMT_SRC | SCALER_FMT_DST),
+   }, {
+   .name   = YUV 4:2:2 packed, YCrYCb,
+   .pixelformat= V4L2_PIX_FMT_YVYU,
+   .depth  = { 16 

[PATCH v3 4/4] [media] exynos-scaler: Add DT bindings for SCALER driver

2013-09-12 Thread Shaik Ameer Basha
This patch adds the DT binding documentation for the
Exynos5420/5410 based SCALER device driver.

Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
---
 .../devicetree/bindings/media/exynos5-scaler.txt   |   22 
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/exynos5-scaler.txt

diff --git a/Documentation/devicetree/bindings/media/exynos5-scaler.txt 
b/Documentation/devicetree/bindings/media/exynos5-scaler.txt
new file mode 100644
index 000..f620baf
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/exynos5-scaler.txt
@@ -0,0 +1,22 @@
+* Samsung Exynos5 SCALER device
+
+SCALER is used for scaling, blending, color fill and color space
+conversion on EXYNOS[5420/5410] SoCs.
+
+Required properties:
+- compatible: should be samsung,exynos5420-scaler or
+   samsung,exynos5410-scaler
+- reg: should contain SCALER physical address location and length.
+- interrupts: should contain SCALER interrupt number
+- clocks: should contain the SCALER clock specifier, from the
+   common clock bindings
+- clock-names: should be scaler
+
+Example:
+   scaler_0: scaler@0x1280 {
+   compatible = samsung,exynos5420-scaler;
+   reg = 0x1280 0x1000;
+   interrupts = 0 220 0;
+   clocks = clock 381;
+   clock-names = scaler;
+   };
-- 
1.7.9.5

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


[PATCH v3 3/4] [media] exynos-scaler: Add m2m functionality for the SCALER driver

2013-09-12 Thread Shaik Ameer Basha
This patch adds the Makefile and memory to memory (m2m) interface
functionality for the SCALER driver.

Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
---
 drivers/media/platform/Kconfig|8 +
 drivers/media/platform/Makefile   |1 +
 drivers/media/platform/exynos-scaler/Makefile |3 +
 drivers/media/platform/exynos-scaler/scaler-m2m.c |  781 +
 4 files changed, 793 insertions(+)
 create mode 100644 drivers/media/platform/exynos-scaler/Makefile
 create mode 100644 drivers/media/platform/exynos-scaler/scaler-m2m.c

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 8068d7b..339d3ba 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -201,6 +201,14 @@ config VIDEO_SAMSUNG_EXYNOS_GSC
help
  This is a v4l2 driver for Samsung EXYNOS5 SoC G-Scaler.
 
+config VIDEO_SAMSUNG_EXYNOS_SCALER
+   tristate Samsung Exynos SCALER driver
+   depends on OF  VIDEO_DEV  VIDEO_V4L2  ARCH_EXYNOS5
+   select VIDEOBUF2_DMA_CONTIG
+   select V4L2_MEM2MEM_DEV
+   help
+ This is a v4l2 driver for Samsung EXYNOS5410/5420 SoC SCALER.
+
 config VIDEO_SH_VEU
tristate SuperH VEU mem2mem video processing driver
depends on VIDEO_DEV  VIDEO_V4L2  GENERIC_HARDIRQS  HAS_DMA
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 4e4da48..14cdad5 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_TV)+= s5p-tv/
 
 obj-$(CONFIG_VIDEO_SAMSUNG_S5P_G2D)+= s5p-g2d/
 obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC) += exynos-gsc/
+obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS_SCALER)  += exynos-scaler/
 
 obj-$(CONFIG_BLACKFIN)  += blackfin/
 
diff --git a/drivers/media/platform/exynos-scaler/Makefile 
b/drivers/media/platform/exynos-scaler/Makefile
new file mode 100644
index 000..6c8a25b
--- /dev/null
+++ b/drivers/media/platform/exynos-scaler/Makefile
@@ -0,0 +1,3 @@
+exynos-scaler-objs := scaler.o scaler-m2m.o scaler-regs.o
+
+obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS_SCALER)  += exynos-scaler.o
diff --git a/drivers/media/platform/exynos-scaler/scaler-m2m.c 
b/drivers/media/platform/exynos-scaler/scaler-m2m.c
new file mode 100644
index 000..eb32f2f
--- /dev/null
+++ b/drivers/media/platform/exynos-scaler/scaler-m2m.c
@@ -0,0 +1,781 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Samsung EXYNOS5 SoC series SCALER driver
+ *
+ * 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/module.h
+#include linux/pm_runtime.h
+
+#include media/v4l2-ioctl.h
+
+#include scaler-regs.h
+
+#define SCALER_DEF_PIX_FMT V4L2_PIX_FMT_RGB32
+#define SCALER_DEF_WIDTH   1280
+#define SCALER_DEF_HEIGHT  720
+
+static int scaler_m2m_ctx_stop_req(struct scaler_ctx *ctx)
+{
+   struct scaler_ctx *curr_ctx;
+   struct scaler_dev *scaler = ctx-scaler_dev;
+   int ret;
+
+   curr_ctx = v4l2_m2m_get_curr_priv(scaler-m2m.m2m_dev);
+   if (!scaler_m2m_pending(scaler) || (curr_ctx != ctx))
+   return 0;
+
+   scaler_ctx_state_lock_set(SCALER_CTX_STOP_REQ, ctx);
+   ret = wait_event_timeout(scaler-irq_queue,
+   !scaler_ctx_state_is_set(SCALER_CTX_STOP_REQ, ctx),
+   SCALER_SHUTDOWN_TIMEOUT);
+
+   return ret == 0 ? -ETIMEDOUT : ret;
+}
+
+static int scaler_m2m_start_streaming(struct vb2_queue *q, unsigned int count)
+{
+   struct scaler_ctx *ctx = q-drv_priv;
+   int ret;
+
+   ret = pm_runtime_get_sync(ctx-scaler_dev-pdev-dev);
+
+   return ret  0 ? 0 : ret;
+}
+
+static int scaler_m2m_stop_streaming(struct vb2_queue *q)
+{
+   struct scaler_ctx *ctx = q-drv_priv;
+   int ret;
+
+   ret = scaler_m2m_ctx_stop_req(ctx);
+   if (ret  0)
+   scaler_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR);
+
+   pm_runtime_put(ctx-scaler_dev-pdev-dev);
+
+   return 0;
+}
+
+void scaler_m2m_job_finish(struct scaler_ctx *ctx, int vb_state)
+{
+   struct vb2_buffer *src_vb, *dst_vb;
+
+   if (!ctx || !ctx-m2m_ctx)
+   return;
+
+   src_vb = v4l2_m2m_src_buf_remove(ctx-m2m_ctx);
+   dst_vb = v4l2_m2m_dst_buf_remove(ctx-m2m_ctx);
+
+   if (src_vb  dst_vb) {
+   v4l2_m2m_buf_done(src_vb, vb_state);
+   v4l2_m2m_buf_done(dst_vb, vb_state);
+
+   v4l2_m2m_job_finish(ctx-scaler_dev-m2m.m2m_dev,
+   ctx-m2m_ctx);
+   }
+}
+
+static void scaler_m2m_job_abort(void *priv)
+{
+   struct scaler_ctx *ctx = priv;
+   int ret;
+
+   ret = scaler_m2m_ctx_stop_req(ctx);
+   if (ret  0)
+   

[PATCH v3 1/4] [media] exynos-scaler: Add new driver for Exynos5 SCALER

2013-09-12 Thread Shaik Ameer Basha
This patch adds support for SCALER device which is a new device
for scaling, blending, color fill  and color space conversion
on EXYNOS5410 and EXYNOS5420 SoCs.

This device supports the followings as key feature.
input image format
- YCbCr420 2P(UV/VU), 3P
- YCbCr422 1P(YUYV/UYVY/YVYU), 2P(UV,VU), 3P
- YCbCr444 2P(UV,VU), 3P
- RGB565, ARGB1555, ARGB, ARGB, RGBA
- Pre-multiplexed ARGB, L8A8 and L8
output image format
- YCbCr420 2P(UV/VU), 3P
- YCbCr422 1P(YUYV/UYVY/YVYU), 2P(UV,VU), 3P
- YCbCr444 2P(UV,VU), 3P
- RGB565, ARGB1555, ARGB, ARGB, RGBA
- Pre-multiplexed ARGB
input rotation
- 0/90/180/270 degree, X/Y/XY Flip
scale ratio
- 1/4 scale down to 16 scale up
color space conversion
- RGB to YUV / YUV to RGB
Size - Exynos5420
- Input : 16x16 to 8192x8192
- Output:   4x4 to 8192x8192
Size - Exynos5410
- Input/Output: 4x4 to 4096x4096
alpha blending, color fill

Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
---
 drivers/media/platform/exynos-scaler/scaler-regs.c |  334 
 drivers/media/platform/exynos-scaler/scaler-regs.h |  331 +++
 2 files changed, 665 insertions(+)
 create mode 100644 drivers/media/platform/exynos-scaler/scaler-regs.c
 create mode 100644 drivers/media/platform/exynos-scaler/scaler-regs.h

diff --git a/drivers/media/platform/exynos-scaler/scaler-regs.c 
b/drivers/media/platform/exynos-scaler/scaler-regs.c
new file mode 100644
index 000..6c488ce
--- /dev/null
+++ b/drivers/media/platform/exynos-scaler/scaler-regs.c
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Samsung EXYNOS5 SoC series SCALER driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/delay.h
+#include linux/platform_device.h
+
+#include scaler-regs.h
+
+/* Scaler reset timeout in milliseconds */
+#define SCALER_RESET_TIMEOUT   50
+
+void scaler_hw_set_sw_reset(struct scaler_dev *dev)
+{
+   u32 cfg;
+
+   cfg = scaler_read(dev, SCALER_CFG);
+   cfg |= SCALER_CFG_SOFT_RESET;
+
+   scaler_write(dev, SCALER_CFG, cfg);
+}
+
+int scaler_wait_reset(struct scaler_dev *dev)
+{
+   unsigned long end = jiffies + msecs_to_jiffies(SCALER_RESET_TIMEOUT);
+   u32 cfg, reset_done = 0;
+
+   while (time_before(jiffies, end)) {
+   cfg = scaler_read(dev, SCALER_CFG);
+   if (!(cfg  SCALER_CFG_SOFT_RESET)) {
+   reset_done = 1;
+   break;
+   }
+   usleep_range(10, 20);
+   }
+
+   /*
+* Write any value to read/write register and read it back.
+* If the written and read value matches, then the reset process is
+* succeeded.
+*/
+   while (reset_done) {
+
+   /*
+* [TODO] need to define number of tries before returning
+* -EBUSY to the caller
+*/
+
+   scaler_write(dev, SCALER_CFG_SOFT_RESET_CHECK_REG,
+   SCALER_CFG_SOFT_RESET_CHECK_VAL);
+   if (SCALER_CFG_SOFT_RESET_CHECK_VAL ==
+   scaler_read(dev, SCALER_CFG_SOFT_RESET_CHECK_REG))
+   return 0;
+   }
+
+   return -EBUSY;
+}
+
+void scaler_hw_set_irq(struct scaler_dev *dev, int irq_num, bool enable)
+{
+   u32 cfg;
+
+   if ((irq_num  SCALER_INT_FRAME_END) ||
+   (irq_num  SCALER_INT_TIMEOUT))
+   return;
+
+   cfg = scaler_read(dev, SCALER_INT_EN);
+   if (enable)
+   cfg |= (1  irq_num);
+   else
+   cfg = ~(1  irq_num);
+   scaler_write(dev, SCALER_INT_EN, cfg);
+}
+
+void scaler_hw_set_input_addr(struct scaler_dev *dev, struct scaler_addr *addr)
+{
+   scaler_dbg(dev, src_buf: 0x%x, cb: 0x%x, cr: 0x%x,
+   addr-y, addr-cb, addr-cr);
+   scaler_write(dev, SCALER_SRC_Y_BASE, addr-y);
+   scaler_write(dev, SCALER_SRC_CB_BASE, addr-cb);
+   scaler_write(dev, SCALER_SRC_CR_BASE, addr-cr);
+}
+
+void scaler_hw_set_output_addr(struct scaler_dev *dev,
+struct scaler_addr *addr)
+{
+   scaler_dbg(dev, dst_buf: 0x%x, cb: 0x%x, cr: 0x%x,
+   addr-y, addr-cb, addr-cr);
+   scaler_write(dev, SCALER_DST_Y_BASE, addr-y);
+   scaler_write(dev, SCALER_DST_CB_BASE, addr-cb);
+   scaler_write(dev, SCALER_DST_CR_BASE, addr-cr);
+}
+
+void scaler_hw_set_in_size(struct scaler_ctx *ctx)
+{
+   struct scaler_dev *dev = ctx-scaler_dev;
+   struct scaler_frame *frame = ctx-s_frame;
+   u32 cfg;
+
+   /* set input pixel offset */
+  

[media] siano: fix divide error on 0 counters

2013-09-12 Thread Mauro Carvalho Chehab
From: Bjørn Mork bj...@mork.no

I took a quick look at the code and wonder if the problem is caused by
an initial zero statistics message?  This is all just a wild guess, but
if it is correct, then the attached untested patch might fix it...
Bjørn
From d78a0599d5b5d4da384eae08bf7da316389dfbe5 Mon Sep 17 00:00:00 2001
ts_packets and ets_packets counters can be 0.  Don't fall over
if they are. Fixes:
[  846.851711] divide error:  [#1] SMP
[  846.851806] Modules linked in: smsdvb dvb_core ir_lirc_codec lirc_dev 
ir_sanyo_decoder ir_mce_kbd_decoder ir_sony_decoder ir_jvc_decoder 
ir_rc6_decoder ir_rc5_decoder ir_nec_decoder rc_hauppauge smsusb smsmdtv 
rc_core pci_stub vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) parport_pc 
ppdev lp parport cpufreq_userspace cpufreq_powersave cpufreq_stats 
cpufreq_conservative rfcomm bnep binfmt_misc uinput nfsd auth_rpcgss 
oid_registry nfs_acl nfs lockd dns_resolver fscache sunrpc ext4 jbd2 fuse 
tp_smapi(O) thinkpad_ec(O) loop firewire_sbp2 dm_crypt snd_hda_codec_conexant 
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm 
thinkpad_acpi nvram snd_page_alloc hid_generic snd_seq_midi snd_seq_midi_event 
arc4 usbhid snd_rawmidi uvcvideo hid iwldvm coretemp kvm_intel mac8021
 1 cdc_wdm
[  846.853477]  cdc_acm snd_seq videobuf2_vmalloc videobuf2_memops 
videobuf2_core videodev media kvm radeon r852 ttm joydev cdc_ether usbnet 
pcmcia mii sm_common nand btusb drm_kms_helper tpm_tis acpi_cpufreq bluetooth 
iwlwifi nand_ecc drm nand_ids i2c_i801 mtd snd_seq_device iTCO_wdt 
iTCO_vendor_support r592 memstick lpc_ich mperf tpm yenta_socket pcmcia_rsrc 
pcmcia_core cfg80211 snd_timer snd pcspkr i2c_algo_bit crc16 i2c_core tpm_bios 
processor mfd_core wmi psmouse mei_me rfkill mei serio_raw soundcore evdev 
battery button video ac microcode ext3 mbcache jbd md_mod dm_mirror 
dm_region_hash dm_log dm_mod sg sr_mod sd_mod cdrom crc_t10dif firewire_ohci 
sdhci_pci sdhci mmc_core firewire_core crc_itu_t thermal thermal_sys ahci 
libahci ehci_pci uhci_hcd ehci_hcd libata scsi_mod usbcore e1000
 e usb_common
[  846.855310]  ptp pps_core
[  846.855356] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G   O 
3.10-2-amd64 #1 Debian 3.10.5-1
[  846.855490] Hardware name: LENOVO 4061WFA/4061WFA, BIOS 6FET92WW (3.22 ) 
12/14/2011
[  846.855609] task: 81613400 ti: 8160 task.ti: 
8160
[  846.855636] RIP: 0010:[a092be0c]  [a092be0c] 
smsdvb_onresponse+0x264/0xa86 [smsdvb]
[  846.863906] RSP: 0018:88013bc03cf0  EFLAGS: 00010046
[  846.863906] RAX:  RBX: 880133bf6000 RCX: 
[  846.863906] RDX:  RSI: 88005d3b58c0 RDI: 880133bf6000
[  846.863906] RBP: 88005d1da000 R08: 0058 R09: 0015
[  846.863906] R10: 1a0d R11: 021a R12: 88005d3b58c0
[  846.863906] R13: 88005d1da008 R14: ff8d R15: 880036cf5060
[  846.863906] FS:  () GS:88013bc0() 
knlGS:
[  846.863906] CS:  0010 DS:  ES:  CR0: 8005003b
[  846.863906] CR2: 7f3a4b69ae50 CR3: 36dac000 CR4: 000407f0
[  846.863906] DR0:  DR1:  DR2: 
[  846.863906] DR3:  DR6: 0ff0 DR7: 0400
[  846.863906] Stack:
[  846.863906]  88007a102000 88005d1da000 88005d3b58c0 
00085824
[  846.863906]  a08c5aa3 88005d1da000 8800a6907390 
8800a69073b0
[  846.863906]  8800a6907000 a08b642c 021a 
8800a69073b0
[  846.863906] Call Trace:
[  846.863906]  IRQ
[  846.863906]
[  846.863906]  [a08c5aa3] ? smscore_onresponse+0x1d5/0x353 [smsmdtv]
[  846.863906]  [a08b642c] ? smsusb_onresponse+0x146/0x192 [smsusb]
[  846.863906]  [a004cb1a] ? usb_hcd_giveback_urb+0x6c/0xac [usbcore]
[  846.863906]  [a0217be1] ? ehci_urb_done+0x62/0x72 [ehci_hcd]
[  846.863906]  [a0217c82] ? qh_completions+0x91/0x364 [ehci_hcd]
[  846.863906]  [a0219bba] ? ehci_work+0x8a/0x68e [ehci_hcd]
[  846.863906]  [8107336c] ? timekeeping_get_ns.constprop.10+0xd/0x31
[  846.863906]  [81064d41] ? update_cfs_rq_blocked_load+0xde/0xec
[  846.863906]  [81058ec2] ? run_posix_cpu_timers+0x25/0x575
[  846.863906]  [a021aa46] ? ehci_irq+0x211/0x23d [ehci_hcd]
[  846.863906]  [a004c0c1] ? usb_hcd_irq+0x31/0x48 [usbcore]
[  846.863906]  [810996fd] ? handle_irq_event_percpu+0x49/0x1a4
[  846.863906]  [8109988a] ? handle_irq_event+0x32/0x4b
[  846.863906]  [8109bd76] ? handle_fasteoi_irq+0x80/0xb6
[  846.863906]  [8100e93e] ? handle_irq+0x18/0x20
[  846.863906]  [8100e657] ? do_IRQ+0x40/0x95
[  846.863906]  [813883ed] ? common_interrupt+0x6d/0x6d
[  846.863906]  EOI
[  846.863906]
[  846.863906]  [812a011c] ? arch_local_irq_enable+0x4/0x8
[  

[PATCH] RFCv2: Support for multiple selections

2013-09-12 Thread Ricardo Ribalda Delgado
Extend v4l2 selection API to support multiple selection areas, this way
sensors that support multiple readout areas can work with multiple areas
of insterest.

The struct v4l2_selection and v4l2_subdev_selection has been extented
with a new field rectangles. If it is value is different than zero the
pr array is used instead of the r field.

A new structure v4l2_ext_rect has been defined, containing 4 reserved
fields for future improvements, as suggested by Hans.

Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 54 +++-
 include/uapi/linux/v4l2-subdev.h | 10 +--
 include/uapi/linux/videodev2.h   | 15 --
 3 files changed, 68 insertions(+), 11 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 68e6b5e..91d21a4 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -572,11 +572,22 @@ static void v4l_print_crop(const void *arg, bool 
write_only)
 static void v4l_print_selection(const void *arg, bool write_only)
 {
const struct v4l2_selection *p = arg;
+   int i;
 
-   pr_cont(type=%s, target=%d, flags=0x%x, wxh=%dx%d, x,y=%d,%d\n,
-   prt_names(p-type, v4l2_type_names),
-   p-target, p-flags,
-   p-r.width, p-r.height, p-r.left, p-r.top);
+   if (p-rectangles==0)
+   pr_cont(type=%s, target=%d, flags=0x%x, wxh=%dx%d
+   , x,y=%d,%d\n,
+   prt_names(p-type, v4l2_type_names),
+   p-target, p-flags,
+   p-r.width, p-r.height, p-r.left, p-r.top);
+   else{
+   pr_cont(type=%s, target=%d, flags=0x%x\n,
+   prt_names(p-type, v4l2_type_names),
+   p-target, p-flags);
+   for (i=0; ip-rectangles;i++)
+   pr_cont(rectangle %d: wxh=%dx%d, x,y=%d,%d\n,
+   i, p-r.width, p-r.height, p-r.left, 
p-r.top);
+   }
 }
 
 static void v4l_print_jpegcompression(const void *arg, bool write_only)
@@ -1645,6 +1656,7 @@ static int v4l_g_crop(const struct v4l2_ioctl_ops *ops,
struct v4l2_crop *p = arg;
struct v4l2_selection s = {
.type = p-type,
+   .rectangles = 0,
};
int ret;
 
@@ -1673,6 +1685,7 @@ static int v4l_s_crop(const struct v4l2_ioctl_ops *ops,
struct v4l2_selection s = {
.type = p-type,
.r = p-c,
+   .rectangles = 0,
};
 
if (ops-vidioc_s_crop)
@@ -1692,7 +1705,10 @@ static int v4l_cropcap(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
struct v4l2_cropcap *p = arg;
-   struct v4l2_selection s = { .type = p-type };
+   struct v4l2_selection s = {
+   .type = p-type,
+   .rectangles = 0,
+   };
int ret;
 
if (ops-vidioc_cropcap)
@@ -1726,6 +1742,30 @@ static int v4l_cropcap(const struct v4l2_ioctl_ops *ops,
return 0;
 }
 
+static int v4l_s_selection(const struct v4l2_ioctl_ops *ops,
+   struct file *file, void *fh, void *arg)
+{
+   struct v4l2_selection *s = arg;
+
+   if (s-rectangles 
+   !access_ok(VERIFY_READ, s-pr, s-rectangles * sizeof(*s-pr)))
+   return -EFAULT;
+
+   return ops-vidioc_s_selection(file, fh, s);
+}
+
+static int v4l_g_selection(const struct v4l2_ioctl_ops *ops,
+   struct file *file, void *fh, void *arg)
+{
+   struct v4l2_selection *s = arg;
+
+   if (s-rectangles 
+   !access_ok(VERIFY_WRITE, s-pr, s-rectangles * sizeof(*s-pr)))
+   return -EFAULT;
+
+   return ops-vidioc_g_selection(file, fh, s);
+}
+
 static int v4l_log_status(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
@@ -2018,8 +2058,8 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO_FNC(VIDIOC_CROPCAP, v4l_cropcap, v4l_print_cropcap, 
INFO_FL_CLEAR(v4l2_cropcap, type)),
IOCTL_INFO_FNC(VIDIOC_G_CROP, v4l_g_crop, v4l_print_crop, 
INFO_FL_CLEAR(v4l2_crop, type)),
IOCTL_INFO_FNC(VIDIOC_S_CROP, v4l_s_crop, v4l_print_crop, INFO_FL_PRIO),
-   IOCTL_INFO_STD(VIDIOC_G_SELECTION, vidioc_g_selection, 
v4l_print_selection, 0),
-   IOCTL_INFO_STD(VIDIOC_S_SELECTION, vidioc_s_selection, 
v4l_print_selection, INFO_FL_PRIO),
+   IOCTL_INFO_FNC(VIDIOC_G_SELECTION, v4l_g_selection, 
v4l_print_selection, 0),
+   IOCTL_INFO_FNC(VIDIOC_S_SELECTION, v4l_s_selection, 
v4l_print_selection, INFO_FL_PRIO),
IOCTL_INFO_STD(VIDIOC_G_JPEGCOMP, vidioc_g_jpegcomp, 
v4l_print_jpegcompression, 0),
IOCTL_INFO_STD(VIDIOC_S_JPEGCOMP, vidioc_s_jpegcomp, 
v4l_print_jpegcompression, INFO_FL_PRIO),

Re: [PATCH] RFC: Support for multiple selections

2013-09-12 Thread Ricardo Ribalda Delgado
Hi Hans

On Wed, Sep 11, 2013 at 3:02 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Ricardo,

 On 09/11/2013 02:13 PM, Ricardo Ribalda Delgado wrote:
 Hello Hans

 On Wed, Sep 11, 2013 at 12:49 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Ricardo,

 On 09/11/2013 11:34 AM, Ricardo Ribalda Delgado wrote:
 Hi Hans

 Thanks for your feedback

 On Wed, Sep 11, 2013 at 11:04 AM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Ricardo,

 On 09/11/2013 10:30 AM, Ricardo Ribalda Delgado wrote:
 A new id field is added to the struct selection. On devices that
 supports multiple sections this id indicate which of the selection to
 modify.

 A new control V4L2_CID_SELECTION_BITMASK selects which of the selections
 are used, if the control is set to zero the default rectangles are used.

 This is needed in cases where the user has to change multiple selections
 at the same time to get a valid combination.

 On devices where the control V4L2_CID_SELECTION_BITMASK does not exist,
 the id field is ignored

 This feels like a hack to me. A big problem I have with using a control 
 here
 is that with a control you can't specify for which selection target it is.


 I am not sure that I understand what you mean here.

 If you set the control to 0x1 you are using selection 0, if you set
 the control to 0x5, you are using selection 0 and 2.

 If you look here:

 http://hverkuil.home.xs4all.nl/spec/media.html#v4l2-selection-targets

 you see that a selection has a 'target': i.e. does the selection define a 
 crop
 rectangle, a compose rectange, a default crop rectangle, etc.

 You are extending the API to support multiple rectangles per target and 
 using
 a control to select which rectangles are active (if I understand correctly).
 But that control does not (and cannot) specify for which target the 
 rectangles
 should be activated.

 I want to have N crop rectangles and N compose rectangles. Every crop
 rectangle has associated one compose rectangle.

 This will fit multiple purposes ie:

 - swap two areas of an image,
 - multiple readout zones
 - different decimation per area





 If you want to set multiple rectangles, why not just pass them directly? 
 E.g.:

 struct v4l2_selection {
 __u32   type;
 __u32   target;
 __u32   flags;
 union {
 struct v4l2_rectr;
 struct v4l2_rect*pr;
 };
 __u32   rectangles;
 __u32   reserved[8];
 };

 If rectangles  1, then pr is used.


 The structure is passed in a ioctl and I dont think that it is a good
 idea that you let the kernel get/set a memory address not encapsulated
 in it. I can see that it could lead to security breaches if there is a
 mistake on the handling.

 It's used in lots of places. It's OK, provided you check the memory 
 carefully.
 See e.g. how VIDIOC_G/S_EXT_CTRLS is handled. Usually the memory checks are 
 done
 in the v4l2 core and the driver doesn't need to take care of it.


 I agree IFF the v4l2 core does the checks. One question raises me: how
 does the user knows how big is the structure he has to allocate for
 g_selection? Do we have to make a new ioctl g_n_selections?

 I would suggest using the same method that is used by the extended control 
 API for
 string controls: if rectangles is too small, then the driver sets the field 
 to the
 total number of rectangles and returns -ENOSPC. The application can then 
 reallocate
 the memory. I expect that applications that want to do this will actually 
 know how
 many rectangles to allocate.


That seems fine for me.


 It's a bit more work to add this to the core code 
 (VIDIOC_SUBDEV_G/S_SELECTION
 should probably be changed at the same time and you have to fix existing 
 drivers
 to check/set the new rectangles field), but it scales much better.

 Also, we would be broking the ABI. Rectangles is not a mandatory
 field, and has a value != 0.

 The spec clearly states that:

 The flags and reserved fields of struct v4l2_selection are ignored and 
 they must
  be filled with zeros.

 Any app not doing that is not obeying the API and hence it is an 
 application bug.

 It's standard practice inside the V4L2 API to handle reserved fields in 
 that way,
 as it provides a mechanism to extend the API safely in the future.


 That is what I mean, the current programs are writing a 0 on that
 field, but now they are required to write a 1, so the API is broken.
 Maybe we should describe:
 if rectangles is 0, the field r is used (legacy), otherwise the pr,
 even for 1 (multi rectangle).

 That's actually what I meant: if rectangles is 0, it will be interpreted as 1.
 Sorry if I wasn't clear.



 What we could do is leave the V4L2_CID_SELECTION_BITMASK  out of the
 api, but keep the id field on the structure, so the user can define a
 private control to do whatever he needs with the id field, wekeep the
 ABI compatibility and no big 

Re: [PATCH -next] staging/media: fix msi3101 build errors

2013-09-12 Thread Mauro Carvalho Chehab
Em Thu, 12 Sep 2013 21:01:51 +0300
Antti Palosaari cr...@iki.fi escreveu:

 Hello Randy,
 It is already fixed, waiting for Mauro's processing.
 https://patchwork.kernel.org/patch/2856771/

Ok. I'll handle the patches after the release of -rc1.

Regards,
Mauro

 
 regards
 Antti
 
 On 09/12/2013 08:42 PM, Randy Dunlap wrote:
  From: Randy Dunlap rdun...@infradead.org
 
  Fix build error when VIDEOBUF2_CORE=m and USB_MSI3101=y.
 
  drivers/built-in.o: In function `msi3101_buf_queue':
  sdr-msi3101.c:(.text+0x1298d6): undefined reference to `vb2_buffer_done'
  drivers/built-in.o: In function `msi3101_cleanup_queued_bufs':
  sdr-msi3101.c:(.text+0x1299c7): undefined reference to `vb2_buffer_done'
  drivers/built-in.o: In function `msi3101_isoc_handler':
  sdr-msi3101.c:(.text+0x12a08d): undefined reference to `vb2_plane_vaddr'
  sdr-msi3101.c:(.text+0x12a0b9): undefined reference to `vb2_buffer_done'
  drivers/built-in.o: In function `msi3101_probe':
  sdr-msi3101.c:(.text+0x12a1c5): undefined reference to `vb2_vmalloc_memops'
  sdr-msi3101.c:(.text+0x12a1d7): undefined reference to `vb2_queue_init'
  drivers/built-in.o:(.rodata+0x34cf0): undefined reference to 
  `vb2_ioctl_reqbufs'
  drivers/built-in.o:(.rodata+0x34cf4): undefined reference to 
  `vb2_ioctl_querybuf'
  drivers/built-in.o:(.rodata+0x34cf8): undefined reference to 
  `vb2_ioctl_qbuf'
  drivers/built-in.o:(.rodata+0x34d00): undefined reference to 
  `vb2_ioctl_dqbuf'
  drivers/built-in.o:(.rodata+0x34d04): undefined reference to 
  `vb2_ioctl_create_bufs'
  drivers/built-in.o:(.rodata+0x34d08): undefined reference to 
  `vb2_ioctl_prepare_buf'
  drivers/built-in.o:(.rodata+0x34d18): undefined reference to 
  `vb2_ioctl_streamon'
  drivers/built-in.o:(.rodata+0x34d1c): undefined reference to 
  `vb2_ioctl_streamoff'
  drivers/built-in.o:(.rodata+0x35580): undefined reference to `vb2_fop_read'
  drivers/built-in.o:(.rodata+0x35588): undefined reference to `vb2_fop_poll'
  drivers/built-in.o:(.rodata+0x35598): undefined reference to `vb2_fop_mmap'
  drivers/built-in.o:(.rodata+0x355a0): undefined reference to 
  `vb2_fop_release'
  drivers/built-in.o:(.data+0x23b40): undefined reference to 
  `vb2_ops_wait_prepare'
  drivers/built-in.o:(.data+0x23b44): undefined reference to 
  `vb2_ops_wait_finish'
 
  Signed-off-by: Randy Dunlap rdun...@infradead.org
  Cc: Antti Palosaari cr...@iki.fi
  ---
drivers/staging/media/msi3101/Kconfig |2 ++
1 file changed, 2 insertions(+)
 
  --- linux-next-20130912.orig/drivers/staging/media/msi3101/Kconfig
  +++ linux-next-20130912/drivers/staging/media/msi3101/Kconfig
  @@ -1,3 +1,5 @@
config USB_MSI3101
  tristate Mirics MSi3101 SDR Dongle
  depends on USB  VIDEO_DEV  VIDEO_V4L2
  +   select VIDEOBUF2_CORE
  +   select VIDEOBUF2_VMALLOC
 
 
 


-- 

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


Re: [PATCH -next] staging/media: fix msi3101 build errors

2013-09-12 Thread Antti Palosaari

Hello Randy,
It is already fixed, waiting for Mauro's processing.
https://patchwork.kernel.org/patch/2856771/

regards
Antti

On 09/12/2013 08:42 PM, Randy Dunlap wrote:

From: Randy Dunlap rdun...@infradead.org

Fix build error when VIDEOBUF2_CORE=m and USB_MSI3101=y.

drivers/built-in.o: In function `msi3101_buf_queue':
sdr-msi3101.c:(.text+0x1298d6): undefined reference to `vb2_buffer_done'
drivers/built-in.o: In function `msi3101_cleanup_queued_bufs':
sdr-msi3101.c:(.text+0x1299c7): undefined reference to `vb2_buffer_done'
drivers/built-in.o: In function `msi3101_isoc_handler':
sdr-msi3101.c:(.text+0x12a08d): undefined reference to `vb2_plane_vaddr'
sdr-msi3101.c:(.text+0x12a0b9): undefined reference to `vb2_buffer_done'
drivers/built-in.o: In function `msi3101_probe':
sdr-msi3101.c:(.text+0x12a1c5): undefined reference to `vb2_vmalloc_memops'
sdr-msi3101.c:(.text+0x12a1d7): undefined reference to `vb2_queue_init'
drivers/built-in.o:(.rodata+0x34cf0): undefined reference to `vb2_ioctl_reqbufs'
drivers/built-in.o:(.rodata+0x34cf4): undefined reference to 
`vb2_ioctl_querybuf'
drivers/built-in.o:(.rodata+0x34cf8): undefined reference to `vb2_ioctl_qbuf'
drivers/built-in.o:(.rodata+0x34d00): undefined reference to `vb2_ioctl_dqbuf'
drivers/built-in.o:(.rodata+0x34d04): undefined reference to 
`vb2_ioctl_create_bufs'
drivers/built-in.o:(.rodata+0x34d08): undefined reference to 
`vb2_ioctl_prepare_buf'
drivers/built-in.o:(.rodata+0x34d18): undefined reference to 
`vb2_ioctl_streamon'
drivers/built-in.o:(.rodata+0x34d1c): undefined reference to 
`vb2_ioctl_streamoff'
drivers/built-in.o:(.rodata+0x35580): undefined reference to `vb2_fop_read'
drivers/built-in.o:(.rodata+0x35588): undefined reference to `vb2_fop_poll'
drivers/built-in.o:(.rodata+0x35598): undefined reference to `vb2_fop_mmap'
drivers/built-in.o:(.rodata+0x355a0): undefined reference to `vb2_fop_release'
drivers/built-in.o:(.data+0x23b40): undefined reference to 
`vb2_ops_wait_prepare'
drivers/built-in.o:(.data+0x23b44): undefined reference to `vb2_ops_wait_finish'

Signed-off-by: Randy Dunlap rdun...@infradead.org
Cc: Antti Palosaari cr...@iki.fi
---
  drivers/staging/media/msi3101/Kconfig |2 ++
  1 file changed, 2 insertions(+)

--- linux-next-20130912.orig/drivers/staging/media/msi3101/Kconfig
+++ linux-next-20130912/drivers/staging/media/msi3101/Kconfig
@@ -1,3 +1,5 @@
  config USB_MSI3101
tristate Mirics MSi3101 SDR Dongle
depends on USB  VIDEO_DEV  VIDEO_V4L2
+   select VIDEOBUF2_CORE
+   select VIDEOBUF2_VMALLOC




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


[PATCH -next] staging/media: fix msi3101 build errors

2013-09-12 Thread Randy Dunlap
From: Randy Dunlap rdun...@infradead.org

Fix build error when VIDEOBUF2_CORE=m and USB_MSI3101=y.

drivers/built-in.o: In function `msi3101_buf_queue':
sdr-msi3101.c:(.text+0x1298d6): undefined reference to `vb2_buffer_done'
drivers/built-in.o: In function `msi3101_cleanup_queued_bufs':
sdr-msi3101.c:(.text+0x1299c7): undefined reference to `vb2_buffer_done'
drivers/built-in.o: In function `msi3101_isoc_handler':
sdr-msi3101.c:(.text+0x12a08d): undefined reference to `vb2_plane_vaddr'
sdr-msi3101.c:(.text+0x12a0b9): undefined reference to `vb2_buffer_done'
drivers/built-in.o: In function `msi3101_probe':
sdr-msi3101.c:(.text+0x12a1c5): undefined reference to `vb2_vmalloc_memops'
sdr-msi3101.c:(.text+0x12a1d7): undefined reference to `vb2_queue_init'
drivers/built-in.o:(.rodata+0x34cf0): undefined reference to `vb2_ioctl_reqbufs'
drivers/built-in.o:(.rodata+0x34cf4): undefined reference to 
`vb2_ioctl_querybuf'
drivers/built-in.o:(.rodata+0x34cf8): undefined reference to `vb2_ioctl_qbuf'
drivers/built-in.o:(.rodata+0x34d00): undefined reference to `vb2_ioctl_dqbuf'
drivers/built-in.o:(.rodata+0x34d04): undefined reference to 
`vb2_ioctl_create_bufs'
drivers/built-in.o:(.rodata+0x34d08): undefined reference to 
`vb2_ioctl_prepare_buf'
drivers/built-in.o:(.rodata+0x34d18): undefined reference to 
`vb2_ioctl_streamon'
drivers/built-in.o:(.rodata+0x34d1c): undefined reference to 
`vb2_ioctl_streamoff'
drivers/built-in.o:(.rodata+0x35580): undefined reference to `vb2_fop_read'
drivers/built-in.o:(.rodata+0x35588): undefined reference to `vb2_fop_poll'
drivers/built-in.o:(.rodata+0x35598): undefined reference to `vb2_fop_mmap'
drivers/built-in.o:(.rodata+0x355a0): undefined reference to `vb2_fop_release'
drivers/built-in.o:(.data+0x23b40): undefined reference to 
`vb2_ops_wait_prepare'
drivers/built-in.o:(.data+0x23b44): undefined reference to `vb2_ops_wait_finish'

Signed-off-by: Randy Dunlap rdun...@infradead.org
Cc: Antti Palosaari cr...@iki.fi
---
 drivers/staging/media/msi3101/Kconfig |2 ++
 1 file changed, 2 insertions(+)

--- linux-next-20130912.orig/drivers/staging/media/msi3101/Kconfig
+++ linux-next-20130912/drivers/staging/media/msi3101/Kconfig
@@ -1,3 +1,5 @@
 config USB_MSI3101
tristate Mirics MSi3101 SDR Dongle
depends on USB  VIDEO_DEV  VIDEO_V4L2
+   select VIDEOBUF2_CORE
+   select VIDEOBUF2_VMALLOC
--
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


[RFD] use-counting V4L2 clocks

2013-09-12 Thread Guennadi Liakhovetski
Hi all

We've got a broken driver in 3.11 and in 3.12-rc and we don't have a clear 
way to properly fix it. The problem has been originally reported and 
discussed in [1], a patch-set to fix the problem has been proposed in [2], 
which actually lead to the topic of this mail - whether or not calls to 
v4l2_clk_enable() and v4l2_clk_disable(), or respectively to s_power(1) 
and s_power(0) subdevice core operations should be balanced. Currently 
they aren't in em28xx driver, and the V4L2 clock API throws warnings on 
attempts to disable already disabled clock. Patch [3] attempted to fix 
that. So, the question is - whether to enforce balanced power on / off 
calls, or to remove the warning.

Let's try to have a look at other examples in the kernel:

1. runtime PM: pm_runtime_get*() / pm_runtime_put*() only work, if 
balanced, but no warning is issued, if the balance is broken, AFAICS.

2. clock API: clk_enable() / clk_disable() in drivers/clk/clk.c have to be 
balanced and a warning is issued, if clk_disable() is called for an 
already disabled clock.

3. regulator API: regulator_enable() / regulator_disable() have to be 
balanced. A warning is issued if regulator_disable() is called for a 
disabled regulator.

So, I think, our V4L2 clock enable / disable calls should be balanced, and 
to enforce that a warning is helpful. Other opinions?

Thanks
Guennadi

[1] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/68028
[2] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/68510
[3] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/68864

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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: [RFD] use-counting V4L2 clocks

2013-09-12 Thread Sylwester Nawrocki

Hi Guennadi,

On 09/12/2013 09:13 PM, Guennadi Liakhovetski wrote:

So, I think, our V4L2 clock enable / disable calls should be balanced, and
to enforce that a warning is helpful. Other opinions?


I'd assume we should enforce those calls balanced, but I might not be
well aware of consequences for the all existing drivers. AFAIR all drivers
used in embedded systems follow the convention where default power state
is off and the s_power() calls are balanced.

I never ventured much into drivers that originally used tuner.s_standby()
before it got renamed to core.s_power(). As Mauro indicated tuner devices
assume default device power ON state, but additional s_power(1) call should
not break things as Frank pointed out.

I'd say let's make s_power(1) calls balanced, keep the warning and revisit
drivers one by one as they get support for explicit clock control added.

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


[PATCH 3/3] [media] siano: Fix initialization for Stellar models

2013-09-12 Thread Mauro Carvalho Chehab
Since kernel 3.8, the initialization for Stellar (sms1000)
devices are broken.

Those devices have a behaviour different than usual sms1100
and sms2270: they start with one USB ID (devices in cold state),
but after firmware load, they get a different USB ID.

This weren't docummented at the driver. So, the patches that added
support for sms2270 broke it.

Properly documment it, and provide a debug log that allows to
follow all phases of the device initialization:

smsusb_probe: board id=13, interface number 0
smsusb_probe: interface 0 won't be used. Expecting interface 1 to popup
smsusb_probe: board id=13, interface number 1
smsusb_probe: smsusb_probe 1
smsusb_probe: endpoint 0 81 02 64
smsusb_probe: endpoint 1 02 02 64
smsusb_probe: stellar device in cold state was found at usb\4-2.
smsusb1_load_firmware: sent 38144(38144) bytes, rc 0
smsusb1_load_firmware: read FW dvbt_bda_stellar_usb.inp, size=38144
smsusb_probe: stellar device now in warm state
usbcore: registered new interface driver smsusb
usb 4-2: USB disconnect, device number 52
usb 4-2: new full-speed USB device number 53 using uhci_hcd
usb 4-2: New USB device found, idVendor=187f, idProduct=0100
usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 4-2: Product: SMS DVBT-BDA Receiver
usb 4-2: Manufacturer: Siano Mobile Silicon
smsusb_probe: board id=1, interface number 0
smsusb_probe: smsusb_probe 0
smsusb_probe: endpoint 0 81 02 64
smsusb_probe: endpoint 1 02 02 64
smsusb_init_device: in_ep = 81, out_ep = 02
smscore_register_device: allocated 50 buffers
smscore_register_device: device 88012a00bc00 created
smsusb_init_device: smsusb_start_streaming(...).
smscore_set_device_mode: set device mode to 4
smsusb1_detectmode: 4 SMS DVBT-BDA Receiver
smsusb_sendrequest: sending MSG_SMS_INIT_DEVICE_REQ(578) size: 12
smsusb_onresponse: received MSG_SMS_INIT_DEVICE_RES(579) size: 12
smscore_set_device_mode: Success setting device mode.
smscore_init_ir: IR port has not been detected
smscore_start_device: device 88012a00bc00 started, rc 0
smsusb_init_device: device 0x88002cfa6000 created
smsusb_probe: Device initialized with return code 0
DVB: registering new adapter (Siano Stellar Digital Receiver)
usb 4-2: DVB: registering adapter 0 frontend 0 (Siano Mobile Digital 
MDTV Receiver)...
smscore_register_client: 88012174a000 693 1
sms_board_dvb3_event: DVB3_EVENT_HOTPLUG
smsdvb_hotplug: success
smsdvb_module_init:

Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
---
 drivers/media/usb/siano/smsusb.c | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index 74236b8..33f3575 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -491,15 +491,26 @@ static int smsusb_probe(struct usb_interface *intf,
}
 
if (id-driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) {
+   /* Detected a Siano Stellar uninitialized */
+
snprintf(devpath, sizeof(devpath), usb\\%d-%s,
 udev-bus-busnum, udev-devpath);
-   sms_info(stellar device was found.);
-   return smsusb1_load_firmware(
+   sms_info(stellar device in cold state was found at %s., 
devpath);
+   rc = smsusb1_load_firmware(
udev, smscore_registry_getmode(devpath),
id-driver_info);
+
+   /* This device will reset and gain another USB ID */
+   if (!rc)
+   sms_info(stellar device now in warm state);
+   else
+   sms_err(Failed to put stellar in warm state. Error: 
%d, rc);
+
+   return rc;
+   } else {
+   rc = smsusb_init_device(intf, id-driver_info);
}
 
-   rc = smsusb_init_device(intf, id-driver_info);
sms_info(Device initialized with return code %d, rc);
sms_board_load_modules(id-driver_info);
return rc;
@@ -552,10 +563,13 @@ static int smsusb_resume(struct usb_interface *intf)
 }
 
 static const struct usb_device_id smsusb_id_table[] = {
+   /* This device is only present before firmware load */
{ USB_DEVICE(0x187f, 0x0010),
-   .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
+   .driver_info = SMS1XXX_BOARD_SIANO_STELLAR_ROM },
+   /* This device pops up after firmware load */
{ USB_DEVICE(0x187f, 0x0100),
.driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
+
{ USB_DEVICE(0x187f, 0x0200),
.driver_info = SMS1XXX_BOARD_SIANO_NOVA_A },
 

Re: [PATCH 2/3] [media] siano: Improve debug/info messages

2013-09-12 Thread André Roth
On Thu, 12 Sep 2013 16:59:59 -0300
Mauro Carvalho Chehab m.che...@samsung.com wrote:

Tested-by: André Roth neol...@gmail.com


 Some messages are not clear, some are debug data, but are
 shown as errors, and one message is duplicated.
 
 Cleanup that mess in order to provide a cleaner log.
 
 Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
 ---
  drivers/media/usb/siano/smsusb.c | 18 ++
  1 file changed, 10 insertions(+), 8 deletions(-)
 
 diff --git a/drivers/media/usb/siano/smsusb.c 
 b/drivers/media/usb/siano/smsusb.c
 index 03761c6..74236b8 100644
 --- a/drivers/media/usb/siano/smsusb.c
 +++ b/drivers/media/usb/siano/smsusb.c
 @@ -209,8 +209,10 @@ static int smsusb_sendrequest(void *context, void 
 *buffer, size_t size)
   struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer;
   int dummy;
  
 - if (dev-state != SMSUSB_ACTIVE)
 + if (dev-state != SMSUSB_ACTIVE) {
 + sms_debug(Device not active yet);
   return -ENOENT;
 + }
  
   sms_debug(sending %s(%d) size: %d,
 smscore_translate_msg(phdr-msg_type), phdr-msg_type,
 @@ -445,14 +447,15 @@ static int smsusb_probe(struct usb_interface *intf,
   char devpath[32];
   int i, rc;
  
 - sms_info(interface number %d,
 + sms_info(board id=%lu, interface number %d,
 +  id-driver_info,
intf-cur_altsetting-desc.bInterfaceNumber);
  
   if (sms_get_board(id-driver_info)-intf_num !=
   intf-cur_altsetting-desc.bInterfaceNumber) {
 - sms_err(interface number is %d expecting %d,
 - sms_get_board(id-driver_info)-intf_num,
 - intf-cur_altsetting-desc.bInterfaceNumber);
 + sms_debug(interface %d won't be used. Expecting interface %d 
 to popup,
 + intf-cur_altsetting-desc.bInterfaceNumber,
 + sms_get_board(id-driver_info)-intf_num);
   return -ENODEV;
   }
  
 @@ -483,12 +486,11 @@ static int smsusb_probe(struct usb_interface *intf,
   }
   if ((udev-actconfig-desc.bNumInterfaces == 2) 
   (intf-cur_altsetting-desc.bInterfaceNumber == 0)) {
 - sms_err(rom interface 0 is not used);
 + sms_debug(rom interface 0 is not used);
   return -ENODEV;
   }
  
   if (id-driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) {
 - sms_info(stellar device was found.);
   snprintf(devpath, sizeof(devpath), usb\\%d-%s,
udev-bus-busnum, udev-devpath);
   sms_info(stellar device was found.);
 @@ -498,7 +500,7 @@ static int smsusb_probe(struct usb_interface *intf,
   }
  
   rc = smsusb_init_device(intf, id-driver_info);
 - sms_info(rc %d, rc);
 + sms_info(Device initialized with return code %d, rc);
   sms_board_load_modules(id-driver_info);
   return rc;
  }
--
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] siano: Improve debug/info messages

2013-09-12 Thread Mauro Carvalho Chehab
Some messages are not clear, some are debug data, but are
shown as errors, and one message is duplicated.

Cleanup that mess in order to provide a cleaner log.

Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
---
 drivers/media/usb/siano/smsusb.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index 03761c6..74236b8 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -209,8 +209,10 @@ static int smsusb_sendrequest(void *context, void *buffer, 
size_t size)
struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer;
int dummy;
 
-   if (dev-state != SMSUSB_ACTIVE)
+   if (dev-state != SMSUSB_ACTIVE) {
+   sms_debug(Device not active yet);
return -ENOENT;
+   }
 
sms_debug(sending %s(%d) size: %d,
  smscore_translate_msg(phdr-msg_type), phdr-msg_type,
@@ -445,14 +447,15 @@ static int smsusb_probe(struct usb_interface *intf,
char devpath[32];
int i, rc;
 
-   sms_info(interface number %d,
+   sms_info(board id=%lu, interface number %d,
+id-driver_info,
 intf-cur_altsetting-desc.bInterfaceNumber);
 
if (sms_get_board(id-driver_info)-intf_num !=
intf-cur_altsetting-desc.bInterfaceNumber) {
-   sms_err(interface number is %d expecting %d,
-   sms_get_board(id-driver_info)-intf_num,
-   intf-cur_altsetting-desc.bInterfaceNumber);
+   sms_debug(interface %d won't be used. Expecting interface %d 
to popup,
+   intf-cur_altsetting-desc.bInterfaceNumber,
+   sms_get_board(id-driver_info)-intf_num);
return -ENODEV;
}
 
@@ -483,12 +486,11 @@ static int smsusb_probe(struct usb_interface *intf,
}
if ((udev-actconfig-desc.bNumInterfaces == 2) 
(intf-cur_altsetting-desc.bInterfaceNumber == 0)) {
-   sms_err(rom interface 0 is not used);
+   sms_debug(rom interface 0 is not used);
return -ENODEV;
}
 
if (id-driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) {
-   sms_info(stellar device was found.);
snprintf(devpath, sizeof(devpath), usb\\%d-%s,
 udev-bus-busnum, udev-devpath);
sms_info(stellar device was found.);
@@ -498,7 +500,7 @@ static int smsusb_probe(struct usb_interface *intf,
}
 
rc = smsusb_init_device(intf, id-driver_info);
-   sms_info(rc %d, rc);
+   sms_info(Device initialized with return code %d, rc);
sms_board_load_modules(id-driver_info);
return rc;
 }
-- 
1.8.3.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 1/3] [media] siano: Don't show debug messages as errors

2013-09-12 Thread André Roth
On Thu, 12 Sep 2013 16:59:58 -0300
Mauro Carvalho Chehab m.che...@samsung.com wrote:

Tested-by: André Roth neol...@gmail.com

 At this bugzilla and similar ones:
https://bugzilla.kernel.org/show_bug.cgi?id=60645
 
 Those debug messages were seen as errors, but they're just debug
 data, and are OK to appear on sms1100 and sms2270. Re-tag them
 to appear only if debug is enabled.
 
 Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
 ---
  drivers/media/common/siano/smscoreapi.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/common/siano/smscoreapi.c 
 b/drivers/media/common/siano/smscoreapi.c
 index a142f79..acf39ad 100644
 --- a/drivers/media/common/siano/smscoreapi.c
 +++ b/drivers/media/common/siano/smscoreapi.c
 @@ -982,7 +982,7 @@ static int smscore_load_firmware_family2(struct 
 smscore_device_t *coredev,
   if (rc  0)
   goto exit_fw_download;
  
 - sms_err(sending MSG_SMS_DATA_VALIDITY_REQ expecting 0x%x,
 + sms_debug(sending MSG_SMS_DATA_VALIDITY_REQ expecting 0x%x,
   calc_checksum);
   SMS_INIT_MSG(msg-x_msg_header, MSG_SMS_DATA_VALIDITY_REQ,
   sizeof(msg-x_msg_header) +
 @@ -1562,7 +1562,7 @@ void smscore_onresponse(struct smscore_device_t 
 *coredev,
   {
   struct sms_msg_data *validity = (struct sms_msg_data *) 
 phdr;
  
 - sms_err(MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x,
 + sms_debug(MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x,
   validity-msg_data[0]);
   complete(coredev-data_validity_done);
   break;
--
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] siano: Don't show debug messages as errors

2013-09-12 Thread Mauro Carvalho Chehab
At this bugzilla and similar ones:
   https://bugzilla.kernel.org/show_bug.cgi?id=60645

Those debug messages were seen as errors, but they're just debug
data, and are OK to appear on sms1100 and sms2270. Re-tag them
to appear only if debug is enabled.

Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
---
 drivers/media/common/siano/smscoreapi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/common/siano/smscoreapi.c 
b/drivers/media/common/siano/smscoreapi.c
index a142f79..acf39ad 100644
--- a/drivers/media/common/siano/smscoreapi.c
+++ b/drivers/media/common/siano/smscoreapi.c
@@ -982,7 +982,7 @@ static int smscore_load_firmware_family2(struct 
smscore_device_t *coredev,
if (rc  0)
goto exit_fw_download;
 
-   sms_err(sending MSG_SMS_DATA_VALIDITY_REQ expecting 0x%x,
+   sms_debug(sending MSG_SMS_DATA_VALIDITY_REQ expecting 0x%x,
calc_checksum);
SMS_INIT_MSG(msg-x_msg_header, MSG_SMS_DATA_VALIDITY_REQ,
sizeof(msg-x_msg_header) +
@@ -1562,7 +1562,7 @@ void smscore_onresponse(struct smscore_device_t *coredev,
{
struct sms_msg_data *validity = (struct sms_msg_data *) 
phdr;
 
-   sms_err(MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x,
+   sms_debug(MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x,
validity-msg_data[0]);
complete(coredev-data_validity_done);
break;
-- 
1.8.3.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] Some improvements/fixes for Siano driver

2013-09-12 Thread Mauro Carvalho Chehab
I got a few reports those days about Siano regressions/issues.

The first one was reported at:
   https://bugzilla.kernel.org/show_bug.cgi?id=60645

While its fix was already upstream, the error messages there doesn't
help, as it induced people to believe that it was a firmware related
error.

The second one was reported via IRC, and it is related to the first
generation of Siano devices (sms1000).

It was a regression caused on kernel 3.9, that made those devices to
fail.

It turns that, on those devices, the driver should first initialize
one USB ID and load a firmware. After firmware load, the device got
replaced by another USB ID, and the device initialization can be
done, on a diferent USB Interface.

This series fixes the second issue and improves the debug message,
in order to make easier to identify what's going wrong at the
init process.

Mauro Carvalho Chehab (3):
  [media] siano: Don't show debug messages as errors
  [media] siano: Improve debug/info messages
  [media] siano: Fix initialization for Stellar models

 drivers/media/common/siano/smscoreapi.c |  4 ++--
 drivers/media/usb/siano/smsusb.c| 40 +++--
 2 files changed, 30 insertions(+), 14 deletions(-)

-- 
1.8.3.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 3/3] [media] siano: Fix initialization for Stellar models

2013-09-12 Thread André Roth
On Thu, 12 Sep 2013 17:00:00 -0300
Mauro Carvalho Chehab m.che...@samsung.com wrote:

Tested-by: André Roth neol...@gmail.com


 Since kernel 3.8, the initialization for Stellar (sms1000)
 devices are broken.
 
 Those devices have a behaviour different than usual sms1100
 and sms2270: they start with one USB ID (devices in cold state),
 but after firmware load, they get a different USB ID.
 
 This weren't docummented at the driver. So, the patches that added
 support for sms2270 broke it.
 
 Properly documment it, and provide a debug log that allows to
 follow all phases of the device initialization:
 
   smsusb_probe: board id=13, interface number 0
   smsusb_probe: interface 0 won't be used. Expecting interface 1 to popup
   smsusb_probe: board id=13, interface number 1
   smsusb_probe: smsusb_probe 1
   smsusb_probe: endpoint 0 81 02 64
   smsusb_probe: endpoint 1 02 02 64
   smsusb_probe: stellar device in cold state was found at usb\4-2.
   smsusb1_load_firmware: sent 38144(38144) bytes, rc 0
   smsusb1_load_firmware: read FW dvbt_bda_stellar_usb.inp, size=38144
   smsusb_probe: stellar device now in warm state
   usbcore: registered new interface driver smsusb
   usb 4-2: USB disconnect, device number 52
   usb 4-2: new full-speed USB device number 53 using uhci_hcd
   usb 4-2: New USB device found, idVendor=187f, idProduct=0100
   usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
   usb 4-2: Product: SMS DVBT-BDA Receiver
   usb 4-2: Manufacturer: Siano Mobile Silicon
   smsusb_probe: board id=1, interface number 0
   smsusb_probe: smsusb_probe 0
   smsusb_probe: endpoint 0 81 02 64
   smsusb_probe: endpoint 1 02 02 64
   smsusb_init_device: in_ep = 81, out_ep = 02
   smscore_register_device: allocated 50 buffers
   smscore_register_device: device 88012a00bc00 created
   smsusb_init_device: smsusb_start_streaming(...).
   smscore_set_device_mode: set device mode to 4
   smsusb1_detectmode: 4 SMS DVBT-BDA Receiver
   smsusb_sendrequest: sending MSG_SMS_INIT_DEVICE_REQ(578) size: 12
   smsusb_onresponse: received MSG_SMS_INIT_DEVICE_RES(579) size: 12
   smscore_set_device_mode: Success setting device mode.
   smscore_init_ir: IR port has not been detected
   smscore_start_device: device 88012a00bc00 started, rc 0
   smsusb_init_device: device 0x88002cfa6000 created
   smsusb_probe: Device initialized with return code 0
   DVB: registering new adapter (Siano Stellar Digital Receiver)
   usb 4-2: DVB: registering adapter 0 frontend 0 (Siano Mobile Digital 
 MDTV Receiver)...
   smscore_register_client: 88012174a000 693 1
   sms_board_dvb3_event: DVB3_EVENT_HOTPLUG
   smsdvb_hotplug: success
   smsdvb_module_init:
 
 Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
 ---
  drivers/media/usb/siano/smsusb.c | 22 ++
  1 file changed, 18 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/media/usb/siano/smsusb.c 
 b/drivers/media/usb/siano/smsusb.c
 index 74236b8..33f3575 100644
 --- a/drivers/media/usb/siano/smsusb.c
 +++ b/drivers/media/usb/siano/smsusb.c
 @@ -491,15 +491,26 @@ static int smsusb_probe(struct usb_interface *intf,
   }
  
   if (id-driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) {
 + /* Detected a Siano Stellar uninitialized */
 +
   snprintf(devpath, sizeof(devpath), usb\\%d-%s,
udev-bus-busnum, udev-devpath);
 - sms_info(stellar device was found.);
 - return smsusb1_load_firmware(
 + sms_info(stellar device in cold state was found at %s., 
 devpath);
 + rc = smsusb1_load_firmware(
   udev, smscore_registry_getmode(devpath),
   id-driver_info);
 +
 + /* This device will reset and gain another USB ID */
 + if (!rc)
 + sms_info(stellar device now in warm state);
 + else
 + sms_err(Failed to put stellar in warm state. Error: 
 %d, rc);
 +
 + return rc;
 + } else {
 + rc = smsusb_init_device(intf, id-driver_info);
   }
  
 - rc = smsusb_init_device(intf, id-driver_info);
   sms_info(Device initialized with return code %d, rc);
   sms_board_load_modules(id-driver_info);
   return rc;
 @@ -552,10 +563,13 @@ static int smsusb_resume(struct usb_interface *intf)
  }
  
  static const struct usb_device_id smsusb_id_table[] = {
 + /* This device is only present before firmware load */
   { USB_DEVICE(0x187f, 0x0010),
 - .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
 + .driver_info = SMS1XXX_BOARD_SIANO_STELLAR_ROM },
 + /* This device pops up after firmware load */
   { USB_DEVICE(0x187f, 0x0100),
   .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
 +

Re: [PATCH 3/3] [media] siano: Fix initialization for Stellar models

2013-09-12 Thread André Roth
On Thu, 12 Sep 2013 17:00:00 -0300
Mauro Carvalho Chehab m.che...@samsung.com wrote:

Tested-by: André Roth neol...@gmail.com


 Since kernel 3.8, the initialization for Stellar (sms1000)
 devices are broken.
 
 Those devices have a behaviour different than usual sms1100
 and sms2270: they start with one USB ID (devices in cold state),
 but after firmware load, they get a different USB ID.
 
 This weren't docummented at the driver. So, the patches that added
 support for sms2270 broke it.
 
 Properly documment it, and provide a debug log that allows to
 follow all phases of the device initialization:
 
   smsusb_probe: board id=13, interface number 0
   smsusb_probe: interface 0 won't be used. Expecting interface 1 to popup
   smsusb_probe: board id=13, interface number 1
   smsusb_probe: smsusb_probe 1
   smsusb_probe: endpoint 0 81 02 64
   smsusb_probe: endpoint 1 02 02 64
   smsusb_probe: stellar device in cold state was found at usb\4-2.
   smsusb1_load_firmware: sent 38144(38144) bytes, rc 0
   smsusb1_load_firmware: read FW dvbt_bda_stellar_usb.inp, size=38144
   smsusb_probe: stellar device now in warm state
   usbcore: registered new interface driver smsusb
   usb 4-2: USB disconnect, device number 52
   usb 4-2: new full-speed USB device number 53 using uhci_hcd
   usb 4-2: New USB device found, idVendor=187f, idProduct=0100
   usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
   usb 4-2: Product: SMS DVBT-BDA Receiver
   usb 4-2: Manufacturer: Siano Mobile Silicon
   smsusb_probe: board id=1, interface number 0
   smsusb_probe: smsusb_probe 0
   smsusb_probe: endpoint 0 81 02 64
   smsusb_probe: endpoint 1 02 02 64
   smsusb_init_device: in_ep = 81, out_ep = 02
   smscore_register_device: allocated 50 buffers
   smscore_register_device: device 88012a00bc00 created
   smsusb_init_device: smsusb_start_streaming(...).
   smscore_set_device_mode: set device mode to 4
   smsusb1_detectmode: 4 SMS DVBT-BDA Receiver
   smsusb_sendrequest: sending MSG_SMS_INIT_DEVICE_REQ(578) size: 12
   smsusb_onresponse: received MSG_SMS_INIT_DEVICE_RES(579) size: 12
   smscore_set_device_mode: Success setting device mode.
   smscore_init_ir: IR port has not been detected
   smscore_start_device: device 88012a00bc00 started, rc 0
   smsusb_init_device: device 0x88002cfa6000 created
   smsusb_probe: Device initialized with return code 0
   DVB: registering new adapter (Siano Stellar Digital Receiver)
   usb 4-2: DVB: registering adapter 0 frontend 0 (Siano Mobile Digital 
 MDTV Receiver)...
   smscore_register_client: 88012174a000 693 1
   sms_board_dvb3_event: DVB3_EVENT_HOTPLUG
   smsdvb_hotplug: success
   smsdvb_module_init:
 
 Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
 ---
  drivers/media/usb/siano/smsusb.c | 22 ++
  1 file changed, 18 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/media/usb/siano/smsusb.c 
 b/drivers/media/usb/siano/smsusb.c
 index 74236b8..33f3575 100644
 --- a/drivers/media/usb/siano/smsusb.c
 +++ b/drivers/media/usb/siano/smsusb.c
 @@ -491,15 +491,26 @@ static int smsusb_probe(struct usb_interface *intf,
   }
  
   if (id-driver_info == SMS1XXX_BOARD_SIANO_STELLAR_ROM) {
 + /* Detected a Siano Stellar uninitialized */
 +
   snprintf(devpath, sizeof(devpath), usb\\%d-%s,
udev-bus-busnum, udev-devpath);
 - sms_info(stellar device was found.);
 - return smsusb1_load_firmware(
 + sms_info(stellar device in cold state was found at %s., 
 devpath);
 + rc = smsusb1_load_firmware(
   udev, smscore_registry_getmode(devpath),
   id-driver_info);
 +
 + /* This device will reset and gain another USB ID */
 + if (!rc)
 + sms_info(stellar device now in warm state);
 + else
 + sms_err(Failed to put stellar in warm state. Error: 
 %d, rc);
 +
 + return rc;
 + } else {
 + rc = smsusb_init_device(intf, id-driver_info);
   }
  
 - rc = smsusb_init_device(intf, id-driver_info);
   sms_info(Device initialized with return code %d, rc);
   sms_board_load_modules(id-driver_info);
   return rc;
 @@ -552,10 +563,13 @@ static int smsusb_resume(struct usb_interface *intf)
  }
  
  static const struct usb_device_id smsusb_id_table[] = {
 + /* This device is only present before firmware load */
   { USB_DEVICE(0x187f, 0x0010),
 - .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
 + .driver_info = SMS1XXX_BOARD_SIANO_STELLAR_ROM },
 + /* This device pops up after firmware load */
   { USB_DEVICE(0x187f, 0x0100),
   .driver_info = SMS1XXX_BOARD_SIANO_STELLAR },
 +

Re: [PATCH 4/3] [media] siano: Use the default firmware for Stellar

2013-09-12 Thread André Roth
On Thu, 12 Sep 2013 17:04:07 -0300
Mauro Carvalho Chehab m.che...@samsung.com wrote:

Tested-by: André Roth neol...@gmail.com


 The Stellar firmware load routine is different. Improve it to use
 the default firmware, if no modprobe parameter tells otherwise.
 
 Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
 ---
  drivers/media/usb/siano/smsusb.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/drivers/media/usb/siano/smsusb.c 
 b/drivers/media/usb/siano/smsusb.c
 index 33f3575..05bd91a 100644
 --- a/drivers/media/usb/siano/smsusb.c
 +++ b/drivers/media/usb/siano/smsusb.c
 @@ -245,6 +245,9 @@ static int smsusb1_load_firmware(struct usb_device *udev, 
 int id, int board_id)
   int rc, dummy;
   char *fw_filename;
  
 + if (id  0)
 + id = sms_get_board(board_id)-default_mode;
 +
   if (id  DEVICE_MODE_DVBT || id  DEVICE_MODE_DVBT_BDA) {
   sms_err(invalid firmware id specified %d, id);
   return -EINVAL;
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] Some improvements/fixes for Siano driver

2013-09-12 Thread André Roth
On Thu, 12 Sep 2013 16:59:57 -0300
Mauro Carvalho Chehab m.che...@samsung.com wrote:

Tested-by: André Roth neol...@gmail.com


 I got a few reports those days about Siano regressions/issues.
 
 The first one was reported at:
https://bugzilla.kernel.org/show_bug.cgi?id=60645
 
 While its fix was already upstream, the error messages there doesn't
 help, as it induced people to believe that it was a firmware related
 error.
 
 The second one was reported via IRC, and it is related to the first
 generation of Siano devices (sms1000).
 
 It was a regression caused on kernel 3.9, that made those devices to
 fail.
 
 It turns that, on those devices, the driver should first initialize
 one USB ID and load a firmware. After firmware load, the device got
 replaced by another USB ID, and the device initialization can be
 done, on a diferent USB Interface.
 
 This series fixes the second issue and improves the debug message,
 in order to make easier to identify what's going wrong at the
 init process.
 
 Mauro Carvalho Chehab (3):
   [media] siano: Don't show debug messages as errors
   [media] siano: Improve debug/info messages
   [media] siano: Fix initialization for Stellar models
 
  drivers/media/common/siano/smscoreapi.c |  4 ++--
  drivers/media/usb/siano/smsusb.c| 40 
 +++--
  2 files changed, 30 insertions(+), 14 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


cron job: media_tree daily build: WARNINGS

2013-09-12 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:   Fri Sep 13 04:00:19 CEST 2013
git branch: test
git hash:   f66b2a1c7f2ae3fb0d5b67d07ab4f5055fd3cf16
gcc version:i686-linux-gcc (GCC) 4.8.1
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.10.1

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.31.14-i686: 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.10.1-i686: OK
linux-3.1.10-i686: OK
linux-3.11-rc1-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: OK
linux-3.9.2-i686: OK
linux-2.6.31.14-x86_64: 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.10.1-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.11-rc1-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: OK
linux-3.9.2-x86_64: OK
apps: WARNINGS
spec-git: OK
ABI WARNING: change for arm-at91
ABI WARNING: change for arm-davinci
ABI WARNING: change for arm-exynos
ABI WARNING: change for arm-mx
ABI WARNING: change for arm-omap
ABI WARNING: change for arm-omap1
ABI WARNING: change for arm-pxa
ABI WARNING: change for blackfin
ABI WARNING: change for i686
ABI WARNING: change for m32r
ABI WARNING: change for mips
ABI WARNING: change for powerpc64
ABI WARNING: change for sh
ABI WARNING: change for x86_64
sparse version: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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