Received: by 10.192.165.148 with SMTP id m20csp1565235imm; Thu, 10 May 2018 12:45:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoslog0ftcBdgc4J7C9MpgenEMWuHjrBKsLgCowTOT4ZRr9N/dypOl7S9T3kCoJ1XxZIEM0 X-Received: by 2002:a17:902:a616:: with SMTP id u22-v6mr2625306plq.186.1525981530228; Thu, 10 May 2018 12:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525981530; cv=none; d=google.com; s=arc-20160816; b=nO8h4oX/GV/ZvVFHIq4YlVjiizTJ8upfsf3HfXCpNyDKrOfySbS/sDdjODY7b+JTur zcB7yjWZ0ajgrpP1K4yVCp0/5ulUQivU3R5tD2CxcDNuvzH+Yba5fmcOuy8XWC740Bcc t6SatCNwWUEgu8DsfxYJoPrvgPTeFGj8opedZyqGIAiHvm4J/IItMsj5CIad7R6idU7e uTpvt3g9Ti/GHqxiqPDmHlodzMfF7miSgj1FgTNg0j5OYk9mSEg5lwpcV/bn3w5Mqtry +HR3zcRAtuUwWvmPxqXHKKkWyhPpDUWKl2RxVHAYf64F8wfTzmAJ0FnA5jFRh+Sf06aJ 9jpQ== 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=Y076TNhtjsxze6pCJi41dS2tneOQUJHYZDKlOSh/fi8=; b=W6vAKjallRZdK3ryl+cnm0T98le4sbZNNjBBeZjpq76yoVep5KYk6tCrKPL6dMGDNq +E/0vORuBjOml/l6s1NyEhcnYzJL/U71JojsKvCiMDjy4kQUHr77TIgKmPwp7IsJPh55 fxh1/xnK2CMHvZk9lZXmilyh1eoePq/OCn7OJOlL1CBYciRI0I4xBZj1cOeO9q+LP1v9 YioUIs9lkPdpMsGFh5wi8nKQBXxvenVXMGn4H1B7RbtGJF7UcJVAxx8QpLhYx30jl08t QuXKqsZiYFdfiqCQV82P7Bqh2KlbNq1FOCKzk037z0iN92m3H+5YY6tItlLoPlUPli1U 2xDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XzTLVoJE; 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 b62-v6si1202902pgc.505.2018.05.10.12.45.05; Thu, 10 May 2018 12:45:30 -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=XzTLVoJE; 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 S1752387AbeEJTnO (ORCPT + 99 others); Thu, 10 May 2018 15:43:14 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33759 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752370AbeEJTnL (ORCPT ); Thu, 10 May 2018 15:43:11 -0400 Received: by mail-wr0-f193.google.com with SMTP id o4-v6so3124416wrm.0; Thu, 10 May 2018 12:43:10 -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=Y076TNhtjsxze6pCJi41dS2tneOQUJHYZDKlOSh/fi8=; b=XzTLVoJEBvLBbVQ0EpoFr5JbdfGxis8q/zUjLo98SDHwUwr0hW0/1zN+r9IkbXlyfb wt8sUEAgpw8b7hmjJJqD6gK1cVTCrk7nxZRvRLpq+giKwtgoLrlaObjd4JX5T+oLsLDI KR1c/1I3NcmkMO2oRKJTvYH2/hyTO4em/YbEiSstczmIRTpHz6U4p8zBHz9KOtJE+eqg ciJ2H4Llees7Sja1Ar2Ml2p8P+kURQcipljrt5tyI19L5+snK2QkLF/IdxQREub3s7DQ gjzvwSgO3QgUgu7olUNXyjN+Nqe+e8TdaIq4LHFjU5vaJVC4oV9cCwUis4g1vWZ9eWZp 4DBA== 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=Y076TNhtjsxze6pCJi41dS2tneOQUJHYZDKlOSh/fi8=; b=JBA7NMyF7dsG8dN+hGdJMu8BIFeXAxS6fYTAo2joWqc9VYOPsx2gX/1Xu6jkbE2Ycp XtZSR+XkwMdlbDxr8X75XWFyJuQ5sqgP8Ck1cBfv+onecoehxVrEpnc+n+YGkIdc4a0D 0gTL/7Iy5bvJPqDx8j0rtL6w1AvkMtLbZIu3U8emsu8e1oVdOJ6LtD1iCkPQsdFB8rJK W/6zGXQBlKoGcPVURCvGAHm6O9CU30NpWmW3qV27VMPL+J1cAZpZkfh27WakIYKX3OUC glOs0KHv0qdaI4jMVgwsWC2804kuQBNDBC7ePiD9XpCUycqGswzZKt4NujrqgOmQk7um AAHw== X-Gm-Message-State: ALKqPwe7ef5xu8z5S1Y/wHxLzPxB3U8kg2cDR56qwwsMqqZGMdFryGgG xQBOp/U7MId2rKf+cOg7vfV90wWP X-Received: by 2002:adf:8672:: with SMTP id 47-v6mr2249904wrw.102.1525981390001; Thu, 10 May 2018 12:43:10 -0700 (PDT) Received: from [192.168.1.18] (chd94.neoplus.adsl.tpnet.pl. [83.31.1.94]) by smtp.gmail.com with ESMTPSA id 19-v6sm2547710wrz.7.2018.05.10.12.43.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 May 2018 12:43:09 -0700 (PDT) Subject: Re: [PATCH v2 2/2] leds: Add Spreadtrum SC27xx breathing light controller driver To: Pavel Machek Cc: Baolin Wang , robh+dt@kernel.org, mark.rutland@arm.com, xiaotong.lu@spreadtrum.com, broonie@kernel.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <9a2a07b8eb313ae3ba64af911337ee7ff7c9ad43.1525757122.git.baolin.wang@linaro.org> <20180509142539.GB25131@amd> <20180510113749.GG6977@amd> From: Jacek Anaszewski Message-ID: <6289571e-7224-ca5e-1acf-5b099be57302@gmail.com> Date: Thu, 10 May 2018 21:41:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180510113749.GG6977@amd> Content-Type: text/plain; charset=windows-1252; format=flowed 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 Hi Pavel, On 05/10/2018 01:37 PM, Pavel Machek wrote: > Hi! > >>>> This patch adds Spreadtrum SC27xx PMIC series breathing light controller >>>> driver, which can support 3 LEDs. Each LED can work at normal PWM mode >>>> and breathing mode. >>>> >>>> diff --git a/Documentation/ABI/testing/sysfs-class-led-driver-sc27xx b/Documentation/ABI/testing/sysfs-class-led-driver-sc27xx >>>> new file mode 100644 >>>> index 0000000..22166fb >>>> --- /dev/null >>>> +++ b/Documentation/ABI/testing/sysfs-class-led-driver-sc27xx >>>> @@ -0,0 +1,19 @@ >>>> +What: /sys/class/leds//rise_time >>>> +What: /sys/class/leds//high_time >>>> +What: /sys/class/leds//fall_time >>>> +What: /sys/class/leds//low_time >>>> +Date: May 2018 >>>> +KernelVersion: 4.18 >>>> +Contact: Xiaotong Lu >>>> +Description: >>>> + Set the pattern generator rise, high, fall and low >>>> + times (0..63). It's unit is 0.125s, it should be > 0. >>>> + >>>> + 1 - 125 ms >>>> + 2 - 250 ms >>>> + 3 - 375 ms >>>> + ... >>>> + ... >>>> + ... >>>> + 62 - 7.75 s >>>> + 63 - 7.875 s >>> >>> How does this interact with triggers? With manually setting >>> brightness? Are the pattern generators independend for the LEDs? >>> >>> Can you generate white breathing pattern? If so, how? >>> >>> How do you select between normal and breathing modes? >>> >>> I'd specify times in miliseconds or something, this is way too >>> hardware specific. >> >> Agreed. >> >>> Now... functionality like this is common between many LED >>> controllers. N900 could do this kind of "breathing", too, and it also >>> supports other patterns. >>> >>> I believe we need interface common between different LED controllers. >>> >>> And I guess it would be easiest if you dropped this part from initial >>> merge. >> >> I disagree here. We already had the same discussion at the occasion >> of the patch [0] and it turned out to be a dead-end [1]. Now we have >> neither the driver nor the generic pattern interface. >> >> We also already have some older LED class drivers that implement custom >> pattern interfaces (e.g. drivers/leds/leds-lm3533.c) and the same >> approach can be applied in this case. > > Please don't. It was mistake to implement custom pattern interfaces > back then, it is still mistake now. It turned out to be really hard to cover all known pattern generator implementations with generic interface. Sure, it would be nice to have one, but the whole discussion around [0] only unveiled the diversity of parameters to cover. And still new devices appear on the market. We would have to propose a set of pattern schemes and allow to add new ones to it. > If we really need solution now, I'd recommend "pattern" file with > > " ". > > In this specific case, hardware only supports patterns in this format: > > low_time 0 rise_time 255 high_time 255 fall_time 0 > > so driver would simply -EINVAL on anything else. I'm fine with the pattern file, but the pattern format would have to be defined in the per-driver ABI documentation. It wouldn't much differ from the custom pattern approach though, unless I'm missing some gain of having pattern setting in a uniformly named single sysfs file (with semantics differing from driver to driver). -- Best regards, Jacek Anaszewski