23 #include <linux/kernel.h>
24 #include <linux/slab.h>
27 #include <linux/module.h>
49 static int mc13xxx_regulator_disable(
struct regulator_dev *rdev)
66 static int mc13xxx_regulator_is_enabled(
struct regulator_dev *rdev)
80 return (val & mc13xxx_regulators[
id].
enable_bit) != 0;
83 static int mc13xxx_regulator_set_voltage_sel(
struct regulator_dev *rdev,
94 selector << mc13xxx_regulators[
id].
vsel_shift);
100 static int mc13xxx_regulator_get_voltage(
struct regulator_dev *rdev)
111 mc13xxx_regulators[
id].
vsel_reg, &val);
122 BUG_ON(val >= mc13xxx_regulators[
id].
desc.n_voltages);
124 return rdev->
desc->volt_table[
val];
128 .enable = mc13xxx_regulator_enable,
129 .disable = mc13xxx_regulator_disable,
130 .is_enabled = mc13xxx_regulator_is_enabled,
132 .set_voltage_sel = mc13xxx_regulator_set_voltage_sel,
133 .get_voltage = mc13xxx_regulator_get_voltage,
143 __func__,
id, min_uV, max_uV);
145 if (min_uV <= rdev->
desc->volt_table[0] &&
146 rdev->
desc->volt_table[0] <= max_uV) {
156 .enable = mc13xxx_regulator_enable,
157 .disable = mc13xxx_regulator_disable,
158 .is_enabled = mc13xxx_regulator_is_enabled,
170 of_node_get(pdev->
dev.parent->of_node);
191 of_node_get(pdev->dev.parent->of_node);
203 for (i = 0; i < num_regulators; i++) {
204 if (!of_node_cmp(child->
name,
205 regulators[i].desc.name)) {