All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Govindraj <govindraj.ti@gmail.com>
Cc: "Govindraj.R" <govindraj.raja@ti.com>,
	linux-omap@vger.kernel.org, Paul Walmsley <paul@pwsan.com>,
	Tony Lindgren <tony@atomide.com>, Partha Basak <p-basak2@ti.com>,
	linux-serial@vger.kernel.org,
	Vishwanath Sripathy <vishwanath.bs@ti.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 07/11] Serial: OMAP: Add runtime pm support for omap-serial driver
Date: Fri, 09 Sep 2011 11:14:13 -0700	[thread overview]
Message-ID: <8739g5y45m.fsf@ti.com> (raw)
In-Reply-To: <CAAL8m4wpCVrhY7++ROwu0Whh4w_cF_dUr0t5622+WmJZah_FRA@mail.gmail.com> (Govindraj's message of "Fri, 9 Sep 2011 12:02:49 +0530")

Govindraj <govindraj.ti@gmail.com> writes:

> On Fri, Sep 9, 2011 at 5:54 AM, Kevin Hilman <khilman@ti.com> wrote:
>> "Govindraj.R" <govindraj.raja@ti.com> writes:
>>
>>> Adapts omap-serial driver to use pm_runtime API's.
>>>
>>> 1.) Moving context_restore func to driver from serial.c
>>> 2.) Use runtime irq safe to use get_sync from irq context.
>>> 3.) autosuspend for port specific activities and put for reg access.
>>
>> Re: autosuspend, it looks like the driver now has 2 mechanisms for
>> tracking activity.  The runtime PM 'mark last busy' and the existing
>> 'up->port_activity = jiffies' stuff.  Do you think those could be
>> unified?
>>
>
> Is there a way where we can retrieve the last busy jiffie value
> using runtime API? I don't find that available.
>

Not currently.  The question is more along the lines of: what is the
port_activity jiffies used for, and can it be replaced by using
_mark_last_busy().

If it cannot, that's fine, but it should be described.

>> At first glance, it looks like most places with a _mark_last_busy() also
>> have a up->port_activity update.  I'm not familiar enough with the
>> driver to make the call, but they look awfully similar.
>>
>
> Ok, I will check whether I can get rid if it.
>
>>> 4.) for earlyprintk usage the debug macro will write to console uart
>>>     so keep uart clocks active from boot, idle using hwmod API's re-enable back
>>>     using runtime API's.
>>
>> /me doesn't understand
>
> I have added this reason in early mail reply to 04/11 patch review
> [needed for earlyprintk option from low level debug ]

OK, but AFAIK, DEBUG_LL + earlyprintk do not use this driver.  Instead
they use the debug macros, so any hacks to deal with that do not belong
in the driver.

If there are hacks required, they should be in a separate patch, with a
separate descriptive changelog.

>>
>>> 5.) Moving context restore to runtime suspend and using reg values from port
>>>     structure to restore the uart port context based on context_loss_count.
>>>     Maintain internal state machine for avoiding repeated enable/disable of
>>>     uart port wakeup mechanism.
>>> 6.) Add API to enable wakeup and check wakeup status.
>>>
>>> Acked-by: Alan Cox <alan@linux.intel.com>
>>> Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
>>> ---
>>>  arch/arm/mach-omap2/serial.c                  |   49 ++++++
>>>  arch/arm/plat-omap/include/plat/omap-serial.h |   10 ++
>>>  drivers/tty/serial/omap-serial.c              |  211 ++++++++++++++++++++++---
>>>  3 files changed, 250 insertions(+), 20 deletions(-)
>>>
>
> [..]
>
>>> +
>>> +static void omap_uart_wakeup_enable(struct platform_device *pdev, bool enable)
>>> +{
>>> +     struct omap_device *od;
>>> +     struct omap_uart_port_info *up = pdev->dev.platform_data;
>>> +
>>> +     /* Set or clear wake-enable bit */
>>> +     if (up->wk_en && up->wk_mask) {
>>> +             u32 v = __raw_readl(up->wk_en);
>>> +             if (enable)
>>> +                     v |= up->wk_mask;
>>> +             else
>>> +                     v &= ~up->wk_mask;
>>> +             __raw_writel(v, up->wk_en);
>>> +     }
>>> +
>>> +     od = to_omap_device(pdev);
>>> +     if (enable)
>>> +             omap_hwmod_enable_wakeup(od->hwmods[0]);
>>> +     else
>>> +             omap_hwmod_disable_wakeup(od->hwmods[0]);
>>> +}
>>> +
>>
>> Here again, this is difficult to review because you removed the code in
>> [4/11] and add it back here, but with rather different functionality
>> with no description as to why.
>>
>
> will move this change as part of 4/11 itself.
>

