Lines Matching full:power
3 * AXP20X and AXP22X PMICs' ACIN power supply driver
39 #define DRVNAME "axp20x-ac-power-supply"
53 struct axp20x_ac_power *power = devid; in axp20x_ac_power_irq() local
55 power_supply_changed(power->supply); in axp20x_ac_power_irq()
64 struct axp20x_ac_power *power = power_supply_get_drvdata(psy); in axp20x_ac_power_get_property() local
69 ret = regmap_read(power->regmap, AXP20X_PWR_INPUT_STATUS, ®); in axp20x_ac_power_get_property()
82 ret = regmap_read(power->regmap, AXP20X_PWR_INPUT_STATUS, ®); in axp20x_ac_power_get_property()
90 ret = regmap_read(power->regmap, AXP20X_PWR_INPUT_STATUS, ®); in axp20x_ac_power_get_property()
97 if (val->intval && power->has_acin_path_sel) { in axp20x_ac_power_get_property()
98 ret = regmap_read(power->regmap, AXP813_ACIN_PATH_CTRL, in axp20x_ac_power_get_property()
109 ret = iio_read_channel_processed(power->acin_v, &val->intval); in axp20x_ac_power_get_property()
113 /* IIO framework gives mV but Power Supply framework gives uV */ in axp20x_ac_power_get_property()
119 ret = iio_read_channel_processed(power->acin_i, &val->intval); in axp20x_ac_power_get_property()
123 /* IIO framework gives mA but Power Supply framework gives uA */ in axp20x_ac_power_get_property()
129 ret = regmap_read(power->regmap, AXP813_ACIN_PATH_CTRL, ®); in axp20x_ac_power_get_property()
138 ret = regmap_read(power->regmap, AXP813_ACIN_PATH_CTRL, ®); in axp20x_ac_power_get_property()
160 struct axp20x_ac_power *power = power_supply_get_drvdata(psy); in axp813_ac_power_set_property() local
164 return regmap_update_bits(power->regmap, AXP813_ACIN_PATH_CTRL, in axp813_ac_power_set_property()
172 return regmap_update_bits(power->regmap, AXP813_ACIN_PATH_CTRL, in axp813_ac_power_set_property()
180 return regmap_update_bits(power->regmap, AXP813_ACIN_PATH_CTRL, in axp813_ac_power_set_property()
287 struct axp20x_ac_power *power = dev_get_drvdata(dev); in axp20x_ac_power_suspend() local
296 if (device_may_wakeup(&power->supply->dev)) in axp20x_ac_power_suspend()
297 enable_irq_wake(power->irqs[i++]); in axp20x_ac_power_suspend()
298 while (i < power->num_irqs) in axp20x_ac_power_suspend()
299 disable_irq(power->irqs[i++]); in axp20x_ac_power_suspend()
306 struct axp20x_ac_power *power = dev_get_drvdata(dev); in axp20x_ac_power_resume() local
309 if (device_may_wakeup(&power->supply->dev)) in axp20x_ac_power_resume()
310 disable_irq_wake(power->irqs[i++]); in axp20x_ac_power_resume()
311 while (i < power->num_irqs) in axp20x_ac_power_resume()
312 enable_irq(power->irqs[i++]); in axp20x_ac_power_resume()
325 struct axp20x_ac_power *power; in axp20x_ac_power_probe() local
339 power = devm_kzalloc(&pdev->dev, in axp20x_ac_power_probe()
340 struct_size(power, irqs, axp_data->num_irq_names), in axp20x_ac_power_probe()
342 if (!power) in axp20x_ac_power_probe()
346 power->acin_v = devm_iio_channel_get(&pdev->dev, "acin_v"); in axp20x_ac_power_probe()
347 if (IS_ERR(power->acin_v)) { in axp20x_ac_power_probe()
348 if (PTR_ERR(power->acin_v) == -ENODEV) in axp20x_ac_power_probe()
350 return PTR_ERR(power->acin_v); in axp20x_ac_power_probe()
353 power->acin_i = devm_iio_channel_get(&pdev->dev, "acin_i"); in axp20x_ac_power_probe()
354 if (IS_ERR(power->acin_i)) { in axp20x_ac_power_probe()
355 if (PTR_ERR(power->acin_i) == -ENODEV) in axp20x_ac_power_probe()
357 return PTR_ERR(power->acin_i); in axp20x_ac_power_probe()
361 power->regmap = dev_get_regmap(pdev->dev.parent, NULL); in axp20x_ac_power_probe()
362 power->has_acin_path_sel = axp_data->acin_path_sel; in axp20x_ac_power_probe()
363 power->num_irqs = axp_data->num_irq_names; in axp20x_ac_power_probe()
365 platform_set_drvdata(pdev, power); in axp20x_ac_power_probe()
368 psy_cfg.drv_data = power; in axp20x_ac_power_probe()
370 power->supply = devm_power_supply_register(&pdev->dev, in axp20x_ac_power_probe()
373 if (IS_ERR(power->supply)) in axp20x_ac_power_probe()
374 return PTR_ERR(power->supply); in axp20x_ac_power_probe()
382 power->irqs[i] = regmap_irq_get_virq(axp20x->regmap_irqc, irq); in axp20x_ac_power_probe()
383 ret = devm_request_any_context_irq(&pdev->dev, power->irqs[i], in axp20x_ac_power_probe()
385 DRVNAME, power); in axp20x_ac_power_probe()
398 .compatible = "x-powers,axp202-ac-power-supply",
401 .compatible = "x-powers,axp221-ac-power-supply",
404 .compatible = "x-powers,axp813-ac-power-supply",
422 MODULE_DESCRIPTION("AXP20X and AXP22X PMICs' AC power supply driver");