fan53880.c (762f99f4f3cb41a775b5157dd761217beba65873) | fan53880.c (c4b02c92d9673ef4704fd0c8f008fec183517b64) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2#include <linux/module.h> 3#include <linux/i2c.h> 4#include <linux/regmap.h> 5#include <linux/regulator/driver.h> 6 7enum fan53880_regulator_ids { 8 FAN53880_LDO1, --- 28 unchanged lines hidden (view full) --- 37 .enable = regulator_enable_regmap, 38 .disable = regulator_disable_regmap, 39 .is_enabled = regulator_is_enabled_regmap, 40}; 41 42#define FAN53880_LDO(_num, _supply, _default) \ 43 [FAN53880_LDO ## _num] = { \ 44 .name = "LDO"#_num, \ | 1// SPDX-License-Identifier: GPL-2.0+ 2#include <linux/module.h> 3#include <linux/i2c.h> 4#include <linux/regmap.h> 5#include <linux/regulator/driver.h> 6 7enum fan53880_regulator_ids { 8 FAN53880_LDO1, --- 28 unchanged lines hidden (view full) --- 37 .enable = regulator_enable_regmap, 38 .disable = regulator_disable_regmap, 39 .is_enabled = regulator_is_enabled_regmap, 40}; 41 42#define FAN53880_LDO(_num, _supply, _default) \ 43 [FAN53880_LDO ## _num] = { \ 44 .name = "LDO"#_num, \ |
45 .of_match = of_match_ptr("LDO"#_num), \ 46 .regulators_node = of_match_ptr("regulators"), \ | 45 .of_match = "LDO"#_num, \ 46 .regulators_node = "regulators", \ |
47 .type = REGULATOR_VOLTAGE, \ 48 .owner = THIS_MODULE, \ 49 .linear_ranges = (struct linear_range[]) { \ 50 REGULATOR_LINEAR_RANGE(_default, 0x0, 0x0, 0), \ 51 REGULATOR_LINEAR_RANGE(800000, 0xf, 0x73, 25000), \ 52 }, \ 53 .n_linear_ranges = 2, \ 54 .n_voltages = 0x74, \ --- 8 unchanged lines hidden (view full) --- 63 64static const struct regulator_desc fan53880_regulators[] = { 65 FAN53880_LDO(1, "VIN12", 2800000), 66 FAN53880_LDO(2, "VIN12", 2800000), 67 FAN53880_LDO(3, "VIN3", 1800000), 68 FAN53880_LDO(4, "VIN4", 1800000), 69 [FAN53880_BUCK] = { 70 .name = "BUCK", | 47 .type = REGULATOR_VOLTAGE, \ 48 .owner = THIS_MODULE, \ 49 .linear_ranges = (struct linear_range[]) { \ 50 REGULATOR_LINEAR_RANGE(_default, 0x0, 0x0, 0), \ 51 REGULATOR_LINEAR_RANGE(800000, 0xf, 0x73, 25000), \ 52 }, \ 53 .n_linear_ranges = 2, \ 54 .n_voltages = 0x74, \ --- 8 unchanged lines hidden (view full) --- 63 64static const struct regulator_desc fan53880_regulators[] = { 65 FAN53880_LDO(1, "VIN12", 2800000), 66 FAN53880_LDO(2, "VIN12", 2800000), 67 FAN53880_LDO(3, "VIN3", 1800000), 68 FAN53880_LDO(4, "VIN4", 1800000), 69 [FAN53880_BUCK] = { 70 .name = "BUCK", |
71 .of_match = of_match_ptr("BUCK"), 72 .regulators_node = of_match_ptr("regulators"), | 71 .of_match = "BUCK", 72 .regulators_node = "regulators", |
73 .type = REGULATOR_VOLTAGE, 74 .owner = THIS_MODULE, 75 .linear_ranges = (struct linear_range[]) { 76 REGULATOR_LINEAR_RANGE(1100000, 0x0, 0x0, 0), 77 REGULATOR_LINEAR_RANGE(600000, 0x1f, 0xf7, 12500), 78 }, 79 .n_linear_ranges = 2, 80 .n_voltages = 0xf8, 81 .vsel_reg = FAN53880_BUCKVOUT, 82 .vsel_mask = 0xff, 83 .enable_reg = FAN53880_ENABLE, 84 .enable_mask = 0x10, 85 .enable_time = 480, 86 .supply_name = "PVIN", 87 .ops = &fan53880_ops, 88 }, 89 [FAN53880_BOOST] = { 90 .name = "BOOST", | 73 .type = REGULATOR_VOLTAGE, 74 .owner = THIS_MODULE, 75 .linear_ranges = (struct linear_range[]) { 76 REGULATOR_LINEAR_RANGE(1100000, 0x0, 0x0, 0), 77 REGULATOR_LINEAR_RANGE(600000, 0x1f, 0xf7, 12500), 78 }, 79 .n_linear_ranges = 2, 80 .n_voltages = 0xf8, 81 .vsel_reg = FAN53880_BUCKVOUT, 82 .vsel_mask = 0xff, 83 .enable_reg = FAN53880_ENABLE, 84 .enable_mask = 0x10, 85 .enable_time = 480, 86 .supply_name = "PVIN", 87 .ops = &fan53880_ops, 88 }, 89 [FAN53880_BOOST] = { 90 .name = "BOOST", |
91 .of_match = of_match_ptr("BOOST"), 92 .regulators_node = of_match_ptr("regulators"), | 91 .of_match = "BOOST", 92 .regulators_node = "regulators", |
93 .type = REGULATOR_VOLTAGE, 94 .owner = THIS_MODULE, 95 .linear_ranges = (struct linear_range[]) { 96 REGULATOR_LINEAR_RANGE(5000000, 0x0, 0x0, 0), 97 REGULATOR_LINEAR_RANGE(3000000, 0x4, 0x70, 25000), 98 }, 99 .n_linear_ranges = 2, 100 .n_voltages = 0x71, --- 51 unchanged lines hidden (view full) --- 152 fan53880_regulators[i].name, ret); 153 return ret; 154 } 155 } 156 157 return 0; 158} 159 | 93 .type = REGULATOR_VOLTAGE, 94 .owner = THIS_MODULE, 95 .linear_ranges = (struct linear_range[]) { 96 REGULATOR_LINEAR_RANGE(5000000, 0x0, 0x0, 0), 97 REGULATOR_LINEAR_RANGE(3000000, 0x4, 0x70, 25000), 98 }, 99 .n_linear_ranges = 2, 100 .n_voltages = 0x71, --- 51 unchanged lines hidden (view full) --- 152 fan53880_regulators[i].name, ret); 153 return ret; 154 } 155 } 156 157 return 0; 158} 159 |
160#ifdef CONFIG_OF | |
161static const struct of_device_id fan53880_dt_ids[] = { 162 { .compatible = "onnn,fan53880", }, 163 {} 164}; 165MODULE_DEVICE_TABLE(of, fan53880_dt_ids); | 160static const struct of_device_id fan53880_dt_ids[] = { 161 { .compatible = "onnn,fan53880", }, 162 {} 163}; 164MODULE_DEVICE_TABLE(of, fan53880_dt_ids); |
166#endif | |
167 168static const struct i2c_device_id fan53880_i2c_id[] = { 169 { "fan53880", }, 170 {} 171}; 172MODULE_DEVICE_TABLE(i2c, fan53880_i2c_id); 173 174static struct i2c_driver fan53880_regulator_driver = { 175 .driver = { 176 .name = "fan53880", | 165 166static const struct i2c_device_id fan53880_i2c_id[] = { 167 { "fan53880", }, 168 {} 169}; 170MODULE_DEVICE_TABLE(i2c, fan53880_i2c_id); 171 172static struct i2c_driver fan53880_regulator_driver = { 173 .driver = { 174 .name = "fan53880", |
177 .of_match_table = of_match_ptr(fan53880_dt_ids), | 175 .of_match_table = fan53880_dt_ids, |
178 }, 179 .probe_new = fan53880_i2c_probe, 180 .id_table = fan53880_i2c_id, 181}; 182module_i2c_driver(fan53880_regulator_driver); 183 184MODULE_DESCRIPTION("FAN53880 PMIC voltage regulator driver"); 185MODULE_AUTHOR("Christoph Fritz <chf.fritz@googlemail.com>"); 186MODULE_LICENSE("GPL"); | 176 }, 177 .probe_new = fan53880_i2c_probe, 178 .id_table = fan53880_i2c_id, 179}; 180module_i2c_driver(fan53880_regulator_driver); 181 182MODULE_DESCRIPTION("FAN53880 PMIC voltage regulator driver"); 183MODULE_AUTHOR("Christoph Fritz <chf.fritz@googlemail.com>"); 184MODULE_LICENSE("GPL"); |