Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp188154imj; Thu, 14 Feb 2019 18:16:15 -0800 (PST) X-Google-Smtp-Source: AHgI3IaKspY72bc9+kM11SHK7yqNr9fCHe7X5R64O75F4pyNPr4upZ+/bjzalCESkhPcA9/u+oZP X-Received: by 2002:a17:902:584:: with SMTP id f4mr7840060plf.28.1550196975376; Thu, 14 Feb 2019 18:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550196975; cv=none; d=google.com; s=arc-20160816; b=iBfqnLuDQZT0dj4XI2YbUsTL+7oFmlMoHcO+MWpYexkKJPoEDr+ieOUg041+lDOcBS Ka28kQGgCz8kWEEu76ySN909LZZFr0wAkiKRnnHxJrYE3ioMuFYu/AheWX79/Yvxdre3 wrVNQUdRRX4eOxmwf+A5TTkFXvqpdxv6lYdrolPAE4tEvF1s8SJv+HE1XnmRtj/PSaF3 SouTfQhYu1omha26wc35JEzolk4/BI3HeRSwEDv8D1AivC6WukVz7P5eVCI6mcEbFwEP PXV3r/e25eNnhmQcCT2wI4fnwrWnVaIzavNJWN7o3qjTZ5+fN0kVortChhcS6rLMYVpr rDUQ== 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=cufxpBUZ2PFDaKJUbe1LoYEcfgdJ6Va1j/2T3vLPI/c=; b=u6+0EQXVrskGuL8uOb09mEci1HZnI0c26nno/1VyDTnCu5hY4wPZhtGBl8xGcBAi5s 64K5Ep3NKQGdb3p78zrOmehElAc3ssq4vSsFHcGzVXsiVfyA3rpyUH5RFc/p+kM7WoYJ ychktQkxDnB/3sZV7POYZGdL5w2YUYH7hbV9GsASWpjRVaUK6OauD12Ab5aa8y+rCi5C 8sOVJPJpI04H2MSklYtSjlswoyUwKCjZHLcEBqFG1r8Ynq74nD11BNg7n4iwOc1Zs+ko VpBvXaCca5YXAiPbCRNoGViR1lfadunPUo4nkIE9N2w6jErjB757UtrjkStYs54NKYF0 Zt7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EciKZRru; 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 s8si4010792plp.269.2019.02.14.18.15.59; Thu, 14 Feb 2019 18:16:15 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EciKZRru; 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 S2440234AbfBNVe6 (ORCPT + 99 others); Thu, 14 Feb 2019 16:34:58 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:35793 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436452AbfBNVe6 (ORCPT ); Thu, 14 Feb 2019 16:34:58 -0500 Received: by mail-yw1-f66.google.com with SMTP id s204so2934129ywg.2; Thu, 14 Feb 2019 13:34:57 -0800 (PST) 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=cufxpBUZ2PFDaKJUbe1LoYEcfgdJ6Va1j/2T3vLPI/c=; b=EciKZRruenGVLzCQQyf4hCrPesod4TxS48xVqCO/OQd3A8ADKzOPJEdxlznJ38XS5I Cy/VyOkpuo9Lf3hE68Hm3R2UuxR/knaYuG7AxzShCgZkIAqBHtyyYlwt3f1CdJfnk1H+ LhhkJZeF48I3GH2RrO+YMEc2sx0siT1icQ3BtWAd5XpbPksgxGOfqUWCPZ3Jrd5PRz19 xUpQozn5E6PmA7vzbXPaljg3a5snDlOQQPtfNd4K5ceUJzrM1dxFS8A0GQNoR5+VmqgD FLSbi/BuQ/lnjynHsSCVTzkl4eDDXrC30rNFarFFlSpNN9qnl4yDI8x3pZsYiM2JzNWV 9hCQ== 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=cufxpBUZ2PFDaKJUbe1LoYEcfgdJ6Va1j/2T3vLPI/c=; b=SZfY+u4eAGc63vKD1gcWS7bIPA9VYxv18hRbTOxcc3uJLWuKadAi+2g2+0mnqIbLA4 n78w4atFOBuIvFF+A+QG+c+sXi1gu/XBakRS4NjdCJZZPU3FgDszNYRn3LRY4DKsDaBa gp8FUJRltkFkq+Vj1uxxo2dWC5XMdiSXPOJT6C3wDG9x/ylXaOdAFXcWWYObZo2XbsLt 3fXHbAsCGW/S/4T48tNWzumDmS9DbLiEcpABy7Aaj9kA+p96hdVCtApsf6MLGiWG09vC pjomPXDRQ5DnjO8RgG4zuTuRr7ZhFBHXO4q5ZjRsC4jjUyNv1Nbsoz/dggD+NzY9mYiQ dgZg== X-Gm-Message-State: AHQUAuZeBz+V2g65G9yoJm8fBjnTV1R6SpROVpJVw/ekGFcdtAH+nUgM LbRWbD4jNepcYLYAsOO53fc= X-Received: by 2002:a81:5c89:: with SMTP id q131mr4982047ywb.90.1550180096879; Thu, 14 Feb 2019 13:34:56 -0800 (PST) Received: from localhost.localdomain ([46.216.144.99]) by smtp.gmail.com with ESMTPSA id r20sm1369083ywa.13.2019.02.14.13.34.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 13:34:55 -0800 (PST) Received: from [127.0.0.1] (helo=jeknote.loshitsa1.net) by localhost.localdomain with esmtp (Exim 4.92-RC4) (envelope-from ) id 1guOej-0000i2-EY; Fri, 15 Feb 2019 00:34:53 +0300 Date: Fri, 15 Feb 2019 00:34:53 +0300 From: Yauhen Kharuzhy To: Hans de Goede Cc: Pavel Machek , 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: <20190214213453.GA30250@jeknote.loshitsa1.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <562e2acd-a60a-2aea-4050-6d9414d23a4e@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On Thu, Feb 14, 2019 at 10:57:13AM +0100, Hans de Goede wrote: > > Anyway, in such case I'd propose having rmmod/reboot/poweroff hook > > that just sets it to breathing. No need to expose it to userspace. > > That assumes that breathing is the default setting on all hardware > and again I don't see why not to export this functionality to > userspace. Just because something does not fit in the existing > API is IMHO not a good reason to not expose it to userspace. > > 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] > > With the [] indicating the current mode, and writes accepting > all 3 values and updating the hw accordingly. > > This format is used in more places in the kernel and allows > for the user to easily discover the possible values. > > 2) "pattern" which when read, prints, e.g. : > on blinking [breathing] Leds class API already has pattern_set()/pattern_get() callbacks which can be used for breathing mode set/request. How this API should deal with specific 'breathing' sysfs attribute? I like the idea about specific 'pattern' attribute because this is very simple, anyway. Second issue: the 'pattern' led trigger supports default pattern initialization by device properties only, not by hardware request. Setting breathing parameters via 'pattern' led trigger may looks too complicated for users, given that only one hw-supported option exists. Pattern corresponded to hw-supported breating should contain too many (brightness, duration) tuples with minimal stepping and has no practical sense. If hw-controlled 'breathing' mode is quite common case for leds controllers, maybe it makes sense to introduce something like 'lighting mode' attribute with values 'continuous'/'breathing' without clarification of breathing parameters? What do you think about this? The same question about frequency of breathing setting. Blinking frequency can be set with existing API, but not a breathing frequency. > > 3) "frequency", when read prints, e.g. : > 0.25hz [0.5hz] 1hz 2hz > Note this controls both the blinking and breathing freq. > > Note I've not listed off anywhere, this can be achieved by > setting the brightness to 0 as we do with normal leds. > > For interactions with other APIs we can do the standard > thing where writing 0 to brightness resets things, in this > case this would reset mode to manual and pattern to on. > > And if the blinking API gets used, then too the mode should > be switched to manual, and the pattern obviously becomes > blinking. > > I believe this will work well with this hardware and > nicely allow the user to control all settings. > > Regards, > > Hans -- Yauhen Kharuzhy