Some gpio reset may be backed by a gpio that can sleep, e.g. pca953x
gpio output. For such gpio, gpio_set_value_cansleep() should be
called. Otherwise, the WARN_ON(chip->can_sleep) in gpiod_set_value()
will be hit. Add a gpio_cansleep() check to handle cansleep gpio.
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
if (drvdata->active_low)
value = !value;
- gpio_set_value(drvdata->gpio, value);
+ if (gpio_cansleep(drvdata->gpio))
+ gpio_set_value_cansleep(drvdata->gpio, value);
+ else
+ gpio_set_value(drvdata->gpio, value);
}
static int gpio_reset(struct reset_controller_dev *rcdev, unsigned long id)