Re: [PATCH] soc-camera: Add mt9t112 camera support

2009-11-25 Thread Magnus Damm
On Thu, Nov 19, 2009 at 6:15 PM, Kuninori Morimoto
morimoto.kunin...@renesas.com wrote:
 Signed-off-by: Kuninori Morimoto morimoto.kunin...@renesas.com
 ---
 Guennadi

 I add new number in v4l2-chip-ident.h
 Is it OK for you ?

 This camera is very picky.
 So, it have a lot of constant value.

 The register of mt9t112 and mt9t111 are same.
 But I have mt9t112 only.
 mt9t111 should also work, but I can not check.

 This patch is based on your 20091105 patches.

  drivers/media/video/Kconfig     |    6 +
  drivers/media/video/Makefile    |    1 +
  drivers/media/video/mt9t112.c   | 1158 
 +++
  include/media/mt9t112.h         |   32 ++
  include/media/v4l2-chip-ident.h |    2 +
  5 files changed, 1199 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/video/mt9t112.c
  create mode 100644 include/media/mt9t112.h

Hi Morimoto-san,

Do you have any mt9t112 platform data for the ecovec board? I'd like
to try out this patch but I don't know which board specific parts that
are missing!

/ magnus
--
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] soc-camera: Add mt9t112 camera support

2009-11-25 Thread Kuninori Morimoto

Hi Magnus

 Do you have any mt9t112 platform data for the ecovec board? I'd like
 to try out this patch but I don't know which board specific parts that
 are missing!

Yes I have.
I attached it.
This platform patch is based on Guennadi's latest patches.

I also attached tw9910 platform patch.
Please apply in order of tw9910 - mt9t112.

Best regards
--
Kuninori Morimoto


0001-sh-mach-ecovec24-Add-tw9910-support.patch
Description: Binary data


0002-sh-mach-ecovec24-Add-mt9t112-camera-support.patch
Description: Binary data


Re: [PATCH] soc-camera: Add mt9t112 camera support

2009-11-25 Thread Magnus Damm
Hey Morimoto-san,

On Thu, Nov 26, 2009 at 9:50 AM, Kuninori Morimoto
morimoto.kunin...@renesas.com wrote:
 Do you have any mt9t112 platform data for the ecovec board? I'd like
 to try out this patch but I don't know which board specific parts that
 are missing!

 Yes I have.
 I attached it.
 This platform patch is based on Guennadi's latest patches.

 I also attached tw9910 platform patch.
 Please apply in order of tw9910 - mt9t112.

Thanks for the patches.

So now I've done some testing of the mt9t112 sensor hooked up to CEU0
on the ecovec board. I tried 16-bit RGB and NV12 in various
resolutions with mplayer. My only comment is that it seems to take a
bit of time to setup the sensor initially, but that may be something
related to the camera sensor itself.

Cheers,

/ magnus
--
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] soc-camera: Add mt9t112 camera support

2009-11-19 Thread Kuninori Morimoto
Signed-off-by: Kuninori Morimoto morimoto.kunin...@renesas.com
---
 Guennadi

I add new number in v4l2-chip-ident.h
Is it OK for you ?

This camera is very picky.
So, it have a lot of constant value.

The register of mt9t112 and mt9t111 are same.
But I have mt9t112 only.
mt9t111 should also work, but I can not check.

This patch is based on your 20091105 patches.

 drivers/media/video/Kconfig |6 +
 drivers/media/video/Makefile|1 +
 drivers/media/video/mt9t112.c   | 1158 +++
 include/media/mt9t112.h |   32 ++
 include/media/v4l2-chip-ident.h |2 +
 5 files changed, 1199 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/mt9t112.c
 create mode 100644 include/media/mt9t112.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 0ab7ccd..0aec969 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -840,6 +840,12 @@ config SOC_CAMERA_MT9T031
help
  This driver supports MT9T031 cameras from Micron.
 
+config SOC_CAMERA_MT9T112
+   tristate mt9t112 support
+   depends on SOC_CAMERA  I2C
+   help
+ This driver supports MT9T112 cameras from Aptina.
+
 config SOC_CAMERA_MT9V022
tristate mt9v022 support
depends on SOC_CAMERA  I2C
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 62d8907..b0e27b2 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -75,6 +75,7 @@ obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
 obj-$(CONFIG_SOC_CAMERA_MT9M001)   += mt9m001.o
 obj-$(CONFIG_SOC_CAMERA_MT9M111)   += mt9m111.o
 obj-$(CONFIG_SOC_CAMERA_MT9T031)   += mt9t031.o
+obj-$(CONFIG_SOC_CAMERA_MT9T112)   += mt9t112.o
 obj-$(CONFIG_SOC_CAMERA_MT9V022)   += mt9v022.o
 obj-$(CONFIG_SOC_CAMERA_OV772X)+= ov772x.o
 obj-$(CONFIG_SOC_CAMERA_OV9640)+= ov9640.o
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
new file mode 100644
index 000..8ca2128
--- /dev/null
+++ b/drivers/media/video/mt9t112.c
@@ -0,0 +1,1158 @@
+/*
+ * mt9t112 Camera Driver
+ *
+ * Copyright (C) 2009 Renesas Solutions Corp.
+ * Kuninori Morimoto morimoto.kunin...@renesas.com
+ *
+ * Based on ov772x driver, mt9m111 driver,
+ *
+ * Copyright (C) 2008 Kuninori Morimoto morimoto.kunin...@renesas.com
+ * Copyright (C) 2008, Robert Jarzmik robert.jarz...@free.fr
+ * Copyright 2006-7 Jonathan Corbet cor...@lwn.net
+ * Copyright (C) 2008 Magnus Damm
+ * Copyright (C) 2008, Guennadi Liakhovetski ker...@pengutronix.de
+ *
+ * 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/init.h
+#include linux/module.h
+#include linux/i2c.h
+#include linux/slab.h
+#include linux/delay.h
+#include linux/videodev2.h
+#include media/v4l2-chip-ident.h
+#include media/v4l2-common.h
+#include media/soc_camera.h
+#include media/mt9t112.h
+
+/* you can check PLL/clock info */
+/* #define EXT_CLOCK 2400 */
+
+/
+
+
+   macro
+
+
+/
+/*
+ * frame size
+ */
+#define MAX_WIDTH   2048
+#define MAX_HEIGHT  1536
+
+#define VGA_WIDTH   640
+#define VGA_HEIGHT  480
+
+/*
+ * macro of read/write
+ */
+#define ECHECKER(x)\
+   do {\
+   ret = x;\
+   if (ret  0)\
+   return ret; \
+   } while (0)
+
+#define mt9t112_reg_write(a, b)  ECHECKER(__mt9t112_reg_write(client, a, b))
+#define mt9t112_mcu_write(a, b)  ECHECKER(__mt9t112_mcu_write(client, a, b))
+
+#define mt9t112_reg_mask_set(a, b, c)\
+   ECHECKER(__mt9t112_reg_mask_set(client, a, b, c))
+#define mt9t112_mcu_mask_set(a, b, c)\
+   ECHECKER(__mt9t112_mcu_mask_set(client, a, b, c))
+
+#define mt9t112_reg_read(a)  __mt9t112_reg_read(client, a)
+#define mt9t112_mcu_read(a)  __mt9t112_mcu_read(client, a)
+
+/*
+ * Logical address
+ */
+#define _VAR(id, offset, base) (base | (id  0x1f)  10 | (offset  0x3ff))
+#define VAR(id, offset)  _VAR(id, offset, 0x)
+#define VAR8(id, offset) _VAR(id, offset, 0x8000)
+
+/
+
+
+   struct
+
+
+/
+struct mt9t112_frame_size {
+   u16 width;
+   u16 height;
+};
+
+struct mt9t112_format {
+   const enum v4l2_imgbus_pixelcode code;
+   u16 fmt;
+   u16 order;
+};
+
+struct mt9t112_priv {
+   struct v4l2_subdev   subdev;
+   struct mt9t112_camera_info  *info;
+   struct i2c_client   *client;
+   struct soc_camera_device 

RE: [PATCH] soc-camera: Add mt9t112 camera support

2009-11-19 Thread Karicheri, Muralidharan
Hi,

Please make this a generic driver so that it can be used across
other SoCs as well. BTW, on which SoC have you tested this driver?
There seems to be a lot of soc-camera specific stuffs here.
Example, probe() is getting a pointer to  struct soc_camera_device *icd. I have 
been working with Guennadi to make the MT9T031.c driver work for TI's VPFE on 
DMxxx SOCs. since this is a new driver, I would like to see it de-coupled from 
soc-camera framework and implemented as a generic v4l2-subdevice driver.

Thanks and regards.

Murali Karicheri
Software Design Engineer
Texas Instruments Inc.
Germantown, MD 20874
phone: 301-407-9583
email: m-kariche...@ti.com

-Original Message-
From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
ow...@vger.kernel.org] On Behalf Of Kuninori Morimoto
Sent: Thursday, November 19, 2009 4:16 AM
To: Guennadi
Cc: Linux-V4L2
Subject: [PATCH] soc-camera: Add mt9t112 camera support

