From patchwork Mon Jun 8 09:02:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 6563661 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9C758C0020 for ; Mon, 8 Jun 2015 09:02:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEE0B20544 for ; Mon, 8 Jun 2015 09:02:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EE142051C for ; Mon, 8 Jun 2015 09:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932303AbbFHJCn (ORCPT ); Mon, 8 Jun 2015 05:02:43 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:50771 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932276AbbFHJCl (ORCPT ); Mon, 8 Jun 2015 05:02:41 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NPM01ZHXBSFBL60@mailout3.samsung.com>; Mon, 08 Jun 2015 18:02:39 +0900 (KST) X-AuditID: cbfee61b-f79416d0000014c0-4b-55755a2f8e88 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 84.E3.05312.F2A55755; Mon, 8 Jun 2015 18:02:39 +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 <0NPM001AYBS2ERZ0@mmp2.samsung.com>; Mon, 08 Jun 2015 18:02:39 +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 v10 1/8] Documentation: leds: Add description of v4l2-flash sub-device Date: Mon, 08 Jun 2015 11:02:18 +0200 Message-id: <1433754145-12765-2-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1433754145-12765-1-git-send-email-j.anaszewski@samsung.com> References: <1433754145-12765-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrILMWRmVeSWpSXmKPExsVy+t9jQV39qNJQg8N7RC2O7pzIZNF79Tmj xdmmN+wWW9+sY7To2bCV1eLuqaNsFrt3PWW1OPymndXizP6VbA6cHjtn3WX3OPx1IYvHnvk/ WD36tqxi9Fix+ju7x+dNcgFsUVw2Kak5mWWpRfp2CVwZi57NYyk4KVmxet4vlgbGftEuRk4O CQETiZ2Tr7NC2GISF+6tZ+ti5OIQEpjOKPFlyhlmCOcno8Syf++ZQarYBAwlfr54zQRiiwhY S8w6NJ0FpIhZYAOjxOUJjUAOB4ewQITEx0cRIDUsAqoSX+/eYASxeQU8JH68/cgEUiIhoCAx Z5INSJhTwFNif/N+sLAQUMn6iUETGHkXMDKsYhRNLUguKE5KzzXSK07MLS7NS9dLzs/dxAgO uGfSOxhXNVgcYhTgYFTi4T2wqCRUiDWxrLgy9xCjBAezkggvk0VpqBBvSmJlVWpRfnxRaU5q 8SFGaQ4WJXHek/k+oUIC6YklqdmpqQWpRTBZJg5OqQbGldy+Xfvm5rbl1xtpuDpZr/umZ55V ulvR9mLL/wu5/nJ1XFPM3OYUb62pvRLnf3Jye/5TdZdPv/R+7QzcMDfJVSxx+eNZWhKS7+5m P1EzdtsUY2F35Oe+iA8FdWdib0isZylPNptfUFL9erOMztGaya/aeK/5nLSaKmolWVg8dfan KaUN4VFKLMUZiYZazEXFiQC/M0OWNAIAAA== 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: Richard Purdie --- Documentation/leds/leds-class-flash.txt | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Documentation/leds/leds-class-flash.txt b/Documentation/leds/leds-class-flash.txt index 19bb673..8da3c6f 100644 --- a/Documentation/leds/leds-class-flash.txt +++ b/Documentation/leds/leds-class-flash.txt @@ -20,3 +20,54 @@ 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 six arguments: +- dev : flash device, e.g. an I2C device +- of_node : of_node of the LED, may be NULL if the same as device's +- fled_cdev : LED flash class device to wrap +- iled_cdev : LED flash class device representing indicator LED associated with + fled_cdev, may be NULL +- 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 , + * torch_intensity - constraints for the LED in TORCH mode + in microamperes, + * indicator_intensity - constraints for the indicator LED + in microamperes, + * has_external_strobe - determines whether the flash strobe source + can be switched to external, + +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. +This function can be safely called with NULL or error pointer argument. + +Please refer to drivers/leds/leds-max77693.c for an exemplary usage of the +v4l2 flash wrapper. + +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.