x86: hpet: allow force enable on ICH10 HPET
[linux-2.6/linux-2.6-openrd.git] / include / linux / regulator / driver.h
blob2dae05705f13e21b9d3410b6c5dfb494a1b9bab8
1 /*
2 * driver.h -- SoC Regulator driver support.
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * Regulator Driver Interface.
15 #ifndef __LINUX_REGULATOR_DRIVER_H_
16 #define __LINUX_REGULATOR_DRIVER_H_
18 #include <linux/device.h>
19 #include <linux/regulator/consumer.h>
21 struct regulator_dev;
22 struct regulator_init_data;
24 /**
25 * struct regulator_ops - regulator operations.
27 * This struct describes regulator operations which can be implemented by
28 * regulator chip drivers.
30 * @enable: Enable the regulator.
31 * @disable: Disable the regulator.
32 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise.
34 * @set_voltage: Set the voltage for the regulator within the range specified.
35 * The driver should select the voltage closest to min_uV.
36 * @get_voltage: Return the currently configured voltage for the regulator.
38 * @set_current_limit: Configure a limit for a current-limited regulator.
39 * @get_current_limit: Get the limit for a current-limited regulator.
41 * @set_mode: Set the operating mode for the regulator.
42 * @get_mode: Get the current operating mode for the regulator.
43 * @get_optimum_mode: Get the most efficient operating mode for the regulator
44 * when running with the specified parameters.
46 * @set_suspend_voltage: Set the voltage for the regulator when the system
47 * is suspended.
48 * @set_suspend_enable: Mark the regulator as enabled when the system is
49 * suspended.
50 * @set_suspend_disable: Mark the regulator as disabled when the system is
51 * suspended.
52 * @set_suspend_mode: Set the operating mode for the regulator when the
53 * system is suspended.
55 struct regulator_ops {
57 /* get/set regulator voltage */
58 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV);
59 int (*get_voltage) (struct regulator_dev *);
61 /* get/set regulator current */
62 int (*set_current_limit) (struct regulator_dev *,
63 int min_uA, int max_uA);
64 int (*get_current_limit) (struct regulator_dev *);
66 /* enable/disable regulator */
67 int (*enable) (struct regulator_dev *);
68 int (*disable) (struct regulator_dev *);
69 int (*is_enabled) (struct regulator_dev *);
71 /* get/set regulator operating mode (defined in regulator.h) */
72 int (*set_mode) (struct regulator_dev *, unsigned int mode);
73 unsigned int (*get_mode) (struct regulator_dev *);
75 /* get most efficient regulator operating mode for load */
76 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
77 int output_uV, int load_uA);
79 /* the operations below are for configuration of regulator state when
80 * its parent PMIC enters a global STANDBY/HIBERNATE state */
82 /* set regulator suspend voltage */
83 int (*set_suspend_voltage) (struct regulator_dev *, int uV);
85 /* enable/disable regulator in suspend state */
86 int (*set_suspend_enable) (struct regulator_dev *);
87 int (*set_suspend_disable) (struct regulator_dev *);
89 /* set regulator suspend operating mode (defined in regulator.h) */
90 int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
94 * Regulators can either control voltage or current.
96 enum regulator_type {
97 REGULATOR_VOLTAGE,
98 REGULATOR_CURRENT,
102 * struct regulator_desc - Regulator descriptor
104 * Each regulator registered with the core is described with a structure of
105 * this type.
107 * @name: Identifying name for the regulator.
108 * @id: Numerical identifier for the regulator.
109 * @ops: Regulator operations table.
110 * @irq: Interrupt number for the regulator.
111 * @type: Indicates if the regulator is a voltage or current regulator.
112 * @owner: Module providing the regulator, used for refcounting.
114 struct regulator_desc {
115 const char *name;
116 int id;
117 struct regulator_ops *ops;
118 int irq;
119 enum regulator_type type;
120 struct module *owner;
123 struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
124 struct device *dev, void *driver_data);
125 void regulator_unregister(struct regulator_dev *rdev);
127 int regulator_notifier_call_chain(struct regulator_dev *rdev,
128 unsigned long event, void *data);
130 void *rdev_get_drvdata(struct regulator_dev *rdev);
131 struct device *rdev_get_dev(struct regulator_dev *rdev);
132 int rdev_get_id(struct regulator_dev *rdev);
134 void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
136 #endif