Lines Matching full:power
3 * AXP20X and AXP22X PMICs' ACIN power supply driver
40 #define DRVNAME "axp20x-ac-power-supply"
54 struct axp20x_ac_power *power = devid; in axp20x_ac_power_irq() local
56 power_supply_changed(power->supply); in axp20x_ac_power_irq()
65 struct axp20x_ac_power *power = power_supply_get_drvdata(psy); in axp20x_ac_power_get_property() local
70 ret = regmap_read(power->regmap, AXP20X_PWR_INPUT_STATUS, ®); in axp20x_ac_power_get_property()
83 ret = regmap_read(power->regmap, AXP20X_PWR_INPUT_STATUS, ®); in axp20x_ac_power_get_property()
91 ret = regmap_read(power->regmap, AXP20X_PWR_INPUT_STATUS, ®); in axp20x_ac_power_get_property()
98 if (val->intval && power->has_acin_path_sel) { in axp20x_ac_power_get_property()
99 ret = regmap_read(power->regmap, AXP813_ACIN_PATH_CTRL, in axp20x_ac_power_get_property()
110 ret = iio_read_channel_processed(power->acin_v, &val->intval); in axp20x_ac_power_get_property()
114 /* IIO framework gives mV but Power Supply framework gives uV */ in axp20x_ac_power_get_property()
120 ret = iio_read_channel_processed(power->acin_i, &val->intval); in axp20x_ac_power_get_property()
124 /* IIO framework gives mA but Power Supply framework gives uA */ in axp20x_ac_power_get_property()
130 ret = regmap_read(power->regmap, AXP813_ACIN_PATH_CTRL, ®); in axp20x_ac_power_get_property()
139 ret = regmap_read(power->regmap, AXP813_ACIN_PATH_CTRL, ®); in axp20x_ac_power_get_property()
161 struct axp20x_ac_power *power = power_supply_get_drvdata(psy); in axp813_ac_power_set_property() local
165 return regmap_update_bits(power->regmap, AXP813_ACIN_PATH_CTRL, in axp813_ac_power_set_property()
173 return regmap_update_bits(power->regmap, AXP813_ACIN_PATH_CTRL, in axp813_ac_power_set_property()
181 return regmap_update_bits(power->regmap, AXP813_ACIN_PATH_CTRL, in axp813_ac_power_set_property()
288 struct axp20x_ac_power *power = dev_get_drvdata(dev); in axp20x_ac_power_suspend() local
297 if (device_may_wakeup(&power->supply->dev)) in axp20x_ac_power_suspend()
298 enable_irq_wake(power->irqs[i++]); in axp20x_ac_power_suspend()
299 while (i < power->num_irqs) in axp20x_ac_power_suspend()
300 disable_irq(power->irqs[i++]); in axp20x_ac_power_suspend()
307 struct axp20x_ac_power *power = dev_get_drvdata(dev); in axp20x_ac_power_resume() local
310 if (device_may_wakeup(&power->supply->dev)) in axp20x_ac_power_resume()
311 disable_irq_wake(power->irqs[i++]); in axp20x_ac_power_resume()
312 while (i < power->num_irqs) in axp20x_ac_power_resume()
313 enable_irq(power->irqs[i++]); in axp20x_ac_power_resume()
326 struct axp20x_ac_power *power; in axp20x_ac_power_probe() local
340 power = devm_kzalloc(&pdev->dev, in axp20x_ac_power_probe()
341 struct_size(power, irqs, axp_data->num_irq_names), in axp20x_ac_power_probe()
343 if (!power) in axp20x_ac_power_probe()
347 power->acin_v = devm_iio_channel_get(&pdev->dev, "acin_v"); in axp20x_ac_power_probe()
348 if (IS_ERR(power->acin_v)) { in axp20x_ac_power_probe()
349 if (PTR_ERR(power->acin_v) == -ENODEV) in axp20x_ac_power_probe()
351 return PTR_ERR(power->acin_v); in axp20x_ac_power_probe()
354 power->acin_i = devm_iio_channel_get(&pdev->dev, "acin_i"); in axp20x_ac_power_probe()
355 if (IS_ERR(power->acin_i)) { in axp20x_ac_power_probe()
356 if (PTR_ERR(power->acin_i) == -ENODEV) in axp20x_ac_power_probe()
358 return PTR_ERR(power->acin_i); in axp20x_ac_power_probe()
362 power->regmap = dev_get_regmap(pdev->dev.parent, NULL); in axp20x_ac_power_probe()
363 power->has_acin_path_sel = axp_data->acin_path_sel; in axp20x_ac_power_probe()
364 power->num_irqs = axp_data->num_irq_names; in axp20x_ac_power_probe()
366 platform_set_drvdata(pdev, power); in axp20x_ac_power_probe()
369 psy_cfg.drv_data = power; in axp20x_ac_power_probe()
371 power->supply = devm_power_supply_register(&pdev->dev, in axp20x_ac_power_probe()
374 if (IS_ERR(power->supply)) in axp20x_ac_power_probe()
375 return PTR_ERR(power->supply); in axp20x_ac_power_probe()
385 power->irqs[i] = regmap_irq_get_virq(axp20x->regmap_irqc, irq); in axp20x_ac_power_probe()
386 ret = devm_request_any_context_irq(&pdev->dev, power->irqs[i], in axp20x_ac_power_probe()
388 DRVNAME, power); in axp20x_ac_power_probe()
401 .compatible = "x-powers,axp202-ac-power-supply",
404 .compatible = "x-powers,axp221-ac-power-supply",
407 .compatible = "x-powers,axp813-ac-power-supply",
425 MODULE_DESCRIPTION("AXP20X and AXP22X PMICs' AC power supply driver");