Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branches 'regulator/topic/rn5t618', 'regulator/topic/rpm', 'regulator/topic/rt5033', 'regulator/topic/s2mpa01' and 'regulator/topic/s2mps11' into regulator-next

+157 -49
+8
drivers/regulator/Kconfig
··· 521 521 help 522 522 Say y here to support the regulators found on Ricoh RN5T618 PMIC. 523 523 524 + config REGULATOR_RT5033 525 + tristate "Richtek RT5033 Regulators" 526 + depends on MFD_RT5033 527 + help 528 + This adds support for voltage and current regulators in Richtek 529 + RT5033 PMIC. The device supports multiple regulators like 530 + current source, LDO and Buck. 531 + 524 532 config REGULATOR_S2MPA01 525 533 tristate "Samsung S2MPA01 voltage regulator" 526 534 depends on MFD_SEC_CORE
+1
drivers/regulator/Makefile
··· 69 69 obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o 70 70 obj-$(CONFIG_REGULATOR_RK808) += rk808-regulator.o 71 71 obj-$(CONFIG_REGULATOR_RN5T618) += rn5t618-regulator.o 72 + obj-$(CONFIG_REGULATOR_RT5033) += rt5033-regulator.o 72 73 obj-$(CONFIG_REGULATOR_S2MPA01) += s2mpa01.o 73 74 obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o 74 75 obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
+19
drivers/regulator/qcom_rpm-regulator.c
··· 183 183 REGULATOR_LINEAR_RANGE(1500000, 64, 100, 50000), 184 184 }; 185 185 186 + static const struct regulator_linear_range smb208_ranges[] = { 187 + REGULATOR_LINEAR_RANGE( 375000, 0, 29, 12500), 188 + REGULATOR_LINEAR_RANGE( 750000, 30, 89, 12500), 189 + REGULATOR_LINEAR_RANGE(1500000, 90, 153, 25000), 190 + REGULATOR_LINEAR_RANGE(3100000, 154, 234, 25000), 191 + }; 192 + 186 193 static const struct regulator_linear_range ncp_ranges[] = { 187 194 REGULATOR_LINEAR_RANGE(1500000, 0, 31, 50000), 188 195 }; ··· 566 559 .parts = &rpm8960_switch_parts, 567 560 }; 568 561 562 + static const struct qcom_rpm_reg smb208_smps = { 563 + .desc.linear_ranges = smb208_ranges, 564 + .desc.n_linear_ranges = ARRAY_SIZE(smb208_ranges), 565 + .desc.n_voltages = 235, 566 + .desc.ops = &uV_ops, 567 + .parts = &rpm8960_smps_parts, 568 + .supports_force_mode_auto = false, 569 + .supports_force_mode_bypass = false, 570 + }; 571 + 569 572 static const struct of_device_id rpm_of_match[] = { 570 573 { .compatible = "qcom,rpm-pm8058-pldo", .data = &pm8058_pldo }, 571 574 { .compatible = "qcom,rpm-pm8058-nldo", .data = &pm8058_nldo }, ··· 595 578 { .compatible = "qcom,rpm-pm8921-ftsmps", .data = &pm8921_ftsmps }, 596 579 { .compatible = "qcom,rpm-pm8921-ncp", .data = &pm8921_ncp }, 597 580 { .compatible = "qcom,rpm-pm8921-switch", .data = &pm8921_switch }, 581 + 582 + { .compatible = "qcom,rpm-smb208", .data = &smb208_smps }, 598 583 { } 599 584 }; 600 585 MODULE_DEVICE_TABLE(of, rpm_of_match);
+4 -47
drivers/regulator/rn5t618-regulator.c
··· 31 31 #define REG(rid, ereg, emask, vreg, vmask, min, max, step) \ 32 32 [RN5T618_##rid] = { \ 33 33 .name = #rid, \ 34 + .of_match = of_match_ptr(#rid), \ 35 + .regulators_node = of_match_ptr("regulators"), \ 34 36 .id = RN5T618_##rid, \ 35 37 .type = REGULATOR_VOLTAGE, \ 36 38 .owner = THIS_MODULE, \ ··· 62 60 REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000), 63 61 }; 64 62 65 - static struct of_regulator_match rn5t618_matches[] = { 66 - [RN5T618_DCDC1] = { .name = "DCDC1" }, 67 - [RN5T618_DCDC2] = { .name = "DCDC2" }, 68 - [RN5T618_DCDC3] = { .name = "DCDC3" }, 69 - [RN5T618_LDO1] = { .name = "LDO1" }, 70 - [RN5T618_LDO2] = { .name = "LDO2" }, 71 - [RN5T618_LDO3] = { .name = "LDO3" }, 72 - [RN5T618_LDO4] = { .name = "LDO4" }, 73 - [RN5T618_LDO5] = { .name = "LDO5" }, 74 - [RN5T618_LDORTC1] = { .name = "LDORTC1" }, 75 - [RN5T618_LDORTC2] = { .name = "LDORTC2" }, 76 - }; 77 - 78 - static int rn5t618_regulator_parse_dt(struct platform_device *pdev) 79 - { 80 - struct device_node *np, *regulators; 81 - int ret; 82 - 83 - np = of_node_get(pdev->dev.parent->of_node); 84 - if (!np) 85 - return 0; 86 - 87 - regulators = of_get_child_by_name(np, "regulators"); 88 - if (!regulators) { 89 - dev_err(&pdev->dev, "regulators node not found\n"); 90 - return -EINVAL; 91 - } 92 - 93 - ret = of_regulator_match(&pdev->dev, regulators, rn5t618_matches, 94 - ARRAY_SIZE(rn5t618_matches)); 95 - of_node_put(regulators); 96 - if (ret < 0) { 97 - dev_err(&pdev->dev, "error parsing regulator init data: %d\n", 98 - ret); 99 - } 100 - 101 - return 0; 102 - } 103 - 104 63 static int rn5t618_regulator_probe(struct platform_device *pdev) 105 64 { 106 65 struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent); 107 66 struct regulator_config config = { }; 108 67 struct regulator_dev *rdev; 109 - int ret, i; 110 - 111 - ret = rn5t618_regulator_parse_dt(pdev); 112 - if (ret) 113 - return ret; 68 + int i; 114 69 115 70 for (i = 0; i < RN5T618_REG_NUM; i++) { 116 - config.dev = &pdev->dev; 117 - config.init_data = rn5t618_matches[i].init_data; 118 - config.of_node = rn5t618_matches[i].of_node; 71 + config.dev = pdev->dev.parent; 119 72 config.regmap = rn5t618->regmap; 120 73 121 74 rdev = devm_regulator_register(&pdev->dev,
+123
drivers/regulator/rt5033-regulator.c
··· 1 + /* 2 + * Regulator driver for the Richtek RT5033 3 + * 4 + * Copyright (C) 2014 Samsung Electronics, Co., Ltd. 5 + * Author: Beomho Seo <beomho.seo@samsung.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published bythe Free Software Foundation. 10 + */ 11 + 12 + #include <linux/module.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/regulator/driver.h> 15 + #include <linux/mfd/rt5033.h> 16 + #include <linux/mfd/rt5033-private.h> 17 + #include <linux/regulator/of_regulator.h> 18 + 19 + static struct regulator_ops rt5033_safe_ldo_ops = { 20 + .is_enabled = regulator_is_enabled_regmap, 21 + .enable = regulator_enable_regmap, 22 + .disable = regulator_disable_regmap, 23 + .list_voltage = regulator_list_voltage_linear, 24 + }; 25 + 26 + static struct regulator_ops rt5033_buck_ops = { 27 + .is_enabled = regulator_is_enabled_regmap, 28 + .enable = regulator_enable_regmap, 29 + .disable = regulator_disable_regmap, 30 + .list_voltage = regulator_list_voltage_linear, 31 + .map_voltage = regulator_map_voltage_linear, 32 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 33 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 34 + }; 35 + 36 + static const struct regulator_desc rt5033_supported_regulators[] = { 37 + [RT5033_BUCK] = { 38 + .name = "BUCK", 39 + .id = RT5033_BUCK, 40 + .ops = &rt5033_buck_ops, 41 + .type = REGULATOR_VOLTAGE, 42 + .owner = THIS_MODULE, 43 + .n_voltages = RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM, 44 + .min_uV = RT5033_REGULATOR_BUCK_VOLTAGE_MIN, 45 + .uV_step = RT5033_REGULATOR_BUCK_VOLTAGE_STEP, 46 + .enable_reg = RT5033_REG_CTRL, 47 + .enable_mask = RT5033_CTRL_EN_BUCK_MASK, 48 + .vsel_reg = RT5033_REG_BUCK_CTRL, 49 + .vsel_mask = RT5033_BUCK_CTRL_MASK, 50 + }, 51 + [RT5033_LDO] = { 52 + .name = "LDO", 53 + .id = RT5033_LDO, 54 + .ops = &rt5033_buck_ops, 55 + .type = REGULATOR_VOLTAGE, 56 + .owner = THIS_MODULE, 57 + .n_voltages = RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM, 58 + .min_uV = RT5033_REGULATOR_LDO_VOLTAGE_MIN, 59 + .uV_step = RT5033_REGULATOR_LDO_VOLTAGE_STEP, 60 + .enable_reg = RT5033_REG_CTRL, 61 + .enable_mask = RT5033_CTRL_EN_LDO_MASK, 62 + .vsel_reg = RT5033_REG_LDO_CTRL, 63 + .vsel_mask = RT5033_LDO_CTRL_MASK, 64 + }, 65 + [RT5033_SAFE_LDO] = { 66 + .name = "SAFE_LDO", 67 + .id = RT5033_SAFE_LDO, 68 + .ops = &rt5033_safe_ldo_ops, 69 + .type = REGULATOR_VOLTAGE, 70 + .owner = THIS_MODULE, 71 + .n_voltages = 1, 72 + .min_uV = RT5033_REGULATOR_SAFE_LDO_VOLTAGE, 73 + .enable_reg = RT5033_REG_CTRL, 74 + .enable_mask = RT5033_CTRL_EN_SAFE_LDO_MASK, 75 + }, 76 + }; 77 + 78 + static int rt5033_regulator_probe(struct platform_device *pdev) 79 + { 80 + struct rt5033_dev *rt5033 = dev_get_drvdata(pdev->dev.parent); 81 + int ret, i; 82 + struct regulator_config config = {}; 83 + 84 + config.dev = &pdev->dev; 85 + config.driver_data = rt5033; 86 + 87 + for (i = 0; i < ARRAY_SIZE(rt5033_supported_regulators); i++) { 88 + struct regulator_dev *regulator; 89 + 90 + config.regmap = rt5033->regmap; 91 + 92 + regulator = devm_regulator_register(&pdev->dev, 93 + &rt5033_supported_regulators[i], &config); 94 + if (IS_ERR(regulator)) { 95 + ret = PTR_ERR(regulator); 96 + dev_err(&pdev->dev, 97 + "Regulator init failed %d: with error: %d\n", 98 + i, ret); 99 + return ret; 100 + } 101 + } 102 + 103 + return 0; 104 + } 105 + 106 + static const struct platform_device_id rt5033_regulator_id[] = { 107 + { "rt5033-regulator", }, 108 + { } 109 + }; 110 + MODULE_DEVICE_TABLE(platform, rt5033_regulator_id); 111 + 112 + static struct platform_driver rt5033_regulator_driver = { 113 + .driver = { 114 + .name = "rt5033-regulator", 115 + }, 116 + .probe = rt5033_regulator_probe, 117 + .id_table = rt5033_regulator_id, 118 + }; 119 + module_platform_driver(rt5033_regulator_driver); 120 + 121 + MODULE_DESCRIPTION("Richtek RT5033 Regulator driver"); 122 + MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>"); 123 + MODULE_LICENSE("GPL");
+1 -1
drivers/regulator/s2mpa01.c
··· 298 298 .enable_mask = S2MPA01_ENABLE_MASK \ 299 299 } 300 300 301 - static struct regulator_desc regulators[] = { 301 + static const struct regulator_desc regulators[] = { 302 302 regulator_desc_ldo(1, STEP_25_MV), 303 303 regulator_desc_ldo(2, STEP_50_MV), 304 304 regulator_desc_ldo(3, STEP_50_MV),
+1 -1
drivers/regulator/s2mps11.c
··· 845 845 return -EINVAL; 846 846 }; 847 847 848 - s2mps11->ext_control_gpio = devm_kzalloc(&pdev->dev, 848 + s2mps11->ext_control_gpio = devm_kmalloc(&pdev->dev, 849 849 sizeof(*s2mps11->ext_control_gpio) * s2mps11->rdev_num, 850 850 GFP_KERNEL); 851 851 if (!s2mps11->ext_control_gpio)