Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1079712pxf; Fri, 12 Mar 2021 01:06:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4nrOTv9RdQQRgi3cEMcXDQDAWhWWhHlwzNCt5qGRvO0xEv53LKa0UdzNzlpSXI6/QMLzg X-Received: by 2002:a05:6402:254f:: with SMTP id l15mr13008607edb.189.1615539963032; Fri, 12 Mar 2021 01:06:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615539963; cv=none; d=google.com; s=arc-20160816; b=Gw/Hyw7gG1E0vnTGjQimVL9Zbb2vaexoZR3Cu+nKzzJBZByr1ltVMLC1HOWXXzLZig 1AhgI35ghAeF0aH4hZCKzM56IF5VAZRSRV6SvvbCmt0BOeGUL+7nmuSWoTrPGFurjKy8 fPLOV58rWTim9/vnUmQ9G4ZAq/jAX0/1FluWtsAk/B0bAfbxH6Ws02qhinZqsgSLggTM d5YIDPPIhDh7B92UnoWWcbW3L22sTIUtktFLclkjbGtmQrkfBL8V6Kgq9exb4K0UXqVu oo4lEgYrLq5r0HYNFxpEDOyHatyTUlVGzzv4hUjj7os9hDQZceCYq5w3/PZQtseyn2/V 15Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=egz615yC4wK91yQ0QGqQFFpudMrIkaDSL//biUzI3Co=; b=QYox70UdZUbfEUUP/VgqIr6hu0d74z8x+1cZedoS3senLb8jm8AyAuA+NS90/rB2SM aQBzuSLAboNgyCZPBIaSoUqNCME9Lmm2ADhwEXrEoB4ffN/6E3V5J+5yxeTvOd8uMzeO oLHkayGiWWh8qx0nRLPSRF1A0z1qen7qt805fQqGuhI4uOGs77oFq+7Mj/fvqlAd7LFf xscJw5qQC/cd/FB+fb7+2hqRV+HYTz9dTLPerVPIh8la+3fUkA17xHBKmXbOtY+vHuue CyMCpMtXd+6NBiopBSybPdD7lNJIFc5hp9Y8/qDvFzCPWwQXIwzsjRqmxOKhJumSHzPF u1+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nic.cz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b26si1977903eds.574.2021.03.12.01.05.40; Fri, 12 Mar 2021 01:06:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nic.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232622AbhCLJDz convert rfc822-to-8bit (ORCPT + 99 others); Fri, 12 Mar 2021 04:03:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232417AbhCLJDa (ORCPT ); Fri, 12 Mar 2021 04:03:30 -0500 X-Greylist: delayed 62617 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 12 Mar 2021 01:03:30 PST Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 889A6C061574; Fri, 12 Mar 2021 01:03:30 -0800 (PST) Received: from localhost (unknown [IPv6:2a0e:b107:ae1:0:3e97:eff:fe61:c680]) by mail.nic.cz (Postfix) with ESMTPSA id 493681408F2; Fri, 12 Mar 2021 10:03:28 +0100 (CET) Date: Fri, 12 Mar 2021 10:03:27 +0100 From: Marek Behun To: Hermes Zhang Cc: Alexander Dahl , "linux-leds@vger.kernel.org" , Pavel Machek , Dan Murphy , kernel , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] leds: leds-dual-gpio: Add dual GPIO LEDs driver Message-ID: <20210312100327.3c3c47ba@nic.cz> In-Reply-To: References: <20210311130408.10820-1-chenhui.zhang@axis.com> <2315048.uTtSMl1LR1@ada> X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-100.0 required=5.9 tests=SHORTCIRCUIT,URIBL_BLOCKED, USER_IN_WELCOMELIST,USER_IN_WHITELIST shortcircuit=ham autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.nic.cz X-Virus-Scanned: clamav-milter 0.102.2 at mail X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 Mar 2021 08:48:55 +0000 Hermes Zhang wrote: > Hi Alexander, > > > Am Donnerstag, 11. März 2021, 14:04:08 CET schrieb Hermes Zhang: > > > From: Hermes Zhang > > > > > > Introduce a new Dual GPIO LED driver. These two GPIOs LED will act as > > > one LED as normal GPIO LED but give the possibility to change the > > > intensity in four levels: OFF, LOW, MIDDLE and HIGH. > > > > Interesting use case. Is there any real world hardware wired like that you > > could point to? > > > > Yes, we have the HW, it's not a chip but just some circuit to made of. > > > > +config LEDS_DUAL_GPIO > > > + tristate "LED Support for Dual GPIO connected LEDs" > > > + depends on LEDS_CLASS > > > + depends on GPIOLIB || COMPILE_TEST > > > + help > > > + This option enables support for the two LEDs connected to GPIO > > > + outputs. These two GPIO LEDs act as one LED in the sysfs and > > > + perform different intensity by enable either one of them or both. > > > > Well, although I never had time to implement that, I suspect that could > > conflict if someone will eventually write a driver for two pin dual color LEDs > > connected to GPIO pins. We actually do that on our hardware and I know > > others do, too. > > > > I asked about that back in 2019, see this thread: > > > > https://www.spinics.net/lists/linux-leds/msg11665.html > > > > At the time the multicolor framework was not yet merged, so today I would > > probably make something which either uses the multicolor framework or at > > least has a similar interface to userspace. However, it probably won't surprise > > you all, this is not highest priority on my ToDo list. ;-) > > > > (What we actually do is pretend those are separate LEDs and ignore the > > conflicting case where both GPIOs are on and the LED is dark then.) > > > > Yes, that case seems conflict with mine, the pattern for me is like: > > P1 | P2 | LED > -- + -- + ----- > 0 | 0 | off > 0 | 1 | Any color > 1 | 0 | Any color > 1 | 1 | both on > > Now I'm investigate another way from Marek's suggestion by using REGULATOR_GPIO, to see if could meet my requirement. If yes, then I do think no new driver is needed. Maybe you could even implement multicolor-gpio, now that we have multicolor LED class :) Marek