mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
UPSTREAM: gpio/rockchip: fetch deferred output settings on probe
Fetch the output settings the pinctrl driver may have created for pinctrl hogs and set the relevant pins as requested. Fixes:9ce9a02039("pinctrl/rockchip: drop the gpio related codes") Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20210913224926.1260726-5-heiko@sntech.de Signed-off-by: Linus Walleij <linus.walleij@linaro.org> (cherry picked from commit59dd178e1d) Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Change-Id: I675bb8af9bfba6603e0e423211a0d9ade6a9c3ce
This commit is contained in:
committed by
Tao Huang
parent
083b5eee62
commit
aaa2148c7f
@@ -696,6 +696,7 @@ static int rockchip_gpio_probe(struct platform_device *pdev)
|
||||
struct device_node *pctlnp = of_get_parent(np);
|
||||
struct pinctrl_dev *pctldev = NULL;
|
||||
struct rockchip_pin_bank *bank = NULL;
|
||||
struct rockchip_pin_output_deferred *cfg;
|
||||
static int gpio;
|
||||
int id, ret;
|
||||
|
||||
@@ -723,6 +724,12 @@ static int rockchip_gpio_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Prevent clashes with a deferred output setting
|
||||
* being added right at this moment.
|
||||
*/
|
||||
mutex_lock(&bank->deferred_lock);
|
||||
|
||||
ret = rockchip_gpiolib_register(bank);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(bank->clk);
|
||||
@@ -730,6 +737,20 @@ static int rockchip_gpio_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (!list_empty(&bank->deferred_output)) {
|
||||
cfg = list_first_entry(&bank->deferred_output,
|
||||
struct rockchip_pin_output_deferred, head);
|
||||
list_del(&cfg->head);
|
||||
|
||||
ret = rockchip_gpio_direction_output(&bank->gpio_chip, cfg->pin, cfg->arg);
|
||||
if (ret)
|
||||
dev_warn(dev, "setting output pin %u to %u failed\n", cfg->pin, cfg->arg);
|
||||
|
||||
kfree(cfg);
|
||||
}
|
||||
|
||||
mutex_unlock(&bank->deferred_lock);
|
||||
|
||||
platform_set_drvdata(pdev, bank);
|
||||
dev_info(dev, "probed %pOF\n", np);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user