1c07bbfe7SFabio Estevam // SPDX-License-Identifier: GPL-2.0+
2c07bbfe7SFabio Estevam //
3c07bbfe7SFabio Estevam // Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
4e3e5aff7SYing-Chun Liu (PaulLiu)
5e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/slab.h>
6e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/device.h>
7e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/module.h>
8baa64151SDong Aisheng #include <linux/mfd/syscon.h>
9e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/err.h>
10e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/io.h>
11e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/platform_device.h>
12e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/of.h>
13e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/of_address.h>
14baa64151SDong Aisheng #include <linux/regmap.h>
15e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/regulator/driver.h>
16e3e5aff7SYing-Chun Liu (PaulLiu) #include <linux/regulator/of_regulator.h>
170d19208eSSascha Hauer #include <linux/regulator/machine.h>
18e3e5aff7SYing-Chun Liu (PaulLiu)
199ee417c0SAnson Huang #define LDO_RAMP_UP_UNIT_IN_CYCLES 64 /* 64 cycles per step */
209ee417c0SAnson Huang #define LDO_RAMP_UP_FREQ_IN_MHZ 24 /* cycle based on 24M OSC */
219ee417c0SAnson Huang
22605ebd35SPhilipp Zabel #define LDO_POWER_GATE 0x00
23d38018f2SPhilipp Zabel #define LDO_FET_FULL_ON 0x1f
24605ebd35SPhilipp Zabel
25e3e5aff7SYing-Chun Liu (PaulLiu) struct anatop_regulator {
269ee417c0SAnson Huang u32 delay_reg;
279ee417c0SAnson Huang int delay_bit_shift;
289ee417c0SAnson Huang int delay_bit_width;
29e3e5aff7SYing-Chun Liu (PaulLiu) struct regulator_desc rdesc;
30d38018f2SPhilipp Zabel bool bypass;
31605ebd35SPhilipp Zabel int sel;
32e3e5aff7SYing-Chun Liu (PaulLiu) };
33e3e5aff7SYing-Chun Liu (PaulLiu)
anatop_regmap_set_voltage_time_sel(struct regulator_dev * reg,unsigned int old_sel,unsigned int new_sel)349ee417c0SAnson Huang static int anatop_regmap_set_voltage_time_sel(struct regulator_dev *reg,
359ee417c0SAnson Huang unsigned int old_sel,
369ee417c0SAnson Huang unsigned int new_sel)
379ee417c0SAnson Huang {
389ee417c0SAnson Huang struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
399ee417c0SAnson Huang u32 val;
409ee417c0SAnson Huang int ret = 0;
419ee417c0SAnson Huang
429ee417c0SAnson Huang /* check whether need to care about LDO ramp up speed */
439ee417c0SAnson Huang if (anatop_reg->delay_bit_width && new_sel > old_sel) {
449ee417c0SAnson Huang /*
459ee417c0SAnson Huang * the delay for LDO ramp up time is
469ee417c0SAnson Huang * based on the register setting, we need
479ee417c0SAnson Huang * to calculate how many steps LDO need to
489ee417c0SAnson Huang * ramp up, and how much delay needed. (us)
499ee417c0SAnson Huang */
50f34a2692SAxel Lin regmap_read(reg->regmap, anatop_reg->delay_reg, &val);
519ee417c0SAnson Huang val = (val >> anatop_reg->delay_bit_shift) &
529ee417c0SAnson Huang ((1 << anatop_reg->delay_bit_width) - 1);
53ff1ce057SShawn Guo ret = (new_sel - old_sel) * (LDO_RAMP_UP_UNIT_IN_CYCLES <<
54ff1ce057SShawn Guo val) / LDO_RAMP_UP_FREQ_IN_MHZ + 1;
559ee417c0SAnson Huang }
569ee417c0SAnson Huang
579ee417c0SAnson Huang return ret;
589ee417c0SAnson Huang }
599ee417c0SAnson Huang
anatop_regmap_enable(struct regulator_dev * reg)60605ebd35SPhilipp Zabel static int anatop_regmap_enable(struct regulator_dev *reg)
61605ebd35SPhilipp Zabel {
62605ebd35SPhilipp Zabel struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
63d38018f2SPhilipp Zabel int sel;
64605ebd35SPhilipp Zabel
65d38018f2SPhilipp Zabel sel = anatop_reg->bypass ? LDO_FET_FULL_ON : anatop_reg->sel;
66d38018f2SPhilipp Zabel return regulator_set_voltage_sel_regmap(reg, sel);
67605ebd35SPhilipp Zabel }
68605ebd35SPhilipp Zabel
anatop_regmap_disable(struct regulator_dev * reg)69605ebd35SPhilipp Zabel static int anatop_regmap_disable(struct regulator_dev *reg)
70605ebd35SPhilipp Zabel {
71605ebd35SPhilipp Zabel return regulator_set_voltage_sel_regmap(reg, LDO_POWER_GATE);
72605ebd35SPhilipp Zabel }
73605ebd35SPhilipp Zabel
anatop_regmap_is_enabled(struct regulator_dev * reg)74605ebd35SPhilipp Zabel static int anatop_regmap_is_enabled(struct regulator_dev *reg)
75605ebd35SPhilipp Zabel {
76605ebd35SPhilipp Zabel return regulator_get_voltage_sel_regmap(reg) != LDO_POWER_GATE;
77605ebd35SPhilipp Zabel }
78605ebd35SPhilipp Zabel
anatop_regmap_core_set_voltage_sel(struct regulator_dev * reg,unsigned selector)79605ebd35SPhilipp Zabel static int anatop_regmap_core_set_voltage_sel(struct regulator_dev *reg,
80605ebd35SPhilipp Zabel unsigned selector)
81605ebd35SPhilipp Zabel {
82605ebd35SPhilipp Zabel struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
83605ebd35SPhilipp Zabel int ret;
84605ebd35SPhilipp Zabel
85d38018f2SPhilipp Zabel if (anatop_reg->bypass || !anatop_regmap_is_enabled(reg)) {
86605ebd35SPhilipp Zabel anatop_reg->sel = selector;
87605ebd35SPhilipp Zabel return 0;
88605ebd35SPhilipp Zabel }
89605ebd35SPhilipp Zabel
90605ebd35SPhilipp Zabel ret = regulator_set_voltage_sel_regmap(reg, selector);
91605ebd35SPhilipp Zabel if (!ret)
92605ebd35SPhilipp Zabel anatop_reg->sel = selector;
93605ebd35SPhilipp Zabel return ret;
94605ebd35SPhilipp Zabel }
95605ebd35SPhilipp Zabel
anatop_regmap_core_get_voltage_sel(struct regulator_dev * reg)96605ebd35SPhilipp Zabel static int anatop_regmap_core_get_voltage_sel(struct regulator_dev *reg)
97605ebd35SPhilipp Zabel {
98605ebd35SPhilipp Zabel struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
99605ebd35SPhilipp Zabel
100d38018f2SPhilipp Zabel if (anatop_reg->bypass || !anatop_regmap_is_enabled(reg))
101605ebd35SPhilipp Zabel return anatop_reg->sel;
102605ebd35SPhilipp Zabel
103605ebd35SPhilipp Zabel return regulator_get_voltage_sel_regmap(reg);
104605ebd35SPhilipp Zabel }
105605ebd35SPhilipp Zabel
anatop_regmap_get_bypass(struct regulator_dev * reg,bool * enable)106d38018f2SPhilipp Zabel static int anatop_regmap_get_bypass(struct regulator_dev *reg, bool *enable)
107d38018f2SPhilipp Zabel {
108d38018f2SPhilipp Zabel struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
109d38018f2SPhilipp Zabel int sel;
110d38018f2SPhilipp Zabel
111d38018f2SPhilipp Zabel sel = regulator_get_voltage_sel_regmap(reg);
112d38018f2SPhilipp Zabel if (sel == LDO_FET_FULL_ON)
113d38018f2SPhilipp Zabel WARN_ON(!anatop_reg->bypass);
114d38018f2SPhilipp Zabel else if (sel != LDO_POWER_GATE)
115d38018f2SPhilipp Zabel WARN_ON(anatop_reg->bypass);
116d38018f2SPhilipp Zabel
117d38018f2SPhilipp Zabel *enable = anatop_reg->bypass;
118d38018f2SPhilipp Zabel return 0;
119d38018f2SPhilipp Zabel }
120d38018f2SPhilipp Zabel
anatop_regmap_set_bypass(struct regulator_dev * reg,bool enable)121d38018f2SPhilipp Zabel static int anatop_regmap_set_bypass(struct regulator_dev *reg, bool enable)
122d38018f2SPhilipp Zabel {
123d38018f2SPhilipp Zabel struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
124d38018f2SPhilipp Zabel int sel;
125d38018f2SPhilipp Zabel
126d38018f2SPhilipp Zabel if (enable == anatop_reg->bypass)
127d38018f2SPhilipp Zabel return 0;
128d38018f2SPhilipp Zabel
129d38018f2SPhilipp Zabel sel = enable ? LDO_FET_FULL_ON : anatop_reg->sel;
130d38018f2SPhilipp Zabel anatop_reg->bypass = enable;
131d38018f2SPhilipp Zabel
132d38018f2SPhilipp Zabel return regulator_set_voltage_sel_regmap(reg, sel);
133d38018f2SPhilipp Zabel }
134d38018f2SPhilipp Zabel
135e3e5aff7SYing-Chun Liu (PaulLiu) static struct regulator_ops anatop_rops = {
136114c5748SAxel Lin .set_voltage_sel = regulator_set_voltage_sel_regmap,
137114c5748SAxel Lin .get_voltage_sel = regulator_get_voltage_sel_regmap,
1380713e6abSAxel Lin .list_voltage = regulator_list_voltage_linear,
139d01c3a1eSAxel Lin .map_voltage = regulator_map_voltage_linear,
140e3e5aff7SYing-Chun Liu (PaulLiu) };
141e3e5aff7SYing-Chun Liu (PaulLiu)
142cae62a93SRikard Falkeborn static const struct regulator_ops anatop_core_rops = {
143605ebd35SPhilipp Zabel .enable = anatop_regmap_enable,
144605ebd35SPhilipp Zabel .disable = anatop_regmap_disable,
145605ebd35SPhilipp Zabel .is_enabled = anatop_regmap_is_enabled,
146605ebd35SPhilipp Zabel .set_voltage_sel = anatop_regmap_core_set_voltage_sel,
147605ebd35SPhilipp Zabel .set_voltage_time_sel = anatop_regmap_set_voltage_time_sel,
148605ebd35SPhilipp Zabel .get_voltage_sel = anatop_regmap_core_get_voltage_sel,
149605ebd35SPhilipp Zabel .list_voltage = regulator_list_voltage_linear,
150605ebd35SPhilipp Zabel .map_voltage = regulator_map_voltage_linear,
151d38018f2SPhilipp Zabel .get_bypass = anatop_regmap_get_bypass,
152d38018f2SPhilipp Zabel .set_bypass = anatop_regmap_set_bypass,
153605ebd35SPhilipp Zabel };
154605ebd35SPhilipp Zabel
anatop_regulator_probe(struct platform_device * pdev)155a5023574SBill Pemberton static int anatop_regulator_probe(struct platform_device *pdev)
156e3e5aff7SYing-Chun Liu (PaulLiu) {
157e3e5aff7SYing-Chun Liu (PaulLiu) struct device *dev = &pdev->dev;
158e3e5aff7SYing-Chun Liu (PaulLiu) struct device_node *np = dev->of_node;
159baa64151SDong Aisheng struct device_node *anatop_np;
160e3e5aff7SYing-Chun Liu (PaulLiu) struct regulator_desc *rdesc;
161e3e5aff7SYing-Chun Liu (PaulLiu) struct regulator_dev *rdev;
162e3e5aff7SYing-Chun Liu (PaulLiu) struct anatop_regulator *sreg;
163e3e5aff7SYing-Chun Liu (PaulLiu) struct regulator_init_data *initdata;
164d914d81bSAxel Lin struct regulator_config config = { };
165f34a2692SAxel Lin struct regmap *regmap;
166f34a2692SAxel Lin u32 control_reg;
167f34a2692SAxel Lin u32 vol_bit_shift;
168f34a2692SAxel Lin u32 vol_bit_width;
169f34a2692SAxel Lin u32 min_bit_val;
170f34a2692SAxel Lin u32 min_voltage;
171f34a2692SAxel Lin u32 max_voltage;
172e3e5aff7SYing-Chun Liu (PaulLiu) int ret = 0;
173605ebd35SPhilipp Zabel u32 val;
174e3e5aff7SYing-Chun Liu (PaulLiu)
175e3e5aff7SYing-Chun Liu (PaulLiu) sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL);
176e3e5aff7SYing-Chun Liu (PaulLiu) if (!sreg)
177e3e5aff7SYing-Chun Liu (PaulLiu) return -ENOMEM;
1785062e047SDong Aisheng
179e3e5aff7SYing-Chun Liu (PaulLiu) rdesc = &sreg->rdesc;
180e3e5aff7SYing-Chun Liu (PaulLiu) rdesc->type = REGULATOR_VOLTAGE;
181e3e5aff7SYing-Chun Liu (PaulLiu) rdesc->owner = THIS_MODULE;
182baa64151SDong Aisheng
183aeb1404dSDong Aisheng of_property_read_string(np, "regulator-name", &rdesc->name);
1844af5924cSDong Aisheng if (!rdesc->name) {
1854af5924cSDong Aisheng dev_err(dev, "failed to get a regulator-name\n");
1864af5924cSDong Aisheng return -EINVAL;
1874af5924cSDong Aisheng }
188aeb1404dSDong Aisheng
189072e78b1SJavier Martinez Canillas initdata = of_get_regulator_init_data(dev, np, rdesc);
1907f51cf2eSDong Aisheng if (!initdata)
1917f51cf2eSDong Aisheng return -ENOMEM;
1927f51cf2eSDong Aisheng
1930d19208eSSascha Hauer initdata->supply_regulator = "vin";
194072e78b1SJavier Martinez Canillas
195baa64151SDong Aisheng anatop_np = of_get_parent(np);
196baa64151SDong Aisheng if (!anatop_np)
197baa64151SDong Aisheng return -ENODEV;
198f34a2692SAxel Lin regmap = syscon_node_to_regmap(anatop_np);
199baa64151SDong Aisheng of_node_put(anatop_np);
200f34a2692SAxel Lin if (IS_ERR(regmap))
201f34a2692SAxel Lin return PTR_ERR(regmap);
202baa64151SDong Aisheng
203f34a2692SAxel Lin ret = of_property_read_u32(np, "anatop-reg-offset", &control_reg);
204e3e5aff7SYing-Chun Liu (PaulLiu) if (ret) {
2052f2cc27fSYing-Chun Liu (PaulLiu) dev_err(dev, "no anatop-reg-offset property set\n");
206f2b269b8SFabio Estevam return ret;
207e3e5aff7SYing-Chun Liu (PaulLiu) }
208f34a2692SAxel Lin ret = of_property_read_u32(np, "anatop-vol-bit-width", &vol_bit_width);
209e3e5aff7SYing-Chun Liu (PaulLiu) if (ret) {
210e3e5aff7SYing-Chun Liu (PaulLiu) dev_err(dev, "no anatop-vol-bit-width property set\n");
211f2b269b8SFabio Estevam return ret;
212e3e5aff7SYing-Chun Liu (PaulLiu) }
213f34a2692SAxel Lin ret = of_property_read_u32(np, "anatop-vol-bit-shift", &vol_bit_shift);
214e3e5aff7SYing-Chun Liu (PaulLiu) if (ret) {
215e3e5aff7SYing-Chun Liu (PaulLiu) dev_err(dev, "no anatop-vol-bit-shift property set\n");
216f2b269b8SFabio Estevam return ret;
217e3e5aff7SYing-Chun Liu (PaulLiu) }
218f34a2692SAxel Lin ret = of_property_read_u32(np, "anatop-min-bit-val", &min_bit_val);
219e3e5aff7SYing-Chun Liu (PaulLiu) if (ret) {
220e3e5aff7SYing-Chun Liu (PaulLiu) dev_err(dev, "no anatop-min-bit-val property set\n");
221f2b269b8SFabio Estevam return ret;
222e3e5aff7SYing-Chun Liu (PaulLiu) }
223f34a2692SAxel Lin ret = of_property_read_u32(np, "anatop-min-voltage", &min_voltage);
224e3e5aff7SYing-Chun Liu (PaulLiu) if (ret) {
225e3e5aff7SYing-Chun Liu (PaulLiu) dev_err(dev, "no anatop-min-voltage property set\n");
226f2b269b8SFabio Estevam return ret;
227e3e5aff7SYing-Chun Liu (PaulLiu) }
228f34a2692SAxel Lin ret = of_property_read_u32(np, "anatop-max-voltage", &max_voltage);
229e3e5aff7SYing-Chun Liu (PaulLiu) if (ret) {
230e3e5aff7SYing-Chun Liu (PaulLiu) dev_err(dev, "no anatop-max-voltage property set\n");
231f2b269b8SFabio Estevam return ret;
232e3e5aff7SYing-Chun Liu (PaulLiu) }
233e3e5aff7SYing-Chun Liu (PaulLiu)
2349ee417c0SAnson Huang /* read LDO ramp up setting, only for core reg */
2359ee417c0SAnson Huang of_property_read_u32(np, "anatop-delay-reg-offset",
2369ee417c0SAnson Huang &sreg->delay_reg);
2379ee417c0SAnson Huang of_property_read_u32(np, "anatop-delay-bit-width",
2389ee417c0SAnson Huang &sreg->delay_bit_width);
2399ee417c0SAnson Huang of_property_read_u32(np, "anatop-delay-bit-shift",
2409ee417c0SAnson Huang &sreg->delay_bit_shift);
2419ee417c0SAnson Huang
242f34a2692SAxel Lin rdesc->n_voltages = (max_voltage - min_voltage) / 25000 + 1
243f34a2692SAxel Lin + min_bit_val;
244f34a2692SAxel Lin rdesc->min_uV = min_voltage;
2450713e6abSAxel Lin rdesc->uV_step = 25000;
246f34a2692SAxel Lin rdesc->linear_min_sel = min_bit_val;
247f34a2692SAxel Lin rdesc->vsel_reg = control_reg;
248f34a2692SAxel Lin rdesc->vsel_mask = ((1 << vol_bit_width) - 1) << vol_bit_shift;
2490d19208eSSascha Hauer rdesc->min_dropout_uV = 125000;
250e3e5aff7SYing-Chun Liu (PaulLiu)
251d914d81bSAxel Lin config.dev = &pdev->dev;
252d914d81bSAxel Lin config.init_data = initdata;
253d914d81bSAxel Lin config.driver_data = sreg;
254d914d81bSAxel Lin config.of_node = pdev->dev.of_node;
255f34a2692SAxel Lin config.regmap = regmap;
256d914d81bSAxel Lin
257605ebd35SPhilipp Zabel /* Only core regulators have the ramp up delay configuration. */
258f34a2692SAxel Lin if (control_reg && sreg->delay_bit_width) {
259605ebd35SPhilipp Zabel rdesc->ops = &anatop_core_rops;
260605ebd35SPhilipp Zabel
261605ebd35SPhilipp Zabel ret = regmap_read(config.regmap, rdesc->vsel_reg, &val);
262605ebd35SPhilipp Zabel if (ret) {
263605ebd35SPhilipp Zabel dev_err(dev, "failed to read initial state\n");
264605ebd35SPhilipp Zabel return ret;
265605ebd35SPhilipp Zabel }
266605ebd35SPhilipp Zabel
267f34a2692SAxel Lin sreg->sel = (val & rdesc->vsel_mask) >> vol_bit_shift;
268d38018f2SPhilipp Zabel if (sreg->sel == LDO_FET_FULL_ON) {
269d38018f2SPhilipp Zabel sreg->sel = 0;
270d38018f2SPhilipp Zabel sreg->bypass = true;
271d38018f2SPhilipp Zabel }
272fe08be3eSMarkus Pargmann
273fe08be3eSMarkus Pargmann /*
274fe08be3eSMarkus Pargmann * In case vddpu was disabled by the bootloader, we need to set
275fe08be3eSMarkus Pargmann * a sane default until imx6-cpufreq was probed and changes the
276fe08be3eSMarkus Pargmann * voltage to the correct value. In this case we set 1.25V.
277fe08be3eSMarkus Pargmann */
278aeb1404dSDong Aisheng if (!sreg->sel && !strcmp(rdesc->name, "vddpu"))
279fe08be3eSMarkus Pargmann sreg->sel = 22;
280da0607c8SMarkus Pargmann
2819bf94454SDong Aisheng /* set the default voltage of the pcie phy to be 1.100v */
2824af5924cSDong Aisheng if (!sreg->sel && !strcmp(rdesc->name, "vddpcie"))
2839bf94454SDong Aisheng sreg->sel = 0x10;
2849bf94454SDong Aisheng
2858a092e68SMika Båtsman if (!sreg->bypass && !sreg->sel) {
286da0607c8SMarkus Pargmann dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");
287da0607c8SMarkus Pargmann return -EINVAL;
288da0607c8SMarkus Pargmann }
289605ebd35SPhilipp Zabel } else {
290ca7734adSAndrey Smirnov u32 enable_bit;
291ca7734adSAndrey Smirnov
292605ebd35SPhilipp Zabel rdesc->ops = &anatop_rops;
293ca7734adSAndrey Smirnov
294ca7734adSAndrey Smirnov if (!of_property_read_u32(np, "anatop-enable-bit",
295ca7734adSAndrey Smirnov &enable_bit)) {
296ca7734adSAndrey Smirnov anatop_rops.enable = regulator_enable_regmap;
297ca7734adSAndrey Smirnov anatop_rops.disable = regulator_disable_regmap;
298ca7734adSAndrey Smirnov anatop_rops.is_enabled = regulator_is_enabled_regmap;
299ca7734adSAndrey Smirnov
300f34a2692SAxel Lin rdesc->enable_reg = control_reg;
301ca7734adSAndrey Smirnov rdesc->enable_mask = BIT(enable_bit);
302ca7734adSAndrey Smirnov }
303605ebd35SPhilipp Zabel }
304605ebd35SPhilipp Zabel
305e3e5aff7SYing-Chun Liu (PaulLiu) /* register regulator */
306be1221e8SSachin Kamat rdev = devm_regulator_register(dev, rdesc, &config);
307e3e5aff7SYing-Chun Liu (PaulLiu) if (IS_ERR(rdev)) {
308788bfc6eSAnson Huang ret = PTR_ERR(rdev);
309788bfc6eSAnson Huang if (ret == -EPROBE_DEFER)
310788bfc6eSAnson Huang dev_dbg(dev, "failed to register %s, deferring...\n",
311e3e5aff7SYing-Chun Liu (PaulLiu) rdesc->name);
312788bfc6eSAnson Huang else
313788bfc6eSAnson Huang dev_err(dev, "failed to register %s\n", rdesc->name);
314788bfc6eSAnson Huang return ret;
315e3e5aff7SYing-Chun Liu (PaulLiu) }
316e3e5aff7SYing-Chun Liu (PaulLiu)
317e3e5aff7SYing-Chun Liu (PaulLiu) platform_set_drvdata(pdev, rdev);
318e3e5aff7SYing-Chun Liu (PaulLiu)
319e3e5aff7SYing-Chun Liu (PaulLiu) return 0;
320e3e5aff7SYing-Chun Liu (PaulLiu) }
321e3e5aff7SYing-Chun Liu (PaulLiu)
322a799baabSJingoo Han static const struct of_device_id of_anatop_regulator_match_tbl[] = {
323e3e5aff7SYing-Chun Liu (PaulLiu) { .compatible = "fsl,anatop-regulator", },
324e3e5aff7SYing-Chun Liu (PaulLiu) { /* end */ }
325e3e5aff7SYing-Chun Liu (PaulLiu) };
326d702ffd4SLuis de Bethencourt MODULE_DEVICE_TABLE(of, of_anatop_regulator_match_tbl);
327e3e5aff7SYing-Chun Liu (PaulLiu)
328c0d78c23SShawn Guo static struct platform_driver anatop_regulator_driver = {
329e3e5aff7SYing-Chun Liu (PaulLiu) .driver = {
330e3e5aff7SYing-Chun Liu (PaulLiu) .name = "anatop_regulator",
331*259b93b2SDouglas Anderson .probe_type = PROBE_PREFER_ASYNCHRONOUS,
332e3e5aff7SYing-Chun Liu (PaulLiu) .of_match_table = of_anatop_regulator_match_tbl,
333e3e5aff7SYing-Chun Liu (PaulLiu) },
334e3e5aff7SYing-Chun Liu (PaulLiu) .probe = anatop_regulator_probe,
335e3e5aff7SYing-Chun Liu (PaulLiu) };
336e3e5aff7SYing-Chun Liu (PaulLiu)
anatop_regulator_init(void)337e3e5aff7SYing-Chun Liu (PaulLiu) static int __init anatop_regulator_init(void)
338e3e5aff7SYing-Chun Liu (PaulLiu) {
339c0d78c23SShawn Guo return platform_driver_register(&anatop_regulator_driver);
340e3e5aff7SYing-Chun Liu (PaulLiu) }
341e3e5aff7SYing-Chun Liu (PaulLiu) postcore_initcall(anatop_regulator_init);
342e3e5aff7SYing-Chun Liu (PaulLiu)
anatop_regulator_exit(void)343e3e5aff7SYing-Chun Liu (PaulLiu) static void __exit anatop_regulator_exit(void)
344e3e5aff7SYing-Chun Liu (PaulLiu) {
345c0d78c23SShawn Guo platform_driver_unregister(&anatop_regulator_driver);
346e3e5aff7SYing-Chun Liu (PaulLiu) }
347e3e5aff7SYing-Chun Liu (PaulLiu) module_exit(anatop_regulator_exit);
348e3e5aff7SYing-Chun Liu (PaulLiu)
34934f75685SJingoo Han MODULE_AUTHOR("Nancy Chen <Nancy.Chen@freescale.com>");
35034f75685SJingoo Han MODULE_AUTHOR("Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>");
351e3e5aff7SYing-Chun Liu (PaulLiu) MODULE_DESCRIPTION("ANATOP Regulator driver");
352e3e5aff7SYing-Chun Liu (PaulLiu) MODULE_LICENSE("GPL v2");
35389705b9eSFabio Estevam MODULE_ALIAS("platform:anatop_regulator");
354