Signed-off-by: Kuninori Morimoto morimoto.kunin...@renesas.com
---
 Guennadi

I add new number in v4l2-chip-ident.h
Is it OK for you ?

This camera is very picky.
So, it have a lot of constant value.

The register of mt9t112 and mt9t111 are same.
But I have mt9t112 only.
mt9t111 should also work, but I can not check.

This patch is based on your 20091105 patches.

 drivers/media/video/Kconfig |6 +
 drivers/media/video/Makefile|1 +
 drivers/media/video/mt9t112.c   | 1158
+++
 include/media/mt9t112.h |   32 ++
 include/media/v4l2-chip-ident.h |2 +
 5 files changed, 1199 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/mt9t112.c
 create mode 100644 include/media/mt9t112.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 0ab7ccd..0aec969 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -840,6 +840,12 @@ config SOC_CAMERA_MT9T031
   help
 This driver supports MT9T031 cameras from Micron.

+config SOC_CAMERA_MT9T112
+  tristate mt9t112 support
+  depends on SOC_CAMERA  I2C
+  help
+This driver supports MT9T112 cameras from Aptina.
+
 config SOC_CAMERA_MT9V022
   tristate mt9v022 support
   depends on SOC_CAMERA  I2C
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 62d8907..b0e27b2 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -75,6 +75,7 @@ obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
 obj-$(CONFIG_SOC_CAMERA_MT9M001)  += mt9m001.o
 obj-$(CONFIG_SOC_CAMERA_MT9M111)  += mt9m111.o
 obj-$(CONFIG_SOC_CAMERA_MT9T031)  += mt9t031.o
+obj-$(CONFIG_SOC_CAMERA_MT9T112)  += mt9t112.o
 obj-$(CONFIG_SOC_CAMERA_MT9V022)  += mt9v022.o
 obj-$(CONFIG_SOC_CAMERA_OV772X)   += ov772x.o
 obj-$(CONFIG_SOC_CAMERA_OV9640)   += ov9640.o
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
new file mode 100644
index 000..8ca2128
--- /dev/null
+++ b/drivers/media/video/mt9t112.c
@@ -0,0 +1,1158 @@
+/*
+ * mt9t112 Camera Driver
+ *
+ * Copyright (C) 2009 Renesas Solutions Corp.
+ * Kuninori Morimoto morimoto.kunin...@renesas.com
+ *
+ * Based on ov772x driver, mt9m111 driver,
+ *
+ * Copyright (C) 2008 Kuninori Morimoto morimoto.kunin...@renesas.com
+ * Copyright (C) 2008, Robert Jarzmik robert.jarz...@free.fr
+ * Copyright 2006-7 Jonathan Corbet cor...@lwn.net
+ * Copyright (C) 2008 Magnus Damm
+ * Copyright (C) 2008, Guennadi Liakhovetski ker...@pengutronix.de
+ *
+ * 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/init.h
+#include linux/module.h
+#include linux/i2c.h
+#include linux/slab.h
+#include linux/delay.h
+#include linux/videodev2.h
+#include media/v4l2-chip-ident.h
+#include media/v4l2-common.h
+#include media/soc_camera.h
+#include media/mt9t112.h
+
+/* you can check PLL/clock info */
+/* #define EXT_CLOCK 2400 */
+
+/
+
+
+  macro
+
+
+/
+/*
+ * frame size
+ */
+#define MAX_WIDTH   2048
+#define MAX_HEIGHT  1536
+
+#define VGA_WIDTH   640
+#define VGA_HEIGHT  480
+
+/*
+ * macro of read/write
+ */
+#define ECHECKER(x)   \
+  do {\
+  ret = x;\
+  if (ret  0)\
+  return ret; \
+  } while (0)
+
+#define mt9t112_reg_write(a, b)  ECHECKER(__mt9t112_reg_write(client, a,
b))
+#define mt9t112_mcu_write(a, b)  ECHECKER(__mt9t112_mcu_write(client, a,
b))
+
+#define mt9t112_reg_mask_set(a, b, c)\
+  ECHECKER(__mt9t112_reg_mask_set(client, a, b, c))
+#define mt9t112_mcu_mask_set(a, b, c)\
+  ECHECKER(__mt9t112_mcu_mask_set(client, a, b, c))
+
+#define