The point was not just that the move was confusing, but that you changed
the functionality along with the move without any description.

>> The previous version enabled wakeups at the PRCM and at the IO ring.
>> This version enables wakeups at the PRCM as well but instead of enabling
>> them at the IO ring, enables them at the module.
>>
>
> Since we are gating using prepare idle call I think
> we can use this enable wake-up call as part of prepare idle call itself,
> as done earlier.

Not sure what that has to with my comment.

In moving this code, you removed the enable/disable of IO ring wakeups.
It probably continues to work because they're enabled by the bootloader,
but that is not correct and the driver should be managing the IO ring
wakeups as before.

[...]

>>>  }
>>>
>>>  static int __init
>>> @@ -1065,22 +1123,33 @@ static struct uart_driver serial_omap_reg = {
>>>       .cons           = OMAP_CONSOLE,
>>>  };
>>>
>>> -static int
>>> -serial_omap_suspend(struct platform_device *pdev, pm_message_t state)
>>> +static int serial_omap_suspend(struct device *dev)
>>>  {
>>> -     struct uart_omap_port *up = platform_get_drvdata(pdev);
>>> +     struct uart_omap_port *up = dev_get_drvdata(dev);
>>>
>>> -     if (up)
>>> +     if (up) {
>>>               uart_suspend_port(&serial_omap_reg, &up->port);
>>> +             if (up->port.line == up->port.cons->index &&
>>> +                             !is_console_locked())
>>> +                     up->console_locked = console_trylock();
>>> +     }
>>> +
>>
>> Motiviation for console locking in this version of the series is not
>> clear, and not described in the changelog.
>>
>> It's also present here in static suspend/resume but not in runtime
>> suspend/resume, which also is suspicious.
>>
>
> Yes will add to change log,
>
> We needed this for no console suspend use case
> no console lock is taken in no_console_suspend is specified,
>
> Since our pwr_dmn hooks disable clocks left enabled during suspend,
> so any prints after pwr_dmn hooks can cause problems since clocks
> are already cut from pwr_dmn hooks.
>
> So buffer prints while entering suspend by taking console lock
> if not taken already and print back after uart state machine restores
> console uart.

Any special consideration for features like no_console_suspend should be
done in a separate patch with a separate changelog.

However, as I've stated before during previous reviews, if someone has
put no_console_suspend on the command line, that means they've
specifically stated they *want* to see console writes during suspend.
That means, we should not cut clocks at all.

Of course, that means the system will not hit the low power state becase
the UART clocks are not gated, but that is what the user requested.


Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 07/11] Serial: OMAP: Add runtime pm support for omap-serial driver
Date: Fri, 09 Sep 2011 11:14:13 -0700	[thread overview]
Message-ID: <8739g5y45m.fsf@ti.com> (raw)
In-Reply-To: <CAAL8m4wpCVrhY7++ROwu0Whh4w_cF_dUr0t5622+WmJZah_FRA@mail.gmail.com> (Govindraj's message of "Fri, 9 Sep 2011 12:02:49 +0530")

Govindraj <govindraj.ti@gmail.com> writes:

> On Fri, Sep 9, 2011 at 5:54 AM, Kevin Hilman <khilman@ti.com> wrote:
>> "Govindraj.R" <govindraj.raja@ti.com> writes:
>>
>>> Adapts omap-serial driver to use pm_runtime API's.
>>>
>>> 1.) Moving context_restore func to driver from serial.c
>>> 2.) Use runtime irq safe to use get_sync from irq context.
>>> 3.) autosuspend for port specific activities and put for reg access.
>>
>> Re: autosuspend, it looks like the driver now has 2 mechanisms for
>> tracking activity. ?The runtime PM 'mark last busy' and the existing
>> 'up->port_activity = jiffies' stuff. ?Do you think those could be
>> unified?
>>
>
> Is there a way where we can retrieve the last busy jiffie value
> using runtime API? I don't find that available.
>

Not currently.  The question is more along the lines of: what is the
port_activity jiffies used for, and can it be replaced by using
_mark_last_busy().

If it cannot, that's fine, but it should be described.

