From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Fabio Estevam <festevam@gmail.com>,
Matthias Kaehlcke <mka@chromium.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH v5 2/4] usb: hub: add infrastructure to pass onboard_dev port features
Date: Wed, 11 Mar 2026 15:44:28 +0100 [thread overview]
Message-ID: <2026031101-rut-storable-7def@gregkh> (raw)
In-Reply-To: <20260223-v6-16-topic-usb-onboard-dev-v5-2-28d3018a8026@pengutronix.de>
On Mon, Feb 23, 2026 at 12:27:35PM +0100, Marco Felsch wrote:
> On board devices may require special handling for en-/disable port
> features due to PCB design decisions e.g. enable/disable the VBUS power
> on the port via a host controlled regulator or GPIO.
>
> This commit adds the necessary infrastructure to prepare the common code
> base for such use-cases.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> drivers/usb/core/hub.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++--
> drivers/usb/core/hub.h | 2 ++
> include/linux/usb.h | 3 +++
> 3 files changed, 58 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 24960ba9caa915f12a4f5582269808fdebd1ee11..9fdfd2f0aacc9b1994cd3761330968e052167c67 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -453,9 +453,19 @@ static int clear_hub_feature(struct usb_device *hdev, int feature)
> */
> int usb_clear_port_feature(struct usb_device *hdev, int port1, int feature)
> {
> - return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
> + struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
> + int ret;
> +
> + ret = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
> USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port1,
> NULL, 0, 1000);
> + if (ret)
> + return ret;
> +
> + if (hub->onboard_hub_clear_port_feature)
> + ret = hub->onboard_hub_clear_port_feature(hdev, feature, port1);
> +
> + return ret;
> }
>
> /*
> @@ -463,9 +473,19 @@ int usb_clear_port_feature(struct usb_device *hdev, int port1, int feature)
> */
> static int set_port_feature(struct usb_device *hdev, int port1, int feature)
> {
> - return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
> + struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
> + int ret;
> +
> + ret = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
> USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port1,
> NULL, 0, 1000);
> + if (ret)
> + return ret;
> +
> + if (hub->onboard_hub_set_port_feature)
> + ret = hub->onboard_hub_set_port_feature(hdev, feature, port1);
> +
> + return ret;
> }
>
> static char *to_led_name(int selector)
> @@ -6545,6 +6565,37 @@ void usb_hub_adjust_deviceremovable(struct usb_device *hdev,
> }
> }
>
> +/**
> + * usb_hub_register_port_feature_hooks - Register port set/get feature hooks
> + * @hdev: USB device belonging to the usb hub
> + * @set_port_feature: set_feature hook which gets called by the hub core
> + * @clear_port_feature: clear_feature hook which gets called by the hub core
> + *
> + * Register set/get_port_feature hooks for a onboard_dev hub.
> + */
> +void usb_hub_register_port_feature_hooks(struct usb_device *hdev,
> + int (*set_port_feature)(struct usb_device *, int, int),
> + int (*clear_port_feature)(struct usb_device *, int, int))
This should be a structure, don't force function pointers to be passed
in a function, that way lies madness :)
thanks,
greg k-h
next prev parent reply other threads:[~2026-03-11 14:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 11:27 [PATCH v5 0/4] Add onboard-dev USB hub host managed vbus handling support Marco Felsch
2026-02-23 11:27 ` [PATCH v5 1/4] usb: port: track the disabled state Marco Felsch
2026-03-11 14:43 ` Greg Kroah-Hartman
2026-03-20 22:16 ` Marco Felsch
2026-02-23 11:27 ` [PATCH v5 2/4] usb: hub: add infrastructure to pass onboard_dev port features Marco Felsch
2026-03-11 14:44 ` Greg Kroah-Hartman [this message]
2026-03-20 22:26 ` Marco Felsch
2026-02-23 11:27 ` [PATCH v5 3/4] dt-bindings: usb: usb-device: add usb hub port vbus-supply suppport Marco Felsch
2026-02-23 11:28 ` Marco Felsch
2026-03-06 0:01 ` Rob Herring (Arm)
2026-02-23 11:27 ` [PATCH v5 4/4] usb: misc: onboard_dev: add hub downstream port host vbus-supply handling Marco Felsch
2026-03-05 11:29 ` [PATCH v5 0/4] Add onboard-dev USB hub host managed vbus handling support Marco Felsch
2026-03-17 3:44 ` Ze Huang
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=2026031101-rut-storable-7def@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=mka@chromium.org \
--cc=robh@kernel.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