Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1139722rwe; Fri, 14 Apr 2023 15:10:09 -0700 (PDT) X-Google-Smtp-Source: AKy350YLwyCZ/kB6ffnXiMEqajWV/wyTRfhOEs9mEeloKOSoz9pyMzCrmMJzki089WqVEhWPgwEb X-Received: by 2002:a05:6a00:14c6:b0:63b:59a7:eafa with SMTP id w6-20020a056a0014c600b0063b59a7eafamr9803761pfu.25.1681510209230; Fri, 14 Apr 2023 15:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681510209; cv=none; d=google.com; s=arc-20160816; b=AeNC+6i6xNCVKLOv51E36PrFdasuhP8YDU5wsnW1oRjrgHk/UKGK2sCqQl3XXOGMCm x2/nxyq3HBnjqlSHsfziHCyANEp6H6smoTJJ08WL/X37kPoFTAVYe4LB4o3xPh7V8+Oq f0J05wQHaSZgrEJuSNEEpbxzjXrg4ASXx2g6LFR0CJEmG/keyvzIxVtWX/T61ULaYWIj Yw/92plspfijS/hIPGI0CntqQySwKGFUrIUSHVWTSQ8vFsLZOb+QIwuLiLy2v8e0NekQ XmYyZcRIAOecmbA2Qnw1MqFZckfJU0tK/y6yUpyP7kYwUnZfN/DAy/TBTzPT9R9vNb4T ZijA== 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 :dkim-signature; bh=s+IM/+0ZljmoOwrC8aH0N6phZc5Qbyf0wMKHprnzsNQ=; b=aQpk4JZHkkqSC1rlG8dN8irO1ABvpUBEMvcYMjVlgRM9G6Tm8GvrxrAbHAvtGJRX2H K5NTxiYExAGjaRTbHWp/T3tJB5I3EPH0GwLtm5Sq+4Naiwh2vIQFiC7v6Y6b6L7+vx0P JE3D1PpDq9szN71mPxpoqskkK94J10/ls6JiFd5Qa2So/XfRe75U4KLVzBXA4JSGSmyi H39dtG3t2eQaXzNpMoCkiML6B2yfE5a3vzSuKhLh32xC3Zcb16NFwdtTBRYa72UDOWEI R8X1S+XCgFTtCr6KVAvIUVmvliucQ+lHXRivuxFRF0fis8Vgi4b7vXEok7M6lPXdEwA8 gnAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=c3UxjVFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j21-20020a635955000000b004fbd2a5db20si5451837pgm.538.2023.04.14.15.09.56; Fri, 14 Apr 2023 15:10:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=c3UxjVFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbjDNWFp (ORCPT + 99 others); Fri, 14 Apr 2023 18:05:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbjDNWFo (ORCPT ); Fri, 14 Apr 2023 18:05:44 -0400 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5F6E3ABB; Fri, 14 Apr 2023 15:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=s+IM/+0ZljmoOwrC8aH0N6phZc5Qbyf0wMKHprnzsNQ=; b=c3UxjVFSuQJdID+wTU9Df0cxAG 9/kq8+F1ioKAvh7UHPGDdjIoJVtqOVEbu2jdTnoFr1EbEGNMjHaqr2x9c+VNA+m77Dstq0E5LHyXd t4BRU0ZRdRZXGGSYiX2Gw/aptn6ZBsaCy0wRwHZ5BHNvyRUMpS3cOq3iiWF+385cTD3bGfm/BjqVK pCb4Y/8MZMY80sSdFsJlmZUiXGtwvRHakgeU+adT8upqimxo/cD/5FZ4gMFQ2WUk3xvFiCh6mVxg1 whPTnZ5m8hK4q/sHi/LZUoVQyvJymO/uzYD0aBxu5lzihAWO2aH2XZbFy4N0IlisOeLUBtN1tv0EB KSMRImVg==; Received: from p200300ccff0c0d001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff0c:d00:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1pnRXz-00075s-Bh; Sat, 15 Apr 2023 00:05:35 +0200 Date: Sat, 15 Apr 2023 00:05:33 +0200 From: Andreas Kemnade To: Pavel Machek Cc: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Matti Vaittinen Subject: Re: [PATCH v4 2/2] leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver Message-ID: <20230415000533.534ea99b@aktux> In-Reply-To: References: <20230414055341.335456-1-andreas@kemnade.info> <20230414055341.335456-3-andreas@kemnade.info> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.24; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -1.0 (-) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pavel, On Fri, 14 Apr 2023 14:18:56 +0200 Pavel Machek wrote: > Hi! > > > The device provides 6 channels which can be individually > > turned off and on but groups of two channels share a common brightness > > register. > > Yeah, well.. Turn it into 3-channel controller with brightness or > 6-channel on/off one... You can't really share brightness. > No, I cannot change the hardware, so it is a 6-channel with limitations. And the devicetree has to describe the hardware and not the driver. What is discussable is just how the driver should deal with that: I see 5 possibilities. a) ignore the shared brightness problem (status quo) b) never set a brightness other than full on/off c) ignore one led of each pair (not register it at all{ d) couple also the on/off of the pairs, so present to userspace only max. 3 leds. e) allow full brightness control where independently possible, if LEDs are defined where that leads to conflicts, register them with max_brightness=1 and use them in on/off mode. My preference were a) or e), the most possible usages. e) has a cleaner interface to the userspace. I would not upstream b) Regards, Andreas > > +++ b/drivers/leds/Kconfig > > @@ -551,6 +551,17 @@ config LEDS_REGULATOR > > help > > This option enables support for regulator driven LEDs. > > > > +config LEDS_BD2606MVV > > + tristate "LED driver for BD2606MVV" > > + depends on LEDS_CLASS > > + depends on I2C > > + select REGMAP_I2C > > + help > > + This option enables support for BD2606MVV LED driver chips > > + accessed via the I2C bus. It supports setting brightness, with > > + the limitiation that there are groups of two channels sharing > > + a brightness setting, but not the on/off setting. > > + > > This driver can be used as a module... > > > > +static int > > +bd2606mvv_brightness_set(struct led_classdev *led_cdev, > > + enum led_brightness brightness) > > +{ > > + struct bd2606mvv_led *led = ldev_to_led(led_cdev); > > + struct bd2606mvv_priv *priv = led->priv; > > + int err; > > + > > + if (brightness == 0) > > + return regmap_update_bits(priv->regmap, > > + BD2606_REG_PWRCNT, > > + 1 << led->led_no, > > + 0); > > + > > + /* shared brightness register */ > > + err = regmap_write(priv->regmap, led->led_no / 2, > > + brightness); > > + if (err) > > + return err; > > Yeah. No. > > Best regards, > Pavel