From patchwork Sun Jul 18 04:29:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 3821 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sun, 18 Jul 2010 04:30:30 +0000 Received: from bombadil.infradead.org [18.85.46.34] by localhost with IMAP (fetchmail-6.3.17) for (single-drop); Sun, 18 Jul 2010 01:33:58 -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 1OaLWI-0001df-2J; Sun, 18 Jul 2010 04:30:30 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546Ab0GREa0 (ORCPT + 1 other); Sun, 18 Jul 2010 00:30:26 -0400 Received: from d1.icnet.pl ([212.160.220.21]:57069 "EHLO d1.icnet.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751318Ab0GREaZ (ORCPT ); Sun, 18 Jul 2010 00:30:25 -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 1OaLWC-0007dC-L8; Sun, 18 Jul 2010 06:30:24 +0200 From: Janusz Krzysztofik Organization: Tele-Info-System, Poznan, PL To: linux-media@vger.kernel.org, "linux-omap@vger.kernel.org" Subject: [RFC] [PATCH 6/6] OMAP1: Amstrad Delta: add camera controlled LEDS trigger Date: Sun, 18 Jul 2010 06:29:47 +0200 User-Agent: KMail/1.9.10 Cc: Guennadi Liakhovetski , Tony Lindgren , Richard Purdie , "Discussion of the Amstrad E3 emailer hardware/software" References: <201007180618.08266.jkrzyszt@tis.icnet.pl> In-Reply-To: <201007180618.08266.jkrzyszt@tis.icnet.pl> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201007180629.56253.jkrzyszt@tis.icnet.pl> X-SA-Exim-Scanned: No (on d1.icnet); SAEximRunCond expanded to false Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch extends the Amstrad Delta camera support with LEDS trigger that can be used for automatic control of the on-board camera LED. The led turns on automatically on camera device open and turns off on camera device close. If you find this solution usefull for other boards / machines / platforms as well, I can try to reimplement it at the SoC camera framework level, or OMAP1 camera interface level. Created and tested against linux-2.6.35-rc3. Works on top of patch 5/6, "OMAP1: Amstrad Delta: add support for on-board camera" Signed-off-by: Janusz Krzysztofik --- arch/arm/mach-omap1/board-ams-delta.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 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 --- linux-2.6.35-rc3.orig/arch/arm/mach-omap1/board-ams-delta.c 2010-07-18 02:48:53.000000000 +0200 +++ linux-2.6.35-rc3/arch/arm/mach-omap1/board-ams-delta.c 2010-07-18 02:47:33.000000000 +0200 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -222,11 +223,30 @@ static struct i2c_board_info ams_delta_c }, }; +#if defined(CONFIG_LEDS_TRIGGERS) +DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger); + +static int ams_delta_camera_power(struct device *dev, int power) +{ + /* + * turn on camera LED + */ + if (power) + led_trigger_event(ams_delta_camera_led_trigger, LED_FULL); + else + led_trigger_event(ams_delta_camera_led_trigger, LED_OFF); + return 0; +} +#else +#define ams_delta_camera_power NULL +#endif + static struct soc_camera_link __initdata ams_delta_iclink = { .bus_id = 0, /* OMAP1 SoC camera bus */ .i2c_adapter_id = 1, .board_info = &ams_delta_camera_board_info[0], .module_name = "ov6650", + .power = ams_delta_camera_power, }; static struct platform_device ams_delta_camera_device = { @@ -281,6 +301,10 @@ static void __init ams_delta_init(void) omap_usb_init(&ams_delta_usb_config); omap1_set_camera_info(&ams_delta_camera_platform_data); +#if defined(CONFIG_LEDS_TRIGGERS) + led_trigger_register_simple("ams_delta_camera", + &ams_delta_camera_led_trigger); +#endif platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); #ifdef CONFIG_AMS_DELTA_FIQ