summaryrefslogtreecommitdiffstats
path: root/sound/arm/pxa2xx-ac97.c
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2017-09-02 15:54:06 -0400
committerMark Brown <broonie@kernel.org>2017-09-04 13:24:56 -0400
commit6f8acad646d29fbf5665a6e0c9adae71c3c2131e (patch)
tree872fbd3a3e4c81e523424eecb68ba94cc03285f2 /sound/arm/pxa2xx-ac97.c
parent8d43344108c9945456128b75b69beee594b64ed6 (diff)
ASoC: arm: make pxa2xx-ac97-lib ac97 codec agnostic
All pxa library functions don't use the input parameters for nothing but slot number. This simplifies their prototypes, and makes them usable by both the legacy ac97 bus and the new ac97 bus. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/arm/pxa2xx-ac97.c')
-rw-r--r--sound/arm/pxa2xx-ac97.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index fbd5dad0c484..4bc244c40f80 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -29,19 +29,38 @@
29 29
30#include "pxa2xx-pcm.h" 30#include "pxa2xx-pcm.h"
31 31
32static void pxa2xx_ac97_reset(struct snd_ac97 *ac97) 32static void pxa2xx_ac97_legacy_reset(struct snd_ac97 *ac97)
33{ 33{
34 if (!pxa2xx_ac97_try_cold_reset(ac97)) { 34 if (!pxa2xx_ac97_try_cold_reset())
35 pxa2xx_ac97_try_warm_reset(ac97); 35 pxa2xx_ac97_try_warm_reset();
36 } 36
37 pxa2xx_ac97_finish_reset();
38}
39
40static unsigned short pxa2xx_ac97_legacy_read(struct snd_ac97 *ac97,
41 unsigned short reg)
42{
43 int ret;
44
45 ret = pxa2xx_ac97_read(ac97->num, reg);
46 if (ret < 0)
47 return 0;
48 else
49 return (unsigned short)(ret & 0xffff);
50}
51
52static void pxa2xx_ac97_legacy_write(struct snd_ac97 *ac97,
53 unsigned short reg, unsigned short val)
54{
55 int __always_unused ret;
37 56
38 pxa2xx_ac97_finish_reset(ac97); 57 ret = pxa2xx_ac97_write(ac97->num, reg, val);
39} 58}
40 59
41static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { 60static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
42 .read = pxa2xx_ac97_read, 61 .read = pxa2xx_ac97_legacy_read,
43 .write = pxa2xx_ac97_write, 62 .write = pxa2xx_ac97_legacy_write,
44 .reset = pxa2xx_ac97_reset, 63 .reset = pxa2xx_ac97_legacy_reset,
45}; 64};
46 65
47static struct pxad_param pxa2xx_ac97_pcm_out_req = { 66static struct pxad_param pxa2xx_ac97_pcm_out_req = {