All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-17  9:34 ` Martin Hostettler
  0 siblings, 0 replies; 27+ messages in thread
From: Martin Hostettler @ 2011-09-17  9:34 UTC (permalink / raw)
  To: Laurent Pinchart, Tony Lindgren, linux-omap
  Cc: linux-media, linux-arm-kernel, Martin Hostettler

Adds board support for an MT9M032 based camera to omap3evm.

Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
---
 arch/arm/mach-omap2/Makefile                |    1 +
 arch/arm/mach-omap2/board-omap3evm-camera.c |  183 +++++++++++++++++++++++++++
 2 files changed, 184 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c

Changes in V2:
 * ported to current mainline
 * Style fixes
 * Fix error handling

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index f343365..8ae3d25 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
 obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
+					   board-omap3evm-camera.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
 					   hsmmc.o
diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c b/arch/arm/mach-omap2/board-omap3evm-camera.c
new file mode 100644
index 0000000..be987d9
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2010-2011 Lund Engineering
+ * Contact: Gil Lund <gwlund@lundeng.com>
+ * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
+ *
+ * Board intregration for a MT9M032 camera connected to IMAGE_CONN and I2C Bus 2
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+
+#include <linux/gpio.h>
+#include <plat/mux.h>
+#include "mux.h"
+
+#include "../../../drivers/media/video/omap3isp/isp.h"
+#include "media/mt9m032.h"
+
+#include "devices.h"
+
+#define EVM_TWL_GPIO_BASE OMAP_MAX_GPIO_LINES
+#define GPIO98_VID_DEC_RES	98
+#define nCAM_VD_SEL		157
+
+#define MT9M032_I2C_BUS_NUM	2
+
+
+enum omap3evmdc_mux {
+	MUX_TVP5146,
+	MUX_CAMERA_SENSOR,
+	MUX_EXP_CAMERA_SENSOR,
+};
+
+/**
+ * omap3evm_set_mux - Sets mux to enable signal routing to
+ *                           different peripherals present on new EVM board
+ * @mux_id: enum, mux id to enable
+ *
+ * Returns 0 for success or a negative error code
+ */
+static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
+{
+	/* Set GPIO6 = 1 */
+	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 6, 1);
+	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
+
+	switch (mux_id) {
+	case MUX_TVP5146:
+		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
+		gpio_set_value(nCAM_VD_SEL, 1);
+		break;
+
+	case MUX_CAMERA_SENSOR:
+		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
+		gpio_set_value(nCAM_VD_SEL, 0);
+		break;
+
+	case MUX_EXP_CAMERA_SENSOR:
+		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 1);
+		break;
+
+	default:
+		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static struct mt9m032_platform_data mt9m032_platform_data = {
+	.ext_clock = 13500000,
+	.pll_pre_div = 6,
+	.pll_mul = 120,
+	.pll_out_div = 5,
+	.invert_pixclock = 1,
+};
+
+static struct i2c_board_info camera_i2c_devices[] = {
+	{
+		I2C_BOARD_INFO(MT9M032_NAME, MT9M032_I2C_ADDR),
+		.platform_data = &mt9m032_platform_data,
+	},
+};
+
+static struct isp_subdev_i2c_board_info camera_i2c_subdevs[] = {
+	{
+		.board_info = &camera_i2c_devices[0],
+		.i2c_adapter_id = MT9M032_I2C_BUS_NUM,
+	},
+	{},
+};
+
+static struct isp_v4l2_subdevs_group camera_subdevs[] = {
+	{
+		.subdevs = camera_i2c_subdevs,
+		.interface = ISP_INTERFACE_PARALLEL,
+		.bus = {
+			.parallel = {
+				.data_lane_shift = 1,
+				.clk_pol = 0,
+				.bridge = ISPCTRL_PAR_BRIDGE_DISABLE,
+			}
+		},
+	},
+	{},
+};
+
+static struct isp_platform_data isp_platform_data = {
+	.subdevs = camera_subdevs,
+};
+
+static int __init camera_init(void)
+{
+	int ret = -EINVAL;
+	
+	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
+	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
+		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
+		       nCAM_VD_SEL);
+		goto err;
+	}
+	if (gpio_direction_output(nCAM_VD_SEL, 1) < 0) {
+		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d) direction\n",
+		       nCAM_VD_SEL);
+		goto err_vdsel;
+	}
+
+	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2") < 0) {
+		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
+		       EVM_TWL_GPIO_BASE + 2);
+		goto err_vdsel;
+	}
+	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0) < 0) {
+		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) direction\n",
+		       EVM_TWL_GPIO_BASE + 2);
+		goto err_2;
+	}
+
+	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN") < 0) {
+		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
+		       EVM_TWL_GPIO_BASE + 8);
+		goto err_2;
+	}
+	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0) < 0) {
+		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d) direction\n",
+		       EVM_TWL_GPIO_BASE + 8);
+		goto err_8;
+	}
+
+	omap3evm_set_mux(MUX_CAMERA_SENSOR);
+
+	
+	ret = omap3_init_camera(&isp_platform_data);
+	if (ret < 0)
+		goto err_8;
+	return 0;
+	
+err_8:
+	gpio_free(EVM_TWL_GPIO_BASE + 8);
+err_2:
+	gpio_free(EVM_TWL_GPIO_BASE + 2);
+err_vdsel:
+	gpio_free(nCAM_VD_SEL);
+err:
+	return ret;
+}
+
+device_initcall(camera_init);
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-17  9:34 ` Martin Hostettler
  0 siblings, 0 replies; 27+ messages in thread
From: Martin Hostettler @ 2011-09-17  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

Adds board support for an MT9M032 based camera to omap3evm.

Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
---
 arch/arm/mach-omap2/Makefile                |    1 +
 arch/arm/mach-omap2/board-omap3evm-camera.c |  183 +++++++++++++++++++++++++++
 2 files changed, 184 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c

Changes in V2:
 * ported to current mainline
 * Style fixes
 * Fix error handling

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index f343365..8ae3d25 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        += board-omap3logic.o \
 obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
+					   board-omap3evm-camera.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
 					   hsmmc.o
diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c b/arch/arm/mach-omap2/board-omap3evm-camera.c
new file mode 100644
index 0000000..be987d9
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2010-2011 Lund Engineering
+ * Contact: Gil Lund <gwlund@lundeng.com>
+ * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
+ *
+ * Board intregration for a MT9M032 camera connected to IMAGE_CONN and I2C Bus 2
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+
+#include <linux/gpio.h>
+#include <plat/mux.h>
+#include "mux.h"
+
+#include "../../../drivers/media/video/omap3isp/isp.h"
+#include "media/mt9m032.h"
+
+#include "devices.h"
+
+#define EVM_TWL_GPIO_BASE OMAP_MAX_GPIO_LINES
+#define GPIO98_VID_DEC_RES	98
+#define nCAM_VD_SEL		157
+
+#define MT9M032_I2C_BUS_NUM	2
+
+
+enum omap3evmdc_mux {
+	MUX_TVP5146,
+	MUX_CAMERA_SENSOR,
+	MUX_EXP_CAMERA_SENSOR,
+};
+
+/**
+ * omap3evm_set_mux - Sets mux to enable signal routing to
+ *                           different peripherals present on new EVM board
+ * @mux_id: enum, mux id to enable
+ *
+ * Returns 0 for success or a negative error code
+ */
+static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
+{
+	/* Set GPIO6 = 1 */
+	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 6, 1);
+	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
+
+	switch (mux_id) {
+	case MUX_TVP5146:
+		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
+		gpio_set_value(nCAM_VD_SEL, 1);
+		break;
+
+	case MUX_CAMERA_SENSOR:
+		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
+		gpio_set_value(nCAM_VD_SEL, 0);
+		break;
+
+	case MUX_EXP_CAMERA_SENSOR:
+		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 1);
+		break;
+
+	default:
+		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static struct mt9m032_platform_data mt9m032_platform_data = {
+	.ext_clock = 13500000,
+	.pll_pre_div = 6,
+	.pll_mul = 120,
+	.pll_out_div = 5,
+	.invert_pixclock = 1,
+};
+
+static struct i2c_board_info camera_i2c_devices[] = {
+	{
+		I2C_BOARD_INFO(MT9M032_NAME, MT9M032_I2C_ADDR),
+		.platform_data = &mt9m032_platform_data,
+	},
+};
+
+static struct isp_subdev_i2c_board_info camera_i2c_subdevs[] = {
+	{
+		.board_info = &camera_i2c_devices[0],
+		.i2c_adapter_id = MT9M032_I2C_BUS_NUM,
+	},
+	{},
+};
+
+static struct isp_v4l2_subdevs_group camera_subdevs[] = {
+	{
+		.subdevs = camera_i2c_subdevs,
+		.interface = ISP_INTERFACE_PARALLEL,
+		.bus = {
+			.parallel = {
+				.data_lane_shift = 1,
+				.clk_pol = 0,
+				.bridge = ISPCTRL_PAR_BRIDGE_DISABLE,
+			}
+		},
+	},
+	{},
+};
+
+static struct isp_platform_data isp_platform_data = {
+	.subdevs = camera_subdevs,
+};
+
+static int __init camera_init(void)
+{
+	int ret = -EINVAL;
+	
+	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
+	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
+		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
+		       nCAM_VD_SEL);
+		goto err;
+	}
+	if (gpio_direction_output(nCAM_VD_SEL, 1) < 0) {
+		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d) direction\n",
+		       nCAM_VD_SEL);
+		goto err_vdsel;
+	}
+
+	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2") < 0) {
+		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
+		       EVM_TWL_GPIO_BASE + 2);
+		goto err_vdsel;
+	}
+	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0) < 0) {
+		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) direction\n",
+		       EVM_TWL_GPIO_BASE + 2);
+		goto err_2;
+	}
+
+	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN") < 0) {
+		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
+		       EVM_TWL_GPIO_BASE + 8);
+		goto err_2;
+	}
+	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0) < 0) {
+		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d) direction\n",
+		       EVM_TWL_GPIO_BASE + 8);
+		goto err_8;
+	}
+
+	omap3evm_set_mux(MUX_CAMERA_SENSOR);
+
+	
+	ret = omap3_init_camera(&isp_platform_data);
+	if (ret < 0)
+		goto err_8;
+	return 0;
+	
+err_8:
+	gpio_free(EVM_TWL_GPIO_BASE + 8);
+err_2:
+	gpio_free(EVM_TWL_GPIO_BASE + 2);
+err_vdsel:
+	gpio_free(nCAM_VD_SEL);
+err:
+	return ret;
+}
+
+device_initcall(camera_init);
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-17  9:34 ` Martin Hostettler
@ 2011-09-17 20:24   ` Joe Perches
  -1 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2011-09-17 20:24 UTC (permalink / raw)
  To: Martin Hostettler
  Cc: Laurent Pinchart, Tony Lindgren, linux-omap, linux-arm-kernel,
	linux-media

On Sat, 2011-09-17 at 11:34 +0200, Martin Hostettler wrote:
> Adds board support for an MT9M032 based camera to omap3evm.

All of the logging messages could be
prefixed by the printk subsystem if you
add #define pr_fmt before any #include

> diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c b/arch/arm/mach-omap2/board-omap3evm-camera.c
[]
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
[]
> +static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
[]
> +	switch (mux_id) {
[]
> +	default:
> +		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);

		pr_err("Invalid mux id #%d\n", mux_id);
[]
> +static int __init camera_init(void)
[]
> +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> +		       nCAM_VD_SEL);

		pr_err("Failed to get GPIO nCAM_VD_SEL(%d)\n",
		       nCAM_VD_SEL);
etc.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-17 20:24   ` Joe Perches
  0 siblings, 0 replies; 27+ messages in thread
From: Joe Perches @ 2011-09-17 20:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 2011-09-17 at 11:34 +0200, Martin Hostettler wrote:
> Adds board support for an MT9M032 based camera to omap3evm.

All of the logging messages could be
prefixed by the printk subsystem if you
add #define pr_fmt before any #include

> diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c b/arch/arm/mach-omap2/board-omap3evm-camera.c
[]
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
[]
> +static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
[]
> +	switch (mux_id) {
[]
> +	default:
> +		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);

		pr_err("Invalid mux id #%d\n", mux_id);
[]
> +static int __init camera_init(void)
[]
> +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> +		       nCAM_VD_SEL);

		pr_err("Failed to get GPIO nCAM_VD_SEL(%d)\n",
		       nCAM_VD_SEL);
etc.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-17  9:34 ` Martin Hostettler
@ 2011-09-17 22:00   ` Sylwester Nawrocki
  -1 siblings, 0 replies; 27+ messages in thread
From: Sylwester Nawrocki @ 2011-09-17 22:00 UTC (permalink / raw)
  To: Martin Hostettler
  Cc: Laurent Pinchart, Tony Lindgren, linux-omap, linux-media,
	linux-arm-kernel

On 09/17/2011 11:34 AM, Martin Hostettler wrote:
> Adds board support for an MT9M032 based camera to omap3evm.
...
> +
> +static int __init camera_init(void)
> +{
> +	int ret = -EINVAL;
> +	
> +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL")<  0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> +		       nCAM_VD_SEL);
> +		goto err;
> +	}
> +	if (gpio_direction_output(nCAM_VD_SEL, 1)<  0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d) direction\n",
> +		       nCAM_VD_SEL);
> +		goto err_vdsel;
> +	}

How about replacing gpio_request + gpio_direction_output with:

	gpio_request_one(nCAM_VD_SEL, GPIOF_OUT_INIT_HIGH, "nCAM_VD_SEL");

> +
> +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2")<  0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> +		       EVM_TWL_GPIO_BASE + 2);
> +		goto err_vdsel;
> +	}
> +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0)<  0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) direction\n",
> +		       EVM_TWL_GPIO_BASE + 2);
> +		goto err_2;
> +	}

 	gpio_request_one(EVM_TWL_GPIO_BASE + 2, GPIOF_OUT_INIT_LOW, "T2_GPIO2");

> +
> +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN")<  0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> +		       EVM_TWL_GPIO_BASE + 8);
> +		goto err_2;
> +	}
> +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0)<  0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d) direction\n",
> +		       EVM_TWL_GPIO_BASE + 8);
> +		goto err_8;
> +	}

...and	gpio_request_one(EVM_TWL_GPIO_BASE + 8, GPIOF_OUT_INIT_LOW, "nCAM_VD_EN") ?

> +
> +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> +
> +	
> +	ret = omap3_init_camera(&isp_platform_data);
> +	if (ret<  0)
> +		goto err_8;
> +	return 0;
> +	
> +err_8:
> +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> +err_2:
> +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> +err_vdsel:
> +	gpio_free(nCAM_VD_SEL);
> +err:
> +	return ret;
> +}
> +
> +device_initcall(camera_init);

--
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-17 22:00   ` Sylwester Nawrocki
  0 siblings, 0 replies; 27+ messages in thread
From: Sylwester Nawrocki @ 2011-09-17 22:00 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/17/2011 11:34 AM, Martin Hostettler wrote:
> Adds board support for an MT9M032 based camera to omap3evm.
...
> +
> +static int __init camera_init(void)
> +{
> +	int ret = -EINVAL;
> +	
> +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL")<  0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> +		       nCAM_VD_SEL);
> +		goto err;
> +	}
> +	if (gpio_direction_output(nCAM_VD_SEL, 1)<  0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d) direction\n",
> +		       nCAM_VD_SEL);
> +		goto err_vdsel;
> +	}

How about replacing gpio_request + gpio_direction_output with:

	gpio_request_one(nCAM_VD_SEL, GPIOF_OUT_INIT_HIGH, "nCAM_VD_SEL");

> +
> +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2")<  0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> +		       EVM_TWL_GPIO_BASE + 2);
> +		goto err_vdsel;
> +	}
> +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0)<  0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) direction\n",
> +		       EVM_TWL_GPIO_BASE + 2);
> +		goto err_2;
> +	}

 	gpio_request_one(EVM_TWL_GPIO_BASE + 2, GPIOF_OUT_INIT_LOW, "T2_GPIO2");

> +
> +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN")<  0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> +		       EVM_TWL_GPIO_BASE + 8);
> +		goto err_2;
> +	}
> +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0)<  0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d) direction\n",
> +		       EVM_TWL_GPIO_BASE + 8);
> +		goto err_8;
> +	}

...and	gpio_request_one(EVM_TWL_GPIO_BASE + 8, GPIOF_OUT_INIT_LOW, "nCAM_VD_EN") ?

> +
> +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> +
> +	
> +	ret = omap3_init_camera(&isp_platform_data);
> +	if (ret<  0)
> +		goto err_8;
> +	return 0;
> +	
> +err_8:
> +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> +err_2:
> +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> +err_vdsel:
> +	gpio_free(nCAM_VD_SEL);
> +err:
> +	return ret;
> +}
> +
> +device_initcall(camera_init);

--
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-17 22:00   ` Sylwester Nawrocki
@ 2011-09-17 22:08     ` Laurent Pinchart
  -1 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2011-09-17 22:08 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: Martin Hostettler, Tony Lindgren, linux-omap, linux-media,
	linux-arm-kernel

On Sunday 18 September 2011 00:00:16 Sylwester Nawrocki wrote:
> On 09/17/2011 11:34 AM, Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> 
> ...
> 
> > +
> > +static int __init camera_init(void)
> > +{
> > +	int ret = -EINVAL;
> > +
> > +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL")<  0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > +		       nCAM_VD_SEL);
> > +		goto err;
> > +	}
> > +	if (gpio_direction_output(nCAM_VD_SEL, 1)<  0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> > direction\n", +		       nCAM_VD_SEL);
> > +		goto err_vdsel;
> > +	}
> 
> How about replacing gpio_request + gpio_direction_output with:
> 
> 	gpio_request_one(nCAM_VD_SEL, GPIOF_OUT_INIT_HIGH, "nCAM_VD_SEL");

I'd even propose gpio_request_array().

> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2")<  0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_vdsel;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0)<  0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) 
direction\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_2;
> > +	}
> 
>  	gpio_request_one(EVM_TWL_GPIO_BASE + 2, GPIOF_OUT_INIT_LOW, "T2_GPIO2");
> 
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN")<  0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_2;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0)<  0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d)
> > direction\n", +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_8;
> > +	}
> 
> ...and	gpio_request_one(EVM_TWL_GPIO_BASE + 8, GPIOF_OUT_INIT_LOW,
> "nCAM_VD_EN") ?
> 
> > +
> > +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> > +
> > +
> > +	ret = omap3_init_camera(&isp_platform_data);
> > +	if (ret<  0)
> > +		goto err_8;
> > +	return 0;
> > +
> > +err_8:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > +err_2:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > +err_vdsel:
> > +	gpio_free(nCAM_VD_SEL);
> > +err:
> > +	return ret;
> > +}
> > +
> > +device_initcall(camera_init);

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-17 22:08     ` Laurent Pinchart
  0 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2011-09-17 22:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Sunday 18 September 2011 00:00:16 Sylwester Nawrocki wrote:
> On 09/17/2011 11:34 AM, Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> 
> ...
> 
> > +
> > +static int __init camera_init(void)
> > +{
> > +	int ret = -EINVAL;
> > +
> > +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL")<  0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > +		       nCAM_VD_SEL);
> > +		goto err;
> > +	}
> > +	if (gpio_direction_output(nCAM_VD_SEL, 1)<  0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> > direction\n", +		       nCAM_VD_SEL);
> > +		goto err_vdsel;
> > +	}
> 
> How about replacing gpio_request + gpio_direction_output with:
> 
> 	gpio_request_one(nCAM_VD_SEL, GPIOF_OUT_INIT_HIGH, "nCAM_VD_SEL");

I'd even propose gpio_request_array().

> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2")<  0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_vdsel;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0)<  0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) 
direction\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_2;
> > +	}
> 
>  	gpio_request_one(EVM_TWL_GPIO_BASE + 2, GPIOF_OUT_INIT_LOW, "T2_GPIO2");
> 
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN")<  0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_2;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0)<  0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d)
> > direction\n", +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_8;
> > +	}
> 
> ...and	gpio_request_one(EVM_TWL_GPIO_BASE + 8, GPIOF_OUT_INIT_LOW,
> "nCAM_VD_EN") ?
> 
> > +
> > +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> > +
> > +
> > +	ret = omap3_init_camera(&isp_platform_data);
> > +	if (ret<  0)
> > +		goto err_8;
> > +	return 0;
> > +
> > +err_8:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > +err_2:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > +err_vdsel:
> > +	gpio_free(nCAM_VD_SEL);
> > +err:
> > +	return ret;
> > +}
> > +
> > +device_initcall(camera_init);

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-17 20:24   ` Joe Perches
@ 2011-09-18 20:10     ` martin at neutronstar.dyndns.org
  -1 siblings, 0 replies; 27+ messages in thread
From: martin @ 2011-09-18 20:10 UTC (permalink / raw)
  To: Joe Perches
  Cc: Laurent Pinchart, Tony Lindgren, linux-omap, linux-arm-kernel,
	linux-media

On Sat, Sep 17, 2011 at 01:24:29PM -0700, Joe Perches wrote:
> On Sat, 2011-09-17 at 11:34 +0200, Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> 
> All of the logging messages could be
> prefixed by the printk subsystem if you
> add #define pr_fmt before any #include

Ah, i didn't really knew about that feature yet. I really have to keep
that in mind when grepping for error messages in the future.

But i don't think it would help much, as i now reducted the total number
of pr_err calls to 2 in this patch.

Thanks for the idea anyway.

 - Martin Hostettler

> 
> > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c b/arch/arm/mach-omap2/board-omap3evm-camera.c
> []
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> []
> > +static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
> []
> > +	switch (mux_id) {
> []
> > +	default:
> > +		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);
> 
> 		pr_err("Invalid mux id #%d\n", mux_id);
> []
> > +static int __init camera_init(void)
> []
> > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > +		       nCAM_VD_SEL);
> 
> 		pr_err("Failed to get GPIO nCAM_VD_SEL(%d)\n",
> 		       nCAM_VD_SEL);
> etc.
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-18 20:10     ` martin at neutronstar.dyndns.org
  0 siblings, 0 replies; 27+ messages in thread
