From: Jun Nie <jun.nie@linaro.org>
To: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
devicetree@vger.kernel.org, sven@svenpeter.dev,
shawn.guo@linaro.org
Subject: Re: [PATCH 2/2] usb: typec: tipd: Support wakeup
Date: Fri, 6 Jan 2023 09:45:39 +0800 [thread overview]
Message-ID: <CABymUCMnBmGDjZtu2eHoRRBrsBT22JXfmYJWOXb3urUhgho+mQ@mail.gmail.com> (raw)
In-Reply-To: <d0191001-d31e-1e65-0594-12dbb789392e@linaro.org>
Bryan O'Donoghue <bryan.odonoghue@linaro.org> 于2023年1月5日周四 19:05写道:
>
> On 05/01/2023 07:50, Jun Nie wrote:
> > Enable wakeup when pluging or unpluging USB cable. It is up to other
> > components to hold system in active mode, such as display, so that
> > user can receive the notification.
> >
> > Signed-off-by: Jun Nie <jun.nie@linaro.org>
> > ---
> > drivers/usb/typec/tipd/core.c | 38 +++++++++++++++++++++++++++++++++++
> > 1 file changed, 38 insertions(+)
> >
> > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> > index 46a4d8b128f0..485b90c13078 100644
> > --- a/drivers/usb/typec/tipd/core.c
> > +++ b/drivers/usb/typec/tipd/core.c
> > @@ -95,6 +95,7 @@ struct tps6598x {
> > struct power_supply_desc psy_desc;
> > enum power_supply_usb_type usb_type;
> >
> > + int wakeup;
> > u16 pwr_status;
> > };
> >
> > @@ -846,6 +847,12 @@ static int tps6598x_probe(struct i2c_client *client)
> > i2c_set_clientdata(client, tps);
> > fwnode_handle_put(fwnode);
> >
> > + tps->wakeup = device_property_read_bool(tps->dev, "wakeup-source");
> > + if (tps->wakeup) {
> > + device_init_wakeup(&client->dev, true);
> > + enable_irq_wake(client->irq);
> > + }
>
> Does the ordering of device_init_wakeup() and enable_irq_wake() matter ?
>
> The sequence in drivers/usb/typec/tcpm/tcpci_maxim.c is
> enable_irq_wake() and then device_init_wakeup() ?
With reading related code, I believe it is better to put device_init_wakeup()
before enable_irq_wake() logically. Though it shall not matter in real world.
device_init_wakeup() register the wakeup source and setup sysfs etc, which
is puerly software side infrastructure. enable_irq_wake() setup interrupt
configuration, including software and hardware sides. I assume there is no
suspend/resume process involves wakeup event before probe function finish
in real world. If there is, device_init_wakeup() should come before before
enable_irq_wake() strictly.
- Jun
>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
next prev parent reply other threads:[~2023-01-06 1:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 7:50 [PATCH 1/2] dt-bindings: usb: tps6598x: Add wakeup property Jun Nie
2023-01-05 7:50 ` [PATCH 2/2] usb: typec: tipd: Support wakeup Jun Nie
2023-01-05 11:05 ` Bryan O'Donoghue
2023-01-06 1:45 ` Jun Nie [this message]
2023-01-05 11:49 ` Heikki Krogerus
2023-01-05 10:56 ` [PATCH 1/2] dt-bindings: usb: tps6598x: Add wakeup property Bryan O'Donoghue
2023-01-06 9:19 ` Krzysztof Kozlowski
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=CABymUCMnBmGDjZtu2eHoRRBrsBT22JXfmYJWOXb3urUhgho+mQ@mail.gmail.com \
--to=jun.nie@linaro.org \
--cc=bryan.odonoghue@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=shawn.guo@linaro.org \
--cc=sven@svenpeter.dev \
/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).