Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2289666imj; Mon, 18 Feb 2019 03:30:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ6JIO+V+X/3P2/MUerNteKf6IIQDH+CpcLK0JpkMifzS3SLHv9Us/WUugmHbPD2UcCCfdn X-Received: by 2002:a17:902:c23:: with SMTP id 32mr25196633pls.183.1550489407384; Mon, 18 Feb 2019 03:30:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550489407; cv=none; d=google.com; s=arc-20160816; b=syOb9Igx6WBuuXLyxRx/Kb3gSpsfF+6oo0OuH0iN/LNKvG/1/oaMAlLITnajCt+XZk YlrgRDv0X/qyq89ipRKkVuS3kUUwCJnSTKXlUvH7p75/ej2Iko4dHuSiUQ90xoV91PBE 2/a9fIOf5d4HWNlKQFMutpNeZnZ+xvmNHpizDXZDSkzP6RMd7xDFJrNmtLK3hvFRhrgu +GHpyO9DgW/ueFA1os/Nnnqe7HsleeJ029gSWVw5DUxysUBKUgXHsSkxSYlJsOF3Y2nR Gk/WYIr4bvNK0eR7GuxQbegsjLYjiwt3xrLHbryJbj7POVUUDD69HUxCbNV2iIF7gZLJ WAOg== 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; bh=+m3L/IeBglQAy401vuVM/5Heee7mjNGQdnMC755SIlk=; b=gndrNnMa8iaTLFnBCOHk226FxnGqP+KZTWb5pG4kp2/secZwQkm0BSGbmd2EQE0Xye 8qDIGgXAyjtaYO49OoTj8iU1MiKSyFzM7hay3Z89xyqhxgPh//hboekmyrvSxzgWWQDQ Q6R8phYBGUr6OmBBvNnap87VOFu/zmQI1xK/eYNJcaHKJfbOMAoOn6z6VE6uYLV2HET8 EakTYDkYKVm1/bekP/YcINKPiRHouFPePm5+2anJTGPGmcum1HlHnd2IdfsWI93MnFPW /iPUCsODTRHtlwTnG07sHtTHu1/FdHXZCOLvQ5mTWPpdsfue5/mG4FHB2iyAOMIjKWBf mKjw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si13522120plm.3.2019.02.18.03.29.51; Mon, 18 Feb 2019 03:30:07 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729681AbfBRLM2 (ORCPT + 99 others); Mon, 18 Feb 2019 06:12:28 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:42224 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729013AbfBRLM1 (ORCPT ); Mon, 18 Feb 2019 06:12:27 -0500 Received: by mail-ed1-f67.google.com with SMTP id j89so4084420edb.9 for ; Mon, 18 Feb 2019 03:12:26 -0800 (PST) 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=+m3L/IeBglQAy401vuVM/5Heee7mjNGQdnMC755SIlk=; b=o/E2UfvAh7a3v+OpyJc8ST1janLbZBBkkIy3VMliFRQyhZOd2JO4sNTVAG8pDA1CQ9 EqM74Gty4EVpY6krpLY2JDTVBmh8LgOomNHvtgFDwoUBlQeEBmHy06ZXqvs0eEWKUcQ1 MLgA455t/0GQq/kcfFdxRaoPKongsbmWSA8KGDs0flHPTgfAX0+jkfUf4O0gUFIOsw02 BrQYYV+qh0Cb7+pdiTX00AhI8c+w9T92HT9uQg/zx6wzsttw1Gkn0drqEaYJd9HB5GtY 3hLaFT2V208o8ptEFWsLX13BZSpNZKoTkklN5ZFD/+yRwvPn+ayegIQLtMiFU3dHUSRk Cu3g== X-Gm-Message-State: AHQUAuZKt6tirnXbWP4MGoMXKm1j9veBnvtKta+duxAHyJeodM/P72eD PL3jUenbtBn4iS7bDMU9pbArPw== X-Received: by 2002:a50:ed81:: with SMTP id h1mr11933707edr.145.1550488345346; Mon, 18 Feb 2019 03:12:25 -0800 (PST) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id j46sm2588236ede.6.2019.02.18.03.12.24 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 18 Feb 2019 03:12:24 -0800 (PST) Subject: Re: [PATCH v2 1/2] leds: Add Intel Cherry Trail Whiskey Cove PMIC LEDs To: Pavel Machek Cc: Jacek Anaszewski , Yauhen Kharuzhy , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org References: <3d5407a7-9458-f071-a1d5-511b09678e20@gmail.com> <87a21c4e-8e5e-c180-2ff3-eb8170746e71@redhat.com> <80971bc3-1193-83ed-913a-12f6217016c8@gmail.com> <8a263266-a41f-c916-e990-02d04de9b5d0@gmail.com> <20190216193727.GA14305@amd> <7be63b6b-8d8d-90b8-fb17-d219b87a101f@redhat.com> <20190217000851.GA29803@amd> <81cc42f5-1f3d-c7f2-eb13-c2f8c4f9bfb4@redhat.com> <20190217174549.GA13301@amd> From: Hans de Goede Message-ID: <98896f2f-1752-d52a-f755-3daa3b29a83f@redhat.com> Date: Mon, 18 Feb 2019 12:12:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190217174549.GA13301@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, On 17-02-19 18:45, Pavel Machek wrote: > Hi! > >>> I see... and yes, that would be the easiest solution. >>> >>> But somehow I see "this LED is controlled by charging state" as >>> primary and "it shows pulses instead of staying on" as secondary >>> eye-candy. >>> >>> This week there was another driver for charger LED.. but that one does >>> not do pulses. Ideally, we'd like consistent interface to the >>> userland. >>> >>> (To make it complex, the other driver supports things like: >>> LED solid on -- fully charged >>> LED blinking slowly -- charging >>> LED blinking fast -- charge error >>> LED off -- not charging). >> >> Something like that could be supported with my original hw_pattern >> proposal where we simply encode all of this in the hw-pattern file: >> >> tupple0: charging blinking_on_time >> tupple1: charging blinking_off_time >> tupple2: charging breathing_time >> tupple3: manual blinking_on_time >> tupple4: manual blinking_off_time >> tupple5: manual breathing_time > > So the userland would need to know "I'm on yoga, so 3rd tupple sets up > breathing when charging"? Yes this is for the hw_pattern file not the regular pattern file and if I've understood things correctly then the hw_pattern file is often (always?) specific to the LED controller model. See e.g. : Documentation/ABI/testing/sysfs-class-led-driver-sc27xx Also userland is not really expected to touch this, the user himself could touch it if he/she wants to customize things. >> So for this chip you mention, we do not need the breathing time (no breathing support), >> so we would get the following tupples: >> >> tupple0: not charging blinking_on_time >> tupple1: not charging blinking_off_time >> tupple2: slow charging blinking_on_time >> tupple3: slow charging blinking_off_time >> tupple4: fast charging blinking_on_time >> tupple5: fast charging blinking_off_time >> tupple6: charging error blinking_on_time >> tupple7: charging error blinking_off_time > > Patterns and their meanings are fixed (or almost) on that driver, so > fortunately that will not be neccessary. Ok, so back the Whiskey Cove PMIC LED controller, I think there was some agreement to add a hw_control sysfs attribute and simplify the hw_pattern ABI to: tupple0: blinking_on_time tupple1: blinking_off_time tupple2: breathing_time You suggested adding support for a hw_control sysfs attribute to the core, activated by a flag. I assume that there will then be a callback into the driver when that file gets written. The semantics for the Whiskey Cove PMIC LED controller are clear, but how should the patch adding support for this to the LED core describe the new hw_control sysfs attribute in: Documentation/ABI/testing/sysfs-class-led ? Or do you just want to have the basic handling in the core and then describe the semantics in a per LED controller way like how we do for hw_pattern, so for the Whiskey Cove PMIC LED controller we would add a: Documentation/ABI/testing/sysfs-class-led-cht-wc file, which we need to do anyways for the hw_pattern file? Regards, Hans > >> Where by solid on/off can be done by setting one >> of the blinking times to 0. >> >> Having hw_pattern ABIs like this where some of >> the tupples only activate on certain conditions >> might be better then a hardware_control sysfs >> file as it offers more flexibility. > > Agreed about flexibility, but I don't think it does enough to provide > hardware abstraction. It might be too much flexibility. > > Also it only works with hw controlled LEDs. > > With RGB LED multiple patterns per LED make a lot of sense (as there's > typically just one led. > > For example on N900, we have > > green: fully charged. > yellow pulsing: charging. > solid yellow: hardware feature, emergency charging. > white pulsing: happy phone, no events > blue fast pulses: message waiting > > On N900, I'm handling that in userspace, but... > > Best regards, > Pavel >