[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+hk2fbm8ppKecVJL6D9rYJizf9baV8mOmwRx6GyO+MKvJ3xBQ@mail.gmail.com>
Date: Thu, 7 Jul 2022 18:49:26 +0800
From: szuni chen <szunichen@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: ChiaEn Wu <peterwu.pub@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Daniel Thompson <daniel.thompson@...aro.org>,
Jingoo Han <jingoohan1@...il.com>, Pavel Machek <pavel@....cz>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Sebastian Reichel <sre@...nel.org>,
Chunfeng Yun <chunfeng.yun@...iatek.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Guenter Roeck <linux@...ck-us.net>,
"Krogerus, Heikki" <heikki.krogerus@...ux.intel.com>,
Helge Deller <deller@....de>,
ChiaEn Wu <chiaen_wu@...htek.com>,
Alice Chen <alice_chen@...htek.com>,
cy_huang <cy_huang@...htek.com>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
USB <linux-usb@...r.kernel.org>,
linux-iio <linux-iio@...r.kernel.org>,
"open list:FRAMEBUFFER LAYER" <linux-fbdev@...r.kernel.org>
Subject: Re: [PATCH v4 12/13] leds: flashlight: mt6370: Add Mediatek MT6370
flashlight support
Hi Andy,
Thank you for the valuable comment.
Andy Shevchenko <andy.shevchenko@...il.com> 於 2022年7月5日 週二 清晨5:06寫道:
>
> On Mon, Jul 4, 2022 at 7:43 AM ChiaEn Wu <peterwu.pub@...il.com> 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 |= 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 = 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/500us
> > + * 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 problem.",
will this meet your expectation?
>
> > +static int mt6370_led_register(struct device *parent, struct mt6370_led *led,
> > + struct led_init_data *init_data)
> > +{
> > + struct v4l2_flash_config v4l2_config = {0};
> > + int ret;
> > +
> > + ret = devm_led_classdev_flash_register_ext(parent, &led->flash,
> > + init_data);
> > + if (ret) {
> > + dev_err(parent, "Couldn't register flash %d\n", led->led_no);
> > + return ret;
> > + }
> > +
> > + mt6370_init_v4l2_flash_config(led, &v4l2_config);
> > + led->v4l2_flash = 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 = clamp_align(val, MT6370_STRBTO_MINUS, MT6370_STRBTO_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
Powered by blists - more mailing lists