Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp244054imw; Thu, 14 Jul 2022 00:27:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ucgGIINk/lmX8BSO8WzncKe2xjRT7FIE394GLbFpM9Sq+jcYpN7316kYSzmyH+ZNj5V9Kt X-Received: by 2002:a17:907:75c6:b0:72b:496c:77c7 with SMTP id jl6-20020a17090775c600b0072b496c77c7mr7362875ejc.47.1657783625429; Thu, 14 Jul 2022 00:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657783625; cv=none; d=google.com; s=arc-20160816; b=wdYOaBfUU4cKFJXrlg4OHj/PiXioOpYKTCYkjhU1Fu+XWlTHlmnW84VKlvHJZT/dyW HzRMHjch7S7kH+SJxgrBdbuyaAhOXu6ByEE4mhLm22zQ4ZLPqgYJ3OBbHxuvwdl1sRwz XgExasLVsqH4kzMw1BTJUFDpsgkKlmW9DxB5eqxQsauv2X0K4981o0pdSCYTjn+lof1J jrSfWojJqztLvlwhgvl0JfqvQjjp1AQYWTcMIQHqUXGDy4p8EjvLcWQtOq5R2Xr6xqbs l2S4VyBv/W5uoTDzkobVuK/JcAznhbhPOre7we8Eu7ghaGOuymn41lect6nzalFjBRh+ 8pKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Q5UuNt5TPK0IuG39xN+NMro5LKgIqNbr9Zx7mA/mPiM=; b=rU33j1isMINbeJXp1f880y9f+UC1D/tgJuEgHxOGcrqcMnarBUrnGynHW90gnzhrIa jv9TEBKACHXnLDO+Kn/fOtRcPD8+j/PK7ol/XDlwhNvfV4NqZIVAZ00VMvFw8usPDlb0 zsy61sJRw42y6868PlOO0blcupQU7evhvbIp/kwSYNIDn+yrZ3NJWaRm0CbD//fo1Iiw jCk81j9K9BPnyMlC0M/5Bohq32Ce5tuHJhDVtufy26QzVG/ViC6zPVD/R7yQIo88rI8g FmX5FbagpXKSy/ekdYCZK6zVNI2Fpbnsr8r7fhP1wjhH831Brc6z1SbrH9LbnkFfTGSa vkwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=b0E3JTU5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a50eb4a000000b0043b0a9cf8bfsi174593edp.490.2022.07.14.00.26.38; Thu, 14 Jul 2022 00:27:05 -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=pass header.i=@gmail.com header.s=20210112 header.b=b0E3JTU5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235752AbiGNHNg (ORCPT + 99 others); Thu, 14 Jul 2022 03:13:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbiGNHNe (ORCPT ); Thu, 14 Jul 2022 03:13:34 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 193049E; Thu, 14 Jul 2022 00:13:32 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id v5so836724qvq.8; Thu, 14 Jul 2022 00:13:32 -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=Q5UuNt5TPK0IuG39xN+NMro5LKgIqNbr9Zx7mA/mPiM=; b=b0E3JTU5pYWhoLa3ap7YFqzgEMsmY9DzPinFwRbVIUxY93YXyUx7ZCDKj7KmfhQ21C rbLfBjhA9+2Iw8+wRoHdzOZmhqnsY+50XpmOdqNkHbt1cSMSHEnAu5vgSo2cTU4Vp00E OzftT9WeV+jRXDaaNmeyjhArEApdAVnDvnAaK0sb17BX1/wJ+erATO6cVT2LmSg5zo1C AkB0gsToiInDLayKBxHHJLxYpaxBz2afFFQmHItaY08Jtmauimz5lnfp+bStbZf1nc6w aPm7pRJ9mU/zUvlfPRnxcyejhyXF2kYZj0eimP7+p17pN8EvNWU5/v59Wtwmk5hE8TwL aWyQ== 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=Q5UuNt5TPK0IuG39xN+NMro5LKgIqNbr9Zx7mA/mPiM=; b=H2H0Hsh08lIl9isbT+fqX3nrppbpkgndA5kcwZBTP2zSZKk9UGbhT8rHlvYi4jXFYr 7fPQenKSeYkJNQx06LmB1pgkWEE3Kq/JYmEFMSpaO6lk5Lybisar1f2ynNayEsDqIfSY c5BR2Ay+hdoWCJSX8cr4sAc3cpwP95sksn0veU/oM/yJcuo+id8EDWVCZYL12mMA6OSf 21slym93QeRbtzeRVEz2xju9enlIHq7I+Z++T15bxUOpHUQxIXxOO9Ix6GmBDN5fxhYV s/ufVVA0tJXSIsy1HYQLG5TiO+1rQzKlzLu8MGjlc9L9DVvv9hLXWQBoCQ16P59Tq/0V Lm0g== X-Gm-Message-State: AJIora+IrAq/ZLuM7OhYsw/pH3i9jr02WdTCP6aykSQuCeQfSvwSddn7 a1qHJ+WBzCD2fAIGRV6G994esdpGxksiKGfKGwY= X-Received: by 2002:a0c:9a0c:0:b0:470:54d7:cfd5 with SMTP id p12-20020a0c9a0c000000b0047054d7cfd5mr6903769qvd.46.1657782811193; Thu, 14 Jul 2022 00:13:31 -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: Thu, 14 Jul 2022 15:13:19 +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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Andy Shevchenko =E6=96=BC 2022=E5=B9=B47=E6=9C= =8813=E6=97=A5 =E9=80=B1=E4=B8=89 =E6=99=9A=E4=B8=8A8:07=E5=AF=AB=E9=81=93= =EF=BC=9A > > On Wed, Jul 13, 2022 at 12:53 PM ChiaEn Wu wrote: > > 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 wrot= e: > > Please, remove unneeded context when replying! > > ... > > > > > + 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 = columns?) > > From my understanding, it is not allowed, right?? > > It's allowed to some extent.Use your common sense. > Here it's obviously broken indentation. > > ... > > > > > + 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?? > > Nope. Try again. What about fls()? I have tried two methods so far, as follows ------------------------------------------------------------- /* * prop_val =3D 1 --> 1 steps --> b'00 * prop_val =3D 2 ~ 4 --> 4 steps --> b'01 * prop_val =3D 5 ~ 16 --> 16 steps --> b'10 * prop_val =3D 17 ~ 64 --> 64 steps --> b'11 */ // 1. use fls() and ffs() combination prop_val =3D ffs(prop_val) =3D=3D fls(prop_val) ? fls(prop_val) >> 1 : (fls(prop_val) + 1) >> 1; // 2. use one line for-loop, but without fls() for (i =3D --prop_val, prop_val =3D 0; i >> 2 * prop_val !=3D 0; prop_val++= ); ------------------------------------------------------------- Do these changes meet your expectations?? > > ... > > > > > + props->max_brightness =3D min_t(u32, brightness, > > > > + MT6370_BL_MAX_BRIGHTNESS); > > > > > > One line? > > > > Ditto, it will be over 80 characters... > > As per above. > > -- > With Best Regards, > Andy Shevchenko