Lines Matching +full:ldo +full:- +full:v
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
8 #include <linux/devm-helpers.h>
57 * struct spmi_regulator_init_data - spmi-regulator initialization data
297 /* LDO regulator current limit control register layout */
300 /* LDO regulator soft start control register layout */
365 * struct spmi_voltage_range - regulator set point voltage mapping description
380 * (max_uV - min_uV) % step_uV == 0
381 * (set_point_min_uV - min_uV) % step_uV == 0*
382 * (set_point_max_uV - min_uV) % step_uV == 0*
383 * n_voltages = (set_point_max_uV - set_point_min_uV) / step_uV + 1
627 return regmap_bulk_read(vreg->regmap, vreg->base + addr, buf, len); in spmi_vreg_read()
633 return regmap_bulk_write(vreg->regmap, vreg->base + addr, buf, len); in spmi_vreg_write()
639 return regmap_update_bits(vreg->regmap, vreg->base + addr, mask, val); in spmi_vreg_update_bits()
646 if (vreg->ocp_irq) { in spmi_regulator_vs_enable()
647 vreg->ocp_count = 0; in spmi_regulator_vs_enable()
648 vreg->vs_enable_time = ktime_get(); in spmi_regulator_vs_enable()
661 return -EINVAL; in spmi_regulator_vs_ocp()
675 lim_min_uV = vreg->set_points->range[0].set_point_min_uV; in spmi_regulator_select_voltage()
677 vreg->set_points->range[vreg->set_points->count - 1].set_point_max_uV; in spmi_regulator_select_voltage()
683 dev_err(vreg->dev, in spmi_regulator_select_voltage()
684 "request v=[%d, %d] is outside possible v=[%d, %d]\n", in spmi_regulator_select_voltage()
686 return -EINVAL; in spmi_regulator_select_voltage()
690 for (i = vreg->set_points->count - 1; i > 0; i--) { in spmi_regulator_select_voltage()
691 range_max_uV = vreg->set_points->range[i - 1].set_point_max_uV; in spmi_regulator_select_voltage()
697 range = &vreg->set_points->range[range_id]; in spmi_regulator_select_voltage()
703 voltage_sel = DIV_ROUND_UP(uV - range->min_uV, range->step_uV); in spmi_regulator_select_voltage()
704 uV = voltage_sel * range->step_uV + range->min_uV; in spmi_regulator_select_voltage()
707 dev_err(vreg->dev, in spmi_regulator_select_voltage()
708 "request v=[%d, %d] cannot be met by any set point; " in spmi_regulator_select_voltage()
711 return -EINVAL; in spmi_regulator_select_voltage()
716 selector += vreg->set_points->range[i].n_voltages; in spmi_regulator_select_voltage()
717 selector += (uV - range->set_point_min_uV) / range->step_uV; in spmi_regulator_select_voltage()
729 range = vreg->set_points->range; in spmi_sw_selector_to_hw()
730 end = range + vreg->set_points->count; in spmi_sw_selector_to_hw()
733 if (selector < range->n_voltages) { in spmi_sw_selector_to_hw()
738 offset = range->set_point_min_uV - range->min_uV; in spmi_sw_selector_to_hw()
739 offset /= range->step_uV; in spmi_sw_selector_to_hw()
741 *range_sel = range->range_sel; in spmi_sw_selector_to_hw()
745 selector -= range->n_voltages; in spmi_sw_selector_to_hw()
748 return -EINVAL; in spmi_sw_selector_to_hw()
756 const struct spmi_voltage_range *r = vreg->set_points->range; in spmi_hw_selector_to_sw()
757 const struct spmi_voltage_range *end = r + vreg->set_points->count; in spmi_hw_selector_to_sw()
760 if (r == range && range->n_voltages) { in spmi_hw_selector_to_sw()
767 offset = range->set_point_min_uV - range->min_uV; in spmi_hw_selector_to_sw()
768 offset /= range->step_uV; in spmi_hw_selector_to_sw()
770 return -EINVAL; in spmi_hw_selector_to_sw()
772 max_hw_sel = range->set_point_max_uV - range->min_uV; in spmi_hw_selector_to_sw()
773 max_hw_sel /= range->step_uV; in spmi_hw_selector_to_sw()
775 return -EINVAL; in spmi_hw_selector_to_sw()
777 return sw_sel + hw_sel - offset; in spmi_hw_selector_to_sw()
779 sw_sel += r->n_voltages; in spmi_hw_selector_to_sw()
782 return -EINVAL; in spmi_hw_selector_to_sw()
791 range = vreg->set_points->range; in spmi_regulator_find_range()
792 end = range + vreg->set_points->count; in spmi_regulator_find_range()
797 if (range->range_sel == range_sel) in spmi_regulator_find_range()
814 if (uV < range->min_uV && max_uV >= range->min_uV) in spmi_regulator_select_voltage_same_range()
815 uV = range->min_uV; in spmi_regulator_select_voltage_same_range()
817 if (uV < range->min_uV || uV > range->max_uV) { in spmi_regulator_select_voltage_same_range()
826 uV = DIV_ROUND_UP(uV - range->min_uV, range->step_uV); in spmi_regulator_select_voltage_same_range()
827 uV = uV * range->step_uV + range->min_uV; in spmi_regulator_select_voltage_same_range()
838 for (i = 0; i < vreg->set_points->count; i++) { in spmi_regulator_select_voltage_same_range()
839 if (uV >= vreg->set_points->range[i].set_point_min_uV in spmi_regulator_select_voltage_same_range()
840 && uV <= vreg->set_points->range[i].set_point_max_uV) { in spmi_regulator_select_voltage_same_range()
842 (uV - vreg->set_points->range[i].set_point_min_uV) in spmi_regulator_select_voltage_same_range()
843 / vreg->set_points->range[i].step_uV; in spmi_regulator_select_voltage_same_range()
847 selector += vreg->set_points->range[i].n_voltages; in spmi_regulator_select_voltage_same_range()
850 if (selector >= vreg->set_points->n_voltages) in spmi_regulator_select_voltage_same_range()
911 diff_uV = abs(spmi_regulator_common_list_voltage(rdev, new_selector) - in spmi_regulator_set_voltage_time_sel()
914 return DIV_ROUND_UP(diff_uV, vreg->slew_rate); in spmi_regulator_set_voltage_time_sel()
927 return -EINVAL; in spmi_regulator_common_get_voltage()
942 range = vreg->set_points->range; in spmi_regulator_ftsmps426_get_voltage()
944 return (uV - range->set_point_min_uV) / range->step_uV; in spmi_regulator_ftsmps426_get_voltage()
996 * In case of range 1: voltage_sel is a 5 bit value, bits[7-5] set to in spmi_regulator_ult_lo_smps_set_voltage()
1016 return -EINVAL; in spmi_regulator_ult_lo_smps_get_voltage()
1018 if (range->range_sel == 1) in spmi_regulator_ult_lo_smps_get_voltage()
1031 if (selector >= vreg->set_points->n_voltages) in spmi_regulator_common_list_voltage()
1034 for (i = 0; i < vreg->set_points->count; i++) { in spmi_regulator_common_list_voltage()
1035 if (selector < vreg->set_points->range[i].n_voltages) { in spmi_regulator_common_list_voltage()
1036 uV = selector * vreg->set_points->range[i].step_uV in spmi_regulator_common_list_voltage()
1037 + vreg->set_points->range[i].set_point_min_uV; in spmi_regulator_common_list_voltage()
1041 selector -= vreg->set_points->range[i].n_voltages; in spmi_regulator_common_list_voltage()
1166 return -EINVAL; in spmi_regulator_ftsmps426_set_mode()
1187 val = vreg->logical_type == in spmi_regulator_hfsmps_set_mode()
1193 return -EINVAL; in spmi_regulator_hfsmps_set_mode()
1205 if (load_uA >= vreg->hpm_min_load) in spmi_regulator_common_set_load()
1243 enum spmi_regulator_logical_type type = vreg->logical_type; in spmi_regulator_set_ilim()
1256 return -EINVAL; in spmi_regulator_set_ilim()
1258 reg = (ilim_uA - 1) / 500; in spmi_regulator_set_ilim()
1271 vreg->vs_enable_time = ktime_get(); in spmi_regulator_vs_clear_ocp()
1296 vreg->vs_enable_time); in spmi_regulator_vs_ocp_isr()
1304 vreg->ocp_count = 0; in spmi_regulator_vs_ocp_isr()
1306 /* Wait for switch output to settle back to 0 V after OCP triggered. */ in spmi_regulator_vs_ocp_isr()
1309 vreg->ocp_count++; in spmi_regulator_vs_ocp_isr()
1311 if (vreg->ocp_count == 1) { in spmi_regulator_vs_ocp_isr()
1314 } else if (vreg->ocp_count <= vreg->ocp_max_retries) { in spmi_regulator_vs_ocp_isr()
1316 schedule_delayed_work(&vreg->ocp_work, in spmi_regulator_vs_ocp_isr()
1317 msecs_to_jiffies(vreg->ocp_retry_delay_ms) + 1); in spmi_regulator_vs_ocp_isr()
1319 dev_err(vreg->dev, in spmi_regulator_vs_ocp_isr()
1321 vreg->ocp_count); in spmi_regulator_vs_ocp_isr()
1379 avs_ctl |= ((pmic_sts - 4) << 10); in spmi_saw_set_vdd()
1398 dev_dbg(&rdev->dev, "range_sel = %02X voltage_sel = %02X", \ in spmi_regulator_saw_set_voltage()
1400 return -EINVAL; in spmi_regulator_saw_set_voltage()
1585 SPMI_VREG(LDO, HT_P600, 0, INF, HFS430, hfs430, ht_p600, 10000),
1586 SPMI_VREG(LDO, HT_P150, 0, INF, HFS430, hfs430, ht_p150, 10000),
1590 SPMI_VREG(LDO, N300, 0, INF, LDO, ldo, nldo1, 10000),
1591 SPMI_VREG(LDO, N600, 0, 0, LDO, ldo, nldo2, 10000),
1592 SPMI_VREG(LDO, N1200, 0, 0, LDO, ldo, nldo2, 10000),
1593 SPMI_VREG(LDO, N600, 1, INF, LDO, ldo, nldo3, 10000),
1594 SPMI_VREG(LDO, N1200, 1, INF, LDO, ldo, nldo3, 10000),
1595 SPMI_VREG(LDO, N600_ST, 0, 0, LDO, ldo, nldo2, 10000),
1596 SPMI_VREG(LDO, N1200_ST, 0, 0, LDO, ldo, nldo2, 10000),
1597 SPMI_VREG(LDO, N600_ST, 1, INF, LDO, ldo, nldo3, 10000),
1598 SPMI_VREG(LDO, N1200_ST, 1, INF, LDO, ldo, nldo3, 10000),
1599 SPMI_VREG(LDO, P50, 0, INF, LDO, ldo, pldo, 5000),
1600 SPMI_VREG(LDO, P150, 0, INF, LDO, ldo, pldo, 10000),
1601 SPMI_VREG(LDO, P300, 0, INF, LDO, ldo, pldo, 10000),
1602 SPMI_VREG(LDO, P600, 0, INF, LDO, ldo, pldo, 10000),
1603 SPMI_VREG(LDO, P1200, 0, INF, LDO, ldo, pldo, 10000),
1604 SPMI_VREG(LDO, LN, 0, INF, LN_LDO, ln_ldo, ln_ldo, 0),
1605 SPMI_VREG(LDO, LV_P50, 0, INF, LDO, ldo, pldo, 5000),
1606 SPMI_VREG(LDO, LV_P150, 0, INF, LDO, ldo, pldo, 10000),
1607 SPMI_VREG(LDO, LV_P300, 0, INF, LDO, ldo, pldo, 10000),
1608 SPMI_VREG(LDO, LV_P600, 0, INF, LDO, ldo, pldo, 10000),
1609 SPMI_VREG(LDO, LV_P1200, 0, INF, LDO, ldo, pldo, 10000),
1610 SPMI_VREG(LDO, HT_N300_ST, 0, INF, FTSMPS426, ftsmps426,
1612 SPMI_VREG(LDO, HT_N600_ST, 0, INF, FTSMPS426, ftsmps426,
1614 SPMI_VREG(LDO, HT_N1200_ST, 0, INF, FTSMPS426, ftsmps426,
1616 SPMI_VREG(LDO, HT_LVP150, 0, INF, FTSMPS426, ftsmps426,
1618 SPMI_VREG(LDO, HT_LVP300, 0, INF, FTSMPS426, ftsmps426,
1620 SPMI_VREG(LDO, L660_N300_ST, 0, INF, FTSMPS426, ftsmps426,
1622 SPMI_VREG(LDO, L660_N600_ST, 0, INF, FTSMPS426, ftsmps426,
1624 SPMI_VREG(LDO, L660_P50, 0, INF, FTSMPS426, ftsmps426,
1626 SPMI_VREG(LDO, L660_P150, 0, INF, FTSMPS426, ftsmps426,
1628 SPMI_VREG(LDO, L660_P600, 0, INF, FTSMPS426, ftsmps426,
1630 SPMI_VREG(LDO, L660_LVP150, 0, INF, FTSMPS426, ftsmps426,
1632 SPMI_VREG(LDO, L660_LVP600, 0, INF, FTSMPS426, ftsmps426,
1665 SPMI_VREG(LDO, LV_P150_510, 0, INF, LDO_510, hfsmps, ht_lvpldo, 10000),
1666 SPMI_VREG(LDO, LV_P300_510, 0, INF, LDO_510, hfsmps, ht_lvpldo, 10000),
1667 SPMI_VREG(LDO, LV_P600_510, 0, INF, LDO_510, hfsmps, ht_lvpldo, 10000),
1668 SPMI_VREG(LDO, MV_P50_510, 0, INF, LDO_510, hfsmps, pldo660, 10000),
1669 SPMI_VREG(LDO, MV_P150_510, 0, INF, LDO_510, hfsmps, pldo660, 10000),
1670 SPMI_VREG(LDO, MV_P600_510, 0, INF, LDO_510, hfsmps, pldo660, 10000),
1671 SPMI_VREG(LDO, N300_510, 0, INF, LDO_510, hfsmps, nldo_510, 10000),
1672 SPMI_VREG(LDO, N600_510, 0, INF, LDO_510, hfsmps, nldo_510, 10000),
1673 SPMI_VREG(LDO, N1200_510, 0, INF, LDO_510, hfsmps, nldo_510, 10000),
1680 struct spmi_voltage_range *range = points->range; in spmi_calculate_num_voltages()
1682 for (; range < points->range + points->count; range++) { in spmi_calculate_num_voltages()
1684 if (range->set_point_max_uV) { in spmi_calculate_num_voltages()
1685 n = range->set_point_max_uV - range->set_point_min_uV; in spmi_calculate_num_voltages()
1686 n = (n / range->step_uV) + 1; in spmi_calculate_num_voltages()
1688 range->n_voltages = n; in spmi_calculate_num_voltages()
1689 points->n_voltages += n; in spmi_calculate_num_voltages()
1698 u8 version[SPMI_COMMON_REG_SUBTYPE - SPMI_COMMON_REG_DIG_MAJOR_REV + 1]; in spmi_regulator_match()
1704 dev_dbg(vreg->dev, "could not read version registers\n"); in spmi_regulator_match()
1708 - SPMI_COMMON_REG_DIG_MAJOR_REV]; in spmi_regulator_match()
1711 type = version[SPMI_COMMON_REG_TYPE - in spmi_regulator_match()
1713 subtype = version[SPMI_COMMON_REG_SUBTYPE - in spmi_regulator_match()
1722 if (mapping->type == type && mapping->subtype == subtype in spmi_regulator_match()
1723 && mapping->revision_min <= dig_major_rev in spmi_regulator_match()
1724 && mapping->revision_max >= dig_major_rev) in spmi_regulator_match()
1728 dev_err(vreg->dev, in spmi_regulator_match()
1730 vreg->desc.name, type, subtype, dig_major_rev); in spmi_regulator_match()
1732 return -ENODEV; in spmi_regulator_match()
1735 vreg->logical_type = mapping->logical_type; in spmi_regulator_match()
1736 vreg->set_points = mapping->set_points; in spmi_regulator_match()
1737 vreg->hpm_min_load = mapping->hpm_min_load; in spmi_regulator_match()
1738 vreg->desc.ops = mapping->ops; in spmi_regulator_match()
1740 if (mapping->set_points) { in spmi_regulator_match()
1741 if (!mapping->set_points->n_voltages) in spmi_regulator_match()
1742 spmi_calculate_num_voltages(mapping->set_points); in spmi_regulator_match()
1743 vreg->desc.n_voltages = mapping->set_points->n_voltages; in spmi_regulator_match()
1758 dev_err(vreg->dev, "spmi read failed, ret=%d\n", ret); in spmi_regulator_init_slew_rate()
1764 return -EINVAL; in spmi_regulator_init_slew_rate()
1766 switch (vreg->logical_type) { in spmi_regulator_init_slew_rate()
1782 slew_rate = SPMI_FTSMPS_CLOCK_RATE * range->step_uV * (1 << step); in spmi_regulator_init_slew_rate()
1788 vreg->slew_rate = max(slew_rate, 1); in spmi_regulator_init_slew_rate()
1799 const struct spmi_voltage_range *range = &vreg->set_points->range[0]; in spmi_regulator_init_slew_rate_ftsmps426()
1803 dev_err(vreg->dev, "spmi read failed, ret=%d\n", ret); in spmi_regulator_init_slew_rate_ftsmps426()
1811 slew_rate = clock_rate * range->step_uV; in spmi_regulator_init_slew_rate_ftsmps426()
1817 vreg->slew_rate = max(slew_rate, 1); in spmi_regulator_init_slew_rate_ftsmps426()
1830 dev_err(vreg->dev, "spmi read failed, ret=%d\n", ret); in spmi_regulator_init_slew_rate_hfsmps()
1837 vreg->slew_rate = SPMI_HFSMPS_SLEW_RATE_38p4 >> delay; in spmi_regulator_init_slew_rate_hfsmps()
1849 type = vreg->logical_type; in spmi_regulator_init_registers()
1856 if (!(data->pin_ctrl_enable & SPMI_REGULATOR_PIN_CTRL_ENABLE_HW_DEFAULT)) { in spmi_regulator_init_registers()
1864 data->pin_ctrl_enable & SPMI_COMMON_ENABLE_FOLLOW_ALL_MASK; in spmi_regulator_init_registers()
1872 if (!(data->pin_ctrl_hpm & SPMI_REGULATOR_PIN_CTRL_HPM_HW_DEFAULT)) { in spmi_regulator_init_registers()
1879 data->pin_ctrl_hpm & SPMI_COMMON_MODE_FOLLOW_ALL_MASK; in spmi_regulator_init_registers()
1888 data->pin_ctrl_hpm & SPMI_COMMON_MODE_FOLLOW_AWAKE_MASK; in spmi_regulator_init_registers()
1902 if (data->vs_soft_start_strength in spmi_regulator_init_registers()
1904 reg = data->vs_soft_start_strength in spmi_regulator_init_registers()
1923 data->pin_ctrl_enable = SPMI_REGULATOR_PIN_CTRL_ENABLE_HW_DEFAULT; in spmi_regulator_get_dt_config()
1924 data->pin_ctrl_hpm = SPMI_REGULATOR_PIN_CTRL_HPM_HW_DEFAULT; in spmi_regulator_get_dt_config()
1925 data->vs_soft_start_strength = SPMI_VS_SOFT_START_STR_HW_DEFAULT; in spmi_regulator_get_dt_config()
1928 of_property_read_u32(node, "qcom,ocp-max-retries", in spmi_regulator_get_dt_config()
1929 &vreg->ocp_max_retries); in spmi_regulator_get_dt_config()
1930 of_property_read_u32(node, "qcom,ocp-retry-delay", in spmi_regulator_get_dt_config()
1931 &vreg->ocp_retry_delay_ms); in spmi_regulator_get_dt_config()
1932 of_property_read_u32(node, "qcom,pin-ctrl-enable", in spmi_regulator_get_dt_config()
1933 &data->pin_ctrl_enable); in spmi_regulator_get_dt_config()
1934 of_property_read_u32(node, "qcom,pin-ctrl-hpm", &data->pin_ctrl_hpm); in spmi_regulator_get_dt_config()
1935 of_property_read_u32(node, "qcom,vs-soft-start-strength", in spmi_regulator_get_dt_config()
1936 &data->vs_soft_start_strength); in spmi_regulator_get_dt_config()
1954 struct spmi_regulator *vreg = config->driver_data; in spmi_regulator_of_parse()
1955 struct device *dev = config->dev; in spmi_regulator_of_parse()
1960 if (!vreg->ocp_max_retries) in spmi_regulator_of_parse()
1961 vreg->ocp_max_retries = SPMI_VS_OCP_DEFAULT_MAX_RETRIES; in spmi_regulator_of_parse()
1962 if (!vreg->ocp_retry_delay_ms) in spmi_regulator_of_parse()
1963 vreg->ocp_retry_delay_ms = SPMI_VS_OCP_DEFAULT_RETRY_DELAY_MS; in spmi_regulator_of_parse()
1971 switch (vreg->logical_type) { in spmi_regulator_of_parse()
2002 if (vreg->logical_type != SPMI_REGULATOR_LOGICAL_TYPE_VS) in spmi_regulator_of_parse()
2003 vreg->ocp_irq = 0; in spmi_regulator_of_parse()
2005 if (vreg->ocp_irq) { in spmi_regulator_of_parse()
2006 ret = devm_request_irq(dev, vreg->ocp_irq, in spmi_regulator_of_parse()
2011 vreg->ocp_irq, ret); in spmi_regulator_of_parse()
2015 ret = devm_delayed_work_autocancel(dev, &vreg->ocp_work, in spmi_regulator_of_parse()
2307 { "5vs1", 0x8300, "vin_5vs", "ocp-5vs1", },
2308 { "5vs2", 0x8400, "vin_5vs", "ocp-5vs2", },
2479 { .compatible = "qcom,pm6125-regulators", .data = &pm6125_regulators },
2480 { .compatible = "qcom,pm660-regulators", .data = &pm660_regulators },
2481 { .compatible = "qcom,pm660l-regulators", .data = &pm660l_regulators },
2482 { .compatible = "qcom,pm8004-regulators", .data = &pm8004_regulators },
2483 { .compatible = "qcom,pm8005-regulators", .data = &pm8005_regulators },
2484 { .compatible = "qcom,pm8019-regulators", .data = &pm8019_regulators },
2485 { .compatible = "qcom,pm8226-regulators", .data = &pm8226_regulators },
2486 { .compatible = "qcom,pm8841-regulators", .data = &pm8841_regulators },
2487 { .compatible = "qcom,pm8909-regulators", .data = &pm8909_regulators },
2488 { .compatible = "qcom,pm8916-regulators", .data = &pm8916_regulators },
2489 { .compatible = "qcom,pm8937-regulators", .data = &pm8937_regulators },
2490 { .compatible = "qcom,pm8941-regulators", .data = &pm8941_regulators },
2491 { .compatible = "qcom,pm8950-regulators", .data = &pm8950_regulators },
2492 { .compatible = "qcom,pm8994-regulators", .data = &pm8994_regulators },
2493 { .compatible = "qcom,pma8084-regulators", .data = &pma8084_regulators },
2494 { .compatible = "qcom,pmi8994-regulators", .data = &pmi8994_regulators },
2495 { .compatible = "qcom,pmp8074-regulators", .data = &pmp8074_regulators },
2496 { .compatible = "qcom,pms405-regulators", .data = &pms405_regulators },
2510 struct device *dev = &pdev->dev; in qcom_spmi_regulator_probe()
2511 struct device_node *node = pdev->dev.of_node; in qcom_spmi_regulator_probe()
2519 return -ENOMEM; in qcom_spmi_regulator_probe()
2523 regmap = dev_get_regmap(dev->parent, NULL); in qcom_spmi_regulator_probe()
2525 return -ENODEV; in qcom_spmi_regulator_probe()
2527 reg = device_get_match_data(&pdev->dev); in qcom_spmi_regulator_probe()
2529 return -ENODEV; in qcom_spmi_regulator_probe()
2531 syscon = of_parse_phandle(node, "qcom,saw-reg", 0); in qcom_spmi_regulator_probe()
2539 for (; reg->name; reg++) { in qcom_spmi_regulator_probe()
2542 reg_node = of_get_child_by_name(node, reg->name); in qcom_spmi_regulator_probe()
2543 reg_prop = of_find_property(reg_node, "qcom,saw-slave", in qcom_spmi_regulator_probe()
2552 return -ENOMEM; in qcom_spmi_regulator_probe()
2554 vreg->dev = dev; in qcom_spmi_regulator_probe()
2555 vreg->base = reg->base; in qcom_spmi_regulator_probe()
2556 vreg->regmap = regmap; in qcom_spmi_regulator_probe()
2557 if (reg->ocp) { in qcom_spmi_regulator_probe()
2558 vreg->ocp_irq = platform_get_irq_byname(pdev, reg->ocp); in qcom_spmi_regulator_probe()
2559 if (vreg->ocp_irq < 0) in qcom_spmi_regulator_probe()
2560 return vreg->ocp_irq; in qcom_spmi_regulator_probe()
2562 vreg->desc.id = -1; in qcom_spmi_regulator_probe()
2563 vreg->desc.owner = THIS_MODULE; in qcom_spmi_regulator_probe()
2564 vreg->desc.type = REGULATOR_VOLTAGE; in qcom_spmi_regulator_probe()
2565 vreg->desc.enable_reg = reg->base + SPMI_COMMON_REG_ENABLE; in qcom_spmi_regulator_probe()
2566 vreg->desc.enable_mask = SPMI_COMMON_ENABLE_MASK; in qcom_spmi_regulator_probe()
2567 vreg->desc.enable_val = SPMI_COMMON_ENABLE; in qcom_spmi_regulator_probe()
2568 vreg->desc.name = name = reg->name; in qcom_spmi_regulator_probe()
2569 vreg->desc.supply_name = reg->supply; in qcom_spmi_regulator_probe()
2570 vreg->desc.of_match = reg->name; in qcom_spmi_regulator_probe()
2571 vreg->desc.of_parse_cb = spmi_regulator_of_parse; in qcom_spmi_regulator_probe()
2572 vreg->desc.of_map_mode = spmi_regulator_of_map_mode; in qcom_spmi_regulator_probe()
2574 ret = spmi_regulator_match(vreg, reg->force_type); in qcom_spmi_regulator_probe()
2579 reg_node = of_get_child_by_name(node, reg->name); in qcom_spmi_regulator_probe()
2580 if (of_property_read_bool(reg_node, "qcom,saw-leader")) { in qcom_spmi_regulator_probe()
2581 spmi_saw_ops = *(vreg->desc.ops); in qcom_spmi_regulator_probe()
2584 vreg->desc.ops = &spmi_saw_ops; in qcom_spmi_regulator_probe()
2589 if (vreg->set_points && vreg->set_points->count == 1) { in qcom_spmi_regulator_probe()
2591 range = vreg->set_points->range; in qcom_spmi_regulator_probe()
2592 vreg->desc.uV_step = range->step_uV; in qcom_spmi_regulator_probe()
2598 rdev = devm_regulator_register(dev, &vreg->desc, &config); in qcom_spmi_regulator_probe()
2604 INIT_LIST_HEAD(&vreg->node); in qcom_spmi_regulator_probe()
2605 list_add(&vreg->node, vreg_list); in qcom_spmi_regulator_probe()
2613 .name = "qcom-spmi-regulator",
2623 MODULE_ALIAS("platform:qcom-spmi-regulator");