Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2949756imm; Tue, 4 Sep 2018 12:39:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYuz5ckdpwkZgQsMYBssfn6z1sCpzKjPZTquVx668vo5CfSewNCQxiNKwPkMLPc0ZQipv1j X-Received: by 2002:a17:902:8d8c:: with SMTP id v12-v6mr34439176plo.94.1536089982156; Tue, 04 Sep 2018 12:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536089982; cv=none; d=google.com; s=arc-20160816; b=mQ19LNaxR/OfuSLUbUzkeXrWZuyXZDlut/F0Naqrvk859P+zzeglI4co3DNguvRNkR TKdHjgNret9QgzFUjLmShC6b7b3EvLbNMTh9yoReNGjf6SAHiH7sA2GNjNyXaumqVhWI E+giAmnm9ta3Gu31z4QqbAfb+bb9oC7tNLKeBbNXe4NKRVMmhmKnVGc2bY7e4E7WPpnn /W1XfYNn8qEXz8BDIMcWl7t7mIlPD+o2Ns9b7zhxMFzL8ZJB3dt1uhssc4l9tOMf6FGe mmD/XiSRemgW0KL7KFyXKBQezGwQuJxMr+HFfc+/MJc7IyoNa9XjWmwDvLsQMGqobFzw d/vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=tsqbdi1m3Y1Bx8nuEk1g2u0F7fj06JUZlvnFtG7xWMM=; b=va04x4FDSdpmuQgXW5vfz9qrUwaQbXJJ1ir0ePws/dwMx1Q4t7t1FMHoPFwfFZ7m3Y eYxYlIoQ3JJDLG2Nz/3ziP1r4St7sXp6b+90hmnL/BGun4FbeGYLdX2Z5RF+Tqk3axIH BeSofr9+yejCrrRBoUuZgizZtJiSDcoacdtzNiw+E060PS/ya1hbNh/nI50t7dpGXfk7 KS+0yyzDSo0oBPN+NyDE1rvCr4TqxEGbtlUxndiC7BwE/4qz7fy/X/ErUIsPtUzeYn0W FGQW6mEIv5N56L3U5TGsGXoakiq5JD1IrFHax6hZ2GnDbWiWEjkOHZLxAw2qCrSddGJC MNiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u5XAJlyW; 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 k17-v6si23478193pfj.321.2018.09.04.12.39.25; Tue, 04 Sep 2018 12:39:42 -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=u5XAJlyW; 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 S1727818AbeIEAEx (ORCPT + 99 others); Tue, 4 Sep 2018 20:04:53 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40744 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726507AbeIEAEx (ORCPT ); Tue, 4 Sep 2018 20:04:53 -0400 Received: by mail-lf1-f66.google.com with SMTP id x26-v6so3960549lfi.7; Tue, 04 Sep 2018 12:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tsqbdi1m3Y1Bx8nuEk1g2u0F7fj06JUZlvnFtG7xWMM=; b=u5XAJlyWW2tvvqN9f9XsczJaAvViBlBbxsriRbsgPpLG/Us9irmjQI2UXNTLo5S2g7 pwXmOp35gEVMs04mNPpYpFl5PiHH31nbu8Vzozru55dJ0xRHCro6UH5sZ1qX8QjEQpoD 5x8MSm+kTzI/mHz28rUQsvxiEoL4sGkIfE5vIniPV1ks2W3f0QNId1FncLnMoUHfKAOC XOnfVQSLfoJHM6d4Uir+SKM0KG2NOXTbKuzkBfryHtzh/i2VceAfuCNY/dJ8ZV7k69D9 bQUKGSM0X+Tx2IL8gjBEq9YvNOb7Az/g2W7KgOfXYHnRorL+DIOTlC7Hh4/McxNNtbxW LN8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tsqbdi1m3Y1Bx8nuEk1g2u0F7fj06JUZlvnFtG7xWMM=; b=JLjUZPA89e6QJxP1Dmg83lMcuWqgRgyRb3GOujg3FFfSmJYlgl8+IruXX2cKEA3Yyq p/jtja6ZbqbJnpeUeI97fqcAvlxvP068KwB4VRhi0jpKTHQSTWvT2Mq15wj3YOvQfVqJ lC/Ci3sEcqUxG7RxykajPvHy45lG+G0XwTRv3I7SgEAXNdI/4fXBELuzyyaPIPsWwEdn CValuJF4dLeOdPANfCcdnG1Bim5BL8soucjuA1uumXOpzaBErN2gKu2DgrBynuYD0R92 4+Y5YvQupBHo29BPQglLtfyTQ/Emc+fMmq9yxr6q3G9g1oO8DaqmhuGIZygAUJ+L3vFE hMyw== X-Gm-Message-State: APzg51CxpKuwFiox/Inm7ScNMmOHBjcQqUXnkhqTlIio9L/atCs8KNcc D7VV29QI4Q9ijSD2el8T8u0c8JEq X-Received: by 2002:a19:c20f:: with SMTP id l15-v6mr22618712lfc.21.1536089897375; Tue, 04 Sep 2018 12:38:17 -0700 (PDT) Received: from [192.168.1.18] (bgs148.neoplus.adsl.tpnet.pl. [83.28.82.148]) by smtp.gmail.com with ESMTPSA id t14-v6sm4186257ljg.17.2018.09.04.12.38.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 12:38:16 -0700 (PDT) Subject: Re: [PATCH v7 1/2] leds: core: Introduce LED pattern trigger To: Pavel Machek Cc: bjorn.andersson@linaro.org, Baolin Wang , rteysseyre@gmail.com, broonie@kernel.org, linus.walleij@linaro.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180903215323.GA21489@amd> From: Jacek Anaszewski Message-ID: Date: Tue, 4 Sep 2018 21:38:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180903215323.GA21489@amd> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/03/2018 11:53 PM, Pavel Machek wrote: > Hi! > >>> +static int pattern_trig_start_pattern(struct led_classdev *led_cdev) >>> +{ >>> + struct pattern_trig_data *data = led_cdev->trigger_data; >>> + >>> + if (!data->npatterns) >>> + return 0; >>> + >>> + if (data->is_hw_pattern) { >>> + return led_cdev->pattern_set(led_cdev, data->patterns, >>> + data->npatterns, data->repeat); >>> + } >> >> I have doubts here if it is a good idea to enforce array of tuples >> as a generic interface for all hw_patterns. It may not fit well for >> every hw pattern engine. It seems that the only feasible solution will >> be allowing drivers to come up with their own interfaces, i.e. the >> approach you proposed at first for your driver. It seems that the >> ledtrig-pattern with software pattern mechanism will be just >> a nice side effect of this series :-) >> >> Unless someone will propose a better solution. > > I believe array of tuples will work for everyone. It is just a LED, it > can change intensity over time. We have an example of different semantics in case of hw pattern for leds-sc27xx-bltc.c, from this patch set. Proposed hw_pattern ABI documentation: +What: /sys/class/leds//hw_pattern +Date: September 2018 +KernelVersion: 4.20 +Description: + Specify a hardware pattern for the SC27XX LED. For the SC27XX + LED controller, it only supports 4 hardware patterns to configure + the low time, rise time, high time and fall time for the breathing + mode, and each stage duration unit is 125ms. So the format of + the hardware pattern values should be: + "brightness_1 duration_1 brightness_2 duration_2 brightness_3 + duration_3 brightness_4 duration_4". In this case low time and high time can be easily described with use of the proposed [brightness delta_t] tuples. It is not equally obvious in case of rise time and fall time. I can imagine hw pattern that would require defining blink rate over period of time, or blink rate during rise/fall time - in the latter case we would have odd number of pattern components. Probably it wouldn't be a big deal, we'd need one "padding" value, but still there's room for improvement IMHO. >> We need a broader consensus here. I'd like to hear Pavel's opinion, >> since he's been always in favor of common pattern interface, and >> inspired this work. > > I believe Baolin did good work here. I believe it will cover most, if > not all, hardware engines out there. I think we should merge it, and > see what happens -- it should be good enough. > > (Yes, there's still more work to do, but that will be stuff like RGB > LED synchronization.) > > (And yes, one of the LED chip has pattern engine that can compute > prime numbers on its own. I don't expect to support > _that_. Fortunately, nobody but me is likely to want that pattern, so > we are still okay :-) > > https://gitlab.com/tui/tui/blob/master/ofone/tests.notcc/primes.nc > > ) > Pavel > -- Best regards, Jacek Anaszewski