Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp192398imj; Thu, 14 Feb 2019 18:21:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IaamGrZIaTAGglSjp3gI8C3dOZFe0EOq8+UfFigUPYyjhnWrmlty7Z++Gh5cxWXbA71Mg/k X-Received: by 2002:aa7:8293:: with SMTP id s19mr7709002pfm.252.1550197310875; Thu, 14 Feb 2019 18:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550197310; cv=none; d=google.com; s=arc-20160816; b=WPBKr+3E04YgHP64QyqOGkjt1vVR9QMOEtnjGxIcpU8VnnH871KCn8mqNDqkvwUGJA kn0fVtCEyjp5uXl8V4b81AEe9aMMCGuXxhjpQuUHvfCLJNbOtXxRfSMHzFTYt9q509ve 4+YbDZ18ve4BL8B/6noM3pT2UTRXvWuPKfVHVp53GN2Hf+4Gi69lpGZMvYz1CeZXpED2 rPEcygHkP/hP+Tw+keRDtK/eAVQgFrZENbOLl/6oVnYAms4DqE3xbq3GA1CH2JZbU5Ok zPZErcL+2O5Lk6hbCig3Db8K66iunnsOIwctDU0i/M3He38xNiKuIx6K22TZLBEctth/ EB/Q== 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=cbgEqGYMzHDpCtM7cwhiVFjYmevVBGbHTloB4dPQSPI=; b=VYR28PJSZrpzQjfaU/BPKaiI0LL2TzKLU0zLxXBRVsYUCOqfD02WKuT0RcPep+BGdb zntTNiWokoFbFy0+/G1ZtiIv+He5nKNttbeCSMQR3LKRdNhH3s4oiJyC8rOuNMwEiczi 84/PKRJRiCDFT02l4Yc5DRo1RbG3rF2n4eiHj45/ierTAcW0asShXexVQvXn7k1QpVCc KCjYluR2ykaSjtY3TmdU98WxNU3r/ghaBYFyT77xDhUQA7t8Glv/VTlodycfW125Yibh hbHEIcHzSpDyQnr9mPVgaq7LH8G/QQPv8Czw5CPQKb9+ejIRXMXyEpL9lkS/2afbHkvC AE8A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9si3875811pfm.36.2019.02.14.18.21.35; Thu, 14 Feb 2019 18:21:50 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728518AbfBNXDQ (ORCPT + 99 others); Thu, 14 Feb 2019 18:03:16 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:33547 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728418AbfBNXDL (ORCPT ); Thu, 14 Feb 2019 18:03:11 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 999C080378; Fri, 15 Feb 2019 00:03:01 +0100 (CET) Date: Fri, 15 Feb 2019 00:03:07 +0100 From: Pavel Machek To: Jacek Anaszewski Cc: Hans de Goede , Yauhen Kharuzhy , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [PATCH v2 1/2] leds: Add Intel Cherry Trail Whiskey Cove PMIC LEDs Message-ID: <20190214230307.GA17358@amd> References: <20190212205901.13037-1-jekhor@gmail.com> <20190212205901.13037-2-jekhor@gmail.com> <1df39a63-533f-bb68-a056-a0241f148be9@redhat.com> <20190213230731.GA8557@amd> <42078a81-e32e-81b7-528f-d1adb60d31c3@redhat.com> <20190213233806.GA11867@amd> <562e2acd-a60a-2aea-4050-6d9414d23a4e@redhat.com> <20190214111423.GE6132@amd> <92cf09b8-726d-4f1b-94ba-368a66af2246@redhat.com> <2b6faaa5-b21e-a512-de7d-ca21be5045fc@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline In-Reply-To: <2b6faaa5-b21e-a512-de7d-ca21be5045fc@gmail.com> 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 --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > >>>I suggest that we deal with this special case by adding 3 custom > >>>sysfs attributes: > >>> > >>>1) "mode" which when read, prints, e.g. : > >>>manual [on-when-charging] > >> > >>While this allows _user on console_ to control everything using echo, > >>it is not suitable for applications trying to control LEDs. > >> > >>As there's nothing special about the case here, I believe we should > >>have generic solution here. > >> > >>My preffered solution would be "hardware" trigger that leaves the LED > >>in hardware control. > > > >As you explained in the parts which I snipped, there are many > >devices which have a similar choice for a LED being under hw or > >user control. I can see how this looks like a trigger and how we > >could use the trigger API for this. > > > >I believe though, that if we implement a "virtual" (for lack of > >a better word) trigger for this, that this should be done in the > >LED core. I can envision this working like this: > > > >1) Add a: > > > >hw_control_set(struct led_classdev *led_cdev, bool enable_hw_control); >=20 > Please note that we have support for hw patterns in the pattern trigger. > (see how drivers/leds/leds-sc27xx-bltc.c makes use of it for its > breathing pattern). > We have also support for hw blinking in timer trigger via blink_set op. >=20 > In addition to that there is brightness_hw_changed sysfs attribute > with led_classdev_notify_brightness_hw_changed() LED API. >=20 > Couldn't they be used in concert to support the specific features > of the device in question? I believe main issue here is this: Hardware can automatically control the LED according to the charging status, or it can be used as normal software-controlled LED. I believe we should use trigger to select if hardware controls it or not (and then add driver-specific files to describe the details). Other proposal is in the mail thread, too. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --45Z9DzgjV8m4Oswq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlxl86sACgkQMOfwapXb+vIVrwCfWOOXkUNNo1qHi9oaIcJFMEWH /W8AnRJZrracf/phzx/edwilQCQPKppD =yr9G -----END PGP SIGNATURE----- --45Z9DzgjV8m4Oswq--