Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1760305rdb; Tue, 20 Feb 2024 06:20:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXx/T+8m6iJ3ekJWSZEaRcguJ4s8xnTgAbFAKnDzsnhrmn+eUskbxvQRc+yfQKtKRiNOGu5ipwVWhf0/e7sB8iekXahT/JyXWvh2wbnRw== X-Google-Smtp-Source: AGHT+IGdggv2P0Wl0HUChrUSZ2VlsnvEBEhkPYx1NTz0Z769wkmqdBxH6eQVQnjQEAQ8koj6S48m X-Received: by 2002:a17:902:9a0a:b0:1db:ab9c:d33d with SMTP id v10-20020a1709029a0a00b001dbab9cd33dmr9000569plp.9.1708438805455; Tue, 20 Feb 2024 06:20:05 -0800 (PST) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h22-20020a170902ac9600b001d50ecf8686si6117330plr.520.2024.02.20.06.20.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 06:20:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=lQi5YSTV; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-73142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73142-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F0697B24944 for ; Tue, 20 Feb 2024 14:06:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A4196BB29; Tue, 20 Feb 2024 14:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="lQi5YSTV" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2116.outbound.protection.outlook.com [40.107.22.116]) (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 DA1E56BFA6; Tue, 20 Feb 2024 14:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.116 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708437962; cv=fail; b=EkPPHcoWvO9Q5i0Sm5i83DFF/S419peQh5+OdsIfUS7JOLC1ZuC+9hxUTIImtEpJ2aYbqCxo4sksC0mUbZ4ww2ZazLGg8Rrzjbcp/26ViA+6gxULskY3ezxw+2wL0tIbci0dYDEo8UTwQSV87EFFgv+bwa3Thn40kmh5ahm2FU4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708437962; c=relaxed/simple; bh=gMWA9iiw4gWjTtXoY5mpyTAT8kscTCPedXSh5GS03x0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=APPFqUycKLDJPRqTyGfDigt2WoKeg9QI4rkqmojO04N8eZd38J8qmIlKhN5+Pp0fpxKsquvv7rlwB9KVc57PxaFVXGdToEPfzotMnNaRl31KSJIAD62hP4db4MgOR5knqhJ33G0+jT8pIHMhKk4q6oflkTOBNxFNBMcyQsw5UgY= 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=lQi5YSTV; arc=fail smtp.client-ip=40.107.22.116 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=lOmXZPMRVBhUXisYMTKCFklsXpqNdkf4c9duEkt+On4AAkI/ohsffXfbGEkIEFBgOr4dHu2GMpDsvVzaKlOIaLBfH8ATquCx2E/SxC+sIKwnyeYEdal/9BEhro0J3e2EtxmuQnQyz7aPH/+vthtOFL/+++8yYmpCj53/FXo6ueU90NLphlpotUTPmQLYkSXZzNxaju9fkMVc/25+ZxBfXoPt18lTv1+XTalDTCZEYixEuT+3UZw1tH/E793hLzrm117V8x9aj2QKsU4Sa/IBO32tw2+iehqv0oxMLHF/1P9Z0F+nkHXGLjnitjetXO/g4ejcZ6hWFHK0aUUbHIqW4Q== 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=hx4YfCu/A6IjPi6V+uhUigfsBHtiz8SORKkkQs9tvJw=; b=TO3mTAeiIhKvwCHzSlet+asWI3BK+wjghfpTlk4pSklMmyy6B0AGmGuLPf1Jm6+jidDIxeNp3ZuEiNO0ZFhjZJ4KDmC8KSFl1EXpf9UJYJpQy5XBdKXj7gW3Rc802cCR0iGpsE1md0VjiqCt6JEhsnot+4hUFPAtWqKHe/uF9i501O8aKjRH/o+bEZEVkGbk3FYadsQ1WAxWnDxADAc5Tj67bqo3aTbT/qLxcN1aDKKkWcYwaQnHOQ/rQxNwf6Ctxp8ZDKOfuUqqsOpPurfsE+cpaRzHnWjxJvzaIzw3cXUVYukexeNuUnAQVzhF+LnE7f5R0ApNxcG2GPxUP/+zoQ== 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=hx4YfCu/A6IjPi6V+uhUigfsBHtiz8SORKkkQs9tvJw=; b=lQi5YSTVYUOP6X1ntvs8OBJFBNi0BWUtkmMjS1qarH0AtQYeEHC/XIN7PbebNnYPvtuggd7gvU1rXVis2WyrlD1bweDVZcJlhen4Nna3i2bLiRHsKuXOrkQD5z8OQao7iPSh8AeD2Yqf8icAMnosANpY9wcv8jWfjS18AL9nBV0= 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 PR3PR08MB5577.eurprd08.prod.outlook.com (2603:10a6:102:81::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.39; Tue, 20 Feb 2024 14:05:53 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9527:ec9f:ec4b:ec99]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9527:ec9f:ec4b:ec99%6]) with mapi id 15.20.7292.033; Tue, 20 Feb 2024 14:05:53 +0000 From: Javier Carrasco Date: Tue, 20 Feb 2024 15:05:46 +0100 Subject: [PATCH v4 2/8] usb: misc: onboard_dev: add support for non-hub devices Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240220-onboard_xvf3500-v4-2-dc1617cc5dd4@wolfvision.net> References: <20240220-onboard_xvf3500-v4-0-dc1617cc5dd4@wolfvision.net> In-Reply-To: <20240220-onboard_xvf3500-v4-0-dc1617cc5dd4@wolfvision.net> To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Kaehlcke , Greg Kroah-Hartman , Helen Koike , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Catalin Marinas , Will Deacon , Russell King Cc: 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, Javier Carrasco X-Mailer: b4 0.14-dev-8b532 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708437949; l=2655; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=gMWA9iiw4gWjTtXoY5mpyTAT8kscTCPedXSh5GS03x0=; b=AudUlCiKCPMauOKYrf8iJScAE9iGk2afLGNmodFqXJ3ThlDTcPoG4vTzl80gZlQq9MZdI3Ifx e7N4KiOhc9vBqZj6UxuuOPcjYhrSni6Ayz2/7KD7yFVQHVCsBgqwmQl X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR0102CA0010.eurprd01.prod.exchangelabs.com (2603:10a6:802::23) 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_|PR3PR08MB5577:EE_ X-MS-Office365-Filtering-Correlation-Id: d7934c8c-e1be-44cf-0bb6-08dc321d0cfc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r6aRTq4/TY9JVHo8XoLCFNQxlRDEodMz5tN+rNm2mJ4WN/5hWren5vYzi8eEXmNoH40j0UVDH29KUvuoy/2RbEItqEPKGVswLV7QVkJlINuC447ZbDZnvpJSmFopj58kibj4w+udC2dyk4SgLs6W9Nv68unsoCmJE+SpFUBzQtVttKN6U6Zm5fTIEJF3Dy7nWzwYu0Tz3OA6WrwhCzPj1gChGOSIsLuta+drwwNY5GgJkekhe7peRbi8pModHN9G53p4VK2ZViQnJBEU73fVcDzzdhuzJGjve80haTDS7xDiZAUdjX11rWwpy1BcfBvUdhlgtTUBdWHmExCykYBL+pBVh6SiEKDRZzlgHmrnDBDbtzyxVcLEcwt+Aa6uQXp/BqRHWsY3xGeTIecM09007Xy+uxR28cC5R13NyzG/M/JNreJimoi1OPEzIaPufMlXwQIFX02a7KFL2bqie5L9kzbVSDQDDjSQW0EdX4G0CsViPlpQtIan+snhtfpB99IkLuqbsc5OzODLWkNeZ1P4bU0DasheI3lcX641ypeQisjrCNChsvBjg2eCgwma3mliP307onM5UOrh/F8KkroFr+cSGYbVUbf/STQgIHKZ2edDswk8q3R4VIaspCnm1uiX 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)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?b25RMGhhdERMU1hKQ3RORWQ5T2pQZTFiVjFvcUxFRDNvN3JlMDE0c0dYUkZo?= =?utf-8?B?STM3RDdjckNnNkNLR1NMY2FHYkx6VnhlYVhmM1U1T2Y4S0ZCUld0Sm1nU21E?= =?utf-8?B?RnduOGdKL2ZhRWJHY0ZFc3RNM2JRcEE2c2JJNFNqZkw1eG9XVlVkL3lMRzQ5?= =?utf-8?B?aGE2Z2Jqc2RLRFpDW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?utf-8?B?dWlPWkE1VS9KYlFFUFB1U2QwMXpTTmNkOVBmNWtiUk5nUmp3YWpIRDJuV2tD?= =?utf-8?B?bS82YkNPNTQ0ejhsdEFCUkh6dmJKZkhTaUZEcXVUN1ZVYXVVNENSRHNVNlMv?= =?utf-8?B?WE1VTGJWbGN4dnNOcnhXTEc4dTNtSTQvd2lTb2l2VkJ4RVU5WS9aQlE2VmVG?= =?utf-8?Q?q8Q9tWBlssvuR4tLhUM0dQo=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: d7934c8c-e1be-44cf-0bb6-08dc321d0cfc X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 14:05:53.4092 (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: CNEjTGxetI51RtL/aJ8DejDSGPv8LacTvfODENzgmlRYMidrwxyE4BRgYVEf0vZt/VF11pLlMmc2nZEkzpBDvSsa2t5j5VusN4b1N/JlhW4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5577 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 --- drivers/usb/misc/onboard_usb_dev.c | 3 ++- drivers/usb/misc/onboard_usb_dev.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c index 2103af2cb2a6..f43130a6786f 100644 --- a/drivers/usb/misc/onboard_usb_dev.c +++ b/drivers/usb/misc/onboard_usb_dev.c @@ -129,7 +129,8 @@ static int __maybe_unused onboard_dev_suspend(struct device *dev) if (!device_may_wakeup(node->udev->bus->controller)) continue; - if (usb_wakeup_enabled_descendants(node->udev)) { + if (usb_wakeup_enabled_descendants(node->udev) || + !onboard_dev->pdata->is_hub) { power_off = false; break; } 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, }; 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