Re: [PATCH v1 03/11] leds: aw200xx: support HWEN hardware control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 6, 2023 at 7:04 PM Dmitry Rokosov
<ddrokosov@xxxxxxxxxxxxxxxxx> wrote:
>
> HWEN is hardware control, which is used for enable/disable aw200xx chip.
> It's high active, internally pulled down to GND.
>
> After HWEN pin set high the chip begins to load the OTP information,
> which takes 200us to complete. About 200us wait time is needed for
> internal oscillator startup and display SRAM initialization. After
> display SRAM initialization, the registers in page1 to page5 can be

pages 1 to 5


> configured via i2c interface.

...

> +#include <linux/of_gpio.h>

Definitely not.

Use agnostic APIs.

...

> @@ -116,6 +117,7 @@ struct aw200xx {
>         struct mutex mutex;

>         u32 num_leds;
>         u32 display_rows;
> +       int hwen;
>         struct aw200xx_led leds[];

Side note: add a patch to use __counted_by() here.

>  };

...

> +       if (!gpio_is_valid(chip->hwen))

Absolutely not. You may not use legacy GPIO APIs.

> +               return;
> +
> +       gpio_set_value(chip->hwen, 1);

Ditto.

...

> +       usleep_range(400, 500);

fsleep() ?

...

> +static void aw200xx_disable(const struct aw200xx *const chip)
> +{
> +       if (gpio_is_valid(chip->hwen))
> +               gpio_set_value(chip->hwen, 0);
> +}

As per above.

...

> +static void aw200xx_probe_hwen(struct device *dev, struct aw200xx *chip)
> +{
> +       chip->hwen = of_get_named_gpio(dev->of_node, "awinic,hwen-gpio", 0);
> +       if (gpio_is_valid(chip->hwen))
> +               if (devm_gpio_request_one(dev, chip->hwen, GPIOF_OUT_INIT_HIGH,
> +                                         "AW200XX HWEN")) {
> +                       dev_warn(dev, "Can't request gpio %d, tag it invalid\n",
> +                                chip->hwen);
> +                       chip->hwen = -EINVAL;
> +               }
> +}

Please, rewrite this completely using supported APIs and not
deprecated or obsolete ones.

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux