linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: omap: adopt pinctrl support
@ 2012-10-16 15:23 Sebastien Guiriec
  2012-10-17 16:35 ` Shubhrajyoti Datta
  2012-10-22  7:42 ` Felipe Balbi
  0 siblings, 2 replies; 4+ messages in thread
From: Sebastien Guiriec @ 2012-10-16 15:23 UTC (permalink / raw)
  To: Sebastien Guiriec, Tony Lindgren, Jean Delvare, Ben Dooks,
	Wolfram Sang, linux-omap, linux-i2c, linux-kernel
  Cc: Felipe Balbi, Shubhrajyoti Datta

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.

log:

[0.482299] omap_i2c i2c.15: could not find pctldev for node /ocp/pinmux@4a00
2840/pinmux_i2c5_pins, deferring probe
[0.482330] platform i2c.15: Driver omap_i2c requests probe deferral
[0.484466] Advanced Linux Sound Architecture Driver Initialized.

[4.746917] omap_i2c i2c.15: bus 4 rev2.4.0 at 100 kHz
[4.755279] gpiochip_find_base: found new base at 477
[4.761169] gpiochip_add: registered GPIOs 477 to 500 on device: tca6424a

Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
---
 drivers/i2c/busses/i2c-omap.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index db31eae..661d8a2 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -44,6 +44,7 @@
 #include <linux/i2c-omap.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_qos.h>
+#include <linux/pinctrl/consumer.h>
 
 /* I2C controller revisions */
 #define OMAP_I2C_OMAP1_REV_2		0x20
@@ -213,6 +214,8 @@ struct omap_i2c_dev {
 	u16			syscstate;
 	u16			westate;
 	u16			errata;
+
+	struct pinctrl		*pins;
 };
 
 static const u8 reg_map_ip_v1[] = {
@@ -1107,6 +1110,16 @@ omap_i2c_probe(struct platform_device *pdev)
 		dev->dtrev = pdata->rev;
 	}
 
+	dev->pins = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(dev->pins)) {
+		if (PTR_ERR(dev->pins) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+
+		dev_warn(&pdev->dev, "did not get pins for i2c error: %li\n",
+			 PTR_ERR(dev->pins));
+		dev->pins = NULL;
+	}
+
 	dev->dev = &pdev->dev;
 	dev->irq = irq;
 
-- 
1.7.10.4


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

* Re: [PATCH] i2c: omap: adopt pinctrl support
  2012-10-16 15:23 [PATCH] i2c: omap: adopt pinctrl support Sebastien Guiriec
@ 2012-10-17 16:35 ` Shubhrajyoti Datta
  2012-10-22  7:42 ` Felipe Balbi
  1 sibling, 0 replies; 4+ messages in thread
From: Shubhrajyoti Datta @ 2012-10-17 16:35 UTC (permalink / raw)
  To: Sebastien Guiriec
  Cc: Tony Lindgren, Jean Delvare, Ben Dooks, Wolfram Sang, linux-omap,
	linux-i2c, linux-kernel, Felipe Balbi, Shubhrajyoti Datta

On Tue, Oct 16, 2012 at 8:53 PM, Sebastien Guiriec <s-guiriec@ti.com> wrote:
> 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.
>
> log:
>
> [0.482299] omap_i2c i2c.15: could not find pctldev for node /ocp/pinmux@4a00
> 2840/pinmux_i2c5_pins, deferring probe
> [0.482330] platform i2c.15: Driver omap_i2c requests probe deferral
> [0.484466] Advanced Linux Sound Architecture Driver Initialized.
>
> [4.746917] omap_i2c i2c.15: bus 4 rev2.4.0 at 100 kHz
> [4.755279] gpiochip_find_base: found new base at 477
> [4.761169] gpiochip_add: registered GPIOs 477 to 500 on device: tca6424a
>
Thanks,

Acked-by: Shubhrajyoti D <shubhrajyoti@ti.com>

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

* Re: [PATCH] i2c: omap: adopt pinctrl support
  2012-10-16 15:23 [PATCH] i2c: omap: adopt pinctrl support Sebastien Guiriec
  2012-10-17 16:35 ` Shubhrajyoti Datta
@ 2012-10-22  7:42 ` Felipe Balbi
  2012-11-14 11:14   ` Wolfram Sang
  1 sibling, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2012-10-22  7:42 UTC (permalink / raw)
  To: Sebastien Guiriec
  Cc: Tony Lindgren, Jean Delvare, Ben Dooks, Wolfram Sang, linux-omap,
	linux-i2c, linux-kernel, Felipe Balbi, Shubhrajyoti Datta

[-- Attachment #1: Type: text/plain, Size: 2291 bytes --]

Hi,

On Tue, Oct 16, 2012 at 05:23:20PM +0200, Sebastien Guiriec wrote:
> 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.
> 
> log:
> 
> [0.482299] omap_i2c i2c.15: could not find pctldev for node /ocp/pinmux@4a00
> 2840/pinmux_i2c5_pins, deferring probe
> [0.482330] platform i2c.15: Driver omap_i2c requests probe deferral
> [0.484466] Advanced Linux Sound Architecture Driver Initialized.
> 
> [4.746917] omap_i2c i2c.15: bus 4 rev2.4.0 at 100 kHz
> [4.755279] gpiochip_find_base: found new base at 477
> [4.761169] gpiochip_add: registered GPIOs 477 to 500 on device: tca6424a
> 
> Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>

looks good to me also, should go in v3.8 merge window:

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/i2c/busses/i2c-omap.c |   13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index db31eae..661d8a2 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -44,6 +44,7 @@
>  #include <linux/i2c-omap.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/pm_qos.h>
> +#include <linux/pinctrl/consumer.h>
>  
>  /* I2C controller revisions */
>  #define OMAP_I2C_OMAP1_REV_2		0x20
> @@ -213,6 +214,8 @@ struct omap_i2c_dev {
>  	u16			syscstate;
>  	u16			westate;
>  	u16			errata;
> +
> +	struct pinctrl		*pins;
>  };
>  
>  static const u8 reg_map_ip_v1[] = {
> @@ -1107,6 +1110,16 @@ omap_i2c_probe(struct platform_device *pdev)
>  		dev->dtrev = pdata->rev;
>  	}
>  
> +	dev->pins = devm_pinctrl_get_select_default(&pdev->dev);
> +	if (IS_ERR(dev->pins)) {
> +		if (PTR_ERR(dev->pins) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +
> +		dev_warn(&pdev->dev, "did not get pins for i2c error: %li\n",
> +			 PTR_ERR(dev->pins));
> +		dev->pins = NULL;
> +	}
> +
>  	dev->dev = &pdev->dev;
>  	dev->irq = irq;
>  
> -- 
> 1.7.10.4
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] i2c: omap: adopt pinctrl support
  2012-10-22  7:42 ` Felipe Balbi
@ 2012-11-14 11:14   ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2012-11-14 11:14 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Sebastien Guiriec, Tony Lindgren, Jean Delvare, Ben Dooks,
	linux-omap, linux-i2c, linux-kernel, Shubhrajyoti Datta

[-- Attachment #1: Type: text/plain, Size: 1365 bytes --]

On Mon, Oct 22, 2012 at 10:42:01AM +0300, Felipe Balbi wrote:
> Hi,
> 
> On Tue, Oct 16, 2012 at 05:23:20PM +0200, Sebastien Guiriec wrote:
> > 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.
> > 
> > log:
> > 
> > [0.482299] omap_i2c i2c.15: could not find pctldev for node /ocp/pinmux@4a00
> > 2840/pinmux_i2c5_pins, deferring probe
> > [0.482330] platform i2c.15: Driver omap_i2c requests probe deferral
> > [0.484466] Advanced Linux Sound Architecture Driver Initialized.
> > 
> > [4.746917] omap_i2c i2c.15: bus 4 rev2.4.0 at 100 kHz
> > [4.755279] gpiochip_find_base: found new base at 477
> > [4.761169] gpiochip_add: registered GPIOs 477 to 500 on device: tca6424a
> > 
> > Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
> 
> looks good to me also, should go in v3.8 merge window:
> 
> Reviewed-by: Felipe Balbi <balbi@ti.com>

Applied to for-next, thanks!

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2012-11-14 11:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-16 15:23 [PATCH] i2c: omap: adopt pinctrl support Sebastien Guiriec
2012-10-17 16:35 ` Shubhrajyoti Datta
2012-10-22  7:42 ` Felipe Balbi
2012-11-14 11:14   ` Wolfram Sang

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).