summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorChaitanya Bandi <bandik@nvidia.com>2014-03-24 14:34:46 +0530
committerLaxman Dewangan <ldewangan@nvidia.com>2014-03-25 05:11:58 -0700
commit058dbe754e4256d57075e083545c41d4db86020c (patch)
tree92e860fbba87ef8af14fe6cde1a4f5c0cca8f543 /drivers/i2c
parent8bdc2b4e4d2d3756c1172c243a10496d18d2dff9 (diff)
i2c: tegra: Set pinctrl drive settings dynamically for HS mode
Added support for setting pinctrl drive settings dynamically during boot in case a controller is configured to operate in HS mode. Bug 1396451 Change-Id: I6f2fd88d6f0263423e32f0cdcb54e8e89324a409 Signed-off-by: Chaitanya Bandi <bandik@nvidia.com> Reviewed-on: http://git-master/r/385532 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-tegra.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 64ad72cd940d..66aabc0e3666 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -40,6 +40,7 @@
#include <linux/spinlock.h>
#include <linux/clk/tegra.h>
#include <linux/tegra-pm.h>
+#include <linux/pinctrl/consumer.h>
#include <asm/unaligned.h>
@@ -1470,6 +1471,8 @@ static int tegra_i2c_probe(struct platform_device *pdev)
const struct tegra_i2c_chipdata *chip_data = NULL;
const struct of_device_id *match;
int bus_num = -1;
+ struct pinctrl *pin;
+ struct pinctrl_state *s;
if (pdev->dev.of_node) {
match = of_match_device(of_match_ptr(tegra_i2c_of_match), &pdev->dev);
@@ -1545,6 +1548,26 @@ static int tegra_i2c_probe(struct platform_device *pdev)
i2c_dev->dvfs_soc_clk = dvfs_soc_clk;
}
+ if (pdata->is_high_speed_enable) {
+ pin = devm_pinctrl_get(&pdev->dev);
+ if (IS_ERR(pin)) {
+ dev_warn(&pdev->dev, "Missing pinctrl device\n");
+ goto skip_pinctrl;
+ }
+
+ s = pinctrl_lookup_state(pin, "hs_mode");
+ if (IS_ERR(s)) {
+ dev_warn(&pdev->dev, "Missing hs_mode state\n");
+ goto skip_pinctrl;
+ }
+
+ ret = pinctrl_select_state(pin, s);
+ if (ret < 0)
+ dev_err(&pdev->dev, "setting state failed\n");
+ }
+
+skip_pinctrl:
+
i2c_dev->base = base;
i2c_dev->div_clk = div_clk;
if (i2c_dev->chipdata->has_fast_clock)