From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD0F6C5478C for ; Wed, 28 Feb 2024 20:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KVAZwrfmr8pxntsRArn18iwgdcHO5rKKMAY63K4t6x0=; b=uh6rb2Rbg7Z11g 9kSbVlgQb+a708oBGEq/wbuOm0Mht2OtcD6Ab7DbJaXW9+JBhaqLbWITzavPs5MbP1SHDJV03ZCS9 K8akIKjJxZ8qRRPJIV2t4KSz3ElVxsMkVsDh+33aNwChxebJtkjNJj8aQVaiVY3e0qrcgcDNZ7jg0 +4C5dYP3BaaYBdUBdm4CfnU5qG3e2m6Smum/baPqw60nRvRDtBqagEcPpGuTbMOycul9kzpoo9P2e 8yTg1TsZR1FuiW2YFCkhz1Ji2rkHudKzyJwMRI7YnqkEWwJZ2B5vBu5ygJAGeL+LENWLHMVyuVVDH NXXiG1PnXHnWYPxBHhrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfQkN-0000000AsAo-3p4Z; Wed, 28 Feb 2024 20:41:47 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfQkL-0000000AsAK-0t3h for linux-arm-kernel@lists.infradead.org; Wed, 28 Feb 2024 20:41:46 +0000 Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-365b3bab179so987835ab.0 for ; Wed, 28 Feb 2024 12:41:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709152903; x=1709757703; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Baw+xs3ggfXLm4MxOGqTtw4oYWjUFXR4qcJc+3eX6ws=; b=UoedF7WAiz4Xll60V2m6gwFGztZTnq0wc/VXZ1iWUfOIM8qIuNPZVZPV9zzatfem/n K1VwbmxJK8qN6+caW1aQx1HrFph8P09DFEDWjIr2b05QECwWXCQw3DuX0oZBrNZfFxJM 8PO8fpgOaMjnsMJwQqXdzdPxMHZEMrb9P1cFQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709152903; x=1709757703; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Baw+xs3ggfXLm4MxOGqTtw4oYWjUFXR4qcJc+3eX6ws=; b=c97/JW+ReYrCvHwj03joIIzA6XNyGfwY8jyXpqqIkM3SGZ+22TNdlHseonnXlpHe5T NaTVLv83M/JWr9Uo5ceXaCiGhobQQB/Swt2X6qEmyg7Qr9+um12KPah3SG1TTJNYCCCE Tl2QOOVOON6UZl/oRL5Qy+oZRjgzU89nET2M3BSU4M2QeBwzFCewfOdx+0GUT4jOPk4W 71da8+MgM0QtvS3HkBxc+9mx/uQmeZRXMG4uMc6eGAFUDLpgIw3qRyLfHYZisbw887y0 F+Mm8TTOS9DKRsyxJaNBX+32pztkfBlf4zYHzj3vFNMtbAwQcxbDmiM2Nd2W3iGJxKIg yZ2g== X-Forwarded-Encrypted: i=1; AJvYcCUhpqmty220mkGmQxGC53xl9vWqY3+A//KTRScxVA9UDuIYGtNoIS2ZcsPWMHZDrfysVMeng2YMqcXhoaZdtnUVi9Y0IwUOT7NDjgMRwB5z8D9FyBI= X-Gm-Message-State: AOJu0YwQ34tUG73TNYV24lpfjSdBQuy7ZC1Dl4UyOeWyadEhv6VnJZqc C+ZWZbtR6nlnMoGC79Z/n8ydZdmvxIO1KOaUL6Tdw7HoH1AuO3vkTp9pAGUuQA== X-Google-Smtp-Source: AGHT+IH3ZpBdW2jBIz8fH0FB8KIQ7tWY8SxlmUVGC6UzHIlrtZ3R+qNemBz8OtGIPciy1hbt6wwyWw== X-Received: by 2002:a92:d2cd:0:b0:365:b5aa:135d with SMTP id w13-20020a92d2cd000000b00365b5aa135dmr322432ilg.32.1709152903571; Wed, 28 Feb 2024 12:41:43 -0800 (PST) Received: from localhost (144.57.222.35.bc.googleusercontent.com. [35.222.57.144]) by smtp.gmail.com with UTF8SMTPSA id bc29-20020a056e02009d00b00364372c5b5asm49554ilb.15.2024.02.28.12.41.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Feb 2024 12:41:43 -0800 (PST) Date: Wed, 28 Feb 2024 20:41:42 +0000 From: Matthias Kaehlcke To: Javier Carrasco Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , Helen Koike , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Catalin Marinas , Will Deacon , Russell King , linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5 6/8] usb: misc: onboard_dev: add support for non-hub devices Message-ID: References: <20240228-onboard_xvf3500-v5-0-76b805fd3fe6@wolfvision.net> <20240228-onboard_xvf3500-v5-6-76b805fd3fe6@wolfvision.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240228_124145_283506_5551375D X-CRM114-Status: GOOD ( 46.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 28, 2024 at 09:21:00PM +0100, Javier Carrasco wrote: > On 28.02.24 19:10, Matthias Kaehlcke wrote: > > On Wed, Feb 28, 2024 at 02:51:33PM +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. > >> > >> The 'always_powered_in_supend' attribute is only available for hub > >> devices, keeping the driver's default behavior for non-hub devices (keep > >> on in suspend). > >> > >> Signed-off-by: Javier Carrasco > >> --- > >> drivers/usb/misc/onboard_usb_dev.c | 25 +++++++++++++++++++++++-- > >> drivers/usb/misc/onboard_usb_dev.h | 10 ++++++++++ > >> 2 files changed, 33 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c > >> index e1779bd2d126..df0ed172c7ec 100644 > >> --- a/drivers/usb/misc/onboard_usb_dev.c > >> +++ b/drivers/usb/misc/onboard_usb_dev.c > >> @@ -132,7 +132,8 @@ static int __maybe_unused onboard_dev_suspend(struct device *dev) > >> struct usbdev_node *node; > >> bool power_off = true; > >> > >> - if (onboard_dev->always_powered_in_suspend) > >> + if (onboard_dev->always_powered_in_suspend && > >> + !onboard_dev->pdata->is_hub) > >> return 0; > > > > With this non-hub devices would always be powered down, since > > 'always_powerd_in_suspend' is not set for them. This should be: > > > > May I ask you what you meant in v4 with this comment? > > > Even without the sysfs attribute the field 'always_powered_in_suspend' > > could > > be set to true by probe() for non-hub devices. struct onboard_dev always has the field 'always_powered_in_suspend', even for non-hubs, that don't have the corresponding sysfs attribute. Currently it is left uninitialized (i.e. false) for non-hubs. Instead it could be initialized to true by probe() for non-hubs, which would be semantically correct. With that it wouldn't be necessary to check here whether a device is hub, because the field would provide the necessary information. > > if (!onboard_dev->pdata->is_hub || > > onboard_dev->always_powered_in_suspend) > > > > Checking for the (non-)hub status first is clearer IMO, also it avoids > > an unneccessary check of 'always_powered' for non-hub devices. > > > > That makes sense and will be fixed. > > > Without code context: for hubs there can be multiple device tree nodes > > for the same physical hub chip (e.g. one for the USB2 and another for > > the USB3 part). I suppose this could also be the case for non-hub > > devices. For hubs there is the 'peer-hub' device tree property to > > establish a link between the two USB devices, as a result the onboard > > driver only creates a single platform device (which is desired, > > otherwise two platform devices would be in charge for power sequencing > > the same phyiscal device. For non-hub devices there is currently no such > > link. In many cases I expect there will be just one DT entry even though > > the device has multiple USB interfaces, but it could happen and would > > actually be a more accurate representation. > > > > General support is already there (the code dealing with 'peer-hub'), but > > we'd have to come up with a suitable name. 'peer-device' is the first > > thing that comes to my mind, but there might be better options. If such > > a generic property is added then we should deprecate 'peer-hub', but > > maintain backwards compatibility. > > I have nothing against that, but the first non-hub device that will be > added does not have multiple DT nodes, so I have nothing to test that > extension with real hardware. I see, the XVF3500 is USB 2.0 only, so it isn't suitable for testing. > That could be added in the future, though, if the need ever arises. I expect it will, when a DT maintainer asks the hardware to be represented correctly for a device that is connected to more than one USB bus. IIRC that's how 'peer-hub' was born :) Ok, we can leave it out for now. I might send a dedicated patch after your series landed. If a switch to 'peer-device' or similar is anticipated then it's probably best to deprecate 'peer-hub' ASAP, to avoid it from getting added to more bindings. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel