Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5925730imm; Wed, 12 Sep 2018 13:19:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZwpW9sbWc74cwMyoxwJJuujshA4EQucdXx5wBlh8CUHJ8nGwKgSpezMra0JubdT0UmBLO1 X-Received: by 2002:a17:902:24e:: with SMTP id 72-v6mr4064838plc.74.1536783547791; Wed, 12 Sep 2018 13:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536783547; cv=none; d=google.com; s=arc-20160816; b=uIf8FBbU9+9zM16YDxDwG0qfnAuG3W/e2EZscfETx5teDahSnSPhSO4pdE93UEd91o qTp0ZRidLgiP27k7Z65/fI6JwfdvY4/Q52c92pUaUu6R+PqqvCZ+h6gpvt/q8ig9nXrd cBBocmQbKutKHMlXnnO60lrchG5hIMxcmDJEDRhDseiyUwlbHlZrZioey24Y8FqvpHgf 77zEB1xdANT+9oduRfNmeh6SjcLHhJ4FuWx19Hw9gPQ0s6EISqlGwjyXpMl5Usa0L+2c QFdSmhbZX/CZlcKoqKQHCE7ky4a/yfyG2Q1I1rzG/6nJ/YIirte2f6V3B+9QkSHem4kj KWUA== 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; bh=o2EMZtEAplHmct5qa72hg2deLGO11tKo5ZpOhgrCP0I=; b=qFKAz0OFxfIwEjNtfajcLtijnxiyrekYcx2U0aNpVEMfwqfXcqlnTrfmRV5eVG+uwm DTwVof4SeFQZ4hQe4m7m024zKSemu2GfFvlsO5a9HUVPV7SGicbUcA16Go45FCenmWym UtSC+v8Hlkcb/dw3i4DjYWZYZrpXv6HPesrJd4ZC/YJLSw50EPgUF4qVAuBP3sYW5vF6 5h61oZNhUBG93MDTcSK3aJ3c0gFzk+R03Mn/mta2SKJrnqBLuZOv2lDqPAQDWa00v5r5 TJCsacVsCYN9fSNIL/LzUVtSXbBH/arM1FpFJi3ezQ63RM83E6l481eKvG4nPt/g9RZt 9Vqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KuZod6Z7; 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 c10-v6si2072288pgb.638.2018.09.12.13.18.50; Wed, 12 Sep 2018 13:19:07 -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=KuZod6Z7; 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 S1728158AbeIMBYy (ORCPT + 99 others); Wed, 12 Sep 2018 21:24:54 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:39565 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbeIMBYy (ORCPT ); Wed, 12 Sep 2018 21:24:54 -0400 Received: by mail-lf1-f67.google.com with SMTP id v77-v6so2836165lfa.6; Wed, 12 Sep 2018 13:18:42 -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=o2EMZtEAplHmct5qa72hg2deLGO11tKo5ZpOhgrCP0I=; b=KuZod6Z7NVyHJ+XM/TKjvcCHHTtsxGGfn50kHAy1pPbczeOUQ+jEIStZCaIXNJVp5S HqjcBNJY9Yybuen9+oJOVSVG5V/d8uLyIZ1AScZXzyo+cmoPN4CJhgvXnUoA3ppqUNVI 4qRzFtVMajY4USZ7gYWJm0OKGreXYeJeolEGhYilKjpwHP+ud7Qrw0meN9gqgU7UjEJN Yoz0D3mwflWwtQWtrEKL3CVG5vYEuWl4yXtlyvc8gqMVwudM83aYAX662GZRdI6m/XEZ Ajis0LfDKlDZXwpz+xnhI2G0RV8/iP5GpZq0CFeCzDYLZEkkCz3kgaXAiNozEdguHpe0 3AhQ== 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=o2EMZtEAplHmct5qa72hg2deLGO11tKo5ZpOhgrCP0I=; b=HKL5eiiz8kKGv+DpcqLcPgpdQUI9hD9yoXfqxf3hTRW5ig0xw/nQA8CTjtNFAW8tmP wO0v9cWzSLRCgwSbM2i7yPd7Hfq7WZC3Iaxu7lYrU64Evipx0Rcra4/yjQU4ppcHExoc mZ1hiZCWNEP/Ja5ypDhPeXy8n35FopccRuHS7IoNtKDFtEANo19gJoibiFEyIcRJUd0l 4PI/H7/9hmgqiZ1eWED+8v4BaXHZwpDzACgxsHXwKYBvQbofS//O/ELgdEvnLJYHzMdo hYlFUGpq6U8diO2hHON3tuVlj898sHdnoX8JlzJK5Zv4ong2OZKUK2bprjoTeGX7KKwj tKnQ== X-Gm-Message-State: APzg51D6O5RLZZJqynw61Y3GRugQDnpm9vVvXEErOXi3BC1JEyq+IBc4 QU+cmG+p2eQwTdLKxVSzmh01u3bJ X-Received: by 2002:a19:7411:: with SMTP id v17-v6mr2669150lfe.49.1536783521098; Wed, 12 Sep 2018 13:18:41 -0700 (PDT) Received: from [192.168.1.18] (bgu158.neoplus.adsl.tpnet.pl. [83.28.84.158]) by smtp.gmail.com with ESMTPSA id u191-v6sm336759lja.13.2018.09.12.13.18.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 13:18:40 -0700 (PDT) Subject: Re: [PATCH v8 1/2] leds: core: Introduce LED pattern trigger To: Pavel Machek Cc: Bjorn Andersson , Baolin Wang , rteysseyre@gmail.com, broonie@kernel.org, linus.walleij@linaro.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org References: <5a502ec29251c019ddad8f3314ab45fc0f6feaf7.1536027873.git.baolin.wang@linaro.org> <20180908050208.GY2523@minitux> <20180910211935.GA4697@amd> <20180912191820.GA27704@amd> From: Jacek Anaszewski Message-ID: Date: Wed, 12 Sep 2018 22:18:37 +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: <20180912191820.GA27704@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/12/2018 09:18 PM, Pavel Machek wrote: > Hi! > >>>>> diff --git a/Documentation/ABI/testing/sysfs-class-led-trigger-pattern b/Documentation/ABI/testing/sysfs-class-led-trigger-pattern >>>> [..] >>>>> +What: /sys/class/leds//hw_pattern >>>>> +Date: September 2018 >>>>> +KernelVersion: 4.20 >>>>> +Description: >>>>> + Specify a hardware pattern for the LED, for LED hardware that >>>>> + supports autonomously controlling brightness over time, according >>>>> + to some preprogrammed hardware patterns. >>>>> + >>>>> + Since different LED hardware can have different semantics of >>>>> + hardware patterns, each driver is expected to provide its own >>>>> + description for the hardware patterns in their ABI documentation >>>>> + file. >>>>> + >>>> >>>> So, after a full circle we're back at drivers with support for hardware >>>> patterns should have their own ABI for setting that pattern. >>>> >>>> The controls for my hardware is: >>>> * a list of brightness values >>>> * the rate of the pattern >>>> * a flag to indicate that the pattern should be played from start >>>> to end, end to start or start to end to start >>>> * a boolean indicating if the pattern should be played once or repeated >>>> indefinitely. >>> >>> No, we are not back to full circle. >>> >>> Or at least we should not be. >>> >>> Yes, hw_pattern can have some limitation pattern does not, but if you >>> take values from hw_pattern file and put them into pattern file, you >>> should get the same pattern (with more power being consumed). And that >>> property is kind of important for me, because it should keep the ABI >>> reasonable. >> >> If you looked at what we agreed on with Baolin, you'd realize >> that this property is in no way preserved. >> This is what the whole story is about - we're introducing hw_pattern >> because of difficulties in describing breathing pattern by a series >> of [brightness delta_t] tuples. >> >> And Bjorn presented another example. I'm inclined to leave the >> definition of hw_pattern semantics to the LED class drivers, >> and allow them to create related sysfs files. > > Please lets not do that. > > We already have drivers that do that and it is complete > nightmare. Some take binary code for the tiny CPU driving the LED. > > What exactly is the problem? [brightness delta_t] can describe You wrote: Yes, hw_pattern can have some limitation pattern does not, but if you take values from hw_pattern file and put them into pattern file, you should get the same pattern (with more power being consumed). The problem is that we decided to introduce hw_pattern to to take away from drivers a responsibility for translating a series of tuples, approximating the brightness curve, to the values that can be written to the hardware registers. Because this is what would need to be done to check if hw can support given series of tuples and activate it. Actually with this approach we wouldn't need hw_pattern at all, since pattern alone would do. But implementation thereof is what we could call a nightmare. What follows, your claim from the quotation is inaccurate: values from hw_pattern written to the pattern file will not produce the same pattern, at least in case of what was proposed in [0] for drivers/leds/leds-sc27xx-bltc.c. > anything single LED can do in finite time. You are right, that > [brightness delta_t] sequence may get rather long, and it may be hard > to turn that sequence into parameters. Are there any _interesting_ > sequences hardware can do but [brightness delta_t] can not store > reasonably? Please propose the implementation of pattern_set for drivers/leds/leds-sc27xx-bltc.c breathing pattern, that will setup breathing mode basing on the values from tuples. Use Baolin's patch [0] for a reference of what hardware expects. [0] https://lore.kernel.org/patchwork/patch/984246/ -- Best regards, Jacek Anaszewski