From: martin at neutronstar.dyndns.org @ 2011-09-18 20:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Sep 17, 2011 at 01:24:29PM -0700, Joe Perches wrote:
> On Sat, 2011-09-17 at 11:34 +0200, Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> 
> All of the logging messages could be
> prefixed by the printk subsystem if you
> add #define pr_fmt before any #include

Ah, i didn't really knew about that feature yet. I really have to keep
that in mind when grepping for error messages in the future.

But i don't think it would help much, as i now reducted the total number
of pr_err calls to 2 in this patch.

Thanks for the idea anyway.

 - Martin Hostettler

> 
> > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c b/arch/arm/mach-omap2/board-omap3evm-camera.c
> []
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> []
> > +static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
> []
> > +	switch (mux_id) {
> []
> > +	default:
> > +		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);
> 
> 		pr_err("Invalid mux id #%d\n", mux_id);
> []
> > +static int __init camera_init(void)
> []
> > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > +		       nCAM_VD_SEL);
> 
> 		pr_err("Failed to get GPIO nCAM_VD_SEL(%d)\n",
> 		       nCAM_VD_SEL);
> etc.
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-17 22:08     ` Laurent Pinchart
@ 2011-09-18 20:13       ` martin at neutronstar.dyndns.org
  -1 siblings, 0 replies; 27+ messages in thread
From: martin @ 2011-09-18 20:13 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Sylwester Nawrocki, Tony Lindgren, linux-omap, linux-media,
	linux-arm-kernel

On Sun, Sep 18, 2011 at 12:08:20AM +0200, Laurent Pinchart wrote:
> On Sunday 18 September 2011 00:00:16 Sylwester Nawrocki wrote:
> > On 09/17/2011 11:34 AM, Martin Hostettler wrote:
> > > Adds board support for an MT9M032 based camera to omap3evm.
> > 
> > ...
> > 
> > > +
> > > +static int __init camera_init(void)
> > > +{
> > > +	int ret = -EINVAL;
> > > +
> > > +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> > > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL")<  0) {
> > > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > > +		       nCAM_VD_SEL);
> > > +		goto err;
> > > +	}
> > > +	if (gpio_direction_output(nCAM_VD_SEL, 1)<  0) {
> > > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> > > direction\n", +		       nCAM_VD_SEL);
> > > +		goto err_vdsel;
> > > +	}
> > 
> > How about replacing gpio_request + gpio_direction_output with:
> > 
> > 	gpio_request_one(nCAM_VD_SEL, GPIOF_OUT_INIT_HIGH, "nCAM_VD_SEL");
> 
> I'd even propose gpio_request_array().
> 

Nice interface. Apart from a bit less detailed error reporting it nicely
simplifies the code. I'll make a new patch using that soon.

 - Martin Hostettler

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-18 20:13       ` martin at neutronstar.dyndns.org
  0 siblings, 0 replies; 27+ messages in thread
From: martin at neutronstar.dyndns.org @ 2011-09-18 20:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Sep 18, 2011 at 12:08:20AM +0200, Laurent Pinchart wrote:
> On Sunday 18 September 2011 00:00:16 Sylwester Nawrocki wrote:
> > On 09/17/2011 11:34 AM, Martin Hostettler wrote:
> > > Adds board support for an MT9M032 based camera to omap3evm.
> > 
> > ...
> > 
> > > +
> > > +static int __init camera_init(void)
> > > +{
> > > +	int ret = -EINVAL;
> > > +
> > > +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> > > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL")<  0) {
> > > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > > +		       nCAM_VD_SEL);
> > > +		goto err;
> > > +	}
> > > +	if (gpio_direction_output(nCAM_VD_SEL, 1)<  0) {
> > > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> > > direction\n", +		       nCAM_VD_SEL);
> > > +		goto err_vdsel;
> > > +	}
> > 
> > How about replacing gpio_request + gpio_direction_output with:
> > 
> > 	gpio_request_one(nCAM_VD_SEL, GPIOF_OUT_INIT_HIGH, "nCAM_VD_SEL");
> 
> I'd even propose gpio_request_array().
> 

Nice interface. Apart from a bit less detailed error reporting it nicely
simplifies the code. I'll make a new patch using that soon.

 - Martin Hostettler

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-17  9:34 ` Martin Hostettler
@ 2011-09-18 21:58   ` Laurent Pinchart
  -1 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2011-09-18 21:58 UTC (permalink / raw)
  To: Martin Hostettler
  Cc: Tony Lindgren, linux-omap, linux-media, linux-arm-kernel

Hi Martin,

On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> Adds board support for an MT9M032 based camera to omap3evm.
> 
> Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> ---
>  arch/arm/mach-omap2/Makefile                |    1 +
>  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> deletions(-)
>  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> 
> Changes in V2:
>  * ported to current mainline
>  * Style fixes
>  * Fix error handling
> 
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index f343365..8ae3d25 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
>  					   hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> +					   board-omap3evm-camera.o \
>  					   hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
>  					   hsmmc.o
> diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> index 0000000..be987d9
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> @@ -0,0 +1,183 @@
> +/*
> + * Copyright (C) 2010-2011 Lund Engineering
> + * Contact: Gil Lund <gwlund@lundeng.com>
> + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> + *
> + * Board intregration for a MT9M032 camera connected to IMAGE_CONN and I2C
> Bus 2 + *
> + * 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.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +
> +#include <linux/gpio.h>
> +#include <plat/mux.h>
> +#include "mux.h"
> +
> +#include "../../../drivers/media/video/omap3isp/isp.h"
> +#include "media/mt9m032.h"
> +
> +#include "devices.h"
> +
> +#define EVM_TWL_GPIO_BASE OMAP_MAX_GPIO_LINES
> +#define GPIO98_VID_DEC_RES	98
> +#define nCAM_VD_SEL		157
> +
> +#define MT9M032_I2C_BUS_NUM	2
> +
> +
> +enum omap3evmdc_mux {
> +	MUX_TVP5146,
> +	MUX_CAMERA_SENSOR,
> +	MUX_EXP_CAMERA_SENSOR,
> +};
> +
> +/**
> + * omap3evm_set_mux - Sets mux to enable signal routing to
> + *                           different peripherals present on new EVM
> board + * @mux_id: enum, mux id to enable
> + *
> + * Returns 0 for success or a negative error code
> + */
> +static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
> +{
> +	/* Set GPIO6 = 1 */
> +	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 6, 1);
> +	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> +
> +	switch (mux_id) {
> +	case MUX_TVP5146:
> +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> +		gpio_set_value(nCAM_VD_SEL, 1);
> +		break;
> +
> +	case MUX_CAMERA_SENSOR:
> +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> +		gpio_set_value(nCAM_VD_SEL, 0);
> +		break;
> +
> +	case MUX_EXP_CAMERA_SENSOR:
> +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 1);
> +		break;
> +
> +	default:
> +		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +static struct mt9m032_platform_data mt9m032_platform_data = {
> +	.ext_clock = 13500000,
> +	.pll_pre_div = 6,
> +	.pll_mul = 120,
> +	.pll_out_div = 5,
> +	.invert_pixclock = 1,
> +};
> +
> +static struct i2c_board_info camera_i2c_devices[] = {
> +	{
> +		I2C_BOARD_INFO(MT9M032_NAME, MT9M032_I2C_ADDR),
> +		.platform_data = &mt9m032_platform_data,
> +	},
> +};
> +
> +static struct isp_subdev_i2c_board_info camera_i2c_subdevs[] = {
> +	{
> +		.board_info = &camera_i2c_devices[0],
> +		.i2c_adapter_id = MT9M032_I2C_BUS_NUM,
> +	},
> +	{},
> +};
> +
> +static struct isp_v4l2_subdevs_group camera_subdevs[] = {
> +	{
> +		.subdevs = camera_i2c_subdevs,
> +		.interface = ISP_INTERFACE_PARALLEL,
> +		.bus = {
> +			.parallel = {
> +				.data_lane_shift = 1,
> +				.clk_pol = 0,
> +				.bridge = ISPCTRL_PAR_BRIDGE_DISABLE,
> +			}
> +		},
> +	},
> +	{},
> +};
> +
> +static struct isp_platform_data isp_platform_data = {
> +	.subdevs = camera_subdevs,
> +};
> +
> +static int __init camera_init(void)
> +{
> +	int ret = -EINVAL;
> +
> +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> +		       nCAM_VD_SEL);
> +		goto err;
> +	}
> +	if (gpio_direction_output(nCAM_VD_SEL, 1) < 0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> direction\n", +		       nCAM_VD_SEL);
> +		goto err_vdsel;
> +	}
> +
> +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2") < 0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> +		       EVM_TWL_GPIO_BASE + 2);
> +		goto err_vdsel;
> +	}
> +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0) < 0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) direction\n",
> +		       EVM_TWL_GPIO_BASE + 2);
> +		goto err_2;
> +	}
> +
> +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN") < 0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> +		       EVM_TWL_GPIO_BASE + 8);
> +		goto err_2;
> +	}
> +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0) < 0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d) direction\n",
> +		       EVM_TWL_GPIO_BASE + 8);
> +		goto err_8;
> +	}
> +
> +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> +
> +
> +	ret = omap3_init_camera(&isp_platform_data);
> +	if (ret < 0)
> +		goto err_8;
> +	return 0;
> +
> +err_8:
> +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> +err_2:
> +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> +err_vdsel:
> +	gpio_free(nCAM_VD_SEL);
> +err:
> +	return ret;
> +}
> +
> +device_initcall(camera_init);

Please don't use device_initcall(), but call the function directly from the 
OMAP3 EVM init handler. Otherwise camera_init() will be called if OMAP3 EVM 
support is compiled in the kernel, regardless of the board the kernel runs on.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-18 21:58   ` Laurent Pinchart
  0 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2011-09-18 21:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Martin,

On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> Adds board support for an MT9M032 based camera to omap3evm.
> 
> Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> ---
>  arch/arm/mach-omap2/Makefile                |    1 +
>  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> deletions(-)
>  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> 
> Changes in V2:
>  * ported to current mainline
>  * Style fixes
>  * Fix error handling
> 
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index f343365..8ae3d25 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
>  					   hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> +					   board-omap3evm-camera.o \
>  					   hsmmc.o
>  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
>  					   hsmmc.o
> diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> index 0000000..be987d9
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> @@ -0,0 +1,183 @@
> +/*
> + * Copyright (C) 2010-2011 Lund Engineering
> + * Contact: Gil Lund <gwlund@lundeng.com>
> + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> + *
> + * Board intregration for a MT9M032 camera connected to IMAGE_CONN and I2C
> Bus 2 + *
> + * 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.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +
> +#include <linux/gpio.h>
> +#include <plat/mux.h>
> +#include "mux.h"
> +
> +#include "../../../drivers/media/video/omap3isp/isp.h"
> +#include "media/mt9m032.h"
> +
> +#include "devices.h"
> +
> +#define EVM_TWL_GPIO_BASE OMAP_MAX_GPIO_LINES
> +#define GPIO98_VID_DEC_RES	98
> +#define nCAM_VD_SEL		157
> +
> +#define MT9M032_I2C_BUS_NUM	2
> +
> +
> +enum omap3evmdc_mux {
> +	MUX_TVP5146,
> +	MUX_CAMERA_SENSOR,
> +	MUX_EXP_CAMERA_SENSOR,
> +};
> +
> +/**
> + * omap3evm_set_mux - Sets mux to enable signal routing to
> + *                           different peripherals present on new EVM
> board + * @mux_id: enum, mux id to enable
> + *
> + * Returns 0 for success or a negative error code
> + */
> +static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
> +{
> +	/* Set GPIO6 = 1 */
> +	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 6, 1);
> +	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> +
> +	switch (mux_id) {
> +	case MUX_TVP5146:
> +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> +		gpio_set_value(nCAM_VD_SEL, 1);
> +		break;
> +
> +	case MUX_CAMERA_SENSOR:
> +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> +		gpio_set_value(nCAM_VD_SEL, 0);
> +		break;
> +
> +	case MUX_EXP_CAMERA_SENSOR:
> +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 1);
> +		break;
> +
> +	default:
> +		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +static struct mt9m032_platform_data mt9m032_platform_data = {
> +	.ext_clock = 13500000,
> +	.pll_pre_div = 6,
> +	.pll_mul = 120,
> +	.pll_out_div = 5,
> +	.invert_pixclock = 1,
> +};
> +
> +static struct i2c_board_info camera_i2c_devices[] = {
> +	{
> +		I2C_BOARD_INFO(MT9M032_NAME, MT9M032_I2C_ADDR),
> +		.platform_data = &mt9m032_platform_data,
> +	},
> +};
> +
> +static struct isp_subdev_i2c_board_info camera_i2c_subdevs[] = {
> +	{
> +		.board_info = &camera_i2c_devices[0],
> +		.i2c_adapter_id = MT9M032_I2C_BUS_NUM,
> +	},
> +	{},
> +};
> +
> +static struct isp_v4l2_subdevs_group camera_subdevs[] = {
> +	{
> +		.subdevs = camera_i2c_subdevs,
> +		.interface = ISP_INTERFACE_PARALLEL,
> +		.bus = {
> +			.parallel = {
> +				.data_lane_shift = 1,
> +				.clk_pol = 0,
> +				.bridge = ISPCTRL_PAR_BRIDGE_DISABLE,
> +			}
> +		},
> +	},
> +	{},
> +};
> +
> +static struct isp_platform_data isp_platform_data = {
> +	.subdevs = camera_subdevs,
> +};
> +
> +static int __init camera_init(void)
> +{
> +	int ret = -EINVAL;
> +
> +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> +		       nCAM_VD_SEL);
> +		goto err;
> +	}
> +	if (gpio_direction_output(nCAM_VD_SEL, 1) < 0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> direction\n", +		       nCAM_VD_SEL);
> +		goto err_vdsel;
> +	}
> +
> +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2") < 0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> +		       EVM_TWL_GPIO_BASE + 2);
> +		goto err_vdsel;
> +	}
> +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0) < 0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) direction\n",
> +		       EVM_TWL_GPIO_BASE + 2);
> +		goto err_2;
> +	}
> +
> +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN") < 0) {
> +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> +		       EVM_TWL_GPIO_BASE + 8);
> +		goto err_2;
> +	}
> +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0) < 0) {
> +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d) direction\n",
> +		       EVM_TWL_GPIO_BASE + 8);
> +		goto err_8;
> +	}
> +
> +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> +
> +
> +	ret = omap3_init_camera(&isp_platform_data);
> +	if (ret < 0)
> +		goto err_8;
> +	return 0;
> +
> +err_8:
> +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> +err_2:
> +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> +err_vdsel:
> +	gpio_free(nCAM_VD_SEL);
> +err:
> +	return ret;
> +}
> +
> +device_initcall(camera_init);

Please don't use device_initcall(), but call the function directly from the 
OMAP3 EVM init handler. Otherwise camera_init() will be called if OMAP3 EVM 
support is compiled in the kernel, regardless of the board the kernel runs on.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 27+ messages in thread

* RE: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-18 21:58   ` Laurent Pinchart
@ 2011-09-19  6:07     ` Hiremath, Vaibhav
  -1 siblings, 0 replies; 27+ messages in thread
From: Hiremath, Vaibhav @ 2011-09-19  6:07 UTC (permalink / raw)
  To: Laurent Pinchart, Martin Hostettler
  Cc: Tony Lindgren, linux-omap, linux-media, linux-arm-kernel


> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Laurent Pinchart
> Sent: Monday, September 19, 2011 3:29 AM
> To: Martin Hostettler
> Cc: Tony Lindgren; linux-omap@vger.kernel.org; linux-
> media@vger.kernel.org; linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based
> camera board.
> 
> Hi Martin,
> 
> On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> >
> > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > ---
> >  arch/arm/mach-omap2/Makefile                |    1 +
> >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > deletions(-)
> >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> >
> > Changes in V2:
> >  * ported to current mainline
> >  * Style fixes
> >  * Fix error handling
> >
> > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > index f343365..8ae3d25 100644
> > --- a/arch/arm/mach-omap2/Makefile
> > +++ b/arch/arm/mach-omap2/Makefile
> > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
> >  					   hsmmc.o
> >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > +					   board-omap3evm-camera.o \
> >  					   hsmmc.o
> >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> >  					   hsmmc.o
> > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > index 0000000..be987d9
> > --- /dev/null
> > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > @@ -0,0 +1,183 @@
> > +/*
> > + * Copyright (C) 2010-2011 Lund Engineering
> > + * Contact: Gil Lund <gwlund@lundeng.com>
> > + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> > + *
[Hiremath, Vaibhav] The file below seems copied from (which is coming from all older releases of TI)

http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/board-omap3evm-camera.c;h=2e6ccfef69027dee880d507b98b5a7998d4bbe7e;hb=adcd067326836777c049e3cb32a5b7d9d401fc31

So I would appreciate if you keep original copyright and authorship of the file and add your sign-off to the patch.

Thanks,
Vaibhav

> > + * Board intregration for a MT9M032 camera connected to IMAGE_CONN and
> I2C
> > Bus 2 + *
> > + * 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.
> > + *
> > + * This program is distributed in the hope that it will be useful, but
> > + * WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> > + * 02110-1301 USA
> > + */
> > +
> > +#include <linux/i2c.h>
> > +#include <linux/init.h>
> > +#include <linux/platform_device.h>
> > +
> > +#include <linux/gpio.h>
> > +#include <plat/mux.h>
> > +#include "mux.h"
> > +
> > +#include "../../../drivers/media/video/omap3isp/isp.h"
> > +#include "media/mt9m032.h"
> > +
> > +#include "devices.h"
> > +
> > +#define EVM_TWL_GPIO_BASE OMAP_MAX_GPIO_LINES
> > +#define GPIO98_VID_DEC_RES	98
> > +#define nCAM_VD_SEL		157
> > +
> > +#define MT9M032_I2C_BUS_NUM	2
> > +
> > +
> > +enum omap3evmdc_mux {
> > +	MUX_TVP5146,
> > +	MUX_CAMERA_SENSOR,
> > +	MUX_EXP_CAMERA_SENSOR,
> > +};
> > +
> > +/**
> > + * omap3evm_set_mux - Sets mux to enable signal routing to
> > + *                           different peripherals present on new EVM
> > board + * @mux_id: enum, mux id to enable
> > + *
> > + * Returns 0 for success or a negative error code
> > + */
> > +static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
> > +{
> > +	/* Set GPIO6 = 1 */
> > +	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 6, 1);
> > +	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> > +
> > +	switch (mux_id) {
> > +	case MUX_TVP5146:
> > +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> > +		gpio_set_value(nCAM_VD_SEL, 1);
> > +		break;
> > +
> > +	case MUX_CAMERA_SENSOR:
> > +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> > +		gpio_set_value(nCAM_VD_SEL, 0);
> > +		break;
> > +
> > +	case MUX_EXP_CAMERA_SENSOR:
> > +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 1);
> > +		break;
> > +
> > +	default:
> > +		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static struct mt9m032_platform_data mt9m032_platform_data = {
> > +	.ext_clock = 13500000,
> > +	.pll_pre_div = 6,
> > +	.pll_mul = 120,
> > +	.pll_out_div = 5,
> > +	.invert_pixclock = 1,
> > +};
> > +
> > +static struct i2c_board_info camera_i2c_devices[] = {
> > +	{
> > +		I2C_BOARD_INFO(MT9M032_NAME, MT9M032_I2C_ADDR),
> > +		.platform_data = &mt9m032_platform_data,
> > +	},
> > +};
> > +
> > +static struct isp_subdev_i2c_board_info camera_i2c_subdevs[] = {
> > +	{
> > +		.board_info = &camera_i2c_devices[0],
> > +		.i2c_adapter_id = MT9M032_I2C_BUS_NUM,
> > +	},
> > +	{},
> > +};
> > +
> > +static struct isp_v4l2_subdevs_group camera_subdevs[] = {
> > +	{
> > +		.subdevs = camera_i2c_subdevs,
> > +		.interface = ISP_INTERFACE_PARALLEL,
> > +		.bus = {
> > +			.parallel = {
> > +				.data_lane_shift = 1,
> > +				.clk_pol = 0,
> > +				.bridge = ISPCTRL_PAR_BRIDGE_DISABLE,
> > +			}
> > +		},
> > +	},
> > +	{},
> > +};
> > +
> > +static struct isp_platform_data isp_platform_data = {
> > +	.subdevs = camera_subdevs,
> > +};
> > +
> > +static int __init camera_init(void)
> > +{
> > +	int ret = -EINVAL;
> > +
> > +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > +		       nCAM_VD_SEL);
> > +		goto err;
> > +	}
> > +	if (gpio_direction_output(nCAM_VD_SEL, 1) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> > direction\n", +		       nCAM_VD_SEL);
> > +		goto err_vdsel;
> > +	}
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_vdsel;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d)
> direction\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_2;
> > +	}
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_2;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d)
> direction\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_8;
> > +	}
> > +
> > +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> > +
> > +
> > +	ret = omap3_init_camera(&isp_platform_data);
> > +	if (ret < 0)
> > +		goto err_8;
> > +	return 0;
> > +
> > +err_8:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > +err_2:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > +err_vdsel:
> > +	gpio_free(nCAM_VD_SEL);
> > +err:
> > +	return ret;
> > +}
> > +
> > +device_initcall(camera_init);
> 
> Please don't use device_initcall(), but call the function directly from
> the
> OMAP3 EVM init handler. Otherwise camera_init() will be called if OMAP3
> EVM
> support is compiled in the kernel, regardless of the board the kernel runs
> on.
> 
> --
> Regards,
> 
> Laurent Pinchart
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-19  6:07     ` Hiremath, Vaibhav
  0 siblings, 0 replies; 27+ messages in thread
From: Hiremath, Vaibhav @ 2011-09-19  6:07 UTC (permalink / raw)
  To: linux-arm-kernel


> -----Original Message-----
> From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
> owner at vger.kernel.org] On Behalf Of Laurent Pinchart
> Sent: Monday, September 19, 2011 3:29 AM
> To: Martin Hostettler
> Cc: Tony Lindgren; linux-omap at vger.kernel.org; linux-
> media at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based
> camera board.
> 
> Hi Martin,
> 
> On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> >
> > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > ---
> >  arch/arm/mach-omap2/Makefile                |    1 +
> >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > deletions(-)
> >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> >
> > Changes in V2:
> >  * ported to current mainline
> >  * Style fixes
> >  * Fix error handling
> >
> > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > index f343365..8ae3d25 100644
> > --- a/arch/arm/mach-omap2/Makefile
> > +++ b/arch/arm/mach-omap2/Makefile
> > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
> >  					   hsmmc.o
> >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > +					   board-omap3evm-camera.o \
> >  					   hsmmc.o
> >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> >  					   hsmmc.o
> > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > index 0000000..be987d9
> > --- /dev/null
> > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > @@ -0,0 +1,183 @@
> > +/*
> > + * Copyright (C) 2010-2011 Lund Engineering
> > + * Contact: Gil Lund <gwlund@lundeng.com>
> > + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> > + *
[Hiremath, Vaibhav] The file below seems copied from (which is coming from all older releases of TI)

http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/board-omap3evm-camera.c;h=2e6ccfef69027dee880d507b98b5a7998d4bbe7e;hb=adcd067326836777c049e3cb32a5b7d9d401fc31

So I would appreciate if you keep original copyright and authorship of the file and add your sign-off to the patch.

Thanks,
Vaibhav

> > + * Board intregration for a MT9M032 camera connected to IMAGE_CONN and
> I2C
> > Bus 2 + *
> > + * 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.
> > + *
> > + * This program is distributed in the hope that it will be useful, but
> > + * WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> > + * 02110-1301 USA
> > + */
> > +
> > +#include <linux/i2c.h>
> > +#include <linux/init.h>
> > +#include <linux/platform_device.h>
> > +
> > +#include <linux/gpio.h>
> > +#include <plat/mux.h>
> > +#include "mux.h"
> > +
> > +#include "../../../drivers/media/video/omap3isp/isp.h"
> > +#include "media/mt9m032.h"
> > +
> > +#include "devices.h"
> > +
> > +#define EVM_TWL_GPIO_BASE OMAP_MAX_GPIO_LINES
> > +#define GPIO98_VID_DEC_RES	98
> > +#define nCAM_VD_SEL		157
> > +
> > +#define MT9M032_I2C_BUS_NUM	2
> > +
> > +
> > +enum omap3evmdc_mux {
> > +	MUX_TVP5146,
> > +	MUX_CAMERA_SENSOR,
> > +	MUX_EXP_CAMERA_SENSOR,
> > +};
> > +
> > +/**
> > + * omap3evm_set_mux - Sets mux to enable signal routing to
> > + *                           different peripherals present on new EVM
> > board + * @mux_id: enum, mux id to enable
> > + *
> > + * Returns 0 for success or a negative error code
> > + */
> > +static int omap3evm_set_mux(enum omap3evmdc_mux mux_id)
> > +{
> > +	/* Set GPIO6 = 1 */
> > +	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 6, 1);
> > +	gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> > +
> > +	switch (mux_id) {
> > +	case MUX_TVP5146:
> > +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> > +		gpio_set_value(nCAM_VD_SEL, 1);
> > +		break;
> > +
> > +	case MUX_CAMERA_SENSOR:
> > +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 0);
> > +		gpio_set_value(nCAM_VD_SEL, 0);
> > +		break;
> > +
> > +	case MUX_EXP_CAMERA_SENSOR:
> > +		gpio_set_value_cansleep(EVM_TWL_GPIO_BASE + 2, 1);
> > +		break;
> > +
> > +	default:
> > +		pr_err("omap3evm-camera: Invalid mux id #%d\n", mux_id);
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static struct mt9m032_platform_data mt9m032_platform_data = {
> > +	.ext_clock = 13500000,
> > +	.pll_pre_div = 6,
> > +	.pll_mul = 120,
> > +	.pll_out_div = 5,
> > +	.invert_pixclock = 1,
> > +};
> > +
> > +static struct i2c_board_info camera_i2c_devices[] = {
> > +	{
> > +		I2C_BOARD_INFO(MT9M032_NAME, MT9M032_I2C_ADDR),
> > +		.platform_data = &mt9m032_platform_data,
> > +	},
> > +};
> > +
> > +static struct isp_subdev_i2c_board_info camera_i2c_subdevs[] = {
> > +	{
> > +		.board_info = &camera_i2c_devices[0],
> > +		.i2c_adapter_id = MT9M032_I2C_BUS_NUM,
> > +	},
> > +	{},
> > +};
> > +
> > +static struct isp_v4l2_subdevs_group camera_subdevs[] = {
> > +	{
> > +		.subdevs = camera_i2c_subdevs,
> > +		.interface = ISP_INTERFACE_PARALLEL,
> > +		.bus = {
> > +			.parallel = {
> > +				.data_lane_shift = 1,
> > +				.clk_pol = 0,
> > +				.bridge = ISPCTRL_PAR_BRIDGE_DISABLE,
> > +			}
> > +		},
> > +	},
> > +	{},
> > +};
> > +
> > +static struct isp_platform_data isp_platform_data = {
> > +	.subdevs = camera_subdevs,
> > +};
> > +
> > +static int __init camera_init(void)
> > +{
> > +	int ret = -EINVAL;
> > +
> > +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > +		       nCAM_VD_SEL);
> > +		goto err;
> > +	}
> > +	if (gpio_direction_output(nCAM_VD_SEL, 1) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> > direction\n", +		       nCAM_VD_SEL);
> > +		goto err_vdsel;
> > +	}
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_vdsel;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d)
> direction\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_2;
> > +	}
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_2;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d)
> direction\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_8;
> > +	}
> > +
> > +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> > +
> > +
> > +	ret = omap3_init_camera(&isp_platform_data);
> > +	if (ret < 0)
> > +		goto err_8;
> > +	return 0;
> > +
> > +err_8:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > +err_2:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > +err_vdsel:
> > +	gpio_free(nCAM_VD_SEL);
> > +err:
> > +	return ret;
> > +}
> > +
> > +device_initcall(camera_init);
> 
> Please don't use device_initcall(), but call the function directly from
> the
> OMAP3 EVM init handler. Otherwise camera_init() will be called if OMAP3
> EVM
> support is compiled in the kernel, regardless of the board the kernel runs
> on.
> 
> --
> Regards,
> 
> Laurent Pinchart
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-18 21:58   ` Laurent Pinchart
@ 2011-09-19  6:10     ` martin at neutronstar.dyndns.org
  -1 siblings, 0 replies; 27+ messages in thread
From: martin @ 2011-09-19  6:10 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Tony Lindgren, linux-omap, linux-media, linux-arm-kernel

On Sun, Sep 18, 2011 at 11:58:55PM +0200, Laurent Pinchart wrote:
> Hi Martin,
> 
> On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> > 
> > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > ---
> >  arch/arm/mach-omap2/Makefile                |    1 +
> >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > deletions(-)
> >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > 
> > Changes in V2:
> >  * ported to current mainline
> >  * Style fixes
> >  * Fix error handling
> > 
> > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > index f343365..8ae3d25 100644
> > --- a/arch/arm/mach-omap2/Makefile
> > +++ b/arch/arm/mach-omap2/Makefile
> > +	return 0;
> > +
> > +err_8:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > +err_2:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > +err_vdsel:
> > +	gpio_free(nCAM_VD_SEL);
> > +err:
> > +	return ret;
> > +}
> > +
> > +device_initcall(camera_init);
> 
> Please don't use device_initcall(), but call the function directly from the 
> OMAP3 EVM init handler. Otherwise camera_init() will be called if OMAP3 EVM 
> support is compiled in the kernel, regardless of the board the kernel runs on.

Ok, will do.
In which header should the prototyp of that function go? Or can i just 
add a prototyp to board-omap3evm.c directly?
I couldn't find anything that looked right, this is rather board specific
after all. 

 - Martin Hostettler

> 
> -- 
> Regards,
> 
> Laurent Pinchart

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-19  6:10     ` martin at neutronstar.dyndns.org
  0 siblings, 0 replies; 27+ messages in thread
