Re: [PATCH 2/2] hack-5.15: add Aquantia PHY hwmon temperature clamp patch

2023-02-19 Thread Robert Marko
On Sat, 18 Feb 2023 at 21:47, Enrico Mioso  wrote:
>
>
>
>
> On Sat, 18 Feb 2023, Robert Marko wrote:
>
> > Date: Sat, 18 Feb 2023 12:45:34
> > From: Robert Marko 
> > To: Enrico Mioso 
> > Cc: openwrt-devel@lists.openwrt.org, Andre Valentin ,
> >     Karol Przybylski 
> > Subject: Re: [PATCH 2/2] hack-5.15: add Aquantia PHY hwmon temperature clamp
> > patch
> >
> > On Sat, 18 Feb 2023 at 00:58, Enrico Mioso  wrote:
> >>
> >> This is needed to avoid failures in the thermal subsystem while using this
> >> driver via hwmon subsystem.
> >
> > This should be submitted upstream, we have enough hacks already and
> > you will get proper feedback from Guenter rather fast whether this is a bug
> > in hwmon or the driver needs fixups.
>
> Thanks for your review and feedback!
>
> I am in the process of discussing this change upstream; the problem seems not 
> to be related to hwmon core, but my approach of clamping the value is not 
> going to be accepted either.
> I'm being asked to simply change the -ERANGE returned value to -EINVAL, so I 
> will do it independently of this openwrt patch.

Perfect, I see that Andrew chimed in as well.
Realistically it should probably be clamped to -40 to 108 as that is
what the industrial models are rated at.

>
> But I am supposed to set max a min limits directly to reasonable values.
> I have no clear idea yet on where to set them in DTS, any help or hint would 
> be very apreciated.

I am not sure if it's possible via DTS or only via sysfs.

Regards,
Robert
>
> Enrico
> >
> > Regards,
> > Robert
> >>
> >> CC: Andre Valentin 
> >> CC: Karol Przybylski 
> >> Signed-off-by: Enrico Mioso 
> >> ---
> >>  ...-clamp-temperature-value-in-aqr_hwmo.patch | 30 +++
> >>  1 file changed, 30 insertions(+)
> >>  create mode 100644 
> >> target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
> >>
> >> diff --git 
> >> a/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
> >>  
> >> b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
> >> new file mode 100644
> >> index 00..36f0b37130
> >> --- /dev/null
> >> +++ 
> >> b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
> >> @@ -0,0 +1,30 @@
> >> +From 7bfceb1036d2ccda7b8e1e177e834c1cea9f0858 Mon Sep 17 00:00:00 2001
> >> +From: Enrico Mioso 
> >> +Date: Sat, 18 Feb 2023 00:27:55 +0100
> >> +Subject: [PATCH] net: phy: aquantia: clamp temperature value in 
> >> aqr_hwmon_set
> >> +
> >> +This patch is still under evaluation and is not guaranteed to be correct,
> >> +therefore it is submitted here in hack form. :)
> >> +
> >> +Signed-off-by: Enrico Mioso 
> >> +---
> >> + drivers/net/phy/aquantia_hwmon.c | 3 +--
> >> + 1 file changed, 1 insertion(+), 2 deletions(-)
> >> +
> >> +diff --git a/drivers/net/phy/aquantia_hwmon.c 
> >> b/drivers/net/phy/aquantia_hwmon.c
> >> +index 19c4c280a6cd..6444055e720c 100644
> >> +--- a/drivers/net/phy/aquantia_hwmon.c
> >>  b/drivers/net/phy/aquantia_hwmon.c
> >> +@@ -70,8 +70,7 @@ static int aqr_hwmon_set(struct phy_device *phydev, int 
> >> reg, long value)
> >> + {
> >> +   int temp;
> >> +
> >> +-  if (value >= 128000 || value < -128000)
> >> +-  return -ERANGE;
> >> ++  clamp_val(value, -128000, 128000);
> >> +
> >> +   temp = value * 256 / 1000;
> >> +
> >> +--
> >> +2.39.2
> >> +
> >> --
> >> 2.39.2
> >>
> >>
> >> ___
> >> openwrt-devel mailing list
> >> openwrt-devel@lists.openwrt.org
> >> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> >

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 2/2] hack-5.15: add Aquantia PHY hwmon temperature clamp patch

2023-02-18 Thread Enrico Mioso





On Sat, 18 Feb 2023, Robert Marko wrote:


Date: Sat, 18 Feb 2023 12:45:34
From: Robert Marko 
To: Enrico Mioso 
Cc: openwrt-devel@lists.openwrt.org, Andre Valentin ,
Karol Przybylski 
Subject: Re: [PATCH 2/2] hack-5.15: add Aquantia PHY hwmon temperature clamp
patch

On Sat, 18 Feb 2023 at 00:58, Enrico Mioso  wrote:


This is needed to avoid failures in the thermal subsystem while using this
driver via hwmon subsystem.


This should be submitted upstream, we have enough hacks already and
you will get proper feedback from Guenter rather fast whether this is a bug
in hwmon or the driver needs fixups.


Thanks for your review and feedback!

I am in the process of discussing this change upstream; the problem seems not 
to be related to hwmon core, but my approach of clamping the value is not going 
to be accepted either.
I'm being asked to simply change the -ERANGE returned value to -EINVAL, so I 
will do it independently of this openwrt patch.

But I am supposed to set max a min limits directly to reasonable values.
I have no clear idea yet on where to set them in DTS, any help or hint would be 
very apreciated.

Enrico


Regards,
Robert


CC: Andre Valentin 
CC: Karol Przybylski 
Signed-off-by: Enrico Mioso 
---
 ...-clamp-temperature-value-in-aqr_hwmo.patch | 30 +++
 1 file changed, 30 insertions(+)
 create mode 100644 
target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch

diff --git 
a/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
 
b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
new file mode 100644
index 00..36f0b37130
--- /dev/null
+++ 
b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
@@ -0,0 +1,30 @@
+From 7bfceb1036d2ccda7b8e1e177e834c1cea9f0858 Mon Sep 17 00:00:00 2001
+From: Enrico Mioso 
+Date: Sat, 18 Feb 2023 00:27:55 +0100
+Subject: [PATCH] net: phy: aquantia: clamp temperature value in aqr_hwmon_set
+
+This patch is still under evaluation and is not guaranteed to be correct,
+therefore it is submitted here in hack form. :)
+
+Signed-off-by: Enrico Mioso 
+---
+ drivers/net/phy/aquantia_hwmon.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/net/phy/aquantia_hwmon.c 
b/drivers/net/phy/aquantia_hwmon.c
+index 19c4c280a6cd..6444055e720c 100644
+--- a/drivers/net/phy/aquantia_hwmon.c
 b/drivers/net/phy/aquantia_hwmon.c
+@@ -70,8 +70,7 @@ static int aqr_hwmon_set(struct phy_device *phydev, int reg, 
long value)
+ {
+   int temp;
+
+-  if (value >= 128000 || value < -128000)
+-  return -ERANGE;
++  clamp_val(value, -128000, 128000);
+
+   temp = value * 256 / 1000;
+
+--
+2.39.2
+
--
2.39.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel




___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH 2/2] hack-5.15: add Aquantia PHY hwmon temperature clamp patch

2023-02-18 Thread Robert Marko
On Sat, 18 Feb 2023 at 00:58, Enrico Mioso  wrote:
>
> This is needed to avoid failures in the thermal subsystem while using this
> driver via hwmon subsystem.

This should be submitted upstream, we have enough hacks already and
you will get proper feedback from Guenter rather fast whether this is a bug
in hwmon or the driver needs fixups.

