[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1405087464-13762-11-git-send-email-j.anaszewski@samsung.com>
Date: Fri, 11 Jul 2014 16:04:13 +0200
From: Jacek Anaszewski <j.anaszewski@...sung.com>
To: linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: kyungmin.park@...sung.com, b.zolnierkie@...sung.com,
Jacek Anaszewski <j.anaszewski@...sung.com>,
Bryan Wu <cooloney@...il.com>,
Richard Purdie <rpurdie@...ys.net>
Subject: [PATCH/RFC v4 10/21] Documentation: leds: add exemplary asynchronous
mux driver
Exemplary driver showing usage of the Flash Manager API
for registering/unregistering asynchronous multiplexers
Signed-off-by: Jacek Anaszewski <j.anaszewski@...sung.com>
Acked-by: Kyungmin Park <kyungmin.park@...sung.com>
Cc: Bryan Wu <cooloney@...il.com>
Cc: Richard Purdie <rpurdie@...ys.net>
---
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 <j.anaszewski@...sung.com>
+ *
+ * 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 <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/led-class-flash.h>
+#include <linux/led-flash-manager.h>
+#include <linux/leds.h>
+#include <linux/of.h>
+
+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 <j.anaszewski@...sung.com>");
+MODULE_DESCRIPTION("LED async mux");
+MODULE_LICENSE("GPL");
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists