Re: [PATCH v4 4/7] power: supply: max8997_charger: Set CHARGER current limit

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

 



On Thu, Dec 24, 2020 at 02:37:06PM +0100, Krzysztof Kozlowski wrote:
> On Thu, Dec 24, 2020 at 01:13:02PM +0000, Timon Baetz wrote:
> > On Thu, 24 Dec 2020 10:55:59 +0100, Krzysztof Kozlowski wrote:
> > > > @@ -170,6 +237,28 @@ static int max8997_battery_probe(struct platform_device *pdev)
> > > >  		return PTR_ERR(charger->battery);
> > > >  	}
> > > >
> > > > +	charger->reg = devm_regulator_get(&pdev->dev, "charger");  
> > > 
> > > Since you do not use get_optional, you will always get a dummy
> > > regulator. In case of error, you should either print it or entirely fail
> > > the probe. Silently continuing makes it difficult to spot errors.
> > > 
> > > Since the driver could operate in case of extcon/regulator error, just
> > > dev_err() so failure will be spotted with dmesg.
> > 
> > I will switch to devm_regulator_get_optional() and print an error on 
> > failure, thanks.
> > 
> > > It will complain on older DTBs because you are introducing incompatible
> > > change, but that's expected. Just correct all other in-tree DTS.
> > 
> > The other 2 in-tree DTS don't have CHARGER regulators. Not sure
> > how to correct those. Should I add muic and charger nodes without a
> > charger-supply? It will still complain in that case.
> 
> +Cc Marek,
> 
> This is why leaving the code as is - devm_regulator_get(), not optional
> - makes sense. Core would provide dummy regulator, so you only have to
> provide MUIC node.
> 
> If you change the code to devm_regulator_get_optional(), you need to add
> everything: the charger regulator, the charger node and MUIC node.
> 
> For Trats, the configuration should be similar as i9100, although I
> don't know the exact values of chargign voltage.
> 
> For Origen, there is no battery, so the power supply should not bind.
> Maybe this could be achieved with "status disabled" for charger node? It
> depends whether MFD will respect such field... If it disables the
> charger, you're done.

I just looked at the MFD code and tested it - it nicely skips disabled
devices. Therefore, for Origen I propose to add disabled nodes for
charger and MUIC because these pins are not connected. No need to add
regulators in such case.

Best regards,
Krzysztof



[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux