From: Christian Marangi <ansuelsmth@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Pavel Machek" <pavel@ucw.cz>, "Lee Jones" <lee@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"William Zhang" <william.zhang@broadcom.com>,
"Anand Gore" <anand.gore@broadcom.com>,
"Kursad Oney" <kursad.oney@broadcom.com>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Jacek Anaszewski" <jacek.anaszewski@gmail.com>,
"Fernández Rojas" <noltari@gmail.com>,
"Sven Schwermer" <sven.schwermer@disruptive-technologies.com>,
linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org
Subject: Re: [net-next PATCH v8 3/5] net: phy: add support for PHY LEDs polarity modes
Date: Thu, 4 Jan 2024 22:42:23 +0100 [thread overview]
Message-ID: <6597286c.050a0220.4684a.182e@mx.google.com> (raw)
In-Reply-To: <47f18def-d34f-4224-9de2-6e0ae7122a52@lunn.ch>
On Thu, Jan 04, 2024 at 02:20:45PM +0100, Andrew Lunn wrote:
> > + if (phydev->drv->led_polarity_set) {
> > + if (of_property_read_bool(led, "active-low"))
> > + set_bit(PHY_LED_ACTIVE_LOW, &modes);
> > + if (of_property_read_bool(led, "inactive-high-impedance"))
> > + set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes);
> > +
> > + err = phydev->drv->led_polarity_set(phydev, index, modes);
> > + if (err)
> > + return err;
> > + }
>
> I think we should return an error if asked to set the mode, but its
> not implemented by the driver. Something like:
>
> if (of_property_read_bool(led, "active-low"))
> set_bit(PHY_LED_ACTIVE_LOW, &modes);
> if (of_property_read_bool(led, "inactive-high-impedance"))
> set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes);
>
>
> if (mode)
> if (phydev->drv->led_polarity_set) {
> return -EINVAL;
> } else {
> err = phydev->drv->led_polarity_set(phydev, index, modes);
> if (err)
> return err;
> }
> }
>
> > + /**
> > + * @led_polarity_set: Set the LED polarity if active low
>
> The 'if active low' is not ouw of date, since it is used for more than
> that.
>
> > + * @dev: PHY device which has the LED
> > + * @index: Which LED of the PHY device or -1
> > + * @modes: bitmap of LED polarity modes
> > + *
> > + * Configure LED with all the required polarity modes in @modes
> > + * to make it correctly turn ON or OFF.
>
> index == -1 should be explained.
>
If you are referring to the special way of setting the LED globally,
that is not a thing anymore. Rob pointed out that having the double
reference in DT is problematic and PHY driver should handle that
internally.
> > + *
> > + * Returns 0, or an error code.
> > + */
> > + int (*led_polarity_set)(struct phy_device *dev, int index,
> > + unsigned long modes);
>
>
> Andrew
>
> ---
> pw-bot: cr
--
Ansuel
WARNING: multiple messages have this Message-ID (diff)
From: Christian Marangi <ansuelsmth@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Pavel Machek" <pavel@ucw.cz>, "Lee Jones" <lee@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"William Zhang" <william.zhang@broadcom.com>,
"Anand Gore" <anand.gore@broadcom.com>,
"Kursad Oney" <kursad.oney@broadcom.com>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Jacek Anaszewski" <jacek.anaszewski@gmail.com>,
"Fernández Rojas" <noltari@gmail.com>,
"Sven Schwermer" <sven.schwermer@disruptive-technologies.com>,
linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org
Subject: Re: [net-next PATCH v8 3/5] net: phy: add support for PHY LEDs polarity modes
Date: Thu, 4 Jan 2024 22:42:23 +0100 [thread overview]
Message-ID: <6597286c.050a0220.4684a.182e@mx.google.com> (raw)
In-Reply-To: <47f18def-d34f-4224-9de2-6e0ae7122a52@lunn.ch>
On Thu, Jan 04, 2024 at 02:20:45PM +0100, Andrew Lunn wrote:
> > + if (phydev->drv->led_polarity_set) {
> > + if (of_property_read_bool(led, "active-low"))
> > + set_bit(PHY_LED_ACTIVE_LOW, &modes);
> > + if (of_property_read_bool(led, "inactive-high-impedance"))
> > + set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes);
> > +
> > + err = phydev->drv->led_polarity_set(phydev, index, modes);
> > + if (err)
> > + return err;
> > + }
>
> I think we should return an error if asked to set the mode, but its
> not implemented by the driver. Something like:
>
> if (of_property_read_bool(led, "active-low"))
> set_bit(PHY_LED_ACTIVE_LOW, &modes);
> if (of_property_read_bool(led, "inactive-high-impedance"))
> set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes);
>
>
> if (mode)
> if (phydev->drv->led_polarity_set) {
> return -EINVAL;
> } else {
> err = phydev->drv->led_polarity_set(phydev, index, modes);
> if (err)
> return err;
> }
> }
>
> > + /**
> > + * @led_polarity_set: Set the LED polarity if active low
>
> The 'if active low' is not ouw of date, since it is used for more than
> that.
>
> > + * @dev: PHY device which has the LED
> > + * @index: Which LED of the PHY device or -1
> > + * @modes: bitmap of LED polarity modes
> > + *
> > + * Configure LED with all the required polarity modes in @modes
> > + * to make it correctly turn ON or OFF.
>
> index == -1 should be explained.
>
If you are referring to the special way of setting the LED globally,
that is not a thing anymore. Rob pointed out that having the double
reference in DT is problematic and PHY driver should handle that
internally.
> > + *
> > + * Returns 0, or an error code.
> > + */
> > + int (*led_polarity_set)(struct phy_device *dev, int index,
> > + unsigned long modes);
>
>
> Andrew
>
> ---
> pw-bot: cr
--
Ansuel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-01-04 21:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 11:01 [net-next PATCH v8 0/5] net: phy: generic polarity + LED support for qca808x Christian Marangi
2024-01-04 11:01 ` Christian Marangi
2024-01-04 11:01 ` [net-next PATCH v8 1/5] dt-bindings: net: phy: Make LED active-low property common Christian Marangi
2024-01-04 11:01 ` Christian Marangi
2024-01-04 11:01 ` [net-next PATCH v8 2/5] dt-bindings: net: phy: Document LED inactive high impedance mode Christian Marangi
2024-01-04 11:01 ` Christian Marangi
2024-01-04 11:01 ` [net-next PATCH v8 3/5] net: phy: add support for PHY LEDs polarity modes Christian Marangi
2024-01-04 11:01 ` Christian Marangi
2024-01-04 13:20 ` Andrew Lunn
2024-01-04 13:20 ` Andrew Lunn
2024-01-04 21:42 ` Christian Marangi [this message]
2024-01-04 21:42 ` Christian Marangi
2024-01-05 2:25 ` Andrew Lunn
2024-01-05 2:25 ` Andrew Lunn
2024-01-04 11:01 ` [net-next PATCH v8 4/5] dt-bindings: net: Document QCA808x PHYs Christian Marangi
2024-01-04 11:01 ` Christian Marangi
2024-01-04 11:01 ` [net-next PATCH v8 5/5] net: phy: at803x: add LED support for qca808x Christian Marangi
2024-01-04 11:01 ` Christian Marangi
2024-01-04 11:48 ` Maxime Chevallier
2024-01-04 11:48 ` Maxime Chevallier
2024-01-04 13:11 ` Christian Marangi
2024-01-04 13:11 ` Christian Marangi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6597286c.050a0220.4684a.182e@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=anand.gore@broadcom.com \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=jacek.anaszewski@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=kursad.oney@broadcom.com \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=noltari@gmail.com \
--cc=pabeni@redhat.com \
--cc=pavel@ucw.cz \
--cc=rafal@milecki.pl \
--cc=robh+dt@kernel.org \
--cc=sven.schwermer@disruptive-technologies.com \
--cc=william.zhang@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.