Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp68619rbe; Wed, 28 Feb 2024 12:21:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVuP0x09W4MJlfSLL0jdhfkXorK1rKTz+ICeiF2ukfAwjVqH8JKFI0z2EwDUnthMzLLQRdsB1iRVpI48lQ9z70o/GPOQUjtQu7wPPVsOw== X-Google-Smtp-Source: AGHT+IGN2A/N2KXSii5bfcW4tKEmyvv3AL6I01fteOWspqNj8scNy2t2Xybe3pfB/VWoF1zfXcpI X-Received: by 2002:a17:90b:378e:b0:299:1831:25c9 with SMTP id mz14-20020a17090b378e00b00299183125c9mr223716pjb.37.1709151706993; Wed, 28 Feb 2024 12:21:46 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id sx8-20020a17090b2cc800b00298b0fab60csi15771pjb.72.2024.02.28.12.21.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 12:21:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85671-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=s0T3n2ex; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-85671-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85671-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BD9BA285853 for ; Wed, 28 Feb 2024 20:21:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 277E3135A71; Wed, 28 Feb 2024 20:21:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="s0T3n2ex" Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2112.outbound.protection.outlook.com [40.107.15.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30E365E082; Wed, 28 Feb 2024 20:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.15.112 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709151668; cv=fail; b=Y9bu/lIzNCw2Ua6I9Q0QeE3pq0C5im48t21pUKrLGbLUUktyqf9uiAirPOUs6WhZsJLmtexIOHyvYHX/vLmLQevXkyQW1nQ/B+xf+lnoUzKAsZWcBknhPdhibZBhodg40gt8xxG6meTAzVTVamjT1acIR23Br22TV31CEWwstWY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709151668; c=relaxed/simple; bh=hrd0s3dnExxQQeyYGP/dlTBss7HIlgNxgbtDcdnJjQk=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=RO7XulmGhfdwuT8Fdji9TcvSt4iz0QvW//WEdyA82LQ88IlkikPGa6DDG3mGGfWJB1xPt6dq7vnPo16x/jwYn/p3o4nxlszI45iH7IJuhYiuuJCScc4PtS88YvExMNJ5BVsXyI/H8UXtiHVeoJuudlbBQSZoGU0aFM7qZEL6aOs= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=s0T3n2ex; arc=fail smtp.client-ip=40.107.15.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A85D9ZoL0GmZK1260B/qUvKi2Izk8RCjE1hrCRcKT3s71bENePjxawwbZ14UjAOcc1WVYgFJsop+8FRyQabKzTZXE3TeBamCJtbVYZMOKQnV+0QLNWD4gUDIk1wVTChKKBv4RWZL5+0P+fz755quUZYwtekiADtZ+eWczhN67BGrrfcuNfgTos7hnRB7icXVslyzHochPuKgNjxhpKMC5XXMABN4kQj0cOdhD9MDRvjudUO5AbkbjmAuoCP4Azt9vKW/Oa8LDMTICD5UbrywjWX53jslJgdfdE+5EkQkSGvsKnAsioEhsA/IyWw1YxN6W1ttDo+FxhmsfchE9lddNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eqEzPb/mVMcIU9eXjoP06fQJwVcbJk51Ys3HvOoWbI4=; b=bktvlJDuZy3TSIkLvy10VbT074CLxWxYwwzlBbGtOJaVxIOr65LdfOEMIc//L6I/ZbUxNc7C8YDjxpvzPoSj251e7MmmlN2qqqWOS3gOvDkkhKr1eYa/nu2Ju5Fo2VK8SfES26KpZw1bdlg6IufKtMNeYzqOUoLKgO7CBipFY+A53sUQZeNwvfOG1WMFmPtXmzFh7xWyqck8VGwp7xvCYwpRauzLBElZ7UMTe5ofzHauLFGaf85r4EWvRIWqXAyw+YH7JbBZDjLQEO6NVhb+O74FbDFb7qo5sqU6xoy3abFhtbrpM6UasRrr0rEj1b3j75wxAU3KuzN2wnlqg2/PNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eqEzPb/mVMcIU9eXjoP06fQJwVcbJk51Ys3HvOoWbI4=; b=s0T3n2exBVXsfDNqFBbeeiPhFWG8ntcbO/pbedw2HqhWOAjULsnnCuZEGtTc1ZpJlCuZ0k6FkRCw2oTxvipG0IEW2+Xs4lEDnhIAgiXnvTvsWGpmM6GyHBiOG01gdrf/QPwcec7y+/y6vMF4d9QwPxKSVrIRSzWRIOj1tPX65Ws= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by AS8PR08MB8875.eurprd08.prod.outlook.com (2603:10a6:20b:5b7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Wed, 28 Feb 2024 20:21:03 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f%6]) with mapi id 15.20.7316.035; Wed, 28 Feb 2024 20:21:03 +0000 Message-ID: Date: Wed, 28 Feb 2024 21:21:00 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 6/8] usb: misc: onboard_dev: add support for non-hub devices Content-Language: en-US To: Matthias Kaehlcke 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 References: <20240228-onboard_xvf3500-v5-0-76b805fd3fe6@wolfvision.net> <20240228-onboard_xvf3500-v5-6-76b805fd3fe6@wolfvision.net> From: Javier Carrasco In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR4P281CA0215.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:e4::16) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|AS8PR08MB8875:EE_ X-MS-Office365-Filtering-Correlation-Id: 700deb88-100c-4417-ba46-08dc389ac903 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F4msH3Yh6JePWIHERyK7aFgdNvpZzv6Vu9LOl4irhHOCa7dngEzZCE6NZrhrAqdsNSvkLke5mQfcO2ozb+t4vaDAOF7S4N8miFm92HafgjKPGsQmmWU22trDk55UZb2oaCwTGQbWic6qMQcf9a9sNramjggrwbCZVoijFq5iBqlhpkPgqNFhxBxcGK0Gv1uGYInIS8w5SpPUQ1M5yrM3dsw40g443l0zz6TC0yinJe2ThWq7U9GQUBO+F7ag+la7BrR5iuUy1nL5o3Y6NJ/DV6Sf1Wc0ucU1XTY1ex8o6RUZx79wdLqTwuOqC12hZsA2NQIranhpTCfgqh8RZsxAJ3EgI8nxK57F7NMSM3MXlaQ2Nbn0zDGoQY2l7gpVitElZd3LbJSruybY6Yx47GeFXgwZf0/x99Fspf2sdoTQqR6VHDd+TtjhcqSnRO+1da4OhVPt/CBxz99+FP+gvN4OBlOh3naJcp8y36UrrLlEnFGXRGkTdmOyRSSQaI1Htp8d0h1Jih9F8JoAVRq+84SUaPs0jkdaB3BUq8JF1QprIUOMAU8VdEbbh6xSiWpn++CsCQWUIR108H7J9VOoF5XdmI30k0H+5Q5WWyS1dP0EWVcp8s5d0J+TOMKZaLNGByGxGYBzb485fbkvKhOIxwmpUw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aW1BMDVDSGUyTS9yaWIzZHpsamhsVlpTSXk3R0gvVXMyQm01cHB6Sk0wckdN?= =?utf-8?B?NFBoeDYraHBtb2xYYjJHV3ZKblpxQm1udnV6eGFJclU2dlRUVFVCKzhkazlM?= =?utf-8?B?K0JLelU0emVqbE1Fc1ZxNVF6MHVBTm9JM2ZxS3lOdFdlZFdDbzc4c0pZUWNK?= =?utf-8?B?ellIaGtOdWJudlU2ZGptd3QxWnhUeXJJUlBOeWxuUkx5ZlhDN2pWSzdUYjhy?= =?utf-8?B?MjVLMVBqUXBSV1ZqREpVcVgwL3EyREd0YXppM3ovb3IwVDVHaW1lNy94VDMz?= =?utf-8?B?RFhzNndnRjIwc042N25HUm1aTjdOa2NRNlpicC92ZUhBWjg2MzBvUUlVQTBR?= =?utf-8?B?Q3ZDdUJFZWJQVmlNZWc4aHBmWFgrRzI5eEs5NmFDSUJtcnc1aVozalRRODZU?= =?utf-8?B?bGJJVDBJcWF2NGRhNmNXakZBaUZ0WVcybGZlNTJ1RzcxWnZoUlQxd205VGVj?= =?utf-8?B?a1czT0VyMTRubHl5WkRaZzhoUmlHTDNCRnpSQ2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ant-Network-Message-Id: 700deb88-100c-4417-ba46-08dc389ac903 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2024 20:21:02.9698 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pRPFOV3zqhujatAQ+f5Io1DZ7dNbaIUJOFDZ/UYR35E7MCNFNxHcpl3xbKRRE8wcs+I+O4GOL1RBnGh+9m+EHU7jTqz64cnVjjyWig4t0+A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8875 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. > 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. That could be added in the future, though, if the need ever arises. Best regards, Javier Carrasco