devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@linaro.org>
To: Hebbar Gururaja <gururaja.hebbar@ti.com>
Cc: grant.likely@linaro.org, linus.walleij@linaro.org,
	rob.herring@calxeda.com,
	davinci-linux-open-source@linux.davincidsp.com,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk,
	linux-kernel@vger.kernel.org, vaibhav.bedia@ti.com,
	sudhakar.raj@ti.com, Tony Lindgren <tony@atomide.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH 11/11] i2c: omap: enhance pinctrl support
Date: Fri, 31 May 2013 10:34:59 -0700	[thread overview]
Message-ID: <87k3mf2gu4.fsf@linaro.org> (raw)
In-Reply-To: <1369995191-20855-12-git-send-email-gururaja.hebbar@ti.com> (Hebbar Gururaja's message of "Fri, 31 May 2013 15:43:11 +0530")

Hebbar Gururaja <gururaja.hebbar@ti.com> writes:

> Amend the I2C omap pin controller to optionally take a pin control
> handle and set the state of the pins to:
>
> - "default" on boot, resume and before performing an i2c transfer
> - "idle" after initial default, after resume default, and after each
> i2c xfer
> - "sleep" on suspend()
>
> By optionally putting the pins into sleep state in the suspend callback
> we can accomplish two things.
> - One is to minimize current leakage from pins and thus save power,
> - second, we can prevent the IP from driving pins output in an
> uncontrolled manner, which may happen if the power domain drops the
> domain regulator.
>
> Note:
> A .suspend & .resume callback is added which simply puts the pins to sleep
> state upon suspend & are moved to default & idle state upon resume.
>
> If any of the above pin states are missing in dt, a warning message
> about the missing state is displayed.
> If certain pin-states are not available, to remove this warning message
> pass respective state name with null phandler.
>
> (Changes based on i2c-nomadik.c)
>
> Signed-off-by: Hebbar Gururaja <gururaja.hebbar@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-omap@vger.kernel.org
> Cc: linux-i2c@vger.kernel.org

[...]

> @@ -664,7 +673,13 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
>  
>  out:
>  	pm_runtime_mark_last_busy(dev->dev);
> +
>  	pm_runtime_put_autosuspend(dev->dev);
> +	/* Optionally let pins go into idle state */
> +	if (!IS_ERR(dev->pins_idle))
> +		if (pinctrl_select_state(dev->pinctrl, dev->pins_idle))
> +			dev_err(dev->dev, "could not set pins to idle state\n");

This is wrong.  You're changing the muxing before the device actually
goes idle.  Anything you want to happen when the device actually idles
for real has to be in runtime PM callbacks.

Looking below, I see it's already in the callbacks, so why is it here also?

[...]

> @@ -1300,6 +1348,10 @@ static int omap_i2c_runtime_suspend(struct device *dev)
>  		omap_i2c_read_reg(_dev, OMAP_I2C_STAT_REG);
>  	}
>  
> +	if (!IS_ERR(_dev->pins_idle))
> +		if (pinctrl_select_state(_dev->pinctrl, _dev->pins_idle))
> +			dev_err(dev, "could not set pins to idle state\n");
> +
>  	return 0;
>  }
>  

Kevin

  parent reply	other threads:[~2013-05-31 17:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31 10:13 [PATCH 00/11] drivers: Add Pinctrl PM support Hebbar Gururaja
     [not found] ` <1369995191-20855-1-git-send-email-gururaja.hebbar-l0cyMroinI0@public.gmane.org>
2013-05-31 10:13   ` [PATCH 01/11] pinctrl: single: adopt pinctrl sleep mode management Hebbar Gururaja
2013-06-17 11:32     ` Linus Walleij
2013-06-17 12:03       ` Tony Lindgren
2013-06-17 16:08         ` Linus Walleij
     [not found]           ` <CACRpkdZGV7v2=rrKfiLXF7k3JG-1BEDr5=dC+E96gvpnPCCRcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-17 17:27             ` Tony Lindgren
2013-05-31 10:13   ` [PATCH 02/11] leds: leds-gpio: Enhance pinctrl support Hebbar Gururaja
2013-06-04  7:18     ` Linus Walleij
2013-05-31 10:13   ` [PATCH 05/11] spi: omap2-mcspi: enhance " Hebbar Gururaja
     [not found]     ` <1369995191-20855-6-git-send-email-gururaja.hebbar-l0cyMroinI0@public.gmane.org>
2013-06-01 19:27       ` Mark Brown
     [not found]         ` <20130601192726.GS16790-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-06-04  9:53           ` Hebbar, Gururaja
2013-05-31 10:13   ` [PATCH 07/11] pwm: pwm-tiehrpwm: " Hebbar Gururaja
2013-05-31 10:13   ` [PATCH 09/11] mmc: omap_hsmmc: " Hebbar Gururaja
2013-06-04  7:11     ` Linus Walleij
2013-06-04  7:19       ` Linus Walleij
     [not found]         ` <CACRpkdYeh6UXnbUXiiZLPP+FUz11HKaD-FrHHaqUGX8AmA_p6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-04  9:52           ` Hebbar, Gururaja
     [not found]     ` <1369995191-20855-10-git-send-email-gururaja.hebbar-l0cyMroinI0@public.gmane.org>
2013-06-04 14:46       ` Tony Lindgren
2013-05-31 10:13   ` [PATCH 11/11] i2c: omap: " Hebbar Gururaja
     [not found]     ` <1369995191-20855-12-git-send-email-gururaja.hebbar-l0cyMroinI0@public.gmane.org>
2013-05-31 14:55       ` Grygorii Strashko
     [not found]         ` <51A8B9EA.6030604-l0cyMroinI0@public.gmane.org>
2013-06-05  9:04           ` Hebbar, Gururaja
2013-05-31 18:07       ` Kevin Hilman
2013-06-04  7:23         ` Linus Walleij
     [not found]         ` <87bo7r10s9.fsf-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-04  9:50           ` Hebbar, Gururaja
2013-05-31 17:34     ` Kevin Hilman [this message]
     [not found]       ` <87k3mf2gu4.fsf-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-04 11:39         ` Grygorii Strashko
2013-06-05  9:05         ` Hebbar, Gururaja
2013-05-31 17:04   ` [PATCH 00/11] drivers: Add Pinctrl PM support Dmitry Torokhov
2013-05-31 18:08     ` Kevin Hilman
     [not found]     ` <20130531170437.GA17591-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
2013-06-04  7:25       ` Linus Walleij
2013-06-04 18:15         ` Kevin Hilman
     [not found]           ` <87k3m92148.fsf-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-04 18:37             ` Mark Brown
2013-06-05 12:41           ` Linus Walleij
2013-05-31 10:13 ` [PATCH 03/11] Input: gpio_keys: Adopt pinctrl support Hebbar Gururaja
2013-05-31 10:13 ` [PATCH 04/11] Input: matrix-keypad: " Hebbar Gururaja
2013-05-31 10:13 ` [PATCH 06/11] usb: musb: dsps: " Hebbar Gururaja
2013-05-31 10:13 ` [PATCH 08/11] pwm: pwm-tiecap: enhance " Hebbar Gururaja
2013-05-31 10:13 ` [PATCH 10/11] video: da8xx-fb: adopt " Hebbar Gururaja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3mf2gu4.fsf@linaro.org \
    --to=khilman@linaro.org \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@linaro.org \
    --cc=gururaja.hebbar@ti.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rob.herring@calxeda.com \
    --cc=sudhakar.raj@ti.com \
    --cc=tony@atomide.com \
    --cc=vaibhav.bedia@ti.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).