Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270849
b: refs/heads/master
c: 31b402e
h: refs/heads/master
i:
  270847: abf67a1
v: v3
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Oct 12, 2011
1 parent 97fbfed commit 2534ab0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e036f65329901a2432c92132b785654944743d9
refs/heads/master: 31b402e3c9eb839a00530511dcf7de47bbf723f6
19 changes: 15 additions & 4 deletions trunk/drivers/mfd/twl6040-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,24 @@
#include <linux/mfd/core.h>
#include <linux/mfd/twl6040.h>

#define VIBRACTRL_MEMBER(reg) ((reg == TWL6040_REG_VIBCTLL) ? 0 : 1)

int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
{
int ret;
u8 val = 0;

mutex_lock(&twl6040->io_mutex);
ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg);
if (ret < 0) {
mutex_unlock(&twl6040->io_mutex);
return ret;
/* Vibra control registers from cache */
if (unlikely(reg == TWL6040_REG_VIBCTLL ||
reg == TWL6040_REG_VIBCTLR)) {
val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)];
} else {
ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg);
if (ret < 0) {
mutex_unlock(&twl6040->io_mutex);
return ret;
}
}
mutex_unlock(&twl6040->io_mutex);

Expand All @@ -57,6 +65,9 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val)

mutex_lock(&twl6040->io_mutex);
ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg);
/* Cache the vibra control registers */
if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR)
twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val;
mutex_unlock(&twl6040->io_mutex);

return ret;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mfd/twl6040.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ struct twl6040 {
int audpwron;
int power_count;
int rev;
u8 vibra_ctrl_cache[2];

int pll;
unsigned int sysclk;
Expand Down

0 comments on commit 2534ab0

Please sign in to comment.