All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: sirf: get the i2c pin group by pinctrl api
@ 2013-03-18  7:22 ` Barry Song
  0 siblings, 0 replies; 16+ messages in thread
From: Barry Song @ 2013-03-18  7:22 UTC (permalink / raw)
  To: w.sang, ben-linux
  Cc: workgroup.linux, Linus Walleij, linux-i2c, linux-arm-kernel,
	Barry Song

From: Barry Song <Baohua.Song@csr.com>

hardcode set i2c pin group to i2c function before, here we
move to use standard pinctrl API to get pins of the group.

Signed-off-by: Barry Song <Baohua.Song@csr.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/i2c/busses/i2c-sirf.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 5a7ad24..dd4004e 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -16,6 +16,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/pinctrl/consumer.h>
 
 #define SIRFSOC_I2C_CLK_CTRL		0x00
 #define SIRFSOC_I2C_STATUS		0x0C
@@ -265,6 +266,7 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
 	struct i2c_adapter *adap;
 	struct resource *mem_res;
 	struct clk *clk;
+	struct pinctrl *pinctrl;
 	int bitrate;
 	int ctrl_speed;
 	int irq;
@@ -272,6 +274,12 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
 	int err;
 	u32 regval;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		err = PTR_ERR(pinctrl);
+		goto failed_pin;
+	}
+
 	clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(clk)) {
 		err = PTR_ERR(clk);
@@ -385,6 +393,7 @@ err_clk_en:
 err_clk_prep:
 	clk_put(clk);
 err_get_clk:
+failed_pin:
 	return err;
 }
 
-- 
1.7.5.4



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-03-27 15:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-18  7:22 [PATCH] i2c: sirf: get the i2c pin group by pinctrl api Barry Song
2013-03-18  7:22 ` Barry Song
     [not found] ` <1363591361-5992-1-git-send-email-Barry.Song-kQvG35nSl+M@public.gmane.org>
2013-03-18  8:01   ` Sourav Poddar
2013-03-18  8:01     ` Sourav Poddar
     [not found]     ` <5146C9C6.2030507-l0cyMroinI0@public.gmane.org>
2013-03-18  8:23       ` Barry Song
2013-03-18  8:23         ` Barry Song
     [not found]         ` <CAGsJ_4yAhUKyH14UEq8WBUmHAq7ZzhNLyX-zcEehR-wr5H6NUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-18  8:41           ` Sourav Poddar
2013-03-18  8:41             ` Sourav Poddar
     [not found]             ` <5146D326.1090409-l0cyMroinI0@public.gmane.org>
2013-03-18  8:54               ` Barry Song
2013-03-18  8:54                 ` Barry Song
2013-03-27 10:20   ` Linus Walleij
2013-03-27 10:20     ` Linus Walleij
     [not found]     ` <CACRpkdbg=ii1XjUmVd7GOOWF_FAMq_uUcvaGstbWjiGWGEbFLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-27 10:36       ` Barry Song
2013-03-27 10:36         ` Barry Song
     [not found]         ` <CAGsJ_4xN6=1myOVyz6wTagd=JCvGgta1q4wwq0RFE0XcDokoSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-27 15:14           ` Linus Walleij
2013-03-27 15:14             ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.