From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3433DCCA485 for ; Fri, 15 Jul 2022 16:29:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233233AbiGOQ3Y (ORCPT ); Fri, 15 Jul 2022 12:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233310AbiGOQ3V (ORCPT ); Fri, 15 Jul 2022 12:29:21 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F407A220C8 for ; Fri, 15 Jul 2022 09:29:17 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id e15so2175137wro.5 for ; Fri, 15 Jul 2022 09:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=g4utnIEpgUH8SrFacOeGCRYGCTX0362lTOZoYsGdnLU=; b=OzC/9QXaaDqxoCP/B7s3PFEoW1r/3BL4QbU0Itu4yM/SSqwTf9zl3vnXpqm6D9/wLg u9IULLjrR/XGDkdPfCpFCJs5/QboFpLuQOffp2IKLY+TcH8l8BzzHthtTM5hML+jlRHO FG6Cxp7CivJKWEJLvCIuG26LkXP6sxJbO1IKctA1ERVcnJsmcMUdeLVDCwMA4onz9+H1 1MNjc+56N5uGO0uP7FpLmEqEBd9LvV4yyBSj2q2kCVBKFG5yQDPjhzHOHdM+unWA77AD SzvLrlWu0scXmQGI3iWJ+50TPqZt4sVHUFRyHKBkMNQSgWZ1mUzUSIa7VQPGG7NvSDCO TFOQ== 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; bh=g4utnIEpgUH8SrFacOeGCRYGCTX0362lTOZoYsGdnLU=; b=UB3IFhb4BnV4a88M+X1754QYpr2gpeUm9jRQFUgGHW4So4Xd5zfseT9t3i57DpaNKZ 8nCZDJ1dLS+hWeprpPqKhAQWpZ70CbQaK7Ob1kELyAnzFHCrYT9zjZk3jfrF4Lw5wdK8 6jr1DDDJ5pMIFpQUT+LbF3Jcu0cmFRHka6C3YqveeNojwN3iAm8SWjpdvFIv5uqGEL/5 /UEHKIwScF6aLtXz3px/gOlZc+h/5W7fwlczFrQrXRs7Y5YT0UzwewxL/k2xQJAi2XgW geQ+BfXvsgeb7QaqcHMx3le0IbMEV8yujIn77xOJBWjoZ7SNZrXPhDX09OcKSPuTcvGn 9T/Q== X-Gm-Message-State: AJIora9/+vo72fiRr24EaQu372Zry8HT4blEjtOgXLshfW1CoUmHIids cwDkdokAJCVi+mcdRgvaISPwFg== X-Google-Smtp-Source: AGRyM1tSF48yUDKFkMabG1ZK0Ufn2HDShLc1rfkqldFR9s050thAUB7FUGwV6hpIfcU96gErNHiZ9Q== X-Received: by 2002:a05:6000:16cb:b0:21d:7b9e:d0af with SMTP id h11-20020a05600016cb00b0021d7b9ed0afmr13306509wrf.139.1657902556488; Fri, 15 Jul 2022 09:29:16 -0700 (PDT) Received: from maple.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id h7-20020adffd47000000b0021d650e4df4sm4283198wrs.87.2022.07.15.09.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 09:29:16 -0700 (PDT) Date: Fri, 15 Jul 2022 17:29:13 +0100 From: Daniel Thompson To: AngeloGioacchino Del Regno Cc: ChiaEn Wu , lee.jones@linaro.org, jingoohan1@gmail.com, pavel@ucw.cz, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, sre@kernel.org, chunfeng.yun@mediatek.com, gregkh@linuxfoundation.org, jic23@kernel.org, lars@metafoo.de, lgirdwood@gmail.com, broonie@kernel.org, linux@roeck-us.net, heikki.krogerus@linux.intel.com, deller@gmx.de, chiaen_wu@richtek.com, alice_chen@richtek.com, cy_huang@richtek.com, dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-iio@vger.kernel.org, linux-fbdev@vger.kernel.org, szunichen@gmail.com Subject: Re: [PATCH v5 13/13] video: backlight: mt6370: Add MediaTek MT6370 support Message-ID: <20220715162913.5ewxwhv6jtdgt3c2@maple.lan> References: <20220715112607.591-1-peterwu.pub@gmail.com> <20220715112607.591-14-peterwu.pub@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Fri, Jul 15, 2022 at 02:38:45PM +0200, AngeloGioacchino Del Regno wrote: > Il 15/07/22 13:26, ChiaEn Wu ha scritto: > > From: ChiaEn Wu > > > > MediaTek MT6370 is a SubPMIC consisting of a single cell battery charger > > with ADC monitoring, RGB LEDs, dual channel flashlight, WLED backlight > > driver, display bias voltage supply, one general purpose LDO, and the > > USB Type-C & PD controller complies with the latest USB Type-C and PD > > standards. > > > > This adds support for MediaTek MT6370 Backlight driver. It's commonly used > > to drive the display WLED. There are 4 channels inside, and each channel > > supports up to 30mA of current capability with 2048 current steps in > > exponential or linear mapping curves. > > > > Signed-off-by: ChiaEn Wu > > Hello ChiaEn, > > I propose to move this one to drivers/leds (or drivers/pwm) and, instead of > registering a backlight device, register a PWM device. > > This way you will be able to reuse the generic backlight-pwm driver, as you'd > be feeding the PWM device exposed by this driver to the generic one: this will > most importantly make it easy to chain it with MTK_DISP_PWM (mtk-pwm-disp) > with a devicetree that looks like... Out of interest, does MT6370 have the same structure for backlights as the prior systems using mtk-pwm-disp or was mtk-pwm-disp simply a normal(-ish) PWM that relied on something on the board for all the constant current driver hardware? > > pwmleds-disp { > compatible = "pwm-leds"; > > disp_led: disp-pwm { > label = "backlight-pwm"; > pwms = <&pwm0 0 500000>; > max-brightness = <1024>; > }; > }; > > backlight_lcd0: backlight { > compatible = "led-backlight"; > leds = <&disp_led>, <&pmic_bl_led>; > default-brightness-level = <300>; > }; I think this proposal has to start with the devicetree bindings rather than the driver. Instead I think the question is: does this proposal result in DT bindings that better describe the underlying hardware? This device has lots of backlight centric features (OCP, OVP, single control with multiple outputs, exponential curves, etc) and its not clear where they would fit into the "PWM" bindings. Come to think of it I'm also a little worried also about the whole linear versus exponential curve thing since I thought LED drivers were required to use exponential curves. Daniel.