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 8BA68CCA482 for ; Wed, 13 Jul 2022 10:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235104AbiGMKxm (ORCPT ); Wed, 13 Jul 2022 06:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbiGMKxl (ORCPT ); Wed, 13 Jul 2022 06:53:41 -0400 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE58C20F6F; Wed, 13 Jul 2022 03:53:38 -0700 (PDT) Received: by mail-qt1-x830.google.com with SMTP id j27so974641qtv.4; Wed, 13 Jul 2022 03:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=DtbNdnUc44YIlF6TRQBufQhc3QEyoL5MrmX0wLT8k54=; b=Gyo9ib/QcIdb16MTJkh9cbA18WvicHplsE0W3sU861LHrnSg07BYqH7gJMgBhngnKz HcevAv8xN2yoj76j2VtRiK2gtKJVtYu4yl5/zly8b+NniYgUqKX802rsbScX12+DWFC4 f0KpI6KMxAijdVif10K4Yr7TL49g59ksBWPF+FSCOp555hmLxPKqliprXs0MwfV8RcVf ETobhf/JgYbtx1rqJ3zRweW6zFE9EFO0mg+t95Av28GUjrByGd6Dv732KM7J1jq47j2b 8+Q496cjjPl2IE4bcmCDO+D9bk6yPPzE9JlJzEBLhQ3fyJGOnWiUMtJcmMXwpI3pw5T7 noUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=DtbNdnUc44YIlF6TRQBufQhc3QEyoL5MrmX0wLT8k54=; b=2dlLst/eKigysqG5Qlhy5ahBIvichPs1QHnAmRIt4BupqfA2zVMjiac5KhdhcxC07a lpbv0f3b6yd238ANL0KfdlGyJJbnJMtvvLrVcmV8fNOMrU8ikBhlHcfJGvFTfn9dKDKB vZhxZzijHWm5YFiXCVF0d5fXNTHevC5y4t3ijPJLN8TVTRvQ/zWt7oKNDICElMI/S8fE 2lU+m+RV2Z2tmsGw+0WtqejFLX8s7kQ404g2q5rxpvLGyQrrt8TCDpuTOefM05Kk7TtA E5Ewaa4HSwVor8N4et1Jhkbp9wT+EBT/NRPIAaXwDVACGAcJQw/SBUMlF9RR98FdbJJc SlgQ== X-Gm-Message-State: AJIora8T/IGO2g/aL5RWQLCwcj2gedHWyfzCf9euRsZLd/R2dwKQoU8A zEm3KBzwCI1S5l6FH3RHpLyUpHhOZao5Dtv5U8s= X-Google-Smtp-Source: AGRyM1tW+7suTTjQXEmy3r5fN1iawLpKRhb3LKUTHZNBYRUSHZBiLtacjGwqLvPQVKDWfDQQGVrgegFbKhRRnQe+Kts= X-Received: by 2002:a05:622a:1755:b0:31e:cbdf:2e32 with SMTP id l21-20020a05622a175500b0031ecbdf2e32mr1387023qtk.548.1657709618139; Wed, 13 Jul 2022 03:53:38 -0700 (PDT) MIME-Version: 1.0 References: <20220704053901.728-1-peterwu.pub@gmail.com> <20220704053901.728-14-peterwu.pub@gmail.com> In-Reply-To: From: ChiaEn Wu Date: Wed, 13 Jul 2022 18:53:26 +0800 Message-ID: Subject: Re: [PATCH v4 13/13] video: backlight: mt6370: Add Mediatek MT6370 support To: Andy Shevchenko Cc: Lee Jones , Daniel Thompson , Jingoo Han , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Sebastian Reichel , Chunfeng Yun , Greg Kroah-Hartman , Jonathan Cameron , Lars-Peter Clausen , Liam Girdwood , Mark Brown , Guenter Roeck , "Krogerus, Heikki" , Helge Deller , ChiaEn Wu , Alice Chen , cy_huang , dri-devel , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Linux PM , USB , linux-iio , "open list:FRAMEBUFFER LAYER" , szuni chen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Hi Andy, Thanks for your reply! I have some questions want to ask you below. Andy Shevchenko =E6=96=BC 2022=E5=B9=B47=E6=9C= =885=E6=97=A5 =E9=80=B1=E4=BA=8C =E6=B8=85=E6=99=A85:14=E5=AF=AB=E9=81=93= =EF=BC=9A > > On Mon, Jul 4, 2022 at 7:43 AM ChiaEn Wu wrote: > > > > From: ChiaEn Wu > > > > Add Mediatek MT6370 Backlight support. > > ... > > > + This driver can also be built as a module. If so the module > > If so, > > > + will be called "mt6370-backlight.ko". > > No ".ko" part. > > ... > > > +#include > > Can you elaborate on this? > > > +#include > > +#include > > +#include > > +#include > > > +#include > > Can you elaborate on this? > > > +#include > > +#include > > Missed mod_devicetable.h. > > ... > > > + brightness_val[0] =3D (brightness - 1) & MT6370_BL_DIM2= _MASK; > > + brightness_val[1] =3D (brightness - 1) > > + >> fls(MT6370_BL_DIM2_MASK); > > Bad indentation. One line? Well... if indent to one line, it will be over 80 characters(or called colu= mns?) >From my understanding, it is not allowed, right?? > > ... > > > + if (priv->enable_gpio) > > Dup check. > > > + gpiod_set_value(priv->enable_gpio, brightness ? 1 : 0); > > ... > > > + brightness =3D brightness_val[1] << fls(MT6370_BL_DIM2_MASK); > > + brightness +=3D (brightness_val[0] & MT6370_BL_DIM2_MASK); > > Too many parentheses. > > ... > > > + /* > > + * prop_val =3D 1 --> 1 steps --> 0x00 > > + * prop_val =3D 2 ~ 4 --> 4 steps --> 0x01 > > + * prop_val =3D 5 ~ 16 --> 16 steps --> 0x10 > > + * prop_val =3D 17 ~ 64 --> 64 steps --> 0x11 > > + */ > > + prop_val =3D (ilog2(roundup_pow_of_two(prop_val)) + 1) = >> 1; > > Isn't something closer to get_order() or fls()? I will revise it to "(get_order(prop_va * PAGE_SIZE) + 1) / 2" and this change is meet your expectations?? > > ... > > > + props->max_brightness =3D min_t(u32, brightness, > > + MT6370_BL_MAX_BRIGHTNESS); > > One line? Ditto, it will be over 80 characters... > > ... > > > + val =3D 0; > > Do you need this here? > > > + prop_val =3D 0; > > Useless. > > > + ret =3D device_property_read_u8(dev, "mediatek,bled-channel-use= ", > > + &prop_val); > > + if (ret) { > > + dev_err(dev, "mediatek,bled-channel-use DT property mis= sing\n"); > > + return ret; > > + } > > + > > + if (!prop_val || prop_val > MT6370_BL_MAX_CH) { > > + dev_err(dev, > > + "No channel specified or over than upper bound = (%d)\n", > > + prop_val); > > + return -EINVAL; > > + } > > ... > > > +static int mt6370_bl_probe(struct platform_device *pdev) > > +{ > > + struct mt6370_priv *priv; > > + struct backlight_properties props =3D { > > + .type =3D BACKLIGHT_RAW, > > + .scale =3D BACKLIGHT_SCALE_LINEAR, > > + }; > > + int ret; > > struct device *dev =3D &pdev->dev; > > will save you a few LoCs. > > -- > With Best Regards, > Andy Shevchenko Best regards, ChiaEn Wu