Regards,
Robert
>
> CC: Andre Valentin 
> CC: Karol Przybylski 
> Signed-off-by: Enrico Mioso 
> ---
>  ...-clamp-temperature-value-in-aqr_hwmo.patch | 30 +++
>  1 file changed, 30 insertions(+)
>  create mode 100644 
> target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
>
> diff --git 
> a/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
>  
> b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
> new file mode 100644
> index 00..36f0b37130
> --- /dev/null
> +++ 
> b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
> @@ -0,0 +1,30 @@
> +From 7bfceb1036d2ccda7b8e1e177e834c1cea9f0858 Mon Sep 17 00:00:00 2001
> +From: Enrico Mioso 
> +Date: Sat, 18 Feb 2023 00:27:55 +0100
> +Subject: [PATCH] net: phy: aquantia: clamp temperature value in aqr_hwmon_set
> +
> +This patch is still under evaluation and is not guaranteed to be correct,
> +therefore it is submitted here in hack form. :)
> +
> +Signed-off-by: Enrico Mioso 
> +---
> + drivers/net/phy/aquantia_hwmon.c | 3 +--
> + 1 file changed, 1 insertion(+), 2 deletions(-)
> +
> +diff --git a/drivers/net/phy/aquantia_hwmon.c 
> b/drivers/net/phy/aquantia_hwmon.c
> +index 19c4c280a6cd..6444055e720c 100644
> +--- a/drivers/net/phy/aquantia_hwmon.c
>  b/drivers/net/phy/aquantia_hwmon.c
> +@@ -70,8 +70,7 @@ static int aqr_hwmon_set(struct phy_device *phydev, int 
> reg, long value)
> + {
> +   int temp;
> +
> +-  if (value >= 128000 || value < -128000)
> +-  return -ERANGE;
> ++  clamp_val(value, -128000, 128000);
> +
> +   temp = value * 256 / 1000;
> +
> +--
> +2.39.2
> +
> --
> 2.39.2
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 2/2] hack-5.15: add Aquantia PHY hwmon temperature clamp patch

2023-02-17 Thread Enrico Mioso
This is needed to avoid failures in the thermal subsystem while using this
driver via hwmon subsystem.

CC: Andre Valentin 
CC: Karol Przybylski 
Signed-off-by: Enrico Mioso 
---
 ...-clamp-temperature-value-in-aqr_hwmo.patch | 30 +++
 1 file changed, 30 insertions(+)
 create mode 100644 
target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch

diff --git 
a/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
 
b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
new file mode 100644
index 00..36f0b37130
--- /dev/null
+++ 
b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
@@ -0,0 +1,30 @@
+From 7bfceb1036d2ccda7b8e1e177e834c1cea9f0858 Mon Sep 17 00:00:00 2001
+From: Enrico Mioso 
+Date: Sat, 18 Feb 2023 00:27:55 +0100
+Subject: [PATCH] net: phy: aquantia: clamp temperature value in aqr_hwmon_set
+
+This patch is still under evaluation and is not guaranteed to be correct,
+therefore it is submitted here in hack form. :)
+
+Signed-off-by: Enrico Mioso 
+---
+ drivers/net/phy/aquantia_hwmon.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/net/phy/aquantia_hwmon.c 
b/drivers/net/phy/aquantia_hwmon.c
+index 19c4c280a6cd..6444055e720c 100644
+--- a/drivers/net/phy/aquantia_hwmon.c
 b/drivers/net/phy/aquantia_hwmon.c
+@@ -70,8 +70,7 @@ static int aqr_hwmon_set(struct phy_device *phydev, int reg, 
long value)
+ {
+   int temp;
+ 
+-  if (value >= 128000 || value < -128000)
+-  return -ERANGE;
++  clamp_val(value, -128000, 128000);
+ 
+   temp = value * 256 / 1000;
+ 
+-- 
+2.39.2
+
-- 
2.39.2


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel