Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp908340yba; Wed, 24 Apr 2019 11:34:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqypLG6It9ZWKlutAK4eMdgTEi+53dO7HBFgGN7nyu6Ql8ZoHynyP9kcHELBCneDj3cct8z2 X-Received: by 2002:a63:5059:: with SMTP id q25mr25404996pgl.314.1556130859178; Wed, 24 Apr 2019 11:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556130859; cv=none; d=google.com; s=arc-20160816; b=g0Vvr8qmI/+iaG/1G7LTB6tEM2f92IODkt0745shMjTdsExLmFN82JNQ38rNlhBqIY /zuWgS/E0cgGICYoN3vEuMgTxJX1QuAQzUK+hNe5fw/Ysj3vod0ZuTUlg9Kw3p1Vdq/e 1JnbDuIRGn05LE2KyAUm3SCCtgWPoDNWieLHxmJMMM38Dkmmbhp6920txLvquoIboL/1 KvXvOWAM1qqRhINAk/It0gRg/08fUXPGeUcExEibnGnG2tYps0IMvDNepQZgTFBdg9hr 8rkgrxVDWIW8SWdJzkCQgyNGAzC+aPjQdci5lP+jXlkfBAYNYSRMpAbjYbxakWBulLoZ yTeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=a7PyW//ODouHJ0UFL0G/u5+dubQwstZk66ZTCET5hDg=; b=iBGH1uohd5Aa9GIQ/lWrEpkDMY1AsXX5o6rZeLyvL3Zruh6LwFUvo7a/MIghDuSKq9 UPmqsWl1vKEmnTSYMuUi+4n8KGcVydO40QlCwiH2N39ko3CerUCG9qfu12/ttQ8v44mP 5Q9snq+XKkqcU3O++YQmmw+B1u1jCBgFI7C1UghPZxdB7HPRMRG8Ze1xZjmQ6senpMT2 jFis8JnN3+OVte6d/9X4YPbOSHdySg79vSKKiMIbwSMXbdDeTjIiUmT4UP8JM3eZYiPz yx+sfd34/iZ6bd2JjELp4URGvcKEmF097lFOjEZ08kwxEskNj1lcTA2pWeYpN2BXXDDN ET6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iCTbTvOm; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a62si16895926pla.107.2019.04.24.11.34.03; Wed, 24 Apr 2019 11:34:19 -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=@gmail.com header.s=20161025 header.b=iCTbTvOm; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387677AbfDXSc7 (ORCPT + 99 others); Wed, 24 Apr 2019 14:32:59 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:41477 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733024AbfDXSc6 (ORCPT ); Wed, 24 Apr 2019 14:32:58 -0400 Received: by mail-lf1-f66.google.com with SMTP id t30so15457787lfd.8; Wed, 24 Apr 2019 11:32:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=a7PyW//ODouHJ0UFL0G/u5+dubQwstZk66ZTCET5hDg=; b=iCTbTvOmNjQO0lutCP4K479JWvDLnKRbytD2MpfFLv4uDsaXEK7P6gKr7eImEO5H9X 3FmEKvbHt6Vkc0kKtxfNMvlBgFeA8Yv+0BUl0kbvIu+QApNGe3Y/JzyzfsVVpHIHWUV6 zkDAgTybXa8OJ1raV34XvWyArlYpch9p4Clh7GOivZ+X0gVI4AI26Ad/bjSzF2ujREtX mI8HRIbDSVBhWeMdZNfCi2hGvZYeVd0TtqQENm+Gz6Zo7qgknkFMRH6eTn/97WvKrG8d Ds6a+XNSDrbcwp66E209jnDyJeBO5CJ5nAe5dqwlBCdxo7mOmwMmIBcP9HV1W/K64kOL FT0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=a7PyW//ODouHJ0UFL0G/u5+dubQwstZk66ZTCET5hDg=; b=TGbJOrciV8xxGhrjkaize+cu2QZjWLYCbTdtkzHoj02WEw/oInGlgvHE+7DG3UY6zU 21PWgj6ICyToPytGZWQfKkGH/cepLBUikfkbGy90sPjs1QFA+5b8s+rudM1xSuILHMOm VUL0Ft8ezGcH20P9pqO72UiehRMb1sIejs3BIfoZH66M6kTCKB7ZsIIdSxlpQXemqyUI mL/cI9GUp3IGHFB4pxRbSUG2OedEv8bgP1CpNx9GEC58md+IoomVVzvbY1FUvgrY8yFZ wUnIxHxQc0Pm5M+qHAnx06yBzSMgbfTeTtRUso8zargyD/RXNT26YIZMJ9UWVgSjGiA1 /Tsg== X-Gm-Message-State: APjAAAUkXPgBdBAbpW8Z2WGsFOPp+vXBw2devsit/BAeitIqq9SH81hE /t+mGI69f5Z6LhYyD2HgxwM= X-Received: by 2002:a19:f50e:: with SMTP id j14mr17143444lfb.11.1556130776679; Wed, 24 Apr 2019 11:32:56 -0700 (PDT) Received: from localhost.localdomain ([193.183.105.170]) by smtp.gmail.com with ESMTPSA id d80sm4750993lfd.90.2019.04.24.11.32.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 11:32:55 -0700 (PDT) Received: from [127.0.0.1] (helo=jeknote.loshitsa1.net) by localhost.localdomain with esmtp (Exim 4.92) (envelope-from ) id 1hJMhP-0002iw-Tq; Wed, 24 Apr 2019 21:32:51 +0300 Date: Wed, 24 Apr 2019 21:32:51 +0300 From: Yauhen Kharuzhy To: Hans de Goede Cc: linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Jacek Anaszewski Subject: Re: [PATCH v2 0/2] Intel Cherry Trail Whiskey Cove LEDs support Message-ID: <20190424183251.GA21254@jeknote.loshitsa1.net> References: <20190212205901.13037-1-jekhor@gmail.com> <21337ca0-bb91-9ca9-117b-89c47c6b2ade@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21337ca0-bb91-9ca9-117b-89c47c6b2ade@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 21, 2019 at 09:28:42PM +0200, Hans de Goede wrote: > Hi Yauhen, > I had a discussion with Jacek Anaszewski about this in another thread and > I believe we have come up with a solution for this which should work > nicely and should allow us to move forward with your driver (after > it is reworked to match the solution. So the solution we've come up with is: > > 1) After thinking a bit more about the primary use-case for this, I've come > to the conclusion that putting LED1 / the charging LED in software-controlled > mode is also the correct thing to do on the GPD win / pocket. The reason for > this is that ideally the LED would glow while charging and be simply solid > on when the battery is full, the hw control does not allow this, so the GPD > win/pocket can benefit from sw-control too. > > 2) To allow the desired behavior we need to define a new > "-charging-glow-full-solid" trigger in > drivers/power/supply/power_supply_leds.c; and this must be the default > trigger for the Intel Cherry Trail Whiskey Cove LED driver so that > everything will just work. Also we must restore the original hw control > setting on reboot/shut-down so that this is used on the GPD win/pocket when > Linux is not running. > > 3) To be able to actually implement this new trigger we first need 2 things > in the kernel internal LED APIs: > > 3a) An API for triggers to put the LED in glowing mode, we've come up > with the following prototype for this: > > void led_trigger_glow(struct led_trigger *trigger, unsigned long *cylce_time); > > Where cycle_time is the number of milliseconds for a full glow cycle (from off > to full-on to off again). So if cylce_time is set to 1000 then the LED glows > at 1 Hz, 500, 2 HZ, etc. Note as with led_trigger_blink() the time passed to > led_trigger_glow is passed by reference as the LED driver may round it to > match what the hardware can do and the rounded value is returned to the caller > through the reference. > > 3b) 3a) in turn will require adding a new optional glow_set callback to > struct led_classdev which will then get called by led_trigger_glow if available. > > We've not discussed yet what to do if led_trigger_glow gets called on > a led_classdev which does not implement the new glow_set callback, I guess > the most sensible thing to do then is to fallback to blinking with delay_on > and delay_off set to cylce_time / 2. > > If you can make some time to work on this solution that would be great. Please > let me know if you've any questions about the solution outlined below. > > Note that glowing is only exported as in kernel functionality, I see no > use-case for exporting this to userspace and keeping this in kernel allows > us to keep things nice and simple. > Hi, Unfortunately I am too busy now at fulltime job, so I don't know when I will return to this. But I still plan to do :) -- Yauhen Kharuzhy