Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270639
b: refs/heads/master
c: d17bf31
h: refs/heads/master
i:
  270637: 770d615
  270635: d9bb05a
  270631: 239e02e
  270623: 2f53ec4
v: v3
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Sep 22, 2011
1 parent 3fde381 commit f14c70d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 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: 5bf692d97225a1e714cfd40a9a67401ebd630a7b
refs/heads/master: d17bf31832d30b91225a84b53fae380dbdd07d3d
2 changes: 0 additions & 2 deletions trunk/include/linux/mfd/twl6040.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@
#define TWL6040_REG_ACCCTL 0x2D
#define TWL6040_REG_STATUS 0x2E

#define TWL6040_CACHEREGNUM (TWL6040_REG_STATUS + 1)

/* INTID (0x03) fields */

#define TWL6040_THINT 0x01
Expand Down
19 changes: 16 additions & 3 deletions trunk/sound/soc/codecs/twl6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
#define TWL6040_HF_VOL_MASK 0x1F
#define TWL6040_HF_VOL_SHIFT 0

/* Shadow register used by the driver */
#define TWL6040_REG_SW_SHADOW 0x2F
#define TWL6040_CACHEREGNUM (TWL6040_REG_SW_SHADOW + 1)

struct twl6040_output {
u16 active;
u16 left_vol;
Expand Down Expand Up @@ -153,6 +157,8 @@ static const u8 twl6040_reg[TWL6040_CACHEREGNUM] = {
0x00, /* REG_HFOTRIM 0x2C */
0x09, /* REG_ACCCTL 0x2D */
0x00, /* REG_STATUS 0x2E (ro) */

0x00, /* REG_SW_SHADOW 0x2F - Shadow, non HW register */
};

/* List of registers to be restored after power up */
Expand Down Expand Up @@ -236,8 +242,12 @@ static int twl6040_read_reg_volatile(struct snd_soc_codec *codec,
if (reg >= TWL6040_CACHEREGNUM)
return -EIO;

value = twl6040_reg_read(twl6040, reg);
twl6040_write_reg_cache(codec, reg, value);
if (likely(reg < TWL6040_REG_SW_SHADOW)) {
value = twl6040_reg_read(twl6040, reg);
twl6040_write_reg_cache(codec, reg, value);
} else {
value = twl6040_read_reg_cache(codec, reg);
}

return value;
}
Expand All @@ -254,7 +264,10 @@ static int twl6040_write(struct snd_soc_codec *codec,
return -EIO;

twl6040_write_reg_cache(codec, reg, value);
return twl6040_reg_write(twl6040, reg, value);
if (likely(reg < TWL6040_REG_SW_SHADOW))
return twl6040_reg_write(twl6040, reg, value);
else
return 0;
}

static void twl6040_init_chip(struct snd_soc_codec *codec)
Expand Down

0 comments on commit f14c70d

Please sign in to comment.