Skip to content

Commit 7738dc2

Browse files
kumajayaniclimcy
authored andcommitted
input: misc: Import MPU6050 changes for wt88047
Change-Id: Id46fb1d1f79f121bc2670e228df31b201085eafe
1 parent 4f3cce6 commit 7738dc2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/input/misc/mpu6050.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@
4040
/*VDD 2.375V-3.46V VLOGIC 1.8V +-5%*/
4141
#define MPU6050_VDD_MIN_UV 2500000
4242
#define MPU6050_VDD_MAX_UV 3400000
43+
#ifndef CONFIG_MACH_WT88047
4344
#define MPU6050_VLOGIC_MIN_UV 1800000
4445
#define MPU6050_VLOGIC_MAX_UV 1800000
46+
#endif
4547
#define MPU6050_VI2C_MIN_UV 1750000
4648
#define MPU6050_VI2C_MAX_UV 1950000
4749

@@ -185,7 +187,9 @@ struct mpu6050_sensor {
185187
bool acc_use_cal;
186188

187189
/* power control */
190+
#ifndef CONFIG_MACH_WT88047
188191
struct regulator *vlogic;
192+
#endif
189193
struct regulator *vdd;
190194
struct regulator *vi2c;
191195
int enable_gpio;
@@ -365,21 +369,25 @@ static int mpu6050_power_ctl(struct mpu6050_sensor *sensor, bool on)
365369
return rc;
366370
}
367371

372+
#ifndef CONFIG_MACH_WT88047
368373
rc = regulator_enable(sensor->vlogic);
369374
if (rc) {
370375
dev_err(&sensor->client->dev,
371376
"Regulator vlogic enable failed rc=%d\n", rc);
372377
regulator_disable(sensor->vdd);
373378
return rc;
374379
}
380+
#endif
375381

376382
if (!IS_ERR_OR_NULL(sensor->vi2c)) {
377383
rc = regulator_enable(sensor->vi2c);
378384
if (rc) {
379385
dev_err(&sensor->client->dev,
380386
"Regulator vi2c enable failed rc=%d\n",
381387
rc);
388+
#ifndef CONFIG_MACH_WT88047
382389
regulator_disable(sensor->vlogic);
390+
#endif
383391
regulator_disable(sensor->vdd);
384392
return rc;
385393
}
@@ -410,13 +418,15 @@ static int mpu6050_power_ctl(struct mpu6050_sensor *sensor, bool on)
410418
return rc;
411419
}
412420

421+
#ifndef CONFIG_MACH_WT88047
413422
rc = regulator_disable(sensor->vlogic);
414423
if (rc) {
415424
dev_err(&sensor->client->dev,
416425
"Regulator vlogic disable failed rc=%d\n", rc);
417426
rc = regulator_enable(sensor->vdd);
418427
return rc;
419428
}
429+
#endif
420430

421431
if (!IS_ERR_OR_NULL(sensor->vi2c)) {
422432
rc = regulator_disable(sensor->vi2c);
@@ -461,6 +471,7 @@ static int mpu6050_power_init(struct mpu6050_sensor *sensor)
461471
}
462472
}
463473

474+
#ifndef CONFIG_MACH_WT88047
464475
sensor->vlogic = regulator_get(&sensor->client->dev, "vlogic");
465476
if (IS_ERR(sensor->vlogic)) {
466477
ret = PTR_ERR(sensor->vlogic);
@@ -479,6 +490,7 @@ static int mpu6050_power_init(struct mpu6050_sensor *sensor)
479490
goto reg_vlogic_put;
480491
}
481492
}
493+
#endif
482494

483495
sensor->vi2c = regulator_get(&sensor->client->dev, "vi2c");
484496
if (IS_ERR(sensor->vi2c)) {
@@ -501,13 +513,15 @@ static int mpu6050_power_init(struct mpu6050_sensor *sensor)
501513

502514
reg_vi2c_put:
503515
regulator_put(sensor->vi2c);
516+
#ifndef CONFIG_MACH_WT88047
504517
if (regulator_count_voltages(sensor->vlogic) > 0)
505518
regulator_set_voltage(sensor->vlogic, 0, MPU6050_VLOGIC_MAX_UV);
506519
reg_vlogic_put:
507520
regulator_put(sensor->vlogic);
508521
reg_vdd_set_vtg:
509522
if (regulator_count_voltages(sensor->vdd) > 0)
510523
regulator_set_voltage(sensor->vdd, 0, MPU6050_VDD_MAX_UV);
524+
#endif
511525
reg_vdd_put:
512526
regulator_put(sensor->vdd);
513527
return ret;
@@ -517,9 +531,11 @@ static int mpu6050_power_deinit(struct mpu6050_sensor *sensor)
517531
{
518532
int ret = 0;
519533

534+
#ifndef CONFIG_MACH_WT88047
520535
if (regulator_count_voltages(sensor->vlogic) > 0)
521536
regulator_set_voltage(sensor->vlogic, 0, MPU6050_VLOGIC_MAX_UV);
522537
regulator_put(sensor->vlogic);
538+
#endif
523539
if (regulator_count_voltages(sensor->vdd) > 0)
524540
regulator_set_voltage(sensor->vdd, 0, MPU6050_VDD_MAX_UV);
525541
regulator_put(sensor->vdd);

0 commit comments

Comments
 (0)