From: "Stanley Chang[昌育德]" <stanley_chang@realtek.com>
To: Kishon Vijay Abraham I <kvijayab@amd.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Vinod Koul" <vkoul@kernel.org>,
"Johan Hovold" <johan@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Jinjie Ruan" <ruanjinjie@huawei.com>,
"Rob Herring" <robh@kernel.org>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Yang Yingliang" <yangyingliang@huawei.com>,
"Flavio Suligoi" <f.suligoi@asem.it>,
"Roy Luo" <royluo@google.com>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Ricardo Cañuelo" <ricardo.canuelo@collabora.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: RE: [PATCH v3 1/4] phy: core: add notify_connect and notify_disconnect callback
Date: Tue, 21 Nov 2023 06:54:12 +0000 [thread overview]
Message-ID: <16319548dfc6446fa1874ec962da8f20@realtek.com> (raw)
In-Reply-To: <2d234d31-3045-72f2-57db-db03515eebcf@amd.com>
Hi Kishon,
> -----Original Message-----
> From: Kishon Vijay Abraham I <kvijayab@amd.com>
> Sent: Tuesday, November 21, 2023 1:47 PM
> To: Stanley Chang[昌育德] <stanley_chang@realtek.com>; Greg
> Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Vinod Koul <vkoul@kernel.org>; Johan Hovold <johan@kernel.org>; Kishon
> Vijay Abraham I <kishon@kernel.org>; Geert Uytterhoeven
> <geert+renesas@glider.be>; Jinjie Ruan <ruanjinjie@huawei.com>; Rob
> Herring <robh@kernel.org>; Alan Stern <stern@rowland.harvard.edu>; Yang
> Yingliang <yangyingliang@huawei.com>; Flavio Suligoi <f.suligoi@asem.it>;
> Roy Luo <royluo@google.com>; Heikki Krogerus
> <heikki.krogerus@linux.intel.com>; Ricardo Cañuelo
> <ricardo.canuelo@collabora.com>; linux-kernel@vger.kernel.org;
> linux-phy@lists.infradead.org; linux-usb@vger.kernel.org
> Subject: Re: [PATCH v3 1/4] phy: core: add notify_connect and
> notify_disconnect callback
>
>
> External mail.
>
>
>
> Hi Stanley,
>
> On 11/10/2023 11:15 AM, Stanley Chang wrote:
> > In Realtek SoC, the parameter of usb phy is designed to can dynamic
> > tuning base on port status. Therefore, add a notify callback of phy
> > driver when usb connection/disconnection change.
> >
> > Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
> > ---
> > v1 to v2:
> > No change
> > v2 to v3:
> > No change
> > ---
> > drivers/phy/phy-core.c | 47
> +++++++++++++++++++++++++++++++++++++++++
> > include/linux/phy/phy.h | 18 ++++++++++++++++
> > 2 files changed, 65 insertions(+)
> >
> > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index
> > 96a0b1e111f3..a84ad4896b7f 100644
> > --- a/drivers/phy/phy-core.c
> > +++ b/drivers/phy/phy-core.c
> > @@ -489,6 +489,53 @@ int phy_calibrate(struct phy *phy)
> > }
> > EXPORT_SYMBOL_GPL(phy_calibrate);
> >
> > +/**
> > + * phy_notify_connect() - phy connect notify
> > + * @phy: the phy returned by phy_get()
> > + * @port: the port index for connect
> > + *
> > + * If phy need the get connection status, the callback can be used.
> > + * Returns: %0 if successful, a negative error code otherwise */ int
> > +phy_notify_connect(struct phy *phy, int port) {
> > + int ret;
> > +
> > + if (!phy || !phy->ops->connect)
> > + return 0;
> > +
> > + mutex_lock(&phy->mutex);
> > + ret = phy->ops->connect(phy, port);
> > + mutex_unlock(&phy->mutex);
> > +
> > + return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(phy_notify_connect);
> > +
> > +/**
> > + * phy_notify_disconnect() - phy disconnect notify
> > + * @phy: the phy returned by phy_get()
> > + * @port: the port index for disconnect
> > + *
> > + * If phy need the get disconnection status, the callback can be used.
> > + *
> > + * Returns: %0 if successful, a negative error code otherwise */ int
> > +phy_notify_disconnect(struct phy *phy, int port) {
> > + int ret;
> > +
> > + if (!phy || !phy->ops->disconnect)
> > + return 0;
> > +
> > + mutex_lock(&phy->mutex);
> > + ret = phy->ops->disconnect(phy, port);
> > + mutex_unlock(&phy->mutex);
> > +
> > + return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(phy_notify_disconnect);
>
> Please use EXTCON framework for notifying connect/disconnect.
Do you mean registering notifications via extcon_register_notifier?
But there is no extcon device provided in the USB framework to notify connect and disconnect.
Therefore, I added the notification connection/disconnection based on the generic phy.
[v3,4/4] usb: core: add phy notify connect and disconnect
https://patchwork.kernel.org/project/linux-usb/patch/20231110054738.23515-4-stanley_chang@realtek.com/
Thanks,
Stanley
prev parent reply other threads:[~2023-11-21 6:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 5:45 [PATCH v3 1/4] phy: core: add notify_connect and notify_disconnect callback Stanley Chang
2023-11-10 5:45 ` [PATCH v3 2/4] phy: realtek: usb: add new driver for the Realtek RTD SoC USB 2.0 PHY Stanley Chang
2023-11-10 7:47 ` Johan Hovold
2023-11-10 10:32 ` Stanley Chang[昌育德]
2023-11-10 5:45 ` [PATCH v3 3/4] phy: realtek: usb: add new driver for the Realtek RTD SoC USB 3.0 PHY Stanley Chang
2023-11-10 5:45 ` [PATCH v3 4/4] usb: core: add phy notify connect and disconnect Stanley Chang
2023-12-07 4:50 ` Stanley Chang[昌育德]
2023-12-07 7:10 ` Greg Kroah-Hartman
2023-12-07 7:16 ` Stanley Chang[昌育德]
2023-11-20 2:16 ` [PATCH v3 1/4] phy: core: add notify_connect and notify_disconnect callback Stanley Chang[昌育德]
2023-11-21 5:47 ` Kishon Vijay Abraham I
2023-11-21 6:54 ` Stanley Chang[昌育德] [this message]
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=16319548dfc6446fa1874ec962da8f20@realtek.com \
--to=stanley_chang@realtek.com \
--cc=f.suligoi@asem.it \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=johan@kernel.org \
--cc=kishon@kernel.org \
--cc=kvijayab@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=ricardo.canuelo@collabora.com \
--cc=robh@kernel.org \
--cc=royluo@google.com \
--cc=ruanjinjie@huawei.com \
--cc=stern@rowland.harvard.edu \
--cc=vkoul@kernel.org \
--cc=yangyingliang@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox