Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3577408imw; Thu, 7 Jul 2022 04:17:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1voiIQVrCfuQUgkaM4VvgLUrBx2j42OFtxfhyQUMBxP8eHsDJoRpDXfg62iLKYVe9bY5owc X-Received: by 2002:a17:906:2086:b0:717:4e91:f1db with SMTP id 6-20020a170906208600b007174e91f1dbmr43541851ejq.345.1657192628323; Thu, 07 Jul 2022 04:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657192628; cv=none; d=google.com; s=arc-20160816; b=uy42XaL7wZFPxueGiOLFicUiPxwQAvj89ypPNPUn8w410ckVrg15h/+dsJrUBa3yHj hsWtRVXgSwZyItHz9z7zZxk/SHghhvepQPM9/ajKLz5y5D2CRN8p8jpzT20zwCZuvl5A WDZ0t+tJf6JJGdIXvKmsOTluw7x27vtYKQH/Sk1OhgMFTIvLNKfto2B38qvh751pUodk Cwp6wPf3gthJCI8OJWdwDzctFAnUwpj3pmKnAx/qmPCJMm6G5SXOJUXYYNaTWEr+2zNQ mPsxPTNJ5luzjYhj6OuPVWkeQnLqsYF/6uLsnlGsTXLQoKVFh5Lu5QqV40m2qukWxf9Z 9rew== 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=/FFWXQHfHuTAnSajIxw6WITRnf577MGViKmqh2rQTck=; b=sTAg+7gZrfmEOsnpzR2J7uAEYTVv7NffWr4i/vr461UZ1H7cKQ69rpzo85mfIuvq7r 8udL9tBQqaFHChaRVjjk/eZS84H1YUBFZGGyHlpylLbA+z26X+2FRjznW6OIYR6iIixX zKxaHmjCaOPpi3v+QaN/2RpcOz0a1uWkNGldtWBkKeuMgUWsAnJcVMNl8Y876gb+vYkE n+yu93HBzsuDQ9rn8PrvaVtt7sRmhZAdyB/HvCF1W57Gs4L9Rz0c/vNExbI/dNCnaRoC lr1yz3u5qXFWrzLEb3ktljdmGly5Q9h90thQG5lUSFLoznOFSwNoiuozAhOrU6WcgxTW VWCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="pNuDXa/t"; 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 hc40-20020a17090716a800b007235c2c8a7bsi57535983ejc.855.2022.07.07.04.16.35; Thu, 07 Jul 2022 04:17:08 -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="pNuDXa/t"; 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 S235254AbiGGKtk (ORCPT + 99 others); Thu, 7 Jul 2022 06:49:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231710AbiGGKti (ORCPT ); Thu, 7 Jul 2022 06:49:38 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF112564C6; Thu, 7 Jul 2022 03:49:37 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id y9so4344889pff.12; Thu, 07 Jul 2022 03:49:37 -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=/FFWXQHfHuTAnSajIxw6WITRnf577MGViKmqh2rQTck=; b=pNuDXa/tbcZ8L6jUMcFhfkiiN+HCY2bTy8g4vxrKF0uCnbdZzaUEHFI3UEhvKFQ1UC eE6uNL4ZcikxGKWmBQMWNFn2vi2ETQWNjJHAKM/K8ooax1hYtWjIkuCEoiWjzlwmG9GX WoMgg2sO0TOL1BOmFZkYZQjlUeFnk4VUM4ID13qr9aO5fAUOHNV8WcMiuWT0KyCv3tNs yt5TOLt/k314oncIAs4MSxNIPDyesqnVGGLLLmR1OaKx2ayShDI5LtdAatcf/iDhjUT+ nlXRge1dqHFL7OZkv58zzWV44JyXq8nAHQm1a8SdNpsI3zpdsjcEr5X6BK+lhzi+b04Z O/RQ== 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=/FFWXQHfHuTAnSajIxw6WITRnf577MGViKmqh2rQTck=; b=p/tO1xIVx83xaaVnQOtPe1agONqonGUSwCMwNVjMgG+8XqFqmGWuYZWqsaHuPjo6VW 295vUjclOp1Cb8oO4S690ZRH4EmDPx79e4jjLKB78Uet3fwznhU9ghsIQcGMeR67Ap6Q xLVXfketpGr/YcJyV76oY56er0HuDwIw/Kh0+QlfmVZmqyMc98La0SBb73i5zmylmzfR BoC5ZHW28i66xi7ISstl9zdy5yynlLZpixoCnvbkBcNgmjuP+Su41XvWiaA9tFQ5gZIz DPkurssdLXEUfYDxsMb7gugIPLAVzkBc9SoAj04hzOaXh5Vc63nFI3Wqizg2Affilds6 GVhw== X-Gm-Message-State: AJIora/cpEEQMHlXGfbRHbXz3sb6382yY1YRR/of5dcV0XLcWuitsaFg N/omYqwM35/G1yCPRT16IX5aXsIPQWFKYaL3qzQ= X-Received: by 2002:a05:6a00:179e:b0:518:9e1d:1cbd with SMTP id s30-20020a056a00179e00b005189e1d1cbdmr52012436pfg.12.1657190977288; Thu, 07 Jul 2022 03:49:37 -0700 (PDT) MIME-Version: 1.0 References: <20220704053901.728-1-peterwu.pub@gmail.com> <20220704053901.728-13-peterwu.pub@gmail.com> In-Reply-To: From: szuni chen Date: Thu, 7 Jul 2022 18:49:26 +0800 Message-ID: Subject: Re: [PATCH v4 12/13] leds: flashlight: mt6370: Add Mediatek MT6370 flashlight support To: Andy Shevchenko Cc: ChiaEn Wu , 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" 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 Hi Andy, Thank you for the valuable comment. 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:06=E5=AF=AB=E9=81=93= =EF=BC=9A > > On Mon, Jul 4, 2022 at 7:43 AM ChiaEn Wu wrote: > > > Add Mediatek MT6370 flashlight support. > > ... > > > + This driver can also be built as a module. If so the module > > If so, > Thank you, I'll fix it in the next version. > > + will be called "leds-mt6370-flash.ko". > > No ".ko" part. > Thank you, I'll fix it in the next version. > ... > > > +#define MT6370_ITORCH_MINUA 25000 > > +#define MT6370_ITORCH_STEPUA 12500 > > +#define MT6370_ITORCH_MAXUA 400000 > > +#define MT6370_ITORCH_DOUBLE_MAXUA 800000 > > +#define MT6370_ISTRB_MINUA 50000 > > +#define MT6370_ISTRB_STEPUA 12500 > > +#define MT6370_ISTRB_MAXUA 1500000 > > +#define MT6370_ISTRB_DOUBLE_MAXUA 3000000 > > +#define MT6370_STRBTO_MINUS 64000 > > +#define MT6370_STRBTO_STEPUS 32000 > > +#define MT6370_STRBTO_MAXUS 2432000 > > Make units suffix visible, i.e. _US, _uA, etc. > Thank you, I'll fix it in the next version. > ... > > > + if (curr) > > + val |=3D MT6370_TORCHEN_MASK; > > + > > + > > One blank line is enough. > Thank you, I'll fix it in the next version. > ... > > > + /* > > + * Due to the current spike when turning on flash, > > + * let brightness to be kept by framework. > > brightness be > the framework > Thank you, I'll fix it in the next version. > > + * This empty function is used to > > + * prevent led_classdev_flash register ops check failure. > > + */ > Thank you, I'll fix it in the next version. > ... > > > + } else { > > + ret =3D regmap_update_bits(priv->regmap, > > + MT6370_REG_FLEDISTRB(led->led_= no), > > + MT6370_ISTROBE_MASK, val); > > > + if (ret) > > + return ret; > > Dup of the below. > Thank you, I'll fix it in the next version. > > + } > > + return ret; > > ... > > > + /* > > + * If the flash need to be on, > > + * config the flash current ramping up to the setting value > > + * Else, always recover back to the minimum one > > Missed periods. > Thank you, I'll fix it in the next version. > > + */ > > ... > > > + /* > > + * For the flash turn on/off, HW ramping up/down time is 5ms/50= 0us > > + * respectively. > > + */ > > + if (!prev && curr) > > + usleep_range(5000, 6000); > > + else if (prev && !curr) > > + udelay(500); > > Comment doesn't explain why this is suddenly a busy loop operation? > For the flash turn on/off, HW ramping up/down waiting time is 5ms/500us, respectively. The busy loop is for preventing turn on/off in wait time, which will cause unexpected problems. If I change the comment to "For the flash turn on/off, HW ramping up/down waiting time is 5ms/500us, respectively. Need to wait until HW ramping successfully to prevent the unexpected proble= m.", will this meet your expectation? > > > +static int mt6370_led_register(struct device *parent, struct mt6370_le= d *led, > > + struct led_init_data *init_data) > > +{ > > + struct v4l2_flash_config v4l2_config =3D {0}; > > + int ret; > > + > > + ret =3D devm_led_classdev_flash_register_ext(parent, &led->flas= h, > > + init_data); > > + if (ret) { > > + dev_err(parent, "Couldn't register flash %d\n", led->le= d_no); > > + return ret; > > + } > > + > > + mt6370_init_v4l2_flash_config(led, &v4l2_config); > > + led->v4l2_flash =3D v4l2_flash_init(parent, init_data->fwnode, > > + &led->flash, &v4l2_flash_ops, > > + &v4l2_config); > > + if (IS_ERR(led->v4l2_flash)) { > > + dev_err(parent, "Failed to register %d v4l2 sd\n", led-= >led_no); > > + return PTR_ERR(led->v4l2_flash); > > + } > > + > > + return 0; > > +} > > ... > > > + } else > > + val =3D clamp_align(val, MT6370_STRBTO_MINUS, MT6370_ST= RBTO_MAXUS, > > + MT6370_STRBTO_STEPUS); > > Missed {} > Thank you, I'll fix it in the next version. > > + > > + > > One blank line is enough. > Thank you, I'll fix it in the next version. > -- Yours Sincerely, Alice