[PATCH 3/4] gpio: rockchip: allow rockchip-gpio driver works independs on pinctrl
Andy Shevchenko
andy.shevchenko at gmail.com
Thu Mar 10 04:07:09 PST 2022
On Wed, Mar 9, 2022 at 1:41 AM Jianqun Xu <jay.xu at rock-chips.com> wrote:
>
> Currently, the rockchip_pin_bank is get from pinctrl, that binds the
> gpio driver to the pinctrl driver.
>
> rockchip-pinctrl
> ->probe
> ->register pinctrl
> ->populate gpio platform
> ...
> ->rockchip-gpio probe
> ->register gpio_chip
>
> Once the pinctrl device registered, other devices may try to configure
> pins througth pinctrl_bind_pins before probe, and if it is a gpio
through
> operation, that make a failure since gpio not ready.
>
> Heiko has provide a output-defer-list to store settings between pinctrl
> and gpio driver, once gpio register, the list will set activate.
>
> With this patch, the gpio can register itself before or without pinctrl,
> even if pinctrl driver used, we can make the gpio register before
> pinctrl by another patch to rockchip pinctrl driver.
>
> rockchip-pinctrl
> ->probe
> ->populate gpio platform
> ->rockchip-gpio probe
> ->register gpio_chip
> ->register pinctrl
>
> Since the pinctrl is registered last, other devices will do defer probe.
will defer
...
> + gc->label = kasprintf(GFP_KERNEL, "gpio%d", bank->id);
No NULL checks?
...
> + static int static_gpio_id;
> id = of_alias_get_id(np, "gpio");
> if (id < 0)
> + id = static_gpio_id++;
You haven't stress tested that, have you?
...
> + clk_prepare_enable(gpio->clk);
Error check?
...
> + printk("%s: probed %s\n", __func__, dev_name(dev));
Why printk()?!
--
With Best Regards,
Andy Shevchenko
More information about the Linux-rockchip
mailing list