summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-01-26 21:03:43 -0800
committerJakub Kicinski <kuba@kernel.org>2024-01-26 21:03:43 -0800
commitc09f32a859458002b40ba44fc736329a4c0fe4e5 (patch)
tree9b7bc7adc9a3950640e99831b640dceb9c46ecd3 /include
parent5642c82b9463c3263c086efb002516244bd4c668 (diff)
parent7196062b64ee470b91015f3d2e82d225948258ea (diff)
downloadlinux-c09f32a859458002b40ba44fc736329a4c0fe4e5.tar.gz
linux-c09f32a859458002b40ba44fc736329a4c0fe4e5.tar.bz2
linux-c09f32a859458002b40ba44fc736329a4c0fe4e5.zip
Merge branch 'net-phy-generic-polarity-led-support-for-qca808x'
Christian Marangi says: ==================== net: phy: generic polarity + LED support for qca808x This small series add LEDs support for qca808x. QCA808x apply on PHY reset a strange polarity settings and require some tweak to apply a more common configuration found on devices. On adding support for it, it was pointed out that a similar feature is also being implemented for a marvell PHY where LED polarity is set per LED (and not global) and also have a special mode where the LED is tristated. The first 3 patch are to generalize this as we expect more PHY in the future to have a similar configuration. The implementation is extensible to support additional special mode in the future with minimal changes and don't create regression on already implemented PHY drivers. ==================== Link: https://lore.kernel.org/r/20240125203702.4552-1-ansuelsmth@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/phy.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 684efaeca07c..c9994a59ca2e 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -852,6 +852,15 @@ struct phy_plca_status {
bool pst;
};
+/* 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_led: An LED driven by the PHY
*
@@ -1145,6 +1154,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)