From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5F4EC282DD for ; Thu, 23 May 2019 19:51:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A96B420851 for ; Thu, 23 May 2019 19:51:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="YMCrXIqc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388212AbfEWTvq (ORCPT ); Thu, 23 May 2019 15:51:46 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:52942 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731847AbfEWTIn (ORCPT ); Thu, 23 May 2019 15:08:43 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4NJ8b6v065640; Thu, 23 May 2019 14:08:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1558638517; bh=uLRO4LuM3Cx4BzGDVEVCqujZlgCV+aiVlzqD9CTygSE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=YMCrXIqcsj51rmyolxPP9XZp8Y3nrFRTTCFuH44rTRKiowkvX9qNR1g531mcVUu3C bkaE9oAJbwV6E3BjD61Ho+l0Snh5q8sEjfBS+dalP82qsrO+2B8sf0QF50irLCKm+H aiMzQMGqJiQJVDS4ZoGXhkDYY1pwZjpTV02ozOwE= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4NJ8bii079032 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 May 2019 14:08:37 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 23 May 2019 14:08:37 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 23 May 2019 14:08:37 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x4NJ8bAO071436; Thu, 23 May 2019 14:08:37 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [PATCH v3 3/9] documention: leds: Add multicolor class documentation Date: Thu, 23 May 2019 14:08:14 -0500 Message-ID: <20190523190820.29375-4-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190523190820.29375-1-dmurphy@ti.com> References: <20190523190820.29375-1-dmurphy@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the support documentation on the multicolor LED framework. This document defines the directores and file generated by the multicolor framework. It also documents usage. Signed-off-by: Dan Murphy --- Documentation/leds/leds-class-multicolor.txt | 99 ++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Documentation/leds/leds-class-multicolor.txt diff --git a/Documentation/leds/leds-class-multicolor.txt b/Documentation/leds/leds-class-multicolor.txt new file mode 100644 index 000000000000..edbb8139e514 --- /dev/null +++ b/Documentation/leds/leds-class-multicolor.txt @@ -0,0 +1,99 @@ + +Multi Color LED handling under Linux +================================================= + +Author: Dan Murphy + +Description +----------- +There are varying monochrome LED colors available for application. These +LEDs can be used as a single use case LED or can be mixed with other color +LEDs to produce the full spectrum of color. Color LEDs that are grouped +can be presented under a single LED node with individual color control. +The multicolor class groups these LEDs and allows dynamically setting the value +of a single LED or setting the brightness values of the LEDs in the group and +updating the LEDs virtually simultaneously. + +Multicolor Class Control +------------------------- +The multicolor class presents the LED groups under a directory called "colors". +This directory is a child under the LED parent node created by the led_class +framework. The led_class framework is documented in led-class.txt within this +documentation directory. + +Each colored LED is given its own directory. These directories can be, but not +limited to red, green, blue, white, amber, yellow and violet. Under these +directories the brightness and max_brightness files are presented for each LED. + +Under the "colors" directory there are two files created: "sync" and +"sync_enable". The sync_enable file controls whether the LED brightness +value is set real time or if the LED brightness value setting is deferred until +the "sync" file is written. If sync_enable is set then writing to each LED +"brightness" file will store the brightness value. Once the "sync" file is +written then each LED color defined in the node will write the brightness of +the LED in the device driver. + +If "sync_enable" is not set then writing the brightness value of the LED to the +device driver is done immediately. Writing the "sync" file has no affect. + +Directory Layout Example +------------------------ +root:/sys/class/leds/rgb:grouped_leds# ls -lR colors/ +colors/: +drwxr-xr-x 2 root root 0 Jun 28 20:21 blue +drwxr-xr-x 2 root root 0 Jun 28 20:21 green +drwxr-xr-x 2 root root 0 Jun 28 20:21 red +--w------- 1 root root 4096 Jun 28 20:21 sync +-rw------- 1 root root 4096 Jun 28 20:22 sync_enable + +colors/blue: +-rw------- 1 root root 4096 Jun 28 20:21 brightness +-r-------- 1 root root 4096 Jun 28 20:27 max_brightness + +colors/green: +-rw------- 1 root root 4096 Jun 28 20:22 brightness +-r-------- 1 root root 4096 Jun 28 20:27 max_brightness + +colors/red: +-rw------- 1 root root 4096 Jun 28 20:21 brightness +-r-------- 1 root root 4096 Jun 28 20:27 max_brightness + +Example of Writing LEDs with Sync Enabled +----------------------------------------- +Below the red, green and blue LEDs are set to corresponding values. These +values are stored and not written until the sync file is written. + +cd /sys/class/leds/rgb:grouped_leds/colors + +echo 1 > sync_enable + +echo 100 > red/brightness +echo 80 > green/brightness +echo 180 > blue/brightness + +* LED device driver has not been updated and the LED states have not changed. +* Writing the LED brightness files again will only change the stored value and +* not the device driver value. + +echo 1 > sync + +* LED device driver has been updated; the LEDs should present the brightness +* levels that have been set. Since sync_enable is still enabled writing to the +* LED brightness files will not change the current brightnesses. + +Example of Writing LEDs with Sync Disabled +------------------------------------------ +Below the values of each LED are written to the device driver immediately upon +request. + +cd /sys/class/leds/rgb:grouped_leds/colors + +echo 0 > sync_enable + +echo 100 > red/brightness // Red LED should be on with the current brightness +echo 80 > green/brightness // Green LED should be on with the current brightness +echo 180 > blue/brightness // Blue LED should be on with the current brightness +. +. +. +echo 0 > green/brightness // Green LED should be off -- 2.21.0.5.gaeb582a983