Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5910856pxb; Sun, 7 Nov 2021 23:30:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAqA0AyTV+UsTq+SkeADBPFZRtD0hjwxlydFP9ReQGXxdflihJEiMByQhrwSQvYUxdmNCk X-Received: by 2002:a17:907:2d8c:: with SMTP id gt12mr8365259ejc.61.1636356604874; Sun, 07 Nov 2021 23:30:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636356604; cv=none; d=google.com; s=arc-20160816; b=svb82+PRZboDLy4qn1U4kIX+u5MrxD7cim0GTfy5i79I1jkdG+zBHE/D5LHEkVM7Bq 7UWk+vdUfwQLbcCm+cSb4cz8Cp2svh/CWL6MLzqiDAKhke6RQOAvpsVUm4gLgSjvul8I hc9pKvzF5l8vw2LCFlVv6I1aQb63YBUyPZWi/RN64u9Pc5JBs5sHPTxIhDARIEe5Hfzw lCe3TpDOhFR8Xrc60++wkjVDCCLFLaOGG5MU4ag+43PPirIKr/vLrqDuV6PCuQx5I8Cj ZUDBOlyCHth7+ozTf2bsYB/5pIN6DVYRersI7kCYb8NZV8h5T+WVx7u2/tO2JJolWC27 akOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=DaO7a1BViMKHX1NBRkvWDUjB1rua4ERcqws+CFgZJiE=; b=UtNN9cm5RZkt2BE2zpJYnuTe+Q4+eSLHNvsUE6jZjZBrdVY7q/qMDlYk/6vvBomH+R 0X6ACQoGfBVJfOBr1AMR48BbNxOWx92FOUSJq1tZlTMSvbMZyoHucDblA8+iIzVRiCfH R9iKkCL7am4Mlx+nqN9A74klr/43rBn61+T0GFB6U0nesqzY8FciL94Y6nBoEqcKkasl 1bejALSOUzMw117GQQMJ0SHqDEmfgIo3P7dtF2LZcvdtiJafqJ8RGUy/xvG+WxCQZ64E 0Q43O4ipTOq2wIZkdqufnarDetTof7/gFKigHXuwSzzSRaK711euCtidG/efi8rfv2mu K9jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=IPS9aghJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c19si22667656ede.147.2021.11.07.23.29.42; Sun, 07 Nov 2021 23:30:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=IPS9aghJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236692AbhKHCcA (ORCPT + 99 others); Sun, 7 Nov 2021 21:32:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbhKHCb7 (ORCPT ); Sun, 7 Nov 2021 21:31:59 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1234::107]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABEC3C061570; Sun, 7 Nov 2021 18:29:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=DaO7a1BViMKHX1NBRkvWDUjB1rua4ERcqws+CFgZJiE=; b=IPS9aghJaG07vU6gMyuOjYmc0N MsjYZ1meQwVV/2oSA1o2VqcPfvBzhYQHD9VMurv521P02d2HqyiVLNEvrhqyehQVq9M03IIm5eRg4 j845ufpFjC/iYS/Ku6avPOeeIG8YIXFzJy47Aa53ePhdpaH8kKeRvtdu7jTaEcGHO/E7J/H5JMrdv id6Qw54k2wCtGRtsZ/sJNin+sKsAoIQh8eewN56y3He2AHlU39OEhwuB6Heon52rCvCfD5sVYVpKE Xxo+LVlcDzO7AdUqOq//vOUIwhIf5ndeyAOm70aqc+qylCgpaqMje4UT8D1na/XuqMcOuFfjyghik 4W0hHefw==; Received: from [2601:1c0:6280:3f0::aa0b] by merlin.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mjuPI-008fRs-WC; Mon, 08 Nov 2021 02:29:13 +0000 Subject: Re: [RFC PATCH v2 1/5] leds: trigger: add API for HW offloading of triggers To: Ansuel Smith , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Rob Herring , Jonathan Corbet , Pavel Machek , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-leds@vger.kernel.org Cc: =?UTF-8?Q?Marek_Beh=c3=ban?= References: <20211108002500.19115-1-ansuelsmth@gmail.com> <20211108002500.19115-2-ansuelsmth@gmail.com> From: Randy Dunlap Message-ID: <7e73d616-9326-ff03-639f-b3b264e64a26@infradead.org> Date: Sun, 7 Nov 2021 18:29:05 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211108002500.19115-2-ansuelsmth@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/7/21 4:24 PM, Ansuel Smith wrote: > From: Marek BehĂșn > > --- > Documentation/leds/leds-class.rst | 20 +++++++++++++++++++ > drivers/leds/led-triggers.c | 1 + > drivers/leds/trigger/Kconfig | 10 ++++++++++ > include/linux/leds.h | 33 +++++++++++++++++++++++++++++++ > 4 files changed, 64 insertions(+) > > diff --git a/Documentation/leds/leds-class.rst b/Documentation/leds/leds-class.rst > index cd155ead8703..5bf6e5d471ce 100644 > --- a/Documentation/leds/leds-class.rst > +++ b/Documentation/leds/leds-class.rst > @@ -169,6 +169,26 @@ Setting the brightness to zero with brightness_set() callback function > should completely turn off the LED and cancel the previously programmed > hardware blinking function, if any. > > +Hardware offloading of LED triggers > +=================================== > + > +Some LEDs can be driven by hardware triggers (for example a LED connected to > +an ethernet PHY or an ethernet switch can be configured to blink on activity on > +the network, which in software is done by the netdev trigger). > + > +To do such offloading, LED driver must support this and a deficated offload dedicated > +trigger must be used. The LED must implement the trigger_offload() method and > +the trigger code must try to call this method (via led_trigger_offload() > +function) to set the LED to this particular mode. (and disable any software > +blinking) > + > +The implementation of the trigger_offload() method by the LED driver must return > +0 if the offload is successful and -EOPNOTSUPP if the requested trigger > +configuration is not supported. > + > +If the second argument (enable) to the trigger_offload() method is false, any > +active HW offloading must be deactivated. In this case errors are not permitted Preferably s/HW/hardware/ and s/SW/software/ throughout documentation and Kconfig files. > +in the trigger_offload() method and the driver will be set to the new trigger. > > Known Issues > ============ > diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig > index dc6816d36d06..33aba8defeab 100644 > --- a/drivers/leds/trigger/Kconfig > +++ b/drivers/leds/trigger/Kconfig > @@ -9,6 +9,16 @@ menuconfig LEDS_TRIGGERS > > if LEDS_TRIGGERS > > +config LEDS_OFFLOAD_TRIGGERS > + bool "LED Offload Trigger support" > + help > + This option enabled offload triggers support used by leds that enables LEDs > + can be driven in hardware by declaring some specific triggers. > + A offload trigger will expose a sysfs dir to configure the > + different blinking trigger and the available hardware triggers. > + > + If unsure, say Y. -- ~Randy