Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3084065ybt; Sat, 4 Jul 2020 05:59:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydc8vpfPtBrWNn/ztdGkXNfDrYW8uwj4oGADIRtccF5dwqPk6WxQaVnW3Uw1vjpnhQkXWl X-Received: by 2002:a17:906:2b50:: with SMTP id b16mr37983881ejg.410.1593867580648; Sat, 04 Jul 2020 05:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593867580; cv=none; d=google.com; s=arc-20160816; b=GIW7RTIdcHDavGCFwErwwlyvkzDWeGFd8TFJ1x3cXkD9jje4cHgakVCB9EfWrOuu/2 TnAcXfU0yR14DmhT83R51BRFWiMI7vF7QXVIVdIB/Q5F2ums7K/1Tz3Ic52rWayieOvY mSw3YEjw3aV86TtEv6uVlWx9O/g8Ea2UO5j780btpWpOboG0R5scuUbA3nLbn1Gyti1/ uSJwP63rMHVh3OnVDiK+NJG9LP+HBT8eiMdUXbuMf3JwJPfX+mo0FamLEHdHOdWVkmpa 6TdENHBlCYAjlY0oSYbTBuLgBEtEZDYMCHzPxTSY11CJHPrnWTUk+kCQIVNOEZQZ4cLJ tHsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=41MupSsvj3hxfv4zTWAyG6BmEGjODAwX+E8BOqNp6qQ=; b=C0fwYC23eN4d6weIkXnB393BHArk13Jsry4WPQZXpyGHj8mrA5a+k8O02gAg526axj Cbs3b9OX+UmtvZNzvLnuiii58VvKzkqj+Xo8DvhA/3BGWhdPgvf+3AOYgxX+qGR4hBzr YrWsic9ysCxE4BKfYK5g2otT3AlpI5OzESRS+dt3YQcnoua1/nRYjqbiWxOdoFwJTHJ3 p/aEey1eolsMDFA6d14ig+Vin2RHeo9yh0GQbF/biIg94DyujLMdKO/A/IyE71VwZXkm kg7eg/yVmhBuWJ4rawjhPo2Rud2MfRzloURYV70N/J6Cz9rIIxBjwjT4ox+15jCT61dE pBcw== ARC-Authentication-Results: i=1; mx.google.com; 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 g21si9562760edm.199.2020.07.04.05.59.16; Sat, 04 Jul 2020 05:59:40 -0700 (PDT) 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; 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 S1727915AbgGDM7E (ORCPT + 99 others); Sat, 4 Jul 2020 08:59:04 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:48092 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbgGDM7D (ORCPT ); Sat, 4 Jul 2020 08:59:03 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id F22FD1C0BD2; Sat, 4 Jul 2020 14:59:00 +0200 (CEST) Date: Sat, 4 Jul 2020 14:59:00 +0200 From: Pavel Machek To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: Ondrej Jirman , linux-kernel@vger.kernel.org, Jacek Anaszewski , Dan Murphy , "open list:LED SUBSYSTEM" Subject: Re: [PATCH RFC] leds: Add support for per-LED device triggers Message-ID: <20200704125900.GA20503@amd> References: <20200702144712.1994685-1-megous@megous.com> <20200703120602.457cff1a@dellmb.labs.office.nic.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline In-Reply-To: <20200703120602.457cff1a@dellmb.labs.office.nic.cz> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > Some criticism to this approach to HW triggers: > - every hw trigger for each LED has to be registered via current trigger > API. This will grow code size and memory footprint once this API is > widely used > - one HW trigger can only master one LED device (via private_led > member). So if I have, for example an ethernet switch with 8 ports, > and each port has 2 LEDs, and each LED has 10 possible HW triggering > mechanisms, with your proposed API one would need to register 8*2*10 > =3D 160 triggers Well, code is simple, and so far I have seen 2 HW triggering mechanisms, not 10. Maybe we should have a function to regiter a hw trigger for a LED, so that internal implementation can be changed more easily. Ondrej: You already have code using this, right? Can we get an example? > I too have been thinking about an API for HW LED triggers, and I > tinkered with it a little. Some time ago I sent some emails, with > subjects: > "RFC: LED hw triggering API" > "about my trigger-sources work" Perhaps it is time to send them one more time, so Ondrej can say if it works for him/looks okay for him? > My current thoughts about how HW LED triggers could work nicely is as > such: > - these members (maybe with different names) shall be added to struct > led_classdev: > available_hw_triggers() > - shall return a NULL terminated list of HW trigger names > available for this LED > set_hw_trigger() > - sets HW trigger for this LED. The LED triggering API shall > call this method after previous LED trigger is unset. If > called with NULL parameter, unsets HW trigger > current_hw_trigger > - name of the currently set HW LED trigger for this LED > - the driver registering the LED cdev informs abouth the LED being > capable of HW triggering - members available_hw_triggers and > set_hw_trigger must be set > - SW LED trigger and HW LED trigger are mutualy exclusive on one LED > - the trigger file in sysfs (/sys/class/leds/LED/trigger) shall first > list the available SW triggers, and then available hw triggers for > this LED, prefixed with "hw:" > When written, if the written trigger name starts with "hw:", > instead of setting SW trigger, a HW trigger is set via > set_hw_trigger() method This does not sound bad, either. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --fdj2RfSjLxBAspz7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl8AfRQACgkQMOfwapXb+vIOgQCfU+rjWFzjMDjVUO2Au4O9+KFz J+IAoI1wY8zexgdpp1vEpFRsp/FcM/bI =mY9m -----END PGP SIGNATURE----- --fdj2RfSjLxBAspz7--