diff options
-rw-r--r-- | drivers/mfd/twl6040-core.c | 23 | ||||
-rw-r--r-- | include/linux/mfd/twl6040.h | 1 |
2 files changed, 3 insertions, 21 deletions
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index 4ded9e7aa24..5f620ae3b1f 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
@@ -64,19 +64,15 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | |||
64 | int ret; | 64 | int ret; |
65 | unsigned int val; | 65 | unsigned int val; |
66 | 66 | ||
67 | mutex_lock(&twl6040->io_mutex); | ||
68 | /* Vibra control registers from cache */ | 67 | /* Vibra control registers from cache */ |
69 | if (unlikely(reg == TWL6040_REG_VIBCTLL || | 68 | if (unlikely(reg == TWL6040_REG_VIBCTLL || |
70 | reg == TWL6040_REG_VIBCTLR)) { | 69 | reg == TWL6040_REG_VIBCTLR)) { |
71 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; | 70 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; |
72 | } else { | 71 | } else { |
73 | ret = regmap_read(twl6040->regmap, reg, &val); | 72 | ret = regmap_read(twl6040->regmap, reg, &val); |
74 | if (ret < 0) { | 73 | if (ret < 0) |
75 | mutex_unlock(&twl6040->io_mutex); | ||
76 | return ret; | 74 | return ret; |
77 | } | ||
78 | } | 75 | } |
79 | mutex_unlock(&twl6040->io_mutex); | ||
80 | 76 | ||
81 | return val; | 77 | return val; |
82 | } | 78 | } |
@@ -86,12 +82,10 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val) | |||
86 | { | 82 | { |
87 | int ret; | 83 | int ret; |
88 | 84 | ||
89 | mutex_lock(&twl6040->io_mutex); | ||
90 | ret = regmap_write(twl6040->regmap, reg, val); | 85 | ret = regmap_write(twl6040->regmap, reg, val); |
91 | /* Cache the vibra control registers */ | 86 | /* Cache the vibra control registers */ |
92 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) | 87 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) |
93 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; | 88 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; |
94 | mutex_unlock(&twl6040->io_mutex); | ||
95 | 89 | ||
96 | return ret; | 90 | return ret; |
97 | } | 91 | } |
@@ -99,23 +93,13 @@ EXPORT_SYMBOL(twl6040_reg_write); | |||
99 | 93 | ||
100 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 94 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
101 | { | 95 | { |
102 | int ret; | 96 | return regmap_update_bits(twl6040->regmap, reg, mask, mask); |
103 | |||
104 | mutex_lock(&twl6040->io_mutex); | ||
105 | ret = regmap_update_bits(twl6040->regmap, reg, mask, mask); | ||
106 | mutex_unlock(&twl6040->io_mutex); | ||
107 | return ret; | ||
108 | } | 97 | } |
109 | EXPORT_SYMBOL(twl6040_set_bits); | 98 | EXPORT_SYMBOL(twl6040_set_bits); |
110 | 99 | ||
111 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 100 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
112 | { | 101 | { |
113 | int ret; | 102 | return regmap_update_bits(twl6040->regmap, reg, mask, 0); |
114 | |||
115 | mutex_lock(&twl6040->io_mutex); | ||
116 | ret = regmap_update_bits(twl6040->regmap, reg, mask, 0); | ||
117 | mutex_unlock(&twl6040->io_mutex); | ||
118 | return ret; | ||
119 | } | 103 | } |
120 | EXPORT_SYMBOL(twl6040_clear_bits); | 104 | EXPORT_SYMBOL(twl6040_clear_bits); |
121 | 105 | ||
@@ -573,7 +557,6 @@ static int __devinit twl6040_probe(struct i2c_client *client, | |||
573 | twl6040->irq = client->irq; | 557 | twl6040->irq = client->irq; |
574 | 558 | ||
575 | mutex_init(&twl6040->mutex); | 559 | mutex_init(&twl6040->mutex); |
576 | mutex_init(&twl6040->io_mutex); | ||
577 | init_completion(&twl6040->ready); | 560 | init_completion(&twl6040->ready); |
578 | 561 | ||
579 | twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV); | 562 | twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV); |
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h index 6659487c31e..dcc0e12b803 100644 --- a/include/linux/mfd/twl6040.h +++ b/include/linux/mfd/twl6040.h | |||
@@ -206,7 +206,6 @@ struct twl6040 { | |||
206 | struct regmap *regmap; | 206 | struct regmap *regmap; |
207 | struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */ | 207 | struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */ |
208 | struct mutex mutex; | 208 | struct mutex mutex; |
209 | struct mutex io_mutex; | ||
210 | struct mutex irq_mutex; | 209 | struct mutex irq_mutex; |
211 | struct mfd_cell cells[TWL6040_CELLS]; | 210 | struct mfd_cell cells[TWL6040_CELLS]; |
212 | struct completion ready; | 211 | struct completion ready; |