mirror of
https://github.com/torvalds/linux.git
synced 2024-11-30 08:01:59 +00:00
ASoC: tlv320aic3x: Switch to soc-cache helpers
Continue phasing out aic3x_read_reg_cache, aic3x_write_reg_cache, aic3x_read and aic3x_write calls. This patch takes the soc-cache in use and removes aic3x_read_reg_cache and aic3x_write. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
This commit is contained in:
parent
e18eca4303
commit
a84a441ba3
@ -111,18 +111,6 @@ static const u8 aic3x_reg[AIC3X_CACHEREGNUM] = {
|
||||
0x00, 0x00, 0x02, /* 100 */
|
||||
};
|
||||
|
||||
/*
|
||||
* read aic3x register cache
|
||||
*/
|
||||
static inline unsigned int aic3x_read_reg_cache(struct snd_soc_codec *codec,
|
||||
unsigned int reg)
|
||||
{
|
||||
u8 *cache = codec->reg_cache;
|
||||
if (reg >= AIC3X_CACHEREGNUM)
|
||||
return -1;
|
||||
return cache[reg];
|
||||
}
|
||||
|
||||
/*
|
||||
* write aic3x register cache
|
||||
*/
|
||||
@ -135,28 +123,6 @@ static inline void aic3x_write_reg_cache(struct snd_soc_codec *codec,
|
||||
cache[reg] = value;
|
||||
}
|
||||
|
||||
/*
|
||||
* write to the aic3x register space
|
||||
*/
|
||||
static int aic3x_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int value)
|
||||
{
|
||||
u8 data[2];
|
||||
|
||||
/* data is
|
||||
* D15..D8 aic3x register offset
|
||||
* D7...D0 register data
|
||||
*/
|
||||
data[0] = reg & 0xff;
|
||||
data[1] = value & 0xff;
|
||||
|
||||
aic3x_write_reg_cache(codec, data[0], data[1]);
|
||||
if (codec->hw_write(codec->control_data, data, 2) == 2)
|
||||
return 0;
|
||||
else
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
* read from the aic3x register space
|
||||
*/
|
||||
@ -1299,10 +1265,16 @@ static int aic3x_init(struct snd_soc_codec *codec)
|
||||
static int aic3x_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->hw_write = (hw_write_t) i2c_master_send;
|
||||
codec->control_data = aic3x->control_data;
|
||||
|
||||
ret = snd_soc_codec_set_cache_io(codec, 8, 8, aic3x->control_type);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
aic3x_init(codec);
|
||||
|
||||
if (aic3x->setup) {
|
||||
@ -1330,8 +1302,6 @@ static int aic3x_remove(struct snd_soc_codec *codec)
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_aic3x = {
|
||||
.read = aic3x_read_reg_cache,
|
||||
.write = aic3x_write,
|
||||
.set_bias_level = aic3x_set_bias_level,
|
||||
.reg_cache_size = ARRAY_SIZE(aic3x_reg),
|
||||
.reg_word_size = sizeof(u8),
|
||||
@ -1375,6 +1345,8 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
|
||||
}
|
||||
|
||||
aic3x->control_data = i2c;
|
||||
aic3x->control_type = SND_SOC_I2C;
|
||||
|
||||
i2c_set_clientdata(i2c, aic3x);
|
||||
if (pdata) {
|
||||
aic3x->gpio_reset = pdata->gpio_reset;
|
||||
|
Loading…
Reference in New Issue
Block a user