From patchwork Mon Apr 1 17:33:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 161561 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp749593jan; Mon, 1 Apr 2019 10:44:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3Kw/iKlIAJKFmNcIbJFeMUCf93q2l5TusXAL09ASG2xysUHuDrgsbRpTxSi4mymZZbLEe X-Received: by 2002:aa7:8518:: with SMTP id v24mr63488904pfn.219.1554140687232; Mon, 01 Apr 2019 10:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554140687; cv=none; d=google.com; s=arc-20160816; b=uyuke5ywu7n/kxCkhn+Ft4dVNtQh6Ldreb7ETqwTOiKvK4x+GG5Tx25AVkiDK8PdNf mVD595HFpFmjvjRvfTFYenFoP2OdWyoHTXdiQK6eQT9R+IrMuUkDTF+ULpUo+6IojVKu qBTFHVLQeJZtKAa/NkG4z5MsuaqsQfiZKk6EJ0JeXxPOw+rlCPaNrA1QaAF0VZs2wS+i SUyOYbKPrWWNQVsEz1KAg994EbAY5Py6KWNSBkqcmvthWYJ25T0PzPNinKb8XBm64NZY ZoIKCkGOthkKcztmlabVq7iAAPvwBQ9EpvFS8mR59wJpULrEUe0/18yKGHspciX9H7tI /pEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=jhFtVq8XbnvL8fgMI7lfcJzn1wR46lpfAaDIbBalNxs=; b=aZ6UkT44C/bPmQEc1WLcm/M/MN2DVUqfH7XdFoe+02yExmDfELzBlgsJk+f6in6DFt GbNZU8nD4WB5lOUQgCb0m7vhbc/d7L4kQwrFmK8+C5fhefbzrPwscPN68ktBquPA2e13 4rDMzNtgTN9fiRzsMNIIJZysTqwDOr6/37OPfMn7wAVs6Gu4LUnqFvFhT31XfPrYaIEF iFTN/t+JfbtWz5R8wNfFDKsb6CmOOYpBFOnXI1vAd732QF6p3fSc/qOU0zapH9BZ15TO lLDhiH4urN66uoskfLVz/m5wrR6f+cWSt0VtFbSeAKRHJOmXGclCosBJoUG61xmpHluc cjyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=h+Nruv5D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9si9180585pgb.532.2019.04.01.10.44.46; Mon, 01 Apr 2019 10:44:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=h+Nruv5D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387781AbfDAReY (ORCPT + 31 others); Mon, 1 Apr 2019 13:34:24 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:33438 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387737AbfDAReR (ORCPT ); Mon, 1 Apr 2019 13:34:17 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x31HY5ce012709; Mon, 1 Apr 2019 12:34:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554140045; bh=jhFtVq8XbnvL8fgMI7lfcJzn1wR46lpfAaDIbBalNxs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=h+Nruv5D4/k7KSkkYycWPUCzIdJ/qjk87ge33kXpBvCMMfSuf92nI7+bTojSIVYoW Fn8KCeeJrbnUaEWU+WN8RUJoFqej1D11JLzulr0vRJnZcfWnsTghlWxt+FHfe7r7if /HuooWq1jqV439eSczhvet+8EeED0CUPJRbLryuc= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x31HY58w019961 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 1 Apr 2019 12:34:05 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 1 Apr 2019 12:34:05 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE107.ent.ti.com (157.170.170.37) 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; Mon, 1 Apr 2019 12:34:04 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x31HY4Lq036411; Mon, 1 Apr 2019 12:34:04 -0500 From: Dan Murphy To: , , CC: , , , Dan Murphy Subject: [RFC PATCH 3/5] documention: leds: Add multicolor class documentation Date: Mon, 1 Apr 2019 12:33:58 -0500 Message-ID: <20190401173400.14238-4-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20190401173400.14238-1-dmurphy@ti.com> References: <20190401173400.14238-1-dmurphy@ti.com> MIME-Version: 1.0 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 -- 2.19.0 diff --git a/Documentation/leds/leds-class-multicolor.txt b/Documentation/leds/leds-class-multicolor.txt new file mode 100644 index 000000000000..8112b99a7668 --- /dev/null +++ b/Documentation/leds/leds-class-multicolor.txt @@ -0,0 +1,99 @@ + +Multi Color LED handling under Linux +================================================= + +Authors: 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 but the led_class +framework. The led_class framework is documented in led-class.txt within this +documentation directory. + +Each colored LED is given it's 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