Re: [PATCH RFC 05/11] power: supply: max77693: Expose INPUT_CURRENT_LIMIT and CURRENT_MAX

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

 



On 31.05.2024 11:38, Krzysztof Kozlowski wrote:
On 30/05/2024 10:55, Artur Weber wrote:
There are two charger current limit registers:

- Fast charge current limit (which controls current going from the
   charger to the battery);
- CHGIN input current limit (which controls current going into the
   charger through the cable, and is managed by the CHARGER regulator).




+	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
+		ret = max77693_get_input_current_limit(chg, &val->intval);
+		break;
+	case POWER_SUPPLY_PROP_CURRENT_MAX:
+		ret = max77693_get_fast_charge_current(regmap, &val->intval);
+		break;
  	case POWER_SUPPLY_PROP_MODEL_NAME:
  		val->strval = max77693_charger_model;
  		break;
@@ -680,6 +727,11 @@ static int max77693_charger_probe(struct platform_device *pdev)
  	chg->dev = &pdev->dev;
  	chg->max77693 = max77693;
+ chg->regu = devm_regulator_get(chg->dev, "CHARGER");
+	if (IS_ERR(chg->regu))
+		return dev_err_probe(&pdev->dev, PTR_ERR(chg->regu),
+				     "failed to get charger regulator\n");\

This breaks users... and where is the binding?
Assuming "this" means "erroring out if the CHARGER regulator is not
found":

The way it works here is that the CHARGER regulator is fetched directly
from the parent max77693 device (it's defined in the regulator subnode
in DT). I suppose we could add a DT property for it, in the charger node
(like we do for the USB connector), though I don't know if anyone would
use any other regulator here than the CHARGER regulator of the max77693
regulator device. (And after all, we're using it here to modify charger
registers... maybe another point to my argument that we should be
handling all of this directly in the charger driver instead of deferring
it to a regulator.)

Best regards
Artur

[1] https://lore.kernel.org/all/20160927081344.GC4394@kozik-lap/
[2] https://lore.kernel.org/all/298d81d5-fe41-e2d1-32a7-d3dc35b0fe25@xxxxxxxxxx/




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux