Message ID | 1365106576-31816-5-git-send-email-jon-hunter@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Apr 4, 2013 at 10:16 PM, Jon Hunter <jon-hunter@ti.com> wrote: > When booting with device-tree the function pointer for detecting context > loss is not populated. Ideally, the pm_runtime framework should be > enhanced to allow a means for reporting context/state loss and we could > avoid populating such function pointers altogether. In the interim until > a generic non-device specific solution is in place, force a restore of > the gpio bank when enabling the gpio controller. > > Adds a new device-tree property for the OMAP GPIO controller to indicate > if the GPIO controller is located in a power-domain that never loses > power and hence will always maintain its logic state. > > Signed-off-by: Jon Hunter <jon-hunter@ti.com> In this case it'd be really helpful to get an ACK from somebody else. I have no clue whether this thing is doing what it should, and if you were the maintainer I'd apply it but now I'd like to hear from Kevin or Santosh first... Yours, Linus Walleij
On 04/10/2013 02:39 PM, Linus Walleij wrote: > On Thu, Apr 4, 2013 at 10:16 PM, Jon Hunter <jon-hunter@ti.com> wrote: > >> When booting with device-tree the function pointer for detecting context >> loss is not populated. Ideally, the pm_runtime framework should be >> enhanced to allow a means for reporting context/state loss and we could >> avoid populating such function pointers altogether. In the interim until >> a generic non-device specific solution is in place, force a restore of >> the gpio bank when enabling the gpio controller. >> >> Adds a new device-tree property for the OMAP GPIO controller to indicate >> if the GPIO controller is located in a power-domain that never loses >> power and hence will always maintain its logic state. >> >> Signed-off-by: Jon Hunter <jon-hunter@ti.com> > > In this case it'd be really helpful to get an ACK from somebody else. > I have no clue whether this thing is doing what it should, and if > you were the maintainer I'd apply it but now I'd like to hear from > Kevin or Santosh first... Santosh gave the his ACK for 1-4 (see 0/5) and Kevin added his reviewed-by for 1-4 (again see 0/5). Cheers Jon
On Wed, Apr 10, 2013 at 9:41 PM, Jon Hunter <jon-hunter@ti.com> wrote: > On 04/10/2013 02:39 PM, Linus Walleij wrote: >> On Thu, Apr 4, 2013 at 10:16 PM, Jon Hunter <jon-hunter@ti.com> wrote: >> >>> When booting with device-tree the function pointer for detecting context >>> loss is not populated. Ideally, the pm_runtime framework should be >>> enhanced to allow a means for reporting context/state loss and we could >>> avoid populating such function pointers altogether. In the interim until >>> a generic non-device specific solution is in place, force a restore of >>> the gpio bank when enabling the gpio controller. >>> >>> Adds a new device-tree property for the OMAP GPIO controller to indicate >>> if the GPIO controller is located in a power-domain that never loses >>> power and hence will always maintain its logic state. >>> >>> Signed-off-by: Jon Hunter <jon-hunter@ti.com> >> >> In this case it'd be really helpful to get an ACK from somebody else. >> I have no clue whether this thing is doing what it should, and if >> you were the maintainer I'd apply it but now I'd like to hear from >> Kevin or Santosh first... > > Santosh gave the his ACK for 1-4 (see 0/5) and Kevin added his > reviewed-by for 1-4 (again see 0/5). OK all in patch 0 how confusing #-) All patches applied with Kevin's and Santosh's tags! Yours, Linus Walleij
On 04/10/2013 02:44 PM, Linus Walleij wrote: > On Wed, Apr 10, 2013 at 9:41 PM, Jon Hunter <jon-hunter@ti.com> wrote: >> On 04/10/2013 02:39 PM, Linus Walleij wrote: >>> On Thu, Apr 4, 2013 at 10:16 PM, Jon Hunter <jon-hunter@ti.com> wrote: >>> >>>> When booting with device-tree the function pointer for detecting context >>>> loss is not populated. Ideally, the pm_runtime framework should be >>>> enhanced to allow a means for reporting context/state loss and we could >>>> avoid populating such function pointers altogether. In the interim until >>>> a generic non-device specific solution is in place, force a restore of >>>> the gpio bank when enabling the gpio controller. >>>> >>>> Adds a new device-tree property for the OMAP GPIO controller to indicate >>>> if the GPIO controller is located in a power-domain that never loses >>>> power and hence will always maintain its logic state. >>>> >>>> Signed-off-by: Jon Hunter <jon-hunter@ti.com> >>> >>> In this case it'd be really helpful to get an ACK from somebody else. >>> I have no clue whether this thing is doing what it should, and if >>> you were the maintainer I'd apply it but now I'd like to hear from >>> Kevin or Santosh first... >> >> Santosh gave the his ACK for 1-4 (see 0/5) and Kevin added his >> reviewed-by for 1-4 (again see 0/5). > > OK all in patch 0 how confusing #-) > > All patches applied with Kevin's and Santosh's tags! Thanks. Sorry for the confusion! By the way, I am hoping you only took 1-4, per the cover-letter I was planning to have Benoit take 5 through his DT branch as there could be conflicts if you merge this with Benoit's branch. Again sorry if this is even more confusing ;-) Cheers Jon
On Wed, Apr 10, 2013 at 9:50 PM, Jon Hunter <jon-hunter@ti.com> wrote: > On 04/10/2013 02:44 PM, Linus Walleij wrote: >> All patches applied with Kevin's and Santosh's tags! > > Thanks. Sorry for the confusion! > > By the way, I am hoping you only took 1-4, Yeah I only took 1-4, no problem... Yours, Linus Walleij
diff --git a/Documentation/devicetree/bindings/gpio/gpio-omap.txt b/Documentation/devicetree/bindings/gpio/gpio-omap.txt index a56e3a5..8d95052 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-omap.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-omap.txt @@ -20,8 +20,11 @@ Required properties: 8 = active low level-sensitive. OMAP specific properties: -- ti,hwmods: Name of the hwmod associated to the GPIO: - "gpio<X>", <X> being the 1-based instance number from the HW spec +- ti,hwmods: Name of the hwmod associated to the GPIO: + "gpio<X>", <X> being the 1-based instance number + from the HW spec. +- ti,gpio-always-on: Indicates if a GPIO bank is always powered and + so will never lose its logic state. Example: diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 685e850..0557529 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1120,11 +1120,17 @@ static int omap_gpio_probe(struct platform_device *pdev) bank->width = pdata->bank_width; bank->is_mpuio = pdata->is_mpuio; bank->non_wakeup_gpios = pdata->non_wakeup_gpios; - bank->loses_context = pdata->loses_context; bank->regs = pdata->regs; #ifdef CONFIG_OF_GPIO bank->chip.of_node = of_node_get(node); #endif + if (node) { + if (!of_property_read_bool(node, "ti,gpio-always-on")) + bank->loses_context = true; + } else { + bank->loses_context = pdata->loses_context; + } + bank->domain = irq_domain_add_linear(node, bank->width, &irq_domain_simple_ops, NULL); @@ -1258,9 +1264,9 @@ static int omap_gpio_runtime_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct gpio_bank *bank = platform_get_drvdata(pdev); - int context_lost_cnt_after; u32 l = 0, gen, gen0, gen1; unsigned long flags; + int c; spin_lock_irqsave(&bank->lock, flags); _gpio_dbck_enable(bank); @@ -1276,14 +1282,17 @@ static int omap_gpio_runtime_resume(struct device *dev) __raw_writel(bank->context.risingdetect, bank->base + bank->regs->risingdetect); - if (bank->get_context_loss_count) { - context_lost_cnt_after = - bank->get_context_loss_count(bank->dev); - if (context_lost_cnt_after != bank->context_loss_count) { + if (bank->loses_context) { + if (!bank->get_context_loss_count) { omap_gpio_restore_context(bank); } else { - spin_unlock_irqrestore(&bank->lock, flags); - return 0; + c = bank->get_context_loss_count(bank->dev); + if (c != bank->context_loss_count) { + omap_gpio_restore_context(bank); + } else { + spin_unlock_irqrestore(&bank->lock, flags); + return 0; + } } }
When booting with device-tree the function pointer for detecting context loss is not populated. Ideally, the pm_runtime framework should be enhanced to allow a means for reporting context/state loss and we could avoid populating such function pointers altogether. In the interim until a generic non-device specific solution is in place, force a restore of the gpio bank when enabling the gpio controller. Adds a new device-tree property for the OMAP GPIO controller to indicate if the GPIO controller is located in a power-domain that never loses power and hence will always maintain its logic state. Signed-off-by: Jon Hunter <jon-hunter@ti.com> --- .../devicetree/bindings/gpio/gpio-omap.txt | 7 ++++-- drivers/gpio/gpio-omap.c | 25 +++++++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-)