Commit d4754ec9 authored by Dimitris Papastamos's avatar Dimitris Papastamos Committed by Mark Brown

ASoC: Update users of readable_register()/volatile_register()

Signed-off-by: default avatarDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 066d16c3
...@@ -529,8 +529,8 @@ struct snd_soc_codec_driver { ...@@ -529,8 +529,8 @@ struct snd_soc_codec_driver {
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
int (*display_register)(struct snd_soc_codec *, char *, int (*display_register)(struct snd_soc_codec *, char *,
size_t, unsigned int); size_t, unsigned int);
int (*volatile_register)(unsigned int); int (*volatile_register)(struct snd_soc_codec *, unsigned int);
int (*readable_register)(unsigned int); int (*readable_register)(struct snd_soc_codec *, unsigned int);
short reg_cache_size; short reg_cache_size;
short reg_cache_step; short reg_cache_step;
short reg_word_size; short reg_word_size;
......
...@@ -193,12 +193,12 @@ static struct cs4270_mode_ratios cs4270_mode_ratios[] = { ...@@ -193,12 +193,12 @@ static struct cs4270_mode_ratios cs4270_mode_ratios[] = {
/* The number of MCLK/LRCK ratios supported by the CS4270 */ /* The number of MCLK/LRCK ratios supported by the CS4270 */
#define NUM_MCLK_RATIOS ARRAY_SIZE(cs4270_mode_ratios) #define NUM_MCLK_RATIOS ARRAY_SIZE(cs4270_mode_ratios)
static int cs4270_reg_is_readable(unsigned int reg) static int cs4270_reg_is_readable(struct snd_soc_codec *codec, unsigned int reg)
{ {
return (reg >= CS4270_FIRSTREG) && (reg <= CS4270_LASTREG); return (reg >= CS4270_FIRSTREG) && (reg <= CS4270_LASTREG);
} }
static int cs4270_reg_is_volatile(unsigned int reg) static int cs4270_reg_is_volatile(struct snd_soc_codec *codec, unsigned int reg)
{ {
/* Unreadable registers are considered volatile */ /* Unreadable registers are considered volatile */
if ((reg < CS4270_FIRSTREG) || (reg > CS4270_LASTREG)) if ((reg < CS4270_FIRSTREG) || (reg > CS4270_LASTREG))
......
...@@ -608,7 +608,7 @@ static struct { ...@@ -608,7 +608,7 @@ static struct {
{ 0xFF, 0x00, 1 }, /* FF */ { 0xFF, 0x00, 1 }, /* FF */
}; };
static int max98088_volatile_register(unsigned int reg) static int max98088_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
return max98088_access[reg].vol; return max98088_access[reg].vol;
} }
......
...@@ -58,7 +58,7 @@ static const u16 wm8523_reg[WM8523_REGISTER_COUNT] = { ...@@ -58,7 +58,7 @@ static const u16 wm8523_reg[WM8523_REGISTER_COUNT] = {
0x0000, /* R8 - ZERO_DETECT */ 0x0000, /* R8 - ZERO_DETECT */
}; };
static int wm8523_volatile_register(unsigned int reg) static int wm8523_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8523_DEVICE_ID: case WM8523_DEVICE_ID:
......
...@@ -175,7 +175,7 @@ static int txsrc_put(struct snd_kcontrol *kcontrol, ...@@ -175,7 +175,7 @@ static int txsrc_put(struct snd_kcontrol *kcontrol,
return 0; return 0;
} }
static int wm8804_volatile(unsigned int reg) static int wm8804_volatile(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8804_RST_DEVID1: case WM8804_RST_DEVID1:
......
...@@ -180,7 +180,7 @@ static const u16 wm8900_reg_defaults[WM8900_MAXREG] = { ...@@ -180,7 +180,7 @@ static const u16 wm8900_reg_defaults[WM8900_MAXREG] = {
/* Remaining registers all zero */ /* Remaining registers all zero */
}; };
static int wm8900_volatile_register(unsigned int reg) static int wm8900_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8900_REG_ID: case WM8900_REG_ID:
......
...@@ -232,7 +232,7 @@ struct wm8903_priv { ...@@ -232,7 +232,7 @@ struct wm8903_priv {
int mic_delay; int mic_delay;
}; };
static int wm8903_volatile_register(unsigned int reg) static int wm8903_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8903_SW_RESET_AND_ID: case WM8903_SW_RESET_AND_ID:
......
...@@ -596,7 +596,7 @@ static struct { ...@@ -596,7 +596,7 @@ static struct {
{ 0x003F, 0x003F, 0 }, /* R248 - FLL NCO Test 1 */ { 0x003F, 0x003F, 0 }, /* R248 - FLL NCO Test 1 */
}; };
static int wm8904_volatile_register(unsigned int reg) static int wm8904_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
return wm8904_access[reg].vol; return wm8904_access[reg].vol;
} }
......
...@@ -291,7 +291,7 @@ struct wm8961_priv { ...@@ -291,7 +291,7 @@ struct wm8961_priv {
int sysclk; int sysclk;
}; };
static int wm8961_volatile_register(unsigned int reg) static int wm8961_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8961_SOFTWARE_RESET: case WM8961_SOFTWARE_RESET:
......
...@@ -1938,7 +1938,7 @@ static const struct wm8962_reg_access { ...@@ -1938,7 +1938,7 @@ static const struct wm8962_reg_access {
[21139] = { 0xFFFF, 0xFFFF, 0x0000 }, /* R21139 - VSS_XTS32_0 */ [21139] = { 0xFFFF, 0xFFFF, 0x0000 }, /* R21139 - VSS_XTS32_0 */
}; };
static int wm8962_volatile_register(unsigned int reg) static int wm8962_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
if (wm8962_reg_access[reg].vol) if (wm8962_reg_access[reg].vol)
return 1; return 1;
...@@ -1946,7 +1946,7 @@ static int wm8962_volatile_register(unsigned int reg) ...@@ -1946,7 +1946,7 @@ static int wm8962_volatile_register(unsigned int reg)
return 0; return 0;
} }
static int wm8962_readable_register(unsigned int reg) static int wm8962_readable_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
if (wm8962_reg_access[reg].read) if (wm8962_reg_access[reg].read)
return 1; return 1;
......
...@@ -242,7 +242,7 @@ struct wm8993_priv { ...@@ -242,7 +242,7 @@ struct wm8993_priv {
int fll_src; int fll_src;
}; };
static int wm8993_volatile(unsigned int reg) static int wm8993_volatile(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8993_SOFTWARE_RESET: case WM8993_SOFTWARE_RESET:
......
...@@ -109,7 +109,7 @@ struct wm8994_priv { ...@@ -109,7 +109,7 @@ struct wm8994_priv {
struct wm8994_pdata *pdata; struct wm8994_pdata *pdata;
}; };
static int wm8994_readable(unsigned int reg) static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8994_GPIO_1: case WM8994_GPIO_1:
...@@ -136,7 +136,7 @@ static int wm8994_readable(unsigned int reg) ...@@ -136,7 +136,7 @@ static int wm8994_readable(unsigned int reg)
return wm8994_access_masks[reg].readable != 0; return wm8994_access_masks[reg].readable != 0;
} }
static int wm8994_volatile(unsigned int reg) static int wm8994_volatile(struct snd_soc_codec *codec, unsigned int reg)
{ {
if (reg >= WM8994_CACHE_SIZE) if (reg >= WM8994_CACHE_SIZE)
return 1; return 1;
...@@ -164,7 +164,7 @@ static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -164,7 +164,7 @@ static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg,
BUG_ON(reg > WM8994_MAX_REGISTER); BUG_ON(reg > WM8994_MAX_REGISTER);
if (!wm8994_volatile(reg)) { if (!wm8994_volatile(codec, reg)) {
ret = snd_soc_cache_write(codec, reg, value); ret = snd_soc_cache_write(codec, reg, value);
if (ret != 0) if (ret != 0)
dev_err(codec->dev, "Cache write to %x failed: %d\n", dev_err(codec->dev, "Cache write to %x failed: %d\n",
...@@ -182,7 +182,7 @@ static unsigned int wm8994_read(struct snd_soc_codec *codec, ...@@ -182,7 +182,7 @@ static unsigned int wm8994_read(struct snd_soc_codec *codec,
BUG_ON(reg > WM8994_MAX_REGISTER); BUG_ON(reg > WM8994_MAX_REGISTER);
if (!wm8994_volatile(reg) && wm8994_readable(reg) && if (!wm8994_volatile(codec, reg) && wm8994_readable(codec, reg) &&
reg < codec->driver->reg_cache_size) { reg < codec->driver->reg_cache_size) {
ret = snd_soc_cache_read(codec, reg, &val); ret = snd_soc_cache_read(codec, reg, &val);
if (ret >= 0) if (ret >= 0)
...@@ -2943,7 +2943,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) ...@@ -2943,7 +2943,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
/* Read our current status back from the chip - we don't want to /* Read our current status back from the chip - we don't want to
* reset as this may interfere with the GPIO or LDO operation. */ * reset as this may interfere with the GPIO or LDO operation. */
for (i = 0; i < WM8994_CACHE_SIZE; i++) { for (i = 0; i < WM8994_CACHE_SIZE; i++) {
if (!wm8994_readable(i) || wm8994_volatile(i)) if (!wm8994_readable(codec, i) || wm8994_volatile(codec, i))
continue; continue;
ret = wm8994_reg_read(codec->control_data, i); ret = wm8994_reg_read(codec->control_data, i);
......
...@@ -909,7 +909,7 @@ static const struct snd_soc_dapm_route wm8995_intercon[] = { ...@@ -909,7 +909,7 @@ static const struct snd_soc_dapm_route wm8995_intercon[] = {
{ "SPK2R", NULL, "SPK2R Driver" } { "SPK2R", NULL, "SPK2R Driver" }
}; };
static int wm8995_volatile(unsigned int reg) static int wm8995_volatile(struct snd_soc_codec *codec, unsigned int reg)
{ {
/* out of bounds registers are generally considered /* out of bounds registers are generally considered
* volatile to support register banks that are partially * volatile to support register banks that are partially
......
...@@ -169,7 +169,7 @@ struct wm9081_priv { ...@@ -169,7 +169,7 @@ struct wm9081_priv {
struct wm9081_retune_mobile_config *retune; struct wm9081_retune_mobile_config *retune;
}; };
static int wm9081_volatile_register(unsigned int reg) static int wm9081_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM9081_SOFTWARE_RESET: case WM9081_SOFTWARE_RESET:
......
...@@ -144,7 +144,7 @@ struct wm9090_priv { ...@@ -144,7 +144,7 @@ struct wm9090_priv {
void *control_data; void *control_data;
}; };
static int wm9090_volatile(unsigned int reg) static int wm9090_volatile(struct snd_soc_codec *codec, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM9090_SOFTWARE_RESET: case WM9090_SOFTWARE_RESET:
...@@ -518,7 +518,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, ...@@ -518,7 +518,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
for (i = 1; i < codec->driver->reg_cache_size; i++) { for (i = 1; i < codec->driver->reg_cache_size; i++) {
if (reg_cache[i] == wm9090_reg_defaults[i]) if (reg_cache[i] == wm9090_reg_defaults[i])
continue; continue;
if (wm9090_volatile(i)) if (wm9090_volatile(codec, i))
continue; continue;
ret = snd_soc_write(codec, i, reg_cache[i]); ret = snd_soc_write(codec, i, reg_cache[i]);
......
...@@ -84,7 +84,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf) ...@@ -84,7 +84,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)
count += sprintf(buf, "%s registers\n", codec->name); count += sprintf(buf, "%s registers\n", codec->name);
for (i = 0; i < codec->driver->reg_cache_size; i += step) { for (i = 0; i < codec->driver->reg_cache_size; i += step) {
if (codec->driver->readable_register && !codec->driver->readable_register(i)) if (codec->driver->readable_register && !codec->driver->readable_register(codec, i))
continue; continue;
count += sprintf(buf + count, "%2x: ", i); count += sprintf(buf + count, "%2x: ", i);
...@@ -2030,7 +2030,7 @@ static int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -2030,7 +2030,7 @@ static int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg) int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg)
{ {
if (codec->driver->volatile_register) if (codec->driver->volatile_register)
return codec->driver->volatile_register(reg); return codec->driver->volatile_register(codec, reg);
else else
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment