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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 218C0EB64D9 for ; Thu, 29 Jun 2023 09:25:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AC0A986332; Thu, 29 Jun 2023 11:25:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=softathome.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=softathome1.onmicrosoft.com header.i=@softathome1.onmicrosoft.com header.b="GVglEiHx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0F0C4863F0; Thu, 29 Jun 2023 11:25:35 +0200 (CEST) Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-mr2fra01on2062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e19::62b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1A4968468A for ; Thu, 29 Jun 2023 11:25:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=softathome.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=philippe.reynes@softathome.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hNlF5WddCQaaK2AL2IdBqJ//6p6ErM+r4FhQHgpHVk7RviedFjRpsATcG2O0agFnXeeWr1USW7x2bbsCxgI2qXleygmVJ5axeN2WT7S4FgYXz1BN2oy3gT6uK/MylmN8+vrubQg1qtb1/0sACxjFY9ljTgGrxtpfWgeUQfTBNqBmC0Y4ASFk7Rj3mOKVOIldZtHHS2im19hnolL0m0GgnEbZC51wgYhT8yqQyKm33FDo/Z/Jx50pcCf+9VAe80LP0dcIDPIaInTaf/qpxqPHLyBJwiUfHEL+mL5Om0fkUAlHWJSPvIp8aa360J3s9CzlkVMvceYUBTs4C+9dX+4yIA== 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=y8av+miOvo53aIEQyHUi54Dht+tOFq33HT8f84pdA04=; b=PwjdSCmE65vy622t7SaoXFaWk4e/SDnvOQhoSLn1H+JGAZIr7HPHuRG1vpsCht0kir5WHXuCUOLFgVLDz7ZlZ2VYUiKYFFyZX/sfdmsX2XlJ/1X9WzcA/9bAITAI1ORRg+QWH8FrDwQGAXSQ39Csm9FUZAZqsB1S8xOMa4pXeelBwg1m8Lc1vG7faBa4D7fwzlia9tz5wsJJNCE5fpKej+QKPE1kJTcnYGHA5/UJPVppqdo253BovB7Zbfj+SigBzDJNrKnbHEIB4Z2AQ9ACvwrplKFdMYgTAxhpvlTwxLM23lzbg4ounBCAf7o6ILOEU7oBsmBFG3B9RM/p7oGYuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.6.166.170) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=softathome.com; dmarc=bestguesspass action=none header.from=softathome.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=softathome1.onmicrosoft.com; s=selector1-softathome1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y8av+miOvo53aIEQyHUi54Dht+tOFq33HT8f84pdA04=; b=GVglEiHxA5Npp2mOR8TY6xpTPTWIgTDgTqUBcixmUN7G3iFLxrWHSCn1s3B0LbqtzB3FSpC3Dugh3n8u7t28Zf6yT39jWIzYrKl/Mx5Kkz1mAR7ohJE34UvZrQyEuEyuTHfFPvANqaM38Q1IoF2cUjg8wvjZRBKCRcnKLdkcRtlA5Q/2FQ1EQVgHa4PQaEnCSFWcXrTZGhLeQvCD9TVAfjUTjSea42E3yaaLYHMX1KsM/m12Fpg4CS1nR4HF4ngOAGv0rCCPnjO/J5KMRM1KaTD17fch/J9jOxxfUtl60cyX7F+RNaPazPKRBhggy9OIJnaO1ZAABvZJA2+2H/Pc2A== Received: from MR2P264CA0036.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500::24) by PR0P264MB1881.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:166::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Thu, 29 Jun 2023 09:25:27 +0000 Received: from MR2FRA01FT014.eop-fra01.prod.protection.outlook.com (2603:10a6:500:0:cafe::54) by MR2P264CA0036.outlook.office365.com (2603:10a6:500::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Thu, 29 Jun 2023 09:25:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.6.166.170) smtp.mailfrom=softathome.com; dkim=none (message not signed) header.d=none;dmarc=bestguesspass action=none header.from=softathome.com; Received-SPF: Pass (protection.outlook.com: domain of softathome.com designates 149.6.166.170 as permitted sender) receiver=protection.outlook.com; client-ip=149.6.166.170; helo=proxy.softathome.com; pr=C Received: from proxy.softathome.com (149.6.166.170) by MR2FRA01FT014.mail.protection.outlook.com (10.152.50.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Thu, 29 Jun 2023 09:25:26 +0000 Received: from sah1lpt571.softathome.com (unknown [192.168.66.150]) by proxy.softathome.com (Postfix) with ESMTPSA id 727F6200D2; Thu, 29 Jun 2023 11:25:26 +0200 (CEST) From: Philippe Reynes To: u-boot@lists.denx.de Cc: Philippe Reynes Subject: [PATCH] drivers: led: bcm6753: do not use null label to find the top Date: Thu, 29 Jun 2023 11:25:23 +0200 Message-Id: <20230629092523.448644-1-philippe.reynes@softathome.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MR2FRA01FT014:EE_|PR0P264MB1881:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 43e7f0dc-2442-43a8-ac3c-08db7882c616 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aHkSSIEmoBuPo4GPV/DDo1DK4Xdp7bLTdWBeB9qnSZp6gy4O+tqYqV2G9tdYspPT+yGgqQuXw9LbEguq6Yc5Rd2aTydVSLyi/o47YpZtqQFdC7IfVw/doQwct/uFX3gVU+/Aw9tIL3/qjOB2nnz4CpWcqgyoYgbvVPUl+taWsrWPVcVFerBogrZAahV6nqqfXngupcrluuQ4E4Pf/2Gzu21i9zsXjDQ/KO0o8F0Lj9b/ZLyk++9jI77MxUQiUcrHeeKUonYtQYyaL8r2KSgdJWYWhawzVaNlUnqGURlbua5tmqipNKA3DlLiueVAGeJ8A88Gjocmzvk6kHXkxhlZfNdVwgDLx2k2IfCZQLduASY574OEW7gK9iNgFaXcBhLdcyIb4MbPWjsJvJwmjcrTxxOg0UAj88aJKELwh+uAuYRkUJ+kkVrGCvJuOTAt4m3LJ1VytBxjxCh4NauudhgyFaQtL8Pm/Ne2MUqAtutJqrG4xt9nVOWKA/HRuRXuH7I5I0xLKUYkt+kcDdGgmA65nrKU1KYw39mFW8f6pG26iUp/chad6K/Sn0S4FHJq2BQa3Qy6/wL+6rCXhFraJrcwrsfieH20v0Rnl1ZKF4S+53EcRAcUkXJ16aD4YSFyrN9KSwrlN0z95d0y/FwOXYhpef0roeBdsR6v6CASxySbPH5oWA4rOAx+9uY0WV6aXoFG6IOOIn2pc7tANj6C6Q1XxlNj4PzIgD5Wpc09/5bPf9pcbySdDpcQGQhjFuolkcPjep8r417uvgq8Wn++30ZGbw== X-Forefront-Antispam-Report: CIP:149.6.166.170; CTRY:FR; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:proxy.softathome.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39850400004)(376002)(396003)(136003)(346002)(451199021)(46966006)(36840700001)(6966003)(6666004)(478600001)(7696005)(83380400001)(47076005)(40480700001)(336012)(2616005)(36860700001)(82740400003)(82960400001)(86362001)(426003)(82310400005)(70586007)(1076003)(107886003)(186003)(26005)(6266002)(2906002)(81166007)(4326008)(36756003)(6916009)(8936002)(70206006)(5660300002)(316002)(44832011)(41300700001)(356005)(8676002)(37363002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: softathome.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2023 09:25:26.6888 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43e7f0dc-2442-43a8-ac3c-08db7882c616 X-MS-Exchange-CrossTenant-Id: aa10e044-e405-4c10-8353-36b4d0cce511 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=aa10e044-e405-4c10-8353-36b4d0cce511; Ip=[149.6.166.170]; Helo=[proxy.softathome.com] X-MS-Exchange-CrossTenant-AuthSource: MR2FRA01FT014.eop-fra01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB1881 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This driver considers that a node with an empty label is the top. But the led class has changed, if a label is not provided for a led, the label is filed with the node name. So we update this driver to use a wrapper to manage the top led node. Signed-off-by: Philippe Reynes --- drivers/led/led_bcm6753.c | 114 ++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 54 deletions(-) diff --git a/drivers/led/led_bcm6753.c b/drivers/led/led_bcm6753.c index 88b650cbfc..2466d93011 100644 --- a/drivers/led/led_bcm6753.c +++ b/drivers/led/led_bcm6753.c @@ -174,57 +174,65 @@ static const struct led_ops bcm6753_led_ops = { static int bcm6753_led_probe(struct udevice *dev) { - struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); - - /* Top-level LED node */ - if (!uc_plat->label) { - void __iomem *regs; - u32 set_bits = 0; - - regs = dev_remap_addr(dev); - if (!regs) - return -EINVAL; - - if (dev_read_bool(dev, "brcm,serial-led-msb-first")) - set_bits |= CLED_CTRL_SERIAL_LED_MSB_FIRST; - if (dev_read_bool(dev, "brcm,serial-led-en-pol")) - set_bits |= CLED_CTRL_SERIAL_LED_EN_POL; - if (dev_read_bool(dev, "brcm,serial-led-clk-pol")) - set_bits |= CLED_CTRL_SERIAL_LED_CLK_POL; - if (dev_read_bool(dev, "brcm,serial-led-data-ppol")) - set_bits |= CLED_CTRL_SERIAL_LED_DATA_PPOL; - - clrsetbits_32(regs + CLED_CTRL_REG, CLED_CTRL_MASK, set_bits); - } else { - struct bcm6753_led_priv *priv = dev_get_priv(dev); - void __iomem *regs; - unsigned int pin; - - regs = dev_remap_addr(dev_get_parent(dev)); - if (!regs) - return -EINVAL; - - pin = dev_read_u32_default(dev, "reg", LEDS_MAX); - if (pin >= LEDS_MAX) - return -EINVAL; - - priv->regs = regs; - priv->pin = pin; - - /* this led is managed by software */ - clrbits_32(regs + CLED_HW_LED_EN_REG, 1 << pin); - - /* configure the polarity */ - if (dev_read_bool(dev, "active-low")) - clrbits_32(regs + CLED_PLED_OP_PPOL_REG, 1 << pin); - else - setbits_32(regs + CLED_PLED_OP_PPOL_REG, 1 << pin); - } + struct bcm6753_led_priv *priv = dev_get_priv(dev); + void __iomem *regs; + unsigned int pin; + + regs = dev_remap_addr(dev_get_parent(dev)); + if (!regs) + return -EINVAL; + + pin = dev_read_u32_default(dev, "reg", LEDS_MAX); + if (pin >= LEDS_MAX) + return -EINVAL; + + priv->regs = regs; + priv->pin = pin; + + /* this led is managed by software */ + clrbits_32(regs + CLED_HW_LED_EN_REG, 1 << pin); + + /* configure the polarity */ + if (dev_read_bool(dev, "active-low")) + clrbits_32(regs + CLED_PLED_OP_PPOL_REG, 1 << pin); + else + setbits_32(regs + CLED_PLED_OP_PPOL_REG, 1 << pin); return 0; } -static int bcm6753_led_bind(struct udevice *parent) +U_BOOT_DRIVER(bcm6753_led) = { + .name = "bcm6753-led", + .id = UCLASS_LED, + .probe = bcm6753_led_probe, + .priv_auto = sizeof(struct bcm6753_led_priv), + .ops = &bcm6753_led_ops, +}; + +static int bcm6753_led_wrap_probe(struct udevice *dev) +{ + void __iomem *regs; + u32 set_bits = 0; + + regs = dev_remap_addr(dev); + if (!regs) + return -EINVAL; + + if (dev_read_bool(dev, "brcm,serial-led-msb-first")) + set_bits |= CLED_CTRL_SERIAL_LED_MSB_FIRST; + if (dev_read_bool(dev, "brcm,serial-led-en-pol")) + set_bits |= CLED_CTRL_SERIAL_LED_EN_POL; + if (dev_read_bool(dev, "brcm,serial-led-clk-pol")) + set_bits |= CLED_CTRL_SERIAL_LED_CLK_POL; + if (dev_read_bool(dev, "brcm,serial-led-data-ppol")) + set_bits |= CLED_CTRL_SERIAL_LED_DATA_PPOL; + + clrsetbits_32(regs + CLED_CTRL_REG, CLED_CTRL_MASK, set_bits); + + return 0; +} + +static int bcm6753_led_wrap_bind(struct udevice *parent) { ofnode node; @@ -247,12 +255,10 @@ static const struct udevice_id bcm6753_led_ids[] = { { /* sentinel */ } }; -U_BOOT_DRIVER(bcm6753_led) = { - .name = "bcm6753-led", - .id = UCLASS_LED, +U_BOOT_DRIVER(bcm6753_led_wrap) = { + .name = "bcm6753_led_wrap", + .id = UCLASS_NOP, .of_match = bcm6753_led_ids, - .bind = bcm6753_led_bind, - .probe = bcm6753_led_probe, - .priv_auto = sizeof(struct bcm6753_led_priv), - .ops = &bcm6753_led_ops, + .probe = bcm6753_led_wrap_probe, + .bind = bcm6753_led_wrap_bind, }; -- 2.25.1