netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: phy: dp83867: Add led_brightness_set support
@ 2023-04-24 13:46 Alexander Stein
  2023-04-24 13:51 ` Andrew Lunn
  2023-04-25  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Stein @ 2023-04-24 13:46 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Alexander Stein, netdev

Up to 4 LEDs can be attached to the PHY, add support for setting
brightness manually.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Blinking cannot be enforced, so led_blink_set cannot be implemented.

 drivers/net/phy/dp83867.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 5821f04c69dc..cf8ceebcc5cf 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -26,6 +26,8 @@
 #define MII_DP83867_MICR	0x12
 #define MII_DP83867_ISR		0x13
 #define DP83867_CFG2		0x14
+#define DP83867_LEDCR1		0x18
+#define DP83867_LEDCR2		0x19
 #define DP83867_CFG3		0x1e
 #define DP83867_CTRL		0x1f
 
@@ -150,6 +152,12 @@
 /* FLD_THR_CFG */
 #define DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK	0x7
 
+#define DP83867_LED_COUNT	4
+
+/* LED_DRV bits */
+#define DP83867_LED_DRV_EN(x)	BIT((x) * 4)
+#define DP83867_LED_DRV_VAL(x)	BIT((x) * 4 + 1)
+
 enum {
 	DP83867_PORT_MIRROING_KEEP,
 	DP83867_PORT_MIRROING_EN,
@@ -970,6 +978,27 @@ static int dp83867_loopback(struct phy_device *phydev, bool enable)
 			  enable ? BMCR_LOOPBACK : 0);
 }
 
+static int
+dp83867_led_brightness_set(struct phy_device *phydev,
+			   u8 index, enum led_brightness brightness)
+{
+	u32 val;
+
+	if (index >= DP83867_LED_COUNT)
+		return -EINVAL;
+
+	/* DRV_EN==1: output is DRV_VAL */
+	val = DP83867_LED_DRV_EN(index);
+
+	if (brightness)
+		val |= DP83867_LED_DRV_VAL(index);
+
+	return phy_modify(phydev, DP83867_LEDCR2,
+			  DP83867_LED_DRV_VAL(index) |
+			  DP83867_LED_DRV_EN(index),
+			  val);
+}
+
 static struct phy_driver dp83867_driver[] = {
 	{
 		.phy_id		= DP83867_PHY_ID,
@@ -997,6 +1026,8 @@ static struct phy_driver dp83867_driver[] = {
 
 		.link_change_notify = dp83867_link_change_notify,
 		.set_loopback	= dp83867_loopback,
+
+		.led_brightness_set = dp83867_led_brightness_set,
 	},
 };
 module_phy_driver(dp83867_driver);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] net: phy: dp83867: Add led_brightness_set support
  2023-04-24 13:46 [PATCH 1/1] net: phy: dp83867: Add led_brightness_set support Alexander Stein
@ 2023-04-24 13:51 ` Andrew Lunn
  2023-04-24 14:06   ` Alexander Stein
  2023-04-25  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2023-04-24 13:51 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Heiner Kallweit, Russell King, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev

On Mon, Apr 24, 2023 at 03:46:25PM +0200, Alexander Stein wrote:
> Up to 4 LEDs can be attached to the PHY, add support for setting
> brightness manually.

Hi Alexander

Please see https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

You should put in the subject line which network tree this is for.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] net: phy: dp83867: Add led_brightness_set support
  2023-04-24 13:51 ` Andrew Lunn
@ 2023-04-24 14:06   ` Alexander Stein
  2023-04-24 14:52     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Stein @ 2023-04-24 14:06 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Heiner Kallweit, Russell King, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev

Hi Andrew,

Am Montag, 24. April 2023, 15:51:32 CEST schrieb Andrew Lunn:
> On Mon, Apr 24, 2023 at 03:46:25PM +0200, Alexander Stein wrote:
> > Up to 4 LEDs can be attached to the PHY, add support for setting
> > brightness manually.
> 
> Hi Alexander
> 
> Please see
> https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
> 
> You should put in the subject line which network tree this is for.

Ah, sorry wasn't aware of that.

> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Thanks, you want me to resend a v2 with the subject fixed and your tag added?

Best regards,
Alexander
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] net: phy: dp83867: Add led_brightness_set support
  2023-04-24 14:06   ` Alexander Stein
@ 2023-04-24 14:52     ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2023-04-24 14:52 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Heiner Kallweit, Russell King, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev

> > Please see
> > https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
> > 
> > You should put in the subject line which network tree this is for.
> 
> Ah, sorry wasn't aware of that.
> 
> > Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> 
> Thanks, you want me to resend a v2 with the subject fixed and your tag added?

No need, just try to remember for future submissions.

   Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] net: phy: dp83867: Add led_brightness_set support
  2023-04-24 13:46 [PATCH 1/1] net: phy: dp83867: Add led_brightness_set support Alexander Stein
  2023-04-24 13:51 ` Andrew Lunn
@ 2023-04-25  1:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-04-25  1:30 UTC (permalink / raw)
  To: Alexander Stein
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 24 Apr 2023 15:46:25 +0200 you wrote:
> Up to 4 LEDs can be attached to the PHY, add support for setting
> brightness manually.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> Blinking cannot be enforced, so led_blink_set cannot be implemented.
> 
> [...]

Here is the summary with links:
  - [1/1] net: phy: dp83867: Add led_brightness_set support
    https://git.kernel.org/netdev/net-next/c/938f65adc420

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-25  1:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-24 13:46 [PATCH 1/1] net: phy: dp83867: Add led_brightness_set support Alexander Stein
2023-04-24 13:51 ` Andrew Lunn
2023-04-24 14:06   ` Alexander Stein
2023-04-24 14:52     ` Andrew Lunn
2023-04-25  1:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).