i2c: gpio: Add support for named gpios in DT
authorLinus Walleij <linus.walleij@linaro.org>
Sat, 16 Sep 2017 21:56:49 +0000 (23:56 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 30 Oct 2017 07:42:59 +0000 (08:42 +0100)
commit05c74778858d7d9907d607172fcc9646b70b6364
treeebbbec1519344517a96ba562ca78c8496d59832a
parent7d29f509d2cfd807b2fccc643ac1f7066b9b1949
i2c: gpio: Add support for named gpios in DT

This adds support for using the "sda" and "scl" GPIOs in
device tree instead of anonymously using index 0 and 1 of
the "gpios" property.

We add a helper function to retrieve the GPIO descriptors
and some explicit error handling since the probe may have
to be deferred. At least this happened to me when moving
to using named "sda" and "scl" lines (all of a sudden this
started to probe before the GPIO driver) so we need to
gracefully defer probe when we ge -ENOENT in the error
pointer.

Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/i2c/busses/i2c-gpio.c