2 * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #ifndef __LINUX_REGULATOR_PFUZE_H
19 #define __LINUX_REGULATOR_PFUZE_H
21 #include <linux/regulator/driver.h>
23 struct pfuze_regulator {
24 struct regulator_desc desc;
26 unsigned char enable_bit;
27 unsigned char vsel_shift;
28 unsigned char vsel_mask;
32 struct pfuze_regulator_priv {
33 struct mc_pfuze *pfuze;
34 struct pfuze_regulator *pfuze_regulators;
35 struct regulator_dev *regulators[];
38 #define PFUZE_DEFINE(prefix, _name, _reg, _voltages, _ops) \
39 [prefix ## _name] = { \
41 .name = #prefix "_" #_name, \
42 .n_voltages = ARRAY_SIZE(_voltages), \
44 .type = REGULATOR_VOLTAGE, \
45 .id = prefix ## _name, \
46 .owner = THIS_MODULE, \
48 .reg = prefix ## _reg, \
49 .enable_bit = prefix ## _reg ## _ ## EN, \
50 .vsel_shift = prefix ## _reg ## _ ## VSEL,\
51 .vsel_mask = prefix ## _reg ## _ ## VSEL_M,\
52 .voltages = _voltages, \
54 #define PFUZE_SW_DEFINE(prefix, _name, _reg, _voltages, _ops) \
55 [prefix ## _name] = { \
57 .name = #prefix "_" #_name, \
58 .n_voltages = ARRAY_SIZE(_voltages), \
60 .type = REGULATOR_VOLTAGE, \
61 .id = prefix ## _name, \
62 .owner = THIS_MODULE, \
64 .reg = prefix ## _reg, \
65 .vsel_shift = prefix ## _reg ## _ ## VSEL,\
66 .vsel_mask = prefix ## _reg ## _ ## VSEL_M,\
67 .voltages = _voltages, \
70 #define PFUZE_FIXED_DEFINE(prefix, _name, _reg, _voltages, _ops) \
71 [prefix ## _name] = { \
73 .name = #prefix "_" #_name, \
74 .n_voltages = ARRAY_SIZE(_voltages), \
76 .type = REGULATOR_VOLTAGE, \
77 .id = prefix ## _name, \
78 .owner = THIS_MODULE, \
80 .reg = prefix ## _reg, \
81 .enable_bit = prefix ## _reg ## _ ## EN, \
82 .voltages = _voltages, \