From patchwork Tue Apr 28 07:18:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 6286251 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BEA8B9F52C for ; Tue, 28 Apr 2015 07:21:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1B6020320 for ; Tue, 28 Apr 2015 07:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 063FC20374 for ; Tue, 28 Apr 2015 07:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347AbbD1HVQ (ORCPT ); Tue, 28 Apr 2015 03:21:16 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:16483 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753333AbbD1HVP (ORCPT ); Tue, 28 Apr 2015 03:21:15 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NNI00MLM9RD5I70@mailout4.samsung.com>; Tue, 28 Apr 2015 16:21:14 +0900 (KST) X-AuditID: cbfee61b-f79536d000000f1f-a6-553f34e9f25c Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 98.BF.03871.9E43F355; Tue, 28 Apr 2015 16:21:13 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NNI00E0Q9Q3KG10@mmp2.samsung.com>; Tue, 28 Apr 2015 16:21:13 +0900 (KST) From: Jacek Anaszewski To: linux-leds@vger.kernel.org, linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, pavel@ucw.cz, cooloney@gmail.com, rpurdie@rpsys.net, sakari.ailus@iki.fi, s.nawrocki@samsung.com, Jacek Anaszewski Subject: [PATCH v6 07/10] Documentation: leds: Add description of v4l2-flash sub-device Date: Tue, 28 Apr 2015 09:18:47 +0200 Message-id: <1430205530-20873-8-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1430205530-20873-1-git-send-email-j.anaszewski@samsung.com> References: <1430205530-20873-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrELMWRmVeSWpSXmKPExsVy+t9jQd2XJvahBkv+W1gc3TmRyaL36nNG i7NNb9gttr5Zx2jRs2Erq8XdU0fZLHbvespqcfhNO6vFmf0r2Rw4PXbOusvucfjrQhaPPfN/ sHr0bVnF6LFi9Xd2j8+b5ALYorhsUlJzMstSi/TtErgyHrcuYStYL1Hx8vsrxgbGxSJdjJwc EgImErsPHGaFsMUkLtxbz9bFyMUhJDCdUeLgo13MEM5PRonud7vBqtgEDCV+vnjNBGKLCFhL zDo0nQWkiFlgA6PE5QmNLCAJYYFIiY3NJ8AaWARUJf5fncUMYvMKeEjs7l3B2MXIAbROQWLO JBsQk1PAU+LEbUeQCiGgiq7j75kmMPIuYGRYxSiaWpBcUJyUnmukV5yYW1yal66XnJ+7iREc cs+kdzCuarA4xCjAwajEwzvhtl2oEGtiWXFl7iFGCQ5mJRHeJeL2oUK8KYmVValF+fFFpTmp xYcYpTlYlMR55+jKhQoJpCeWpGanphakFsFkmTg4pRoY2Y89WBYYnrS8TGCrYHQii6mrgP/s hqfr3vcIqH5ufKr7+kLha76kcG0rlkNi3X2PPsnt/V2YZ6zjdtPZvNzm7O2tfbsUJwgfiuib uPajAqfE95semz5vX79Mq0Lmi5qej9K/UtszOmfEip3fTb+0zDRqfXjIIpUnBp6pR/4dVjXO vcEmyfVPiaU4I9FQi7moOBEAeJq7hDUCAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch extends LED Flash class documention by the description of interactions with v4l2-flash sub-device. Signed-off-by: Jacek Anaszewski Acked-by: Kyungmin Park Cc: Bryan Wu Cc: Richard Purdie Acked-by: Sakari Ailus --- Documentation/leds/leds-class-flash.txt | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/Documentation/leds/leds-class-flash.txt b/Documentation/leds/leds-class-flash.txt index 19bb673..9d39133 100644 --- a/Documentation/leds/leds-class-flash.txt +++ b/Documentation/leds/leds-class-flash.txt @@ -20,3 +20,50 @@ Following sysfs attributes are exposed for controlling flash LED devices: - max_flash_timeout - flash_strobe - flash_fault + + +V4L2 flash wrapper for flash LEDs +================================= + +A LED subsystem driver can be controlled also from the level of VideoForLinux2 +subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to +be defined in the kernel config. + +The driver must call the v4l2_flash_init function to get registered in the +V4L2 subsystem. The function takes three arguments: +- fled_cdev : the LED Flash class device to wrap +- ops : V4L2 specific ops + * external_strobe_set - defines the source of the flash LED strobe - + V4L2_CID_FLASH_STROBE control or external source, typically + a sensor, which makes it possible to synchronise the flash + strobe start with exposure start, + * intensity_to_led_brightness and led_brightness_to_intensity - perform + enum led_brightness <-> V4L2 intensity conversion in a device + specific manner - they can be used for devices with non-linear + LED current scale. +- config : configuration for V4L2 Flash sub-device + * dev_name - the name of the media entity, unique in the system, + * flash_faults - bitmask of flash faults that the LED Flash class + device can report; corresponding LED_FAULT* bit definitions are + available in , + * intensity - constraints for the LED in the TORCH or INDICATOR mode, + in microamperes, + * has_external_strobe - determines whether the flash strobe source + can be switched to external, + * indicator_led - signifies that a led is of indicator type, which + implies that it can have only two V4L2 controls: + V4L2_CID_FLASH_INDICATOR_INTENSITY and V4L2_CID_FLASH_FAULT. + +On remove the v4l2_flash_release function has to be called, which takes one +argument - struct v4l2_flash pointer returned previously by v4l2_flash_init. + +Please refer to drivers/leds/leds-max77693.c for an exemplary usage of the +v4l2 flash API. + +Once the V4L2 sub-device is registered by the driver which created the Media +controller device, the sub-device node acts just as a node of a native V4L2 +flash API device would. The calls are simply routed to the LED flash API. + +Opening the V4L2 flash sub-device makes the LED subsystem sysfs interface +unavailable. The interface is re-enabled after the V4L2 flash sub-device +is closed.