From patchwork Mon Sep 27 01:02:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 4424 Return-path: Envelope-to: mchehab@pedra Delivery-date: Sun, 26 Sep 2010 22:04:27 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1P028p-00050d-3D for mchehab@pedra; Sun, 26 Sep 2010 22:04:27 -0300 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Sun, 26 Sep 2010 22:04:27 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P0282-0004FN-Qt; Mon, 27 Sep 2010 01:03:38 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757999Ab0I0BDf (ORCPT + 1 other); Sun, 26 Sep 2010 21:03:35 -0400 Received: from d1.icnet.pl ([212.160.220.21]:37449 "EHLO d1.icnet.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754544Ab0I0BDe (ORCPT ); Sun, 26 Sep 2010 21:03:34 -0400 Received: from 87-205-12-81.ip.netia.com.pl ([87.205.12.81] helo=vclass.intranet) by d1.icnet.pl with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1P027x-0002Ni-90; Mon, 27 Sep 2010 03:03:33 +0200 To: "linux-omap@vger.kernel.org" Subject: [PATCH v3] OMAP1: Add support for SoC camera interface Cc: linux-media@vger.kernel.org, Guennadi Liakhovetski , Tony Lindgren , "Discussion of the Amstrad E3 emailer hardware/software" Content-Disposition: inline From: Janusz Krzysztofik Organization: Tele-Info-System, Poznan, PL MIME-Version: 1.0 Date: Mon, 27 Sep 2010 03:02:27 +0200 Message-Id: <201009270302.28655.jkrzyszt@tis.icnet.pl> X-SA-Exim-Scanned: No (on d1.icnet); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: This patch adds a definition of the OMAP1 camera interface platform device, and a function that allows for providing a board specific platform data. The device will be used with the upcoming OMAP1 SoC camera interface driver. Created and tested against linux-2.6.36-rc5 on Amstrad Delta. Signed-off-by: Janusz Krzysztofik --- Tony, I hope this now satisfies your requirements. I resubmit only this updated patch, not the other two, Amstrad Delta specific, which you have alredy applied. Those are still valid (work for me), only the not yet merged include/media/omap1_camera.h header file is required for successfull compilation of board-ams-delta.c. I hope this is not a problem. I'll submit the driver for Guennadi to push it via the media tree soon. v2->v3 changes: requested or inspired by Tony Lindgren (thanks!): - don't #include into devices.c in order to allow for successfull compilation while the camera.h still includes a not yet merged , - move the OMAP1_CAMERA_IOSIZE macro defintion from camera.h to devices.c, - to remove any remaining or dependencies from devices.c, replace the struct omap1_cam_platform_data * argument type with a void *, and provide an inline wrapper function in camera.h that converts back from void * to struct omap1_cam_platform_data *, suggested by Guennadi Liakhovetski (thanks!): - try groupping headers according to their location and keeping them sorted alphabeticaly, - drop "extern" qualifier from fuction declaration, v1->v2 changes: - no functional changes, - refreshed against linux-2.6.36-rc3 arch/arm/mach-omap1/devices.c | 43 ++++++++++++++++++++++++++++++ arch/arm/mach-omap1/include/mach/camera.h | 13 +++++++++ 2 files changed, 56 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -upr linux-2.6.36-rc5.orig/arch/arm/mach-omap1/devices.c linux-2.6.36-rc5/arch/arm/mach-omap1/devices.c --- linux-2.6.36-rc5.orig/arch/arm/mach-omap1/devices.c 2010-09-24 15:34:27.000000000 +0200 +++ linux-2.6.36-rc5/arch/arm/mach-omap1/devices.c 2010-09-25 03:47:55.000000000 +0200 @@ -9,6 +9,7 @@ * (at your option) any later version. */ +#include #include #include #include @@ -191,6 +192,48 @@ static inline void omap_init_spi100k(voi } #endif + +#define OMAP1_CAMERA_BASE 0xfffb6800 +#define OMAP1_CAMERA_IOSIZE 0x1c + +static struct resource omap1_camera_resources[] = { + [0] = { + .start = OMAP1_CAMERA_BASE, + .end = OMAP1_CAMERA_BASE + OMAP1_CAMERA_IOSIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = INT_CAMERA, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 omap1_camera_dma_mask = DMA_BIT_MASK(32); + +static struct platform_device omap1_camera_device = { + .name = "omap1-camera", + .id = 0, /* This is used to put cameras on this interface */ + .dev = { + .dma_mask = &omap1_camera_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + }, + .num_resources = ARRAY_SIZE(omap1_camera_resources), + .resource = omap1_camera_resources, +}; + +void __init omap1_camera_init(void *info) +{ + struct platform_device *dev = &omap1_camera_device; + int ret; + + dev->dev.platform_data = info; + + ret = platform_device_register(dev); + if (ret) + dev_err(&dev->dev, "unable to register device: %d\n", ret); +} + + /*-------------------------------------------------------------------------*/ static inline void omap_init_sti(void) {} diff -upr linux-2.6.36-rc5.orig/arch/arm/mach-omap1/include/mach/camera.h linux-2.6.36-rc5/arch/arm/mach-omap1/include/mach/camera.h --- linux-2.6.36-rc5.orig/arch/arm/mach-omap1/include/mach/camera.h 2010-09-24 15:39:07.000000000 +0200 +++ linux-2.6.36-rc5/arch/arm/mach-omap1/include/mach/camera.h 2010-09-25 03:19:12.000000000 +0200 @@ -0,0 +1,13 @@ +#ifndef __ASM_ARCH_CAMERA_H_ +#define __ASM_ARCH_CAMERA_H_ + +#include + +void omap1_camera_init(void *); + +static inline void omap1_set_camera_info(struct omap1_cam_platform_data *info) +{ + omap1_camera_init(info); +} + +#endif /* __ASM_ARCH_CAMERA_H_ */