aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Guiriec <s-guiriec@ti.com>2012-10-16 11:23:20 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-11-14 11:44:37 -0500
commit2d4b4520a5eaed6701b0c9f7540c8fd99a26e449 (patch)
tree760d720fc68cafd7f44cbaac54c3abe233bbff61
parentd60ece5f010043422c5fbc3609714c4420c7c9bf (diff)
i2c: omap: adopt pinctrl support
Some GPIO expanders need some early pin control muxing. Due to legacy boards sometimes the driver uses subsys_initcall instead of module_init. This patch takes advantage of defer probe feature and pin control in order to wait until pin control probing before GPIO driver probing. It has been tested on OMAP5 board with TCA6424 driver. Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com> Acked-by: Shubhrajyoti D <shubhrajyoti@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r--drivers/i2c/busses/i2c-omap.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 3525c9e62cb0..16afb289cca7 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -43,6 +43,7 @@
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/i2c-omap.h> 44#include <linux/i2c-omap.h>
45#include <linux/pm_runtime.h> 45#include <linux/pm_runtime.h>
46#include <linux/pinctrl/consumer.h>
46 47
47/* I2C controller revisions */ 48/* I2C controller revisions */
48#define OMAP_I2C_OMAP1_REV_2 0x20 49#define OMAP_I2C_OMAP1_REV_2 0x20
@@ -213,6 +214,8 @@ struct omap_i2c_dev {
213 u16 syscstate; 214 u16 syscstate;
214 u16 westate; 215 u16 westate;
215 u16 errata; 216 u16 errata;
217
218 struct pinctrl *pins;
216}; 219};
217 220
218static const u8 reg_map_ip_v1[] = { 221static const u8 reg_map_ip_v1[] = {
@@ -1104,6 +1107,16 @@ omap_i2c_probe(struct platform_device *pdev)
1104 dev->dtrev = pdata->rev; 1107 dev->dtrev = pdata->rev;
1105 } 1108 }
1106 1109
1110 dev->pins = devm_pinctrl_get_select_default(&pdev->dev);
1111 if (IS_ERR(dev->pins)) {
1112 if (PTR_ERR(dev->pins) == -EPROBE_DEFER)
1113 return -EPROBE_DEFER;
1114
1115 dev_warn(&pdev->dev, "did not get pins for i2c error: %li\n",
1116 PTR_ERR(dev->pins));
1117 dev->pins = NULL;
1118 }
1119
1107 dev->dev = &pdev->dev; 1120 dev->dev = &pdev->dev;
1108 dev->irq = irq; 1121 dev->irq = irq;
1109 1122