Lines Matching refs:dcdc
2 * wm831x-dcdc.c -- DC-DC buck convertor driver for the WM831x series
65 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
66 struct wm831x *wm831x = dcdc->wm831x;
82 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
83 struct wm831x *wm831x = dcdc->wm831x;
91 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
92 struct wm831x *wm831x = dcdc->wm831x;
101 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
102 struct wm831x *wm831x = dcdc->wm831x;
103 u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
154 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
155 struct wm831x *wm831x = dcdc->wm831x;
156 u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
164 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
165 struct wm831x *wm831x = dcdc->wm831x;
166 u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
173 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
174 struct wm831x *wm831x = dcdc->wm831x;
217 struct wm831x_dcdc *dcdc = data;
219 regulator_notifier_call_chain(dcdc->regulator,
228 struct wm831x_dcdc *dcdc = data;
230 regulator_notifier_call_chain(dcdc->regulator,
288 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
290 if (state == dcdc->dvs_gpio_state)
293 dcdc->dvs_gpio_state = state;
294 gpio_set_value(dcdc->dvs_gpio, state);
307 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
308 struct wm831x *wm831x = dcdc->wm831x;
309 int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
310 int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
318 if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
321 if (dcdc->dvs_gpio && dcdc->dvs_vsel == vsel)
328 dcdc->on_vsel = vsel;
330 if (!dcdc->dvs_gpio)
350 if (vsel == dcdc->on_vsel)
355 dcdc->dvs_vsel = vsel;
366 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
367 struct wm831x *wm831x = dcdc->wm831x;
368 u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
380 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
382 if (dcdc->dvs_gpio && dcdc->dvs_gpio_state)
383 return wm831x_buckv_list_voltage(rdev, dcdc->dvs_vsel);
385 return wm831x_buckv_list_voltage(rdev, dcdc->on_vsel);
396 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
397 struct wm831x *wm831x = dcdc->wm831x;
398 u16 reg = dcdc->base + WM831X_DCDC_CONTROL_2;
413 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
414 struct wm831x *wm831x = dcdc->wm831x;
415 u16 reg = dcdc->base + WM831X_DCDC_CONTROL_2;
446 static __devinit void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc,
449 struct wm831x *wm831x = dcdc->wm831x;
465 pdata->dvs_control_src, dcdc->name);
469 ret = wm831x_set_bits(wm831x, dcdc->base + WM831X_DCDC_DVS_CONTROL,
473 dcdc->name, ret);
480 dcdc->name, ret);
487 dcdc->dvs_gpio_state = pdata->dvs_init_state;
489 ret = gpio_direction_output(pdata->dvs_gpio, dcdc->dvs_gpio_state);
492 dcdc->name, ret);
497 dcdc->dvs_gpio = pdata->dvs_gpio;
504 int id = pdev->id % ARRAY_SIZE(pdata->dcdc);
505 struct wm831x_dcdc *dcdc;
511 if (pdata == NULL || pdata->dcdc[id] == NULL)
514 dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL);
515 if (dcdc == NULL) {
520 dcdc->wm831x = wm831x;
528 dcdc->base = res->start;
530 snprintf(dcdc->name, sizeof(dcdc->name), "DCDC%d", id + 1);
531 dcdc->desc.name = dcdc->name;
532 dcdc->desc.id = id;
533 dcdc->desc.type = REGULATOR_VOLTAGE;
534 dcdc->desc.n_voltages = WM831X_BUCKV_MAX_SELECTOR + 1;
535 dcdc->desc.ops = &wm831x_buckv_ops;
536 dcdc->desc.owner = THIS_MODULE;
538 ret = wm831x_reg_read(wm831x, dcdc->base + WM831X_DCDC_ON_CONFIG);
543 dcdc->on_vsel = ret & WM831X_DC1_ON_VSEL_MASK;
545 ret = wm831x_reg_read(wm831x, dcdc->base + WM831X_DCDC_ON_CONFIG);
550 dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK;
552 if (pdata->dcdc[id])
553 wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data);
555 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
556 pdata->dcdc[id], dcdc);
557 if (IS_ERR(dcdc->regulator)) {
558 ret = PTR_ERR(dcdc->regulator);
566 IRQF_TRIGGER_RISING, dcdc->name,
567 dcdc);
576 IRQF_TRIGGER_RISING, dcdc->name,
577 dcdc);
584 platform_set_drvdata(pdev, dcdc);
589 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "UV"), dcdc);
591 regulator_unregister(dcdc->regulator);
593 if (dcdc->dvs_gpio)
594 gpio_free(dcdc->dvs_gpio);
595 kfree(dcdc);
601 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
602 struct wm831x *wm831x = dcdc->wm831x;
606 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "HC"), dcdc);
607 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "UV"), dcdc);
608 regulator_unregister(dcdc->regulator);
609 if (dcdc->dvs_gpio)
610 gpio_free(dcdc->dvs_gpio);
611 kfree(dcdc);
641 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
642 struct wm831x *wm831x = dcdc->wm831x;
659 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
660 u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
668 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
669 u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
676 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
677 struct wm831x *wm831x = dcdc->wm831x;
678 u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
707 int id = pdev->id % ARRAY_SIZE(pdata->dcdc);
708 struct wm831x_dcdc *dcdc;
714 if (pdata == NULL || pdata->dcdc[id] == NULL)
717 dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL);
718 if (dcdc == NULL) {
723 dcdc->wm831x = wm831x;
731 dcdc->base = res->start;
733 snprintf(dcdc->name, sizeof(dcdc->name), "DCDC%d", id + 1);
734 dcdc->desc.name = dcdc->name;
735 dcdc->desc.id = id;
736 dcdc->desc.type = REGULATOR_VOLTAGE;
737 dcdc->desc.n_voltages = WM831X_BUCKP_MAX_SELECTOR + 1;
738 dcdc->desc.ops = &wm831x_buckp_ops;
739 dcdc->desc.owner = THIS_MODULE;
741 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
742 pdata->dcdc[id], dcdc);
743 if (IS_ERR(dcdc->regulator)) {
744 ret = PTR_ERR(dcdc->regulator);
752 IRQF_TRIGGER_RISING, dcdc->name,
753 dcdc);
760 platform_set_drvdata(pdev, dcdc);
765 regulator_unregister(dcdc->regulator);
767 kfree(dcdc);
773 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
774 struct wm831x *wm831x = dcdc->wm831x;
778 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "UV"), dcdc);
779 regulator_unregister(dcdc->regulator);
780 kfree(dcdc);
800 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
801 struct wm831x *wm831x = dcdc->wm831x;
837 int id = pdev->id % ARRAY_SIZE(pdata->dcdc);
838 struct wm831x_dcdc *dcdc;
844 if (pdata == NULL || pdata->dcdc[id] == NULL)
847 dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL);
848 if (dcdc == NULL) {
853 dcdc->wm831x = wm831x;
861 dcdc->base = res->start;
863 snprintf(dcdc->name, sizeof(dcdc->name), "DCDC%d", id + 1);
864 dcdc->desc.name = dcdc->name;
865 dcdc->desc.id = id;
866 dcdc->desc.type = REGULATOR_VOLTAGE;
867 dcdc->desc.ops = &wm831x_boostp_ops;
868 dcdc->desc.owner = THIS_MODULE;
870 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
871 pdata->dcdc[id], dcdc);
872 if (IS_ERR(dcdc->regulator)) {
873 ret = PTR_ERR(dcdc->regulator);
881 IRQF_TRIGGER_RISING, dcdc->name,
882 dcdc);
889 platform_set_drvdata(pdev, dcdc);
894 regulator_unregister(dcdc->regulator);
896 kfree(dcdc);
902 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
903 struct wm831x *wm831x = dcdc->wm831x;
907 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "UV"), dcdc);
908 regulator_unregister(dcdc->regulator);
909 kfree(dcdc);
944 struct wm831x_dcdc *dcdc;
952 dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL);
953 if (dcdc == NULL) {
958 dcdc->wm831x = wm831x;
963 snprintf(dcdc->name, sizeof(dcdc->name), "EPE%d", id + 1);
964 dcdc->desc.name = dcdc->name;
965 dcdc->desc.id = id + WM831X_EPE_BASE; /* Offset in DCDC registers */
966 dcdc->desc.ops = &wm831x_epe_ops;
967 dcdc->desc.type = REGULATOR_VOLTAGE;
968 dcdc->desc.owner = THIS_MODULE;
970 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
971 pdata->epe[id], dcdc);
972 if (IS_ERR(dcdc->regulator)) {
973 ret = PTR_ERR(dcdc->regulator);
979 platform_set_drvdata(pdev, dcdc);
984 kfree(dcdc);
990 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
994 regulator_unregister(dcdc->regulator);
995 kfree(dcdc);