From mboxrd@z Thu Jan 1 00:00:00 1970 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 45245EB64DC for ; Tue, 18 Jul 2023 13:43:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F43F866C9; Tue, 18 Jul 2023 15:43:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="KTnNEppR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3402866DC; Tue, 18 Jul 2023 15:43:52 +0200 (CEST) Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BC020866B2 for ; Tue, 18 Jul 2023 15:43:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-cacc3f97ee9so5969885276.3 for ; Tue, 18 Jul 2023 06:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1689687828; x=1692279828; 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=MFL+HiEM9j4v6Th8LK6MWgPO34BoGOvhHDYD+WKSRYA=; b=KTnNEppRBNlyM1VFUKuri8sVgeYjebqvLOSTaEzu7Xdewsi+EH1FFvSEd1/qdHR6i3 3bkRUzhb/n/nXgCCh5cuxBVvRowyqNY+uQs46hhFdM1eFact3041Gq0Rp/bejVRaZtvW CwUp+6/c0aq4TJDc+difLhip4Z3CSKMjwwzQk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689687828; x=1692279828; 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=MFL+HiEM9j4v6Th8LK6MWgPO34BoGOvhHDYD+WKSRYA=; b=EXnZeDBi5KgBPFvZ9D0ZCsO5ouogrxBQLO/B7tYVdzR2YtGX+mIZ5XMHQLPvuREhRV jWHSMQOsLRELURjXku56zYmlQ+MpVElGowlTnJCBhqb66PgiLbfmMiYrDGeVzsS0aKiR BChgN4e7ErYj2JxA/Ff/Q9fakd9WmND4lYm81N+r3R+XQh8VyrjegLWHWUzS10KcAGm4 KwKPlSBYYt/Kff8jT0SuEpptJOWQ0/rKHsokB+UW0nQgBAeuTPojLe7BNfQQS7v8SM/4 DzGeXn92TsKs26xlRWo2uFMzxHPkcvWmUFZ6UTRGSWNUwL3rxkkwpdxcb1I6T0eAEl35 okdw== X-Gm-Message-State: ABy/qLarH+r834qX2fK5kMbqtbEDFM0hvJdhbgzsEnFYIdMKWRQeEcy6 YvtE4Bw9OcX9YEUuyD+o4v1HFg== X-Google-Smtp-Source: APBJJlGt7OmlCa/MSjtRxVubL991H8CE0K6wfefAZsuJwf+BhHOqmDZYINQ9rvX/wMNdoOGaKttllg== X-Received: by 2002:a25:248e:0:b0:c3c:8d58:6f15 with SMTP id k136-20020a25248e000000b00c3c8d586f15mr12709918ybk.47.1689687828396; Tue, 18 Jul 2023 06:43:48 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-e1d8-58e7-e10a-a96d.res6.spectrum.com. [2603:6081:7b00:6400:e1d8:58e7:e10a:a96d]) by smtp.gmail.com with ESMTPSA id c2-20020a258802000000b00c74e24a68e8sm406705ybl.55.2023.07.18.06.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 06:43:47 -0700 (PDT) Date: Tue, 18 Jul 2023 09:43:46 -0400 From: Tom Rini To: Philippe REYNES Cc: u-boot@lists.denx.de, anand.gore@broadcom.com, william.zhang@broadcom.com, kursad.oney@broadcom.com, joel.peshkin@broadcom.com Subject: Re: [PATCH] drivers: led: bcm6858: do not use null label to find the top Message-ID: <20230718134346.GL1670569@bill-the-cat> References: <20230623163642.241034-1-philippe.reynes@softathome.com> <26b80141-3956-20eb-f93e-0b278651bc33@softathome.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="teR+xr1gK9m7yduf" Content-Disposition: inline In-Reply-To: <26b80141-3956-20eb-f93e-0b278651bc33@softathome.com> X-Clacks-Overhead: GNU Terry Pratchett 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 --teR+xr1gK9m7yduf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 18, 2023 at 11:20:52AM +0200, Philippe REYNES wrote: > Hi Tom, >=20 > For this patch, I see that it is accepted on patchwork: > https://patchwork.ozlabs.org/project/uboot/patch/20230623163642.241034-1-= philippe.reynes@softathome.com/ > But I don't see it in master/next. >=20 > Is it a "miss" or I have to update it please ? This commit: https://source.denx.de/u-boot/u-boot/-/commit/910b01c27c0499ae8f84104a0db74= 5dd3a056c04 is that patch, yes? >=20 > Regards, > Philippe >=20 >=20 >=20 > Le 23/06/2023 =C3=A0 18:36, Philippe Reynes a =C3=A9crit : > > 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. > >=20 > > Signed-off-by: Philippe Reynes > > --- > > drivers/led/led_bcm6858.c | 122 ++++++++++++++++++++------------------ > > 1 file changed, 64 insertions(+), 58 deletions(-) > >=20 > > diff --git a/drivers/led/led_bcm6858.c b/drivers/led/led_bcm6858.c > > index 6b3698674b..397dc0d869 100644 > > --- a/drivers/led/led_bcm6858.c > > +++ b/drivers/led/led_bcm6858.c > > @@ -180,63 +180,71 @@ static const struct led_ops bcm6858_led_ops =3D { > >=20 > > static int bcm6858_led_probe(struct udevice *dev) > > { > > - struct led_uc_plat *uc_plat =3D dev_get_uclass_plat(dev); > > - > > - /* Top-level LED node */ > > - if (!uc_plat->label) { > > - void __iomem *regs; > > - u32 set_bits =3D 0; > > - > > - regs =3D dev_remap_addr(dev); > > - if (!regs) > > - return -EINVAL; > > - > > - if (dev_read_bool(dev, "brcm,serial-led-msb-first")) > > - set_bits |=3D LED_CTRL_SERIAL_LED_MSB_FIRST; > > - if (dev_read_bool(dev, "brcm,serial-led-en-pol")) > > - set_bits |=3D LED_CTRL_SERIAL_LED_EN_POL; > > - if (dev_read_bool(dev, "brcm,serial-led-clk-pol")) > > - set_bits |=3D LED_CTRL_SERIAL_LED_CLK_POL; > > - if (dev_read_bool(dev, "brcm,serial-led-data-ppol")) > > - set_bits |=3D LED_CTRL_SERIAL_LED_DATA_PPOL; > > - if (dev_read_bool(dev, "brcm,led-test-mode")) > > - set_bits |=3D LED_CTRL_LED_TEST_MODE; > > - > > - clrsetbits_32(regs + LED_CTRL_REG, ~0, set_bits); > > - } else { > > - struct bcm6858_led_priv *priv =3D dev_get_priv(dev); > > - void __iomem *regs; > > - unsigned int pin, brightness; > > - > > - regs =3D dev_remap_addr(dev_get_parent(dev)); > > - if (!regs) > > - return -EINVAL; > > - > > - pin =3D dev_read_u32_default(dev, "reg", LEDS_MAX); > > - if (pin >=3D LEDS_MAX) > > - return -EINVAL; > > - > > - priv->regs =3D regs; > > - priv->pin =3D pin; > > - > > - /* this led is managed by software */ > > - clrbits_32(regs + LED_HW_LED_EN_REG, 1 << pin); > > - > > - /* configure the polarity */ > > - if (dev_read_bool(dev, "active-low")) > > - clrbits_32(regs + LED_PLED_OP_PPOL_REG, 1 << pin); > > - else > > - setbits_32(regs + LED_PLED_OP_PPOL_REG, 1 << pin); > > + struct bcm6858_led_priv *priv =3D dev_get_priv(dev); > > + void __iomem *regs; > > + unsigned int pin, brightness; > > + > > + regs =3D dev_remap_addr(dev_get_parent(dev)); > > + if (!regs) > > + return -EINVAL; > > + > > + pin =3D dev_read_u32_default(dev, "reg", LEDS_MAX); > > + if (pin >=3D LEDS_MAX) > > + return -EINVAL; > > + > > + priv->regs =3D regs; > > + priv->pin =3D pin; > > + > > + /* this led is managed by software */ > > + clrbits_32(regs + LED_HW_LED_EN_REG, 1 << pin); > >=20 > > - brightness =3D dev_read_u32_default(dev, "default-brightn= ess", > > + /* configure the polarity */ > > + if (dev_read_bool(dev, "active-low")) > > + clrbits_32(regs + LED_PLED_OP_PPOL_REG, 1 << pin); > > + else > > + setbits_32(regs + LED_PLED_OP_PPOL_REG, 1 << pin); > > + > > + brightness =3D dev_read_u32_default(dev, "default-brightness", > > LEDS_MAX_BRIGHTNESS); > > - led_set_brightness(dev, brightness); > > - } > > + led_set_brightness(dev, brightness); > >=20 > > return 0; > > } > >=20 > > -static int bcm6858_led_bind(struct udevice *parent) > > +U_BOOT_DRIVER(bcm6858_led) =3D { > > + .name =3D "bcm6858-led", > > + .id =3D UCLASS_LED, > > + .probe =3D bcm6858_led_probe, > > + .priv_auto =3D sizeof(struct bcm6858_led_priv), > > + .ops =3D &bcm6858_led_ops, > > +}; > > + > > +static int bcm6858_led_wrap_probe(struct udevice *dev) > > +{ > > + void __iomem *regs; > > + u32 set_bits =3D 0; > > + > > + regs =3D dev_remap_addr(dev); > > + if (!regs) > > + return -EINVAL; > > + > > + if (dev_read_bool(dev, "brcm,serial-led-msb-first")) > > + set_bits |=3D LED_CTRL_SERIAL_LED_MSB_FIRST; > > + if (dev_read_bool(dev, "brcm,serial-led-en-pol")) > > + set_bits |=3D LED_CTRL_SERIAL_LED_EN_POL; > > + if (dev_read_bool(dev, "brcm,serial-led-clk-pol")) > > + set_bits |=3D LED_CTRL_SERIAL_LED_CLK_POL; > > + if (dev_read_bool(dev, "brcm,serial-led-data-ppol")) > > + set_bits |=3D LED_CTRL_SERIAL_LED_DATA_PPOL; > > + if (dev_read_bool(dev, "brcm,led-test-mode")) > > + set_bits |=3D LED_CTRL_LED_TEST_MODE; > > + > > + clrsetbits_32(regs + LED_CTRL_REG, ~0, set_bits); > > + > > + return 0; > > +} > > + > > +static int bcm6858_led_wrap_bind(struct udevice *parent) > > { > > ofnode node; > >=20 > > @@ -259,12 +267,10 @@ static const struct udevice_id bcm6858_led_ids[] = =3D { > > { /* sentinel */ } > > }; > >=20 > > -U_BOOT_DRIVER(bcm6858_led) =3D { > > - .name =3D "bcm6858-led", > > - .id =3D UCLASS_LED, > > +U_BOOT_DRIVER(bcm6858_led_wrap) =3D { > > + .name =3D "bcm6858_led_wrap", > > + .id =3D UCLASS_NOP, > > .of_match =3D bcm6858_led_ids, > > - .bind =3D bcm6858_led_bind, > > - .probe =3D bcm6858_led_probe, > > - .priv_auto =3D sizeof(struct bcm6858_led_priv), > > - .ops =3D &bcm6858_led_ops, > > + .probe =3D bcm6858_led_wrap_probe, > > + .bind =3D bcm6858_led_wrap_bind, > > }; > -- This message and any attachments herein are confidential, intended sol= ely for the addressees and are SoftAtHome=E2=80=99s ownership. Any unauthor= ized use or dissemination is prohibited. If you are not the intended addres= see of this message, please cancel it immediately and inform the sender. --=20 Tom --teR+xr1gK9m7yduf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmS2lw4ACgkQFHw5/5Y0 tyyv6gv+L0v52oowtfIwOlZ10JKQ1tFif/lfDtVy328k9doGzKj/YDsQt7e0nIVi tDvLxJsJwNLXUsTaVDIK/7JoxVKiDpDGC9tzAne2ZVcdJIwuVF+baZoJMe2PrdYK O9sWMJ9tXSznT+cd+VDyZ52wsOhreeQy4p37QDqd2yFZqC8OfsXwnhRgZGM+dkrA q7hl3Azg360eFqUi/kIR+9kP1ZRZiXJujwHv9940GZ9kWaxLSWy25Cqe/2wJme5Z DvHvLImZDg7DItRrg0MfK2yh85lI0nQ+xpmQfxht23uf6VW20M2gqkgg+pgbSTSn 00G6Xt6v+dJ0pTJtLhb302eo27T0O0BZslj0aSAsjOiR+V/pF+FXdhPqSWuKbL7q P9IL/j5YbaPZvMJ8Tv2/b35gMzWKyNGYA7SwEHcNNDIbg5MXMnX6R549SyZL4SKl 5rT5yd8F3YGIoupyO2w3eiik0UjTc40g3t9btn0xEuR1hpvbiclcx4LVFakYkX8N UlimMGQ/ =RyX9 -----END PGP SIGNATURE----- --teR+xr1gK9m7yduf--