>> At first glance, it looks like most places with a _mark_last_busy() also
>> have a up->port_activity update. ?I'm not familiar enough with the
>> driver to make the call, but they look awfully similar.
>>
>
> Ok, I will check whether I can get rid if it.
>
>>> 4.) for earlyprintk usage the debug macro will write to console uart
>>> ? ? so keep uart clocks active from boot, idle using hwmod API's re-enable back
>>> ? ? using runtime API's.
>>
>> /me doesn't understand
>
> I have added this reason in early mail reply to 04/11 patch review
> [needed for earlyprintk option from low level debug ]

OK, but AFAIK, DEBUG_LL + earlyprintk do not use this driver.  Instead
they use the debug macros, so any hacks to deal with that do not belong
in the driver.

If there are hacks required, they should be in a separate patch, with a
separate descriptive changelog.

>>
>>> 5.) Moving context restore to runtime suspend and using reg values from port
>>> ? ? structure to restore the uart port context based on context_loss_count.
>>> ? ? Maintain internal state machine for avoiding repeated enable/disable of
>>> ? ? uart port wakeup mechanism.
>>> 6.) Add API to enable wakeup and check wakeup status.
>>>
>>> Acked-by: Alan Cox <alan@linux.intel.com>
>>> Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
>>> ---
>>> ?arch/arm/mach-omap2/serial.c ? ? ? ? ? ? ? ? ?| ? 49 ++++++
>>> ?arch/arm/plat-omap/include/plat/omap-serial.h | ? 10 ++
>>> ?drivers/tty/serial/omap-serial.c ? ? ? ? ? ? ?| ?211 ++++++++++++++++++++++---
>>> ?3 files changed, 250 insertions(+), 20 deletions(-)
>>>
>
> [..]
>
>>> +
>>> +static void omap_uart_wakeup_enable(struct platform_device *pdev, bool enable)
>>> +{
>>> + ? ? struct omap_device *od;
>>> + ? ? struct omap_uart_port_info *up = pdev->dev.platform_data;
>>> +
>>> + ? ? /* Set or clear wake-enable bit */
>>> + ? ? if (up->wk_en && up->wk_mask) {
>>> + ? ? ? ? ? ? u32 v = __raw_readl(up->wk_en);
>>> + ? ? ? ? ? ? if (enable)
>>> + ? ? ? ? ? ? ? ? ? ? v |= up->wk_mask;
>>> + ? ? ? ? ? ? else
>>> + ? ? ? ? ? ? ? ? ? ? v &= ~up->wk_mask;
>>> + ? ? ? ? ? ? __raw_writel(v, up->wk_en);
>>> + ? ? }
>>> +
>>> + ? ? od = to_omap_device(pdev);
>>> + ? ? if (enable)
>>> + ? ? ? ? ? ? omap_hwmod_enable_wakeup(od->hwmods[0]);
>>> + ? ? else
>>> + ? ? ? ? ? ? omap_hwmod_disable_wakeup(od->hwmods[0]);
>>> +}
>>> +
>>
>> Here again, this is difficult to review because you removed the code in
>> [4/11] and add it back here, but with rather different functionality
>> with no description as to why.
>>
>
> will move this change as part of 4/11 itself.
>

The point was not just that the move was confusing, but that you changed
the functionality along with the move without any description.

>> The previous version enabled wakeups at the PRCM and at the IO ring.
>> This version enables wakeups at the PRCM as well but instead of enabling
>> them at the IO ring, enables them at the module.
>>
>
> Since we are gating using prepare idle call I think
> we can use this enable wake-up call as part of prepare idle call itself,
> as done earlier.

Not sure what that has to with my comment.

In moving this code, you removed the enable/disable of IO ring wakeups.
It probably continues to work because they're enabled by the bootloader,
but that is not correct and the driver should be managing the IO ring
wakeups as before.

[...]

