Re: [PATCH net-next v5 13/17] net: pse-pd: Use regulator framework within PSE framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 04, 2024 at 10:27:08AM +0100, Köry Maincent wrote:
> Hello Oleksij,

> > > +	psec = dev_find_pse_control(&phy->mdio.dev);
> > > +	if (IS_ERR(psec)) {
> > > +		rc = PTR_ERR(psec);
> > > +		goto unregister_phy;
> > > +	}
> > > +  
> > 
> > I do not think it is a good idea to make PSE controller depend on
> > phy->mdio.dev. The only reason why we have fwnode_find_pse_control()
> > here was the missing port abstraction.
> 
> I totally agree that having port abstraction would be more convenient.
> Maxime Chevallier is currently working on this and will post it after his
> multi-phy series get merged.
> Meanwhile, we still need a device pointer for getting the regulator. The
> phy->mdio.dev is the only one I can think of as a regulator consumer.
> Another idea?

I would say, in current code state, PSE controller is regulator provider and
consumer - both are same devices. Otherwise, it will be impossible to
unregistered PHY devices without shutting down PSE-PI. Mostly, we should
be able to continue to provide the power even if network interface is down. 

> > > +	rconfig.dev = pcdev->dev;
> > > +	rconfig.driver_data = pcdev;
> > > +	rconfig.init_data = &pse_pi_initdata;  
> > 
> > Please add input supply to track all dependencies:
> >         if (of_property_present(np, "vin-supply"))
> > config->input_supply = "vin";
> > 
> > May be better to make it not optional...
> 
> Does the "vin-supply" property be added at the pse-pi node level or the
> pse-controller node level or at the hardware port node level or the manager node
> level for the pd692x0?
> Maybe better at the pse-pi node level and each PIs of the manager will get the
> same regulator?
> What do you think?

Yes, I agree. PSE-PI should share same parent regulator. Different PSE
managers may have different power supplies. One port (PSE PI) - not.

>  
> > Should be tested, but if, instead of "vin-supply", we will use
> > "pse-supply" it will make most part of pse_regulator.c obsolete.
> 
> Don't know, if it is done at the pse-pi node level it may not break
> pse_regulator.c. Not sure about it.

me too. Before your patch set, the regulator topology for PoDL PSE was
following:
power-source
  fixed-regulator
     PoDL_PSE-consumer

Now it will be:
power-source
  fixed-regulator
     PoDL_PSE-consumer
       PSE-PI-provider
         PSE-PI-consumer

By porting porting PSE framework to regulator, probably it make sense to
remove two levels of regulators?
power-source
  fixed-regulator
     PSE-PI-consumer

> > ....  
> > > @@ -310,6 +452,20 @@ pse_control_get_internal(struct pse_controller_dev
> > > *pcdev, unsigned int index) return ERR_PTR(-ENODEV);
> > >  	}
> > >  
> > > +	psec->ps = devm_regulator_get_exclusive(dev,
> > > +
> > > rdev_get_name(pcdev->pi[index].rdev));
> > > +	if (IS_ERR(psec->ps)) {
> > > +		kfree(psec);
> > > +		return ERR_CAST(psec->ps);
> > > +	}
> > > +
> > > +	ret = regulator_is_enabled(psec->ps);
> > > +	if (ret < 0) {
> > > +		kfree(psec);
> > > +		return ERR_PTR(ret);
> > > +	}
> > > +	pcdev->pi[index].enabled = ret;  
> > 
> > If I see it correctly, it will prevent us to refcount a request from
> > user space. So, the runtime PM may suspend PI.
> 
> I don't think so as the regulator_get_exclusive() does the same and refcount it:
> https://elixir.bootlin.com/linux/v6.7.8/source/drivers/regulator/core.c#L2268

ok, thx.

-- 
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 |




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux