All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] plarform-mx2-camera: fix missing header dma-mapping.h
@ 2011-08-26 13:12 Michael Grzeschik
  2011-08-26 13:12 ` [PATCH 2/2] ARM: i.MX27 pca100: Add camera support for mt9m111 Michael Grzeschik
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Grzeschik @ 2011-08-26 13:12 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 arch/arm/plat-mxc/devices/platform-mx2-camera.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-mxc/devices/platform-mx2-camera.c b/arch/arm/plat-mxc/devices/platform-mx2-camera.c
index b3f4828..a6199d7 100644
--- a/arch/arm/plat-mxc/devices/platform-mx2-camera.c
+++ b/arch/arm/plat-mxc/devices/platform-mx2-camera.c
@@ -6,6 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
+#include <linux/dma-mapping.h>
 #include <mach/hardware.h>
 #include <mach/devices-common.h>
 
-- 
1.7.5.4

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

* [PATCH 2/2] ARM: i.MX27 pca100: Add camera support for mt9m111
  2011-08-26 13:12 [PATCH 1/2] plarform-mx2-camera: fix missing header dma-mapping.h Michael Grzeschik
@ 2011-08-26 13:12 ` Michael Grzeschik
  2011-08-26 14:15   ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Grzeschik @ 2011-08-26 13:12 UTC (permalink / raw)
  To: linux-arm-kernel

This glue code for the pca100 implements support for the mt9m111
LVDS connected camera.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 arch/arm/mach-imx/Kconfig       |    1 +
 arch/arm/mach-imx/mach-pca100.c |   59 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 0519dd7..4697ed3 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -328,6 +328,7 @@ config MACH_PCA100
 	select IMX_HAVE_PLATFORM_MXC_NAND
 	select IMX_HAVE_PLATFORM_MXC_W1
 	select IMX_HAVE_PLATFORM_SPI_IMX
+	select IMX_HAVE_PLATFORM_MX2_CAMERA
 	select MXC_ULPI if USB_ULPI
 	help
 	  Include support for phyCARD-s (aka pca100) platform. This
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index 71083aa..e67a41b 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -30,6 +30,8 @@
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
 
+#include <media/soc_camera.h>
+
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 #include <mach/common.h>
@@ -153,6 +155,19 @@ static const int pca100_pins[] __initconst = {
 	GPIO_PORTC | 31 | GPIO_GPIO | GPIO_IN, /* GPIO0_IRQ */
 	GPIO_PORTC | 25 | GPIO_GPIO | GPIO_IN, /* GPIO1_IRQ */
 	GPIO_PORTE | 5 | GPIO_GPIO | GPIO_IN, /* GPIO2_IRQ */
+	/* Camera */
+	PB10_PF_CSI_D0,
+	PB11_PF_CSI_D1,
+	PB12_PF_CSI_D2,
+	PB13_PF_CSI_D3,
+	PB14_PF_CSI_D4,
+	PB15_PF_CSI_MCLK,
+	PB16_PF_CSI_PIXCLK,
+	PB17_PF_CSI_D5,
+	PB18_PF_CSI_D6,
+	PB19_PF_CSI_D7,
+	PB20_PF_CSI_VSYNC,
+	PB21_PF_CSI_HSYNC,
 };
 
 static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -175,6 +190,17 @@ static struct at24_platform_data board_eeprom = {
 	.flags = AT24_FLAG_ADDR16,
 };
 
