Skip to content

Commit

Permalink
ASoC: stac9766: Remove register paging support
Browse files Browse the repository at this point in the history
The AC'97 standard defines paging support for the register range 0x60-0x6f.
Meaning registers in this window are mapped to different physical registers
depending on the setting of the page select register (0x24).

The stac9766 implements support for switching between page 0 and page 1
depending on the addressed register. But the driver never accesses any
registers from page 1, in addition page 0 is the page selected by default.

Considering the development history it is unlikely that the driver will see
any new features that require paging support. Removing the paging support
makes transitioning the driver to regmap a bit more straight forward.

The default register value table is update to contain the values from page
0, rather than page 1.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Nov 4, 2016
1 parent 355602e commit 2bea8f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
16 changes: 2 additions & 14 deletions sound/soc/codecs/stac9766.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ static const u16 stac9766_reg[] = {
0x0000, 0x0000, 0x0003, 0xffff, /* 4e */
0x0000, 0x0000, 0x0000, 0x0000, /* 56 */
0x4000, 0x0000, 0x0000, 0x0000, /* 5e */
0x1201, 0xFFFF, 0xFFFF, 0x0000, /* 66 */
0x0000, 0x0000, 0x0000, 0x0000, /* 6e */
0x1201, 0x0000, 0x0000, 0x0000, /* 66 */
0x0000, 0x0000, 0x0000, 0x1000, /* 6e */
0x0000, 0x0000, 0x0000, 0x0006, /* 76 */
0x0000, 0x0000, 0x0000, 0x0000, /* 7e */
};
Expand Down Expand Up @@ -145,12 +145,6 @@ static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg,
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
u16 *cache = codec->reg_cache;

if (reg > AC97_STAC_PAGE0) {
stac9766_ac97_write(codec, AC97_INT_PAGING, 0);
soc_ac97_ops->write(ac97, reg, val);
stac9766_ac97_write(codec, AC97_INT_PAGING, 1);
return 0;
}
if (reg / 2 >= ARRAY_SIZE(stac9766_reg))
return -EIO;

Expand All @@ -165,12 +159,6 @@ static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec,
struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
u16 val = 0, *cache = codec->reg_cache;

if (reg > AC97_STAC_PAGE0) {
stac9766_ac97_write(codec, AC97_INT_PAGING, 0);
val = soc_ac97_ops->read(ac97, reg - AC97_STAC_PAGE0);
stac9766_ac97_write(codec, AC97_INT_PAGING, 1);
return val;
}
if (reg / 2 >= ARRAY_SIZE(stac9766_reg))
return -EIO;

Expand Down
5 changes: 2 additions & 3 deletions sound/soc/codecs/stac9766.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
#ifndef _STAC9766_H
#define _STAC9766_H

#define AC97_STAC_PAGE0 0x1000
#define AC97_STAC_DA_CONTROL (AC97_STAC_PAGE0 | 0x6A)
#define AC97_STAC_ANALOG_SPECIAL (AC97_STAC_PAGE0 | 0x6E)
#define AC97_STAC_DA_CONTROL 0x6A
#define AC97_STAC_ANALOG_SPECIAL 0x6E
#define AC97_STAC_STEREO_MIC 0x78

#endif

0 comments on commit 2bea8f9

Please sign in to comment.