Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1745266pxm; Thu, 24 Feb 2022 08:35:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyR7Ujqn4xGxBJmQG3LwH1rdiZEdH5RlAn6Fz6DKPMvhkZeeITc04EESYFnT1ftYd4i7SSm X-Received: by 2002:a63:725e:0:b0:369:f04:ac4a with SMTP id c30-20020a63725e000000b003690f04ac4amr2951460pgn.306.1645720532163; Thu, 24 Feb 2022 08:35:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645720532; cv=none; d=google.com; s=arc-20160816; b=owR+vTk+5WqmuicSlWMvTh0kYFArLTy2LS7D7ArvlPrTFpawq2DAceqXUm8421W/xY BaQOlgQR4WjBezLCe4QgPjakRyZLH6crQAcdSHZ0pz6KW/PibHUQ8V8EeXdfnjsHcnTY nRDbZ1NhXXkC3jIzjGTdE9n7xFr4T6H8isusSBvVEUjASCwSJPWgQ6rb+jEw2oOC5Eir BhchcRcezRn5mheK54JyYrAAPDbo3O8oTnYSw1B2gRGdVy0KyenSBsksNcVKDRgIwwcH hHN89JIvHZ+ggaNemvLA+bYeYzS94FMmWVeQe0MEZJnYQY9PCLeMQoU69XVY6awE9lKx o0og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=FBkptmrbjgcyXNexB1zWqSeWZWCGxggPHix7hH53JHk=; b=JNinG1RPwIr21VKCklvCYerlUSOgWlg3iStlspVpkpJYZIHqFwBO/CY9YBY9X86sp1 uBpDoYlVd/6bLFtwnbNJpJ17yAde85PuDvatcmx/b0tQpTAjzEdm5Xb980lgV84nXqZ8 QjkRPkCg+i3VX3ycfU2SZydoAIbE08cRgCtt4jNJ4UP9KFU9L+glfaewMIu9lvUt7duN wqFYT9oe5Hp5dMD2/U+1WXPsj/6upGRAZvah0MCzY9QYuHkleAEPmEL915Ys4gEHYOJM CFHRnpOpge/qDfh6aDXS5P6tIHBcLypwufHp9UE/9v4IQt8ZqNaVLOmsMoLkd9ieCW0h An4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oTmm8LPK; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id nv6si2659528pjb.94.2022.02.24.08.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:35:32 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oTmm8LPK; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 228391B3080; Thu, 24 Feb 2022 08:19:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235366AbiBXOPA (ORCPT + 99 others); Thu, 24 Feb 2022 09:15:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233446AbiBXOO5 (ORCPT ); Thu, 24 Feb 2022 09:14:57 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19DAC27909E; Thu, 24 Feb 2022 06:14:27 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id x5so3003377edd.11; Thu, 24 Feb 2022 06:14:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FBkptmrbjgcyXNexB1zWqSeWZWCGxggPHix7hH53JHk=; b=oTmm8LPK0MzPhXymI8PYrIMyp4RSZdfYJC2P0ZpWpdUtLI9GerBu57MELgq5/RfArW F7zIJw8srBE0v4xMi/F+FGGimFFJCEqyVwyRG0y/b+cEnJsd5IuYRoMEmubfGKHOJWBm rMAnXBKF7OHfREcTkb/JBSHXmhBkQWfuPkeheqxZwTh5iItauF/3Tc5NfRluxDJH/Vt4 x0DBLLKju2pazAgxYSKd5oDi/SHxKPcr3wmD0b9+hDyGhzjK1A3jPmLHFgbwY61QYEq6 6vARtmsfFC+X0/jZ2aSAp/moDFX/HMrR16cJRv7NXo67Pcs+eTU0xLiKltNfCMMnxndx shCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FBkptmrbjgcyXNexB1zWqSeWZWCGxggPHix7hH53JHk=; b=I63A8z/WQhowiH9V5EG40CrPgFp0YTsjM9emjHQb5u3/3RYW5v2q1xz/oFFn0VFIVD bFWoIHya5Ro8s4q0oznh3EDUwvx7h7EK/aLg8tBaBWxrlfO/iMF+J+QQ2iFvMM2dWhSE btbGsJ22YBsho0ghEExxu0kWmE0bFc2//6K7/XMXqlcfeO3ej7Ddjf0mEMleJiiBamHJ +/dvT1LZCZmWsBsRB/p+//MiLfxzN/gzgdzBDmwDjxczaY8wDSwtvXBO9lNCni/+Xxym LV1BCMQXDoE6Ov9/ZE0LSvH1+VO54Trly1TiepaA81BMkBQoxra/zd14o8xPErFG++Xz cNGg== X-Gm-Message-State: AOAM533Y4YCYQ7gLBfiibyvmQhG4QEduTR7a5Rba3VTE+k2zTdEhrPaI PNXcRSsC48bQJD9X/lA81/qWzHXN1B8= X-Received: by 2002:a05:6402:492:b0:404:c4bf:8b7e with SMTP id k18-20020a056402049200b00404c4bf8b7emr2462100edv.318.1645712065532; Thu, 24 Feb 2022 06:14:25 -0800 (PST) Received: from orome ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id m7sm1392562eds.104.2022.02.24.06.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 06:14:24 -0800 (PST) Date: Thu, 24 Feb 2022 15:14:22 +0100 From: Thierry Reding To: Bjorn Andersson Cc: Pavel Machek , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Lee Jones , Rob Herring , Jonathan Corbet , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-pwm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Luca Weiss , Doug Anderson Subject: Re: [PATCH v13 2/2] leds: Add driver for Qualcomm LPG Message-ID: References: <20220218183116.2261770-1-bjorn.andersson@linaro.org> <20220218183116.2261770-2-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="31AA9bs7Oglvh3xm" Content-Disposition: inline In-Reply-To: <20220218183116.2261770-2-bjorn.andersson@linaro.org> User-Agent: Mutt/2.2.1 (c8109e14) (2022-02-19) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 --31AA9bs7Oglvh3xm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 18, 2022 at 10:31:16AM -0800, Bjorn Andersson wrote: > The Light Pulse Generator (LPG) is a PWM-block found in a wide range of > PMICs from Qualcomm. These PMICs typically comes with 1-8 LPG instances, > with their output being routed to various other components, such as > current sinks or GPIOs. >=20 > Each LPG instance can operate on fixed parameters or based on a shared > lookup-table, altering the duty cycle over time. This provides the means > for hardware assisted transitions of LED brightness. >=20 > A typical use case for the fixed parameter mode is to drive a PWM > backlight control signal, the driver therefor allows each LPG instance > to be exposed to the kernel either through the LED framework or the PWM > framework. >=20 > A typical use case for the LED configuration is to drive RGB LEDs in > smartphones etc, for which the driver supports multiple channels to be > ganged up to a MULTICOLOR LED. In this configuration the pattern > generators will be synchronized, to allow for multi-color patterns. >=20 > The idea of modelling this as a LED driver ontop of a PWM driver was > considered, but setting the properties related to patterns does not fit > in the PWM API. Similarly the idea of just duplicating the lower bits in > a PWM and LED driver separately was considered, but this would not allow > the PWM channels and LEDs to be configured on a per-board basis. The > driver implements the more complex LED interface, and provides a PWM > interface on the side of that, in the same driver. >=20 > Tested-by: Luca Weiss > Tested-by: Doug Anderson > Signed-off-by: Bjorn Andersson > --- > Changes since v12: > - Initialize ret in lpg_pwm_apply() >=20 > Changes since v11: > - Extended commit message to cover decision to put pwm_chip in the LED dr= iver > - Added Documentation, in particular for the hw_pattern format > - Added a lock to synchronize requests from LED and PWM frameworks > - Turned out that the 9bit selector differs per channel in some PMICs, so > replaced bitmask in lpg_data with lookup based on QPNP SUBTYPE > - Fixed kerneldoc for the struct device pointer in struct lpg > - Rewrote conditional in lut_free() to make it easier to read > - Corrected and deduplicated max_period expression in lpg_calc_freq() > - Extended nom/dom to numerator/denominator in lpg_calc_freq() > - Replaced 1 << 9 with LPG_RESOLUTION in one more place in lpg_calc_freq() > - Use FIELD_PREP() in lpg_apply_freq() as masks was introduced for readin= g the > same in get_state() > - Cleaned up the pattern format, to allow specifying both low and high pa= use > with and without pingpong mode. > - Only update frequency and pwm_value if PWM channel is enabled in lpg_pw= m_apply > - Make lpg_pwm_get_state() read the hardware state, in order to pick up e= =2Eg. > bootloader backlight configuration > - Use devm_bitmap_zalloc() to allocate the lut_bitmap > - Use dev_err_probe() in lpg_probe() > - Extended Kconfig help text to mention module name and satisfy checkpatch >=20 > Documentation/leds/leds-qcom-lpg.rst | 76 ++ > drivers/leds/Kconfig | 3 + > drivers/leds/Makefile | 3 + > drivers/leds/rgb/Kconfig | 18 + > drivers/leds/rgb/Makefile | 3 + > drivers/leds/rgb/leds-qcom-lpg.c | 1401 ++++++++++++++++++++++++++ > 6 files changed, 1504 insertions(+) > create mode 100644 Documentation/leds/leds-qcom-lpg.rst > create mode 100644 drivers/leds/rgb/Kconfig > create mode 100644 drivers/leds/rgb/Makefile > create mode 100644 drivers/leds/rgb/leds-qcom-lpg.c Looks good to me from a PWM point of view: Acked-by: Thierry Reding --31AA9bs7Oglvh3xm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmIXkr4ACgkQ3SOs138+ s6FG6g//ad/JahWMr3wxO69qvnHidSEWsS28DQ/xb0qlzM+TSGk8x6lRI/NlMYZ3 EIrULOy7VZz0kNjmuQ3OlKKplnlk5l7SXKYD9b7MmMrYJvs5oivlJUQzXO192qHz RVkm2NupYyxbQeQTdiTeWBVwBVAvW/WOjx6Tcd+uqmkrCqnBjbLRZYjcYcMExozZ lzDVhu5x/OeusETYUsa0LY+AGIoKW585x3uO0n/nAHeETfsjHsyyKscKlJD8XdVQ WqCQB3el2k7Nmr48mVKM/JTBggadBVYrIovefP29fJoSRrvy+IXtvNc2tSvL5U0v lRGljrInbXqCjB2OgjL71fZCDNKW0J2IdDidaNDhZFayGUTtj+dnGdnb1ujgRGXY m5cOSsGYR0bk63IqfImOjU5K9FkGwQiCfudIQxMdRteez+erEGAySSG3F6Lg5fSr Qk4PTaM8sFlb6IvV+Lew1LusK0DTKlX+cALb9Ee4VoiMykvpN+I6hnsRlwbWksG4 +omgWoSI3rP5J5M3VlfjqnU3W31Oo9cT53bnlOKbATwV+Zxmsbtj+p65RFn5ETXX f6glLJvmQksc9X4zeOBdaT5SaH4dK1SIP2ZpmQ3LYjgBPb7WWkZKcZ8SfPAB3ctN 9AX1EvXj0P7DG9Q16/GhVrYBmdI+GnVauu2RyY4YXmoMqobBPMw= =MNBh -----END PGP SIGNATURE----- --31AA9bs7Oglvh3xm--