From: martin at neutronstar.dyndns.org @ 2011-09-19  6:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Sep 18, 2011 at 11:58:55PM +0200, Laurent Pinchart wrote:
> Hi Martin,
> 
> On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> > 
> > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > ---
> >  arch/arm/mach-omap2/Makefile                |    1 +
> >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > deletions(-)
> >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > 
> > Changes in V2:
> >  * ported to current mainline
> >  * Style fixes
> >  * Fix error handling
> > 
> > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > index f343365..8ae3d25 100644
> > --- a/arch/arm/mach-omap2/Makefile
> > +++ b/arch/arm/mach-omap2/Makefile
> > +	return 0;
> > +
> > +err_8:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > +err_2:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > +err_vdsel:
> > +	gpio_free(nCAM_VD_SEL);
> > +err:
> > +	return ret;
> > +}
> > +
> > +device_initcall(camera_init);
> 
> Please don't use device_initcall(), but call the function directly from the 
> OMAP3 EVM init handler. Otherwise camera_init() will be called if OMAP3 EVM 
> support is compiled in the kernel, regardless of the board the kernel runs on.

Ok, will do.
In which header should the prototyp of that function go? Or can i just 
add a prototyp to board-omap3evm.c directly?
I couldn't find anything that looked right, this is rather board specific
after all. 

 - Martin Hostettler

> 
> -- 
> Regards,
> 
> Laurent Pinchart

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-19  6:10     ` martin at neutronstar.dyndns.org
@ 2011-09-19  8:01       ` Laurent Pinchart
  -1 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2011-09-19  8:01 UTC (permalink / raw)
  To: martin; +Cc: Tony Lindgren, linux-omap, linux-media, linux-arm-kernel

Hi Martin,

On Monday 19 September 2011 08:10:19 martin@neutronstar.dyndns.org wrote:
> On Sun, Sep 18, 2011 at 11:58:55PM +0200, Laurent Pinchart wrote:
> > On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > > Adds board support for an MT9M032 based camera to omap3evm.
> > > 
> > > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > ---
> > > 
> > >  arch/arm/mach-omap2/Makefile                |    1 +
> > >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > > 
> > > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > > deletions(-)
> > > 
> > >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > > 
> > > Changes in V2:
> > >  * ported to current mainline
> > >  * Style fixes
> > >  * Fix error handling
> > > 
> > > diff --git a/arch/arm/mach-omap2/Makefile
> > > b/arch/arm/mach-omap2/Makefile index f343365..8ae3d25 100644
> > > --- a/arch/arm/mach-omap2/Makefile
> > > +++ b/arch/arm/mach-omap2/Makefile
> > > +	return 0;
> > > +
> > > +err_8:
> > > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > > +err_2:
> > > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > > +err_vdsel:
> > > +	gpio_free(nCAM_VD_SEL);
> > > +err:
> > > +	return ret;
> > > +}
> > > +
> > > +device_initcall(camera_init);
> > 
> > Please don't use device_initcall(), but call the function directly from
> > the OMAP3 EVM init handler. Otherwise camera_init() will be called if
> > OMAP3 EVM support is compiled in the kernel, regardless of the board the
> > kernel runs on.
> 
> Ok, will do.
> In which header should the prototyp of that function go? Or can i just
> add a prototyp to board-omap3evm.c directly?
> I couldn't find anything that looked right, this is rather board specific
> after all.

You can either create arch/arm/mach-omap2/board-omap3evm.h or add the 
prototype to board-omap3evm.c.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-19  8:01       ` Laurent Pinchart
  0 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2011-09-19  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Martin,

On Monday 19 September 2011 08:10:19 martin at neutronstar.dyndns.org wrote:
> On Sun, Sep 18, 2011 at 11:58:55PM +0200, Laurent Pinchart wrote:
> > On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > > Adds board support for an MT9M032 based camera to omap3evm.
> > > 
> > > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > ---
> > > 
> > >  arch/arm/mach-omap2/Makefile                |    1 +
> > >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > > 
> > > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > > deletions(-)
> > > 
> > >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > > 
> > > Changes in V2:
> > >  * ported to current mainline
> > >  * Style fixes
> > >  * Fix error handling
> > > 
> > > diff --git a/arch/arm/mach-omap2/Makefile
> > > b/arch/arm/mach-omap2/Makefile index f343365..8ae3d25 100644
> > > --- a/arch/arm/mach-omap2/Makefile
> > > +++ b/arch/arm/mach-omap2/Makefile
> > > +	return 0;
> > > +
> > > +err_8:
> > > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > > +err_2:
> > > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > > +err_vdsel:
> > > +	gpio_free(nCAM_VD_SEL);
> > > +err:
> > > +	return ret;
> > > +}
> > > +
> > > +device_initcall(camera_init);
> > 
> > Please don't use device_initcall(), but call the function directly from
> > the OMAP3 EVM init handler. Otherwise camera_init() will be called if
> > OMAP3 EVM support is compiled in the kernel, regardless of the board the
> > kernel runs on.
> 
> Ok, will do.
> In which header should the prototyp of that function go? Or can i just
> add a prototyp to board-omap3evm.c directly?
> I couldn't find anything that looked right, this is rather board specific
> after all.

You can either create arch/arm/mach-omap2/board-omap3evm.h or add the 
prototype to board-omap3evm.c.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-18 21:58   ` Laurent Pinchart
@ 2011-09-19 19:17     ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 27+ messages in thread
From: Guennadi Liakhovetski @ 2011-09-19 19:17 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Martin Hostettler, Tony Lindgren, linux-omap, linux-media,
	linux-arm-kernel

Hi

On Sun, 18 Sep 2011, Laurent Pinchart wrote:

> Hi Martin,
> 
> On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> > 
> > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > ---
> >  arch/arm/mach-omap2/Makefile                |    1 +
> >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > deletions(-)
> >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > 
> > Changes in V2:
> >  * ported to current mainline
> >  * Style fixes
> >  * Fix error handling
> > 
> > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > index f343365..8ae3d25 100644
> > --- a/arch/arm/mach-omap2/Makefile
> > +++ b/arch/arm/mach-omap2/Makefile
> > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
> >  					   hsmmc.o
> >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > +					   board-omap3evm-camera.o \
> >  					   hsmmc.o
> >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> >  					   hsmmc.o
> > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > index 0000000..be987d9
> > --- /dev/null
> > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > @@ -0,0 +1,183 @@

[snip]

> > +static int __init camera_init(void)
> > +{
> > +	int ret = -EINVAL;
> > +
> > +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > +		       nCAM_VD_SEL);
> > +		goto err;
> > +	}
> > +	if (gpio_direction_output(nCAM_VD_SEL, 1) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> > direction\n", +		       nCAM_VD_SEL);
> > +		goto err_vdsel;
> > +	}
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_vdsel;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) direction\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_2;
> > +	}
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_2;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d) direction\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_8;
> > +	}
> > +
> > +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> > +
> > +
> > +	ret = omap3_init_camera(&isp_platform_data);
> > +	if (ret < 0)
> > +		goto err_8;
> > +	return 0;
> > +
> > +err_8:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > +err_2:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > +err_vdsel:
> > +	gpio_free(nCAM_VD_SEL);
> > +err:
> > +	return ret;
> > +}
> > +
> > +device_initcall(camera_init);
> 
> Please don't use device_initcall(), but call the function directly from the 
> OMAP3 EVM init handler. Otherwise camera_init() will be called if OMAP3 EVM 
> support is compiled in the kernel, regardless of the board the kernel runs on.

Another possibility is to put

	if (!machine_is_omap3evm())
		return 0;

in the beginning of the function. Probably, best to follow what other 
omap3 boards do.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-19 19:17     ` Guennadi Liakhovetski
  0 siblings, 0 replies; 27+ messages in thread
From: Guennadi Liakhovetski @ 2011-09-19 19:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi

On Sun, 18 Sep 2011, Laurent Pinchart wrote:

> Hi Martin,
> 
> On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > Adds board support for an MT9M032 based camera to omap3evm.
> > 
> > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > ---
> >  arch/arm/mach-omap2/Makefile                |    1 +
> >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > deletions(-)
> >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > 
> > Changes in V2:
> >  * ported to current mainline
> >  * Style fixes
> >  * Fix error handling
> > 
> > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > index f343365..8ae3d25 100644
> > --- a/arch/arm/mach-omap2/Makefile
> > +++ b/arch/arm/mach-omap2/Makefile
> > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
> >  					   hsmmc.o
> >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > +					   board-omap3evm-camera.o \
> >  					   hsmmc.o
> >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> >  					   hsmmc.o
> > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > index 0000000..be987d9
> > --- /dev/null
> > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > @@ -0,0 +1,183 @@

[snip]

> > +static int __init camera_init(void)
> > +{
> > +	int ret = -EINVAL;
> > +
> > +	omap_mux_init_gpio(nCAM_VD_SEL, OMAP_PIN_OUTPUT);
> > +	if (gpio_request(nCAM_VD_SEL, "nCAM_VD_SEL") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_SEL(%d)\n",
> > +		       nCAM_VD_SEL);
> > +		goto err;
> > +	}
> > +	if (gpio_direction_output(nCAM_VD_SEL, 1) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_SEL(%d)
> > direction\n", +		       nCAM_VD_SEL);
> > +		goto err_vdsel;
> > +	}
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 2, "T2_GPIO2") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO T2_GPIO2(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_vdsel;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 2, 0) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO T2_GPIO2(%d) direction\n",
> > +		       EVM_TWL_GPIO_BASE + 2);
> > +		goto err_2;
> > +	}
> > +
> > +	if (gpio_request(EVM_TWL_GPIO_BASE + 8, "nCAM_VD_EN") < 0) {
> > +		pr_err("omap3evm-camera: Failed to get GPIO nCAM_VD_EN(%d)\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_2;
> > +	}
> > +	if (gpio_direction_output(EVM_TWL_GPIO_BASE + 8, 0) < 0) {
> > +		pr_err("omap3evm-camera: Failed to set GPIO nCAM_VD_EN(%d) direction\n",
> > +		       EVM_TWL_GPIO_BASE + 8);
> > +		goto err_8;
> > +	}
> > +
> > +	omap3evm_set_mux(MUX_CAMERA_SENSOR);
> > +
> > +
> > +	ret = omap3_init_camera(&isp_platform_data);
> > +	if (ret < 0)
> > +		goto err_8;
> > +	return 0;
> > +
> > +err_8:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 8);
> > +err_2:
> > +	gpio_free(EVM_TWL_GPIO_BASE + 2);
> > +err_vdsel:
> > +	gpio_free(nCAM_VD_SEL);
> > +err:
> > +	return ret;
> > +}
> > +
> > +device_initcall(camera_init);
> 
> Please don't use device_initcall(), but call the function directly from the 
> OMAP3 EVM init handler. Otherwise camera_init() will be called if OMAP3 EVM 
> support is compiled in the kernel, regardless of the board the kernel runs on.

Another possibility is to put

	if (!machine_is_omap3evm())
		return 0;

in the beginning of the function. Probably, best to follow what other 
omap3 boards do.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-19  6:07     ` Hiremath, Vaibhav
  (?)
