Skip to content

Commit

Permalink
ASoC: max98095: Convert codec->hw_write to snd_soc_write
Browse files Browse the repository at this point in the history
codec->hw_write is broken now, convert codec->hw_write to snd_soc_write.

The hardware has 2 banks of registers sharing a section in I2C register space.
The 1st bank is the primary one and is cached.
The 2nd bank is for loading coefficients only and they do not need cache.
These coefficients registers are therefore direct writes.
Thus we set cache_bypass flag to deal with this before calling snd_soc_write.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Oct 22, 2011
1 parent 226d0f2 commit 0d8d293
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sound/soc/codecs/max98095.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,14 +617,13 @@ static int max98095_volatile(struct snd_soc_codec *codec, unsigned int reg)
static int max98095_hw_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value)
{
u8 data[2];
int ret;

data[0] = reg;
data[1] = value;
if (codec->hw_write(codec->control_data, data, 2) == 2)
return 0;
else
return -EIO;
codec->cache_bypass = 1;
ret = snd_soc_write(codec, reg, value);
codec->cache_bypass = 0;

return ret ? -EIO : 0;
}

/*
Expand Down

0 comments on commit 0d8d293

Please sign in to comment.