Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6383986imm; Mon, 23 Jul 2018 17:21:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdcOThWSe4U+mOJoirJ19zkBRQ4gN4y7skEoy/5HoExQ34l+9rjIiKw3IFc49fJFsD0y5K1 X-Received: by 2002:a17:902:22cc:: with SMTP id o12-v6mr14608165plg.68.1532391665165; Mon, 23 Jul 2018 17:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532391665; cv=none; d=google.com; s=arc-20160816; b=uqOyo93zJaAk5XCpuQHRdscEHmWARIYOuy4OpHHbxbz9g8CGUq6O5TpG6R4wyYKE29 dDtgRtdYMnsvaUmMdvlRYgpCn30DuwLEmVE9nV01J8mUtmJx6ApH+/zsiRfB8O1R1pQG O5EMfVRahskpXzKd1wt0zW6cU5yr4Xk0MsDveLN4+rJp9nYdqtn6ZQH90QYM0pEeyLtr 0gSzj8ypIXD6yD3qwCPegnO4ZH3/Oswy6xhqplgzIIypKviOCzW7kBDH4JfI1MingtJC l3MYjd0wYErFYkHvcPXofDVRUUwI8sbCLhCrEGZvcE8hnw4NMtpKq/4oHkRlF5DrFKd+ AXoQ== 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:dkim-signature:arc-authentication-results; bh=VHS1EWb9GT/7Qy/MnDqMpQcxktJ5P4zMipAxegMiH1s=; b=QhYsbOHLANOEePi0Fdc/ydyQORHZ+4A1Pq2n9wUwihpz/If6x9eZI/OUHTeKBzK3/7 aw8eIA461gqomZEGwh8Fxxo8h8MD28ON0vheMeIyVGlg4vypmYc1bQQPfTAzD1Fhwew8 V99bk/vYZI/LWurEWrCvk00npvfQVA/ZOVQybFQZ0SOWC8E04cw3f0g7yOA9X0hws+/F X1ntiJ2fAXwxLPlq4QznCPiDJRdZzER7kjAJJl2yRh286TLU8/MUE0DU1DatT5iAt5aT KNvv/ppa3yvvJ3QL7DMmG+KymTdPAMg3hBOsbSyPZ6zlQqshWQU0EqrMOoyj9XxgjsTF IIvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wm+8oyzy; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si9622164pga.298.2018.07.23.17.20.48; Mon, 23 Jul 2018 17:21:05 -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=@linaro.org header.s=google header.b=Wm+8oyzy; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388234AbeGXBXk (ORCPT + 99 others); Mon, 23 Jul 2018 21:23:40 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34826 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388149AbeGXBXk (ORCPT ); Mon, 23 Jul 2018 21:23:40 -0400 Received: by mail-pg1-f196.google.com with SMTP id e6-v6so1530421pgv.2 for ; Mon, 23 Jul 2018 17:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VHS1EWb9GT/7Qy/MnDqMpQcxktJ5P4zMipAxegMiH1s=; b=Wm+8oyzypPrg0mz9ibBX28CTzjk+QGmyiSgf8Q1EZYUaM9TtclvZ8GdsNrWCnjY5Mr 7Ikg9krnGJcW3zAJNX2gk6ahJ3dc7nufbGN7UsDkaXPVwIZyCkEFx5L0KHbwqDA2xc2t cQP1L33HY7LPVcPKNG18Z84MeUCb6h8EFqv3A= 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:user-agent; bh=VHS1EWb9GT/7Qy/MnDqMpQcxktJ5P4zMipAxegMiH1s=; b=cnl80yzQMeIP+ulYFqXbE7CX5U7wtdr5rq1lLpuxqDcRfrL63P7DYl7w5Ej3WnS2Cn GNqPSbKsC1zP9QhzTsPaHL1bZ49yEFyh2EDBQXauJYwAQVnTxFXspUGEx10a2Gh08iVo rzaQMaPn5mJoeDUHKBQO0xjWJIzHKolcIFcEuSFGc7ZmDzbe4uGHokX/b1MNiOiiT9LN wXbnFy3607QKMEBq7m2qLpUskxgdUbKVLW2kU0o6ILbBV7EMzypnTvDECzfvE1x79ROV Fhpsm/Btj0QYlo1pdczZs85Ma3Qc2N8GRSjgiSchlB5kL3U/h6X3vhsWnZlMD9xLaX+Z 9elA== X-Gm-Message-State: AOUpUlGoT40iEx/2z1TU/UTZEN9iUO6JKVRxiyK3r15mqmp7MlgQ8Fh2 2pZNPx9GmTcXILZ0VbVJM44R+A== X-Received: by 2002:a62:34c4:: with SMTP id b187-v6mr15179969pfa.15.1532391597107; Mon, 23 Jul 2018 17:19:57 -0700 (PDT) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id g10-v6sm12115863pgs.17.2018.07.23.17.19.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 17:19:56 -0700 (PDT) Date: Mon, 23 Jul 2018 17:18:51 -0700 From: Bjorn Andersson To: David Lechner Cc: Baolin Wang , Jacek Anaszewski , Pavel Machek , Mark Brown , Linux LED Subsystem , LKML Subject: Re: [PATCH v3 1/2] leds: core: Introduce generic pattern interface Message-ID: <20180724001851.GE30024@minitux> References: <1665b877dc2f886a90a00e3ca3b7425372d99b6e.1530248085.git.baolin.wang@linaro.org> <8da1b769-8aa3-9698-467a-2e7b0707fecf@gmail.com> <20180714212033.GA31950@amd> <00fa2693-9308-8d74-0124-04066a76c35a@gmail.com> <20180714222924.GA2776@amd> <20180714223907.GB2776@amd> <1138f834-e805-6076-bb5b-aa1fdc1f2606@gmail.com> <2c3a8911-150a-9b25-2a66-a9432047f96b@lechnology.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c3a8911-150a-9b25-2a66-a9432047f96b@lechnology.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun 15 Jul 18:00 PDT 2018, David Lechner wrote: > On 07/15/2018 07:22 AM, Jacek Anaszewski wrote: > > On 07/15/2018 12:39 AM, Pavel Machek wrote: > > > On Sun 2018-07-15 00:29:25, Pavel Machek wrote: > > > > On Sun 2018-07-15 00:02:57, Jacek Anaszewski wrote: > > > > > Hi Pavel, > > > > > > > > > > On 07/14/2018 11:20 PM, Pavel Machek wrote: > > > > > > Hi! > > > > > > > > > > > > > > It also drew my attention to the issue of desired pattern sysfs > > > > > > > > interface semantics on uninitialized pattern. In your implementation > > > > > > > > user seems to be unable to determine if the pattern is activated > > > > > > > > or not. We should define the semantics for this use case and > > > > > > > > describe it in the documentation. Possibly pattern could > > > > > > > > return alone new line character then. > > > > > > > > > > > > Let me take a step back: we have triggers.. like LED blinking. > > > > > > > > > > > > How is that going to interact with patterns? We probably want the > > > > > > patterns to be ignored in that case...? > > > > > > > > > > > > Which suggest to me that we should treat patterns as a trigger. I > > > > > > believe we do something similar with blinking already. > > > > > > > > > > > > Then it is easy to determine if pattern is active, and pattern > > > > > > vs. trigger issue is solved automatically. > > > > > > > > > > I'm all for it. I proposed this approach during the previous > > > > > discussions related to possible pattern interface implementations, > > > > > but you seemed not to be so enthusiastic in [0]. > > > > > > > > > > [0] https://lkml.org/lkml/2017/4/7/350 > > > > > > > > Hmm. Reading my own email now, I can't decipher it. > > > > > > > > I believe I meant "changing patterns from kernel in response to events > > > > is probably overkill"... or something like that. > > > > > > Anyway -- to clean up the confusion -- I'd like to see > > > > > > echo pattern > trigger > > > echo "1 2 3 4 5 6 7 8" > somewhere > > > > s/somewhere/pattern/ > > > > pattern trigger should create "pattern" file similarly how ledtrig-timer > > creates delay_{on|off} files. > > > > I don't think this is the best way. For example, if you want more than one > LED to have the same pattern, then the patterns will not be synchronized > between the LEDs. The same things happens now with many of the existing > triggers. For example, if I have two LEDs side-by-side using the heartbeat > trigger, they may blink at the same time or they may not, which is not > very nice. I think we can make something better. > > Perhaps a way to do this would be to use configfs to create a pattern > trigger that can be shared by multiple LEDs. Like this: > > mkdir /sys/kernel/config/leds/triggers/my-nice-pattern > echo "1 2 3 4" > /sys/kernel/config/leds/triggers/my-nice-pattern/pattern > echo my-nice-pattern > /sys/class/leds/led0/trigger > echo my-nice-pattern > /sys/class/leds/led1/trigger > In the case where you describe this as two different LEDs (to Linux) and you rely on the two enable-calls to happen fairly quickly I think you can just as well specify the same pattern in two independent triggers. This also helps by not providing the illusion of there being any synchronization between them. Regards, Bjorn