aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2012-11-13 05:33:40 -0500
committerWolfram Sang <w.sang@pengutronix.de>2012-11-16 06:53:25 -0500
commit2693ac69880a33d4d9df6f128415b65e745f00ba (patch)
treed947754cefb3bb6dd68833e53b5643bedb279cf7 /drivers/i2c
parenta72ad456bb93a0114b4d6702421b35a9c548bd46 (diff)
i2c: s3c2410: Add support for pinctrl
This patch adds support for pin configuration using pinctrl subsystem to the i2c-s3c2410 driver. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index f82d11f9b8f..40e2d40bbdb 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -38,6 +38,7 @@
38#include <linux/io.h> 38#include <linux/io.h>
39#include <linux/of_i2c.h> 39#include <linux/of_i2c.h>
40#include <linux/of_gpio.h> 40#include <linux/of_gpio.h>
41#include <linux/pinctrl/consumer.h>
41 42
42#include <asm/irq.h> 43#include <asm/irq.h>
43 44
@@ -82,6 +83,7 @@ struct s3c24xx_i2c {
82 83
83 struct s3c2410_platform_i2c *pdata; 84 struct s3c2410_platform_i2c *pdata;
84 int gpios[2]; 85 int gpios[2];
86 struct pinctrl *pctrl;
85#ifdef CONFIG_CPU_FREQ 87#ifdef CONFIG_CPU_FREQ
86 struct notifier_block freq_transition; 88 struct notifier_block freq_transition;
87#endif 89#endif
@@ -860,9 +862,8 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
860 862
861 if (pdata->cfg_gpio) 863 if (pdata->cfg_gpio)
862 pdata->cfg_gpio(to_platform_device(i2c->dev)); 864 pdata->cfg_gpio(to_platform_device(i2c->dev));
863 else 865 else if (IS_ERR(i2c->pctrl) && s3c24xx_i2c_parse_dt_gpio(i2c))
864 if (s3c24xx_i2c_parse_dt_gpio(i2c)) 866 return -EINVAL;
865 return -EINVAL;
866 867
867 /* write slave address */ 868 /* write slave address */
868 869
@@ -1003,6 +1004,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
1003 i2c->adap.algo_data = i2c; 1004 i2c->adap.algo_data = i2c;
1004 i2c->adap.dev.parent = &pdev->dev; 1005 i2c->adap.dev.parent = &pdev->dev;
1005 1006
1007 i2c->pctrl = devm_pinctrl_get_select_default(i2c->dev);
1008
1006 /* initialise the i2c controller */ 1009 /* initialise the i2c controller */
1007 1010
1008 ret = s3c24xx_i2c_init(i2c); 1011 ret = s3c24xx_i2c_init(i2c);
@@ -1092,7 +1095,8 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
1092 clk_disable_unprepare(i2c->clk); 1095 clk_disable_unprepare(i2c->clk);
1093 clk_put(i2c->clk); 1096 clk_put(i2c->clk);
1094 1097
1095 s3c24xx_i2c_dt_gpio_free(i2c); 1098 if (pdev->dev.of_node && IS_ERR(i2c->pctrl))
1099 s3c24xx_i2c_dt_gpio_free(i2c);
1096 1100
1097 return 0; 1101 return 0;
1098} 1102}