From: Phil Reid <preid@electromag.com.au>
To: nsekhar@ti.com, khilman@kernel.org, wsa@the-dreams.de,
jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com,
mika.westerberg@linux.intel.com, preid@electromag.com.au,
linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
fntoth@gmail.com
Subject: [PATCH v4 5/7] i2c: imx: switch to using gpiod for bus recovery gpios
Date: Tue, 31 Oct 2017 15:33:57 +0800 [thread overview]
Message-ID: <1509435239-64848-6-git-send-email-preid@electromag.com.au> (raw)
In-Reply-To: <1509435239-64848-1-git-send-email-preid@electromag.com.au>
Change the driver to use the gpio descriptors for the bus recovery
information instead of the deprecated integer interface.
Signed-off-by: Phil Reid <preid@electromag.com.au>
---
drivers/i2c/busses/i2c-imx.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index f96830f..c4cf265 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1006,26 +1006,26 @@ static int i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx,
PINCTRL_STATE_DEFAULT);
i2c_imx->pinctrl_pins_gpio = pinctrl_lookup_state(i2c_imx->pinctrl,
"gpio");
- rinfo->sda_gpio = of_get_named_gpio(pdev->dev.of_node, "sda-gpios", 0);
- rinfo->scl_gpio = of_get_named_gpio(pdev->dev.of_node, "scl-gpios", 0);
+ rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_OUT_HIGH);
+ rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", GPIOD_IN);
- if (rinfo->sda_gpio == -EPROBE_DEFER ||
- rinfo->scl_gpio == -EPROBE_DEFER) {
+ if (PTR_ERR(rinfo->sda_gpiod) == -EPROBE_DEFER ||
+ PTR_ERR(rinfo->scl_gpiod) == -EPROBE_DEFER) {
return -EPROBE_DEFER;
- } else if (!gpio_is_valid(rinfo->sda_gpio) ||
- !gpio_is_valid(rinfo->scl_gpio) ||
+ } else if (IS_ERR(rinfo->sda_gpiod) ||
+ IS_ERR(rinfo->scl_gpiod) ||
IS_ERR(i2c_imx->pinctrl_pins_default) ||
IS_ERR(i2c_imx->pinctrl_pins_gpio)) {
dev_dbg(&pdev->dev, "recovery information incomplete\n");
return 0;
}
- dev_dbg(&pdev->dev, "using scl-gpio %d and sda-gpio %d for recovery\n",
- rinfo->scl_gpio, rinfo->sda_gpio);
+ dev_dbg(&pdev->dev, "using scl%s for recovery\n",
+ rinfo->sda_gpiod ? ",sda" : "");
rinfo->prepare_recovery = i2c_imx_prepare_recovery;
rinfo->unprepare_recovery = i2c_imx_unprepare_recovery;
- rinfo->recover_bus = i2c_generic_gpio_recovery;
+ rinfo->recover_bus = i2c_generic_scl_recovery;
i2c_imx->adapter.bus_recovery_info = rinfo;
return 0;
--
1.8.3.1
next prev parent reply other threads:[~2017-10-31 7:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 7:33 [PATCH v4 0/7] i2c: designware: add i2c gpio recovery option Phil Reid
2017-10-31 7:33 ` [PATCH v4 1/7] i2c: Switch to using gpiod interface for gpio bus recovery Phil Reid
2017-11-01 16:23 ` Jarkko Nikula
2017-10-31 7:33 ` [PATCH v4 2/7] i2c: designware: move i2c_dw_plat_prepare_clk to common Phil Reid
2017-10-31 7:33 ` [PATCH v4 3/7] i2c: designware: rename i2c_dw_plat_prepare_clk to i2c_dw_prepare_clk Phil Reid
2017-10-31 10:10 ` Andy Shevchenko
2017-10-31 7:33 ` [PATCH v4 4/7] i2c: designware: add i2c gpio recovery option Phil Reid
2017-11-01 16:22 ` Jarkko Nikula
2017-10-31 7:33 ` Phil Reid [this message]
2017-10-31 7:33 ` [PATCH v4 6/7] i2c: davinci: switch to using gpiod for bus recovery gpios Phil Reid
2017-10-31 7:33 ` [PATCH v4 7/7] i2c: remove legacy integer scl/sda gpio for recovery Phil Reid
2017-10-31 10:19 ` Andy Shevchenko
2017-10-31 10:17 ` [PATCH v4 0/7] i2c: designware: add i2c gpio recovery option Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509435239-64848-6-git-send-email-preid@electromag.com.au \
--to=preid@electromag.com.au \
--cc=andriy.shevchenko@linux.intel.com \
--cc=fntoth@gmail.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=nsekhar@ti.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).