mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 13:48:06 +00:00
51bbc8114b
1. Update target/linux/generic/config-6.6 for new ksym 2. Refresh patches Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.57 Added: generic/backport-6.6/777-netfilter-xtables-fix-typo-causing-some-targets-to-not-load-on-IPv6.patch[1] Manually rebased: generic/hack-6.6/645-netfilter-connmark-introduce-set-dscpmark.patch Removed upstreamed: gemini/patches-6.6/0001-net-ethernet-cortina-Drop-TSO-support.patch[2] gemini/patches-6.6/0004-net-ethernet-cortina-Restore-TSO-support.patch[3] All other patches automatically rebased. 1. https://lore.kernel.org/all/20241019-xtables-typos-v2-1-6b8b1735dc8e@0upti.me/ 2 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.57&id=452c0740d72c6a77a41f6ddc318a48f18c3d2346 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.57&id=611f74b0e7fb93ee2366d9d7edca546806b220e9 Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/16726 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
99 lines
3.2 KiB
Diff
99 lines
3.2 KiB
Diff
From 7ae215ee7bb855f13c80565470fc7f67db4ba82f Mon Sep 17 00:00:00 2001
|
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
Date: Thu, 25 Jan 2024 21:36:59 +0100
|
|
Subject: [PATCH 3/5] net: phy: add support for PHY LEDs polarity modes
|
|
|
|
Add support for PHY LEDs polarity modes. Some PHY require LED to be set
|
|
to active low to be turned ON. Adds support for this by declaring
|
|
active-low property in DT.
|
|
|
|
PHY driver needs to declare .led_polarity_set() to configure LED
|
|
polarity modes. Function will pass the index with the LED index and a
|
|
bitmap with all the required modes to set.
|
|
|
|
Current supported modes are:
|
|
- active-low with the flag PHY_LED_ACTIVE_LOW. LED is set to active-low
|
|
to turn it ON.
|
|
- inactive-high-impedance with the flag PHY_LED_INACTIVE_HIGH_IMPEDANCE.
|
|
LED is set to high impedance to turn it OFF.
|
|
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
|
Link: https://lore.kernel.org/r/20240125203702.4552-4-ansuelsmth@gmail.com
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
drivers/net/phy/phy_device.c | 16 ++++++++++++++++
|
|
include/linux/phy.h | 22 ++++++++++++++++++++++
|
|
2 files changed, 38 insertions(+)
|
|
|
|
--- a/drivers/net/phy/phy_device.c
|
|
+++ b/drivers/net/phy/phy_device.c
|
|
@@ -3202,6 +3202,7 @@ static int of_phy_led(struct phy_device
|
|
struct device *dev = &phydev->mdio.dev;
|
|
struct led_init_data init_data = {};
|
|
struct led_classdev *cdev;
|
|
+ unsigned long modes = 0;
|
|
struct phy_led *phyled;
|
|
u32 index;
|
|
int err;
|
|
@@ -3219,6 +3220,21 @@ static int of_phy_led(struct phy_device
|
|
if (index > U8_MAX)
|
|
return -EINVAL;
|
|
|
|
+ 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 (modes) {
|
|
+ /* Return error if asked to set polarity modes but not supported */
|
|
+ if (!phydev->drv->led_polarity_set)
|
|
+ return -EINVAL;
|
|
+
|
|
+ err = phydev->drv->led_polarity_set(phydev, index, modes);
|
|
+ if (err)
|
|
+ return err;
|
|
+ }
|
|
+
|
|
phyled->index = index;
|
|
if (phydev->drv->led_brightness_set)
|
|
cdev->brightness_set_blocking = phy_led_set_brightness;
|
|
--- a/include/linux/phy.h
|
|
+++ b/include/linux/phy.h
|
|
@@ -870,6 +870,15 @@ struct phy_led {
|
|
|
|
#define to_phy_led(d) container_of(d, struct phy_led, led_cdev)
|
|
|
|
+/* Modes for PHY LED configuration */
|
|
+enum phy_led_modes {
|
|
+ PHY_LED_ACTIVE_LOW = 0,
|
|
+ PHY_LED_INACTIVE_HIGH_IMPEDANCE = 1,
|
|
+
|
|
+ /* keep it last */
|
|
+ __PHY_LED_MODES_NUM,
|
|
+};
|
|
+
|
|
/**
|
|
* struct phy_driver - Driver structure for a particular PHY type
|
|
*
|
|
@@ -1146,6 +1155,19 @@ struct phy_driver {
|
|
int (*led_hw_control_get)(struct phy_device *dev, u8 index,
|
|
unsigned long *rules);
|
|
|
|
+ /**
|
|
+ * @led_polarity_set: Set the LED polarity modes
|
|
+ * @dev: PHY device which has the LED
|
|
+ * @index: Which LED of the PHY device
|
|
+ * @modes: bitmap of LED polarity modes
|
|
+ *
|
|
+ * Configure LED with all the required polarity modes in @modes
|
|
+ * to make it correctly turn ON or OFF.
|
|
+ *
|
|
+ * Returns 0, or an error code.
|
|
+ */
|
|
+ int (*led_polarity_set)(struct phy_device *dev, int index,
|
|
+ unsigned long modes);
|
|
};
|
|
#define to_phy_driver(d) container_of(to_mdio_common_driver(d), \
|
|
struct phy_driver, mdiodrv)
|