From patchwork Fri Jul 11 14:04:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 4534631 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 40334BEEAA for ; Fri, 11 Jul 2014 14:09:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FC392017A for ; Fri, 11 Jul 2014 14:09:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6787B20158 for ; Fri, 11 Jul 2014 14:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754025AbaGKOJf (ORCPT ); Fri, 11 Jul 2014 10:09:35 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:59423 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753857AbaGKOFI (ORCPT ); Fri, 11 Jul 2014 10:05:08 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8J00ECDWGIQZ50@mailout4.samsung.com>; Fri, 11 Jul 2014 23:05:06 +0900 (KST) X-AuditID: cbfee61a-f79e46d00000134f-95-53bfef12ab88 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id DB.87.04943.21FEFB35; Fri, 11 Jul 2014 23:05:06 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8J00JI5WF7VM80@mmp2.samsung.com>; Fri, 11 Jul 2014 23:05:06 +0900 (KST) From: Jacek Anaszewski To: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kyungmin.park@samsung.com, b.zolnierkie@samsung.com, Jacek Anaszewski , Bryan Wu , Richard Purdie Subject: [PATCH/RFC v4 10/21] Documentation: leds: add exemplary asynchronous mux driver Date: Fri, 11 Jul 2014 16:04:13 +0200 Message-id: <1405087464-13762-11-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1405087464-13762-1-git-send-email-j.anaszewski@samsung.com> References: <1405087464-13762-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBLMWRmVeSWpSXmKPExsVy+t9jQV2h9/uDDTbs5bPYOGM9q8XRnROZ LOYfOcdq0Xv1OaPF2aY37BaXd81hs9j6Zh2jRc+GrawWu3c9ZXXg9Ng56y67x575P1g9+ras YvT4vEkugCWKyyYlNSezLLVI3y6BK6N1y1XmgifCFT9PH2ZrYHwh0MXIySEhYCKx8vwcFghb TOLCvfVsXYxcHEIC0xklvvWvZ4dw2pkkHu28xQxSxSZgKPHzxWsmEFtEoFyi5/0zsA5mgdWM Ene2fmUFSQgLREnM6wLp5uRgEVCVaNxyHaiZg4NXwFPi5hYpEFNCQEFiziQbkApOoOjB/pts ILaQgIfEw7Un2Ccw8i5gZFjFKJpakFxQnJSea6hXnJhbXJqXrpecn7uJERxez6R2MK5ssDjE KMDBqMTDq7B+X7AQa2JZcWXuIUYJDmYlEd6rb/YHC/GmJFZWpRblxxeV5qQWH2KU5mBREuc9 0GodKCSQnliSmp2aWpBaBJNl4uCUamAs0wjk1TCZdKBVltfhTeCRFWv+Fq448b9gq2Ge6+7j uSemsmhqXNb4asPeEeKzJXeuqTZrz43apOjFBybscO/W8b1y6EuJ6LoGNY17EmVHeTd+vnFy nseUvk//lb/253RM2ZT/UcVhwb8KPe1qi/JEFqdnM7QX3nvnWnmdZeKp8CcSLX0qwexKLMUZ iYZazEXFiQDoSdZzKwIAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Exemplary driver showing usage of the Flash Manager API for registering/unregistering asynchronous multiplexers Signed-off-by: Jacek Anaszewski Acked-by: Kyungmin Park Cc: Bryan Wu Cc: Richard Purdie --- Documentation/leds/leds-async-mux.c | 65 +++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/leds/leds-async-mux.c diff --git a/Documentation/leds/leds-async-mux.c b/Documentation/leds/leds-async-mux.c new file mode 100644 index 0000000..ee35d2f --- /dev/null +++ b/Documentation/leds/leds-async-mux.c @@ -0,0 +1,65 @@ +/* + * Exemplary driver showing usage of the Flash Manager API + * for registering/unregistering asynchronous multiplexers. + * + * Copyright (C) 2014, Samsung Electronics Co., Ltd. + * Author: Jacek Anaszewski + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include + +static int led_async_mux_select_line(u32 line_id, void *mux) +{ + pr_info("led_async_mux_select_line line_id: %d\n", line_id); + return 0; +} + +struct led_flash_mux_ops mux_ops = { + .select_line = led_async_mux_select_line, +}; + +static int led_async_mux_probe(struct platform_device *pdev) +{ + struct led_flash_mux mux; + + mux.ops = &mux_ops; + mux.owner = THIS_MODULE; + mux.node = pdev->dev->of_node; + + return led_flash_manager_bind_async_mux(&mux); +} + +static int led_async_mux_remove(struct platform_device *pdev) +{ + return led_flash_manager_unbind_async_mux(pdev->dev->of_node); +} + +static struct of_device_id led_async_mux_dt_match[] = { + {.compatible = "led-async-mux"}, + {}, +}; + +static struct platform_driver led_async_mux_driver = { + .probe = led_async_mux_probe, + .remove = led_async_mux_remove, + .driver = { + .name = "led-async-mux", + .owner = THIS_MODULE, + .of_match_table = led_async_mux_dt_match, + }, +}; + +module_platform_driver(led_async_mux_driver); + +MODULE_AUTHOR("Jacek Anaszewski "); +MODULE_DESCRIPTION("LED async mux"); +MODULE_LICENSE("GPL");