>>> ?}
>>>
>>> ?static int __init
>>> @@ -1065,22 +1123,33 @@ static struct uart_driver serial_omap_reg = {
>>> ? ? ? .cons ? ? ? ? ? = OMAP_CONSOLE,
>>> ?};
>>>
>>> -static int
>>> -serial_omap_suspend(struct platform_device *pdev, pm_message_t state)
>>> +static int serial_omap_suspend(struct device *dev)
>>> ?{
>>> - ? ? struct uart_omap_port *up = platform_get_drvdata(pdev);
>>> + ? ? struct uart_omap_port *up = dev_get_drvdata(dev);
>>>
>>> - ? ? if (up)
>>> + ? ? if (up) {
>>> ? ? ? ? ? ? ? uart_suspend_port(&serial_omap_reg, &up->port);
>>> + ? ? ? ? ? ? if (up->port.line == up->port.cons->index &&
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? !is_console_locked())
>>> + ? ? ? ? ? ? ? ? ? ? up->console_locked = console_trylock();
>>> + ? ? }
>>> +
>>
>> Motiviation for console locking in this version of the series is not
>> clear, and not described in the changelog.
>>
>> It's also present here in static suspend/resume but not in runtime
>> suspend/resume, which also is suspicious.
>>
>
> Yes will add to change log,
>
> We needed this for no console suspend use case
> no console lock is taken in no_console_suspend is specified,
>
> Since our pwr_dmn hooks disable clocks left enabled during suspend,
> so any prints after pwr_dmn hooks can cause problems since clocks
> are already cut from pwr_dmn hooks.
>
> So buffer prints while entering suspend by taking console lock
> if not taken already and print back after uart state machine restores
> console uart.

Any special consideration for features like no_console_suspend should be
done in a separate patch with a separate changelog.

However, as I've stated before during previous reviews, if someone has
put no_console_suspend on the command line, that means they've
specifically stated they *want* to see console writes during suspend.
That means, we should not cut clocks at all.

Of course, that means the system will not hit the low power state becase
the UART clocks are not gated, but that is what the user requested.


Kevin

  reply	other threads:[~2011-09-09 18:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07 12:53 [PATCH v4 00/11] OMAP2+: Serial: Runtime adaptation + cleanup Govindraj.R
2011-09-07 12:53 ` Govindraj.R
2011-09-07 12:53 ` [PATCH v4 01/11] OMAP2+: hwmod: Add API to enable IO ring wakeup Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-07 12:53 ` [PATCH v4 02/11] OMAP2+: hwmod: Add API to check IO PAD wakeup status Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-07 12:53 ` [PATCH v4 03/11] OMAP2+: UART: cleanup + remove certain uart calls from pm code Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-07 12:53 ` [PATCH v4 04/11] OMAP2+: UART: Remove uart clock handling code from serial.c Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-08 23:39   ` Kevin Hilman
2011-09-08 23:39     ` Kevin Hilman
2011-09-09  5:22     ` Govindraj
2011-09-09  5:22       ` Govindraj
2011-09-07 12:53 ` [PATCH v4 05/11] OMAP2+: Serial: Add default mux for all uarts Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-07 12:53 ` [PATCH v4 06/11] Serial: OMAP: Store certain reg values to port structure Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-07 12:53 ` [PATCH v4 07/11] Serial: OMAP: Add runtime pm support for omap-serial driver Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-09  0:24   ` Kevin Hilman
2011-09-09  0:24     ` Kevin Hilman
2011-09-09  6:32     ` Govindraj
2011-09-09  6:32       ` Govindraj
2011-09-09 18:14       ` Kevin Hilman [this message]
2011-09-09 18:14         ` Kevin Hilman
2011-09-12  6:55         ` Govindraj
2011-09-12  6:55           ` Govindraj
2011-09-12  6:58           ` Govindraj
2011-09-12  6:58             ` Govindraj
2011-09-12 17:01           ` Kevin Hilman
2011-09-12 17:01             ` Kevin Hilman
2011-09-07 12:53 ` [PATCH v4 08/11] Serial: OMAP2+: Move erratum handling from serial.c Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-07 12:53 ` [PATCH v4 09/11] OMAP2+: Serial: Use prepare and resume calls to gate uart clocks Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-09 18:59   ` Kevin Hilman
2011-09-09 18:59     ` Kevin Hilman
2011-09-12  6:37     ` Govindraj
2011-09-12  6:37       ` Govindraj
2011-09-07 12:53 ` [PATCH v4 10/11] OMAP: Serial: Allow UART parameters to be configured from board file Govindraj.R
2011-09-07 12:53   ` Govindraj.R
2011-09-09 19:11   ` Kevin Hilman
2011-09-09 19:11     ` Kevin Hilman
2011-09-12  6:34     ` Govindraj
2011-09-12  6:34       ` Govindraj
2011-09-07 12:53 ` [PATCH v4 11/11] Serial: OMAP2+: Make the RX_TIMEOUT for DMA configurable for each UART Govindraj.R
2011-09-07 12:53   ` Govindraj.R

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=8739g5y45m.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=govindraj.raja@ti.com \
    --cc=govindraj.ti@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=p-basak2@ti.com \
    --cc=paul@pwsan.com \
    --cc=tony@atomide.com \
    --cc=vishwanath.bs@ti.com \
    /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 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.