[PATCH 07/14] leds: flashlight: mt6370: Add Mediatek MT6370 flashlight support
szuni chen
szunichen at gmail.com
Thu Jun 2 05:07:08 PDT 2022
Thank you for the valuable suggestion.
Andy Shevchenko <andy.shevchenko at gmail.com> 於 2022年6月1日 週三 下午5:57寫道:
>
> On Tue, May 31, 2022 at 1:32 PM ChiaEn Wu <peterwu.pub at gmail.com> wrote:
> >
> > From: Alice Chen <alice_chen at richtek.com>
> >
> > Add Mediatek MT6370 flashlight support
>
> Same comments about the commit message.
>
> ...
>
> > +#include <linux/platform_device.h>
> > +#include <linux/property.h>
> > +#include <linux/regmap.h>
>
> + blank line?
Thanks, this will be refined in the new version.
>
> > +#include <media/v4l2-flash-led-class.h>
>
> + blank line
Thanks, this will be refined in the new version.
>
> > +enum {
> > + MT6370_LED_FLASH1,
> > + MT6370_LED_FLASH2,
> > + MT6370_MAX_LEDS
> > +};
>
> ...
>
> > + struct mt6370_led *led = container_of(fl_cdev, struct mt6370_led,
> > + flash);
>
> > + struct mt6370_led *led = container_of(fl_cdev, struct mt6370_led,
> > + flash);
>
> Make a helper out of this
>
> #define to_mt637_led() container_of()
>
> and reuse.
Thanks, this will be refined in the new version.
>
> ...
>
> > + /*
> > + * For the flash turn on/off, HW rampping up/down time is 5ms/500us,
>
> ramping
>
> > + * respectively
>
> Period!
Thanks, this will be refined in the new version.
>
> > + */
>
> ...
>
> > + const char * const states[] = { "off", "keep", "on" };
> > + const char *str;
> > + int ret;
> > +
> > + if (!fwnode_property_read_string(init_data->fwnode,
> > + "default-state", &str)) {
> > + ret = match_string(states, ARRAY_SIZE(states), str);
> > + if (ret < 0)
> > + ret = STATE_OFF;
> > +
> > + led->default_state = ret;
> > + }
>
> fwnode_property_match_string()?
Sorry, but I think the use of this function is different from my target.
I want to read the string of the "default-state" property and figure
out if the string is in the states array.
But the fwnode_property_match_string aimed to figure out if the state
in the property array.
One is a property array and another one is a state array.
>
> ...
>
> > + if (!count || count > MT6370_MAX_LEDS) {
> > + dev_err(&pdev->dev,
> > + "No child node or node count over max led number %lu\n", count);
> > + return -EINVAL;
>
> return dev_err_probe(...);
Thanks, will refine in the new version
>
> > + }
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Sincerely,
Alice Chen
More information about the Linux-mediatek
mailing list