On Fri, Jun 28, 2024 at 10:31:57AM +0200, Kory Maincent wrote: > From: Kory Maincent (Dent Project) <kory.maincent@xxxxxxxxxxx> > > This patch add a way to get and set the power limit of a PSE PI. > For that it uses regulator API callbacks wrapper like get_voltage() and > get/set_current_limit() as power is simply V * I. > We used mW unit as defined by the IEEE 802.3-2022 standards. > > set_current_limit() uses the voltage return by get_voltage() and the > desired power limit to calculate the current limit. get_voltage() callback > is then mandatory to set the power limit. > > get_current_limit() callback is by default looking at a driver callback > and fallback to extracting the current limit from _pse_ethtool_get_status() > if the driver does not set its callback. We prefer let the user the choice > because ethtool_get_status return much more information than the current > limit. > > expand pse status with c33_pw_limit_ranges to return the ranges available > to configure the power limit. > > Reviewed-by: Sai Krishna <saikrishnag@xxxxxxxxxxx> > Signed-off-by: Kory Maincent <kory.maincent@xxxxxxxxxxx> Acked-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> Thank you! -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |