12 #include <linux/kernel.h>
13 #include <linux/module.h>
21 static const unsigned int V1_table[] = {
22 2775000, 1275000, 1600000, 1725000, 1825000, 1925000, 2075000, 2275000,
25 static const unsigned int V2_table[] = {
29 static const unsigned int V3_table[] = {
30 1075000, 1275000, 1550000, 1725000, 1876000, 1950000, 2075000, 2275000,
33 static const unsigned int V4_table[] = {
34 1275000, 1550000, 1725000, 1875000, 1950000, 2075000, 2275000, 2775000,
37 static const unsigned int V5_table[] = {
38 1875000, 2275000, 2475000, 2775000,
41 static const unsigned int V6_table[] = {
45 static const unsigned int V7_table[] = {
49 #define V8_table V4_table
51 static const unsigned int V9_table[] = {
52 1575000, 1875000, 2475000, 2775000,
55 static const unsigned int V10_table[] = {
59 static const unsigned int VAUX1_table[] = {
60 1875000, 2475000, 2775000, 3000000,
63 #define VAUX2_table VAUX1_table
65 static const unsigned int VAUX3_table[] = {
66 1200000, 1200000, 1200000, 1200000, 1400000, 1600000, 1800000, 2000000,
67 2200000, 2400000, 2600000, 2800000, 3000000, 3200000, 3400000, 3600000,
70 static const unsigned int VAUX4_table[] = {
71 1800000, 1800000, 3000000, 5000000,
74 static const unsigned int VSIM_table[] = {
78 static const unsigned int VSIM2_table[] = {
82 static const unsigned int VVIB_table[] = {
83 1300000, 1800000, 2000000, 3000000,
86 static const unsigned int SW1_table[] = {
87 900000, 950000, 1000000, 1050000, 1100000, 1150000, 1200000, 1250000,
88 1300000, 1350000, 1400000, 1450000, 1500000, 1600000, 1875000, 2250000,
91 #define SW2_table SW1_table
93 static const unsigned int SW3_table[] = {
94 4000000, 4500000, 5000000, 5500000,
107 #define VREG_INFO(_vreg, _reg, _en, _index, _stby, _lowpwr) \
156 if (rdev->
desc->n_voltages == 1)
160 (rdev->
desc->n_voltages - 1) << vreg->
index,
161 selector << vreg->
index);
164 static int pcap_regulator_get_voltage_sel(
struct regulator_dev *rdev)
170 if (rdev->
desc->n_voltages == 1)
174 tmp = ((tmp >> vreg->
index) & (rdev->
desc->n_voltages - 1));
189 static int pcap_regulator_disable(
struct regulator_dev *rdev)
200 static int pcap_regulator_is_enabled(
struct regulator_dev *rdev)
210 return (tmp >> vreg->
en) & 1;
215 .set_voltage_sel = pcap_regulator_set_voltage_sel,
216 .get_voltage_sel = pcap_regulator_get_voltage_sel,
217 .enable = pcap_regulator_enable,
218 .disable = pcap_regulator_disable,
219 .is_enabled = pcap_regulator_is_enabled,
222 #define VREG(_vreg) \
226 .n_voltages = ARRAY_SIZE(_vreg##_table), \
227 .volt_table = _vreg##_table, \
228 .ops = &pcap_regulator_ops, \
229 .type = REGULATOR_VOLTAGE, \
230 .owner = THIS_MODULE, \
251 return PTR_ERR(rdev);
253 platform_set_drvdata(pdev, rdev);
263 platform_set_drvdata(pdev,
NULL);
270 .name =
"pcap-regulator",
273 .probe = pcap_regulator_probe,
277 static int __init pcap_regulator_init(
void)
282 static void __exit pcap_regulator_exit(
void)