@ 2011-09-19 19:24       ` martin
  -1 siblings, 0 replies; 27+ messages in thread
From: martin @ 2011-09-19 19:24 UTC (permalink / raw)
  To: Hiremath, Vaibhav
  Cc: Laurent Pinchart, Tony Lindgren, linux-omap, linux-media,
	linux-arm-kernel

On Mon, Sep 19, 2011 at 11:37:37AM +0530, Hiremath, Vaibhav wrote:
> 
> > -----Original Message-----
> > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> > owner@vger.kernel.org] On Behalf Of Laurent Pinchart
> > Sent: Monday, September 19, 2011 3:29 AM
> > To: Martin Hostettler
> > Cc: Tony Lindgren; linux-omap@vger.kernel.org; linux-
> > media@vger.kernel.org; linux-arm-kernel@lists.infradead.org
> > Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based
> > camera board.
> > 
> > Hi Martin,
> > 
> > On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > > Adds board support for an MT9M032 based camera to omap3evm.
> > >
> > > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > ---
> > >  arch/arm/mach-omap2/Makefile                |    1 +
> > >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > > deletions(-)
> > >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > >
> > > Changes in V2:
> > >  * ported to current mainline
> > >  * Style fixes
> > >  * Fix error handling
> > >
> > > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > > index f343365..8ae3d25 100644
> > > --- a/arch/arm/mach-omap2/Makefile
> > > +++ b/arch/arm/mach-omap2/Makefile
> > > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
> > >  					   hsmmc.o
> > >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > > +					   board-omap3evm-camera.o \
> > >  					   hsmmc.o
> > >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> > >  					   hsmmc.o
> > > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > > index 0000000..be987d9
> > > --- /dev/null
> > > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > @@ -0,0 +1,183 @@
> > > +/*
> > > + * Copyright (C) 2010-2011 Lund Engineering
> > > + * Contact: Gil Lund <gwlund@lundeng.com>
> > > + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > + *
> [Hiremath, Vaibhav] The file below seems copied from (which is coming from all older releases of TI)
> 
> http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/board-omap3evm-camera.c;h=2e6ccfef69027dee880d507b98b5a7998d4bbe7e;hb=adcd067326836777c049e3cb32a5b7d9d401fc31
> 
> So I would appreciate if you keep original copyright and authorship of the file and add your sign-off to the patch.
> 

First of all i don't have any problem Adding your name and the TI
copyright.
Maybe i should have been more careful when looking at and adeption
omap3evm_set_mux as i really took that from the TI code.

I honestly don't remember if i took any other code from that file or not.
It ends up doing what the hardware needs anyway. For me it doesn't matter
with such trival things, but i should have been more careful.

Do you consider it resolved if use the following at the start?

/*
 * Copyright (C) 2010 Texas Instruments Inc
 * Copyright (C) 2010-2011 Lund Engineering
 * Contact: Gil Lund <gwlund@lundeng.com>
 * Authors:
 *    Vaibhav Hiremath <hvaibhav@ti.com>
 *    Martin Hostettler <martin@neutronstar.dyndns.org>
 */
 

But then again the copy on my harddisk has these too...

 * Contributors:
 *     Anuj Aggarwal <anuj.aggarwal@ti.com>
 *     Sivaraj R <sivaraj@ti.com>

Maybe i should add them too.

Not sure really...


 - Martin Hostettler

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-19 19:24       ` martin
  0 siblings, 0 replies; 27+ messages in thread
From: martin @ 2011-09-19 19:24 UTC (permalink / raw)
  To: Hiremath, Vaibhav
  Cc: Laurent Pinchart, Tony Lindgren, linux-omap, linux-media,
	linux-arm-kernel

On Mon, Sep 19, 2011 at 11:37:37AM +0530, Hiremath, Vaibhav wrote:
> 
> > -----Original Message-----
> > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> > owner@vger.kernel.org] On Behalf Of Laurent Pinchart
> > Sent: Monday, September 19, 2011 3:29 AM
> > To: Martin Hostettler
> > Cc: Tony Lindgren; linux-omap@vger.kernel.org; linux-
> > media@vger.kernel.org; linux-arm-kernel@lists.infradead.org
> > Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based
> > camera board.
> > 
> > Hi Martin,
> > 
> > On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > > Adds board support for an MT9M032 based camera to omap3evm.
> > >
> > > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > ---
> > >  arch/arm/mach-omap2/Makefile                |    1 +
> > >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > > deletions(-)
> > >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > >
> > > Changes in V2:
> > >  * ported to current mainline
> > >  * Style fixes
> > >  * Fix error handling
> > >
> > > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > > index f343365..8ae3d25 100644
> > > --- a/arch/arm/mach-omap2/Makefile
> > > +++ b/arch/arm/mach-omap2/Makefile
> > > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
> > >  					   hsmmc.o
> > >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > > +					   board-omap3evm-camera.o \
> > >  					   hsmmc.o
> > >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> > >  					   hsmmc.o
> > > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > > index 0000000..be987d9
> > > --- /dev/null
> > > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > @@ -0,0 +1,183 @@
> > > +/*
> > > + * Copyright (C) 2010-2011 Lund Engineering
> > > + * Contact: Gil Lund <gwlund@lundeng.com>
> > > + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > + *
> [Hiremath, Vaibhav] The file below seems copied from (which is coming from all older releases of TI)
> 
> http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/board-omap3evm-camera.c;h=2e6ccfef69027dee880d507b98b5a7998d4bbe7e;hb=adcd067326836777c049e3cb32a5b7d9d401fc31
> 
> So I would appreciate if you keep original copyright and authorship of the file and add your sign-off to the patch.
> 

First of all i don't have any problem Adding your name and the TI
copyright.
Maybe i should have been more careful when looking at and adeption
omap3evm_set_mux as i really took that from the TI code.

I honestly don't remember if i took any other code from that file or not.
It ends up doing what the hardware needs anyway. For me it doesn't matter
with such trival things, but i should have been more careful.

Do you consider it resolved if use the following at the start?

/*
 * Copyright (C) 2010 Texas Instruments Inc
 * Copyright (C) 2010-2011 Lund Engineering
 * Contact: Gil Lund <gwlund@lundeng.com>
 * Authors:
 *    Vaibhav Hiremath <hvaibhav@ti.com>
 *    Martin Hostettler <martin@neutronstar.dyndns.org>
 */
 

But then again the copy on my harddisk has these too...

 * Contributors:
 *     Anuj Aggarwal <anuj.aggarwal@ti.com>
 *     Sivaraj R <sivaraj@ti.com>

Maybe i should add them too.

Not sure really...


 - Martin Hostettler

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-19 19:24       ` martin
  0 siblings, 0 replies; 27+ messages in thread
From: martin at neutronstar.dyndns.org @ 2011-09-19 19:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 19, 2011 at 11:37:37AM +0530, Hiremath, Vaibhav wrote:
> 
> > -----Original Message-----
> > From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
> > owner at vger.kernel.org] On Behalf Of Laurent Pinchart
> > Sent: Monday, September 19, 2011 3:29 AM
> > To: Martin Hostettler
> > Cc: Tony Lindgren; linux-omap at vger.kernel.org; linux-
> > media at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> > Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based
> > camera board.
> > 
> > Hi Martin,
> > 
> > On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > > Adds board support for an MT9M032 based camera to omap3evm.
> > >
> > > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > ---
> > >  arch/arm/mach-omap2/Makefile                |    1 +
> > >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > > deletions(-)
> > >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > >
> > > Changes in V2:
> > >  * ported to current mainline
> > >  * Style fixes
> > >  * Fix error handling
> > >
> > > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > > index f343365..8ae3d25 100644
> > > --- a/arch/arm/mach-omap2/Makefile
> > > +++ b/arch/arm/mach-omap2/Makefile
> > > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
> > >  					   hsmmc.o
> > >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > > +					   board-omap3evm-camera.o \
> > >  					   hsmmc.o
> > >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> > >  					   hsmmc.o
> > > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > > index 0000000..be987d9
> > > --- /dev/null
> > > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > @@ -0,0 +1,183 @@
> > > +/*
> > > + * Copyright (C) 2010-2011 Lund Engineering
> > > + * Contact: Gil Lund <gwlund@lundeng.com>
> > > + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > + *
> [Hiremath, Vaibhav] The file below seems copied from (which is coming from all older releases of TI)
> 
> http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/board-omap3evm-camera.c;h=2e6ccfef69027dee880d507b98b5a7998d4bbe7e;hb=adcd067326836777c049e3cb32a5b7d9d401fc31
> 
> So I would appreciate if you keep original copyright and authorship of the file and add your sign-off to the patch.
> 

First of all i don't have any problem Adding your name and the TI
copyright.
Maybe i should have been more careful when looking at and adeption
omap3evm_set_mux as i really took that from the TI code.

I honestly don't remember if i took any other code from that file or not.
It ends up doing what the hardware needs anyway. For me it doesn't matter
with such trival things, but i should have been more careful.

Do you consider it resolved if use the following at the start?

/*
 * Copyright (C) 2010 Texas Instruments Inc
 * Copyright (C) 2010-2011 Lund Engineering
 * Contact: Gil Lund <gwlund@lundeng.com>
 * Authors:
 *    Vaibhav Hiremath <hvaibhav@ti.com>
 *    Martin Hostettler <martin@neutronstar.dyndns.org>
 */
 

But then again the copy on my harddisk has these too...

 * Contributors:
 *     Anuj Aggarwal <anuj.aggarwal@ti.com>
 *     Sivaraj R <sivaraj@ti.com>

Maybe i should add them too.

Not sure really...


 - Martin Hostettler

^ permalink raw reply	[flat|nested] 27+ messages in thread

* RE: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
  2011-09-19 19:24       ` martin
@ 2011-09-19 19:59         ` Hiremath, Vaibhav
  -1 siblings, 0 replies; 27+ messages in thread
From: Hiremath, Vaibhav @ 2011-09-19 19:59 UTC (permalink / raw)
  To: martin
  Cc: Laurent Pinchart, Tony Lindgren, linux-omap, linux-media,
	linux-arm-kernel


> -----Original Message-----
> From: martin@neutronstar.dyndns.org [mailto:martin@neutronstar.dyndns.org]
> Sent: Tuesday, September 20, 2011 12:55 AM
> To: Hiremath, Vaibhav
> Cc: Laurent Pinchart; Tony Lindgren; linux-omap@vger.kernel.org; linux-
> media@vger.kernel.org; linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based
> camera board.
> 
> On Mon, Sep 19, 2011 at 11:37:37AM +0530, Hiremath, Vaibhav wrote:
> >
> > > -----Original Message-----
> > > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> > > owner@vger.kernel.org] On Behalf Of Laurent Pinchart
> > > Sent: Monday, September 19, 2011 3:29 AM
> > > To: Martin Hostettler
> > > Cc: Tony Lindgren; linux-omap@vger.kernel.org; linux-
> > > media@vger.kernel.org; linux-arm-kernel@lists.infradead.org
> > > Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032
> based
> > > camera board.
> > >
> > > Hi Martin,
> > >
> > > On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > > > Adds board support for an MT9M032 based camera to omap3evm.
> > > >
> > > > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > > ---
> > > >  arch/arm/mach-omap2/Makefile                |    1 +
> > > >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > > > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > > > deletions(-)
> > > >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > > >
> > > > Changes in V2:
> > > >  * ported to current mainline
> > > >  * Style fixes
> > > >  * Fix error handling
> > > >
> > > > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-
> omap2/Makefile
> > > > index f343365..8ae3d25 100644
> > > > --- a/arch/arm/mach-omap2/Makefile
> > > > +++ b/arch/arm/mach-omap2/Makefile
> > > > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > > > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-
> overo.o \
> > > >  					   hsmmc.o
> > > >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > > > +					   board-omap3evm-camera.o \
> > > >  					   hsmmc.o
> > > >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> > > >  					   hsmmc.o
> > > > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > > > index 0000000..be987d9
> > > > --- /dev/null
> > > > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > > @@ -0,0 +1,183 @@
> > > > +/*
> > > > + * Copyright (C) 2010-2011 Lund Engineering
> > > > + * Contact: Gil Lund <gwlund@lundeng.com>
> > > > + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > > + *
> > [Hiremath, Vaibhav] The file below seems copied from (which is coming
> from all older releases of TI)
> >
> > http://arago-project.org/git/projects/?p=linux-
> omap3.git;a=blob;f=arch/arm/mach-omap2/board-omap3evm-
> camera.c;h=2e6ccfef69027dee880d507b98b5a7998d4bbe7e;hb=adcd067326836777c04
> 9e3cb32a5b7d9d401fc31
> >
> > So I would appreciate if you keep original copyright and authorship of
> the file and add your sign-off to the patch.
> >
> 
> First of all i don't have any problem Adding your name and the TI
> copyright.
> Maybe i should have been more careful when looking at and adeption
> omap3evm_set_mux as i really took that from the TI code.
> 

The best practice it to always keep copy-right of the file intact... I wouldn't mind if you use and modify any part of the code and also add your authorship. 
I feel, Copy-right is important part.
 
> I honestly don't remember if i took any other code from that file or not.
> It ends up doing what the hardware needs anyway. For me it doesn't matter
> with such trival things, but i should have been more careful.
> 
> Do you consider it resolved if use the following at the start?
> 
> /*
>  * Copyright (C) 2010 Texas Instruments Inc

Change it to 2011.

>  * Copyright (C) 2010-2011 Lund Engineering
>  * Contact: Gil Lund <gwlund@lundeng.com>

Not sure do you really need above line...

>  * Authors:
>  *    Vaibhav Hiremath <hvaibhav@ti.com>
>  *    Martin Hostettler <martin@neutronstar.dyndns.org>
>  */
> 
> 
Looks ok to me.

> But then again the copy on my harddisk has these too...
> 
>  * Contributors:
>  *     Anuj Aggarwal <anuj.aggarwal@ti.com>
>  *     Sivaraj R <sivaraj@ti.com>
> 
> Maybe i should add them too.
> 
> Not sure really...
> 
> 

I think we should not pollute source file with all our names, so I would recommend to put copy rights and probably author.

Thanks,
Vaibhav
>  - Martin Hostettler

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board.
@ 2011-09-19 19:59         ` Hiremath, Vaibhav
  0 siblings, 0 replies; 27+ messages in thread
From: Hiremath, Vaibhav @ 2011-09-19 19:59 UTC (permalink / raw)
  To: linux-arm-kernel


> -----Original Message-----
> From: martin at neutronstar.dyndns.org [mailto:martin at neutronstar.dyndns.org]
> Sent: Tuesday, September 20, 2011 12:55 AM
> To: Hiremath, Vaibhav
> Cc: Laurent Pinchart; Tony Lindgren; linux-omap at vger.kernel.org; linux-
> media at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032 based
> camera board.
> 
> On Mon, Sep 19, 2011 at 11:37:37AM +0530, Hiremath, Vaibhav wrote:
> >
> > > -----Original Message-----
> > > From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
> > > owner at vger.kernel.org] On Behalf Of Laurent Pinchart
> > > Sent: Monday, September 19, 2011 3:29 AM
> > > To: Martin Hostettler
> > > Cc: Tony Lindgren; linux-omap at vger.kernel.org; linux-
> > > media at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> > > Subject: Re: [PATCH v2] arm: omap3evm: Add support for an MT9M032
> based
> > > camera board.
> > >
> > > Hi Martin,
> > >
> > > On Saturday 17 September 2011 11:34:57 Martin Hostettler wrote:
> > > > Adds board support for an MT9M032 based camera to omap3evm.
> > > >
> > > > Sigend-off-by: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > > ---
> > > >  arch/arm/mach-omap2/Makefile                |    1 +
> > > >  arch/arm/mach-omap2/board-omap3evm-camera.c |  183
> > > > +++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 0
> > > > deletions(-)
> > > >  create mode 100644 arch/arm/mach-omap2/board-omap3evm-camera.c
> > > >
> > > > Changes in V2:
> > > >  * ported to current mainline
> > > >  * Style fixes
> > > >  * Fix error handling
> > > >
> > > > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-
> omap2/Makefile
> > > > index f343365..8ae3d25 100644
> > > > --- a/arch/arm/mach-omap2/Makefile
> > > > +++ b/arch/arm/mach-omap2/Makefile
> > > > @@ -202,6 +202,7 @@ obj-$(CONFIG_MACH_OMAP3_TORPEDO)        +=
> > > > board-omap3logic.o \ obj-$(CONFIG_MACH_OVERO)		+= board-
> overo.o \
> > > >  					   hsmmc.o
> > > >  obj-$(CONFIG_MACH_OMAP3EVM)		+= board-omap3evm.o \
> > > > +					   board-omap3evm-camera.o \
> > > >  					   hsmmc.o
> > > >  obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
> > > >  					   hsmmc.o
> > > > diff --git a/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > > b/arch/arm/mach-omap2/board-omap3evm-camera.c new file mode 100644
> > > > index 0000000..be987d9
> > > > --- /dev/null
> > > > +++ b/arch/arm/mach-omap2/board-omap3evm-camera.c
> > > > @@ -0,0 +1,183 @@
> > > > +/*
> > > > + * Copyright (C) 2010-2011 Lund Engineering
> > > > + * Contact: Gil Lund <gwlund@lundeng.com>
> > > > + * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
> > > > + *
> > [Hiremath, Vaibhav] The file below seems copied from (which is coming
> from all older releases of TI)
> >
> > http://arago-project.org/git/projects/?p=linux-
> omap3.git;a=blob;f=arch/arm/mach-omap2/board-omap3evm-
> camera.c;h=2e6ccfef69027dee880d507b98b5a7998d4bbe7e;hb=adcd067326836777c04
> 9e3cb32a5b7d9d401fc31
> >
> > So I would appreciate if you keep original copyright and authorship of
> the file and add your sign-off to the patch.
> >
> 
> First of all i don't have any problem Adding your name and the TI
> copyright.
> Maybe i should have been more careful when looking at and adeption
> omap3evm_set_mux as i really took that from the TI code.
> 

The best practice it to always keep copy-right of the file intact... I wouldn't mind if you use and modify any part of the code and also add your authorship. 
I feel, Copy-right is important part.
 
> I honestly don't remember if i took any other code from that file or not.
> It ends up doing what the hardware needs anyway. For me it doesn't matter
> with such trival things, but i should have been more careful.
> 
> Do you consider it resolved if use the following at the start?
> 
> /*
>  * Copyright (C) 2010 Texas Instruments Inc

Change it to 2011.

>  * Copyright (C) 2010-2011 Lund Engineering
>  * Contact: Gil Lund <gwlund@lundeng.com>

Not sure do you really need above line...

>  * Authors:
>  *    Vaibhav Hiremath <hvaibhav@ti.com>
>  *    Martin Hostettler <martin@neutronstar.dyndns.org>
>  */
> 
> 
Looks ok to me.

> But then again the copy on my harddisk has these too...
> 
>  * Contributors:
>  *     Anuj Aggarwal <anuj.aggarwal@ti.com>
>  *     Sivaraj R <sivaraj@ti.com>
> 
> Maybe i should add them too.
> 
> Not sure really...
> 
> 

I think we should not pollute source file with all our names, so I would recommend to put copy rights and probably author.

Thanks,
Vaibhav
>  - Martin Hostettler

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2011-09-19 19:59 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-17  9:34 [PATCH v2] arm: omap3evm: Add support for an MT9M032 based camera board Martin Hostettler
2011-09-17  9:34 ` Martin Hostettler
2011-09-17 20:24 ` Joe Perches
2011-09-17 20:24   ` Joe Perches
2011-09-18 20:10   ` martin
2011-09-18 20:10     ` martin at neutronstar.dyndns.org
2011-09-17 22:00 ` Sylwester Nawrocki
2011-09-17 22:00   ` Sylwester Nawrocki
2011-09-17 22:08   ` Laurent Pinchart
2011-09-17 22:08     ` Laurent Pinchart
2011-09-18 20:13     ` martin
2011-09-18 20:13       ` martin at neutronstar.dyndns.org
2011-09-18 21:58 ` Laurent Pinchart
2011-09-18 21:58   ` Laurent Pinchart
2011-09-19  6:07   ` Hiremath, Vaibhav
2011-09-19  6:07     ` Hiremath, Vaibhav
2011-09-19 19:24     ` martin
2011-09-19 19:24       ` martin at neutronstar.dyndns.org
2011-09-19 19:24       ` martin
2011-09-19 19:59       ` Hiremath, Vaibhav
2011-09-19 19:59         ` Hiremath, Vaibhav
2011-09-19  6:10   ` martin
2011-09-19  6:10     ` martin at neutronstar.dyndns.org
2011-09-19  8:01     ` Laurent Pinchart
2011-09-19  8:01       ` Laurent Pinchart
2011-09-19 19:17   ` Guennadi Liakhovetski
2011-09-19 19:17     ` Guennadi Liakhovetski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.