devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Javier Carrasco <javier.carrasco@wolfvision.net>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH v3 2/7] usb: misc: onboard_dev: add support for non-hub devices
Date: Tue, 6 Feb 2024 18:40:58 +0000	[thread overview]
Message-ID: <ZcJ9OnYOtUVMu2Yk@google.com> (raw)
In-Reply-To: <20240206-onboard_xvf3500-v3-2-f85b04116688@wolfvision.net>

On Tue, Feb 06, 2024 at 02:59:30PM +0100, Javier Carrasco wrote:
> Most of the functionality this driver provides can be used by non-hub
> devices as well.
> 
> To account for the hub-specific code, add a flag to the device data
> structure and check its value for hub-specific code.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
> ---
>  drivers/usb/misc/onboard_usb_dev.c |  3 +++
>  drivers/usb/misc/onboard_usb_dev.h | 10 ++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c
> index e2e1e1e30c1e..3ac21ec38ac0 100644
> --- a/drivers/usb/misc/onboard_usb_dev.c
> +++ b/drivers/usb/misc/onboard_usb_dev.c
> @@ -123,6 +123,9 @@ static int __maybe_unused onboard_dev_suspend(struct device *dev)
>  	if (onboard_dev->always_powered_in_suspend)
>  		return 0;
>  
> +	if (!onboard_dev->pdata->is_hub)
> +		return onboard_dev_power_off(onboard_dev);

Why turn the device always off when it isn't a hub? It could be a device
with wakeup support.

I really regret making 'off in suspend' the default :(

> +
>  	mutex_lock(&onboard_dev->lock);
>  
>  	list_for_each_entry(node, &onboard_dev->udev_list, list) {
> diff --git a/drivers/usb/misc/onboard_usb_dev.h b/drivers/usb/misc/onboard_usb_dev.h
> index f13d11a84371..ebe83e19d818 100644
> --- a/drivers/usb/misc/onboard_usb_dev.h
> +++ b/drivers/usb/misc/onboard_usb_dev.h
> @@ -9,51 +9,61 @@
>  struct onboard_dev_pdata {
>  	unsigned long reset_us;		/* reset pulse width in us */
>  	unsigned int num_supplies;	/* number of supplies */
> +	bool is_hub;
>  };
>  
>  static const struct onboard_dev_pdata microchip_usb424_data = {
>  	.reset_us = 1,
>  	.num_supplies = 1,
> +	.is_hub = true,

Depending on when 'is_hub' is checked it could be an option to initialize
it at runtime (depending on USB_CLASS_HUB), e.g. in onboard_dev_add_usbdev().
Might not be worth the hassle tough if more than the current check(s) get
added.

>  };
>  
>  static const struct onboard_dev_pdata microchip_usb5744_data = {
>  	.reset_us = 0,
>  	.num_supplies = 2,
> +	.is_hub = true,
>  };
>  
>  static const struct onboard_dev_pdata realtek_rts5411_data = {
>  	.reset_us = 0,
>  	.num_supplies = 1,
> +	.is_hub = true,
>  };
>  
>  static const struct onboard_dev_pdata ti_tusb8041_data = {
>  	.reset_us = 3000,
>  	.num_supplies = 1,
> +	.is_hub = true,
>  };
>  
>  static const struct onboard_dev_pdata cypress_hx3_data = {
>  	.reset_us = 10000,
>  	.num_supplies = 2,
> +	.is_hub = true,
>  };
>  
>  static const struct onboard_dev_pdata cypress_hx2vl_data = {
>  	.reset_us = 1,
>  	.num_supplies = 1,
> +	.is_hub = true,
>  };
>  
>  static const struct onboard_dev_pdata genesys_gl850g_data = {
>  	.reset_us = 3,
>  	.num_supplies = 1,
> +	.is_hub = true,
>  };
>  
>  static const struct onboard_dev_pdata genesys_gl852g_data = {
>  	.reset_us = 50,
>  	.num_supplies = 1,
> +	.is_hub = true,
>  };
>  
>  static const struct onboard_dev_pdata vialab_vl817_data = {
>  	.reset_us = 10,
>  	.num_supplies = 1,
> +	.is_hub = true,
>  };
>  
>  static const struct of_device_id onboard_dev_match[] = {
> 
> -- 
> 2.40.1
> 

  reply	other threads:[~2024-02-06 18:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 13:59 [PATCH v3 0/7] usb: misc: onboard_hub: add support for XMOS XVF3500 Javier Carrasco
2024-02-06 13:59 ` [PATCH v3 1/7] usb: misc: onboard_hub: rename to onboard_dev Javier Carrasco
2024-02-06 17:55   ` Matthias Kaehlcke
2024-02-13 10:36     ` Javier Carrasco
2024-02-21 18:22       ` Matthias Kaehlcke
2024-02-06 13:59 ` [PATCH v3 2/7] usb: misc: onboard_dev: add support for non-hub devices Javier Carrasco
2024-02-06 18:40   ` Matthias Kaehlcke [this message]
2024-02-13 10:00     ` Javier Carrasco
2024-02-21 18:33       ` Matthias Kaehlcke
2024-02-06 13:59 ` [PATCH v3 3/7] drm: ci: arm64.config: update ONBOARD_USB_HUB to ONBOARD_USB_DEV Javier Carrasco
2024-02-06 13:59 ` [PATCH v3 4/7] arm64: defconfig: " Javier Carrasco
2024-02-06 13:59 ` [PATCH v3 5/7] ARM: multi_v7_defconfig: update ONBOARD_USB_HUB name Javier Carrasco
2024-02-06 13:59 ` [PATCH v3 6/7] ASoC: dt-bindings: xmos,xvf3500: add XMOS XVF3500 voice processor Javier Carrasco
2024-02-06 14:32   ` Mark Brown
2024-02-06 15:05     ` Javier Carrasco
2024-02-06 15:22       ` Matthias Kaehlcke
2024-02-06 15:35         ` Javier Carrasco
2024-02-06 16:22           ` Mark Brown
2024-02-06 15:35       ` Mark Brown
2024-02-06 15:38         ` Javier Carrasco
2024-02-06 15:49         ` Matthias Kaehlcke
2024-02-06 16:35           ` Mark Brown
2024-02-06 13:59 ` [PATCH v3 7/7] usb: misc: onboard_hub: add support for XMOS XVF3500 Javier Carrasco

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=ZcJ9OnYOtUVMu2Yk@google.com \
    --to=mka@chromium.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=javier.carrasco@wolfvision.net \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).