* [RFC] serial_core: Add wake_peer uart operation
@ 2014-11-18 6:50 Kiran Kumar Raparthy
2014-11-18 16:25 ` Greg Kroah-Hartman
2014-11-24 9:04 ` One Thousand Gnomes
0 siblings, 2 replies; 4+ messages in thread
From: Kiran Kumar Raparthy @ 2014-11-18 6:50 UTC (permalink / raw)
To: linux-kernel
Cc: San Mehat, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
Android Kernel Team, John Stultz, Sumit Semwal, Kiran Raparthy
From: San Mehat <san@google.com>
serial_core: Add wake_peer uart operation
Add wake_peer which is called before starting UART TX. The idea here
is to provide a mechanism where we can wakeup our peer before sending
data.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Android Kernel Team <kernel-team@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: San Mehat <san@google.com>
[Kiran: Added context to commit message]
Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
---
This is one of the number of patches from the Android AOSP common.git tree,
which is used on almost all Android devices. I wanted to submit it for review
to see if it should go upstream.
drivers/tty/serial/serial_core.c | 3 +++
include/linux/serial_core.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index df3a8c7..dc45c4b 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -95,6 +95,9 @@ static void __uart_start(struct tty_struct *tty)
struct uart_state *state = tty->driver_data;
struct uart_port *port = state->uart_port;
+ if (port->ops->wake_peer)
+ port->ops->wake_peer(port);
+
if (!uart_tx_stopped(port))
port->ops->start_tx(port);
}
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 21c2e05..219b6a3 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -66,6 +66,7 @@ struct uart_ops {
void (*set_ldisc)(struct uart_port *, int new);
void (*pm)(struct uart_port *, unsigned int state,
unsigned int oldstate);
+ void (*wake_peer)(struct uart_port *);
/*
* Return a string describing the type of the port
--
1.8.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [RFC] serial_core: Add wake_peer uart operation
2014-11-18 6:50 [RFC] serial_core: Add wake_peer uart operation Kiran Kumar Raparthy
@ 2014-11-18 16:25 ` Greg Kroah-Hartman
2014-11-18 16:43 ` Kiran Raparthy
2014-11-24 9:04 ` One Thousand Gnomes
1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2014-11-18 16:25 UTC (permalink / raw)
To: Kiran Kumar Raparthy
Cc: linux-kernel, San Mehat, Jiri Slaby, linux-serial,
Android Kernel Team, John Stultz, Sumit Semwal
On Tue, Nov 18, 2014 at 12:20:01PM +0530, Kiran Kumar Raparthy wrote:
> From: San Mehat <san@google.com>
>
> serial_core: Add wake_peer uart operation
>
> Add wake_peer which is called before starting UART TX. The idea here
> is to provide a mechanism where we can wakeup our peer before sending
> data.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.cz>
> Cc: linux-serial@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Android Kernel Team <kernel-team@android.com>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Signed-off-by: San Mehat <san@google.com>
> [Kiran: Added context to commit message]
> Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
> ---
> This is one of the number of patches from the Android AOSP common.git tree,
> which is used on almost all Android devices. I wanted to submit it for review
> to see if it should go upstream.
>
> drivers/tty/serial/serial_core.c | 3 +++
> include/linux/serial_core.h | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index df3a8c7..dc45c4b 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -95,6 +95,9 @@ static void __uart_start(struct tty_struct *tty)
> struct uart_state *state = tty->driver_data;
> struct uart_port *port = state->uart_port;
>
> + if (port->ops->wake_peer)
> + port->ops->wake_peer(port);
> +
> if (!uart_tx_stopped(port))
> port->ops->start_tx(port);
> }
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 21c2e05..219b6a3 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -66,6 +66,7 @@ struct uart_ops {
> void (*set_ldisc)(struct uart_port *, int new);
> void (*pm)(struct uart_port *, unsigned int state,
> unsigned int oldstate);
> + void (*wake_peer)(struct uart_port *);
>
> /*
> * Return a string describing the type of the port
Do you have a driver that uses this callback to submit? I really don't
like taking hooks that are not used in the tree, otherwise it usually
gets removed by someone who says, "look this hook isn't being used,
let's delete it!"
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFC] serial_core: Add wake_peer uart operation
2014-11-18 16:25 ` Greg Kroah-Hartman
@ 2014-11-18 16:43 ` Kiran Raparthy
0 siblings, 0 replies; 4+ messages in thread
From: Kiran Raparthy @ 2014-11-18 16:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: LKML, San Mehat, Jiri Slaby, linux-serial, Android Kernel Team,
John Stultz, Sumit Semwal
On 18 November 2014 21:55, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Nov 18, 2014 at 12:20:01PM +0530, Kiran Kumar Raparthy wrote:
>> From: San Mehat <san@google.com>
>>
>> serial_core: Add wake_peer uart operation
>>
>> Add wake_peer which is called before starting UART TX. The idea here
>> is to provide a mechanism where we can wakeup our peer before sending
>> data.
>>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: Jiri Slaby <jslaby@suse.cz>
>> Cc: linux-serial@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Cc: Android Kernel Team <kernel-team@android.com>
>> Cc: John Stultz <john.stultz@linaro.org>
>> Cc: Sumit Semwal <sumit.semwal@linaro.org>
>> Signed-off-by: San Mehat <san@google.com>
>> [Kiran: Added context to commit message]
>> Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
>> ---
>> This is one of the number of patches from the Android AOSP common.git tree,
>> which is used on almost all Android devices. I wanted to submit it for review
>> to see if it should go upstream.
>>
>> drivers/tty/serial/serial_core.c | 3 +++
>> include/linux/serial_core.h | 1 +
>> 2 files changed, 4 insertions(+)
>>
>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
>> index df3a8c7..dc45c4b 100644
>> --- a/drivers/tty/serial/serial_core.c
>> +++ b/drivers/tty/serial/serial_core.c
>> @@ -95,6 +95,9 @@ static void __uart_start(struct tty_struct *tty)
>> struct uart_state *state = tty->driver_data;
>> struct uart_port *port = state->uart_port;
>>
>> + if (port->ops->wake_peer)
>> + port->ops->wake_peer(port);
>> +
>> if (!uart_tx_stopped(port))
>> port->ops->start_tx(port);
>> }
>> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
>> index 21c2e05..219b6a3 100644
>> --- a/include/linux/serial_core.h
>> +++ b/include/linux/serial_core.h
>> @@ -66,6 +66,7 @@ struct uart_ops {
>> void (*set_ldisc)(struct uart_port *, int new);
>> void (*pm)(struct uart_port *, unsigned int state,
>> unsigned int oldstate);
>> + void (*wake_peer)(struct uart_port *);
>>
>> /*
>> * Return a string describing the type of the port
>
> Do you have a driver that uses this callback to submit? I really don't
> like taking hooks that are not used in the tree, otherwise it usually
> gets removed by someone who says, "look this hook isn't being used,
> let's delete it!"
Okay,let me check and resubmit the patch which uses the callback in driver.
Thanks for the review comments.
Regards,
Kiran
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] serial_core: Add wake_peer uart operation
2014-11-18 6:50 [RFC] serial_core: Add wake_peer uart operation Kiran Kumar Raparthy
2014-11-18 16:25 ` Greg Kroah-Hartman
@ 2014-11-24 9:04 ` One Thousand Gnomes
1 sibling, 0 replies; 4+ messages in thread
From: One Thousand Gnomes @ 2014-11-24 9:04 UTC (permalink / raw)
To: Kiran Kumar Raparthy
Cc: linux-kernel, San Mehat, Greg Kroah-Hartman, Jiri Slaby,
linux-serial, Android Kernel Team, John Stultz, Sumit Semwal
> This is one of the number of patches from the Android AOSP common.git tree,
> which is used on almost all Android devices. I wanted to submit it for review
> to see if it should go upstream.
>
> drivers/tty/serial/serial_core.c | 3 +++
> include/linux/serial_core.h | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index df3a8c7..dc45c4b 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -95,6 +95,9 @@ static void __uart_start(struct tty_struct *tty)
> struct uart_state *state = tty->driver_data;
> struct uart_port *port = state->uart_port;
>
> + if (port->ops->wake_peer)
> + port->ops->wake_peer(port);
> +
> if (!uart_tx_stopped(port))
> port->ops->start_tx(port);
> }
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 21c2e05..219b6a3 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -66,6 +66,7 @@ struct uart_ops {
> void (*set_ldisc)(struct uart_port *, int new);
> void (*pm)(struct uart_port *, unsigned int state,
> unsigned int oldstate);
> + void (*wake_peer)(struct uart_port *);
>
> /*
> * Return a string describing the type of the port
Can we please document the locking and call semantics for this - eg what
stop the peer going back to sleep as this call is made ? when does the
peer go back to sleep ? how does the peer decide to go back to sleep ?
Who sets wake_peer, when may it be set, why is it a uart_op when it's
likely to be per port and really ought to be a bit more dynamic ?
It's probably obvious to Android folks, but the rules are not afaik
written down anywhere in kernel land.
Also I guess why is the power management framework not appropriate for
this should also be answered.
I'm less worried about users - there are a lot of GPL out of tree drivers
using it, and several in tree ones with patches you add for Android use
which exist solely to fix up wake peer and the old wakelocks.
Alan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-24 9:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18 6:50 [RFC] serial_core: Add wake_peer uart operation Kiran Kumar Raparthy
2014-11-18 16:25 ` Greg Kroah-Hartman
2014-11-18 16:43 ` Kiran Raparthy
2014-11-24 9:04 ` One Thousand Gnomes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox