Lines Matching full:ldo
3 // wm831x-ldo.c -- LDO driver for the WM831x series
47 struct wm831x_ldo *ldo = data; in wm831x_ldo_uv_irq() local
49 regulator_notifier_call_chain(ldo->regulator, in wm831x_ldo_uv_irq()
68 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_gp_ldo_set_suspend_voltage() local
69 struct wm831x *wm831x = ldo->wm831x; in wm831x_gp_ldo_set_suspend_voltage()
70 int sel, reg = ldo->base + WM831X_LDO_SLEEP_CONTROL; in wm831x_gp_ldo_set_suspend_voltage()
81 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_gp_ldo_get_mode() local
82 struct wm831x *wm831x = ldo->wm831x; in wm831x_gp_ldo_get_mode()
83 int ctrl_reg = ldo->base + WM831X_LDO_CONTROL; in wm831x_gp_ldo_get_mode()
84 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; in wm831x_gp_ldo_get_mode()
107 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_gp_ldo_set_mode() local
108 struct wm831x *wm831x = ldo->wm831x; in wm831x_gp_ldo_set_mode()
109 int ctrl_reg = ldo->base + WM831X_LDO_CONTROL; in wm831x_gp_ldo_set_mode()
110 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; in wm831x_gp_ldo_set_mode()
158 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_gp_ldo_get_status() local
159 struct wm831x *wm831x = ldo->wm831x; in wm831x_gp_ldo_get_status()
220 struct wm831x_ldo *ldo; in wm831x_gp_ldo_probe() local
230 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); in wm831x_gp_ldo_probe()
232 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); in wm831x_gp_ldo_probe()
233 if (!ldo) in wm831x_gp_ldo_probe()
236 ldo->wm831x = wm831x; in wm831x_gp_ldo_probe()
244 ldo->base = res->start; in wm831x_gp_ldo_probe()
246 snprintf(ldo->name, sizeof(ldo->name), "LDO%d", id + 1); in wm831x_gp_ldo_probe()
247 ldo->desc.name = ldo->name; in wm831x_gp_ldo_probe()
249 snprintf(ldo->supply_name, sizeof(ldo->supply_name), in wm831x_gp_ldo_probe()
250 "LDO%dVDD", id + 1); in wm831x_gp_ldo_probe()
251 ldo->desc.supply_name = ldo->supply_name; in wm831x_gp_ldo_probe()
253 ldo->desc.id = id; in wm831x_gp_ldo_probe()
254 ldo->desc.type = REGULATOR_VOLTAGE; in wm831x_gp_ldo_probe()
255 ldo->desc.n_voltages = 32; in wm831x_gp_ldo_probe()
256 ldo->desc.ops = &wm831x_gp_ldo_ops; in wm831x_gp_ldo_probe()
257 ldo->desc.owner = THIS_MODULE; in wm831x_gp_ldo_probe()
258 ldo->desc.vsel_reg = ldo->base + WM831X_LDO_ON_CONTROL; in wm831x_gp_ldo_probe()
259 ldo->desc.vsel_mask = WM831X_LDO1_ON_VSEL_MASK; in wm831x_gp_ldo_probe()
260 ldo->desc.enable_reg = WM831X_LDO_ENABLE; in wm831x_gp_ldo_probe()
261 ldo->desc.enable_mask = 1 << id; in wm831x_gp_ldo_probe()
262 ldo->desc.bypass_reg = ldo->base; in wm831x_gp_ldo_probe()
263 ldo->desc.bypass_mask = WM831X_LDO1_SWI; in wm831x_gp_ldo_probe()
264 ldo->desc.linear_ranges = wm831x_gp_ldo_ranges; in wm831x_gp_ldo_probe()
265 ldo->desc.n_linear_ranges = ARRAY_SIZE(wm831x_gp_ldo_ranges); in wm831x_gp_ldo_probe()
269 config.init_data = pdata->ldo[id]; in wm831x_gp_ldo_probe()
270 config.driver_data = ldo; in wm831x_gp_ldo_probe()
273 ldo->regulator = devm_regulator_register(&pdev->dev, &ldo->desc, in wm831x_gp_ldo_probe()
275 if (IS_ERR(ldo->regulator)) { in wm831x_gp_ldo_probe()
276 ret = PTR_ERR(ldo->regulator); in wm831x_gp_ldo_probe()
277 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", in wm831x_gp_ldo_probe()
286 ldo->name, in wm831x_gp_ldo_probe()
287 ldo); in wm831x_gp_ldo_probe()
294 platform_set_drvdata(pdev, ldo); in wm831x_gp_ldo_probe()
305 .name = "wm831x-ldo",
321 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_aldo_set_suspend_voltage() local
322 struct wm831x *wm831x = ldo->wm831x; in wm831x_aldo_set_suspend_voltage()
323 int sel, reg = ldo->base + WM831X_LDO_SLEEP_CONTROL; in wm831x_aldo_set_suspend_voltage()
334 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_aldo_get_mode() local
335 struct wm831x *wm831x = ldo->wm831x; in wm831x_aldo_get_mode()
336 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; in wm831x_aldo_get_mode()
352 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_aldo_set_mode() local
353 struct wm831x *wm831x = ldo->wm831x; in wm831x_aldo_set_mode()
354 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; in wm831x_aldo_set_mode()
381 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_aldo_get_status() local
382 struct wm831x *wm831x = ldo->wm831x; in wm831x_aldo_get_status()
430 struct wm831x_ldo *ldo; in wm831x_aldo_probe() local
440 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); in wm831x_aldo_probe()
442 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); in wm831x_aldo_probe()
443 if (!ldo) in wm831x_aldo_probe()
446 ldo->wm831x = wm831x; in wm831x_aldo_probe()
454 ldo->base = res->start; in wm831x_aldo_probe()
456 snprintf(ldo->name, sizeof(ldo->name), "LDO%d", id + 1); in wm831x_aldo_probe()
457 ldo->desc.name = ldo->name; in wm831x_aldo_probe()
459 snprintf(ldo->supply_name, sizeof(ldo->supply_name), in wm831x_aldo_probe()
460 "LDO%dVDD", id + 1); in wm831x_aldo_probe()
461 ldo->desc.supply_name = ldo->supply_name; in wm831x_aldo_probe()
463 ldo->desc.id = id; in wm831x_aldo_probe()
464 ldo->desc.type = REGULATOR_VOLTAGE; in wm831x_aldo_probe()
465 ldo->desc.n_voltages = 32; in wm831x_aldo_probe()
466 ldo->desc.linear_ranges = wm831x_aldo_ranges; in wm831x_aldo_probe()
467 ldo->desc.n_linear_ranges = ARRAY_SIZE(wm831x_aldo_ranges); in wm831x_aldo_probe()
468 ldo->desc.ops = &wm831x_aldo_ops; in wm831x_aldo_probe()
469 ldo->desc.owner = THIS_MODULE; in wm831x_aldo_probe()
470 ldo->desc.vsel_reg = ldo->base + WM831X_LDO_ON_CONTROL; in wm831x_aldo_probe()
471 ldo->desc.vsel_mask = WM831X_LDO7_ON_VSEL_MASK; in wm831x_aldo_probe()
472 ldo->desc.enable_reg = WM831X_LDO_ENABLE; in wm831x_aldo_probe()
473 ldo->desc.enable_mask = 1 << id; in wm831x_aldo_probe()
474 ldo->desc.bypass_reg = ldo->base; in wm831x_aldo_probe()
475 ldo->desc.bypass_mask = WM831X_LDO7_SWI; in wm831x_aldo_probe()
479 config.init_data = pdata->ldo[id]; in wm831x_aldo_probe()
480 config.driver_data = ldo; in wm831x_aldo_probe()
483 ldo->regulator = devm_regulator_register(&pdev->dev, &ldo->desc, in wm831x_aldo_probe()
485 if (IS_ERR(ldo->regulator)) { in wm831x_aldo_probe()
486 ret = PTR_ERR(ldo->regulator); in wm831x_aldo_probe()
487 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", in wm831x_aldo_probe()
496 ldo->name, ldo); in wm831x_aldo_probe()
503 platform_set_drvdata(pdev, ldo); in wm831x_aldo_probe()
519 * Alive LDO
527 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_alive_ldo_set_suspend_voltage() local
528 struct wm831x *wm831x = ldo->wm831x; in wm831x_alive_ldo_set_suspend_voltage()
529 int sel, reg = ldo->base + WM831X_ALIVE_LDO_SLEEP_CONTROL; in wm831x_alive_ldo_set_suspend_voltage()
540 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); in wm831x_alive_ldo_get_status() local
541 struct wm831x *wm831x = ldo->wm831x; in wm831x_alive_ldo_get_status()
574 struct wm831x_ldo *ldo; in wm831x_alive_ldo_probe() local
585 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); in wm831x_alive_ldo_probe()
587 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL); in wm831x_alive_ldo_probe()
588 if (!ldo) in wm831x_alive_ldo_probe()
591 ldo->wm831x = wm831x; in wm831x_alive_ldo_probe()
599 ldo->base = res->start; in wm831x_alive_ldo_probe()
601 snprintf(ldo->name, sizeof(ldo->name), "LDO%d", id + 1); in wm831x_alive_ldo_probe()
602 ldo->desc.name = ldo->name; in wm831x_alive_ldo_probe()
604 snprintf(ldo->supply_name, sizeof(ldo->supply_name), in wm831x_alive_ldo_probe()
605 "LDO%dVDD", id + 1); in wm831x_alive_ldo_probe()
606 ldo->desc.supply_name = ldo->supply_name; in wm831x_alive_ldo_probe()
608 ldo->desc.id = id; in wm831x_alive_ldo_probe()
609 ldo->desc.type = REGULATOR_VOLTAGE; in wm831x_alive_ldo_probe()
610 ldo->desc.n_voltages = WM831X_ALIVE_LDO_MAX_SELECTOR + 1; in wm831x_alive_ldo_probe()
611 ldo->desc.ops = &wm831x_alive_ldo_ops; in wm831x_alive_ldo_probe()
612 ldo->desc.owner = THIS_MODULE; in wm831x_alive_ldo_probe()
613 ldo->desc.vsel_reg = ldo->base + WM831X_ALIVE_LDO_ON_CONTROL; in wm831x_alive_ldo_probe()
614 ldo->desc.vsel_mask = WM831X_LDO11_ON_VSEL_MASK; in wm831x_alive_ldo_probe()
615 ldo->desc.enable_reg = WM831X_LDO_ENABLE; in wm831x_alive_ldo_probe()
616 ldo->desc.enable_mask = 1 << id; in wm831x_alive_ldo_probe()
617 ldo->desc.min_uV = 800000; in wm831x_alive_ldo_probe()
618 ldo->desc.uV_step = 50000; in wm831x_alive_ldo_probe()
619 ldo->desc.enable_time = 1000; in wm831x_alive_ldo_probe()
623 config.init_data = pdata->ldo[id]; in wm831x_alive_ldo_probe()
624 config.driver_data = ldo; in wm831x_alive_ldo_probe()
627 ldo->regulator = devm_regulator_register(&pdev->dev, &ldo->desc, in wm831x_alive_ldo_probe()
629 if (IS_ERR(ldo->regulator)) { in wm831x_alive_ldo_probe()
630 ret = PTR_ERR(ldo->regulator); in wm831x_alive_ldo_probe()
631 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", in wm831x_alive_ldo_probe()
636 platform_set_drvdata(pdev, ldo); in wm831x_alive_ldo_probe()
647 .name = "wm831x-alive-ldo",
671 MODULE_DESCRIPTION("WM831x LDO driver");
673 MODULE_ALIAS("platform:wm831x-ldo");