net: phy: aquantia: add hwmon support
Subsystems (3)
Heiner Kallweit
maintainerv3 cover net: phy: aquantia: add hwmon support
This series adds HWMON support for the temperature sensor and the related alarms on the 107/108/109 chips.
v2:
- remove struct aqr_priv
- rename header file to aquantia.h
v3:
- add conditional compiling of aquantia_hwmon.c
- improve converting sensor register values to/from long
- add helper aqr_hwmon_test_bit
Heiner Kallweit (2):
net: phy: aquantia: rename aquantia.c to aquantia_main.c
net: phy: aquantia: add hwmon support
drivers/net/phy/Makefile | 4 +
drivers/net/phy/aquantia.h | 16 ++
drivers/net/phy/aquantia_hwmon.c | 250 ++++++++++++++++++
.../net/phy/{aquantia.c => aquantia_main.c} | 4 +
4 files changed, 274 insertions(+)
create mode 100644 drivers/net/phy/aquantia.h
create mode 100644 drivers/net/phy/aquantia_hwmon.c
rename drivers/net/phy/{aquantia.c => aquantia_main.c} (99%)Signature · 1 line
2.20.1
Heiner Kallweit
maintainerPATCH v3 1/2 net: phy: aquantia: rename aquantia.c to aquantia_main.c
Rename aquantia.c to aquantia_main.c to be prepared for adding new functionality to separate source code files.
---
drivers/net/phy/Makefile | 1 +
drivers/net/phy/{aquantia.c => aquantia_main.c} | 0
2 files changed, 1 insertion(+)
rename drivers/net/phy/{aquantia.c => aquantia_main.c} (100%)drivers/net/phy/Makefile +1 -0
@@ -45,6 +45,7 @@ sfp-obj-$(CONFIG_SFP) += sfp-bus.o obj-y += $(sfp-obj-y) $(sfp-obj-m) obj-$(CONFIG_AMD_PHY) += amd.o +aquantia-objs += aquantia_main.o obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o obj-$(CONFIG_ASIX_PHY) += asix.o obj-$(CONFIG_AT803X_PHY) += at803x.o
drivers/net/phy/aquantia_main.c renamed from drivers/net/phy/aquantia.c +0 -0
Signature · 1 line
2.20.1
Re: [PATCH net-next v3 1/2] net: phy: aquantia: rename aquantia.c to aquantia_main.c
Quoted 4 lines · Heiner Kallweit
Rename
aquantia.ctoaquantia_main.cto be prepared for adding new functionality to separate source code files.Signed-off-by Heiner Kallweit <[email protected]>
Signature · 1 line
Florian
Heiner Kallweit
maintainerPATCH v3 2/2 net: phy: aquantia: add hwmon support
In reply to Heiner KallweitThis adds HWMON support for the temperature sensor and the related alarms on the 107/108/109 chips. This patch is based on work from Nikita and Andrew. I added:
- support for changing alarm thresholds via sysfs
- move HWMON code to a separate source file to improve maintainability
- smaller changes like using IS_REACHABLE instead of ifdef (avoids problems if PHY driver is built in and HWMON is a module)
v2:
- remove struct aqr_priv
- rename header file to aquantia.h
v3:
- add conditional compiling of aquantia_hwmon.c
- improve converting sensor register values to/from long
- add helper aqr_hwmon_test_bit
--- drivers/net/phy/Makefile | 3 + drivers/net/phy/aquantia.h | 16 ++ drivers/net/phy/aquantia_hwmon.c | 250 +++++++++++++++++++++++++++++++ drivers/net/phy/aquantia_main.c | 4 + 4 files changed, 273 insertions(+) create mode 100644 drivers/net/phy/aquantia.h create mode 100644 drivers/net/phy/aquantia_hwmon.c
drivers/net/phy/Makefile +3 -0
@@ -46,6 +46,9 @@ obj-y += $(sfp-obj-y) $(sfp-obj-m) obj-$(CONFIG_AMD_PHY) += amd.o aquantia-objs += aquantia_main.o +ifdef CONFIG_HWMON +aquantia-objs += aquantia_hwmon.o +endif obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o obj-$(CONFIG_ASIX_PHY) += asix.o obj-$(CONFIG_AT803X_PHY) += at803x.o
drivers/net/phy/aquantia.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 +* HWMON driver for Aquantia PHY +* +* Author: Nikita Yushchenko <[email protected]> +* Author: Andrew Lunn <[email protected]> +* Author: Heiner Kallweit <[email protected]> +*/ + +#include <linux/device.h> +#include <linux/phy.h> + +#if IS_REACHABLE (CONFIG_HWMON ) +int aqr_hwmon_probe (struct phy_device *phydev); +#else +static inline int aqr_hwmon_probe (struct phy_device *phydev) {return 0 ; } +#endif
drivers/net/phy/aquantia_hwmon.c new file +250 -0
250 lines not on this page · raw message
drivers/net/phy/aquantia_main.c +4 -0
@@ -12,6 +12,8 @@#include <linux/delay.h> #include <linux/phy.h> +#include "aquantia.h" +#define PHY_ID_AQ1202 0x03a1b445#define PHY_ID_AQ2104 0x03a1b460#define PHY_ID_AQR105 0x03a1b4a2
@@ -231,6 +233,7 @@ static struct phy_driver aqr_driver[] = { .name = "Aquantia AQR107", .aneg_done = genphy_c45_aneg_done, .get_features = genphy_c45_pma_read_abilities, + .probe = aqr_hwmon_probe, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .ack_interrupt = aqr_ack_interrupt,
@@ -241,6 +244,7 @@ static struct phy_driver aqr_driver[] = { .name = "Aquantia AQCS109", .aneg_done = genphy_c45_aneg_done, .get_features = genphy_c45_pma_read_abilities, + .probe = aqr_hwmon_probe, .config_init = aqcs109_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr,
Signature · 1 line
2.20.1
Quoted 16 lines · Heiner Kallweit
This adds HWMON support for the temperature sensor and the related alarms on the 107/108/109 chips. This patch is based on work from Nikita and Andrew. I added:
- support for changing alarm thresholds via sysfs
- move HWMON code to a separate source file to improve maintainability
- smaller changes like usingIS_REACHABLEinstead of ifdef (avoids problems if PHY driver is built in and HWMON is a module)v2:
- remove structaqr_priv
- rename header file toaquantia.h
v3:
- add conditional compiling ofaquantia_hwmon.c
- improve converting sensor register values to/from long
- add helperaqr_hwmon_test_bit
Quoted 3 lines
Signed-off-by Nikita Yushchenko <[email protected]>Signed-off-by Andrew Lunn <[email protected]>Signed-off-by Heiner Kallweit <[email protected]>
Signature · 1 line
Florian
David Miller
maintainerFrom: Heiner Kallweit <[email protected]>
Date: Mon, 25 Feb 2019 19:52:14 +0100
Quoted 10 lines
This series adds HWMON support for the temperature sensor and the related alarms on the 107/108/109 chips.
v2:
- remove structaqr_priv
- rename header file toaquantia.h
v3:
- add conditional compiling ofaquantia_hwmon.c
- improve converting sensor register values to/from long
- add helperaqr_hwmon_test_bit
Series applied, thanks Heiner.