From: Vinod Koul <vkoul@kernel.org>
To: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Johan Hovold <johan@kernel.org>,
linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] phy: omap-usb2: add explicit PHY comparator API
Date: Sat, 3 Oct 2026 22:20:19 +0200 [thread overview]
Message-ID: <asFjg44FteVbJdj2@parshuram> (raw)
In-Reply-To: <16609718-fc04-4e1e-b63f-e54aafd14eb6@gmail.com>
On 31-08-26, 19:14, Ivaylo Dimitrov wrote:
>
>
> On 27.08.26 г. 18:51 ч., Vinod Koul wrote:
> > On 22-07-26, 08:36, Ivaylo Dimitrov wrote:
> > > The existing omap_usb2_set_comparator() API locates the OMAP USB2 PHY
> > > instance by calling usb_get_phy(USB_PHY_TYPE_USB2), assuming there is a
> > > single USB2 PHY registered in the system.
> > >
> > > This assumption no longer holds on systems with multiple USB2 PHY
> > > providers. In such cases, the global lookup may return a different USB2
> > > PHY instance, causing the OMAP driver to perform an invalid container_of()
> > > conversion when accessing its private data.
> > >
> > > Introduce omap_usb2_set_phy_comparator(), allowing callers to explicitly
> > > specify the OMAP USB2 PHY instance to associate with a phy_companion.
> > > The new helper validates that the supplied USB PHY is an OMAP USB2 PHY
> > > before accessing its private data.
> >
> > Well the name can cause ambiguity with old API. Second I would like to
> > see users of this API as well
> >
>
> Would `omap_usb2_set_comparator_for_phy()` be clearer? Or could you
> suggest a better name?
Yes that would be okay
> Regarding the user of the API, let me provide some background.
>
> Currently, the cpcap-charger driver uses the old omap_usb2_set_comparator()
> API. On mapphone devices there are two
> USB-PHY devices, phy_omap_usb2 and phy_cpcap_usb. The old API selects
> the first USB2 PHY probed, which is not guaranteed to be the OMAP PHY.
>
> I have also added DCP detection and extcon support to the CPCAP PHY, and
> I'm working on proper charging current limiting in cpcap-charger. For that,
> the charger driver needs to be able to explicitly select the OMAP
> PHY from DT and register for its PHY events, in order to properly limit
> the current in case of DCP/gadget/OTG connection.
>
> With the DT configuration, cpcap-charger has the specific PHY instance
> available and can use the new API. For legacy configurations without a
> PHY specified in DT, it will continue to use the existing API.
>
> The relevant changes are:
>
> DCP detection/extcon support in the CPCAP PHY:
> https://lkml.org/lkml/2026/7/11/600
>
> `cpcap-charger` changes (currently out-of-tree):
> https://git.maemo.org/leste-upstream-forks/droid4-linux/commit/0261cbb724d875ee4aa2e5af34caead39e5e47fb
>
> I initially kept the cpcap-charger change separate since the two
> patches look somewhat unrelated. I also wanted to see whether the
> approach in this patch is acceptable in principle before preparing the
> cpcap-charger changes for upstreaming.
>
> Would you prefer me to send a series with the $subject patch and the
> cpcap-charger changes, including the required DT schema changes?
>
> Thanks and regards,
> Ivo
>
--
~Vinod
prev parent reply other threads:[~2026-10-03 20:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 5:36 Ivaylo Dimitrov
2026-08-27 6:13 ` Ivaylo Dimitrov
2026-08-27 15:51 ` Vinod Koul
2026-08-31 16:14 ` Ivaylo Dimitrov
2026-10-03 20:20 ` Vinod Koul [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=asFjg44FteVbJdj2@parshuram \
--to=vkoul@kernel.org \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
/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
all inboxes | Powered by JetHome®