Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp198205lqs; Mon, 4 Mar 2024 21:55:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVzhjBdg5HZYJ9BTBCeKKUG8s/bvToVLdSfgQ+IdCRmtA7DczQ7JOiyPDrNtidSb6sD7Wg3uAAQyI1hPbS8fQsCAFaiqg3xOjHg28qThw== X-Google-Smtp-Source: AGHT+IHxcWq75MqdgK3/w883Q9Uv9pLHGBu8LXx4iDAFcGxFmU0Qm8jOe4jIfg47RLwD5bNHzDrR X-Received: by 2002:a05:6870:170e:b0:221:26a1:efcd with SMTP id h14-20020a056870170e00b0022126a1efcdmr892726oae.37.1709618147690; Mon, 04 Mar 2024 21:55:47 -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 e191-20020a6369c8000000b005cdfcb3908bsi9346154pgc.316.2024.03.04.21.55.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 21:55:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91706-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=Cbyb8WBK; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-91706-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91706-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 5834F2846C7 for ; Tue, 5 Mar 2024 05:55:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C2C77E105; Tue, 5 Mar 2024 05:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="Cbyb8WBK" Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2109.outbound.protection.outlook.com [40.107.247.109]) (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 067397C0A1; Tue, 5 Mar 2024 05:55:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.109 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709618119; cv=fail; b=k1FaEl44VlyVMGpuydWZy9FjtyuTfweKcRxpDWyePWijgi3iVq5qTHpS0XE7tbYEYTIEEnj46FoAhSIfvJyES+AxwczxNSpFVBcs/GQI7nk+KWeuQ+EogK5YH04OBt+1MZSzZ/loiaq584p3YmuXrpr+9ijligknTmVZGIaju6w= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709618119; c=relaxed/simple; bh=hLEAZIEQz6ksQuaNqwCOXTPaYxX3asHHadVtJggQpuM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Qe2Wv5KZWugyppMqLTDs5bPHEUbKFd1dt/5uNQyiO2xU9//ebwcuSB8s8vg+tcQkyzopEmzzIh/fG7Qj+fh9T59zHa+YI/d2dk4yIoIjBAQzyx4Qr3YZR5MKVgRcoUFM/nRDkuXk2eGN4cFIHbMDkS/8M4ghObqU5szilX+ySSc= 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=Cbyb8WBK; arc=fail smtp.client-ip=40.107.247.109 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=PE5edMSZl5gqbpGCcacbpTNT/a+Tesl6JW0reBAI75R9ixMxACj5ED5DA0QnGQH0t+yovNSrCaTjzh/PoL6GXh7zsL9YliJEKn1xFlG120F3UUkvHTMEd+G7ogthTBK5JrUFHicpgZoP7DXeb1aL8ifWsXcdK17eoUDuLWQNEWqjgM3OuxwsYsXZBSITwFoD/etD6ThHWzObBTMTJ1MPXI6msQG1tWu6Ns/5eSCrJAR4EjJmQ9zhOrSU/ThxKUmUuGbS6YycAKqBBPuNyBZUjvrRjFxFZ8r4bJQa4CTJN7yuSO+R5wmptWM/R8WtKZs7nxPYcbdsEEPAMMfgI23qoA== 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=5Sv/dmBSgR8EmzNvZoJoI/UpeZyuslotiSuh5epalWQ=; b=KPc4nBgsUP8iByYajwS59DspNG0icIWmD8ug/zpsyogN9qSQZqsFk+GR1abkC9FlmJ/L0BzKdS/9NlCwCOQvO3h/RZNZTYNFzFP2jSSJJD4A8qmIC9F5ecrYt3vpCUCoGEChP0lDZp1ZCsKbFrLMFtJqbseysxe8DsNmJdBHchRefS5gSbZN1dFE1qsEknq/DCXOG4wbu5qhaRaH9u9jC5cXDwR/IRD43YtkBujEGNHhztRMstV9TaiEoUMVaqvPKcnXXhB4ZQsAh4fns2FwxVJ5cDIvPzjVcIf+jygdMp1+RYL60RQLSU+kHlsmg8cnRq+oVrW6Nmw0nMkrw9Xilw== 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=5Sv/dmBSgR8EmzNvZoJoI/UpeZyuslotiSuh5epalWQ=; b=Cbyb8WBK12GjwpHeJVcPwtW/9ZIvJamzPyektBJto5zWLIeDCveyi0S6KBxkA1Q1QQbP2SUksvyW3oMeMUPcZlVLd6FJ6nO5NaY0O4loP4ljRXFnisaSlw8VztPiu9ISNxpxFEfwrMgve1dYX6wGM+ur+N/e/oX89lcsXcWoUtg= 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 DB9PR08MB8385.eurprd08.prod.outlook.com (2603:10a6:10:3da::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Tue, 5 Mar 2024 05:55:12 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f%7]) with mapi id 15.20.7339.035; Tue, 5 Mar 2024 05:55:12 +0000 From: Javier Carrasco Date: Tue, 05 Mar 2024 06:55:02 +0100 Subject: [PATCH v7 2/9] usb: misc: onboard_hub: use device supply names Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240305-onboard_xvf3500-v7-2-ad3fb50e593b@wolfvision.net> References: <20240305-onboard_xvf3500-v7-0-ad3fb50e593b@wolfvision.net> In-Reply-To: <20240305-onboard_xvf3500-v7-0-ad3fb50e593b@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 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709618108; l=5246; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=hLEAZIEQz6ksQuaNqwCOXTPaYxX3asHHadVtJggQpuM=; b=T5f/KljSE7T1xv0p5NsLGsznYGcVQx5F4Vt4OzlPioOgPz99P/cFkqNP+89zQmmQcTjrYxuTq HSLteXBSCFkDBXIJ3zwlNV76pSc1oupnjfUpcwk635xLl/97Dsn+cCj X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: FR4P281CA0110.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:bb::18) 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_|DB9PR08MB8385:EE_ X-MS-Office365-Filtering-Correlation-Id: 36f1a7b9-96b3-4851-af35-08dc3cd8d287 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rboD1bFAcAQuZiRaj62lC5zPm91b1c5ovRDbPmJOFlLfrJ/1WlnuWyTQ9ep/oJ9DbXjE+ia5A23+8lOqgdP7bzdzoPRjv6e4Z4SSOgYH/4647Fj7cntgAs5arytFHYs7c+duKn6VTBD/r7Glbvry1IPOP9JylOvCdR9FdZcQ/I56UC0HhxuC1xdj3KWitk6T2bSioVVKekhJdsfkE5bxbcFRjmCQMY19IvqCp+w16H4Q0XX4ZSJu3v/TFxdfwr7KD7giNpD0ekYOn6Lx+LlvOlLn9ldRtxmZihhlPdTSyBDFFHs+Z51OY3k1WdNQ8FRw2oNM67oeh6NDR/lcWDPFpZroDdRalqtnpBoumR6x32IOgzVXG3YtJGg3uHCDMpBABC1ld10JvwlvUjxSujmCRcQ/NJlKDP+OOGiLDpcpsn4sVs1rv2ND95sS2da+Md1nWHP4q8OL8ENpmi+h9u/2H4MTMxivlCc8YUuudRk1e97p/9vXeINGDAQxce6q+MQNx9HBa5F1aXh+yl320V5Xh1/4q+uI54mI2V8HrGe1tm0gAj343e0J1wijh27cm1Jy+YRdE7UE/vInRhdJZZGatzTmaQvHvCb1XQxY6RlsH+TqlkRVjEeV4rG+FSZFl5/Xd/GPVOvo3Y1Yue931hvFuClLz2XthB/UWyeSOhF8eZPhoybBHYHH3QcQDNUyi3jHrzut69O4SZcD6kM9y4dt2MdBEU2Qp2g+0QXg9BLz/PM= 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)(376005)(38350700005)(921011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dE1aMEFwd2M0dXlsQ2JaSUVHSjRsU2tMaktaeUxqS0MyVmNtdFRSZVVZNENv?= =?utf-8?B?a1U3UnpBWEZzSVowbFJwR2ZaT0UyL25QellleG5vTUdPUmZR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mczUyYnVDZXVHVVhwcDA3WGZkNXdIZ2Z1S2JQVUJlYWczazJ5eDBONEYr?= =?utf-8?B?enBhaW1Wc3N5S2NaRklaeVJLcGVzeGFuL25HZUNiWlF5ekZYOWNhLytQWjdp?= =?utf-8?B?dGFQWVpLd0czZTVIamRVOG5xZVpkVmVqVkhBdVpkbmdmUWJzQ015YUUyMW80?= =?utf-8?B?NXh1ZjhGNE5LanYvREFnRElmYU5vejJuU1hadXhVcUhOV3NtalYydEVXWFdu?= =?utf-8?B?WC9OU29nYXF5a1o5cUdlQ0t5YzEyS0FsVWhBZERvQ1hWcVlwRGFZK0Z0aEJ5?= =?utf-8?B?VHc9PQ==?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 36f1a7b9-96b3-4851-af35-08dc3cd8d287 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 05:55:12.3468 (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: 8LzEa8zdTRI1A5K9kqGVVGQ4iJN9sgFU7pd4CGgH45sP6YTl2E8GnA2aZw38rXcmfGhVHl0Nmg1nc5z1izM/VMdsFPdPJ30KQ0ujBJhBJI8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8385 The current implementation uses generic names for the power supplies, which conflicts with proper name definitions in the device bindings. Add a per-device property to include real supply names and keep generic names for existing devices to keep backward compatibility. Acked-by: Matthias Kaehlcke Signed-off-by: Javier Carrasco --- drivers/usb/misc/onboard_usb_hub.c | 49 ++++++++++++++++++++------------------ drivers/usb/misc/onboard_usb_hub.h | 12 ++++++++++ 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/drivers/usb/misc/onboard_usb_hub.c b/drivers/usb/misc/onboard_usb_hub.c index 81c001fd38c1..1f3e0094957d 100644 --- a/drivers/usb/misc/onboard_usb_hub.c +++ b/drivers/usb/misc/onboard_usb_hub.c @@ -29,17 +29,6 @@ #include "onboard_usb_hub.h" -/* - * Use generic names, as the actual names might differ between hubs. If a new - * hub requires more than the currently supported supplies, add a new one here. - */ -static const char * const supply_names[] = { - "vdd", - "vdd2", -}; - -#define MAX_SUPPLIES ARRAY_SIZE(supply_names) - static void onboard_hub_attach_usb_driver(struct work_struct *work); static struct usb_device_driver onboard_hub_usbdev_driver; @@ -65,6 +54,29 @@ struct onboard_hub { struct clk *clk; }; +static int onboard_hub_get_regulators(struct onboard_hub *hub) +{ + const char * const *supply_names = hub->pdata->supply_names; + unsigned int num_supplies = hub->pdata->num_supplies; + struct device *dev = hub->dev; + unsigned int i; + int err; + + if (num_supplies > MAX_SUPPLIES) + return dev_err_probe(dev, -EINVAL, "max %d supplies supported!\n", + MAX_SUPPLIES); + + for (i = 0; i < num_supplies; i++) + hub->supplies[i].supply = supply_names[i]; + + err = devm_regulator_bulk_get(dev, num_supplies, hub->supplies); + if (err) + dev_err(dev, "Failed to get regulator supplies: %pe\n", + ERR_PTR(err)); + + return err; +} + static int onboard_hub_power_on(struct onboard_hub *hub) { int err; @@ -253,7 +265,6 @@ static int onboard_hub_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct onboard_hub *hub; - unsigned int i; int err; hub = devm_kzalloc(dev, sizeof(*hub), GFP_KERNEL); @@ -264,18 +275,11 @@ static int onboard_hub_probe(struct platform_device *pdev) if (!hub->pdata) return -EINVAL; - if (hub->pdata->num_supplies > MAX_SUPPLIES) - return dev_err_probe(dev, -EINVAL, "max %zu supplies supported!\n", - MAX_SUPPLIES); - - for (i = 0; i < hub->pdata->num_supplies; i++) - hub->supplies[i].supply = supply_names[i]; + hub->dev = dev; - err = devm_regulator_bulk_get(dev, hub->pdata->num_supplies, hub->supplies); - if (err) { - dev_err(dev, "Failed to get regulator supplies: %pe\n", ERR_PTR(err)); + err = onboard_hub_get_regulators(hub); + if (err) return err; - } hub->clk = devm_clk_get_optional(dev, NULL); if (IS_ERR(hub->clk)) @@ -286,7 +290,6 @@ static int onboard_hub_probe(struct platform_device *pdev) if (IS_ERR(hub->reset_gpio)) return dev_err_probe(dev, PTR_ERR(hub->reset_gpio), "failed to get reset GPIO\n"); - hub->dev = dev; mutex_init(&hub->lock); INIT_LIST_HEAD(&hub->udev_list); diff --git a/drivers/usb/misc/onboard_usb_hub.h b/drivers/usb/misc/onboard_usb_hub.h index f360d5cf8d8a..0ee515e7feae 100644 --- a/drivers/usb/misc/onboard_usb_hub.h +++ b/drivers/usb/misc/onboard_usb_hub.h @@ -6,54 +6,66 @@ #ifndef _USB_MISC_ONBOARD_USB_HUB_H #define _USB_MISC_ONBOARD_USB_HUB_H +#define MAX_SUPPLIES 2 + struct onboard_hub_pdata { unsigned long reset_us; /* reset pulse width in us */ unsigned int num_supplies; /* number of supplies */ + const char * const supply_names[MAX_SUPPLIES]; }; static const struct onboard_hub_pdata microchip_usb424_data = { .reset_us = 1, .num_supplies = 1, + .supply_names = { "vdd" }, }; static const struct onboard_hub_pdata microchip_usb5744_data = { .reset_us = 0, .num_supplies = 2, + .supply_names = { "vdd", "vdd2" }, }; static const struct onboard_hub_pdata realtek_rts5411_data = { .reset_us = 0, .num_supplies = 1, + .supply_names = { "vdd" }, }; static const struct onboard_hub_pdata ti_tusb8041_data = { .reset_us = 3000, .num_supplies = 1, + .supply_names = { "vdd" }, }; static const struct onboard_hub_pdata cypress_hx3_data = { .reset_us = 10000, .num_supplies = 2, + .supply_names = { "vdd", "vdd2" }, }; static const struct onboard_hub_pdata cypress_hx2vl_data = { .reset_us = 1, .num_supplies = 1, + .supply_names = { "vdd" }, }; static const struct onboard_hub_pdata genesys_gl850g_data = { .reset_us = 3, .num_supplies = 1, + .supply_names = { "vdd" }, }; static const struct onboard_hub_pdata genesys_gl852g_data = { .reset_us = 50, .num_supplies = 1, + .supply_names = { "vdd" }, }; static const struct onboard_hub_pdata vialab_vl817_data = { .reset_us = 10, .num_supplies = 1, + .supply_names = { "vdd" }, }; static const struct of_device_id onboard_hub_match[] = { -- 2.40.1