• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/regulator/

Lines Matching refs:regulator

24 #include <linux/regulator/consumer.h>
25 #include <linux/regulator/driver.h>
26 #include <linux/regulator/machine.h>
46 struct regulator_dev *regulator;
50 * struct regulator
54 struct regulator {
83 /* gets the regulator for a given consumer device */
84 static struct regulator *get_device_regulator(struct device *dev)
86 struct regulator *regulator = NULL;
92 list_for_each_entry(regulator, &rdev->consumer_list, list) {
93 if (regulator->dev == dev) {
96 return regulator;
192 /* dynamic regulator mode switching constraint check */
211 struct regulator *regulator;
213 regulator = get_device_regulator(dev);
214 if (regulator == NULL)
217 return sprintf(buf, "%d\n", regulator->uA_load);
392 struct regulator *regulator;
396 list_for_each_entry(regulator, &rdev->consumer_list, list)
397 uA += regulator->uA_load;
523 * Other attributes are a function of regulator functionality.
539 .name = "regulator",
544 /* Calculate the new optimum regulator operating mode based on the new total
548 struct regulator *sibling;
574 /* now get the optimum mode for our new total regulator load */
715 printk(KERN_INFO "regulator: %s: %s\n", rdev_get_name(rdev), buf);
741 * the actual range supported by this regulator.
793 /* use regulator's subset of machine constraints */
812 * set_machine_constraints - sets regulator constraints
813 * @rdev: regulator source
817 * regulator circuits e.g. valid voltage/current ranges, etc. NOTE:
819 * regulator operations to proceed i.e. set_voltage, set_current_limit,
865 /* If the constraints say the regulator should be on at this point
884 * set_supply - set regulator supply regulator
885 * @rdev: regulator name
886 * @supply_rdev: supply regulator name
888 * Called by platform initialisation code to set the supply regulator for this
889 * regulator. This ensures that a regulators supply will also be enabled by the
912 * set_consumer_device_supply: Bind a regulator to a symbolic supply
913 * @rdev: regulator source
918 * Allows platform initialisation code to map physical regulator
921 * need to provide board-specific regulator names as platform data.
958 dev_name(&node->regulator->dev),
959 node->regulator->desc->name,
969 node->regulator = rdev;
989 if (rdev == node->regulator) {
999 static struct regulator *create_regulator(struct regulator_dev *rdev,
1003 struct regulator *regulator;
1007 regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
1008 if (regulator == NULL)
1012 regulator->rdev = rdev;
1013 list_add(&regulator->list, &rdev->consumer_list);
1022 regulator->dev = dev;
1023 sysfs_attr_init(&regulator->dev_attr.attr);
1024 regulator->dev_attr.attr.name = kstrdup(buf, GFP_KERNEL);
1025 if (regulator->dev_attr.attr.name == NULL)
1028 regulator->dev_attr.attr.mode = 0444;
1029 regulator->dev_attr.show = device_requested_uA_show;
1030 err = device_create_file(dev, &regulator->dev_attr);
1043 regulator->supply_name = kstrdup(buf, GFP_KERNEL);
1044 if (regulator->supply_name == NULL)
1053 device_remove_file(dev, &regulator->dev_attr);
1058 return regulator;
1060 kfree(regulator->supply_name);
1062 device_remove_file(regulator->dev, &regulator->dev_attr);
1064 kfree(regulator->dev_attr.attr.name);
1066 list_del(&regulator->list);
1067 kfree(regulator);
1079 /* Internal regulator request function */
1080 static struct regulator *_regulator_get(struct device *dev, const char *id,
1085 struct regulator *regulator = ERR_PTR(-ENODEV);
1090 printk(KERN_ERR "regulator: get() with no identifier\n");
1091 return regulator;
1106 rdev = map->regulator;
1116 * substitute in a dummy regulator so consumers can continue.
1119 pr_warning("%s supply %s not found, using dummy regulator\n",
1127 return regulator;
1131 regulator = ERR_PTR(-EPERM);
1136 regulator = ERR_PTR(-EBUSY);
1143 regulator = create_regulator(rdev, dev, id);
1144 if (regulator == NULL) {
1145 regulator = ERR_PTR(-ENOMEM);
1163 return regulator;
1167 * regulator_get - lookup and obtain a reference to a regulator.
1168 * @dev: device for regulator "consumer"
1169 * @id: Supply name or regulator ID.
1171 * Returns a struct regulator corresponding to the regulator producer,
1179 struct regulator *regulator_get(struct device *dev, const char *id)
1186 * regulator_get_exclusive - obtain exclusive access to a regulator.
1187 * @dev: device for regulator "consumer"
1188 * @id: Supply name or regulator ID.
1190 * Returns a struct regulator corresponding to the regulator producer,
1193 * regulator will be initialised to reflect the current state of the
1194 * regulator.
1197 * use of the regulator such as those which need to force the
1198 * regulator off for correct operation of the hardware they are
1206 struct regulator *regulator_get_exclusive(struct device *dev, const char *id)
1213 * regulator_put - "free" the regulator source
1214 * @regulator: regulator source
1217 * regulator source are balanced by regulator_disable calls prior to calling
1220 void regulator_put(struct regulator *regulator)
1224 if (regulator == NULL || IS_ERR(regulator))
1228 rdev = regulator->rdev;
1231 if (regulator->dev) {
1232 sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
1233 kfree(regulator->supply_name);
1234 device_remove_file(regulator->dev, &regulator->dev_attr);
1235 kfree(regulator->dev_attr.attr.name);
1237 list_del(&regulator->list);
1238 kfree(regulator);
1264 /* do we need to enable the supply regulator first */
1280 /* The regulator may on if it's not switchable or left on */
1302 /* Allow the regulator to ramp; it would be useful
1328 * regulator_enable - enable regulator output
1329 * @regulator: regulator source
1331 * Request that the regulator be enabled with the regulator output at
1336 * hardwired in the regulator.
1338 int regulator_enable(struct regulator *regulator)
1340 struct regulator_dev *rdev = regulator->rdev;
1396 * regulator_disable - disable regulator output
1397 * @regulator: regulator source
1399 * Disable the regulator output voltage or current. Calls to
1403 * NOTE: this will only disable the regulator output if no other consumer
1404 * devices have it enabled, the regulator device supports disabling and
1407 int regulator_disable(struct regulator *regulator)
1409 struct regulator_dev *rdev = regulator->rdev;
1447 * regulator_force_disable - force disable regulator output
1448 * @regulator: regulator source
1450 * Forcibly disable the regulator output voltage or current.
1451 * NOTE: this *will* disable the regulator output even if other consumer
1453 * damage will likely occur if the regulator is not disabled (e.g. over temp).
1455 int regulator_force_disable(struct regulator *regulator)
1459 mutex_lock(&regulator->rdev->mutex);
1460 regulator->uA_load = 0;
1461 ret = _regulator_force_disable(regulator->rdev);
1462 mutex_unlock(&regulator->rdev->mutex);
1469 /* If we don't know then assume that the regulator is always on */
1477 * regulator_is_enabled - is the regulator output enabled
1478 * @regulator: regulator source
1480 * Returns positive if the regulator driver backing the source/client
1484 * Note that the device backing this regulator handle can have multiple
1488 int regulator_is_enabled(struct regulator *regulator)
1492 mutex_lock(&regulator->rdev->mutex);
1493 ret = _regulator_is_enabled(regulator->rdev);
1494 mutex_unlock(&regulator->rdev->mutex);
1502 * @regulator: regulator source
1508 int regulator_count_voltages(struct regulator *regulator)
1510 struct regulator_dev *rdev = regulator->rdev;
1518 * @regulator: regulator source
1526 int regulator_list_voltage(struct regulator *regulator, unsigned selector)
1528 struct regulator_dev *rdev = regulator->rdev;
1553 * @regulator: Regulator to check.
1559 int regulator_is_supported_voltage(struct regulator *regulator,
1564 ret = regulator_count_voltages(regulator);
1570 ret = regulator_list_voltage(regulator, i);
1580 * regulator_set_voltage - set regulator output voltage
1581 * @regulator: regulator source
1585 * Sets a voltage regulator to the desired output voltage. This can be set
1586 * during any regulator state. IOW, regulator can be disabled or enabled.
1588 * If the regulator is enabled then the voltage will change to the new value
1589 * immediately otherwise if the regulator is disabled the regulator will
1592 * NOTE: If the regulator is shared between several devices then the lowest
1594 * Regulator system constraints must be set for this regulator before
1597 int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
1599 struct regulator_dev *rdev = regulator->rdev;
1614 regulator->min_uV = min_uV;
1615 regulator->max_uV = max_uV;
1635 * regulator_get_voltage - get regulator output voltage
1636 * @regulator: regulator source
1638 * This returns the current regulator voltage in uV.
1640 * NOTE: If the regulator is disabled it will return the voltage value. This
1641 * function should not be used to determine regulator state.
1643 int regulator_get_voltage(struct regulator *regulator)
1647 mutex_lock(&regulator->rdev->mutex);
1649 ret = _regulator_get_voltage(regulator->rdev);
1651 mutex_unlock(&regulator->rdev->mutex);
1658 * regulator_set_current_limit - set regulator output current limit
1659 * @regulator: regulator source
1664 * any regulator state. IOW, regulator can be disabled or enabled.
1666 * If the regulator is enabled then the current will change to the new value
1667 * immediately otherwise if the regulator is disabled the regulator will
1670 * NOTE: Regulator system constraints must be set for this regulator before
1673 int regulator_set_current_limit(struct regulator *regulator,
1676 struct regulator_dev *rdev = regulator->rdev;
1718 * regulator_get_current_limit - get regulator output current
1719 * @regulator: regulator source
1723 * NOTE: If the regulator is disabled it will return the current value. This
1724 * function should not be used to determine regulator state.
1726 int regulator_get_current_limit(struct regulator *regulator)
1728 return _regulator_get_current_limit(regulator->rdev);
1733 * regulator_set_mode - set regulator operating mode
1734 * @regulator: regulator source
1737 * Set regulator operating mode to increase regulator efficiency or improve
1740 * NOTE: Regulator system constraints must be set for this regulator before
1743 int regulator_set_mode(struct regulator *regulator, unsigned int mode)
1745 struct regulator_dev *rdev = regulator->rdev;
1797 * regulator_get_mode - get regulator operating mode
1798 * @regulator: regulator source
1800 * Get the current regulator operating mode.
1802 unsigned int regulator_get_mode(struct regulator *regulator)
1804 return _regulator_get_mode(regulator->rdev);
1809 * regulator_set_optimum_mode - set regulator optimum operating mode
1810 * @regulator: regulator source
1813 * Notifies the regulator core of a new device load. This is then used by
1814 * DRMS (if enabled by constraints) to set the most efficient regulator
1815 * operating mode for the new regulator loading.
1817 * Consumer devices notify their supply regulator of the maximum power
1829 * DRMS will sum the total requested load on the regulator and change
1832 * Returns the new regulator mode or error.
1834 int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1836 struct regulator_dev *rdev = regulator->rdev;
1837 struct regulator *consumer;
1843 regulator->uA_load = uA_load;
1872 /* calc total requested load for this regulator */
1901 * regulator_register_notifier - register regulator event notifier
1902 * @regulator: regulator source
1905 * Register notifier block to receive regulator events.
1907 int regulator_register_notifier(struct regulator *regulator,
1910 return blocking_notifier_chain_register(&regulator->rdev->notifier,
1916 * regulator_unregister_notifier - unregister regulator event notifier
1917 * @regulator: regulator source
1920 * Unregister regulator event notifier block.
1922 int regulator_unregister_notifier(struct regulator *regulator,
1925 return blocking_notifier_chain_unregister(&regulator->rdev->notifier,
1930 /* notify regulator consumers and downstream regulator consumers.
1941 /* now notify regulator we supply */
1950 * regulator_bulk_get - get multiple regulator consumers
1958 * This helper function allows drivers to get several regulator
1995 * regulator_bulk_enable - enable multiple regulator consumers
2001 * This convenience API allows consumers to enable multiple regulator
2030 * regulator_bulk_disable - disable multiple regulator consumers
2036 * This convenience API allows consumers to disable multiple regulator
2066 * regulator_bulk_free - free multiple regulator consumers
2071 * This convenience API allows consumers to free multiple regulator
2087 * regulator_notifier_call_chain - call regulator event notifier
2088 * @rdev: regulator source
2092 * Called by regulator drivers to notify clients a regulator event has
2093 * occurred. We also notify regulator clients downstream.
2106 * regulator_mode_to_status - convert a regulator mode into a status
2110 * Convert a regulator mode into a status.
2246 * regulator_register - register regulator
2247 * @regulator_desc: regulator to register
2248 * @dev: struct device for the regulator
2250 * @driver_data: private regulator data
2252 * Called by regulator drivers to register a regulator.
2292 /* preform any regulator specific init */
2302 dev_set_name(&rdev->dev, "regulator.%d",
2312 /* set regulator constraints */
2317 /* add attributes supported by this regulator */
2322 /* set supply regulator if it exists */
2325 "Supply regulator specified by both name and dev\n");
2392 * regulator_unregister - unregister regulator
2393 * @rdev: regulator to unregister
2395 * Called by regulator drivers to unregister a regulator.
2417 * Configure each regulator with it's suspend operating parameters for state.
2425 /* ON is handled by regulator active state */
2451 * Calling this function will cause the regulator API to disable all
2466 * rdev_get_drvdata - get rdev regulator driver data
2467 * @rdev: regulator
2469 * Get rdev regulator driver private data. This call can be used in the
2470 * regulator driver context.
2479 * regulator_get_drvdata - get regulator driver data
2480 * @regulator: regulator
2482 * Get regulator driver private data. This call can be used in the consumer
2483 * driver context when non API regulator specific functions need to be called.
2485 void *regulator_get_drvdata(struct regulator *regulator)
2487 return regulator->rdev->reg_data;
2492 * regulator_set_drvdata - set regulator driver data
2493 * @regulator: regulator
2496 void regulator_set_drvdata(struct regulator *regulator, void *data)
2498 regulator->rdev->reg_data = data;
2503 * regulator_get_id - get regulator ID
2504 * @rdev: regulator
2528 printk(KERN_INFO "regulator: core version %s\n", REGULATOR_VERSION);