Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp113947lqc; Thu, 29 Feb 2024 11:52:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUJQ9K7Mp8dMlLz6GZGKumVsey+T2IbM/6u9cwXr/XV7bsR40aTi/2F6Y1NJHJQ3wJiBoPMsCN0fUsujiuDiYrbng970N9RA9MRATHnag== X-Google-Smtp-Source: AGHT+IGIYemcwoZBSbNrJ3aB6JLV7YCk+1fKtxUpLWIHMCMlR5vLZhNh3ohDRndwD+OC/hQfRwzW X-Received: by 2002:a17:906:cd1f:b0:a3e:7d36:62b1 with SMTP id oz31-20020a170906cd1f00b00a3e7d3662b1mr2211358ejb.46.1709236362341; Thu, 29 Feb 2024 11:52:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709236362; cv=pass; d=google.com; s=arc-20160816; b=qQdgqji8Nj39/QS0VFv1OgpF273rD8nmJ+LnCr/OxzorHP8T0HIXcB9bMP3b8gNJ0M 3iNaAGwYdZx7XWrx+eBVyovcy4tyrhqFYF5zasEHgmR1UlqeXy7dAhSe0YIoaud6omG5 Zjv2URQv2mhHF1qxOcl2f8R6v8D8FFC+lM8EwSuu5yjVQo1GhcWFg0XTcmRp15/p8osW iwRx+UyBj9nQ6p5iJBgZPgvfXfRvRhKDPu7JJv7RfRinO/IY/4/HOTQ4EHCrQbVZSaJQ NqDPpTBi7+24XBQhjJ7OYqr6LoUQi55/wvjFNwKoiidwIVQ59SafeMEhj1sjWCpHmh9c RV0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2t6iwGhsnNUxY4xM8qxSPssm7+cm45B8gw+DhHQKME4=; fh=Zrsa3sIMQNobhfNdi9CVB65K6g3wBbnALl6Yf9mkFXU=; b=eT8bnkNz7u5CVrg9trpIyd+wFpI3d9kE+NUViCFpWFimZZVBmT7VR0iUQH3mK6P8E3 TbkH8UbNSzRM5siKZakRWQNnkcKM4xE+byf/MsnWZ6/hHCdb2if92Dt42vUkM6CBA8A0 Sv1G5Sh1MnDXkhFUQQNBUfLgTU/CKhW82i2kWmxeshYAlKpvjkGvLl+FQMAwmDazx+Z6 cgkq3xKouln+YCLmm2zJPTAcwuWQT6qlD6EzoFmN4RrVk5B7wop/WdAl3bBH5qqQXjBW K7BV+rMcB8tsYeu3XPCNbqaZRUI75b05m+nIOWEs77OC5rpAorShiqMQZA/mEQB+UsMX 4JMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HypF3EI9; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-87384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87384-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k8-20020a170906054800b00a446d966c32si182078eja.74.2024.02.29.11.52.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 11:52:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HypF3EI9; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-87384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87384-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0B3451F2227C for ; Thu, 29 Feb 2024 19:52:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A630313F42C; Thu, 29 Feb 2024 19:52:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HypF3EI9" Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40DC013C9CD for ; Thu, 29 Feb 2024 19:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709236351; cv=none; b=Z04c8b2B+40E2La4K2rm8qr67hrMmTQu2k4rrI+d5pXm4AlLW2FhsgHIqNhQHmIeN6O1tYmixxuwf4aYFA8sQFIByRQyQr54K8twISUdRgmjKPiKTZFh49phABQp2N/Nz2vi2dc6YVKRjxHeW93P3MPs2qshtwNSQvRqGzssmpA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709236351; c=relaxed/simple; bh=BP7MIA4aqWsMyk/DGZfI6PyI07QVMNIRBi3JywY0eHw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nu/Lh/OyqMojqmeBfeOo+J33uuT0o7ku0CDzvwdsXiUQWVkvi4NnT8/i0h2ma24rtTZOAD1VmVGtQpgwah/3gRpt8XD1gP1XU/ZPJUT3b2wYsIOXMDrbDHTz/91pjggPnr/b+dDWgPnnQMu5sQ5k4MqsHwXPYYxcqSrIYb2gVgs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=HypF3EI9; arc=none smtp.client-ip=209.85.166.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-7c7701f95b6so72174039f.1 for ; Thu, 29 Feb 2024 11:52:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709236349; x=1709841149; darn=vger.kernel.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=2t6iwGhsnNUxY4xM8qxSPssm7+cm45B8gw+DhHQKME4=; b=HypF3EI9hLgQur8I6NBhRnURfqFI7olBYhAmwesAxfVtKJ6jcKGaOFMnuEL4pd+Cnb rCzJyadxlNFrmvS9HJrV6QSm/B2irlD8WqJrVpiM411kdNarXQJgZz0HGwz53/H13oLK 35vOknB0OWFPxxFCT9XdgoPn7FvQI8XYZRbLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709236349; x=1709841149; 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=2t6iwGhsnNUxY4xM8qxSPssm7+cm45B8gw+DhHQKME4=; b=AW4bbf4//xDH5AastvbRGrCpif4MkFpeKPqUQ7jgB1JCLH/aLWpKckbCEoZhrEzWBQ 23f14+w8J7JvxvuNWd2W4R7mzAo3SlYsJzss9hykUiT1tnqa1ON3HDmC3B6DtERTToxq GEfKMgJNqUmDwPvWFvwZbX+sSIxQD9dALNbTFuouRjUQPQ7KkPLj9vnIl95UQFP1q6fa 5dvV++MEHh0Fwt6r4Q5Axc+hUr9hucaixudOgs7EL5SCMpc6oadBbSaP304n25biuKdb B4TQeoYVpv9t3p3ijMAdVbvAdazeelcGv/SejTCLo3bx0nZS3eUOnP+Ko4VI4UyqKYOR 0qKw== X-Forwarded-Encrypted: i=1; AJvYcCWV7CuI4wmi85nG5X2Yjru7dqUAyC+2sz5sUsP9snNaF6LU5DRdCVr/qJhxVTSMlq7c1iZz+WidZxSPoUNB8KmJCGhFmhgIsK4QO1Be X-Gm-Message-State: AOJu0YyHu5hc5XrRZ0ccxeD6Zehd0SAEUg6AUega7LhgVlAYSk+Lbp7q o40EPB5DrggQTCUa1E4ypAbadyiPBgGAaFEnPSo/Qs/SDhgu62OMBUA6j1ahsw== X-Received: by 2002:a05:6e02:1a8e:b0:365:185a:83ed with SMTP id k14-20020a056e021a8e00b00365185a83edmr1768942ilv.10.1709236349457; Thu, 29 Feb 2024 11:52:29 -0800 (PST) Received: from localhost (144.57.222.35.bc.googleusercontent.com. [35.222.57.144]) by smtp.gmail.com with UTF8SMTPSA id 6-20020a056e020ca600b003653eb24e14sm492989ilg.78.2024.02.29.11.52.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Feb 2024 11:52:29 -0800 (PST) Date: Thu, 29 Feb 2024 19:52:28 +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 v6 7/9] usb: misc: onboard_dev: add support for non-hub devices Message-ID: References: <20240229-onboard_xvf3500-v6-0-a0aff2947040@wolfvision.net> <20240229-onboard_xvf3500-v6-7-a0aff2947040@wolfvision.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240229-onboard_xvf3500-v6-7-a0aff2947040@wolfvision.net> On Thu, Feb 29, 2024 at 09:34:50AM +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, 34 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c > index 4ae580445408..f1b174503c44 100644 > --- a/drivers/usb/misc/onboard_usb_dev.c > +++ b/drivers/usb/misc/onboard_usb_dev.c > @@ -261,7 +261,27 @@ static struct attribute *onboard_dev_attrs[] = { > &dev_attr_always_powered_in_suspend.attr, > NULL, > }; > -ATTRIBUTE_GROUPS(onboard_dev); > + > +static umode_t onboard_dev_attrs_are_visible(struct kobject *kobj, > + struct attribute *attr, > + int n) > +{ > + struct device *dev = kobj_to_dev(kobj); > + struct onboard_dev *onboard_dev = dev_get_drvdata(dev); > + > + if (attr == &dev_attr_always_powered_in_suspend.attr && > + !onboard_dev->pdata->is_hub) > + return 0; > + > + return attr->mode; > +} > + > +static const struct attribute_group onboard_dev_group = { > + .is_visible = onboard_dev_attrs_are_visible, > + .attrs = onboard_dev_attrs, > +}; > +__ATTRIBUTE_GROUPS(onboard_dev); > + nit: remove one empty line > > static void onboard_dev_attach_usb_driver(struct work_struct *work) > { > @@ -286,6 +306,9 @@ static int onboard_dev_probe(struct platform_device *pdev) > if (!onboard_dev->pdata) > return -EINVAL; > > + if (!onboard_dev->pdata->is_hub) > + onboard_dev->always_powered_in_suspend = true; > + > onboard_dev->dev = dev; > > err = onboard_dev_get_regulators(onboard_dev); > diff --git a/drivers/usb/misc/onboard_usb_dev.h b/drivers/usb/misc/onboard_usb_dev.h > index 4da9f3b7f9e9..58cf8c81b2cf 100644 > --- a/drivers/usb/misc/onboard_usb_dev.h > +++ b/drivers/usb/misc/onboard_usb_dev.h > @@ -12,60 +12,70 @@ struct onboard_dev_pdata { > unsigned long reset_us; /* reset pulse width in us */ > unsigned int num_supplies; /* number of supplies */ > const char * const supply_names[MAX_SUPPLIES]; > + bool is_hub; /* true if the device is a HUB */ nit: either drop the comment (the variable name is pretty self explaining), or s/HUB/hub/ ('hub' isn't an acronym). Acked-by: Matthias Kaehlcke