aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMisael Lopez Cruz <misael.lopez@ti.com>2012-03-05 18:18:38 -0600
committerZiyann <jaraidaniel@gmail.com>2014-10-03 01:18:00 +0200
commita4161f85acc29eb8391f548dccd95811142cb8ab (patch)
tree7938e5ae1ff185b4b88de683fd517601f9a1a78d /sound
parentd1b50349879cc469d2cdb3f9a41d51a491b009d0 (diff)
downloadkernel_samsung_tuna-a4161f85acc29eb8391f548dccd95811142cb8ab.tar.gz
kernel_samsung_tuna-a4161f85acc29eb8391f548dccd95811142cb8ab.tar.bz2
kernel_samsung_tuna-a4161f85acc29eb8391f548dccd95811142cb8ab.zip
ASoC: twl6040: Reduce i2c writes during power mode change
Replace direct i2c writes to TWL6040 by calls to snd_soc_update_bits() which prevents unnecessary i2c writes when reg cache and hardware are in sync. Change-Id: I8bb02d83fb419a478707d33498a95efa6e98a45c Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> Conflicts: sound/soc/codecs/twl6040.c
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/twl6040.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 3f28e82db5a..ab14f47041d 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -783,20 +783,18 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf)
{
int hslctl, hsrctl;
int mask = TWL6040_HSDRVMODEL | TWL6040_HSDACMODEL;
+ int val;
- hslctl = twl6040_read_reg_cache(codec, TWL6040_REG_HSLCTL);
- hsrctl = twl6040_read_reg_cache(codec, TWL6040_REG_HSRCTL);
+ hslctl = snd_soc_read(codec, TWL6040_REG_HSLCTL);
+ hsrctl = snd_soc_read(codec, TWL6040_REG_HSRCTL);
- if (high_perf) {
- hslctl &= ~mask;
- hsrctl &= ~mask;
- } else {
- hslctl |= mask;
- hsrctl |= mask;
- }
+ if (high_perf)
+ val = 0;
+ else
+ val = mask;
- twl6040_write(codec, TWL6040_REG_HSLCTL, hslctl);
- twl6040_write(codec, TWL6040_REG_HSRCTL, hsrctl);
+ snd_soc_update_bits(codec, TWL6040_REG_HSLCTL, mask, val);
+ snd_soc_update_bits(codec, TWL6040_REG_HSRCTL, mask, val);
return 0;
}