i2c: gpio: flag atomic capability if possible
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 3 Apr 2019 12:40:19 +0000 (14:40 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 16 Apr 2019 11:08:17 +0000 (13:08 +0200)
If switching GPIOs does not sleep, then we can support atomic transfers.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-gpio.c

index bba5c4627de3c5818fed727299f76f06bcd19bff..9684a0ac2a6d968b590a76ff4ce350b0ebd9fce5 100644 (file)
@@ -413,6 +413,8 @@ static int i2c_gpio_probe(struct platform_device *pdev)
 
        if (gpiod_cansleep(priv->sda) || gpiod_cansleep(priv->scl))
                dev_warn(dev, "Slow GPIO pins might wreak havoc into I2C/SMBus bus timing");
+       else
+               bit_data->can_do_atomic = true;
 
        bit_data->setsda = i2c_gpio_setsda_val;
        bit_data->setscl = i2c_gpio_setscl_val;