+static unsigned long pbaa01_camera_query_bus_param(struct soc_camera_link *icl)
+{
+	return SOCAM_DATAWIDTH_8;
+}
+
+static int pbaa01_camera_set_bus_param(struct soc_camera_link *icl,
+		unsigned long flags)
+{
+	return 0;
+}
+
 static struct i2c_board_info pca100_i2c_devices[] = {
 	{
 		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
@@ -301,6 +327,34 @@ static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
 
 static int otg_mode_host;
 
+static struct i2c_board_info __initdata pbaa01_camera_mt9m131 = {
+		I2C_BOARD_INFO("mt9m111", 0x48),
+		.type = "mt9m111",
+};
+
+static struct soc_camera_link iclink_mt9m131 = {
+	.bus_id		= 0,		/* Must match with the camera ID */
+	.board_info	= &pbaa01_camera_mt9m131,
+	.i2c_adapter_id	= 0,
+	.module_name	= "mt9m111",
+	.query_bus_param = pbaa01_camera_query_bus_param,
+	.set_bus_param	= pbaa01_camera_set_bus_param,
+};
+
+static struct platform_device pca100_mt9m131 = {
+	.name	= "soc-camera-pdrv",
+	.id	= 0,
+	.dev	= {
+		.platform_data = &iclink_mt9m131,
+	},
+};
+
+struct mx2_camera_platform_data pca100_camera = {
+	.clk  = 26600000,
+	.flags = MX2_CAMERA_HSYNC_HIGH | MX2_CAMERA_GATED_CLOCK |
+		MX2_CAMERA_PACK_DIR_MSB,
+};
+
 static int __init pca100_otg_mode(char *options)
 {
 	if (!strcmp(options, "host"))
@@ -388,8 +442,11 @@ static void __init pca100_init(void)
 	i2c_register_board_info(1, pca100_i2c_devices,
 				ARRAY_SIZE(pca100_i2c_devices));
 
+	imx27_add_imx_i2c(0, &pca100_i2c1_data);
 	imx27_add_imx_i2c(1, &pca100_i2c1_data);
 
+	platform_device_register(&pca100_mt9m131);
+
 	mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_IN);
 	mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN);
 	spi_register_board_info(pca100_spi_board_info,
@@ -423,6 +480,8 @@ static void __init pca100_init(void)
 	imx27_add_fec(NULL);
 	imx27_add_imx2_wdt(NULL);
 	imx27_add_mxc_w1(NULL);
+
+	imx27_add_mx2_camera(&pca100_camera);
 }
 
 static void __init pca100_timer_init(void)
-- 
1.7.5.4

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

* [PATCH 2/2] ARM: i.MX27 pca100: Add camera support for mt9m111
  2011-08-26 13:12 ` [PATCH 2/2] ARM: i.MX27 pca100: Add camera support for mt9m111 Michael Grzeschik
@ 2011-08-26 14:15   ` Uwe Kleine-König
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2011-08-26 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

Halli Michael,

On Fri, Aug 26, 2011 at 03:12:11PM +0200, Michael Grzeschik wrote:
> This glue code for the pca100 implements support for the mt9m111
> LVDS connected camera.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  arch/arm/mach-imx/Kconfig       |    1 +
>  arch/arm/mach-imx/mach-pca100.c |   59 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 60 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> index 0519dd7..4697ed3 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -328,6 +328,7 @@ config MACH_PCA100
>  	select IMX_HAVE_PLATFORM_MXC_NAND
>  	select IMX_HAVE_PLATFORM_MXC_W1
>  	select IMX_HAVE_PLATFORM_SPI_IMX
> +	select IMX_HAVE_PLATFORM_MX2_CAMERA
Please keep this list sorted alphabetically

>  	select MXC_ULPI if USB_ULPI
>  	help
>  	  Include support for phyCARD-s (aka pca100) platform. This
> diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
> index 71083aa..e67a41b 100644
> --- a/arch/arm/mach-imx/mach-pca100.c
> +++ b/arch/arm/mach-imx/mach-pca100.c
> @@ -30,6 +30,8 @@
>  #include <linux/usb/otg.h>
>  #include <linux/usb/ulpi.h>
>  
> +#include <media/soc_camera.h>
> +
>  #include <asm/mach/arch.h>
>  #include <asm/mach-types.h>
>  #include <mach/common.h>
> @@ -153,6 +155,19 @@ static const int pca100_pins[] __initconst = {
>  	GPIO_PORTC | 31 | GPIO_GPIO | GPIO_IN, /* GPIO0_IRQ */
>  	GPIO_PORTC | 25 | GPIO_GPIO | GPIO_IN, /* GPIO1_IRQ */
>  	GPIO_PORTE | 5 | GPIO_GPIO | GPIO_IN, /* GPIO2_IRQ */
> +	/* Camera */
> +	PB10_PF_CSI_D0,
> +	PB11_PF_CSI_D1,
> +	PB12_PF_CSI_D2,
> +	PB13_PF_CSI_D3,
> +	PB14_PF_CSI_D4,
> +	PB15_PF_CSI_MCLK,
> +	PB16_PF_CSI_PIXCLK,
> +	PB17_PF_CSI_D5,
> +	PB18_PF_CSI_D6,
> +	PB19_PF_CSI_D7,
> +	PB20_PF_CSI_VSYNC,
> +	PB21_PF_CSI_HSYNC,
>  };
>  
>  static const struct imxuart_platform_data uart_pdata __initconst = {
> @@ -175,6 +190,17 @@ static struct at24_platform_data board_eeprom = {
>  	.flags = AT24_FLAG_ADDR16,
>  };
>  
> +static unsigned long pbaa01_camera_query_bus_param(struct soc_camera_link *icl)
> +{
> +	return SOCAM_DATAWIDTH_8;
> +}
What is pbaa01? The machine's name is pca100.

> +
> +static int pbaa01_camera_set_bus_param(struct soc_camera_link *icl,
> +		unsigned long flags)
> +{
> +	return 0;
> +}
> +
>  static struct i2c_board_info pca100_i2c_devices[] = {
>  	{
>  		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
> @@ -301,6 +327,34 @@ static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
>  
>  static int otg_mode_host;
>  
> +static struct i2c_board_info __initdata pbaa01_camera_mt9m131 = {
__initdata should go directly before the =.

> +		I2C_BOARD_INFO("mt9m111", 0x48),
> +		.type = "mt9m111",
this is broken. I2C_BOARD_INFO already provides the .type assignment.

> +};
> +
> +static struct soc_camera_link iclink_mt9m131 = {
> +	.bus_id		= 0,		/* Must match with the camera ID */
> +	.board_info	= &pbaa01_camera_mt9m131,
Here is a section mismatch. Is that OK?

> +	.i2c_adapter_id	= 0,
> +	.module_name	= "mt9m111",
> +	.query_bus_param = pbaa01_camera_query_bus_param,
> +	.set_bus_param	= pbaa01_camera_set_bus_param,
> +};
> +
> +static struct platform_device pca100_mt9m131 = {
> +	.name	= "soc-camera-pdrv",
> +	.id	= 0,
> +	.dev	= {
> +		.platform_data = &iclink_mt9m131,
> +	},
> +};
Better allocate this dynamically. Then iclink_mt9m131 can be
const + __initconst, too.

> +struct mx2_camera_platform_data pca100_camera = {
This should be const + __initconst.

> +	.clk  = 26600000,
> +	.flags = MX2_CAMERA_HSYNC_HIGH | MX2_CAMERA_GATED_CLOCK |
> +		MX2_CAMERA_PACK_DIR_MSB,
> +};
> +
>  static int __init pca100_otg_mode(char *options)
>  {
>  	if (!strcmp(options, "host"))
> @@ -388,8 +442,11 @@ static void __init pca100_init(void)
>  	i2c_register_board_info(1, pca100_i2c_devices,
>  				ARRAY_SIZE(pca100_i2c_devices));
>  
> +	imx27_add_imx_i2c(0, &pca100_i2c1_data);
>  	imx27_add_imx_i2c(1, &pca100_i2c1_data);
maybe drop the 1 from pca100_i2c1_data as it is used for i2c0 now, too?

>  
> +	platform_device_register(&pca100_mt9m131);
> +
>  	mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_IN);
>  	mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN);
>  	spi_register_board_info(pca100_spi_board_info,
> @@ -423,6 +480,8 @@ static void __init pca100_init(void)
>  	imx27_add_fec(NULL);
>  	imx27_add_imx2_wdt(NULL);
>  	imx27_add_mxc_w1(NULL);
> +
> +	imx27_add_mx2_camera(&pca100_camera);
>  }
>  
>  static void __init pca100_timer_init(void)
Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2011-08-26 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-26 13:12 [PATCH 1/2] plarform-mx2-camera: fix missing header dma-mapping.h Michael Grzeschik
2011-08-26 13:12 ` [PATCH 2/2] ARM: i.MX27 pca100: Add camera support for mt9m111 Michael Grzeschik
2011-08-26 14:15   ` Uwe Kleine-König

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.