RE: [PATCH] soc-camera: Add mt9t112 camera support

2009-11-19 Thread Guennadi Liakhovetski
On Thu, 19 Nov 2009, Karicheri, Muralidharan wrote:

 Hi,
 
 Please make this a generic driver so that it can be used across
 other SoCs as well. BTW, on which SoC have you tested this driver?
 There seems to be a lot of soc-camera specific stuffs here.
 Example, probe() is getting a pointer to struct soc_camera_device *icd. 
 I have been working with Guennadi to make the MT9T031.c driver work for 
 TI's VPFE on DMxxx SOCs. since this is a new driver, I would like to see 
 it de-coupled from soc-camera framework and implemented as a generic 
 v4l2-subdevice driver.

Murali, yes, our aim is to make sensor drivers universally usable, using 
the v4l2-subdev API. But ATM sensor drivers, written and tested to work 
with soc-camera hosts, cannot be absolutely soc-camera free. Although, we 
can (and shall) try to make them at least partially usable outside of the 
soc-camera framework, as I have done with the mt9t031 driver. ATM this 
driver would refuse to work with a non soc-camera host, or even 
misfunction, if that host driver is using i2c client platform data for 
something else. Yes, we'll fix this, but don't expect it to become 
absolutely soc-camera free for now.

Thanks
Guennadi
---
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: [PATCH] soc-camera: Add mt9t112 camera support

2009-11-19 Thread Karicheri, Muralidharan
Guennadi,

I am not sure what you mean by ATM sensor. Is it not a
Aptina/Micron sensor giving Raw Bayer RGB or Yuv data?
Not sure what prevents it from interfacing with VPFE.
In otherwords, how is this different from mt9t031/mt9t001
in terms of hardware signals available to interface to
a SOC?

Murali Karicheri
Software Design Engineer
Texas Instruments Inc.
Germantown, MD 20874
phone: 301-407-9583
email: m-kariche...@ti.com

-Original Message-
From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
ow...@vger.kernel.org] On Behalf Of Guennadi Liakhovetski
Sent: Thursday, November 19, 2009 9:55 AM
To: Karicheri, Muralidharan
Cc: Kuninori Morimoto; Linux-V4L2
Subject: RE: [PATCH] soc-camera: Add mt9t112 camera support

On Thu, 19 Nov 2009, Karicheri, Muralidharan wrote:

 Hi,

 Please make this a generic driver so that it can be used across
 other SoCs as well. BTW, on which SoC have you tested this driver?
 There seems to be a lot of soc-camera specific stuffs here.
 Example, probe() is getting a pointer to struct soc_camera_device *icd.
 I have been working with Guennadi to make the MT9T031.c driver work for
 TI's VPFE on DMxxx SOCs. since this is a new driver, I would like to see
 it de-coupled from soc-camera framework and implemented as a generic
 v4l2-subdevice driver.

Murali, yes, our aim is to make sensor drivers universally usable, using
the v4l2-subdev API. But ATM sensor drivers, written and tested to work
with soc-camera hosts, cannot be absolutely soc-camera free. Although, we
can (and shall) try to make them at least partially usable outside of the
soc-camera framework, as I have done with the mt9t031 driver. ATM this
driver would refuse to work with a non soc-camera host, or even
misfunction, if that host driver is using i2c client platform data for
something else. Yes, we'll fix this, but don't expect it to become
absolutely soc-camera free for now.

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

--
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] soc-camera: Add mt9t112 camera support

2009-11-19 Thread Guennadi Liakhovetski
On Thu, 19 Nov 2009, Karicheri, Muralidharan wrote:

 Guennadi,
 
 I am not sure what you mean by ATM sensor.

ATM = At the moment.

 Is it not a
 Aptina/Micron sensor giving Raw Bayer RGB or Yuv data?

I presume it is.

 Not sure what prevents it from interfacing with VPFE.
 In otherwords, how is this different from mt9t031/mt9t001
 in terms of hardware signals available to interface to
 a SOC?

It is not. It just has been developed for a host, using soc-camera. And so 
you have to use soc-camera functionality, like query/set_bus_param, not 
yet available in v4l2-subdev, to get this client driver to work with that 
host driver.

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