]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/regulator/pfuze-regulator.h
ENGR00172752-2 Remove usless code in pfuze100 regulator driver
[karo-tx-linux.git] / drivers / regulator / pfuze-regulator.h
1 /*
2  * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. All Rights Reserved.
3  *
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.
8  *
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.
13  *
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
17  */
18 #ifndef __LINUX_REGULATOR_PFUZE_H
19 #define __LINUX_REGULATOR_PFUZE_H
20
21 #include <linux/regulator/driver.h>
22
23 struct pfuze_regulator {
24         struct regulator_desc desc;
25         unsigned int reg;
26         unsigned char enable_bit;
27         unsigned char vsel_shift;
28         unsigned char vsel_mask;
29         int const *voltages;
30 };
31
32 struct pfuze_regulator_priv {
33         struct mc_pfuze *pfuze;
34         struct pfuze_regulator *pfuze_regulators;
35         struct regulator_dev *regulators[];
36 };
37
38 #define PFUZE_DEFINE(prefix, _name, _reg, _voltages, _ops)      \
39         [prefix ## _name] = {                           \
40                 .desc = {                                               \
41                         .name = #prefix "_" #_name,                     \
42                         .n_voltages = ARRAY_SIZE(_voltages),            \
43                         .ops = &_ops,                   \
44                         .type = REGULATOR_VOLTAGE,                      \
45                         .id = prefix ## _name,          \
46                         .owner = THIS_MODULE,                           \
47                 },                                                      \
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,                                 \
53         }
54 #define PFUZE_SW_DEFINE(prefix, _name, _reg, _voltages, _ops)   \
55         [prefix ## _name] = {                           \
56                 .desc = {                                               \
57                         .name = #prefix "_" #_name,                     \
58                         .n_voltages = ARRAY_SIZE(_voltages),            \
59                         .ops = &_ops,                   \
60                         .type = REGULATOR_VOLTAGE,                      \
61                         .id = prefix ## _name,          \
62                         .owner = THIS_MODULE,                           \
63                 },                                                      \
64                 .reg = prefix ## _reg,                          \
65                 .vsel_shift = prefix ## _reg ## _ ## VSEL,\
66                 .vsel_mask = prefix ## _reg ## _ ## VSEL_M,\
67                 .voltages =  _voltages,                                 \
68         }
69
70 #define PFUZE_FIXED_DEFINE(prefix, _name, _reg, _voltages, _ops)        \
71         [prefix ## _name] = {                           \
72                 .desc = {                                               \
73                         .name = #prefix "_" #_name,                     \
74                         .n_voltages = ARRAY_SIZE(_voltages),            \
75                         .ops = &_ops,           \
76                         .type = REGULATOR_VOLTAGE,                      \
77                         .id = prefix ## _name,          \
78                         .owner = THIS_MODULE,                           \
79                 },                                                      \
80                 .reg = prefix ## _reg,                          \
81                 .enable_bit = prefix ## _reg ## _ ## EN,        \
82                 .voltages =  _voltages,                                 \
83         }
84
85 #endif
86