@@ -82,42 +82,6 @@ static const struct mpr121_init_register init_reg_table[] = {
82
82
{ AUTO_CONFIG_CTRL_ADDR , 0x0b },
83
83
};
84
84
85
- static void mpr121_vdd_supply_disable (void * data )
86
- {
87
- struct regulator * vdd_supply = data ;
88
-
89
- regulator_disable (vdd_supply );
90
- }
91
-
92
- static struct regulator * mpr121_vdd_supply_init (struct device * dev )
93
- {
94
- struct regulator * vdd_supply ;
95
- int err ;
96
-
97
- vdd_supply = devm_regulator_get (dev , "vdd" );
98
- if (IS_ERR (vdd_supply )) {
99
- dev_err (dev , "failed to get vdd regulator: %ld\n" ,
100
- PTR_ERR (vdd_supply ));
101
- return vdd_supply ;
102
- }
103
-
104
- err = regulator_enable (vdd_supply );
105
- if (err ) {
106
- dev_err (dev , "failed to enable vdd regulator: %d\n" , err );
107
- return ERR_PTR (err );
108
- }
109
-
110
- err = devm_add_action_or_reset (dev , mpr121_vdd_supply_disable ,
111
- vdd_supply );
112
- if (err ) {
113
- dev_err (dev , "failed to add disable regulator action: %d\n" ,
114
- err );
115
- return ERR_PTR (err );
116
- }
117
-
118
- return vdd_supply ;
119
- }
120
-
121
85
static void mpr_touchkey_report (struct input_dev * dev )
122
86
{
123
87
struct mpr121_touchkey * mpr121 = input_get_drvdata (dev );
@@ -233,19 +197,16 @@ static int mpr121_phys_init(struct mpr121_touchkey *mpr121,
233
197
static int mpr_touchkey_probe (struct i2c_client * client )
234
198
{
235
199
struct device * dev = & client -> dev ;
236
- struct regulator * vdd_supply ;
237
200
int vdd_uv ;
238
201
struct mpr121_touchkey * mpr121 ;
239
202
struct input_dev * input_dev ;
240
203
u32 poll_interval = 0 ;
241
204
int error ;
242
205
int i ;
243
206
244
- vdd_supply = mpr121_vdd_supply_init (dev );
245
- if (IS_ERR (vdd_supply ))
246
- return PTR_ERR (vdd_supply );
247
-
248
- vdd_uv = regulator_get_voltage (vdd_supply );
207
+ vdd_uv = devm_regulator_get_enable_read_voltage (dev , "vdd" );
208
+ if (vdd_uv < 0 )
209
+ return dev_err_probe (dev , vdd_uv , "failed to get vdd voltage\n" );
249
210
250
211
mpr121 = devm_kzalloc (dev , sizeof (* mpr121 ), GFP_KERNEL );
251
212
if (!mpr121 )
0 commit comments