Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp985684ima; Wed, 24 Oct 2018 12:19:26 -0700 (PDT) X-Google-Smtp-Source: AJdET5eKqcdQ/ltXohxuT4KM3RWLobUyF4/++AyXRZ1mVO7xz2zhDDWB5pJMHM6hKXVrhBDM+xqt X-Received: by 2002:a17:902:8ec2:: with SMTP id x2-v6mr3640529plo.157.1540408766491; Wed, 24 Oct 2018 12:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540408766; cv=none; d=google.com; s=arc-20160816; b=XitsY/ZE1V+KPFRcbEXc5psSFWvwEhYQzhBMVID3uhpYhl496T/siJYUfSK6ZmF2LW Cef61+IIzOcxUvHs4DcsGjSyKwsPTbKoKWlfW+hD31MIe9fRncdDXojrL8mmUi1kzCO/ OAtD7Qsl1X0ote3HB/4UrYY4W1wbZIxuyNWOTZeGKe1l86WMmbFpwg4VGuE+i9AxhM25 9P9MJeelNngUbKPxlKL5T8/6PgsAKKlm6vXHUd4pautonKentYXM2zvN8jmnFHCqmrlF 7blWk2QkAygyCMgLvf8ESYxV5a5CrQfqrkDc/5ZRjvkH5pebatRoQsEqx6R0e2q1y2hR cbjQ== 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=pwOaWq361y+BBOuEcV2WBGuL+YC+eKSUhwrvxmiJNy0=; b=DhGhaMwfj4j8QGGM0c3mjaoyyL7IfRBizsHhp6DqVWIVCBjMifi2sIyujfbaq8ZQRW bOcJuVJ1Uc7ZckDYGL042Cid88OwWIm6CKnMEexe41vGGqAY0HGdrMiWk6EVYdrr0i0G bqgVlAHVHUgGyNblMOGJj/Vj29b8KsS5urR7Mq+yy5oyiCFf2Regi9TjtZi1rfd1Urls izYSFjqB4fjubvKXw+IFQjISkBA0U7GASI6HLE4+ufaRGUVY+I5albtvYpzCH+jsg5q8 kSXKL+jhH3y5Gxp3BOLJwUJEKcp91NDgGsVSgVOjEBE5oOb5PH3d3zUAnFlQAI174keg U9EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MzMmFWRZ; 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 p15-v6si5645989pgr.336.2018.10.24.12.19.11; Wed, 24 Oct 2018 12:19:26 -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=MzMmFWRZ; 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 S1727004AbeJYDqt (ORCPT + 99 others); Wed, 24 Oct 2018 23:46:49 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:45101 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbeJYDqt (ORCPT ); Wed, 24 Oct 2018 23:46:49 -0400 Received: by mail-lj1-f194.google.com with SMTP id j4-v6so5827391ljc.12; Wed, 24 Oct 2018 12:17:30 -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=pwOaWq361y+BBOuEcV2WBGuL+YC+eKSUhwrvxmiJNy0=; b=MzMmFWRZz1pDcTbexFeCNy19R9HFjVIRjiYCQoMBR80S8EW4tuosCEqKUxADe6CAXN M++KMH1ML/czqziOCBk+N1jKWb223XWHMTN6rEwgFJGDjBhuOGjzRGXnJ4Qs2g4uPHvV +Hk/fNOkcyJhXXh1pieA2dye7wQsABB3D0df24BSSM6jSPNwkD7DY8/FGhx3bEoxhVSR A3hs7SY0YVNeCl0sLGs7xE07sa3DoWjHF5VKUskVFOJ6iDsCL+PZ98b5YnrPcIr2zRJb B6MjrePSUMFlQqIbl8uUNN9xbsMmp2MI0s7dVxDLOMV8d3G40rEAO73191rvtJln6YS1 8dDw== 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=pwOaWq361y+BBOuEcV2WBGuL+YC+eKSUhwrvxmiJNy0=; b=GX+jhhhEO/5f15A6atgnHXtIN9R/nbVb1JvhTnWst+w9CqGLp4OiYivhdfMExYouVT 10JCMMtxyg1zLja80pz3ExcL2Xs7wj0zABb/LqxrQ6EbG/yDOHVtfuec3ecybEFA9zGJ tjxvoVjZpcnh4G7h3lndOu31Kc50Ri1iNSwOTugwJXlmevDPUnNWKrwQwgzkhZrLuGoC 6POo/RNEwMHtmWnt/B3/nKvHuPBm4Hna+RNYYYWMGHMU2Jg7N6kTQ7b2+ZZRaCf8USYY YYCB6fv/yf/5nF2GmEY08uKDAql6I9PlPuqkNdYsr0TRIJvvUS1AoHjyRDb3Tki3Yms7 cThw== X-Gm-Message-State: AGRZ1gI6x24yovN4dVQr5Nu5e/x8J5Mvb0SrSM8xC7HbNBTntB0pB0QX 8T/a5YYGo8RZ1WB1HlmvsEfFS+xe X-Received: by 2002:a2e:98c2:: with SMTP id s2-v6mr2604953ljj.19.1540408649133; Wed, 24 Oct 2018 12:17:29 -0700 (PDT) Received: from [192.168.1.18] (bgs214.neoplus.adsl.tpnet.pl. [83.28.82.214]) by smtp.gmail.com with ESMTPSA id 134-v6sm867797lfz.76.2018.10.24.12.17.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 12:17:28 -0700 (PDT) Subject: Re: [PATCH v15 1/2] leds: core: Introduce LED pattern trigger To: Pavel Machek Cc: Baolin Wang , rteysseyre@gmail.com, bjorn.andersson@linaro.org, broonie@kernel.org, linus.walleij@linaro.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org References: <9794969ab8a5a6f62d8ac54cdebcaa3caedfc6d6.1539230481.git.baolin.wang@linaro.org> <20181024083143.GA24165@amd> From: Jacek Anaszewski Message-ID: Date: Wed, 24 Oct 2018 21:17:25 +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: <20181024083143.GA24165@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 10/24/2018 10:31 AM, Pavel Machek wrote: > Hi! > >>> + >>> + The gradual dimming format of the software pattern values should be: >>> + "brightness_1 duration_1 brightness_2 duration_2 brightness_3 >>> + duration_3 ...". For example: >>> + >>> + echo 0 1000 255 2000 > pattern >>> + >>> + It will make the LED go gradually from zero-intensity to max (255) >>> + intensity in 1000 milliseconds, then back to zero intensity in 2000 >>> + milliseconds: >>> + >>> + LED brightness >>> + ^ >>> + 255-| / \ / \ / >>> + | / \ / \ / >>> + | / \ / \ / >>> + | / \ / \ / >>> + 0-| / \/ \/ >>> + +---0----1----2----3----4----5----6------------> time (s) >>> + > > Ok, so I got around to testing this. > > echo "0 1000 10 2550 0 1000 0 100" > pattern > > makes expected pattern [ .-xXx-. ]. > > But when I do > > echo "0 1000 10 2550 0 1000" > pattern > > I only get expected pattern on the first iteration, then I get > [ Xx-. ]. This is because the tuples are processed in a loop, without discerning between start and end of the sequence. So this sequence ends up being squashed, because of the comparison: if (data->curr->brightness == data->next->brightness) { //step change od brightness ... /* Skip the tuple with zero duration */ Here we actually only assume that this is zero duration since it is not checked. Possibly needs fixing. pattern_trig_update_patterns(data); /* Select next tuple */ pattern_trig_update_patterns(data); In effect we have: 0 -> 10 // dimming 10 -> 0 // dimming 0 skipped // step 10 -> 0 // dimming 0 skipped // step 10 -> 0 // dimming ... In order to get "rise - fall - rise - fall" sequence you need only two tuples: echo "0 1000 10 1000" > pattern which will be processed as follows: 0 -> 10 // dimming 10 -> 0 // dimming 0 -> 10 // dimming 10 -> 0 // dimming 0 -> 10 // dimming 10 -> 0 // dimming > I'm using led-controller:flash on nokia n900 (so everything in > software). > >> OK, let's abide by constant update interval for now. >> >> Thank you for your work on this patch set throughout >> all these months. We will have -rc8, so one week of testing >> before sending upstream should be enough. >> >> Patch set applied to the for-next branch of linux-leds.git. > > Thanks! > Pavel > -- Best regards, Jacek Anaszewski