Skip to content

Commit 0ac0e2e

Browse files
rmurphy-armgregkh
authored andcommitted
gpio: rockchip: Stop calling pinctrl for set_direction
commit 7ca497b upstream. Marking the whole controller as sleeping due to the pinctrl calls in the .direction_{input,output} callbacks has the unfortunate side effect that legitimate invocations of .get and .set, which cannot themselves sleep, in atomic context now spew WARN()s from gpiolib. However, as Heiko points out, the driver doing this is a bit silly to begin with, as the pinctrl .gpio_set_direction hook doesn't even care about the direction, the hook is only used to claim the mux. And sure enough, the .gpio_request_enable hook exists to serve this very purpose, so switch to that and remove the problematic business entirely. Cc: stable@vger.kernel.org Fixes: 20cf2ae ("gpio: rockchip: mark the GPIO controller as sleeping") Suggested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/bddc0469f25843ca5ae0cf578ab3671435ae98a7.1769429546.git.robin.murphy@arm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f69cae1 commit 0ac0e2e

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

drivers/gpio/gpio-rockchip.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <linux/of.h>
1919
#include <linux/of_address.h>
2020
#include <linux/of_irq.h>
21-
#include <linux/pinctrl/consumer.h>
2221
#include <linux/pinctrl/pinconf-generic.h>
2322
#include <linux/platform_device.h>
2423
#include <linux/regmap.h>
@@ -164,12 +163,6 @@ static int rockchip_gpio_set_direction(struct gpio_chip *chip,
164163
unsigned long flags;
165164
u32 data = input ? 0 : 1;
166165

167-
168-
if (input)
169-
pinctrl_gpio_direction_input(chip, offset);
170-
else
171-
pinctrl_gpio_direction_output(chip, offset);
172-
173166
raw_spin_lock_irqsave(&bank->slock, flags);
174167
rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr);
175168
raw_spin_unlock_irqrestore(&bank->slock, flags);
@@ -593,7 +586,6 @@ static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank)
593586
gc->ngpio = bank->nr_pins;
594587
gc->label = bank->name;
595588
gc->parent = bank->dev;
596-
gc->can_sleep = true;
597589

598590
ret = gpiochip_add_data(gc, bank);
599591
if (ret) {

drivers/pinctrl/pinctrl-rockchip.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3184,10 +3184,9 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector,
31843184
return 0;
31853185
}
31863186

3187-
static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
3188-
struct pinctrl_gpio_range *range,
3189-
unsigned offset,
3190-
bool input)
3187+
static int rockchip_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
3188+
struct pinctrl_gpio_range *range,
3189+
unsigned int offset)
31913190
{
31923191
struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
31933192
struct rockchip_pin_bank *bank;
@@ -3201,7 +3200,7 @@ static const struct pinmux_ops rockchip_pmx_ops = {
32013200
.get_function_name = rockchip_pmx_get_func_name,
32023201
.get_function_groups = rockchip_pmx_get_groups,
32033202
.set_mux = rockchip_pmx_set,
3204-
.gpio_set_direction = rockchip_pmx_gpio_set_direction,
3203+
.gpio_request_enable = rockchip_pmx_gpio_request_enable,
32053204
};
32063205

32073206
/*

0 commit comments

Comments
 (0)