Thread (11 messages) 11 messages, 3 authors, 2024-01-05

Re: [net-next PATCH v8 5/5] net: phy: at803x: add LED support for qca808x

From: Christian Marangi <ansuelsmth@gmail.com>
Date: 2024-01-04 13:11:15
Also in: linux-devicetree, linux-leds, lkml, netdev

On Thu, Jan 04, 2024 at 12:48:05PM +0100, Maxime Chevallier wrote:
Hello Christian,

On Thu,  4 Jan 2024 12:01:12 +0100
Christian Marangi [off-list ref] wrote:
quoted
Add LED support for QCA8081 PHY.

Documentation for this LEDs PHY is very scarce even with NDA access
to Documentation for OEMs. Only the blink pattern are documented and are
very confusing most of the time. No documentation is present about
forcing the LED on/off or to always blink.

Those settings were reversed by poking the regs and trying to find the
correct bits to trigger these modes. Some bits mode are not clear and
maybe the documentation option are not 100% correct. For the sake of LED
support the reversed option are enough to add support for current LED
APIs.
I have one small comment below :
quoted
+static int qca808x_led_blink_set(struct phy_device *phydev, u8 index,
+				 unsigned long *delay_on,
+				 unsigned long *delay_off)
+{
+	int ret;
+	u16 reg;
+
+	if (index > 2)
+		return -EINVAL;
+
+	reg = QCA808X_MMD7_LED_FORCE_CTRL(index);
+
+	/* Set blink to 50% off, 50% on at 4Hz by default */
+	ret = phy_modify_mmd(phydev, MDIO_MMD_AN, QCA808X_MMD7_LED_GLOBAL,
+			     QCA808X_LED_BLINK_FREQ_MASK | QCA808X_LED_BLINK_DUTY_MASK,
+			     QCA808X_LED_BLINK_FREQ_256HZ | QCA808X_LED_BLINK_DUTY_50_50);
The comment (4Hz) and the blink frequency (256Hz) don't match, is that
right ? because I see there exists a QCA808X_LED_BLINK_FREQ_4HZ
definition, shouldn't it be used ?
Thanks for checking this, oversight by me! Will fix. (the blink
frequency was discovered only lately)

-- 
	Ansuel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help