From patchwork Tue Mar 31 13:52:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 29057 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Ycwdv-0006Dr-Id; Tue, 31 Mar 2015 15:55:47 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-5) with esmtp id 1Ycwdt-0005Cm-7q; Tue, 31 Mar 2015 15:55:47 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754716AbbCaNzi (ORCPT + 1 other); Tue, 31 Mar 2015 09:55:38 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:55060 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754542AbbCaNze (ORCPT ); Tue, 31 Mar 2015 09:55:34 -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 <0NM200CZBXCLFWB0@mailout4.samsung.com>; Tue, 31 Mar 2015 22:55:33 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-4f-551aa7552aa8 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AA.0F.09430.557AA155; Tue, 31 Mar 2015 22:55:33 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NM200JI4X7ZTQ90@mmp1.samsung.com>; Tue, 31 Mar 2015 22:55:33 +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 v4 09/12] Documentation: leds: Add description of v4l2-flash sub-device Date: Tue, 31 Mar 2015 15:52:45 +0200 Message-id: <1427809965-25540-10-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1427809965-25540-1-git-send-email-j.anaszewski@samsung.com> References: <1427809965-25540-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrELMWRmVeSWpSXmKPExsVy+t9jAd3Q5VKhBuufCVsc3TmRyaL36nNG i7NNb9gttr5Zx2jRs2Erq8XdU0fZLHbvespqcfhNO6vFmf0r2Rw4PXbOusvucfjrQhaPPfN/ sHr0bVnF6LFi9Xd2j8+b5ALYorhsUlJzMstSi/TtErgy9m4NLVgvUXFz11nmBsYlIl2MnBwS AiYSW/7OZIawxSQu3FvP1sXIxSEksIhRYuONlYwQzk9GiQdrl7OCVLEJGEr8fPGaCcQWEbCW mHVoOgtIEbPABkaJyxMaWUASwgKREq/vHwSzWQRUJZ6un8YOYvMKeEp8XjsZyOYAWqcgMWeS DUiYEyjcuWonWImQgIfE57d72Ccw8i5gZFjFKJpakFxQnJSea6RXnJhbXJqXrpecn7uJERxy z6R3MK5qsDjEKMDBqMTDW3FHMlSINbGsuDL3EKMEB7OSCO/PiVKhQrwpiZVVqUX58UWlOanF hxilOViUxHmV7NtChATSE0tSs1NTC1KLYLJMHJxSDYwLFC78TDfb/2Ghys/bhkZn79xvyV3O a/em7tqCtL74o+oWR89531QJzXi6a1vLDjbNcrOF9z/JTFdS3CC1/N/XX3oLPed8u8iReiR2 hvQSlX/+SfPf/39cIuK94USr3O+WiZcDhTquv75fG5A9e5a3zaqeV8UaCgkequsMHG681d34 ctnDeTXnlViKMxINtZiLihMBENPyUTUCAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.3.31.134520 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, REFERENCES 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BADTHINGS 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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 --- 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..ad80eeb 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.